/* Tell HQ — warm, Basecamp-flavored UI, in Tell Studios' real brand palette
   (colors pulled from tell-assets/tell.css: navy/teal/coral/gold on cream) */
* { box-sizing: border-box; }
:root {
  --bg: #F4EFE7;
  --card: #FFFFFF;
  --ink: #2c313b;
  --muted: #5c626f;
  --line: rgba(44,49,59,.14);
  --accent: #0E93A8;       /* teal, darkened ~15% off brand #11ACC5 for AA text contrast */
  --accent-soft: #E1F2F4;
  --warn: #df4a36;         /* brand coral-deep */
  --warn-soft: #FBE9E6;
  --hold: #91700F;         /* darkened brand gold #EAC11E, for legible badge text */
  --hold-soft: #FBF1D2;
  --blue: #404655;         /* brand navy — links / info tone, distinct from teal accent */
  --blue-soft: #E6E7EB;
}
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.55 -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
}
h1, h2, h3 { font-family: Georgia, "Times New Roman", serif; font-weight: 700; line-height: 1.2; }
h1 { font-size: 32px; margin: 0 0 6px; }
h2 { font-size: 21px; margin: 0 0 12px; }
a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }

.wrap { max-width: 1100px; margin: 0 auto; padding: 0 20px 80px; }

