/* Ford Strategies workspace. Palette and type match fordstrategies.ca:
   Segoe UI + Georgia italic accents, BisTrack blue on slate, 6px corners, hairlines. */

:root, :root[data-theme="light"] {
  --font-sans: "Segoe UI", Arial, Helvetica, sans-serif;
  --font-serif: Georgia, "Times New Roman", serif;

  --ink: #0F172A;
  --body: #1E293B;
  --paper: #F1F5F9;
  --surface: #FFFFFF;
  --surface-2: #F8FAFC;
  --blue: #00529B;
  --blue-dark: #00457F;
  --blue-soft: #E6EEF7;
  --accent: #5B9BD5;
  --mid: #475569;
  --muted: #94A3B8;
  --line: #E2E8F0;
  --input: #CBD5E1;
  --danger: #B42318;
  --danger-soft: #FDECEA;
  --warn: #B54708;
  --warn-soft: #FEF0E1;
  --ok: #067647;

  --sidebar: #0F172A;
  --sidebar-text: #CBD5E1;
  --sidebar-active: #1E293B;

  --radius: 6px;
  --shadow: 0 10px 30px rgba(15, 23, 42, .12);
}
:root[data-theme="dark"] {
  --ink: #F1F5F9;
  --body: #E2E8F0;
  --paper: #0B1220;
  --surface: #111A2B;
  --surface-2: #0F1726;
  --blue: #5B9BD5;
  --blue-dark: #7FB1DF;
  --blue-soft: #16273F;
  --mid: #A3B1C6;
  --muted: #64748B;
  --line: #1F2A3D;
  --input: #2C3A52;
  --danger: #F97066;
  --danger-soft: #3A1A1A;
  --warn: #FDB022;
  --warn-soft: #33260F;
  --ok: #47CD89;
  --sidebar: #070C16;
  --sidebar-text: #A3B1C6;
  --sidebar-active: #16213A;
  --shadow: 0 10px 30px rgba(0, 0, 0, .45);
}

*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0; font: 14px/1.5 var(--font-sans);
  background: var(--paper); color: var(--body);
}
[hidden] { display: none !important; }
em { font-family: var(--font-serif); font-style: italic; font-weight: 400; color: var(--blue); }
.muted { color: var(--mid); }
button { font: inherit; }

/* ---------- Wordmark ---------- */
.wordmark { display: flex; align-items: center; gap: .55rem; font-weight: 700; font-size: 1.05rem; letter-spacing: .2px; color: var(--ink); }
.dot { width: 9px; height: 9px; border-radius: 50%; background: var(--blue); flex: none; }

