/* Thinknbox HQ: a working tool in the agency's blue and red. Dense, scannable, phone-friendly. */
:root {
  --bg: #F2F6FB;
  --surface: #FFFFFF;
  --surface-2: #EDF2F9;
  --ink: #101B33;
  --muted: #5A6884;
  --line: #D6E0EC;
  --blue: #1B4DB0;
  --blue-ink: #FFFFFF;
  --blue-soft: #E2EBFA;
  --red: #D9121D;
  --green: #157F3B;
  --green-soft: #E1F3E7;
  --amber: #A85A06;
  --amber-soft: #FCEFD9;
  --shadow: 0 1px 2px rgba(16, 27, 51, 0.06), 0 8px 24px -16px rgba(16, 27, 51, 0.25);
  --label: "Archivo", "Arial Narrow", system-ui, sans-serif;
  --body: "DM Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --display: "Fraunces", Georgia, serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0B1222; --surface: #121B30; --surface-2: #18233D; --ink: #E7ECF6; --muted: #9AA8C3; --line: #26334F;
    --blue: #8FB1FF; --blue-ink: #0B1222; --blue-soft: #1A2A52; --red: #FF6B70;
    --green: #5BD98A; --green-soft: #12301F; --amber: #F5B04C; --amber-soft: #3A2A10;
    --shadow: 0 1px 2px rgba(0,0,0,.3), 0 10px 28px -18px rgba(0,0,0,.7);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 15px/1.5 var(--body); -webkit-font-smoothing: antialiased; }
a { color: var(--blue); }
button, input, select, textarea { font: inherit; color: inherit; }
h1, h2, h3 { margin: 0; line-height: 1.2; text-wrap: balance; }
p { margin: 0; }
:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }

/* Top bar */
.top { position: sticky; top: 0; z-index: 10; background: var(--surface); border-bottom: 1px solid var(--line); }
.top-inner { max-width: 1180px; margin: 0 auto; padding-inline: 16px; display: flex; align-items: center; gap: 18px; min-height: 58px; }
.wm { font-family: var(--label); font-stretch: 125%; color: var(--red); line-height: 1; white-space: nowrap; font-size: 17px; text-decoration: none; }
.wm b { font-weight: 900; }
.wm span { font-weight: 300; }
.wm em { font-style: normal; font-weight: 700; color: var(--ink); font-size: 11px; letter-spacing: .18em; margin-left: 8px; vertical-align: 2px; }
.nav { display: flex; gap: 2px; overflow-x: auto; scrollbar-width: none; flex: 1; min-width: 0; }
.nav::-webkit-scrollbar { display: none; }
.nav a { text-decoration: none; color: var(--muted); font-weight: 600; font-size: 14px; padding: 8px 12px; border-radius: 8px; white-space: nowrap; }
.nav a:hover { background: var(--surface-2); color: var(--ink); }
.nav a.on { background: var(--blue-soft); color: var(--blue); }
.who { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); white-space: nowrap; }
.who button { background: none; border: 1px solid var(--line); border-radius: 999px; padding: 4px 10px; cursor: pointer; font-weight: 600; color: var(--ink); }

@media (max-width: 760px) {
  .top-inner { flex-wrap: wrap; gap: 6px 12px; padding-block: 10px 6px; }
  .nav { order: 3; flex-basis: 100%; }
  .who { margin-left: auto; }
}

main { max-width: 1180px; margin: 0 auto; padding-inline: 16px; padding-block: 22px 80px; display: grid; gap: 20px; }

/* Type */
.eyebrow { font-family: var(--label); font-stretch: 115%; font-size: 11px; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; color: var(--blue); }
.h1 { font-size: clamp(24px, 4vw, 32px); font-weight: 700; letter-spacing: -0.01em; }
.h2 { font-size: 18px; font-weight: 700; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.num { font-variant-numeric: tabular-nums; }
.head { display: flex; flex-wrap: wrap; align-items: end; justify-content: space-between; gap: 12px; }
.head > div { display: grid; gap: 4px; min-width: 0; }

/* Surfaces */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow); padding: 16px; display: grid; gap: 12px; min-width: 0; }
.grid { display: grid; gap: 14px; }
.g2 { grid-template-columns: repeat(auto-fit, minmax(min(100%, 320px), 1fr)); }
.g3 { grid-template-columns: repeat(auto-fit, minmax(min(100%, 240px), 1fr)); }
.split { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); gap: 18px; align-items: start; }
@media (max-width: 900px) { .split { grid-template-columns: minmax(0, 1fr); } }
.sticky { position: sticky; top: 76px; }
@media (max-width: 900px) { .sticky { position: static; } }

