/* GTG Work Task Manager. Colours are tokens: light here, dark below (device setting, or the header toggle).
   No CSS transitions or keyframes: the little motion there is runs in app.js and skips reduced-motion devices. */
:root {
  color-scheme: light;
  --bg: #f4f6fa; --surface: #ffffff; --surface-2: #f6f8fb; --ink: #172033; --muted: #5a6477; --line: #e1e6ee;
  --field: #ffffff; --field-line: #c9d2df;
  --head: #18243a; --head-ink: #ffffff; --head-muted: #c3ccda; --head-btn: #26354f;
  --primary: #2f5bf0; --primary-ink: #ffffff; --soft: #e9eef6; --soft-ink: #263247; --danger: #b42318; --danger-ink: #ffffff;
  --pill: #eef1f6; --pill-ink: #3d485c; --late: #b42318; --today: #8a5300; --focus: #2f5bf0;
  --q1: #c8372d; --q1-bg: #fff2f0; --q2: #2f5bf0; --q2-bg: #eef3ff; --q3: #a35f00; --q3-bg: #fff7e6; --q4: #23784a; --q4-bg: #ecf7f0;
  --shadow: 0 1px 2px rgba(24, 36, 58, .07);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #0e141e; --surface: #182132; --surface-2: #1c2638; --ink: #e7ecf4; --muted: #a6b1c3; --line: #2b3649;
    --field: #111926; --field-line: #3a4760;
    --head: #0a0f17; --head-ink: #ffffff; --head-muted: #a9b4c6; --head-btn: #1c2638;
    --primary: #3a63f2; --primary-ink: #ffffff; --soft: #26324a; --soft-ink: #dde5f1; --danger: #c9302c; --danger-ink: #ffffff;
    --pill: #26324a; --pill-ink: #d3dbe8; --late: #ff9a91; --today: #f4be5c; --focus: #8ea9ff;
    --q1: #ff8a80; --q1-bg: #231a21; --q2: #8ea9ff; --q2-bg: #171f36; --q3: #f0b44c; --q3-bg: #221f18; --q4: #62d394; --q4-bg: #142420;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3);
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0e141e; --surface: #182132; --surface-2: #1c2638; --ink: #e7ecf4; --muted: #a6b1c3; --line: #2b3649;
  --field: #111926; --field-line: #3a4760;
  --head: #0a0f17; --head-ink: #ffffff; --head-muted: #a9b4c6; --head-btn: #1c2638;
  --primary: #3a63f2; --primary-ink: #ffffff; --soft: #26324a; --soft-ink: #dde5f1; --danger: #c9302c; --danger-ink: #ffffff;
  --pill: #26324a; --pill-ink: #d3dbe8; --late: #ff9a91; --today: #f4be5c; --focus: #8ea9ff;
  --q1: #ff8a80; --q1-bg: #231a21; --q2: #8ea9ff; --q2-bg: #171f36; --q3: #f0b44c; --q3-bg: #221f18; --q4: #62d394; --q4-bg: #142420;
  --shadow: 0 1px 2px rgba(0, 0, 0, .3);
}

* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 14px/1.45 "Segoe UI", system-ui, -apple-system, Roboto, Arial, sans-serif; }
[hidden] { display: none !important; }
h1, h2, h3, h4 { line-height: 1.2; }
.muted { color: var(--muted); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }

