:root {
  --bg: #f4f5f7;
  --surface: #ffffff;
  --text: #111827;
  --muted: #6b7280;
  --border: #e5e7eb;
  --primary: #ea580c;
  --primary-dark: #c2410c;
  --primary-soft: #ffedd5;
  --success: #15803d;
  --success-soft: #dcfce7;
  --danger: #b91c1c;
  --danger-dark: #991b1b;
  --danger-soft: #fee2e2;
  --radius: 14px;
  --shadow: 0 1px 3px rgba(0,0,0,.06), 0 4px 12px rgba(0,0,0,.04);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1115;
    --surface: #1a1d24;
    --text: #f3f4f6;
    --muted: #9ca3af;
    --border: #2b3039;
    --primary: #fb923c;
    --primary-dark: #f97316;
    --primary-soft: #431407;
    --danger: #ef4444;
    --danger-dark: #dc2626;
    --danger-soft: #3b1414;
    --success: #4ade80;
    --success-soft: #14321f;
    --shadow: none;
  }
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.45;
  padding-bottom: env(safe-area-inset-bottom);
}
body.has-nav { padding-bottom: calc(72px + env(safe-area-inset-bottom)); }
body.modal-open { overflow: hidden; }

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0,0,0,0); border: 0;
}

/* Header */
.topbar {
  background: #1f2937;
  color: #fff;
  padding-top: env(safe-area-inset-top);
  position: sticky;
  top: 0;
  z-index: 10;
}
.topbar-inner {
  max-width: 760px;
  margin: 0 auto;
  padding: 12px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.brand { display: flex; align-items: center; min-width: 0; }
.brand-logo { height: 38px; width: auto; display: block; }
.print-only { display: none; }
.date-pill {
  font-size: 12px; font-weight: 600;
  background: rgba(255,255,255,.12);
  padding: 6px 10px; border-radius: 999px;
  white-space: nowrap;
}

/* Layout */
.container {
  max-width: 760px;
  margin: 0 auto;
  padding: 16px 16px 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow);
}
.card h2 { margin: 0 0 12px; font-size: 16px; }
.card > .field + .field, .card > form .field + .field { margin-top: 12px; }
.muted { color: var(--muted); margin: 0; }
.small { font-size: 12px; margin-top: 10px; }

/* Role switch */
.role-switch {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 1fr;
  gap: 10px;
}
.role-switch + .field { margin-top: 12px; }
.role-btn {
  padding: 12px 10px;
  border-radius: 10px;
  border: 2px solid var(--border);
  background: transparent;
  color: var(--text);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: border-color .15s, background .15s;
}
.role-btn[aria-selected="true"] {
  border-color: var(--primary);
  background: var(--primary);
  color: #fff;
}

/* Fields */
.field { display: flex; flex-direction: column; gap: 6px; }
.field span { font-size: 13px; font-weight: 600; color: var(--muted); }
.field input, .field textarea {
  font: inherit;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  width: 100%;
}
.field textarea { resize: vertical; min-height: 80px; }
.field input:focus, .field textarea:focus {
  outline: 2px solid var(--primary);
  outline-offset: 1px;
}

/* Shift tabs */
.shift-tabs {
  display: flex;
  gap: 6px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 6px;
  box-shadow: var(--shadow);
}
.shift-tab {
  flex: 1;
  padding: 10px 6px;
  border: none;
  border-radius: 10px;
  background: transparent;
  color: var(--muted);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}
.shift-tab[aria-selected="true"] {
  background: #1f2937;
  color: #fff;
}
a.shift-tab { text-decoration: none; }
.shift-tabs.plain { border: none; box-shadow: none; padding: 0; margin: 12px 0; background: transparent; }
.shift-tab .dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--border);
}
.shift-tab .dot.partial { background: #f59e0b; }
.shift-tab .dot.done { background: var(--success); }

/* Progress */
.progress-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}
.progress-head strong { font-size: 15px; }
.progress-percent { font-size: 22px; font-weight: 800; }
.progress-bar {
  height: 10px;
  border-radius: 999px;
  background: var(--border);
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  width: 0;
  background: var(--primary);
  border-radius: 999px;
  transition: width .25s ease;
}
.progress-card.complete .progress-fill { background: var(--success); }
.progress-card.complete .progress-percent { color: var(--success); }

/* Checklist */
.checklist { display: flex; flex-direction: column; gap: 14px; }
.section-card { padding: 0; overflow: hidden; }
.section-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  background: var(--bg);
}
.section-head h3 { margin: 0; font-size: 14px; text-transform: uppercase; letter-spacing: .04em; }
.section-count { font-size: 12px; color: var(--muted); font-weight: 600; }

