:root {
  --bg: #f4f5f7;
  --panel: #ffffff;
  --ink: #1b2430;
  --muted: #6b7686;
  --line: #e4e7ec;
  --accent: #0b6e99;
  --accent-ink: #ffffff;
  --sidebar-bg: #14202e;
  --sidebar-ink: #c8d4e0;
  --open: #d9534f;
  --progress: #2f80ed;
  --done: #27a06a;
  --radius: 10px;
  font-size: 15px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
}
.hidden { display: none !important; }
button { cursor: pointer; font: inherit; }

/* ---------- login ---------- */
.login-screen {
  position: fixed; inset: 0; z-index: 50;
  display: flex; align-items: center; justify-content: center;
  background: radial-gradient(1200px 600px at 70% -10%, #1d3850 0%, #0e1722 55%, #0a111a 100%);
}
.login-card {
  background: rgba(255,255,255,.06);
  border: 1px solid rgba(255,255,255,.12);
  backdrop-filter: blur(8px);
  padding: 42px 46px; border-radius: 16px; text-align: center;
  width: min(380px, 92vw);
  color: #e8eef5;
}
.login-logo { font-size: 44px; margin-bottom: 8px; }
.login-card h1 { font-size: 26px; letter-spacing: .5px; }
.login-sub { color: #8fa3b8; font-size: 13px; margin: 6px 0 26px; }
.login-card input {
  width: 100%; padding: 12px 14px; border-radius: 8px;
  border: 1px solid rgba(255,255,255,.2); background: rgba(0,0,0,.25);
  color: #fff; font-size: 15px; outline: none;
}
.login-card input:focus { border-color: #4da3d0; }
.login-card button {
  width: 100%; margin-top: 14px; padding: 12px;
  border: 0; border-radius: 8px; background: var(--accent); color: #fff;
  font-weight: 600; font-size: 15px;
}
.login-card button:hover { filter: brightness(1.1); }
.login-error { color: #ff9b94; font-size: 13px; margin-top: 12px; min-height: 16px; }

/* ---------- layout ---------- */
.app { display: flex; min-height: 100vh; }
.sidebar {
  width: 270px; flex-shrink: 0;
  background: var(--sidebar-bg); color: var(--sidebar-ink);
  display: flex; flex-direction: column;
  padding: 22px 14px;
  position: sticky; top: 0; height: 100vh; overflow-y: auto;
}
.brand { display: flex; gap: 10px; align-items: center; padding: 0 8px 18px; border-bottom: 1px solid rgba(255,255,255,.08); }
.brand-icon { font-size: 26px; }
.brand-name { font-weight: 700; color: #fff; font-size: 16px; }
.brand-sub { font-size: 11.5px; color: #7d8fa3; }

.topic-nav { flex: 1; margin-top: 14px; display: flex; flex-direction: column; gap: 2px; }
.topic-link {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 10px; border-radius: 8px; color: var(--sidebar-ink);
  text-decoration: none; font-size: 14px;
}
.topic-link:hover { background: rgba(255,255,255,.06); }
.topic-link.active { background: rgba(77,163,208,.18); color: #fff; }
.topic-link .t-icon { width: 20px; text-align: center; }
.topic-link .t-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.badge {
  font-size: 11px; font-weight: 700; padding: 2px 7px; border-radius: 99px;
  background: rgba(217,83,79,.22); color: #ff9b94;
}
.badge.zero { background: rgba(39,160,106,.2); color: #7fd6ae; }

.sidebar-add, .sidebar-logout {
  margin-top: 8px; padding: 9px; border-radius: 8px; border: 1px dashed rgba(255,255,255,.22);
  background: transparent; color: var(--sidebar-ink); font-size: 13.5px;
}
.sidebar-add:hover { border-color: #4da3d0; color: #fff; }
.sidebar-logout { border-style: solid; border-color: transparent; color: #7d8fa3; }
.sidebar-logout:hover { color: #ff9b94; }

.main { flex: 1; padding: 30px 38px; max-width: 980px; }

/* ---------- page header ---------- */
.page-head { display: flex; align-items: flex-start; gap: 14px; margin-bottom: 6px; }
.page-icon { font-size: 34px; line-height: 1.2; }
.page-titles { flex: 1; }
.page-titles h2 { font-size: 24px; }
.page-desc { color: var(--muted); font-size: 13.5px; margin-top: 3px; }
.page-actions { display: flex; gap: 8px; }
.icon-btn {
  border: 1px solid var(--line); background: var(--panel); border-radius: 8px;
  padding: 7px 10px; font-size: 13px; color: var(--muted);
}
.icon-btn:hover { color: var(--ink); border-color: #c4ccd6; }
.icon-btn.danger:hover { color: var(--open); border-color: var(--open); }

.progress-bar { height: 6px; background: #e7ebf0; border-radius: 99px; overflow: hidden; margin: 16px 0 22px; }
.progress-fill { height: 100%; background: linear-gradient(90deg, #27a06a, #4dc592); transition: width .3s; }

/* ---------- composer ---------- */
.composer {
  display: flex; gap: 8px; margin-bottom: 26px;
}
.composer input {
  flex: 1; padding: 11px 14px; border: 1px solid var(--line); border-radius: var(--radius);
  font-size: 14px; background: var(--panel); outline: none;
}
.composer input:focus { border-color: var(--accent); }
.composer button {
  padding: 11px 18px; border: 0; border-radius: var(--radius);
  background: var(--accent); color: var(--accent-ink); font-weight: 600; font-size: 14px;
}

/* ---------- task groups ---------- */
.group-title {
  font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .8px;
  color: var(--muted); margin: 22px 0 10px; display: flex; align-items: center; gap: 8px;
}
.group-title .dot { width: 8px; height: 8px; border-radius: 50%; }
.dot.open { background: var(--open); }
.dot.in_progress { background: var(--progress); }
.dot.done { background: var(--done); }

.task {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 13px 16px; margin-bottom: 8px;
  display: flex; gap: 12px; align-items: flex-start;
  transition: box-shadow .15s;
}
.task:hover { box-shadow: 0 2px 10px rgba(16,30,50,.07); }
.task.done .t-title { text-decoration: line-through; color: var(--muted); }

.status-chip {
  flex-shrink: 0; border: 0; border-radius: 99px; font-size: 11px; font-weight: 700;
  padding: 5px 10px; min-width: 86px; color: #fff; margin-top: 1px;
}
.status-chip[data-s="open"] { background: var(--open); }
.status-chip[data-s="in_progress"] { background: var(--progress); }
.status-chip[data-s="done"] { background: var(--done); }
.status-chip:hover { filter: brightness(1.08); }

.t-body { flex: 1; min-width: 0; }
.t-title { font-size: 14.5px; font-weight: 600; }
.t-detail { font-size: 13px; color: var(--muted); margin-top: 4px; white-space: pre-wrap; }
.t-meta { display: flex; gap: 10px; margin-top: 7px; flex-wrap: wrap; }
.t-tag {
  font-size: 11.5px; color: var(--muted); background: #eef1f5;
  padding: 2px 8px; border-radius: 5px;
}
.t-actions { display: flex; gap: 4px; flex-shrink: 0; }
.t-actions button {
  border: 0; background: transparent; color: #aab4c0; font-size: 14px; padding: 4px 6px; border-radius: 6px;
}
.t-actions button:hover { background: #eef1f5; color: var(--ink); }
.t-actions .del:hover { color: var(--open); }

.empty { color: var(--muted); font-size: 13.5px; padding: 12px 4px; }

/* ---------- dashboard ---------- */
.kpi-row { display: flex; gap: 12px; margin: 18px 0 8px; flex-wrap: wrap; align-items: stretch; }
.kpi {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 16px 20px; min-width: 105px; text-align: center; flex: 1;
}
.kpi-value { font-size: 30px; font-weight: 800; line-height: 1.1; }
.kpi.open .kpi-value { color: var(--open); }
.kpi.in_progress .kpi-value { color: var(--progress); }
.kpi.done .kpi-value { color: var(--done); }
.kpi-label { font-size: 11.5px; color: var(--muted); text-transform: uppercase; letter-spacing: .6px; margin-top: 4px; }

.donut-card { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 12px 20px; }
.donut { width: 76px; height: 76px; border-radius: 50%; position: relative; }
.donut::after { content: ''; position: absolute; inset: 12px; background: var(--panel); border-radius: 50%; }
.donut-label { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: 15px; z-index: 1; }

.topic-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 12px; }
.topic-card {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 14px 16px; cursor: pointer; transition: box-shadow .15s, transform .15s;
}
.topic-card:hover { box-shadow: 0 4px 14px rgba(16,30,50,.1); transform: translateY(-1px); }
.tc-top { display: flex; gap: 8px; align-items: center; margin-bottom: 10px; }
.tc-icon { font-size: 20px; }
.tc-name { font-weight: 700; font-size: 14.5px; }
.topic-card .progress-bar { margin: 0 0 8px; }
.tc-counts { font-size: 12px; color: var(--muted); }

.dash-section-title {
  font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .8px;
  color: var(--muted); margin: 28px 0 10px;
}
.dash-row {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 10px 14px; margin-bottom: 6px;
  display: flex; gap: 12px; align-items: center; cursor: pointer;
}
.dash-row:hover { box-shadow: 0 2px 10px rgba(16,30,50,.07); }
.dash-row .t-title { font-size: 14px; font-weight: 500; }
.dash-row .t-tag { flex-shrink: 0; }

/* ---------- arrivals & extras ---------- */
.fetched-note { font-size: 11.5px; color: var(--muted); margin: -2px 0 4px; }
.bk-card {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 13px 16px; margin-bottom: 8px;
}
.bk-card.cancelled { opacity: .6; }
.bk-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.bk-name { font-size: 15px; font-weight: 700; }
.bk-total { margin-left: auto; font-weight: 700; font-size: 14px; }
.cancel-tag { background: #fbe4e2; color: var(--open); }
.bk-dates { font-size: 13px; color: var(--muted); margin-top: 4px; }
.bk-row { display: flex; align-items: center; gap: 10px; margin-top: 8px; flex-wrap: wrap; }
.pc-badge { font-size: 11.5px; font-weight: 700; padding: 3px 9px; border-radius: 99px; }
.pc-badge.ok { background: #e1f4ea; color: var(--done); }
.pc-badge.warn { background: #fdf0dd; color: #b96b00; }
.bk-link { font-size: 12.5px; color: var(--accent); text-decoration: none; font-weight: 600; }
.bk-link:hover { text-decoration: underline; }
.bk-msg { font-size: 12.5px; color: var(--ink); background: #f4f7fa; border-left: 3px solid #c6d4e2; padding: 6px 10px; border-radius: 0 6px 6px 0; margin-top: 8px; }
.extra-ev {
  display: flex; align-items: flex-start; gap: 10px;
  background: #fff8ec; border: 1px solid #f0dfbe; border-radius: 8px;
  padding: 8px 12px; margin-top: 8px;
}
.extra-ev.handled { background: #f4f6f8; border-color: var(--line); }
.extra-ev.handled .ev-line { text-decoration: line-through; color: var(--muted); }
.ev-main { flex: 1; min-width: 0; }
.ev-line { font-size: 13px; font-weight: 600; }
.ev-note { font-size: 12px; color: var(--muted); margin-top: 3px; }
.ev-actions { display: flex; gap: 6px; flex-shrink: 0; }
.pill-btn {
  border: 1px solid var(--line); background: var(--panel); border-radius: 99px;
  font-size: 11.5px; font-weight: 600; padding: 4px 10px; color: var(--muted);
}
.pill-btn:hover { color: var(--ink); border-color: #c4ccd6; }
.show-past { margin-top: 18px; }

/* ---------- modal ---------- */
.modal-backdrop {
  position: fixed; inset: 0; background: rgba(10,17,26,.55); z-index: 40;
  display: flex; align-items: center; justify-content: center;
}
.modal {
  background: var(--panel); border-radius: 14px; padding: 26px;
  width: min(520px, 94vw); max-height: 88vh; overflow-y: auto;
}
.modal h3 { margin-bottom: 18px; font-size: 18px; }
.modal label { display: block; font-size: 12.5px; font-weight: 600; color: var(--muted); margin: 12px 0 5px; }
.modal input, .modal textarea, .modal select {
  width: 100%; padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px;
  font: inherit; font-size: 14px; outline: none; background: #fff;
}
.modal input:focus, .modal textarea:focus { border-color: var(--accent); }
.modal textarea { resize: vertical; min-height: 90px; }
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 22px; }
.btn { padding: 10px 18px; border-radius: 8px; border: 0; font-weight: 600; font-size: 14px; }
.btn.primary { background: var(--accent); color: #fff; }
.btn.ghost { background: #eef1f5; color: var(--ink); }
.btn.danger { background: var(--open); color: #fff; }

/* ---------- cleaning handover ---------- */
.cl-context-row { display: flex; gap: 12px; flex-wrap: wrap; margin: 14px 0 4px; }
.cl-context {
  flex: 1; min-width: 240px;
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 12px 16px;
}
.cc-label { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .6px; color: var(--muted); }
.cc-main { font-size: 14.5px; font-weight: 700; margin-top: 4px; }
.cc-sub { font-size: 12.5px; color: var(--muted); margin-top: 2px; }
.cc-extra {
  display: inline-block; font-size: 11.5px; font-weight: 700;
  background: #fdf0dd; color: #b96b00; border-radius: 99px; padding: 2px 9px; margin: 6px 6px 0 0;
}

.cl-start-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 12px; margin-top: 8px; }
.cl-start { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; }
.cs-emoji { font-size: 28px; }
.cs-emoji-sm { font-size: 20px; flex-shrink: 0; }
.cs-title { font-weight: 800; font-size: 16px; margin-top: 6px; }
.cs-es { color: var(--muted); font-size: 13px; margin-top: 2px; }
.cs-meta { color: var(--muted); font-size: 12px; margin-top: 6px; }
.cs-actions { display: flex; gap: 8px; margin-top: 12px; }
.cs-actions .btn.primary { flex: 1; }

.cl-counts { font-size: 12.5px; color: var(--muted); margin: -14px 0 4px; }
.cl-intro {
  background: var(--panel); border: 1px solid var(--line); border-left: 4px solid var(--accent);
  border-radius: var(--radius); padding: 12px 14px; margin: 14px 0; font-size: 13px;
}
.cl-intro .es { color: var(--muted); margin-top: 6px; }
.cl-completed-note { font-size: 13px; font-weight: 700; color: var(--done); margin: -4px 0 8px; }
.cl-st-es { font-weight: 600; text-transform: none; letter-spacing: 0; color: #9aa6b5; }

.cl-item {
  display: flex; gap: 12px; align-items: flex-start;
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 12px 14px; margin-bottom: 8px; cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.cl-item:hover { box-shadow: 0 2px 10px rgba(16,30,50,.07); }
.cl-item.readonly { cursor: default; }
.cl-item.done { background: #f3faf6; border-color: #cfe9dc; }
.cl-item.done .ci-en { text-decoration: line-through; color: var(--muted); }
.cl-item.flagged { background: #fff6ed; border-color: #f0cf9e; }
.cl-box {
  flex-shrink: 0; width: 30px; height: 30px;
  border: 2px solid #c4ccd6; border-radius: 8px; background: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 16px; font-weight: 800; color: #fff;
}
.cl-item.done .cl-box { background: var(--done); border-color: var(--done); }
.cl-item.flagged .cl-box { background: #fff; border-color: #e8920f; font-size: 14px; }
.ci-body { flex: 1; min-width: 0; }
.ci-en { font-size: 14.5px; font-weight: 600; }
.ci-es { font-size: 13px; color: var(--muted); margin-top: 3px; }
.ci-why { font-size: 12px; color: #9a6a1f; font-style: italic; margin-top: 5px; }
.ci-note { font-size: 12.5px; font-weight: 600; color: #b96b00; margin-top: 5px; }
.ci-flag { flex-shrink: 0; font-size: 13px; }

.cl-actionbar {
  position: sticky; bottom: 10px; z-index: 5;
  display: flex; gap: 10px; margin-top: 18px;
  background: rgba(244,245,247,.92); backdrop-filter: blur(4px);
  border: 1px solid var(--line); border-radius: 12px; padding: 10px;
}
.cl-actionbar .btn.primary { flex: 1; padding: 14px; font-size: 15px; }

/* ---------- print (blank checklist) ---------- */
.print-area { display: none; }
@media print {
  body.printing > *:not(.print-area) { display: none !important; }
  body.printing .print-area { display: block; font-size: 11px; color: #000; }
  .pr-title { font-size: 16px; font-weight: 800; margin-bottom: 4px; }
  .pr-intro { font-size: 10px; color: #333; margin-bottom: 3px; }
  .pr-line { margin: 8px 0; font-size: 11px; }
  .pr-section { font-weight: 800; text-transform: uppercase; font-size: 10.5px; letter-spacing: .5px; margin: 9px 0 3px; border-bottom: 1px solid #000; padding-bottom: 1px; }
  .pr-item { display: flex; gap: 7px; padding: 3px 0; border-bottom: 1px dotted #bbb; page-break-inside: avoid; }
  .pr-box { flex-shrink: 0; width: 12px; height: 12px; border: 1.5px solid #000; border-radius: 3px; margin-top: 2px; }
  .pr-en { font-weight: 600; }
  .pr-es { color: #444; }
  .pr-footer { margin-top: 10px; font-size: 10px; font-weight: 600; border-top: 1px solid #000; padding-top: 4px; }
}

/* ---------- toast ---------- */
.toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%);
  background: #1b2430; color: #fff; padding: 11px 20px; border-radius: 10px;
  font-size: 13.5px; z-index: 60; box-shadow: 0 6px 24px rgba(0,0,0,.25);
}
.toast.err { background: #8e2f2b; }

@media (max-width: 760px) {
  .app { flex-direction: column; }
  .sidebar { width: 100%; height: auto; position: static; }
  .main { padding: 20px 16px; }
}
