/*! © 2026 Other Work LTD. Other work Tasks web app. */

:root {
  --primary: #4682B4;
  --primary-dark: #225ca2;
  --primary-soft: rgba(70, 130, 180, .12);
  --on-primary: #fff;
  --bg: #f4f7fb;
  --card: #ffffff;
  --border: #d6deeb;
  --text: #1f2933;
  --muted: #5b657a;
  --todo: #6b7280;
  --todo-soft: #eceef1;
  --doing: #2f6fa6;
  --doing-soft: #dfeaf6;
  --waiting: #a16207;
  --waiting-soft: #fdf1d2;
  --done: #1a8f3a;
  --done-soft: #dff3e6;
  --danger: #c62828;
  --danger-soft: #fbdede;
  --shadow: 0 1px 2px rgba(15, 23, 42, .06), 0 4px 16px rgba(15, 23, 42, .06);
  --radius: 10px;
  --sidebar: 280px;
  --detail: 420px;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0b1220;
    --card: #111a2e;
    --border: rgba(201, 211, 230, .16);
    --text: #e5e7eb;
    --muted: rgba(229, 231, 235, .66);
    --primary-soft: rgba(70, 130, 180, .22);
    --todo: #a3a9b5;
    --todo-soft: rgba(255, 255, 255, .07);
    --doing: #8fbcef;
    --doing-soft: rgba(70, 130, 180, .22);
    --waiting: #f0b45a;
    --waiting-soft: rgba(240, 160, 40, .16);
    --done: #5fd38a;
    --done-soft: rgba(26, 143, 58, .2);
    --danger: #ff8a80;
    --danger-soft: rgba(198, 40, 40, .2);
    --shadow: 0 1px 2px rgba(0, 0, 0, .3);
    color-scheme: dark;
  }
}

:root[data-theme="dark"] {
  --bg: #0b1220;
  --card: #111a2e;
  --border: rgba(201, 211, 230, .16);
  --text: #e5e7eb;
  --muted: rgba(229, 231, 235, .66);
  --primary-soft: rgba(70, 130, 180, .22);
  --todo: #a3a9b5;
  --todo-soft: rgba(255, 255, 255, .07);
  --doing: #8fbcef;
  --doing-soft: rgba(70, 130, 180, .22);
  --waiting: #f0b45a;
  --waiting-soft: rgba(240, 160, 40, .16);
  --done: #5fd38a;
  --done-soft: rgba(26, 143, 58, .2);
  --danger: #ff8a80;
  --danger-soft: rgba(198, 40, 40, .2);
  --shadow: 0 1px 2px rgba(0, 0, 0, .3);
  color-scheme: dark;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font: 14px/1.45 "Segoe UI", -apple-system, BlinkMacSystemFont, Roboto, "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}

/* Scrollbars: a thin, faint thumb with no track or arrows, everywhere. */
* { scrollbar-width: thin; scrollbar-color: rgba(127, 127, 127, .35) transparent; }
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(127, 127, 127, .35); border-radius: 8px; border: 2px solid transparent; background-clip: padding-box; }
::-webkit-scrollbar-button { display: none; }

/* The app fills the window, so the sidebar's footer (sync, import, account) sits at the bottom. */
#app { height: 100%; }

button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--primary); }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.spacer { flex: 1; }

/* ===== Buttons and fields ===== */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 36px; padding: 0 14px;
  border: 1px solid var(--primary-dark); border-radius: 8px;
  background: var(--primary); color: var(--on-primary);
  font-weight: 600; white-space: nowrap;
}
.btn:hover { background: var(--primary-dark); }
.btn:disabled { opacity: .5; cursor: default; }
.btn.secondary { background: var(--card); color: var(--text); border-color: var(--border); font-weight: 500; }
.btn.secondary:hover { background: var(--primary-soft); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--muted); font-weight: 500; }
.btn.ghost:hover { background: var(--primary-soft); color: var(--text); }
.btn.danger { background: var(--card); color: var(--danger); border-color: var(--danger-soft); }
.btn.danger:hover { background: var(--danger-soft); }
.btn.small { min-height: 30px; padding: 0 10px; font-size: 13px; }
.icon-btn {
  width: 36px; height: 36px; display: inline-grid; place-items: center;
  border: 0; border-radius: 8px; background: transparent; color: var(--muted); font-size: 18px;
}
.icon-btn:hover { background: var(--primary-soft); color: var(--text); }

