/* eGooroo Tasks */
:root {
  --brand: #0A5694;
  --brand-dark: #07426F;
  --brand-tint: #E7F0F8;
  --bg: #EEF3F8;
  --surface: #FFFFFF;
  --surface-2: #F6F8FB;
  --line: #DDE4EC;
  --line-soft: #EBEFF4;
  --text: #1B2430;
  --muted: #66758A;
  --red: #D32F2F;
  --red-tint: #FDECEC;
  --amber: #B26A00;
  --amber-tint: #FFF4E0;
  --green: #2E7D32;
  --shadow-sm: 0 1px 2px rgba(16, 38, 64, .06), 0 1px 3px rgba(16, 38, 64, .06);
  --shadow: 0 2px 6px rgba(16, 38, 64, .06), 0 8px 24px rgba(16, 38, 64, .07);
  --shadow-lg: 0 24px 64px rgba(10, 30, 55, .28);
  --radius: 14px;
  --radius-sm: 8px;
  --font: 'Open Sans', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --brand-tint: #16314B;
    --bg: #0E1620;
    --surface: #17212D;
    --surface-2: #1D2936;
    --line: #2A3848;
    --line-soft: #223040;
    --text: #E6EDF5;
    --muted: #93A3B6;
    --red: #FF6B6B;
    --red-tint: #3A1F24;
    --amber: #FFB84D;
    --amber-tint: #3A2D17;
    --green: #66BB6A;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, .3);
    --shadow: 0 2px 8px rgba(0, 0, 0, .35);
    color-scheme: dark;
  }
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.45;
  color: var(--text);
  background: var(--bg);
}
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; }
code { font-size: .9em; background: var(--surface-2); padding: 1px 5px; border-radius: 4px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.sprite { display: none; }
.inline { display: inline; margin: 0; }

.icon {
  width: 18px; height: 18px; flex: none;
  fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round;
}
.icon.rot { transform: rotate(-90deg); }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 38px; padding: 0 16px; border-radius: 10px; border: 1px solid transparent;
  font-weight: 600; font-size: 14px; background: var(--surface-2); white-space: nowrap;
  transition: background .15s, box-shadow .15s, transform .05s;
}
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-primary { background: var(--c, var(--brand)); color: var(--c-ink, #fff); }
.btn-primary:hover { filter: brightness(1.08); }
.btn-light { background: #fff; color: var(--brand); }
.btn-light:hover { background: #E7F0F8; }
.btn-ghost { background: transparent; border-color: var(--line); }
.btn-ghost:hover { background: var(--surface-2); }
.btn-danger-ghost { background: transparent; color: var(--red); }
.btn-danger-ghost:hover { background: var(--red-tint); }
.btn-block { width: 100%; }

.icon-btn {
  display: inline-grid; place-items: center; width: 34px; height: 34px; flex: none;
  border: 0; border-radius: 9px; background: transparent; color: inherit; opacity: .8;
  transition: background .15s, opacity .15s;
}
.icon-btn:hover { opacity: 1; background: rgba(127, 140, 160, .16); }
.icon-btn.on-dark { color: #fff; }
.icon-btn.on-dark:hover { background: rgba(255, 255, 255, .16); }
.icon-btn.tiny { width: 26px; height: 26px; border-radius: 7px; }
.icon-btn.tiny .icon { width: 15px; height: 15px; }

:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }

/* ---------- Login ---------- */
.login-page {
  min-height: 100vh; display: grid; place-items: center; padding: 24px;
  background: radial-gradient(1200px 600px at 20% -10%, #1F74B8 0%, transparent 60%), var(--brand);
}
.login-card {
  width: 100%; max-width: 400px; background: var(--surface); border-radius: 20px;
  padding: 36px 32px 30px; box-shadow: var(--shadow-lg); text-align: center;
}
.login-logo { width: 100%; max-width: 300px; height: auto; margin: 0 auto 6px; display: block; }
@media (prefers-color-scheme: dark) { .login-logo { filter: brightness(0) invert(1); } }
.login-card h1 {
  font-size: 13px; font-weight: 700; letter-spacing: .14em; text-transform: uppercase;
  color: var(--muted); margin: 10px 0 22px;
}
.login-card form { display: grid; gap: 12px; }
.login-card input[type=password] {
  height: 46px; padding: 0 14px; border-radius: 10px; border: 1px solid var(--line);
  background: var(--surface-2); font-size: 16px; text-align: center; letter-spacing: .05em;
}
.login-card input[type=password]:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px rgba(10, 86, 148, .18); }
.login-card .btn { height: 46px; font-size: 15px; }
.login-msg { font-size: 14px; border-radius: 10px; padding: 9px 12px; margin: 0 0 14px; }
.login-msg.error { background: var(--red-tint); color: var(--red); }
.login-msg.warn { background: var(--amber-tint); color: var(--amber); margin: 16px 0 0; font-size: 13px; }

/* ---------- Top bar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 16px;
  padding: 10px 24px; background: var(--brand); color: #fff;
  box-shadow: 0 2px 12px rgba(7, 40, 70, .25);
}
.brand img { display: block; height: 38px; width: auto; }
.search {
  flex: 1; max-width: 460px; margin-left: auto; position: relative; display: flex; align-items: center;
}
.search .icon { position: absolute; left: 12px; opacity: .75; pointer-events: none; }
.search input {
  width: 100%; height: 38px; padding: 0 12px 0 38px; border-radius: 10px; border: 0;
  background: rgba(255, 255, 255, .14); color: #fff; outline: none; transition: background .15s;
}
.search input::placeholder { color: rgba(255, 255, 255, .7); }
.search input:focus { background: rgba(255, 255, 255, .24); box-shadow: 0 0 0 2px rgba(255, 255, 255, .35); }
.topbar-actions { display: flex; align-items: center; gap: 8px; }

.toggle { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; user-select: none; font-size: 14px; font-weight: 600; padding: 0 6px; }
.toggle input { position: absolute; opacity: 0; pointer-events: none; }
.toggle-track { width: 34px; height: 20px; border-radius: 20px; background: rgba(255, 255, 255, .28); position: relative; transition: background .15s; }
.toggle-track::after { content: ''; position: absolute; top: 3px; left: 3px; width: 14px; height: 14px; border-radius: 50%; background: #fff; transition: transform .15s; }
.toggle input:checked + .toggle-track { background: #4FC3F7; }
.toggle input:checked + .toggle-track::after { transform: translateX(14px); }
.toggle input:focus-visible + .toggle-track { outline: 2px solid #fff; outline-offset: 2px; }

/* ---------- Layout ---------- */
.wrap { padding: 22px 24px 60px; max-width: 1800px; margin: 0 auto; }

/* ---------- Focus tiles ---------- */
.focus { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 18px; margin-bottom: 26px; }
.focus:empty { display: none; }
.focus-tile {
  background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow);
  border-top: 4px solid var(--accent); overflow: hidden; display: flex; flex-direction: column;
}
.focus-tile.urgent { --accent: var(--red); }
.focus-tile.due-soon { --accent: #F29C1F; }
.focus-tile header { display: flex; align-items: center; gap: 8px; padding: 13px 16px 9px; color: var(--accent); }
.focus-tile h2 { font-size: 15px; font-weight: 800; margin: 0; color: var(--text); }
.focus-tile .count { margin-left: auto; }
.count {
  min-width: 24px; height: 22px; padding: 0 7px; border-radius: 11px; display: inline-grid; place-items: center;
  font-size: 12px; font-weight: 700; background: var(--surface-2); color: var(--muted);
}
.focus-tile.urgent .count { background: var(--red-tint); color: var(--red); }
.pill { font-size: 11.5px; font-weight: 700; padding: 2px 8px; border-radius: 10px; }
.pill.overdue { background: var(--red-tint); color: var(--red); }
.focus-list { list-style: none; margin: 0; padding: 0 8px 10px; max-height: 280px; overflow-y: auto; }
.focus-item { display: flex; align-items: center; gap: 10px; padding: 6px 8px; border-radius: 9px; }
.focus-item:hover { background: var(--surface-2); }
.focus-open {
  flex: 1; min-width: 0; display: flex; align-items: center; gap: 9px; padding: 2px 0;
  border: 0; background: none; text-align: left;
}
.focus-client {
  flex: none; max-width: 40%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  font-size: 11.5px; font-weight: 700; padding: 2px 8px 2px 18px; border-radius: 6px; position: relative;
  background: color-mix(in srgb, var(--c) 14%, transparent); color: var(--text);
}
.focus-client::before {
  content: ''; position: absolute; left: 7px; top: 50%; width: 6px; height: 6px; margin-top: -3px;
  border-radius: 50%; background: var(--c);
}
.focus-title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.focus-empty { margin: 0; padding: 4px 18px 18px; color: var(--muted); font-size: 14px; }

/* ---------- Board ---------- */
.board {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(310px, 1fr));
  gap: 18px; align-items: start;
}
.client {
  background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow);
  overflow: hidden; display: flex; flex-direction: column;
}
.client-head {
  display: flex; align-items: center; gap: 4px; padding: 8px 6px 8px 8px;
  background: var(--c); color: var(--c-ink); cursor: grab; user-select: none;
}
.client-head:active { cursor: grabbing; }
.client-head .grip { opacity: .55; display: grid; }
.client-head .grip .icon { width: 16px; height: 16px; }
.client-head h2 {
  margin: 0 4px 0 0; font-size: 16px; font-weight: 800; flex: 1; min-width: 0;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.client-head .count { background: rgba(255, 255, 255, .22); color: inherit; margin-right: 2px; }
.client-head .icon-btn { width: 30px; height: 30px; }
.client-head .icon-btn:hover { background: rgba(255, 255, 255, .2); }
.client.collapsed .client-head { border-radius: var(--radius); }

.client-body { padding: 6px 0 8px; }
.client-notes {
  margin: 4px 14px 8px; padding: 7px 10px; font-size: 13px; color: var(--muted);
  background: color-mix(in srgb, var(--c) 8%, var(--surface)); border-left: 3px solid var(--c); border-radius: 0 6px 6px 0;
  white-space: pre-line; max-height: 5.9em; overflow: hidden;
}
.tasks { list-style: none; margin: 0; padding: 0 6px; min-height: 8px; }
.tasks-empty { margin: 4px 16px 6px; color: var(--muted); font-size: 13.5px; }

.task { border-radius: 9px; position: relative; }
.task:hover { background: var(--surface-2); }
.task-row { display: flex; align-items: flex-start; gap: 10px; padding: 7px 8px; cursor: grab; }
.task.is-urgent::before {
  content: ''; position: absolute; left: 0; top: 8px; bottom: 8px; width: 3px; border-radius: 3px; background: var(--red);
}
.task-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.task-title {
  min-width: 0; border: 0; background: none; padding: 0; text-align: left;
  line-height: 1.4; margin-top: 1px; word-wrap: break-word; overflow-wrap: anywhere;
}
.task-title:hover { color: var(--brand); }
@media (prefers-color-scheme: dark) { .task-title:hover { color: #7FB8E8; } }
.task.done .task-title { color: var(--muted); text-decoration: line-through; }
.task-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.flag { color: var(--red); display: grid; }
.flag .icon, .has-notes .icon { width: 15px; height: 15px; }
.has-notes { color: var(--muted); display: grid; }

.due {
  font-size: 11.5px; font-weight: 700; padding: 2px 7px; border-radius: 6px; white-space: nowrap;
  background: var(--surface-2); color: var(--muted); border: 1px solid var(--line-soft);
}
.due.overdue { background: var(--red); color: #fff; border-color: transparent; }
.due.today { background: var(--red-tint); color: var(--red); border-color: transparent; }
.due.soon { background: var(--amber-tint); color: var(--amber); border-color: transparent; }
.task.done .due { opacity: .5; background: var(--surface-2); color: var(--muted); }

.sub-toggle {
  display: inline-flex; align-items: center; gap: 2px; height: 22px; padding: 0 4px 0 7px;
  border: 1px solid var(--line); border-radius: 6px; background: var(--surface);
  font-size: 11.5px; font-weight: 700; color: var(--muted);
}
.sub-toggle .icon { width: 14px; height: 14px; transform: rotate(-90deg); transition: transform .15s; }
.sub-toggle.open .icon { transform: none; }
.sub-toggle.complete { color: var(--green); }
.sub-toggle:hover { border-color: var(--brand); color: var(--brand); }

.subs { list-style: none; margin: -2px 0 6px; padding: 0 8px 0 38px; }
.sub label { display: flex; align-items: flex-start; gap: 8px; padding: 3px 0; font-size: 13.5px; cursor: pointer; }
.sub.done span { color: var(--muted); text-decoration: line-through; }

/* Custom checkboxes */
.check {
  appearance: none; -webkit-appearance: none; flex: none; margin: 2px 0 0;
  width: 19px; height: 19px; border-radius: 50%; border: 2px solid #A9B6C6; background: var(--surface);
  display: grid; place-items: center; cursor: pointer; transition: background .15s, border-color .15s;
}
.check::after {
  content: ''; width: 5px; height: 9px; border: solid #fff; border-width: 0 2px 2px 0;
  transform: rotate(45deg) translate(-1px, -1px); opacity: 0;
}
.check:hover { border-color: var(--green); }
.check:checked { background: var(--green); border-color: var(--green); }
.check:checked::after { opacity: 1; }
.check.small { width: 16px; height: 16px; border-radius: 5px; margin-top: 2px; }
.check.small::after { width: 4px; height: 8px; }

.quick-add {
  display: flex; align-items: center; gap: 8px; margin: 4px 10px 0; padding: 0 8px;
  border-radius: 9px; color: var(--muted); transition: background .15s;
}
.quick-add:focus-within { background: var(--surface-2); color: var(--c); }
.quick-add input { flex: 1; height: 36px; border: 0; background: transparent; outline: none; min-width: 0; }
.quick-add input::placeholder { color: var(--muted); }

/* Drag & drop */
.drag-ghost { opacity: .35; }
.client.drag-ghost { outline: 2px dashed var(--brand); }
.is-dragging .task:hover { background: transparent; }
.is-dragging .tasks:empty { min-height: 44px; margin: 0 10px; border: 2px dashed var(--line); border-radius: 9px; }
.is-dragging .tasks:empty + .tasks-empty { display: none; }
.sortable-chosen .task-row, .sortable-chosen.client { cursor: grabbing; }

.empty-board { text-align: center; padding: 60px 20px; color: var(--muted); }
.empty-board img { opacity: .9; }
.empty-board h2 { color: var(--text); margin: 12px 0 4px; }
.empty-board p { margin: 0 0 18px; }
.no-results { text-align: center; color: var(--muted); padding: 30px; }

/* ---------- Dialogs ---------- */
.dialog {
  border: 0; padding: 0; border-radius: 18px; background: var(--surface); color: var(--text);
  box-shadow: var(--shadow-lg); width: min(600px, calc(100vw - 24px)); max-height: calc(100vh - 48px);
  overflow: hidden;
}
.dialog[open] { display: flex; flex-direction: column; animation: pop .16s ease-out; }
.dialog > form { display: flex; flex-direction: column; min-height: 0; flex: 1; }
.dialog::backdrop { background: rgba(10, 25, 45, .5); backdrop-filter: blur(2px); }
@keyframes pop { from { opacity: 0; transform: translateY(8px) scale(.98); } }
.dialog-accent { height: 6px; background: var(--c); flex: none; }
.dialog-head { display: flex; align-items: center; gap: 10px; padding: 14px 16px 6px 22px; flex: none; }
.dialog-head h2 { margin: 0; font-size: 18px; flex: 1; }
.dialog-head .icon-btn { margin-left: auto; }
.dialog-body { padding: 6px 22px 16px; overflow-y: auto; flex: 1; min-height: 0; }
.dialog-foot {
  display: flex; align-items: center; gap: 10px; padding: 12px 16px 12px 22px;
  border-top: 1px solid var(--line-soft); background: var(--surface-2); flex: none;
}
.dialog-foot .btn:last-child { margin-left: auto; }
.dialog-foot.end { justify-content: flex-end; }
.dialog-foot.end .btn:last-child { margin-left: 0; }

.field-label { display: block; font-size: 12px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); margin: 18px 0 7px; }
.field-label.with-meta span { font-weight: 600; letter-spacing: 0; text-transform: none; margin-left: 6px; }
.dialog input[type=text], .dialog textarea {
  width: 100%; border: 1px solid var(--line); border-radius: 10px; padding: 9px 12px; background: var(--surface);
  outline: none; transition: border-color .15s, box-shadow .15s;
}
.dialog input[type=text]:focus, .dialog textarea:focus { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(10, 86, 148, .15); }
.dialog textarea { resize: vertical; line-height: 1.5; }

.client-select {
  appearance: none; -webkit-appearance: none; border: 0; border-radius: 8px; padding: 5px 30px 5px 12px;
  font-weight: 700; font-size: 13px; cursor: pointer; max-width: 70%;
  background: var(--c) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='2.5'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E") no-repeat right 9px center / 14px;
  color: var(--c-ink);
}
.client-select option { background: var(--surface); color: var(--text); }

.td-title-row { display: flex; align-items: flex-start; gap: 12px; margin-top: 4px; }
.dialog .td-title {
  border-color: transparent; font-size: 21px; font-weight: 700; line-height: 1.3; padding: 4px 8px; margin-left: -8px;
  resize: none; overflow: hidden;
}
.dialog .td-title:hover { border-color: var(--line); }
.task-dialog.is-done .td-title { text-decoration: line-through; color: var(--muted); }
.round-check {
  flex: none; width: 30px; height: 30px; margin-top: 5px; border-radius: 50%; border: 2px solid #A9B6C6;
  background: var(--surface); display: grid; place-items: center; color: transparent; transition: all .15s;
}
.round-check:hover { border-color: var(--green); color: var(--green); }
.round-check.on { background: var(--green); border-color: var(--green); color: #fff; }
.round-check .icon { width: 16px; height: 16px; stroke-width: 3; }

.td-props { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 14px 0 0 42px; }
.chip-toggle {
  display: inline-flex; align-items: center; gap: 6px; height: 34px; padding: 0 12px;
  border-radius: 9px; border: 1px solid var(--line); background: var(--surface); font-weight: 600; font-size: 13.5px;
}
.chip-toggle .icon { width: 16px; height: 16px; }
.chip-toggle:hover { border-color: var(--red); color: var(--red); }
.chip-toggle.on { background: var(--red); border-color: var(--red); color: #fff; }
.date-field {
  display: inline-flex; align-items: center; gap: 6px; height: 34px; padding: 0 4px 0 10px;
  border: 1px solid var(--line); border-radius: 9px; color: var(--muted);
}
.date-field:focus-within { border-color: var(--brand); }
.date-field .icon { width: 16px; height: 16px; }
.date-field input { border: 0; background: none; outline: none; height: 30px; color: var(--text); font-size: 13.5px; }
.quick-dates { display: inline-flex; gap: 4px; }
.quick-dates button {
  height: 28px; padding: 0 9px; border-radius: 7px; border: 0; background: var(--surface-2);
  font-size: 12.5px; font-weight: 600; color: var(--muted);
}
.quick-dates button:hover { background: var(--brand-tint); color: var(--brand); }
.td-notes { min-height: 90px; }

.progress { height: 5px; border-radius: 5px; background: var(--line-soft); overflow: hidden; margin-bottom: 8px; }
.progress span { display: block; height: 100%; background: var(--green); border-radius: 5px; transition: width .25s; }
.sub-list { list-style: none; margin: 0; padding: 0; }
.sub-item { display: flex; align-items: center; gap: 6px; padding: 2px 0; border-radius: 8px; }
.sub-item:hover { background: var(--surface-2); }
.sub-item .grip { color: var(--muted); opacity: 0; cursor: grab; display: grid; }
.sub-item:hover .grip { opacity: .7; }
.sub-item .grip .icon { width: 15px; height: 15px; }
.sub-item .check.small { margin-top: 0; }
.dialog .sub-item .sub-title { flex: 1; border-color: transparent; padding: 5px 8px; background: transparent; }
.dialog .sub-item .sub-title:hover { border-color: var(--line); }
.sub-item.done .sub-title { text-decoration: line-through; color: var(--muted); }
.sub-item .icon-btn { opacity: 0; }
.sub-item:hover .icon-btn, .sub-item:focus-within .icon-btn { opacity: .7; }
.sub-add { display: flex; align-items: center; gap: 8px; padding-left: 26px; color: var(--muted); margin-top: 2px; }
.dialog .sub-add input { border-style: dashed; }

/* Client dialog */
.client-dialog { width: min(480px, calc(100vw - 24px)); }
.swatches { display: flex; flex-wrap: wrap; gap: 8px; }
.swatch {
  width: 34px; height: 34px; border-radius: 10px; border: 0; display: grid; place-items: center;
  color: #fff; position: relative; transition: transform .1s; box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .08);
}
.swatch:hover { transform: scale(1.08); }
.swatch .icon { width: 17px; height: 17px; stroke-width: 3; opacity: 0; }
.swatch.on { box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px var(--text); }
.swatch.on .icon { opacity: 1; }
.swatch.custom { background: var(--surface-2); color: var(--muted); cursor: pointer; border: 1px dashed var(--line); overflow: hidden; }
.swatch.custom .icon { opacity: 1; }
.swatch.custom.on { color: var(--c-ink); border: 0; }
.swatch.custom input { position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; height: 100%; border: 0; padding: 0; }
.cd-danger { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 22px; padding-top: 16px; border-top: 1px solid var(--line-soft); }

/* ---------- View switcher ---------- */
.views { display: flex; gap: 2px; padding: 3px; border-radius: 11px; background: rgba(0, 0, 0, .16); }
.views a {
  display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 12px; border-radius: 8px;
  color: rgba(255, 255, 255, .8); text-decoration: none; font-weight: 600; font-size: 14px;
}
.views a .icon { width: 16px; height: 16px; }
.views a:hover { color: #fff; background: rgba(255, 255, 255, .1); }
.views a.on { background: #fff; color: var(--brand); }
body.view-time .search, body.view-time .toggle { display: none; }
body.view-time .topbar-actions { margin-left: auto; }

/* ---------- Running timer (top bar) ---------- */
.timer-bar {
  display: flex; align-items: center; gap: 8px; height: 38px; padding: 0 4px 0 12px; min-width: 0; max-width: 380px;
  border-radius: 10px; background: #fff; color: var(--text); box-shadow: 0 0 0 3px rgba(255, 255, 255, .25);
}
.timer-bar.long { background: #FFF4E0; }
.rec-dot {
  flex: none; width: 9px; height: 9px; border-radius: 50%; background: #E53935;
  animation: pulse 1.6s ease-in-out infinite;
}
@keyframes pulse { 50% { opacity: .35; } }
.timer-task {
  display: flex; flex-direction: column; min-width: 0; border: 0; background: none; padding: 0; text-align: left; line-height: 1.15;
}
.timer-client { font-size: 10.5px; font-weight: 700; color: var(--c); text-transform: uppercase; letter-spacing: .04em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.timer-title { font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: #1B2430; }
.timer-task:hover .timer-title { text-decoration: underline; }
.timer-clock { font-variant-numeric: tabular-nums; font-weight: 800; font-size: 15px; color: #1B2430; }
.timer-stop {
  display: grid; place-items: center; width: 30px; height: 30px; flex: none; border: 0; border-radius: 8px;
  background: #E53935; color: #fff;
}
.timer-stop:hover { background: #C62828; }
.timer-stop .icon { width: 14px; height: 14px; }

/* ---------- Play buttons on tasks ---------- */
.play {
  flex: none; display: grid; place-items: center; width: 28px; height: 28px; margin: -3px -2px 0 0;
  border: 0; border-radius: 50%; background: transparent; color: var(--muted); opacity: 0; transition: opacity .15s, background .15s, color .15s;
}
.play .icon { width: 13px; height: 13px; }
.task:hover .play, .focus-item:hover .play, .play:focus-visible { opacity: 1; }
.play:hover { background: var(--brand-tint); color: var(--brand); }
.play.on { opacity: 1; background: #E53935; color: #fff; }
.play.on:hover { background: #C62828; color: #fff; }
.focus-item .play { margin: 0; }
.task.is-running { background: color-mix(in srgb, #E53935 7%, transparent); }
.time-chip {
  display: inline-flex; align-items: center; gap: 3px; font-size: 11.5px; font-weight: 700; color: var(--muted);
  font-variant-numeric: tabular-nums;
}
.time-chip .icon { width: 13px; height: 13px; }
.time-chip.running { color: #E53935; }

/* ---------- Time section in task dialog ---------- */
.td-time {
  display: flex; align-items: center; gap: 12px; margin: 16px 0 0; padding: 10px 12px;
  border-radius: 12px; background: var(--surface-2); border: 1px solid var(--line-soft);
}
.timer-btn {
  display: inline-flex; align-items: center; gap: 8px; height: 38px; padding: 0 16px 0 12px; border: 0; border-radius: 10px;
  background: var(--brand); color: #fff; font-weight: 700; font-size: 14px; flex: none;
}
.timer-btn .icon { width: 15px; height: 15px; }
.timer-btn:hover { filter: brightness(1.1); }
.timer-btn.on { background: #E53935; }
.td-time-total { display: flex; flex-direction: column; line-height: 1.25; min-width: 0; }
.td-time-total strong { font-size: 17px; font-variant-numeric: tabular-nums; }
.small-btn { height: 32px; padding: 0 11px; font-size: 13px; }
.small-btn .icon { width: 15px; height: 15px; }
.td-time .small-btn { margin-left: auto; }
.sessions { list-style: none; margin: 6px 0 0; padding: 0; max-height: 236px; overflow-y: auto; }
.session {
  display: grid; grid-template-columns: 7.5em 1fr auto auto; align-items: center; gap: 10px;
  padding: 5px 4px 5px 12px; border-radius: 8px; font-size: 13.5px;
}
.session:hover { background: var(--surface-2); }
.session-day { font-weight: 600; }
.session-span { color: var(--muted); }
.session-dur { font-weight: 700; font-variant-numeric: tabular-nums; text-align: right; }
.session.running .session-dur { color: #E53935; }
.session-actions { display: flex; opacity: 0; transition: opacity .15s; }
.session:hover .session-actions, .session:focus-within .session-actions { opacity: 1; }
.session-edit form { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; padding: 8px 10px; border-radius: 10px; background: var(--brand-tint); margin: 4px 0; }
.session-edit input { height: 32px; border: 1px solid var(--line); border-radius: 8px; padding: 0 8px; background: var(--surface); }
.session-edit input:disabled { opacity: .5; }

/* ---------- Time report ---------- */
.report-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-bottom: 18px; }
.report-toolbar h1 { margin: 0 8px 0 0; font-size: 24px; font-weight: 800; }
.range-presets { display: flex; flex-wrap: wrap; gap: 2px; padding: 3px; border-radius: 11px; background: var(--surface); box-shadow: var(--shadow-sm); }
.range-presets button { height: 30px; padding: 0 11px; border: 0; border-radius: 8px; background: none; font-size: 13px; font-weight: 600; color: var(--muted); }
.range-presets button:hover { color: var(--text); background: var(--surface-2); }
.range-presets button.on { background: var(--brand); color: #fff; }
.custom-range { display: flex; align-items: center; gap: 6px; }
.custom-range input, .report-toolbar select {
  height: 36px; border: 1px solid var(--line); border-radius: 9px; padding: 0 10px; background: var(--surface);
}
.report-toolbar select { min-width: 150px; }
.report-toolbar .btn-ghost { background: var(--surface); }
#exportCsv { margin-left: auto; }

.report-summary {
  display: flex; align-items: center; gap: 24px; padding: 18px 22px; margin-bottom: 18px;
  background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow);
}
.report-summary .big { font-size: 32px; font-weight: 800; line-height: 1.1; color: var(--brand); font-variant-numeric: tabular-nums; }
@media (prefers-color-scheme: dark) { .report-summary .big { color: #7FB8E8; } }
.report-summary-meta { display: flex; flex-direction: column; padding-left: 24px; border-left: 1px solid var(--line); }
.report-empty { text-align: center; padding: 40px 20px; color: var(--muted); }
.report-empty .icon { width: 40px; height: 40px; stroke-width: 1.5; }
.report-empty p { margin: 8px 0 0; }
.report-loading { padding: 20px; }

.report-client { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; margin-bottom: 18px; border-top: 5px solid var(--c); }
.report-client header { display: flex; align-items: center; gap: 14px; padding: 14px 18px 10px; }
.report-client h2 { margin: 0; font-size: 17px; font-weight: 800; flex: none; max-width: 45%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.report-share { flex: 1; height: 6px; border-radius: 6px; background: var(--line-soft); overflow: hidden; min-width: 40px; }
.report-share span { display: block; height: 100%; background: var(--c); border-radius: 6px; }
.report-total { font-size: 18px; font-weight: 800; font-variant-numeric: tabular-nums; white-space: nowrap; }
.report-total small { font-size: 12px; font-weight: 600; color: var(--muted); margin-left: 6px; }
.report-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.report-table th {
  text-align: left; font-size: 11.5px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted);
  padding: 6px 18px; border-bottom: 1px solid var(--line-soft);
}
.report-table td { padding: 7px 18px; border-bottom: 1px solid var(--line-soft); vertical-align: middle; }
.report-table tr:last-child td { border-bottom: 0; }
.report-table .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.report-table .strong { font-weight: 700; }
.report-table td:first-child { display: flex; align-items: center; gap: 4px; }
.report-table .expand { display: grid; place-items: center; width: 24px; height: 24px; margin-left: -6px; border: 0; border-radius: 6px; background: none; color: var(--muted); flex: none; }
.report-table .expand:hover { background: var(--surface-2); }
.report-table .expand .icon { width: 15px; height: 15px; }
.report-task { display: inline-flex; align-items: center; gap: 6px; border: 0; background: none; padding: 0; text-align: left; font-weight: 600; }
.report-task:hover { color: var(--brand); text-decoration: underline; }
.report-task .done-icon { width: 15px; height: 15px; color: var(--green); stroke-width: 3; }
.task-line.done .report-task { color: var(--muted); }
.task-line.open td { border-bottom-color: transparent; }
.session-line td { padding-top: 3px; padding-bottom: 3px; font-size: 13px; color: var(--muted); background: var(--surface-2); }
.session-line td:first-child { padding-left: 46px; }

/* ---------- Toasts ---------- */
.toasts { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); display: grid; gap: 8px; z-index: 100; }
.toast {
  background: #1B2430; color: #fff; padding: 10px 16px; border-radius: 10px; font-size: 14px;
  box-shadow: var(--shadow-lg); animation: pop .16s ease-out; transition: opacity .4s, transform .4s;
}
.toast.error { background: var(--red); }
.toast.out { opacity: 0; transform: translateY(6px); }

/* ---------- Small screens ---------- */
@media (max-width: 760px) {
  .topbar { flex-wrap: wrap; padding: 10px 14px; gap: 10px; }
  .brand img { height: 30px; }
  .search { order: 3; flex-basis: 100%; max-width: none; margin: 0; }
  .topbar-actions { margin-left: auto; }
  .btn-light span { display: none; }
  .btn-light { padding: 0 10px; }
  .toggle-label { display: none; }
  .wrap { padding: 16px 12px 40px; }
  .board, .focus { grid-template-columns: 1fr; gap: 14px; }
  .td-props { margin-left: 0; }
  .focus-open { flex-wrap: wrap; gap: 3px 8px; }
  .focus-client { max-width: 100%; }
  .focus-title { flex-basis: 100%; white-space: normal; }
  .dialog { max-height: calc(100vh - 16px); }
  .views a span { display: none; }
  .views a { padding: 0 9px; }
  .timer-bar { order: 4; flex-basis: 100%; max-width: none; }
  .timer-task { flex: 1; }
  .play { opacity: .7; }
  .report-summary { flex-direction: column; align-items: flex-start; gap: 10px; }
  .report-summary-meta { padding-left: 0; border-left: 0; }
  .hide-sm { display: none; }
  .report-table td, .report-table th { padding-left: 12px; padding-right: 12px; }
  .session { grid-template-columns: 1fr auto auto; }
  .session-span { grid-column: 1; grid-row: 2; font-size: 12.5px; }
  .td-time { flex-wrap: wrap; }
  #exportCsv { margin-left: 0; }
}
@media (hover: none) {
  .sub-item .grip, .sub-item .icon-btn { opacity: .6; }
  .play, .session-actions { opacity: 1; }
}