/* Header */
.top { background: var(--head); color: var(--head-ink); }
.top-in { max-width: 1440px; margin: 0 auto; padding: 20px 24px; display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.brand { font-size: 20px; font-weight: 750; letter-spacing: .2px; }
.sub { color: var(--head-muted); font-size: 12px; margin-top: 3px; }
.top-actions { display: flex; align-items: center; gap: 8px; flex: none; }
.icon-btn, .head-btn { background: var(--head-btn); color: var(--head-ink); border: 1px solid rgba(255, 255, 255, .16); border-radius: 9px; height: 38px; cursor: pointer; font: inherit; font-weight: 600; font-size: 13px; }
.icon-btn { width: 38px; display: inline-flex; align-items: center; justify-content: center; padding: 0; }
.head-btn { padding: 0 12px; display: inline-flex; align-items: center; gap: 7px; white-space: nowrap; }
.head-btn svg { flex: none; }
.icon-btn:hover, .head-btn:hover { border-color: rgba(255, 255, 255, .4); }

/* Buttons and fields */
button { font: inherit; }
.primary, .secondary, .outline, .danger { border: 0; border-radius: 9px; padding: 10px 14px; font-weight: 650; font-size: 13px; cursor: pointer; white-space: nowrap; }
.primary { background: var(--primary); color: var(--primary-ink); }
.primary:hover { filter: brightness(1.08); }
.secondary { background: var(--soft); color: var(--soft-ink); }
.outline { background: var(--surface); border: 1px solid var(--field-line); color: var(--ink); }
.outline:hover, .secondary:hover { border-color: var(--muted); }
.danger { background: var(--danger); color: var(--danger-ink); }
.tiny { border: 1px solid var(--line); border-radius: 7px; padding: 4px 9px; font-size: 12px; font-weight: 600; background: var(--soft); color: var(--soft-ink); cursor: pointer; }
.tiny:hover { border-color: var(--muted); }
input, select, textarea { width: 100%; padding: 10px 11px; border: 1px solid var(--field-line); border-radius: 8px; background: var(--field); color: var(--ink); font: inherit; }
textarea { resize: vertical; }
::placeholder { color: var(--muted); opacity: 1; }

/* Loading and sign-in */
.loading { text-align: center; color: var(--muted); padding: 80px 16px; margin: 0; }
.login { display: flex; justify-content: center; padding: 64px 16px; }
.login-card { width: min(400px, 100%); background: var(--surface); border: 1px solid var(--line); border-radius: 15px; padding: 26px; box-shadow: var(--shadow); }
.login-card h1 { margin: 0 0 6px; font-size: 22px; }
.login-card p { margin: 0 0 18px; }
.login-card label { display: block; font-weight: 650; font-size: 12px; margin-bottom: 5px; }
.login-card .primary { width: 100%; margin-top: 4px; }
.form-error { color: var(--late); font-size: 13px; min-height: 1.45em; margin: 8px 0 !important; }

/* Page */
.wrap { max-width: 1440px; margin: 26px auto; padding: 0 24px 40px; }
.topline { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 20px; flex-wrap: wrap; }
.topline h1 { font-size: 25px; margin: 0 0 4px; }
.topline p { margin: 0; }
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 13px; margin-bottom: 22px; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: 13px; padding: 16px; }
.stat small { color: var(--muted); font-size: 12px; }
.stat strong { display: block; font-size: 27px; margin-top: 5px; }
.stat-overdue.has-overdue strong { color: var(--late); }
.toolbar { display: flex; gap: 9px; flex-wrap: wrap; margin-bottom: 12px; }
.toolbar input { flex: 1 1 220px; min-width: 0; }
.toolbar select { flex: 0 1 200px; min-width: 0; }
.toolbar-end { display: flex; gap: 9px; margin-left: auto; }
.board-hint { font-size: 12px; margin: 0 0 10px; }

/* Board: the four quadrants as columns */
.board { position: relative; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; align-items: start; }
.col { background: var(--qbg); border: 1px solid var(--line); border-top: 4px solid var(--qc); border-radius: 13px; padding: 13px; min-height: 220px; }
.q1 { --qc: var(--q1); --qbg: var(--q1-bg); }
.q2 { --qc: var(--q2); --qbg: var(--q2-bg); }
.q3 { --qc: var(--q3); --qbg: var(--q3-bg); }
.q4 { --qc: var(--q4); --qbg: var(--q4-bg); }
.col.drop { outline: 2px dashed var(--qc); outline-offset: 2px; }
.col-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; margin-bottom: 10px; }
.col-head h3 { font-size: 15px; margin: 0; }
.col-head h3 b { color: var(--qc); }
.col-head p { margin: 2px 0 0; font-size: 12px; color: var(--muted); }
.count { background: var(--surface); border: 1px solid var(--line); border-radius: 20px; padding: 2px 9px; font-weight: 700; font-size: 12px; flex: none; }
.empty { color: var(--muted); font-size: 12px; padding: 10px 2px; margin: 0; }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 11px; margin: 0 0 8px; box-shadow: var(--shadow); }
.card[draggable="true"] { cursor: grab; }
.card.dragging { opacity: .45; }
.card-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; }
.card-name { font-size: 14px; font-weight: 700; margin: 0; overflow-wrap: anywhere; }
.card-desc { color: var(--muted); font-size: 12px; margin: 5px 0 0; white-space: pre-line; overflow-wrap: anywhere; }
.meta { display: flex; gap: 6px 8px; flex-wrap: wrap; align-items: center; color: var(--muted); font-size: 12px; margin-top: 8px; }
.pill { padding: 2px 8px; border-radius: 20px; background: var(--pill); color: var(--pill-ink); font-size: 11px; font-weight: 600; white-space: nowrap; }
.due { white-space: nowrap; }
.due-late { color: var(--late); font-weight: 700; }
.due-today { color: var(--today); font-weight: 700; }
.card-foot { display: flex; gap: 7px; align-items: center; margin-top: 9px; }
.card-foot select { font-size: 12px; padding: 5px 7px; flex: 1; min-width: 0; }
.card.done { background: var(--surface-2); box-shadow: none; }
.card.done .card-name { text-decoration: line-through; color: var(--muted); }