.field { display: grid; gap: 4px; margin-bottom: 12px; }
.field > span { font-size: 12px; font-weight: 600; color: var(--muted); }
.input, .textarea, .select {
  width: 100%; min-height: 38px; padding: 8px 10px;
  border: 1px solid var(--border); border-radius: 8px;
  background: var(--card); outline: none;
}
.textarea { min-height: 90px; resize: vertical; }
.input:focus, .textarea:focus, .select:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
.row { display: flex; gap: 8px; align-items: center; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

/* ===== Sign-in screen ===== */

.auth {
  min-height: 100%; display: grid; place-items: center;
  padding: calc(24px + var(--safe-top)) 16px calc(24px + var(--safe-bottom));
}
.auth-card {
  width: 100%; max-width: 400px; background: var(--card);
  border: 1px solid var(--border); border-radius: 14px; padding: 28px 24px; box-shadow: var(--shadow);
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 18px; margin-bottom: 18px; }
.brand-mark {
  width: 34px; height: 34px; border-radius: 9px; background: var(--primary); color: #fff;
  display: grid; place-items: center; font-size: 18px;
}
.brand small { display: block; font-weight: 500; font-size: 12px; color: var(--muted); }
.auth h1 { font-size: 20px; margin: 0 0 4px; }
.auth p { margin: 0 0 18px; }
.auth .btn { width: 100%; min-height: 42px; margin-top: 4px; }
.auth-switch { text-align: center; margin-top: 16px; font-size: 13px; }
.auth-switch button { border: 0; background: none; color: var(--primary); font-weight: 600; padding: 0; }
.error-box { background: var(--danger-soft); color: var(--danger); border-radius: 8px; padding: 8px 10px; margin-bottom: 12px; font-size: 13px; }
.ok-box { background: var(--done-soft); color: var(--done); border-radius: 8px; padding: 8px 10px; margin-bottom: 12px; font-size: 13px; }
.hp { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }

/* ===== App shell ===== */

.shell { display: grid; grid-template-columns: var(--sidebar) 1fr; height: 100%; min-height: 0; }

.sidebar {
  background: var(--card); border-right: 1px solid var(--border);
  display: flex; flex-direction: column; min-height: 0;
  padding-top: var(--safe-top);
}
.sidebar-head { display: flex; align-items: center; gap: 10px; padding: 14px 14px 10px; }
.sidebar-head .brand { margin: 0; font-size: 15px; }
.sidebar-scroll { flex: 1; overflow-y: auto; padding: 4px 8px 12px; }
.nav-label { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); padding: 14px 8px 6px; display: flex; align-items: center; }
.nav-item {
  width: 100%; display: flex; align-items: center; gap: 10px;
  border: 0; background: transparent; border-radius: 8px;
  padding: 8px 10px; text-align: left; color: var(--text);
}
.nav-item:hover { background: var(--primary-soft); }
.nav-item.active { background: var(--primary-soft); color: var(--primary-dark); font-weight: 600; }
:root[data-theme="dark"] .nav-item.active { color: #b9d5f1; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .nav-item.active { color: #b9d5f1; } }
.nav-item .ico { width: 22px; text-align: center; flex: none; }
.nav-item .name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav-item .count { font-size: 12px; color: var(--muted); font-weight: 500; }
.nav-item .mini-bar { width: 100%; }
.project-dot { width: 10px; height: 10px; border-radius: 50%; flex: none; margin: 0 6px; }

.sidebar-foot { border-top: 1px solid var(--border); padding: 10px 12px calc(10px + var(--safe-bottom)); display: flex; align-items: center; gap: 8px; font-size: 12px; }
.sync-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--done); flex: none; }
.sync-dot.pending { background: var(--waiting); }
.sync-dot.offline { background: var(--todo); }
.sync-dot.error { background: var(--danger); }