/* ---------- Buttons & inputs ---------- */
.btn {
  font-weight: 600; font-size: 13px; padding: 7px 14px; border-radius: var(--radius); cursor: pointer;
  border: 1.5px solid var(--input); background: var(--surface); color: var(--ink); white-space: nowrap;
}
.btn:hover { border-color: var(--mid); }
.btn.primary { background: var(--blue); border-color: var(--blue); color: #fff; }
.btn.primary:hover { background: var(--blue-dark); border-color: var(--blue-dark); }
:root[data-theme="dark"] .btn.primary { color: #0B1220; }
.btn.ghost { background: transparent; }
.btn.danger { color: var(--danger); border-color: var(--danger); background: transparent; }
.btn:disabled { opacity: .6; cursor: default; }
.icon-btn {
  width: 32px; height: 32px; border-radius: var(--radius); border: 0; cursor: pointer;
  background: transparent; color: inherit; font-size: 16px;
}
.icon-btn:hover { background: rgba(148, 163, 184, .18); }
.link-btn { border: 0; background: none; padding: 0; color: var(--accent); cursor: pointer; font-size: 12px; }
.link { border: 0; background: none; padding: 0; color: var(--blue); cursor: pointer; font-weight: 600; font-size: 13px; }

input, select, textarea {
  font: inherit; font-size: 14px; color: var(--ink); background: var(--surface);
  border: 1px solid var(--input); border-radius: var(--radius); padding: 7px 10px;
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--blue); outline-offset: -1px; border-color: transparent; }
textarea { resize: vertical; }

/* ---------- Gate (sign-in / setup) ---------- */
.gate { min-height: 100%; display: grid; place-items: center; padding: 24px 16px; }
.gate-card {
  width: min(440px, 100%); background: var(--surface); border: 1px solid var(--line);
  border-radius: 10px; padding: 32px; box-shadow: var(--shadow);
}
.gate-card h1 { font-size: 24px; line-height: 1.2; color: var(--ink); margin: 22px 0 8px; }
.gate-card p { color: var(--mid); margin: 0 0 18px; }
.gate-card ul { margin: 0 0 18px; padding-left: 18px; color: var(--mid); }
.gate-card pre { white-space: pre-wrap; font-size: 12px; color: var(--danger); background: var(--danger-soft); padding: 10px; border-radius: var(--radius); }
.gate-card .btn { width: 100%; padding: 10px; }
.fine { font-size: 12px; color: var(--muted); margin-top: 12px !important; }

/* ---------- Shell ---------- */
.shell { display: grid; grid-template-columns: 232px 1fr; height: 100%; }
.sidebar {
  background: var(--sidebar); color: var(--sidebar-text);
  display: flex; flex-direction: column; padding: 20px 14px; gap: 22px;
}
.sidebar .wordmark { color: #fff; }
.sidebar .dot { background: var(--accent); }
.brand-sub { padding-left: 1.15rem; margin-top: 2px; }
.brand-sub em { color: var(--accent); font-size: 15px; }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav-item {
  display: flex; align-items: center; justify-content: space-between;
  border: 0; background: transparent; color: var(--sidebar-text); text-align: left;
  padding: 8px 10px; border-radius: var(--radius); cursor: pointer; font-weight: 600;
}
.nav-item:hover { color: #fff; background: rgba(255, 255, 255, .05); }
.nav-item.active { background: var(--sidebar-active); color: #fff; box-shadow: inset 3px 0 0 var(--accent); }
.nav-count { font-size: 11px; font-weight: 700; min-width: 20px; padding: 1px 6px; border-radius: 10px; background: rgba(255,255,255,.1); text-align: center; }
.nav-count:empty { display: none; }
.nav-count.alert { background: var(--danger); color: #fff; }
.sidebar-foot { margin-top: auto; display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.me { display: flex; align-items: center; gap: 10px; min-width: 0; }
.me-text { min-width: 0; }
.me-name { color: #fff; font-weight: 600; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.foot-actions { display: flex; }

.page { overflow: auto; padding: 28px 32px 40px; min-width: 0; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 18px; flex-wrap: wrap; }
.page-head h1 { margin: 0; font-size: 28px; line-height: 1.15; color: var(--ink); font-weight: 700; letter-spacing: -.01em; }
.page-head .sub { margin: 4px 0 0; color: var(--mid); }
.toolbar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 16px; }
.toolbar input[type=search] { flex: 1 1 220px; max-width: 320px; }

/* ---------- Avatars, chips, pills ---------- */
.avatar {
  width: 26px; height: 26px; border-radius: 50%; flex: none; display: grid; place-items: center;
  font-size: 10.5px; font-weight: 700; background: var(--blue-soft); color: var(--blue); letter-spacing: .3px;
}
.avatar.none { background: transparent; border: 1px dashed var(--input); color: var(--muted); }
.sidebar .avatar { background: var(--accent); color: var(--sidebar); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 4px; }
.chip {
  font-size: 12px; color: var(--mid); background: var(--surface-2); border: 1px solid var(--line);
  padding: 0 7px; border-radius: 4px; cursor: pointer; max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.chip:hover { color: var(--blue); border-color: var(--blue); }
.chip.job::before { content: "◆ "; color: var(--accent); font-size: 9px; }
.pill { font-size: 11.5px; font-weight: 600; padding: 2px 8px; border-radius: 10px; background: var(--blue-soft); color: var(--blue); white-space: nowrap; }
.pill.muted { background: var(--surface-2); color: var(--mid); border: 1px solid var(--line); }
.prio { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; padding: 1px 6px; border-radius: 4px; }
.prio-high { color: var(--warn); background: var(--warn-soft); }
.prio-urgent { color: var(--danger); background: var(--danger-soft); }
.due { font-size: 12.5px; color: var(--mid); white-space: nowrap; }
.due.overdue { color: var(--danger); font-weight: 600; }
.due.today { color: var(--blue); font-weight: 600; }
.count { font-size: 11px; font-weight: 700; color: var(--mid); background: var(--surface-2); border: 1px solid var(--line); padding: 0 6px; border-radius: 9px; }

/* ---------- Quick add ---------- */
.quick-add { margin-bottom: 20px; }
.quick-add input {
  width: 100%; padding: 12px 14px 12px 40px; font-size: 15px; border: 1px solid var(--line);
  background: var(--surface) no-repeat 14px 50%; box-shadow: 0 1px 2px rgba(15,23,42,.04);
}
.quick-add { position: relative; }
.quick-add::before { content: "+"; position: absolute; left: 15px; top: 50%; transform: translateY(-52%); font-size: 20px; color: var(--blue); pointer-events: none; }
.quick-add.small { margin: 8px 0 10px; }
.quick-add.small input { padding: 8px 10px 8px 32px; font-size: 13.5px; }
.quick-add.small::before { left: 11px; font-size: 17px; }

/* ---------- Task rows ---------- */
.group-head { display: flex; align-items: center; gap: 8px; margin: 22px 0 8px; font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--mid); }
.group-head.overdue { color: var(--danger); }
.group-head:first-child { margin-top: 0; }
.task-list { background: var(--surface); border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.task {
  display: flex; align-items: center; gap: 12px; padding: 10px 14px; cursor: pointer;
  border-bottom: 1px solid var(--line); background: var(--surface);
}
.task:last-child { border-bottom: 0; }
.task:hover { background: var(--surface-2); }
.check {
  width: 18px; height: 18px; border-radius: 50%; border: 1.5px solid var(--input); background: transparent;
  flex: none; cursor: pointer; padding: 0; display: grid; place-items: center; color: transparent; font-size: 11px;
}
.check:hover { border-color: var(--blue); color: var(--blue); }
.check:hover::after, .task.done .check::after { content: "✓"; }
.task.done .check { background: var(--blue); border-color: var(--blue); color: #fff; }
.task-main { flex: 1; min-width: 0; }
.task-title { color: var(--ink); font-weight: 500; word-break: break-word; }
.task.done .task-title { color: var(--muted); text-decoration: line-through; }
.task-side { display: flex; align-items: center; gap: 10px; flex: none; }
.empty { color: var(--mid); padding: 14px; margin: 0; }
.empty-big { text-align: center; color: var(--mid); padding: 50px 20px; background: var(--surface); border: 1px dashed var(--input); border-radius: 8px; }
.empty-big em { font-size: 20px; display: block; margin-bottom: 4px; }

/* ---------- Boards ---------- */
.tabs { display: flex; gap: 4px; margin-bottom: 14px; border-bottom: 1px solid var(--line); overflow-x: auto; overflow-y: hidden; }
.tab {
  border: 0; background: none; cursor: pointer; padding: 8px 12px; font-weight: 600; color: var(--mid);
  border-bottom: 2px solid transparent; margin-bottom: -1px; display: flex; gap: 8px; align-items: center; white-space: nowrap;
}
.tab:hover { color: var(--ink); }
.tab.active { color: var(--blue); border-bottom-color: var(--blue); }
.board { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(250px, 1fr); gap: 12px; overflow-x: auto; padding-bottom: 6px; }
.col { background: var(--surface-2); border: 1px solid var(--line); border-radius: 8px; display: flex; flex-direction: column; min-height: 240px; }
:root[data-theme="light"] .col { background: #E9EEF4; border-color: #DDE4EC; }
.col-head { display: flex; justify-content: space-between; align-items: center; padding: 10px 12px; font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--mid); }
.col-head.closed { color: var(--muted); }
.col-body { padding: 0 8px 8px; flex: 1; }
.col.drop-ok { outline: 2px solid var(--blue); outline-offset: -2px; }
.empty-drop { border: 1px dashed var(--input); border-radius: 6px; padding: 18px; text-align: center; color: var(--muted); font-size: 12.5px; }
.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: 6px;
  padding: 10px 12px; margin-bottom: 8px; cursor: pointer; box-shadow: 0 1px 2px rgba(15,23,42,.05);
}
.card:hover { border-color: var(--accent); }
.card.dragging { opacity: .4; }
.card.done .card-title { color: var(--muted); text-decoration: line-through; }
.card-top { display: flex; justify-content: space-between; gap: 8px; align-items: flex-start; }
.card-title { font-weight: 600; color: var(--ink); word-break: break-word; }
.card-sub { font-size: 12.5px; color: var(--mid); margin-top: 1px; }
.card-meta { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 8px; font-size: 12.5px; color: var(--mid); }
.card-meta:empty { display: none; }

/* ---------- Table ---------- */
.table-wrap { background: var(--surface); border: 1px solid var(--line); border-radius: 8px; overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 11px 14px; border-bottom: 1px solid var(--line); }
th { font-size: 11.5px; text-transform: uppercase; letter-spacing: .05em; color: var(--mid); font-weight: 700; background: var(--surface-2); white-space: nowrap; }
tbody tr { cursor: pointer; }
tbody tr:hover { background: var(--surface-2); }
tbody tr:last-child td { border-bottom: 0; }
td.name { font-weight: 600; color: var(--ink); }
td.num { font-variant-numeric: tabular-nums; }
.overdue-text { color: var(--danger); font-weight: 600; }

/* ---------- Drawer ---------- */
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0; width: min(480px, 100vw); z-index: 20;
  background: var(--surface); border-left: 1px solid var(--line); box-shadow: var(--shadow);
  display: flex; flex-direction: column;
}
.drawer-head { display: flex; justify-content: space-between; gap: 12px; padding: 20px 22px 14px; border-bottom: 1px solid var(--line); }
.eyebrow { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; color: var(--accent); }
.drawer-head h2 { margin: 2px 0 6px; font-size: 21px; color: var(--ink); line-height: 1.25; }
.drawer-head .meta { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; font-size: 13px; color: var(--mid); }
.drawer-actions { display: flex; gap: 4px; align-items: flex-start; }
.drawer-body { overflow-y: auto; padding: 16px 22px 30px; }
.drawer-body section { margin-top: 22px; }
.section-head { display: flex; justify-content: space-between; align-items: center; }
.section-head h3 { margin: 0; font-size: 13px; text-transform: uppercase; letter-spacing: .05em; color: var(--mid); display: flex; gap: 8px; align-items: center; }
.toggle { font-size: 12.5px; color: var(--mid); display: flex; gap: 5px; align-items: center; cursor: pointer; }
.facts { display: grid; grid-template-columns: 100px 1fr; gap: 6px 12px; font-size: 13.5px; }
.facts dt { color: var(--mid); }
.facts dd { margin: 0; color: var(--ink); word-break: break-word; }
.facts a { color: var(--blue); }
.notes { white-space: pre-wrap; background: var(--surface-2); border: 1px solid var(--line); border-radius: 6px; padding: 10px 12px; margin-top: 14px; font-size: 13.5px; }
.rows { border: 1px solid var(--line); border-radius: 8px; overflow: hidden; margin-top: 8px; }
.row { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 9px 12px; border-bottom: 1px solid var(--line); cursor: pointer; }
.row:last-child { border-bottom: 0; }
.row:hover { background: var(--surface-2); }
.row-title { font-weight: 600; color: var(--ink); }
.row-sub { font-size: 12.5px; color: var(--mid); }
.drawer .task-list { margin-top: 0; }

/* ---------- Editor ---------- */
dialog {
  border: 1px solid var(--line); border-radius: 10px; padding: 0; color: var(--body);
  width: min(600px, calc(100vw - 32px)); background: var(--surface); box-shadow: var(--shadow);
}
dialog::backdrop { background: rgba(15, 23, 42, .5); }
#editor-form { padding: 22px; }
#editor-form h2 { margin: 0 0 16px; font-size: 20px; color: var(--ink); }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.form-grid label { display: flex; flex-direction: column; gap: 4px; font-size: 12px; font-weight: 600; color: var(--mid); }
.form-grid label.wide { grid-column: 1 / -1; }
.subtasks { margin-top: 20px; padding-top: 16px; border-top: 1px solid var(--line); }
.subtasks .task-list { margin-top: 8px; }
.subtasks .task { padding: 8px 12px; }
.sub-add { display: grid; grid-template-columns: 1fr 170px 140px auto; gap: 8px; margin-top: 10px; }
.part-of { margin: 14px 0 0; font-size: 13px; color: var(--mid); }
.part-of a { color: var(--blue); font-weight: 600; }
.chip.parent { color: var(--blue); }
.chip.sub { cursor: inherit; }
.chip.sub:hover { color: var(--mid); border-color: var(--line); }
.editor-actions { display: flex; gap: 8px; margin-top: 20px; }
.spacer { flex: 1; }

.toast {
  position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%); z-index: 50;
  background: var(--ink); color: var(--paper); padding: 9px 16px; border-radius: var(--radius); font-size: 13px; box-shadow: var(--shadow);
}

/* ---------- Feedback widget ---------- */
.fb-launch {
  position: fixed; right: 20px; bottom: 20px; z-index: 40;
  background: var(--blue); color: #fff; border: 0; border-radius: 22px; padding: 10px 20px;
  font-weight: 700; font-size: 14px; cursor: pointer; box-shadow: var(--shadow);
}
.fb-launch:hover, .fb-launch.active { background: var(--blue-dark); }
:root[data-theme="dark"] .fb-launch { color: #0B1220; }
.fb-panel {
  position: fixed; right: 20px; bottom: 72px; z-index: 40; width: min(360px, calc(100vw - 32px));
  max-height: calc(100vh - 100px); overflow-y: auto;
  background: var(--surface); border: 1px solid var(--line); border-radius: 10px; box-shadow: var(--shadow);
  padding: 16px; display: flex; flex-direction: column; gap: 8px;
}
.fb-head { display: flex; justify-content: space-between; align-items: center; }
.fb-head h3, .fb-list-head h3 { margin: 0; font-size: 15px; color: var(--blue); display: flex; gap: 8px; align-items: center; }
.fb-list-head { display: flex; justify-content: space-between; align-items: center; margin-top: 2px; }
.fb-x { border: 0; background: none; color: var(--mid); cursor: pointer; padding: 2px 6px; border-radius: 4px; }
.fb-x:hover { background: var(--surface-2); color: var(--ink); }
.fb-panel textarea { width: 100%; resize: vertical; min-height: 96px; }
.fb-link { border: 0; background: none; padding: 0; align-self: flex-start; color: var(--blue); font-weight: 700; text-decoration: underline; cursor: pointer; }
.fb-link.small { font-weight: 500; font-size: 12.5px; }
.fb-hint { font-size: 12.5px; color: var(--mid); margin: -4px 0 0; }
.fb-actions { display: flex; gap: 8px; margin-top: 4px; }
.fb-actions .btn { flex: 1; padding: 8px 10px; }
.fb-target { display: flex; justify-content: space-between; align-items: center; gap: 8px; font-size: 13px; color: var(--ink); background: var(--blue-soft); border-radius: 6px; padding: 5px 4px 5px 10px; }
.fb-target span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fb-shot { position: relative; border: 1px solid var(--line); border-radius: 6px; overflow: hidden; }
.fb-shot img { display: block; width: 100%; max-height: 180px; object-fit: contain; background: var(--surface-2); }
.fb-shot .fb-x { position: absolute; top: 4px; right: 4px; background: var(--surface); box-shadow: var(--shadow); }
.fb-notes { display: flex; flex-direction: column; gap: 8px; }
.fb-note { border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; display: flex; flex-direction: column; gap: 5px; }
.fb-note.done { opacity: .6; }
.fb-note-text { white-space: pre-wrap; color: var(--ink); font-size: 13.5px; word-break: break-word; }
.fb-meta { font-size: 12px; color: var(--mid); word-break: break-word; }
.fb-thumb img { display: block; max-width: 100%; max-height: 140px; border: 1px solid var(--line); border-radius: 4px; }
.fb-outline {
  position: fixed; z-index: 45; pointer-events: none; border: 2px solid var(--blue); border-radius: 6px;
  background: rgba(0, 82, 155, .08); transition: all .06s;
}
.fb-banner {
  position: fixed; top: 14px; left: 50%; transform: translateX(-50%); z-index: 46;
  background: var(--ink); color: var(--paper); padding: 8px 16px; border-radius: 20px; font-size: 13px; box-shadow: var(--shadow);
}
.fb-banner kbd { font: inherit; font-weight: 700; }
body.fb-pointing, body.fb-pointing * { cursor: crosshair !important; }
.drawer-body { padding-bottom: 80px; }

/* ---------- Small screens ---------- */
@media (max-width: 820px) {
  .shell { grid-template-columns: 1fr; grid-template-rows: auto 1fr; }
  .sidebar { flex-direction: row; flex-wrap: wrap; align-items: center; padding: 10px 16px; gap: 10px; }
  .brand-sub { display: none; }
  .nav { flex-direction: row; order: 3; width: 100%; overflow-x: auto; }
  .nav-item { white-space: nowrap; gap: 6px; }
  .nav-item.active { box-shadow: inset 0 -2px 0 var(--accent); }
  .sidebar-foot { margin: 0 0 0 auto; }
  .me-text { display: none; }
  .page { padding: 18px 16px 30px; }
  .page-head h1 { font-size: 23px; }
  .form-grid { grid-template-columns: 1fr; }
  .sub-add { grid-template-columns: 1fr 1fr; }
  .sub-add input[name=SubTitle] { grid-column: 1 / -1; }
  .task-side .avatar { display: none; }
}
