:root {
  --fj-bg: #ecfdf5;
  --fj-surface: #fff;
  --fj-text: #1a202c;
  --fj-muted: #64748b;
  --fj-primary: #059669;
  --fj-primary-hover: #047857;
  --fj-danger: #c53030;
  --fj-danger-hover: #9b2c2c;
  --fj-success-bg: #f0fff4;
  --fj-success-border: #9ae6b4;
  --fj-warn-bg: #fffaf0;
  --fj-warn-border: #fbd38d;
  --fj-radius: 14px;
  --fj-shadow: 0 8px 24px rgba(26, 54, 93, 0.08);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

body.fj-body {
  margin: 0;
  min-height: 100dvh;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: var(--fj-bg);
  color: var(--fj-text);
}

.fj-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.85rem 1rem;
  background: var(--fj-surface);
  border-bottom: 1px solid #e2e8f0;
  position: sticky;
  top: 0;
  z-index: 10;
}

.fj-top__brand {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  min-width: 0;
  overflow: hidden;
}

.fj-top__brand .brand-logo-frame,
.fj-top__brand .brand-logo-frame--fichaje {
  display: inline-flex;
  align-items: center;
  flex-shrink: 0;
  max-height: 52px;
  overflow: hidden;
  background: linear-gradient(165deg, #047857 0%, #064e3b 100%);
  border-radius: 10px;
  padding: 0.28rem 0.32rem;
  box-shadow: 0 2px 8px rgba(6, 78, 59, 0.22);
}

.fj-top__brand .brand-logo,
.fj-top__brand .brand-logo--fichaje,
.fj-top__brand img {
  display: block;
  height: 40px;
  width: auto;
  max-width: min(156px, 44vw);
  max-height: 40px;
  padding: 0.12rem 0.22rem;
  background: #ffffff;
  border-radius: 7px;
  object-fit: contain;
  box-sizing: content-box;
}

.fj-top__user {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 0.9rem;
}

.fj-top__name {
  font-weight: 600;
}

.fj-top__exit {
  color: var(--fj-primary);
  text-decoration: none;
  font-weight: 600;
}

.fj-main {
  max-width: 520px;
  margin: 0 auto;
  padding: 1.25rem 1rem 2rem;
}

.fj-body--working {
  background: #ecfdf5;
}

.fj-back {
  display: inline-block;
  margin-bottom: 0.85rem;
  color: var(--fj-primary);
  text-decoration: none;
  font-weight: 600;
  font-size: 0.9rem;
}

.fj-panel--working {
  border: 2px solid #38a169;
  box-shadow: 0 12px 32px rgba(56, 161, 105, 0.18);
}

.fj-picker-form {
  margin-top: 1rem;
}

.fj-picker-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(148px, 1fr));
  gap: 0.75rem;
}

.fj-picker-item {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.35rem;
  min-height: 4.5rem;
  padding: 0.95rem 1rem;
  border: 2px solid #e2e8f0;
  border-radius: 14px;
  background: #fff;
  cursor: pointer;
  text-align: left;
  text-decoration: none;
  color: inherit;
  font: inherit;
  appearance: none;
  -webkit-appearance: none;
  transition: border-color 0.15s, background 0.15s, transform 0.1s;
}

.fj-picker-item:active {
  transform: scale(0.98);
}

.fj-picker-item__name {
  font-size: 1rem;
  font-weight: 700;
  color: var(--fj-text);
  line-height: 1.25;
}

.fj-picker-item__badge {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 0.2rem 0.45rem;
  border-radius: 999px;
  background: #c6f6d5;
  color: #22543d;
}

.fj-picker-item__badge--done {
  background: #e2e8f0;
  color: #4a5568;
}

.fj-picker-item__badge--new {
  background: #ecfdf5;
  color: #047857;
}

.fj-picker-item--trabajando {
  border-color: #38a169;
  background: #f0fff4;
}

.fj-picker-item--completado {
  border-color: #cbd5e0;
  background: #f7fafc;
}

.fj-picker-item--pendiente:hover {
  border-color: var(--fj-primary);
  background: #ebf8ff;
}

.fj-status--working {
  background: #c6f6d5;
  border: 2px solid #38a169;
  text-align: center;
  padding: 1.35rem 1rem;
}

.fj-status--working .fj-status__icon {
  display: block;
  font-size: 2rem;
  color: #38a169;
  line-height: 1;
  margin-bottom: 0.35rem;
  animation: fj-pulse 1.6s ease-in-out infinite;
}

.fj-status--working .fj-status__label {
  color: #22543d;
  font-size: 0.95rem;
}