/* All tasks table */
.lower { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; margin: 26px 0 10px; flex-wrap: wrap; }
.lower h2 { font-size: 16px; margin: 0; }
.lower h2 span { font-weight: 400; font-size: 14px; }
.table-wrap { border: 1px solid var(--line); border-radius: 12px; overflow: hidden; background: var(--surface); }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 11px; border-bottom: 1px solid var(--line); font-size: 13px; vertical-align: top; }
tbody tr:last-child td { border-bottom: 0; }
th { background: var(--surface-2); color: var(--muted); font-size: 12px; font-weight: 650; }
td.nowrap, .row-actions { white-space: nowrap; }
.row-actions { text-align: right; }
.row-actions .tiny + .tiny { margin-left: 5px; }
.qtag { font-weight: 700; color: var(--qc); }
.notice { font-size: 12px; color: var(--muted); margin-top: 14px; }

/* Dialogs and toast */
.dialog { background: var(--surface); color: var(--ink); width: min(570px, calc(100% - 32px)); max-height: 92vh; border: 1px solid var(--line); border-radius: 15px; padding: 21px; box-shadow: 0 20px 60px rgba(0, 0, 0, .3); }
.dialog::backdrop { background: rgba(10, 15, 25, .6); }
.dialog-small { width: min(420px, calc(100% - 32px)); }
.dialog h2 { margin: 0 0 16px; font-size: 19px; }
.dialog-small h2 { margin-bottom: 8px; }
.formgrid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 12px; }
.field { margin-bottom: 12px; }
.field label { display: block; font-weight: 650; font-size: 12px; margin-bottom: 5px; }
.full { grid-column: 1 / -1; }
.hint { display: block; color: var(--muted); font-size: 12px; margin-top: 4px; }
.dialog .form-error { margin: 0 0 4px !important; }
.dialogfoot { display: flex; justify-content: flex-end; gap: 8px; margin-top: 15px; }
.toast { position: fixed; left: 50%; bottom: 22px; transform: translateX(-50%); background: var(--ink); color: var(--bg); padding: 10px 16px; border-radius: 10px; font-size: 13px; font-weight: 600; box-shadow: 0 8px 30px rgba(0, 0, 0, .25); z-index: 10; max-width: calc(100% - 32px); }

/* Quadrant jump buttons, shown only when the columns scroll sideways */
.board-tabs { display: none; gap: 6px; margin-bottom: 10px; }
.board-tabs button { flex: 1; border: 1px solid var(--line); border-top: 3px solid var(--qc); border-radius: 9px; background: var(--surface); color: var(--ink); padding: 7px 4px; font-size: 13px; font-weight: 700; cursor: pointer; white-space: nowrap; }
.board-tabs button span { color: var(--muted); font-weight: 600; }
.board-tabs button[aria-current="true"] { background: var(--qbg); border-color: var(--qc); }

/* Narrower screens: the columns scroll sideways, one swipe per column */
@media (max-width: 1100px) {
  .board-tabs { display: flex; }
  .board { grid-template-columns: none; grid-auto-flow: column; grid-auto-columns: minmax(280px, 42%); overflow-x: auto; scroll-snap-type: x mandatory; padding-bottom: 8px; overscroll-behavior-x: contain; }
  .col { scroll-snap-align: start; }
}
@media (max-width: 760px) {
  .top-in { padding: 16px; }
  .brand { font-size: 15px; letter-spacing: 0; }
  /* Icons only in the phone header; the buttons keep their aria-labels */
  .head-btn { width: 38px; padding: 0; justify-content: center; }
  .head-btn span { display: none; }
  .wrap { padding: 0 16px 30px; margin-top: 20px; }
  .topline h1 { font-size: 22px; }
  .stats { grid-template-columns: 1fr 1fr; gap: 10px; }
  .toolbar select { flex: 1 1 140px; }
  .toolbar-end { margin-left: 0; width: 100%; }
  .toolbar-end button { flex: 1; }
  .board { grid-auto-columns: 86%; }
  .board-hint { display: none; }
  .formgrid { grid-template-columns: 1fr; }
  /* The table becomes one block per task */
  thead { display: none; }
  table, tbody, tr, td { display: block; }
  tr { padding: 10px 12px; border-bottom: 1px solid var(--line); }
  tbody tr:last-child { border-bottom: 0; }
  td { border: 0; padding: 3px 0; display: flex; gap: 10px; }
  td[data-label]::before { content: attr(data-label); color: var(--muted); font-size: 12px; min-width: 88px; flex: none; }
  td.task-cell { font-size: 14px; padding-bottom: 5px; }
  .row-actions { text-align: left; padding-top: 7px; }
}