/* Progress */
.bar { height: 8px; border-radius: 999px; background: var(--surface-2); overflow: hidden; }
.bar > i { display: block; height: 100%; background: var(--blue); border-radius: inherit; transition: width .3s ease; }
.bar.done > i { background: var(--green); }
.bar.late > i { background: var(--amber); }
.pace { position: relative; }
.pace::after { content: ""; position: absolute; top: -3px; bottom: -3px; left: var(--pace); width: 2px; background: var(--ink); opacity: .35; border-radius: 2px; }
.big-pct { font-family: var(--label); font-stretch: 112%; font-weight: 800; font-size: 34px; line-height: 1; font-variant-numeric: tabular-nums; }

/* Pills */
.pill { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; font-weight: 700; padding: 2px 9px; border-radius: 999px; background: var(--surface-2); color: var(--muted); white-space: nowrap; }
.pill.blue { background: var(--blue-soft); color: var(--blue); }
.pill.green { background: var(--green-soft); color: var(--green); }
.pill.amber { background: var(--amber-soft); color: var(--amber); }
.pill.red { background: color-mix(in srgb, var(--red) 14%, transparent); color: var(--red); }

/* Buttons and fields */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); border-radius: 9px; padding: 8px 14px; font-weight: 600; font-size: 14px; cursor: pointer; text-decoration: none; white-space: nowrap; }
.btn:hover { background: var(--surface-2); }
.btn.primary { background: var(--blue); border-color: var(--blue); color: var(--blue-ink); }
.btn.primary:hover { filter: brightness(1.08); }
.btn.danger { color: var(--red); }
.btn.sm { padding: 5px 10px; font-size: 13px; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
.row-actions { display: flex; flex-wrap: wrap; gap: 8px; }
label.f { display: grid; gap: 4px; font-size: 13px; font-weight: 600; color: var(--muted); min-width: 0; }
.f input, .f select, .f textarea, .inp { width: 100%; border: 1px solid var(--line); background: var(--surface); border-radius: 8px; padding: 8px 10px; font-size: 14px; font-weight: 500; color: var(--ink); min-width: 0; }
.f textarea { min-height: 84px; resize: vertical; }
.fields { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 170px), 1fr)); }
.fields.narrow { grid-template-columns: repeat(auto-fit, minmax(min(100%, 110px), 1fr)); }
fieldset { border: 0; padding: 0; margin: 0; display: grid; gap: 12px; min-width: 0; }
legend { font-weight: 700; font-size: 15px; padding: 0; margin-bottom: 4px; }
.check-inline { display: flex; align-items: center; gap: 8px; font-size: 14px; font-weight: 600; }
.check-inline input { width: 18px; height: 18px; accent-color: var(--blue); }

/* Chips filter */
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { border: 1px solid var(--line); background: var(--surface); border-radius: 999px; padding: 5px 12px; font-size: 13px; font-weight: 600; cursor: pointer; color: var(--muted); }
.chip.on { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; }
.monthnav { display: flex; align-items: center; gap: 4px; }
.monthnav strong { min-width: 132px; text-align: center; font-size: 15px; }
.monthnav button { width: 34px; height: 34px; border-radius: 8px; border: 1px solid var(--line); background: var(--surface); cursor: pointer; font-size: 16px; }
.search { flex: 1; min-width: 180px; max-width: 320px; }

