/* Venture Tracker. Layout: a wrapping top bar, a venture filter row, then one view at a time.
   Neutral interface; the only strong colors are each venture's own dot and the overdue red. */
:root {
  --bg: #F4F5F8; --surface: #FFFFFF; --sunken: #EBEDF2; --ink: #1B1F27; --ink2: #3C4452; --muted: #5B6472;
  --line: #E1E4EA; --line2: #C9CED8; --strong: #1B1F27; --on-strong: #FFFFFF; --today: #E4E9F7; --focus: #2450B8;
  --danger: #B42318; --shadow: rgba(27, 31, 39, 0.16);
  --display: "Space Grotesk", Inter, system-ui, sans-serif; --body: Inter, system-ui, -apple-system, sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #14171D; --surface: #1D2129; --sunken: #171A20; --ink: #ECEEF2; --ink2: #C5CAD3; --muted: #9BA3B0;
    --line: #2C323D; --line2: #414958; --strong: #ECEEF2; --on-strong: #14171D; --today: #232C44; --focus: #8FA8F0;
    --danger: #FF8A7A; --shadow: rgba(0, 0, 0, 0.5);
    color-scheme: dark;
  }
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--ink); font: 14px/1.4 var(--body); font-variant-numeric: tabular-nums; -webkit-text-size-adjust: 100%; }
[hidden] { display: none !important; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
h1, h2, h3 { font-family: var(--display); font-weight: 600; margin: 0; text-wrap: balance; }
h2 { font-size: 20px; }
.sr { position: absolute; left: -9999px; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.danger { color: var(--danger); font-weight: 600; }
.dot { flex: none; display: inline-block; width: 10px; height: 10px; border-radius: 50%; }

input[type="text"], input[type="search"], input[type="password"], input[type="date"], select, textarea {
  min-height: 40px; padding: 8px 12px; border: 1px solid var(--line2); border-radius: 8px; background: var(--surface); width: 100%; min-width: 0;
}
textarea { resize: vertical; line-height: 1.45; }
.btn { min-height: 40px; padding: 0 14px; border: 1px solid var(--line2); border-radius: 8px; background: var(--surface); font-weight: 500; white-space: nowrap; }
.btn.primary { background: var(--strong); color: var(--on-strong); border-color: var(--strong); font-weight: 600; }
.btn.ghost { border-color: transparent; background: none; }
.btn.warn { color: var(--danger); }

/* Sign in */
.login { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.login-card { width: 100%; max-width: 340px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 24px; display: flex; flex-direction: column; gap: 10px; }
.login-card h1 { font-size: 22px; margin-bottom: 8px; }
.msg { margin: 0; min-height: 1.4em; color: var(--danger); }

/* Top bar */
.top { background: var(--surface); border-bottom: 1px solid var(--line); padding: 12px max(16px, env(safe-area-inset-right)) 8px max(16px, env(safe-area-inset-left)); padding-top: calc(12px + env(safe-area-inset-top)); display: flex; flex-wrap: wrap; gap: 10px 20px; align-items: center; }
.brand { font-family: var(--display); font-weight: 600; font-size: 18px; letter-spacing: -0.01em; }
.tabs { display: flex; gap: 4px; }
.tabs button { min-height: 40px; padding: 0 14px; border: 0; border-radius: 8px; background: none; color: var(--ink2); font-weight: 600; }
.tabs button[aria-current="page"] { background: var(--strong); color: var(--on-strong); }
.tools { flex: 1 1 420px; display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-end; min-width: 0; }
.tools > input { flex: 1 1 160px; max-width: 240px; }
.quick { flex: 2 1 260px; max-width: 420px; display: flex; gap: 6px; margin: 0; min-width: 0; }
.hint { flex: 1 1 100%; margin: 0; font-size: 12px; color: var(--muted); text-align: right; }

.filters { padding: 14px 16px 0; display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.chip { display: inline-flex; align-items: center; gap: 8px; min-height: 40px; padding: 0 14px; border-radius: 999px; border: 1px solid var(--line2); background: none; font-weight: 500; }
.chip[aria-pressed="true"] { background: var(--surface); border-color: var(--strong); box-shadow: inset 0 0 0 1px var(--strong); }
.chip .n { color: var(--muted); font-weight: 400; }
.filters .when { margin-left: auto; color: var(--muted); }

main { padding: 20px 16px 48px; }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 18px; min-width: 0; }
.panel > h2 { margin-bottom: 4px; }
.panel-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 12px; margin-bottom: 6px; }
.empty { color: var(--muted); margin: 8px 0 0; }

/* Rows (lists of items) */
.row { display: flex; align-items: center; gap: 4px; border-top: 1px solid var(--line); }
.row .check { flex: none; width: 40px; height: 44px; border: 0; background: none; display: grid; place-items: center; }
.row .check span { width: 18px; height: 18px; border: 2px solid var(--line2); border-radius: 50%; display: block; }
.row .check:hover span { border-color: var(--strong); }
.row .open { flex: 1 1 auto; min-width: 0; display: flex; align-items: center; gap: 10px; min-height: 48px; padding: 6px 4px; border: 0; background: none; text-align: left; }
.row .text { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; }
.row .title { font-weight: 500; overflow-wrap: anywhere; }
.row .when { flex: none; font-size: 12px; color: var(--muted); }
.row .lead { flex: none; width: 56px; font-weight: 600; }

/* Home */
.home { display: flex; flex-wrap: wrap; gap: 20px; align-items: flex-start; }
.home > .panel { flex: 1 1 360px; }
.home > .col { flex: 1.3 1 440px; min-width: 0; display: flex; flex-direction: column; gap: 20px; }
.scroll-x { overflow-x: auto; }
.week { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 8px; min-width: 720px; }
.day { min-width: 0; border-radius: 8px; padding: 8px; background: var(--bg); }
.day.today { background: var(--today); box-shadow: inset 0 0 0 2px var(--focus); }
.day .dow { font-size: 12px; color: var(--muted); font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; }
.day .num { font-family: var(--display); font-size: 18px; font-weight: 600; margin-bottom: 6px; }
.pill { display: block; width: 100%; text-align: left; padding: 6px 6px 6px 8px; border: 0; border-radius: 6px; background: var(--surface); box-shadow: inset 0 0 0 1px var(--line); font-size: 12px; line-height: 1.3; margin-top: 4px; overflow-wrap: anywhere; }
.pill .dot { width: 8px; height: 8px; margin-right: 6px; }
.pill b { font-weight: 600; }
input:disabled { opacity: 0.5; }
.pill.done { opacity: 0.55; text-decoration: line-through; }
.vgrid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; }
.vcard { text-align: left; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; display: flex; flex-direction: column; gap: 4px; }
.vcard .name { display: flex; align-items: center; gap: 8px; font-family: var(--display); font-weight: 600; font-size: 16px; }

/* Board */
.board { display: flex; gap: 12px; align-items: flex-start; min-width: 1200px; }
.colm { flex: 1 1 0; min-width: 0; background: var(--sunken); border-radius: 12px; padding: 10px; min-height: 120px; }
.colm.over { box-shadow: inset 0 0 0 2px var(--focus); }
.colm h2 { font: 600 13px var(--body); letter-spacing: 0.04em; text-transform: uppercase; color: var(--ink2); margin: 2px 4px 10px; }
.colm h2 span { color: var(--muted); font-weight: 400; }
.card { display: flex; flex-direction: column; gap: 6px; width: 100%; text-align: left; background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 10px; margin-bottom: 8px; }
.card[draggable="true"] { cursor: grab; }
.card .title { font-weight: 500; line-height: 1.3; overflow-wrap: anywhere; }
.card .meta { display: flex; align-items: center; gap: 6px; color: var(--muted); font-size: 12px; }
.card .meta .dot { width: 8px; height: 8px; }
.card .foot { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; font-size: 12px; color: var(--muted); }
.badge { padding: 1px 7px; border-radius: 999px; background: var(--strong); color: var(--on-strong); font-weight: 600; font-size: 12px; }
.badge.line { background: none; color: var(--ink2); box-shadow: inset 0 0 0 1px var(--line2); }

/* Calendar */
.bar { display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: center; margin-bottom: 12px; }
.bar h2 { margin-right: auto; }
.cal { min-width: 860px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.cal .heads, .cal .cells { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); }
.cal .heads { background: var(--sunken); font-size: 12px; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; color: var(--ink2); }
.cal .heads div { padding: 8px 10px; }
.cell { min-width: 0; min-height: 108px; padding: 6px 8px 8px; border-top: 1px solid var(--line); border-left: 1px solid var(--line); }
.cell:nth-child(7n + 1) { border-left: 0; }
.cell.out { background: var(--bg); }
.cell.today { background: var(--today); }
.cell.over { box-shadow: inset 0 0 0 2px var(--focus); }
.cell .top-line { display: flex; justify-content: space-between; align-items: center; }
.cell .n { font-weight: 600; color: var(--ink2); }
.cell .add { width: 28px; height: 28px; border: 0; border-radius: 6px; background: none; color: var(--muted); font-size: 18px; line-height: 1; }
.cell .add:hover { background: var(--sunken); color: var(--ink); }
.cell .pill { background: var(--bg); box-shadow: none; padding: 4px 6px; }
.cell.today .pill, .cell.out .pill { background: var(--surface); }
.agenda .date-head { font-weight: 600; margin: 14px 0 0; padding: 6px 0; }

/* Timeline */
.tl { min-width: 1000px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.tl .lane { display: flex; border-top: 1px solid var(--line); }
.tl .lane.head { border-top: 0; background: var(--sunken); }
.tl .who { flex: none; width: 180px; padding: 10px 12px; display: flex; flex-direction: column; justify-content: center; min-width: 0; }
.tl .who .p { font-weight: 600; display: flex; align-items: center; gap: 8px; }
.tl .who .v { color: var(--muted); font-size: 12px; padding-left: 18px; }
.tl .track { flex: 1 1 auto; position: relative; height: 72px; }
.tl .head .track { height: 32px; }
.tl .month { position: absolute; top: 8px; padding-left: 8px; border-left: 1px solid var(--line2); font-size: 12px; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; color: var(--ink2); white-space: nowrap; }
.tl .axis { position: absolute; left: 0; right: 0; top: 35px; height: 2px; background: var(--line); }
.tl .now { position: absolute; top: 0; bottom: 0; width: 2px; background: var(--strong); opacity: 0.35; }
.tl .mark { position: absolute; display: flex; align-items: flex-start; gap: 3px; padding: 0; margin-left: -7px; border: 0; background: none; font-size: 12px; white-space: nowrap; text-align: left; }
.tl .mark.up { top: 7px; flex-direction: column-reverse; }
.tl .mark.down { top: 29px; flex-direction: column; }
.tl .mark i { display: block; width: 14px; height: 14px; border-radius: 50%; border: 3px solid; background: var(--surface); }
.tl .tick { position: absolute; top: 31px; width: 10px; height: 10px; margin-left: -5px; padding: 0; border: 0; border-radius: 2px; opacity: 0.75; }
.tl .none { position: absolute; top: 8px; left: 36%; font-size: 12px; color: var(--muted); background: var(--surface); padding: 0 6px; }

/* Item drawer */
.drawer { position: fixed; top: 0; bottom: 0; right: 0; z-index: 20; width: 420px; max-width: 100%; background: var(--surface); border-left: 1px solid var(--line); box-shadow: -12px 0 32px var(--shadow); padding: 20px; padding-top: calc(20px + env(safe-area-inset-top)); padding-bottom: calc(20px + env(safe-area-inset-bottom)); display: flex; flex-direction: column; gap: 14px; overflow-y: auto; }
.drawer .head { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.drawer .title-in { font: 600 20px/1.25 var(--display); }
.fields { display: grid; grid-template-columns: 96px minmax(0, 1fr); gap: 10px 12px; align-items: center; }
.fields label, .fields .lab { color: var(--muted); }
.checks { display: flex; flex-wrap: wrap; gap: 6px 18px; }
.checks label { display: flex; align-items: center; gap: 8px; min-height: 40px; color: var(--ink); }
.checks input { width: 18px; height: 18px; }
.stack { display: flex; flex-direction: column; gap: 6px; }
.links a { color: var(--focus); overflow-wrap: anywhere; }
.log { margin: 0; padding: 0; list-style: none; color: var(--muted); font-size: 12px; }
.inline { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }

/* Projects dialog */
.overlay { position: fixed; inset: 0; z-index: 30; background: rgba(10, 12, 16, 0.5); display: flex; justify-content: center; align-items: flex-start; padding: 24px 16px; overflow-y: auto; }
.dialog { width: 100%; max-width: 560px; background: var(--surface); border-radius: 12px; padding: 20px; display: flex; flex-direction: column; gap: 16px; }
.vent { border: 1px solid var(--line); border-radius: 10px; padding: 12px; display: flex; flex-direction: column; gap: 8px; }
.vent.archived, .proj.archived { opacity: 0.6; }
.line { display: flex; gap: 8px; align-items: center; }
.line input[type="color"] { flex: none; width: 40px; height: 40px; padding: 2px; border: 1px solid var(--line2); border-radius: 8px; background: var(--surface); }
.proj { padding-left: 48px; }

.toast { position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom)); transform: translateX(-50%); z-index: 40; max-width: calc(100% - 32px); background: var(--strong); color: var(--on-strong); padding: 10px 16px; border-radius: 8px; box-shadow: 0 8px 24px var(--shadow); }

@media (max-width: 720px) {
  .tabs { position: fixed; left: 0; right: 0; bottom: 0; z-index: 10; background: var(--surface); border-top: 1px solid var(--line); padding: 6px 8px calc(6px + env(safe-area-inset-bottom)); display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .tabs button { min-height: 48px; padding: 0; }
  main { padding-bottom: 110px; }
  .tools > input { max-width: none; }
  .quick { max-width: none; flex-basis: 100%; }
  .hint { display: none; }
  .tools > input { flex-basis: 100%; }
  #settingsBtn { order: -1; margin-left: auto; }
  .filters .when { display: none; }
  .toast { bottom: calc(84px + env(safe-area-inset-bottom)); }
  .fields { grid-template-columns: 84px minmax(0, 1fr); }
}
@media (prefers-reduced-motion: no-preference) {
  .drawer { animation: slide 0.16s ease-out; }
  @keyframes slide { from { transform: translateX(24px); opacity: 0; } }
}