.fj-status--working .fj-status__value {
  color: #1a4731;
  font-size: 1.2rem;
}

@keyframes fj-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.45; }
}

.fj-flash-list {
  list-style: none;
  margin: 0;
  padding: 0.75rem 1rem 0;
  max-width: 480px;
  margin-inline: auto;
}

.fj-flash {
  padding: 0.75rem 1rem;
  border-radius: 10px;
  margin-bottom: 0.5rem;
  font-size: 0.95rem;
}

.fj-flash--success {
  background: var(--fj-success-bg);
  border: 1px solid var(--fj-success-border);
}

.fj-flash--error {
  background: #fff5f5;
  border: 1px solid #feb2b2;
}

.fj-auth,
.fj-panel {
  background: var(--fj-surface);
  border-radius: var(--fj-radius);
  box-shadow: var(--fj-shadow);
  padding: 1.5rem 1.25rem;
}

.fj-auth__title,
.fj-panel__title {
  margin: 0 0 0.35rem;
  font-size: 1.5rem;
  color: var(--fj-primary);
}

.fj-auth__sub,
.fj-panel__sub {
  margin: 0 0 1.25rem;
  color: var(--fj-muted);
}

.fj-form,
.fj-actions {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.fj-field {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.fj-field__label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--fj-muted);
}

.fj-input {
  width: 100%;
  padding: 0.85rem 0.95rem;
  border: 1px solid #cbd5e0;
  border-radius: 10px;
  font-size: 1rem;
  background: #fff;
}

.fj-input--select {
  appearance: none;
}

.fj-centro-tag {
  display: inline-block;
  margin: 0;
  padding: 0.35rem 0.65rem;
  border-radius: 999px;
  background: #ebf4ff;
  color: var(--fj-primary);
  font-size: 0.85rem;
  font-weight: 600;
}

.fj-note {
  margin: 0;
  font-size: 0.88rem;
  color: var(--fj-muted);
  line-height: 1.45;
}

.fj-note--warn {
  color: #c05621;
}

.fj-empty {
  margin-top: 1rem;
  padding: 1.25rem 1rem;
  border-radius: 12px;
  background: #fffbeb;
  border: 2px solid #fbbf24;
  text-align: center;
}

.fj-empty__title {
  margin: 0 0 0.65rem;
  font-size: 1.15rem;
  font-weight: 700;
  color: #92400e;
}

.fj-empty__text {
  margin: 0 0 0.75rem;
  font-size: 0.95rem;
  line-height: 1.5;
  color: #78350f;
}

.fj-empty__hint {
  margin: 0;
  font-size: 0.88rem;
  color: var(--fj-muted);
  line-height: 1.45;
}

.fj-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: none;
  border-radius: 12px;
  padding: 0.85rem 1.1rem;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  text-decoration: none;
}

.fj-btn--primary {
  background: var(--fj-primary);
  color: #fff;
}

.fj-btn--primary:hover {
  background: var(--fj-primary-hover);
}

.fj-btn--danger {
  background: var(--fj-danger);
  color: #fff;
}

.fj-btn--danger:hover {
  background: var(--fj-danger-hover);
}

.fj-btn--xl {
  min-height: 4.5rem;
  font-size: 1.15rem;
  width: 100%;
}

.fj-status {
  border-radius: 12px;
  padding: 1rem;
  margin-bottom: 1.25rem;
}

.fj-status--open {
  background: #ebf8ff;
  border: 1px solid #90cdf4;
}

.fj-status--done {
  background: var(--fj-success-bg);
  border: 1px solid var(--fj-success-border);
}

.fj-status--idle {
  background: var(--fj-warn-bg);
  border: 1px solid var(--fj-warn-border);
}

.fj-status__label {
  display: block;
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--fj-muted);
  margin-bottom: 0.25rem;
}

.fj-status__value {
  display: block;
  font-size: 1.05rem;
  font-weight: 600;
}

.fj-install {
  margin-top: 1.25rem;
  background: var(--fj-surface);
  border-radius: var(--fj-radius);
  box-shadow: var(--fj-shadow);
  padding: 1.25rem;
  text-align: center;
}

.fj-install__title {
  margin: 0 0 0.35rem;
  font-size: 1.1rem;
  color: var(--fj-primary);
}

.fj-install__sub {
  margin: 0 0 1rem;
  color: var(--fj-muted);
  font-size: 0.9rem;
}

.pwa-install-qr__url {
  word-break: break-all;
  font-size: 0.8rem;
}

.pwa-install-qr__url a {
  color: var(--fj-primary);
}