/* Client task cards */
.clients { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 520px), 1fr)); align-items: start; }
.cc { padding: 0; gap: 0; overflow: hidden; }
.cc-head { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 6px 12px; align-items: center; padding: 14px 16px; cursor: pointer; }
.cc-head h3 { font-size: 16px; }
.cc-sub { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); }
.cc-pct { font-family: var(--label); font-stretch: 112%; font-weight: 800; font-size: 20px; font-variant-numeric: tabular-nums; text-align: right; }
.cc-head .bar { grid-column: 1 / -1; }
.cc-body { border-top: 1px solid var(--line); padding: 12px 16px 16px; display: grid; gap: 12px; }
.owner-sel { border: 1px solid var(--line); border-radius: 999px; padding: 2px 8px; font-size: 12.5px; font-weight: 700; background: var(--surface); cursor: pointer; }
.owner-sel.none { color: var(--red); border-color: color-mix(in srgb, var(--red) 40%, var(--line)); }
.trow { display: grid; grid-template-columns: 170px minmax(0, 1fr); gap: 8px 12px; align-items: start; }
.trow .tl { font-size: 13.5px; font-weight: 600; padding-top: 4px; }
.trow .tl small { display: block; font-weight: 600; color: var(--muted); font-variant-numeric: tabular-nums; }
@media (max-width: 560px) { .trow { grid-template-columns: minmax(0, 1fr); gap: 6px; } .trow .tl { padding-top: 0; display: flex; justify-content: space-between; } }
.boxes { display: flex; flex-wrap: wrap; gap: 6px; }
.box { width: 32px; height: 32px; border-radius: 8px; border: 1.5px solid var(--line); background: var(--surface); display: grid; place-items: center; font-size: 11.5px; font-weight: 700; color: var(--muted); cursor: pointer; font-variant-numeric: tabular-nums; padding: 0; transition: background .12s, border-color .12s; }
.box:hover { border-color: var(--blue); }
.box.on { background: var(--blue); border-color: var(--blue); color: var(--blue-ink); font-size: 15px; }
.box.on::before { content: "\2713"; }
.box.on span { display: none; }
.box.wide { width: auto; padding: 0 12px; gap: 6px; display: inline-flex; }
.box.wide.on::before { content: none; }
.box.busy { opacity: .55; }
.theme { display: flex; gap: 8px; align-items: center; }
.theme input { flex: 1; }
.meta-notes { display: grid; gap: 6px; font-size: 13px; background: var(--surface-2); border-radius: 10px; padding: 10px 12px; }
.meta-notes b { color: var(--ink); }
.dont { color: var(--red); font-weight: 600; }
.onetime { border-top: 1px dashed var(--line); padding-top: 10px; display: grid; gap: 6px; }
.ck { display: flex; align-items: flex-start; gap: 10px; font-size: 14px; cursor: pointer; padding: 4px 0; }
.ck input { width: 20px; height: 20px; margin: 1px 0 0; accent-color: var(--blue); flex: none; }
.ck .by { display: block; font-size: 12px; color: var(--muted); }
.ck.done > span:first-of-type { color: var(--muted); }

/* Lists */
.list { display: grid; gap: 0; }
.li { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 12px; align-items: center; padding: 11px 0; border-top: 1px solid var(--line); text-decoration: none; color: inherit; }
.li:first-child { border-top: 0; }
.li:hover .li-t { color: var(--blue); }
.li-t { font-weight: 700; }
.li .bar { grid-column: 1 / -1; }
.empty { padding: 18px; text-align: center; color: var(--muted); font-size: 14px; border: 1px dashed var(--line); border-radius: 12px; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th { text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 700; padding: 8px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
td { padding: 11px 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
tr.click { cursor: pointer; }
tr.click:hover td { background: var(--surface-2); }

/* Team cards */
.team-card { display: grid; gap: 10px; text-decoration: none; color: inherit; }
.team-card:hover { border-color: var(--blue); }
.team-top { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; }
.avatar { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; background: var(--blue-soft); color: var(--blue); font-weight: 800; font-family: var(--label); }

/* Onboarding */
.ogroup { display: grid; gap: 4px; }
.ogroup h4 { margin: 6px 0 2px; font-size: 12px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
.timeline { display: grid; gap: 8px; }
.tl-step { display: grid; grid-template-columns: 14px minmax(0, 1fr); gap: 10px; font-size: 13.5px; align-items: start; }
.tl-step::before { content: ""; width: 10px; height: 10px; margin-top: 5px; border-radius: 50%; border: 2px solid var(--line); }
.tl-step.on::before { background: var(--green); border-color: var(--green); }
.money { display: grid; gap: 6px; font-size: 14px; }
.money div { display: flex; justify-content: space-between; gap: 12px; font-variant-numeric: tabular-nums; }
.money .tot { border-top: 1px solid var(--line); padding-top: 8px; font-weight: 800; font-size: 16px; }
.addon-row { display: grid; grid-template-columns: minmax(0, 1fr) 110px 120px 36px; gap: 8px; align-items: center; }
@media (max-width: 560px) { .addon-row { grid-template-columns: minmax(0, 1fr) 90px; } .addon-row select { grid-column: 1; } }
.icon-btn { width: 34px; height: 34px; border-radius: 8px; border: 1px solid var(--line); background: var(--surface); cursor: pointer; color: var(--muted); }

/* Login */
.login { min-height: 100vh; display: grid; place-items: center; padding-inline: 16px; }
.login .card { width: min(100%, 380px); padding: 26px; gap: 16px; }
.people { display: grid; grid-template-columns: repeat(auto-fit, minmax(100px, 1fr)); gap: 8px; }

/* Toast */
.toast { position: fixed; left: 50%; bottom: calc(18px + env(safe-area-inset-bottom, 0px)); transform: translateX(-50%); background: var(--ink); color: var(--bg); padding: 10px 16px; border-radius: 10px; font-weight: 600; font-size: 14px; z-index: 50; max-width: calc(100% - 32px); box-shadow: var(--shadow); }
.toast.err { background: var(--red); color: #fff; }
.loading { padding: 60px 0; text-align: center; color: var(--muted); }

@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