.task {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  -webkit-tap-highlight-color: transparent;
}
.task-check { display: flex; cursor: pointer; padding: 2px 4px 2px 0; margin: -2px -4px -2px 0; }
.task-open {
  all: unset; display: block; box-sizing: border-box; flex: 1; min-width: 0;
  cursor: pointer; border-radius: 8px; padding: 0 4px; margin: 0 -4px;
  font: inherit; color: inherit;
}
.task-open:active { background: var(--bg); }
.task-open:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.task-more { color: var(--muted); font-size: 13px; margin-left: 6px; }
.task-note-preview {
  margin-top: 4px; font-size: 12px; color: var(--muted);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.sheet h3 { font-size: 17px; line-height: 1.35; margin: 0; }
.sheet-details { margin: 0; font-size: 14px; white-space: pre-wrap; background: var(--bg); padding: 10px; border-radius: 8px; }
.editor-details { resize: vertical; min-height: 40px; font-size: 13px; }
.task:last-child { border-bottom: none; }
.task input { position: absolute; opacity: 0; width: 0; height: 0; }
.checkbox {
  flex-shrink: 0;
  width: 26px; height: 26px;
  border-radius: 8px;
  border: 2px solid var(--muted);
  display: grid; place-items: center;
  margin-top: 1px;
  transition: background .15s, border-color .15s;
}
.checkbox svg { width: 16px; height: 16px; opacity: 0; stroke: #fff; }
.checkbox.camera svg { width: 17px; height: 17px; opacity: 1; stroke: var(--muted); }
.task-text { flex: 1; font-size: 15px; }
.task-meta { font-size: 11px; color: var(--muted); margin-top: 8px; }
.task.done .checkbox { background: var(--success); border-color: var(--success); }
.task.done .checkbox svg { opacity: 1; }
.task.done .task-label { color: var(--muted); text-decoration: line-through; }
.task input:focus-visible + .checkbox { outline: 2px solid var(--primary); outline-offset: 2px; }

/* Actions */
.actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.btn {
  font: inherit;
  font-weight: 600;
  padding: 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
}
.btn:active { transform: scale(.98); }
.btn-primary {
  grid-column: 1 / -1;
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}
.btn-primary:disabled { opacity: .5; cursor: not-allowed; }
.btn-danger { color: var(--danger); grid-column: 1 / -1; }

/* History */
.history { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 6px; }
.history { gap: 8px; }
.history li {
  display: flex; justify-content: space-between; gap: 12px;
  font-size: 13px;
  padding: 10px 12px;
  border-radius: 10px;
  background: var(--bg);
}
.history li span:last-child { color: var(--muted); white-space: nowrap; }
.history-empty { color: var(--muted); font-size: 13px; }

/* Toast */
.toast {
  position: fixed;
  left: 50%;
  bottom: calc(24px + env(safe-area-inset-bottom));
  transform: translateX(-50%) translateY(20px);
  background: #111827;
  color: #fff;
  padding: 10px 16px;
  border-radius: 999px;
  font-size: 14px;
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s, transform .2s;
  z-index: 20;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
body.has-nav .toast { bottom: calc(88px + env(safe-area-inset-bottom)); }

@media (min-width: 600px) {
  .actions { grid-template-columns: repeat(3, 1fr); }
  .btn-primary { grid-column: 1 / -1; }
  .btn-danger { grid-column: auto; }
}

/* Print */
@media print {
  body { background: #fff; color: #000; }
  .topbar { position: static; background: #fff; color: #000; }
  .date-pill { background: none; border: 1px solid #000; }
  .role-switch, .shift-tabs, .actions, #history-card, .toast { display: none !important; }
  .card, .section-card { box-shadow: none; border-color: #999; break-inside: avoid; }
  .task { break-inside: avoid; }
  .task.done .task-label { color: #000; }
  .checkbox { border-color: #000; }
  .task.done .checkbox { background: #000; }
}

/* Layout helpers */
.stack { display: flex; flex-direction: column; gap: 16px; }
.card.stack, .auth-card, .sheet { gap: 14px; }
.row { display: flex; gap: 10px; align-items: flex-end; flex-wrap: wrap; }
.row .field { flex: 1; min-width: 180px; }
.row.between { justify-content: space-between; align-items: center; margin-top: 10px; }
.center { text-align: center; }
.group-title { margin: 6px 0 0; font-size: 16px; }
a { color: var(--primary); }
.error {
  margin: 0; padding: 10px 12px; border-radius: 10px;
  background: var(--danger-soft); color: var(--danger-dark); font-size: 14px;
}
@media (prefers-color-scheme: dark) { .error { color: #fca5a5; } }

/* Header */
.topbar-right { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.user-chip { all: unset; display: inline-flex; cursor: pointer; border-radius: 50%; }
.user-chip:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }
a.brand { text-decoration: none; color: inherit; }
.back-link { display: inline-block; font-weight: 600; text-decoration: none; font-size: 14px; }
.user-chip .avatar { border: 2px solid rgba(255,255,255,.85); }
.avatar.sm { width: 30px; height: 30px; font-size: 11px; }

/* Auth */
.auth-wrap { display: flex; flex-direction: column; align-items: center; gap: 20px; padding-top: 20px; }
.auth-logo { width: 170px; height: auto; }
.auth-logo.dark-only { display: none; }
@media (prefers-color-scheme: dark) {
  .auth-logo.light-only { display: none; }
  .auth-logo.dark-only { display: block; }
}
.auth-card { width: 100%; max-width: 420px; display: flex; flex-direction: column; gap: 12px; }
.auth-card h2 { margin: 0; font-size: 20px; }
.auth-card .btn-primary { grid-column: auto; }
.field select {
  font: inherit; padding: 10px 12px; border-radius: 10px;
  border: 1px solid var(--border); background: var(--bg); color: var(--text); width: 100%;
}

/* Bottom nav */
.bottom-nav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 10;
  display: flex;
  background: var(--surface);
  border-top: 1px solid var(--border);
  padding-bottom: env(safe-area-inset-bottom);
}
.bottom-nav a {
  flex: 1; display: flex; flex-direction: column; align-items: center; gap: 4px;
  padding: 10px 4px 9px; font-size: 12px; font-weight: 600;
  color: var(--muted); text-decoration: none;
}
.nav-icon {
  display: block; width: 24px; height: 24px; background: currentColor;
  -webkit-mask: var(--nav-mask) center / contain no-repeat; mask: var(--nav-mask) center / contain no-repeat;
}
.nav-icon-lists { --nav-mask: url("../icons/nav-lists.png"); }
.nav-icon-admin { --nav-mask: url("../icons/nav-admin.png"); }
.nav-icon-history { --nav-mask: url("../icons/nav-history.png"); }
.bottom-nav a.active { color: var(--primary); }
.bottom-nav a[hidden] { display: none; }

/* Photos */
.photo-badge {
  display: inline-block; margin-left: 8px; font-size: 11px; font-weight: 600;
  color: var(--primary-dark); background: var(--primary-soft);
  padding: 2px 8px; border-radius: 999px; vertical-align: middle;
}
@media (prefers-color-scheme: dark) { .photo-badge { color: #fdba74; } }
.thumb {
  display: block; margin-top: 8px;
  width: 96px; height: 72px; object-fit: cover;
  border-radius: 8px; border: 1px solid var(--border); cursor: zoom-in;
}
.photo-view { display: flex; flex-direction: column; gap: 12px; align-items: center; }
.photo-view img { max-width: 100%; max-height: 70vh; border-radius: 10px; }

/* Modal */
.modal-backdrop {
  position: fixed; inset: 0; z-index: 30;
  background: rgba(0,0,0,.6);
  display: flex; align-items: center; justify-content: center; padding: 16px;
}
.modal-backdrop[hidden] { display: none; }
.modal {
  background: var(--surface); color: var(--text);
  border-radius: var(--radius); padding: 20px;
  width: 100%; max-width: 520px; max-height: 90vh; overflow: auto;
}
.modal h3 { margin: 0 0 10px; }
.summary { white-space: pre-wrap; font-size: 12px; background: var(--bg); padding: 10px; border-radius: 8px; }

/* Buttons */
.btn-small { padding: 7px 10px; font-size: 13px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.icon-btn {
  width: 36px; height: 36px; flex-shrink: 0;
  border-radius: 8px; border: 1px solid var(--border);
  background: var(--surface); color: var(--text);
  font-size: 15px; cursor: pointer;
}
.icon-btn:disabled { opacity: .35; cursor: not-allowed; }
.icon-btn.on { background: var(--primary-soft); border-color: var(--primary); }
.icon-btn svg { width: 18px; height: 18px; stroke: var(--muted); vertical-align: middle; }
.icon-btn.on svg { stroke: var(--primary-dark); }

/* Dashboard */
.dash-card.complete .progress-percent { color: var(--success); }
.progress-bar.complete .progress-fill { background: var(--success); }
.details { margin-top: 12px; border-top: 1px solid var(--border); padding-top: 12px; }
.detail-title { margin: 0 0 6px; font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.detail-list { list-style: none; margin: 0; padding: 0; }
.detail-list li { display: flex; gap: 10px; padding: 10px 0; font-size: 14px; border-bottom: 1px solid var(--border); }
.detail-list li:last-child { border-bottom: none; }
.detail-mark { width: 22px; flex-shrink: 0; text-align: center; color: var(--muted); font-weight: 700; }
.detail-list li.done .detail-mark { color: var(--success); }
.detail-body { flex: 1; }
.notes-text { margin: 0; white-space: pre-wrap; font-size: 14px; background: var(--bg); padding: 10px; border-radius: 8px; }

/* Checklist editor */
.editor-section { display: flex; flex-direction: column; gap: 8px; }
.editor-row { display: flex; gap: 6px; align-items: center; }
.editor-row.head { padding-bottom: 6px; border-bottom: 1px solid var(--border); }
.editor-input {
  flex: 1; min-width: 0; font: inherit; padding: 8px 10px;
  border-radius: 8px; border: 1px solid var(--border);
  background: var(--bg); color: var(--text);
}
.editor-input.strong { font-weight: 700; text-transform: uppercase; letter-spacing: .03em; font-size: 13px; }
.editor-input:focus { outline: 2px solid var(--primary); outline-offset: 1px; }

/* Users */
.user-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 12px; }
.user-row {
  display: flex; flex-direction: column; gap: 12px;
  padding: 14px; border-radius: 12px; background: var(--bg); min-width: 0;
}
.user-info { display: flex; flex-direction: column; }
/* Identity: avatar, then the name on its own line and the details on their own lines. */
.user-identity { display: flex; gap: 12px; align-items: flex-start; min-width: 0; }
.user-text { display: flex; flex-direction: column; gap: 3px; min-width: 0; flex: 1; }
.user-name { font-size: 15px; line-height: 1.3; overflow-wrap: anywhere; }
.user-meta { font-size: 13px; line-height: 1.35; color: var(--muted); overflow-wrap: anywhere; margin: 0; }
/* Controls: one column on phones, two from 560px, one ergonomic row on wide screens. */
.user-actions { display: grid; grid-template-columns: 1fr; gap: 8px; align-items: stretch; min-width: 0; }
.user-actions > * { min-width: 0; }
.user-actions .btn { white-space: normal; overflow-wrap: anywhere; }
@media (min-width: 560px) { .user-actions { grid-template-columns: 1fr 1fr; } }
@media (min-width: 720px) {
  .user-row:not(.loc-row) .user-actions { grid-template-columns: minmax(205px, 1.4fr) minmax(165px, 1.2fr) auto auto; align-items: center; }
}
.user-actions select {
  font: inherit; font-size: 13px; padding: 7px 8px; border-radius: 8px;
  border: 1px solid var(--border); background: var(--surface); color: var(--text);
}
.user-row .btn-danger { grid-column: auto; }

@media print {
  .bottom-nav, .user-chip, .modal-backdrop, .photo-badge, .screen-only { display: none !important; }
  .print-only { display: block; }
  body.has-nav { padding-bottom: 0; }
  .thumb { width: 160px; height: 120px; }
}

/* Sí / No answers */
.no-btn {
  flex-shrink: 0; align-self: center;
  font: inherit; font-size: 12px; font-weight: 700;
  padding: 6px 10px; border-radius: 999px;
  border: 1px solid var(--border); background: var(--surface); color: var(--muted);
  cursor: pointer;
}
.no-btn.on { background: var(--danger-soft); border-color: var(--danger); color: var(--danger-dark); }
.no-btn:disabled { opacity: .4; cursor: not-allowed; }
@media (prefers-color-scheme: dark) { .no-btn.on { color: #fca5a5; } }
.task.flagged .checkbox { background: var(--danger); border-color: var(--danger); color: #fff; font-weight: 800; font-size: 15px; }
.task.flagged .task-label { text-decoration: none; color: var(--text); }
.task-note, .detail-list .task-note {
  margin-top: 6px; padding: 8px 10px; border-radius: 8px;
  background: var(--danger-soft); color: var(--text); font-size: 13px; white-space: pre-wrap;
}
.detail-list li.flagged .detail-mark { color: var(--danger); }
.modal .actions { grid-template-columns: 1fr; gap: 10px; margin-top: 4px; }

/* Shift tabs scroll when there are many (weekly routine) */
.shift-tabs { flex-wrap: wrap; }
.shift-tab { flex: 1 1 auto; min-width: 0; white-space: nowrap; padding-left: 10px; padding-right: 10px; }
.today-tag {
  font-size: 10px; text-transform: uppercase; letter-spacing: .05em;
  background: var(--primary); color: #fff; padding: 1px 6px; border-radius: 999px;
}
.empty-note { padding: 28px 16px; }

/* Priority */
.task-tags { display: inline-flex; flex-wrap: wrap; gap: 6px; margin-left: 8px; vertical-align: middle; }
.task-tags .photo-badge { margin-left: 0; }
.prio-tag, .prio-value {
  display: inline-block; font-size: 11px; font-weight: 700;
  padding: 2px 8px; border-radius: 999px; white-space: nowrap;
  background: var(--border); color: var(--muted);
}
.prio-tag.p5, .prio-value.p5 { background: #c2410c; color: #fff; }
.prio-tag.p4, .prio-value.p4 { background: #fed7aa; color: #7c2d12; }
.prio-tag.p3, .prio-value.p3 { background: #fde68a; color: #78350f; }
.prio-tag.p2, .prio-value.p2 { background: #d1fae5; color: #065f46; }
.prio-tag.p1, .prio-value.p1 { background: var(--border); color: var(--muted); }
@media (prefers-color-scheme: dark) {
  .prio-tag.p4, .prio-value.p4 { background: #7c2d12; color: #fed7aa; }
  .prio-tag.p3, .prio-value.p3 { background: #78350f; color: #fde68a; }
  .prio-tag.p2, .prio-value.p2 { background: #065f46; color: #d1fae5; }
}
.task.done .prio-tag { opacity: .6; }
.editor-task { display: flex; flex-direction: column; gap: 6px; padding-bottom: 8px; border-bottom: 1px dashed var(--border); }
.editor-task:last-of-type { border-bottom: none; }
.prio-row { display: flex; align-items: center; gap: 8px; padding-left: 2px; }
.prio-end { font-size: 10px; color: var(--muted); white-space: nowrap; }
.prio-slider { flex: 1; min-width: 80px; accent-color: var(--primary); margin: 0; }
.prio-value { min-width: 58px; text-align: center; }

/* Avatars */
.avatar { width: 32px; height: 32px; border-radius: 50%; object-fit: cover; flex-shrink: 0; display: inline-grid; place-items: center; vertical-align: middle; overflow: hidden; line-height: 1; }
.avatar.xs { width: 22px; height: 22px; }
.avatar.md { width: 44px; height: 44px; }
.avatar.initials { background: var(--primary); color: #fff; font-weight: 700; font-size: 11px; letter-spacing: 0; }
.avatar.xs.initials { font-size: 10px; }
.avatar.sm.initials { font-size: 11px; }
.avatar.md.initials { font-size: 15px; }
.task-meta { display: flex; align-items: center; gap: 8px; }
.avatar-picker { display: flex; align-items: center; gap: 12px; }
.avatar-preview { width: 64px; height: 64px; border-radius: 50%; overflow: hidden; background: var(--bg); border: 2px dashed var(--border); display: grid; place-items: center; flex-shrink: 0; }
.avatar-preview img { width: 100%; height: 100%; object-fit: cover; }
.avatar-placeholder { display: grid; place-items: center; } .avatar-placeholder svg { width: 26px; height: 26px; stroke: var(--muted); }
.avatar-actions { display: flex; flex-direction: column; gap: 4px; }

/* Locations */
.loc-label { margin: 0; font-size: 13px; font-weight: 700; color: var(--muted); }
.loc-title { margin: 8px 0 0; font-size: 18px; }
.loc-group { padding-top: 4px; border-top: 2px solid var(--border); }
.loc-group:first-of-type { border-top: none; padding-top: 0; }
.workers { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.worker { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; font-weight: 600; background: var(--bg); padding: 3px 8px 3px 4px; border-radius: 999px; }
.user-info.with-avatar { flex-direction: row; align-items: center; gap: 10px; }
.user-info.grow { flex: 1; min-width: 160px; }

/* Success button */
.btn-success { background: var(--success); border-color: var(--success); color: #fff; }

/* Admin: one card per restaurant */
.restaurant-head { display: flex; justify-content: space-between; align-items: center; gap: 14px; margin-bottom: 10px; }
.restaurant-name { margin: 0; font-size: 18px; }
.dash-lists { display: flex; flex-direction: column; gap: 10px; }
.dash-group .detail-title { margin: 8px 0 4px; }
.dash-row { border-top: 1px solid var(--border); }
.dash-row.empty { display: flex; justify-content: space-between; gap: 10px; padding: 8px 0; }
.dash-row-btn {
  all: unset; box-sizing: border-box; display: grid; width: 100%;
  grid-template-columns: 1fr auto; grid-template-rows: auto auto; column-gap: 10px; row-gap: 6px;
  align-items: center; padding: 9px 0; cursor: pointer; font: inherit; color: inherit;
}
.dash-row-btn:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; border-radius: 6px; }
.dash-row-main { display: flex; flex-direction: column; min-width: 0; }
.dash-row-label { font-weight: 700; font-size: 14px; }
.dash-row-status { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dash-row.complete .dash-row-status { color: var(--success); }
.dash-row-btn .progress-bar { grid-column: 1; height: 6px; }
.dash-row-side { grid-column: 2; grid-row: 1 / 3; display: flex; align-items: center; gap: 8px; }
.dash-avatars { display: flex; }
.dash-avatars .avatar { margin-left: -6px; border: 2px solid var(--surface); box-sizing: content-box; }
.dash-avatars .avatar:first-child { margin-left: 0; }
.dash-pct { font-weight: 800; font-size: 15px; min-width: 40px; text-align: right; }
.dash-row.complete .dash-pct { color: var(--success); }
.chev { color: var(--muted); font-size: 20px; line-height: 1; transition: transform .15s; }
.dash-row-btn[aria-expanded="true"] .chev { transform: rotate(90deg); }
.dash-row .details { margin-top: 0; border-top: none; padding: 4px 0 12px; }

/* Pickers (replace native select) */
.picker {
  all: unset; box-sizing: border-box; display: flex; align-items: center; gap: 8px; width: 100%;
  padding: 10px 12px; border-radius: 10px; border: 1px solid var(--border);
  background: var(--bg); color: var(--text); font: inherit; cursor: pointer; text-align: left;
}
.picker:focus-visible { outline: 2px solid var(--primary); outline-offset: 1px; }
.picker:disabled { opacity: .55; cursor: not-allowed; }
.picker-label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.picker.empty .picker-label { color: var(--muted); }
.picker-chev, .picker-icon { display: inline-flex; flex-shrink: 0; }
.picker-chev svg, .picker-icon svg { width: 18px; height: 18px; stroke: var(--muted); }
.user-actions .picker { width: 100%; max-width: none; padding: 8px 10px; font-size: 13px; }
.option-list { display: flex; flex-direction: column; gap: 6px; max-height: 55vh; overflow: auto; }
.option {
  all: unset; box-sizing: border-box; display: flex; justify-content: space-between; align-items: center; gap: 10px;
  padding: 12px 14px; border-radius: 10px; background: var(--bg); font: inherit; color: var(--text); cursor: pointer;
}
.option:focus-visible { outline: 2px solid var(--primary); }
.option.selected { background: var(--primary-soft); font-weight: 700; }
.option-check svg { width: 18px; height: 18px; stroke: var(--primary-dark); }
.inline-link { display: inline-block; margin-top: 12px; font-size: 14px; font-weight: 600; text-decoration: none; }

/* Calendar */
.cal-head { display: flex; justify-content: space-between; align-items: center; }
.cal-head strong { font-size: 15px; }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.cal-dow { text-align: center; font-size: 11px; font-weight: 700; color: var(--muted); padding: 4px 0; }
.cal-day {
  all: unset; box-sizing: border-box; text-align: center; padding: 10px 0; border-radius: 10px;
  font: inherit; font-weight: 600; color: var(--text); cursor: pointer;
}
.cal-day:hover { background: var(--bg); }
.cal-day:focus-visible { outline: 2px solid var(--primary); }
.cal-day.today { box-shadow: inset 0 0 0 2px var(--primary); }
.cal-day.selected { background: var(--primary); color: #fff; }
.cal-day:disabled { opacity: .3; cursor: not-allowed; }

/* Restaurants admin */
.loc-row { flex-direction: column; align-items: stretch; }
.loc-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
@media (max-width: 480px) { .loc-fields { grid-template-columns: 1fr; } }
.restaurant-where { margin: 0; font-size: 13px; color: var(--muted); }

/* Checkbox groups (list visibility) */
.check-group { display: flex; flex-wrap: wrap; gap: 8px; }
.check-option {
  display: inline-flex; align-items: center; gap: 8px; padding: 8px 12px;
  border-radius: 10px; border: 1px solid var(--border); background: var(--bg); font-size: 14px; cursor: pointer;
}
.check-option input { width: 18px; height: 18px; accent-color: var(--primary); margin: 0; }

/* Restaurant icons */
.loc-icon { width: 30px; height: 30px; object-fit: contain; flex-shrink: 0; display: inline-block; vertical-align: middle; }
.loc-icon.sm { width: 26px; height: 26px; }
.loc-icon.lg { width: 60px; height: 60px; }
.loc-icon.initials { display: inline-grid; place-items: center; border-radius: 8px; background: var(--border); color: var(--muted); font-weight: 800; font-size: 13px; }
.loc-icon.lg.initials { border-radius: 14px; font-size: 22px; }
.icon-btn-wrap { all: unset; display: inline-flex; cursor: pointer; border-radius: 12px; }
.icon-btn-wrap:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.icon-sheet-preview { width: 140px; height: 140px; margin: 0 auto; display: grid; place-items: center; }
.icon-sheet-preview .loc-icon { width: 140px; height: 140px; }
.icon-sheet-preview .loc-icon.initials { font-size: 48px; border-radius: 24px; }
.loc-label { display: flex; align-items: center; gap: 8px; }
.loc-head { display: flex; align-items: center; gap: 12px; }
.restaurant-head { align-items: center; }
.restaurant-head .grow { flex: 1; min-width: 0; }
.picker-icon-slot { display: inline-flex; flex-shrink: 0; }
.picker-icon-slot:empty { display: none; }
.option-main { display: inline-flex; align-items: center; gap: 10px; min-width: 0; }
.icon-preview { width: 64px; height: 64px; border-radius: 14px; overflow: hidden; background: var(--bg); border: 2px dashed var(--border); display: grid; place-items: center; flex-shrink: 0; }
.icon-preview img { width: 100%; height: 100%; object-fit: contain; }

/* People chips and profile sheet */
.who { all: unset; display: inline-flex; align-items: center; gap: 6px; cursor: pointer; border-radius: 999px; font-size: 12px; font-weight: 600; color: var(--text); }
.who:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.who.chip { background: var(--bg); padding: 3px 10px 3px 3px; }
.who.chip:active { background: var(--border); }
.task-meta .who { font-size: 12px; }
.team { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 6px 0 14px; }
.team-label { font-size: 12px; font-weight: 700; color: var(--muted); }
.avatar.xl { width: 84px; height: 84px; font-size: 30px; margin: 0 auto; }
.profile-sheet { text-align: center; }
.profile-sheet h3 { margin: 0; }

/* List editor: settings sit directly under the list tabs */
.list-settings { display: flex; flex-direction: column; gap: 12px; padding: 14px; border-radius: 12px; background: var(--bg); border: 1px solid var(--border); }
.list-settings .field input { background: var(--surface); }
.list-settings .check-option { background: var(--surface); }
.list-settings .row.between { margin-top: 2px; }

.screen-title { margin: 0; font-size: 18px; }
.nav-icon-weekly { --nav-mask: url("../icons/nav-weekly.png"); }

/* Weekday circles on the Semanal tab */
.shift-tabs.days { justify-content: space-between; flex-wrap: nowrap; gap: 4px; padding: 8px; }
.shift-tab.day {
  flex: 1 1 0; min-width: 0; max-width: 48px; aspect-ratio: 1; padding: 0;
  border-radius: 50%; font-size: 15px; font-weight: 800; display: grid; place-items: center;
}
.shift-tab.day.today { color: var(--primary); box-shadow: inset 0 0 0 2px var(--primary); }
.shift-tab.day[aria-selected="true"] { background: #1f2937; color: #fff; }
.shift-tab.day.today[aria-selected="true"] { background: var(--primary); color: #fff; box-shadow: none; }

.photo-preview { display: block; width: 100%; max-height: 40vh; object-fit: contain; border-radius: 10px; background: var(--bg); }

/* Admin feedback on tasks: comments and recalls */
.task-feedback { display: flex; flex-direction: column; gap: 6px; margin-top: 8px; }
.comment-box, .recall-box { padding: 8px 10px; border-radius: 8px; font-size: 13px; line-height: 1.4; }
.comment-box { background: var(--bg); border-left: 3px solid var(--primary); }
.recall-box { background: var(--danger-soft); border-left: 3px solid var(--danger); }
.recall-box.resolved { opacity: .7; border-left-color: var(--muted); background: var(--bg); }
.comment-box strong, .recall-box strong { font-size: 12px; }
.task.recalled .checkbox { border-color: var(--danger); }
.task.recalled .task-label { color: var(--danger-dark); }
@media (prefers-color-scheme: dark) { .task.recalled .task-label { color: #fca5a5; } }
.detail-list li.recalled .detail-mark { color: var(--danger); }
.admin-row { display: flex; gap: 8px; margin-top: 8px; }
.btn-danger-solid { background: var(--danger); border-color: var(--danger); color: #fff; }

/* Task sheet layout */
.sheet-section { padding: 12px; border-radius: 12px; background: var(--bg); }
.sheet-section .detail-title { margin-top: 0; }
.row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.sheet-footer { display: flex; flex-direction: column; gap: 10px; margin-top: 4px; }
.sheet-footer .btn-primary, .sheet-footer .btn-success { grid-column: auto; }
.link-btn { all: unset; align-self: center; cursor: pointer; font-size: 14px; font-weight: 600; color: var(--muted); padding: 6px 10px; border-radius: 8px; }
.link-btn:hover, .link-btn:focus-visible { color: var(--danger); outline: none; }
.field > .muted.small { margin-top: -2px; }

/* Historial feed */
.feed { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.feed-item { display: flex; gap: 10px; align-items: flex-start; padding: 10px 0; border-bottom: 1px solid var(--border); font-size: 14px; }
.feed-item:last-child { border-bottom: none; }
.feed-mark { width: 18px; text-align: center; font-weight: 800; color: var(--muted); padding-top: 4px; }
.feed-item.done .feed-mark { color: var(--success); }
.feed-item.recalled .feed-mark { color: var(--danger); }
.feed-item.undone .feed-mark { color: var(--muted); }
.feed-item.undone .feed-main { color: var(--muted); }
.feed-item.shift .feed-mark { color: var(--primary); }
.feed-body { flex: 1; min-width: 0; }
.feed-main { line-height: 1.4; }
.feed-note { margin-top: 4px; padding: 6px 10px; border-radius: 8px; background: var(--danger-soft); font-size: 13px; }
.feed-meta { font-size: 12px; color: var(--muted); margin-top: 3px; }

/* Restaurant line in the header */
.header-loc {
  max-width: 760px; margin: 0 auto; padding: 0 16px 10px;
  display: flex; align-items: center; gap: 8px;
  font-size: 13px; font-weight: 600; color: rgba(255,255,255,.85);
}
.header-loc .loc-icon.initials { background: rgba(255,255,255,.15); color: #fff; }
.profile-locs { display: flex; flex-wrap: wrap; gap: 8px; margin: 6px 0 12px; }
.loc-chip { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px 4px 4px; border-radius: 999px; background: var(--bg); font-size: 13px; font-weight: 600; }
@media print { .header-loc { color: #000; } }

.profile-head { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.profile-head p { margin: 0; }
.profile-name { margin: 0 0 2px; font-size: 20px; }

/* Room between text boxes and the buttons after them */
.card form > .field + .btn, .card > .field + .btn, form > .field + .btn, .field + .btn, .error + .btn { margin-top: 18px; }
.auth-card .btn-primary { margin-top: 6px; }
.card form > .field + .field, form.card > .field + .field, .card > .field + .field { margin-top: 14px; }
form.card > .btn { margin-top: 18px; }
.card > form > .btn { margin-top: 18px; }
.avatar-picker + .field { margin-top: 16px; }

/* Settings list on the profile page */
.settings-list { display: flex; flex-direction: column; }
.settings-row {
  all: unset; box-sizing: border-box; display: flex; justify-content: space-between; align-items: center;
  width: 100%; padding: 14px 4px; border-bottom: 1px solid var(--border); cursor: pointer; font: inherit; font-weight: 600; color: var(--text);
}
.settings-row:last-child { border-bottom: none; }
.settings-row:active { background: var(--bg); }
.settings-row:focus-visible { outline: 2px solid var(--primary); border-radius: 8px; }
.settings-row.danger { color: var(--danger); }
.settings-row .chev { font-size: 22px; color: var(--muted); }


/* Sync status (offline / changes waiting to be sent) */
.sync-pill {
  font-size: 0.72rem;
  font-weight: 600;
  padding: 0.25rem 0.55rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.14);
  color: #fff;
  white-space: nowrap;
  max-width: 46vw;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sync-pill.offline { background: #b45309; }
.sync-pill.pending { background: rgba(255, 255, 255, 0.22); }
@media print { .sync-pill { display: none; } }

/* Busy state: spinner + status on the control that started the work (see withBusy in app.js) */
.is-busy { cursor: progress; opacity: .85; }
.btn.is-busy, .picker.is-busy { display: inline-flex; align-items: center; justify-content: center; gap: 8px; }
.spinner {
  width: 15px; height: 15px; flex-shrink: 0; border-radius: 50%;
  border: 2px solid currentColor; border-right-color: transparent;
  animation: spin .8s linear infinite;
}
.busy-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) {
  .spinner { animation: none; border-right-color: currentColor; border-style: dotted; }
  .btn:active { transform: none; }
}
form[aria-busy="true"] input, form[aria-busy="true"] textarea { opacity: .85; }

/* Video evidence */
.video-thumb {
  display: inline-flex; align-items: center; gap: 8px; margin-top: 8px;
  padding: 8px 12px; border-radius: 10px; border: 1px solid var(--border);
  background: var(--surface); color: var(--text); font: inherit; font-size: 13px; font-weight: 600; cursor: pointer;
  max-width: 100%;
}
.video-thumb .play { width: 26px; height: 26px; border-radius: 50%; background: var(--primary); color: #fff; display: grid; place-items: center; font-size: 12px; flex-shrink: 0; }
.video-thumb .muted { font-weight: 400; }
.video-player { width: 100%; max-height: 60vh; background: #000; border-radius: 10px; display: block; }
.video-preview { width: 100%; max-height: 45vh; background: #000; border-radius: 10px; display: block; }
.upload-progress { display: flex; flex-direction: column; gap: 6px; }
.upload-bar { height: 8px; border-radius: 999px; background: var(--border); overflow: hidden; }
.upload-bar > div { height: 100%; background: var(--primary); width: 0; transition: width .2s linear; }
@media (prefers-reduced-motion: reduce) { .upload-bar > div { transition: none; } }
.upload-note { font-size: 12px; color: var(--muted); margin: 0; }
.warn { font-size: 13px; color: #b45309; margin: 0; }
@media (prefers-color-scheme: dark) { .warn { color: #fdba74; } }
.media-choice { display: grid; gap: 10px; }