/* nav */
nav.topbar {
  background: var(--card); border-bottom: 1px solid var(--line);
  padding: 0 20px; margin-bottom: 28px; position: relative;
}
nav.topbar .inner { max-width: 1100px; margin: 0 auto; display: flex; align-items: center; gap: 22px; height: 58px; }
nav.topbar .logo { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
nav.topbar .logo img { display: block; }
nav.topbar .logo .logo-hq { font-family: Georgia, serif; font-size: 19px; font-weight: 700; color: var(--accent); letter-spacing: .01em; }
nav.topbar .nav-primary { display: flex; align-items: center; gap: 22px; }
nav.topbar a.navlink { color: var(--muted); font-size: 15px; padding: 4px 2px; white-space: nowrap; }
nav.topbar a.navlink:hover { text-decoration: none; color: var(--ink); }
nav.topbar a.navlink.active { color: var(--ink); font-weight: 600; border-bottom: 2px solid var(--accent); }
nav.topbar .spacer { flex: 1; }
nav.topbar select { max-width: 160px; }
nav.topbar .nav-new { flex-shrink: 0; text-decoration: none; }
nav.topbar .nav-new:hover { text-decoration: none; }

/* account menu (right side, desktop) */
.account { position: relative; }
.acct-btn .caret { font-size: 10px; opacity: .7; }
.acct-menu {
  position: absolute; top: calc(100% + 6px); right: 0; min-width: 150px; z-index: 40;
  background: var(--card); border: 1px solid var(--line); border-radius: 10px;
  box-shadow: 0 8px 24px rgba(40,32,20,.16); padding: 6px; display: flex; flex-direction: column; gap: 2px;
}
.acct-menu[hidden] { display: none; }
.acct-item {
  display: block; text-align: left; background: none; border: none; cursor: pointer;
  font: inherit; font-size: 14px; color: var(--ink); padding: 8px 12px; border-radius: 7px; width: 100%;
}
.acct-item:hover { background: #F3EFE6; text-decoration: none; }

/* hamburger + mobile drawer (hidden on desktop) */
nav.topbar .menu-toggle {
  display: none; background: none; border: 1px solid var(--line); border-radius: 8px;
  font-size: 18px; line-height: 1; padding: 6px 10px; cursor: pointer; color: var(--ink); flex-shrink: 0;
}
nav.topbar .nav-drawer { display: none; }

@media (max-width: 760px) {
  nav.topbar .nav-primary,
  nav.topbar #account-slot { display: none; }
  nav.topbar .menu-toggle { display: inline-flex; }
  nav.topbar .inner { gap: 12px; }
  nav.topbar.open .nav-drawer {
    display: flex; flex-direction: column; gap: 2px;
    position: absolute; top: 58px; left: 0; right: 0; z-index: 45;
    background: var(--card); border-bottom: 1px solid var(--line);
    box-shadow: 0 10px 24px rgba(40,32,20,.14); padding: 10px 16px 16px;
  }
  nav.topbar .nav-drawer a.navlink,
  nav.topbar .nav-drawer .acct-action {
    display: block; padding: 11px 4px; border-bottom: none; font-size: 16px;
    text-align: left; background: none; border: none; width: 100%; cursor: pointer; color: var(--ink);
  }
  nav.topbar .nav-drawer a.navlink.active { border-bottom: none; color: var(--accent); }
  nav.topbar .nav-drawer-account { margin-top: 6px; padding-top: 8px; border-top: 1px solid var(--line); }
  nav.topbar .nav-drawer .drawer-me { font-size: 13px; color: var(--muted); padding: 4px 4px 2px; }
}

/* cards & layout */
.card {
  background: var(--card); border: 1px solid var(--line); border-radius: 12px;
  padding: 20px 22px; margin-bottom: 20px; box-shadow: 0 1px 2px rgba(60,50,30,.04);
}
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
@media (max-width: 760px) { .grid2 { grid-template-columns: 1fr; } }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.right { text-align: right; }
.mt0 { margin-top: 0; }
.flex { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }

/* badges */
.badge { display: inline-block; padding: 1px 9px; border-radius: 99px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.badge.todo { background: #EFEBE1; color: #6C6355; }
.badge.in_progress { background: var(--blue-soft); color: var(--blue); }
.badge.stuck { background: var(--warn-soft); color: var(--warn); }
.badge.on_hold { background: var(--hold-soft); color: var(--hold); }
.badge.done { background: var(--accent-soft); color: var(--accent); }
.badge.long-lead { background: #F3E8FA; color: #7A3FA0; }
.badge.overdue { background: var(--warn-soft); color: var(--warn); }
.badge.internal { background: var(--hold-soft); color: var(--hold); }
.badge.phase { background: #EFEBE1; color: #6C6355; font-weight: 500; }

/* buttons & forms */
.btn {
  display: inline-block; background: var(--ink); color: #fff; border: none; cursor: pointer;
  border-radius: 8px; padding: 9px 18px; font-size: 15px; font-weight: 600;
}
.btn:hover { background: #443C32; }
.btn.green { background: var(--accent); } .btn.green:hover { background: #0A7887; } /* darker brand teal */
.btn.ghost { background: transparent; color: var(--ink); border: 1px solid var(--line); font-weight: 500; }
.btn.ghost:hover { background: #F3EFE6; }
.btn.small { padding: 5px 12px; font-size: 13px; }
.btn.danger { background: var(--warn); }
.btn:disabled { opacity: .5; cursor: default; }
input, select, textarea {
  font: inherit; color: var(--ink); background: #fff; border: 1px solid var(--line);
  border-radius: 8px; padding: 8px 10px; width: 100%;
}
input:focus, select:focus, textarea:focus { outline: 2px solid #CBE2D4; border-color: var(--accent); }
label { font-size: 13px; font-weight: 600; color: var(--muted); display: block; margin-bottom: 4px; }
.field { margin-bottom: 12px; }
.inline-form { display: flex; gap: 8px; align-items: flex-end; flex-wrap: wrap; }
.inline-form .field { margin-bottom: 0; }

/* tables */
.table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table { width: 100%; border-collapse: collapse; font-size: 14.5px; }
th { text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); padding: 6px 8px; border-bottom: 1px solid var(--line); }
td { padding: 8px; border-bottom: 1px solid #F1ECE1; vertical-align: middle; }
tr:last-child td { border-bottom: none; }
td .mini { border: none; background: transparent; padding: 3px 4px; width: auto; }
td select.mini { max-width: 130px; }
td input.mini[type="date"] { max-width: 140px; }

/* task rows */
.task-row.done .task-title { text-decoration: line-through; color: var(--muted); }
.task-check { width: 18px; height: 18px; accent-color: var(--accent); cursor: pointer; }

/* dashboard */
.dash-section h2 { display: flex; align-items: center; gap: 8px; }
.count-pill { background: var(--ink); color: #fff; border-radius: 99px; font-size: 12px; padding: 0 8px; font-family: -apple-system, sans-serif; }
.empty { color: var(--muted); font-style: italic; padding: 6px 0; }

/* project cards */
.proj-card { display: block; color: inherit; }
.proj-card:hover { text-decoration: none; border-color: var(--accent); }
.proj-meta { display: flex; gap: 18px; font-size: 13.5px; color: var(--muted); flex-wrap: wrap; }
.bar { height: 8px; background: #EFEBE1; border-radius: 99px; overflow: hidden; margin: 8px 0 4px; }
.bar > div { height: 100%; background: var(--accent); border-radius: 99px; }
.bar > div.over { background: var(--warn); }

/* chat (intake) */
.chat-box { display: flex; flex-direction: column; gap: 14px; min-height: 300px; }
.msg { max-width: 82%; padding: 12px 16px; border-radius: 14px; white-space: pre-wrap; }
.msg.user { align-self: flex-end; background: var(--ink); color: #fff; border-bottom-right-radius: 4px; }
.msg.ai { align-self: flex-start; background: #F3EFE6; border-bottom-left-radius: 4px; }
.msg.ai.thinking { color: var(--muted); font-style: italic; }
.chat-input { display: flex; gap: 10px; margin-top: 16px; }
.chat-input textarea { resize: none; height: 70px; }

/* plan preview */
.plan-preview { border: 2px solid var(--accent); }
.plan-preview h2 { color: var(--accent); }

/* review markdown-ish */
.review-body h2 { font-size: 17px; margin: 16px 0 6px; }
.review-body ul { margin: 4px 0 10px; padding-left: 22px; }
.review-body li { margin-bottom: 4px; }

/* login */
.login-wrap { max-width: 380px; margin: 12vh auto 0; }
.login-wrap .logo { display: flex; align-items: center; justify-content: center; gap: 10px; margin-bottom: 20px; }
.login-wrap .logo .logo-hq { font-family: Georgia, serif; font-size: 26px; font-weight: 700; color: var(--accent); }

.err { color: var(--warn); font-size: 14px; margin-top: 8px; }

/* floating project assistant */
#hq-asst-fab {
  position: fixed; bottom: 22px; right: 22px; width: 56px; height: 56px;
  border-radius: 50%; background: var(--accent); color: #fff; font-size: 24px;
  border: none; cursor: pointer; box-shadow: 0 4px 14px rgba(0,0,0,.28); z-index: 899;
  transition: transform .12s;
}
#hq-asst-fab:hover { transform: scale(1.07); }
#hq-asst-panel {
  position: fixed; bottom: 90px; right: 22px; width: 480px; max-width: calc(100vw - 30px);
  height: 680px; max-height: 82vh; background: #fff; border: 1px solid var(--line);
  border-radius: 14px; box-shadow: 0 12px 40px rgba(40,32,20,.22);
  flex-direction: column; z-index: 898; overflow: hidden;
}
.asst-head { display: flex; justify-content: space-between; align-items: center; padding: 12px 16px; border-bottom: 1px solid var(--line); background: #FAF7F0; }
.asst-head strong { font-family: Georgia, serif; }
.asst-head button { background: none; border: none; cursor: pointer; font-size: 15px; color: var(--muted); }
.asst-log { flex: 1; overflow-y: auto; padding: 14px; display: flex; flex-direction: column; gap: 10px; }
.asst-log .msg { max-width: 90%; font-size: 14.5px; padding: 10px 13px; }
.asst-input { display: flex; gap: 8px; padding: 10px; border-top: 1px solid var(--line); }
.asst-input textarea { resize: vertical; height: 110px; min-height: 60px; max-height: 260px; font-size: 14.5px; }

/* undo toast */
#undo-toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%);
  background: var(--ink); color: #fff; border-radius: 10px; padding: 10px 18px;
  display: flex; gap: 16px; align-items: center; z-index: 1000;
  box-shadow: 0 4px 16px rgba(0,0,0,.25); font-size: 14.5px; max-width: 90vw;
}
#undo-toast button { background: none; border: none; cursor: pointer; font-size: 14.5px; padding: 0; }
#undo-toast .undo-btn { color: #9FD4B4; font-weight: 700; }
#undo-toast .undo-x { color: #B9B1A4; }

/* project page tabs */
.tabbar { display: flex; gap: 4px; border-bottom: 2px solid var(--line); margin: 18px 0 22px; flex-wrap: wrap; }
.tabbar button {
  font: inherit; font-size: 15px; font-weight: 600; color: var(--muted);
  background: none; border: none; cursor: pointer; padding: 8px 14px 10px;
  border-bottom: 3px solid transparent; margin-bottom: -2px;
}
.tabbar button:hover { color: var(--ink); }
.tabbar button.active { color: var(--ink); border-bottom-color: var(--accent); }
.tabbar button .count-pill { margin-left: 4px; }
[data-tab-panel] { display: none; }
[data-tab-panel].tab-show { display: block; }

/* board view */
.view-toggle .btn.active { background: var(--ink); color: #fff; border-color: var(--ink); }
.board { display: flex; gap: 12px; overflow-x: auto; padding: 4px 0 12px; align-items: flex-start; }
.board-col {
  flex: 1 0 190px; min-width: 190px; background: #F3EFE6; border-radius: 10px;
  padding: 10px; min-height: 120px; transition: background .15s;
}
.board-col.drag-over { background: #E7E0CF; outline: 2px dashed var(--accent); }
.board-col-head { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); margin-bottom: 10px; display: flex; justify-content: space-between; }
.board-card {
  background: #fff; border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px;
  margin-bottom: 8px; cursor: grab; box-shadow: 0 1px 2px rgba(60,50,30,.06); font-size: 14px;
}
.board-card:active { cursor: grabbing; }
.board-card .bc-title { font-weight: 600; margin-bottom: 4px; }
.board-card.done .bc-title { text-decoration: line-through; color: var(--muted); }
.board-card .badge { font-size: 11px; }
.bc-meta { color: var(--muted); font-size: 12px; margin-top: 4px; }

/* task modal */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(43,38,32,.45); z-index: 50;
  display: flex; align-items: flex-start; justify-content: center; padding: 5vh 16px; overflow-y: auto;
}
.modal {
  background: var(--bg); border-radius: 14px; max-width: 640px; width: 100%;
  padding: 26px 28px; box-shadow: 0 12px 40px rgba(0,0,0,.25); position: relative;
}
.modal .close-x {
  position: absolute; top: 14px; right: 16px; background: none; border: none;
  font-size: 22px; color: var(--muted); cursor: pointer;
}
.modal h2[contenteditable] { outline: none; border-bottom: 1px dashed transparent; }
.modal h2[contenteditable]:focus { border-bottom-color: var(--line); }
.modal .grid3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 10px; }
.modal .grid2m { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
@media (max-width: 560px) { .modal .grid3, .modal .grid2m { grid-template-columns: 1fr; } }
.comment { border-top: 1px solid var(--line); padding: 10px 0; }
.comment .who { font-size: 12.5px; color: var(--muted); margin-bottom: 2px; }
.badge.blocked { background: #EFE3F6; color: #6B3E8E; }

/* calendar */
.cal-daynames { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; margin-bottom: 6px; }
.cal-daynames span { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); text-align: center; }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.cal-cell {
  background: #FBF8F2; border: 1px solid var(--line); border-radius: 8px; min-height: 96px;
  padding: 6px; cursor: pointer; display: flex; flex-direction: column; gap: 3px;
}
.cal-cell:hover { border-color: var(--accent); }
.cal-cell.other-month { background: transparent; opacity: .45; cursor: default; }
.cal-cell.selected { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.cal-cell .cal-daynum { font-size: 12.5px; font-weight: 700; color: var(--muted); }
.cal-cell.today .cal-daynum {
  display: inline-flex; align-items: center; justify-content: center;
  width: 20px; height: 20px; border-radius: 50%; background: var(--accent); color: #fff;
}
.cal-pill {
  font-size: 11px; padding: 1px 6px; border-radius: 6px; background: var(--accent-soft); color: var(--accent);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.cal-pill.overdue { background: var(--warn-soft); color: var(--warn); }
.cal-pill.more { background: none; color: var(--muted); font-style: italic; }
.cal-legend-dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 5px; vertical-align: middle; }
.cal-list-item { display: flex; gap: 10px; align-items: baseline; padding: 7px 0; border-bottom: 1px solid var(--line); }
.cal-list-item:last-child { border-bottom: none; }

/* conflicts & red flags */
.conflicts-card { border-left: 4px solid var(--warn); }
.conflict-row { display: flex; gap: 10px; align-items: flex-start; padding: 9px 0; border-bottom: 1px solid #F1ECE1; }
.conflict-row:last-child { border-bottom: none; }
.conflict-icon { flex-shrink: 0; font-size: 15px; line-height: 1.5; }
.conflict-row.red > div > a, .conflict-row.red > div > strong { color: var(--warn); }

/* ---- mobile pass ---- */
@media (max-width: 760px) {
  .wrap { padding: 0 14px 70px; }
  h1 { font-size: 25px; }
  h2 { font-size: 19px; }
  .card { padding: 16px; border-radius: 10px; }
  .grid2 { grid-template-columns: 1fr; }
  /* keep the FAB from covering content / the New button */
  #hq-asst-fab { bottom: 16px; right: 16px; width: 50px; height: 50px; font-size: 21px; }
  #hq-asst-panel { right: 12px; left: 12px; width: auto; bottom: 78px; }
  /* calendar is dense — shrink cells; pills collapse to thin color bars (tap a day for the list) */
  .cal-grid, .cal-daynames { gap: 3px; }
  .cal-cell { min-height: 54px; padding: 3px; }
  .cal-cell .cal-pill { font-size: 0; height: 4px; padding: 0; border-radius: 2px; overflow: hidden; }
  .cal-cell .cal-pill.more { display: none; }
  .modal { padding: 20px 16px; }
  .modal .grid3, .modal .grid2m { grid-template-columns: 1fr; }
}