.main { min-width: 0; display: flex; flex-direction: column; min-height: 0; }
.topbar {
  display: flex; align-items: center; gap: 10px;
  padding: calc(12px + var(--safe-top)) 20px 12px;
  border-bottom: 1px solid var(--border); background: var(--card);
}
.topbar h2 { margin: 0; font-size: 18px; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: none; max-width: 40%; }

/* Progress in the top bar, next to the title. */
.head-stats { display: flex; align-items: center; gap: 6px 14px; flex-wrap: wrap; min-width: 0; margin-left: 10px; font-size: 13px; color: var(--muted); }
.head-stats .hs-bar { width: 140px; flex: none; }
.head-stats b { color: var(--text); }
.head-stats .hs-n { white-space: nowrap; }
.head-stats .hs-n.doing b { color: var(--doing); }
.head-stats .hs-n.waiting b { color: var(--waiting); }
.head-stats .hs-n.done b { color: var(--done); }
.head-stats .hs-money { white-space: nowrap; font-variant-numeric: tabular-nums; }
.menu-btn { display: none; }
.theme-btn { font-size: 17px; flex: none; }
.content { flex: 1; overflow-y: auto; scrollbar-gutter: stable; padding: 18px 20px calc(40px + var(--safe-bottom)); }
/* While a window is open, the page behind it stays still. */
body:has(.backdrop) .content { overflow: hidden; }
.content-inner { max-width: 980px; margin: 0 auto; }

/* ===== Progress and money ===== */

.progress { height: 8px; border-radius: 99px; background: var(--todo-soft); overflow: hidden; display: flex; }
.progress > i { display: block; height: 100%; }
.progress .p-done { background: var(--done); }
.progress .p-doing { background: var(--doing); }
.progress .p-waiting { background: var(--waiting); }
.progress.thin { height: 4px; }

.summary {
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 14px 16px; margin-bottom: 14px; box-shadow: var(--shadow);
}
.summary-top { display: flex; align-items: baseline; gap: 10px; margin-bottom: 8px; flex-wrap: wrap; }
.summary-top .pct { font-size: 22px; font-weight: 700; }
.stats { display: flex; gap: 18px; flex-wrap: wrap; margin-top: 10px; font-size: 13px; }
.stat b { display: block; font-size: 16px; }
.stat.money b { font-variant-numeric: tabular-nums; }

.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; }
.card {
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 14px; box-shadow: var(--shadow); cursor: pointer; text-align: left; width: 100%;
}
.card:hover { border-color: var(--primary); }
.card h3 { margin: 0 0 2px; font-size: 15px; display: flex; align-items: center; gap: 8px; }
.card .meta { font-size: 12px; color: var(--muted); margin: 6px 0 0; display: flex; gap: 10px; flex-wrap: wrap; }

/* ===== Quick add and filters ===== */

.quick-add { display: flex; gap: 8px; margin-bottom: 12px; }
.quick-add .input { min-height: 42px; font-size: 15px; }
.tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 12px; }
.tab {
  border: 1px solid var(--border); background: var(--card); border-radius: 99px;
  padding: 5px 12px; font-size: 13px; color: var(--muted);
}
.tab.active { background: var(--primary); border-color: var(--primary); color: #fff; }
.tab .n { opacity: .75; margin-left: 4px; }

/* ===== Task list ===== */

.list { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.list + .list { margin-top: 14px; }
.list-head { display: flex; align-items: center; gap: 8px; padding: 10px 14px; font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); border-bottom: 1px solid var(--border); background: transparent; width: 100%; border-left: 0; border-right: 0; border-top: 0; text-align: left; }
.task {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 10px 14px; border-top: 1px solid var(--border); cursor: pointer;
}
.list-head + .task, .task:first-child { border-top: 0; }
.task:hover { background: var(--primary-soft); }
.task.selected { background: var(--primary-soft); box-shadow: inset 3px 0 0 var(--primary); }
.check {
  width: 22px; height: 22px; flex: none; margin-top: 1px;
  border: 2px solid var(--border); border-radius: 50%; background: transparent;
  display: grid; place-items: center; color: transparent; font-size: 13px; padding: 0;
}
.check:hover { border-color: var(--done); color: var(--done); }
.check.on { background: var(--done); border-color: var(--done); color: #fff; cursor: default; }
.check.cancelled { background: var(--todo); border-color: var(--todo); color: #fff; cursor: default; font-size: 12px; }
.check.cancelled:hover { color: #fff; }
.task-body { flex: 1; min-width: 0; }
.task-title { font-size: 14.5px; word-wrap: break-word; }
.task.is-done .task-title { color: var(--muted); text-decoration: line-through; text-decoration-color: rgba(127, 127, 127, .5); }
.task-meta { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; margin-top: 3px; font-size: 12px; color: var(--muted); }
.task-meta .last { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%; }
/* The running line under a task: every note and price, oldest first. */
.task-meta .chain { display: inline; line-height: 1.6; word-break: break-word; }
.task-meta .chain b { color: var(--text); font-weight: 600; font-variant-numeric: tabular-nums; }
.task-meta .chain i { font-style: normal; opacity: .55; margin: 0 6px; }
.price-in { width: 110px; flex: none; }
.tl-item.price::before { border-color: var(--done); }
.task-right { display: flex; align-items: center; gap: 8px; flex: none; }
.cost { font-variant-numeric: tabular-nums; font-weight: 600; font-size: 13px; }
.row-menu { width: 30px; height: 30px; font-size: 16px; opacity: 0; }
.task:hover .row-menu, .row-menu:focus { opacity: 1; }
@media (hover: none) { .row-menu { opacity: .7; } }
.task.is-done .cost { color: var(--muted); }
.star { color: #e0a800; }

.pill {
  display: inline-flex; align-items: center; gap: 4px; border-radius: 99px;
  padding: 1px 8px; font-size: 11.5px; font-weight: 600; border: 0; white-space: nowrap;
}
.pill.todo { background: var(--todo-soft); color: var(--todo); }
.pill.doing { background: var(--doing-soft); color: var(--doing); }
.pill.waiting { background: var(--waiting-soft); color: var(--waiting); }
.pill.done { background: var(--done-soft); color: var(--done); }
.pill.due { background: var(--todo-soft); color: var(--muted); font-weight: 500; }
.pill.due.late { background: var(--danger-soft); color: var(--danger); }
.pill.proj { background: transparent; border: 1px solid var(--border); color: var(--muted); font-weight: 500; }

.empty { text-align: center; padding: 40px 16px; color: var(--muted); }
.empty .big { font-size: 34px; margin-bottom: 6px; }

.day-head { font-size: 12px; font-weight: 700; color: var(--muted); padding: 14px 4px 6px; }

/* ===== Detail panel ===== */

.detail {
  background: var(--card); border-left: 1px solid var(--border);
  display: flex; flex-direction: column; min-height: 0;
  padding-top: var(--safe-top);
}
.detail-head { display: flex; align-items: center; gap: 6px; padding: 10px 12px; border-bottom: 1px solid var(--border); }
.detail-scroll { flex: 1; overflow-y: auto; padding: 16px; }
.detail .title-input { font-size: 18px; font-weight: 600; border: 1px solid transparent; padding: 6px 8px; margin: -6px -8px 10px; width: calc(100% + 16px); background: transparent; border-radius: 8px; resize: none; overflow: hidden; min-height: 0; }
.detail .title-input:hover { border-color: var(--border); }
.detail .title-input:focus { border-color: var(--primary); outline: none; background: var(--card); }
.status-picker { display: grid; grid-template-columns: repeat(auto-fit, minmax(0, 1fr)); gap: 6px; margin-bottom: 14px; }
.status-picker button {
  border: 1px solid var(--border); background: var(--card); border-radius: 8px;
  padding: 8px 4px; font-size: 12.5px; font-weight: 600; color: var(--muted);
}
.status-picker button.on.todo { background: var(--todo-soft); color: var(--todo); border-color: var(--todo); }
.status-picker button.on.doing { background: var(--doing-soft); color: var(--doing); border-color: var(--doing); }
.status-picker button.on.waiting { background: var(--waiting-soft); color: var(--waiting); border-color: var(--waiting); }
.status-picker button.on.done { background: var(--done-soft); color: var(--done); border-color: var(--done); }

.timeline { border-left: 2px solid var(--border); margin: 6px 0 0 6px; padding-left: 14px; }
.tl-item { position: relative; padding-bottom: 12px; }
.tl-item::before { content: ""; position: absolute; left: -20px; top: 5px; width: 10px; height: 10px; border-radius: 50%; background: var(--card); border: 2px solid var(--primary); }
.tl-item.status::before { border-color: var(--muted); }
.tl-item .when { font-size: 11.5px; color: var(--muted); }
.tl-item .text { white-space: pre-wrap; word-wrap: break-word; }
.tl-item .del { border: 0; background: none; color: var(--muted); font-size: 12px; padding: 0 4px; visibility: hidden; }
.tl-item:hover .del { visibility: visible; }
.section-title { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); margin: 18px 0 8px; }

/* ===== Dialogs and toast ===== */

.backdrop { position: fixed; inset: 0; background: rgba(15, 23, 42, .45); z-index: 50; display: grid; place-items: center; padding: 16px; }
.dialog { background: var(--card); border-radius: 14px; width: 100%; max-width: 480px; max-height: 90vh; overflow-y: auto; scrollbar-width: thin; padding: 20px; box-shadow: 0 20px 60px rgba(0, 0, 0, .3); }
.dialog h3 { margin: 0 0 14px; font-size: 17px; }
.dialog .actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 16px; flex-wrap: wrap; }
.swatches { display: flex; gap: 8px; flex-wrap: wrap; }
.swatch { width: 28px; height: 28px; border-radius: 50%; border: 2px solid transparent; padding: 0; display: inline-grid; place-items: center; }
/* The chosen colour: a white gap, a dark ring around it and a tick inside - clear at a glance. */
.swatch.on { border-color: var(--card); box-shadow: 0 0 0 2px var(--text); transform: scale(1.12); }
.swatch.on::after { content: "✓"; color: #fff; font-size: 14px; font-weight: 700; line-height: 1; text-shadow: 0 1px 2px rgba(0, 0, 0, .35); }
.swatch { transition: transform .12s ease; }
.swatch.more { background: var(--card); border: 1px dashed var(--muted); }
.swatch.more:hover { border-color: var(--primary); color: var(--primary); }
.more-colours { margin-top: 8px; }
.swatch.custom { position: relative; overflow: hidden; cursor: pointer; background: conic-gradient(#ef4444, #eab308, #22c55e, #06b6d4, #6366f1, #ec4899, #ef4444); }
.swatch.custom input { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; border: 0; padding: 0; }

/* Project icons: picked with a click, shown to the right of the project name. */
.icon-grid { display: grid; grid-template-columns: repeat(10, minmax(0, 1fr)); gap: 4px; }
.more-icons { margin-top: 4px; }
.icon-pick.more, .swatch.more { display: grid; place-items: center; padding: 0; color: var(--muted); }
.icon-pick.more svg, .swatch.more svg { display: block; }
.icon-pick { height: 38px; border: 1px solid transparent; border-radius: 8px; background: var(--todo-soft); font-size: 19px; line-height: 1; padding: 0; color: var(--muted); }
.icon-pick:hover { border-color: var(--border); background: var(--primary-soft); }
.icon-pick.on { border-color: var(--primary); background: var(--primary-soft); box-shadow: 0 0 0 2px var(--primary-soft); }
.p-icon { font-weight: normal; margin-left: 2px; }

.toast {
  position: fixed; left: 50%; bottom: calc(20px + var(--safe-bottom)); transform: translateX(-50%);
  background: #1f2933; color: #fff; border-radius: 10px; padding: 10px 14px; z-index: 60;
  display: flex; gap: 12px; align-items: center; box-shadow: 0 8px 30px rgba(0, 0, 0, .3); max-width: calc(100% - 32px);
}
.toast button { border: 0; background: none; color: #8fbcef; font-weight: 700; }

.menu { position: fixed; z-index: 55; background: var(--card); border: 1px solid var(--border); border-radius: 10px; box-shadow: 0 10px 30px rgba(0, 0, 0, .18); padding: 4px; min-width: 180px; }
.menu button { display: flex; width: 100%; gap: 8px; align-items: center; border: 0; background: none; padding: 8px 10px; border-radius: 6px; text-align: left; }
.menu button:hover { background: var(--primary-soft); }
.menu button.danger { color: var(--danger); }
.menu { min-width: 220px; padding: 5px; }
.menu button { font-size: 13.5px; padding: 7px 10px; }
.menu .mi { width: 20px; text-align: center; flex: none; color: var(--muted); }
.menu button.danger .mi { color: var(--danger); }
.menu-sep { height: 1px; background: var(--border); margin: 4px 6px; }

/* The task window. */
/* The task window: header to drag it by, a body that scrolls only if it must, a fixed footer. */
.task-dialog { max-width: 620px; padding: 0; display: flex; flex-direction: column; overflow: hidden; max-height: min(90vh, 820px); }
.task-dialog-body { overflow-y: auto; padding: 0 20px 6px; scrollbar-width: thin; }
.task-dialog-foot { display: flex; align-items: center; gap: 8px; padding: 10px 16px 12px 12px; border-top: 1px solid var(--border); }
/* The history scrolls on its own, so its line and dots are drawn inside it rather than poking out. */
.task-dialog .timeline { max-height: 200px; overflow-y: auto; scrollbar-width: thin; margin: 6px 0 4px; padding-left: 24px; border-left: 0;
  background: linear-gradient(var(--border), var(--border)) no-repeat 6px 0 / 2px 100%; }
.task-dialog .textarea { min-height: 64px; }
.task-dialog .field { margin-bottom: 10px; }
.task-dialog .section-title { margin-top: 8px; }
.task-dialog-head { display: flex; align-items: center; gap: 4px; padding: 10px 10px 4px 20px; cursor: move; user-select: none; flex: none; }
.dialog > h3[data-drag] { cursor: move; user-select: none; }
.dialog.dragging { transition: none; box-shadow: 0 24px 70px rgba(0, 0, 0, .38); }
.task-dialog .title-input { font-size: 19px; font-weight: 600; border: 1px solid transparent; padding: 6px 8px; margin: 0 -8px 8px; width: calc(100% + 16px); background: transparent; border-radius: 8px; resize: none; overflow: hidden; min-height: 0; }
.task-dialog .title-input:hover { border-color: var(--border); }
.task-dialog .title-input:focus { border-color: var(--primary); outline: none; background: var(--card); }
.grid3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 10px; }
.backdrop.dialog-layer { z-index: 52; }

/* ===== Phone and tablet ===== */

@media (max-width: 1000px) {
  .head-stats .hs-n, .head-stats .hs-money { display: none; }
}

@media (max-width: 760px) {
  .shell { grid-template-columns: 1fr; }
  .head-stats { margin-left: 4px; }
  .head-stats .hs-bar { width: 70px; }
  .grid3 { grid-template-columns: 1fr 1fr; }
  .task-dialog-body { padding: 0 14px 6px; }
  .task-dialog-head { padding-left: 14px; }
  .backdrop { padding: 8px; align-items: end; }
  .backdrop .dialog { max-height: 94vh; }
  .sidebar { position: fixed; top: 0; left: 0; bottom: 0; width: min(300px, 86vw); z-index: 45; transform: translateX(-102%); transition: transform .2s ease; box-shadow: 10px 0 40px rgba(0, 0, 0, .2); }
  .sidebar.open { transform: none; }
  .scrim { position: fixed; inset: 0; background: rgba(15, 23, 42, .4); z-index: 44; }
  .menu-btn { display: inline-grid; }
  .topbar { padding-left: 10px; padding-right: 10px; }
  .content { padding: 12px 12px calc(40px + var(--safe-bottom)); }
  .detail { width: 100%; }
  .task { padding: 11px 12px; }
  .grid2 { grid-template-columns: 1fr; }
  .quick-add .btn span { display: none; }
  /* On a phone the task window's footer keeps Delete and Done editing; the others show icons only. */
  .task-dialog-foot .btn.ghost .lbl { display: none; }
  .task-dialog-foot { gap: 4px; }
}

/* Subprojects: indented in the sidebar, grouped under their project on its page. */
.nav-item.nav-sub { padding-left: 26px; font-size: 13.5px; }
.sub-list { margin-top: 14px; }
.list-head.sub-head { display: flex; align-items: center; gap: 8px; cursor: pointer; text-transform: none; letter-spacing: 0; font-size: 14px; font-weight: 700; }
.list-head.sub-head:hover { background: var(--primary-soft); }
.sub-progress { color: var(--muted); font-weight: 500; font-size: 12px; }
.sub-empty { padding: 10px 14px; font-size: 13px; }
.sub-list.flash { animation: sub-flash 1.4s ease-out; }
@keyframes sub-flash { 0%, 30% { box-shadow: 0 0 0 3px var(--primary); } 100% { box-shadow: 0 0 0 3px transparent; } }
.crumb { border: 0; background: none; padding: 0; font: inherit; font-weight: 600; cursor: pointer; }
.crumb:hover { text-decoration: underline; }
.crumb-sep { color: var(--muted); margin: 0 8px; font-weight: 400; }

/* Pictures on a task: square tiles, the + tile last. */
.pics { display: grid; grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); gap: 8px; margin-bottom: 4px; }
.pic-wrap { position: relative; }
.pic { display: block; width: 100%; aspect-ratio: 1; border: 1px solid var(--border); border-radius: 10px; overflow: hidden; padding: 0; background: var(--todo-soft); cursor: zoom-in; }
.pic img { width: 100%; height: 100%; object-fit: cover; display: block; }
.pic.broken::after { content: "?"; display: grid; place-items: center; height: 100%; color: var(--muted); }
.pic.uploading { display: grid; place-items: center; cursor: default; }
.pic-add { display: grid; place-items: center; cursor: pointer; color: var(--muted); border-style: dashed; background: transparent; }
.pic-add:hover { color: var(--primary); border-color: var(--primary); }
.pic-del { position: absolute; top: 4px; right: 4px; width: 22px; height: 22px; border-radius: 50%; border: 0; background: rgba(15, 23, 42, .65); color: #fff; font-size: 11px; line-height: 1; padding: 0; opacity: 0; transition: opacity .15s; }
.pic-wrap:hover .pic-del, .pic-del:focus-visible { opacity: 1; }
@media (hover: none) { .pic-del { opacity: .9; } }
.pics-count { white-space: nowrap; }
.spinner { width: 18px; height: 18px; border: 2px solid var(--border); border-top-color: var(--primary); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.task-dialog.drop-here { box-shadow: 0 0 0 3px var(--primary), 0 20px 60px rgba(0, 0, 0, .25); }

.lightbox { position: fixed; inset: 0; z-index: 90; background: rgba(0, 0, 0, .85); display: grid; place-items: center; padding: 16px; cursor: zoom-out; }
.lightbox img { max-width: 100%; max-height: 100%; object-fit: contain; border-radius: 6px; box-shadow: 0 10px 40px rgba(0, 0, 0, .5); }
.lightbox-close { position: absolute; top: calc(10px + env(safe-area-inset-top, 0px)); right: 12px; color: #fff; font-size: 18px; }

/* Earlier versions of a task's text. */
.versions { max-height: 55vh; overflow: auto; display: grid; gap: 10px; margin-bottom: 4px; }
.version { border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; }
.version-head { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--muted); }
.version-reason { font-size: 11.5px; color: var(--muted); margin: 2px 0 6px; }
.version-title { font-weight: 600; word-wrap: break-word; }
.version-notes { white-space: pre-wrap; word-wrap: break-word; font-size: 13px; margin-top: 4px; max-height: 120px; overflow: auto; }

/* iPhone zooms the page in when a field's text is under 16px, so on touch screens no field is
   smaller than that. Larger titles keep their own size. */
@media (hover: none) and (pointer: coarse) {
  input, textarea, select, .input, .textarea, .select, .quick-add .input { font-size: 16px; }
}
