/* Classic desktop-app look, modelled on the VisionFlow Time/Expenses screen.

   Colour follows the TransLution Factory Suite Design System (brand.json v2.0):
     primary #00529A · accent #105FAA · pale blue #C8DAF3 · body #1E293B · muted #8B8680
     typeface Geist (Modern skin) / Segoe UI fallback.
   --muted is the brand grey darkened to #6E6A64 so small text reaches 4.5:1 on white. */
:root {
  color-scheme: light;
  --bg: #e6eef7;
  --panel: #ffffff;
  --panel-head: linear-gradient(#fafafa, #e9e9e9);
  --border: #c4ccd8;
  --border-soft: #e2e6ec;
  --text: #1E293B;
  --muted: #6E6A64;
  --link: #105FAA;
  --group: #C8DAF3;
  --stripe: #f5f8fb;
  --hover: #e6eef7;
  --primary: #00529A;
  --primary-hover: #003f78;
  --tl-blue: #00529A;
  --tl-grey: #939598;
  --tl-heading: #00529A;
  --tl-accent: #105FAA;
  --warn: #8A6114;
  --warn-soft: #F7EEDC;
  --danger: #A3312B;
  --danger-soft: #F9E5E3;
  --success: #1B7A4B;
  --green: #3aa655;
  --red: #d84b3a;
  --pencil: #2f7d32;
  --today: #fff7d6;
  --radius: 3px;
  font-family: Tahoma, "Segoe UI", Verdana, Arial, sans-serif;
  font-size: 12px;
  color: var(--text);
}

/* The two dark blocks carry identical values and must be kept in step. */
:root[data-theme="dark"] {
    color-scheme: dark;
    --bg: #1e1f22;
    --panel: #26282c;
    --panel-head: linear-gradient(#34363b, #2a2c30);
    --border: #45484e;
    --border-soft: #34363b;
    --text: #e6e6e6;
    --muted: #a0a4ab;
    --link: #8fb4e6;
    --group: #263447;
    --stripe: #2a2c31;
    --hover: #2f3b52;
    --primary: #2f8fd0;
    --primary-hover: #4aa3e0;
    --warn: #D9A455;
    --warn-soft: #31240D;
    --danger: #ff6b61;
    --danger-soft: #45231f;
    --today: #3a3520;
    --tl-heading: #9dc1ea;
    --tl-blue: #2f8fd0;
  }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #1e1f22;
    --panel: #26282c;
    --panel-head: linear-gradient(#34363b, #2a2c30);
    --border: #45484e;
    --border-soft: #34363b;
    --text: #e6e6e6;
    --muted: #a0a4ab;
    --link: #8fb4e6;
    --group: #263447;
    --stripe: #2a2c31;
    --hover: #2f3b52;
    --primary: #2f8fd0;
    --primary-hover: #4aa3e0;
    --warn: #D9A455;
    --warn-soft: #31240D;
    --danger: #ff6b61;
    --danger-soft: #45231f;
    --today: #3a3520;
    --tl-heading: #9dc1ea;
    --tl-blue: #2f8fd0;
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); height: 100%; }
body { padding: 0 0 8px; display: flex; flex-direction: column; align-items: center; overflow: hidden; }
:root { --page-max: 1480px; --page-gutter: 16px; }
body > .banner, body > .filters, body > .panel.results, body > .mfilters, body > .msummary, body > .loginwrap { width: min(100% - 2 * var(--page-gutter), var(--page-max)); }
body > .apphead, body > .accentbar { width: 100%; }
a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; }
.hidden { display: none !important; }
.muted { color: var(--muted); font-weight: normal; }
b { font-weight: 700; }

/* ---------- header ---------- */
.apphead {
  display: flex; align-items: center; gap: 22px; margin: 0;
  padding: 10px max(var(--page-gutter), calc((100% - var(--page-max)) / 2)) 9px;
  background: var(--panel); border-bottom: 1px solid var(--border);
}
.apphead .logo { display: inline-flex; align-items: center; flex: none; padding: 4px 0; }
.apphead .logo img { height: 36px; width: auto; display: block; }
.apphead .logo .logo-dark { display: none; }
:root[data-theme="dark"] .apphead .logo .logo-light { display: none; }
:root[data-theme="dark"] .apphead .logo .logo-dark { display: block; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .apphead .logo .logo-light { display: none; }
  :root:not([data-theme="light"]) .apphead .logo .logo-dark { display: block; }
}
.apptitle { display: flex; flex-direction: column; justify-content: center; border-left: 1px solid var(--border); padding-left: 22px; min-height: 40px; }
.apptitle h1 { margin: 0; font: 600 20px/1.1 "Segoe UI", Tahoma, Verdana, sans-serif; color: var(--tl-heading); letter-spacing: .2px; }
.apptitle h1 .sep { color: var(--tl-grey); font-weight: 300; margin: 0 4px; }
.apptitle .subtitle { color: var(--muted); font-size: 11px; margin-top: 3px; }
.headright { margin-left: auto; display: flex; align-items: center; gap: 18px; }
.headtotal { font: 600 16px/1 "Segoe UI", Tahoma, sans-serif; color: var(--tl-blue); font-variant-numeric: tabular-nums; }
.headtotal small { font-size: 11px; font-weight: normal; color: var(--muted); margin-left: 5px; }
.user { display: inline-flex; align-items: center; gap: 8px; color: var(--text); padding: 4px 10px 4px 4px; border: 1px solid var(--border); border-radius: 20px; background: var(--stripe); font: inherit; cursor: pointer; }
.user:hover { background: var(--hover); }
.user .caret { font-size: 10px; color: var(--muted); margin-left: -2px; }
.userwrap { position: relative; }
.umenu { position: absolute; right: 0; top: calc(100% + 6px); z-index: 60; min-width: 220px; padding: 4px; background: var(--panel); border: 1px solid var(--border); border-radius: 6px; box-shadow: 0 6px 20px rgba(0,0,0,.25); display: flex; flex-direction: column; }
.umenu .mhead { padding: 6px 10px 6px; font-size: 11px; color: var(--muted); border-bottom: 1px solid var(--border-soft); margin-bottom: 3px; white-space: nowrap; }
.umenu .mi { display: block; padding: 7px 10px; border-radius: 4px; color: var(--text); text-decoration: none; }
.umenu .mi:hover { background: var(--hover); text-decoration: none; }
.user img { width: 24px; height: 24px; border-radius: 50%; }
.user .uname { font-weight: 600; }
.user .usite { color: var(--muted); font-size: 11px; }
.accentbar { height: 4px; margin: 0 0 10px; background: linear-gradient(90deg, var(--tl-blue) 0 55%, var(--tl-grey) 55% 100%); }
:root[data-theme="dark"] .apptitle h1 { color: #9dc1ea; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .apptitle h1 { color: #9dc1ea; }
}

/* ---------- panels ---------- */
.panel { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); }
.ptitle { background: var(--group); border-bottom: 1px solid var(--border); padding: 5px 8px; font-weight: 700; color: var(--tl-heading); }
.banner { background: var(--hover); border: 1px solid var(--border); border-radius: var(--radius); padding: 10px 12px; margin-bottom: 8px; line-height: 1.5; }
.banner.error { background: var(--danger-soft); }
.banner.warn { background: var(--warn-soft); color: var(--warn); border-color: transparent; font-weight: 600; }
.banner code { background: rgba(0,0,0,.07); padding: 1px 4px; border-radius: 3px; }

/* ---------- filter panel ---------- */
.filters { display: flex; gap: 18px; padding: 10px 12px 12px; flex-wrap: wrap; }
.fcol { display: flex; flex-direction: column; gap: 4px; min-width: 200px; }
.fcol.grow { flex: 1; min-width: 260px; }
.fcol > label { font-size: 11px; color: var(--muted); margin-top: 6px; }
.fcol > label:first-child { margin-top: 0; }
select, input[type=date], input[type=time], input[type=text], textarea {
  font: inherit; color: var(--text); background: var(--panel); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 3px 5px; width: 100%;
}
select[multiple] { height: 190px; padding: 2px; }
select[multiple] option { padding: 2px 4px; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--primary); outline-offset: -1px; }
.check { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--text) !important; margin-top: 2px !important; }
.check input { width: auto; }
.periodnav { display: flex; gap: 4px; margin-top: 6px; }
.segmented { display: inline-flex; border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.seg { font: inherit; padding: 4px 10px; border: 0; background: var(--panel); color: var(--text); cursor: pointer; }
.seg + .seg { border-left: 1px solid var(--border); }
.seg.active { background: var(--primary); color: #fff; }

/* ---------- buttons ---------- */
.btn {
  font: inherit; border: 1px solid var(--border); border-radius: var(--radius); padding: 4px 12px;
  background: linear-gradient(#fdfdfd, #e6e6e6); color: var(--text); cursor: pointer;
}
:root[data-theme="dark"] .btn { background: linear-gradient(#3a3d43, #2c2e33); }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .btn { background: linear-gradient(#3a3d43, #2c2e33); }
}
.btn:hover { filter: brightness(.96); }
.btn.small { padding: 3px 8px; flex: 1; }
.btn.wide { padding: 6px 8px; font-weight: 600; flex: 1; white-space: nowrap; display: inline-flex; align-items: center; justify-content: center; gap: 6px; }
.actionrow { display: flex; gap: 6px; margin-top: 8px; }
.ico.plus-w { background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 14 14'><path d='M7 2.5v9M2.5 7h9' stroke='white' stroke-width='2.2' stroke-linecap='round'/></svg>"); width: 12px; height: 12px; }
.btn.primary { background: var(--primary); color: #fff; border-color: var(--primary); }
.btn.primary:hover { background: var(--primary-hover); filter: none; }
.btn.danger { background: var(--danger-soft); color: var(--danger); border-color: transparent; }
.btn.icon { width: 26px; padding: 2px 0; font-size: 16px; line-height: 1; }
.btn:disabled { opacity: .5; cursor: default; }

/* ---------- links row ---------- */
.links { display: flex; gap: 18px; padding: 6px 4px; }
.plus-link { display: inline-flex; align-items: center; gap: 5px; }
.ico { display: inline-block; width: 14px; height: 14px; background-repeat: no-repeat; background-size: contain; vertical-align: middle; }
.ico.plus    { background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 14 14'><rect x='1' y='1' width='12' height='12' rx='2' fill='%233aa655'/><path d='M7 3.5v7M3.5 7h7' stroke='white' stroke-width='2' stroke-linecap='round'/></svg>"); }
.ico.pencil  { background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 14 14'><path d='M2 12l.8-3.2L9.6 2l2.4 2.4-6.8 6.8z' fill='%23f5c542' stroke='%232f7d32' stroke-width='1'/><path d='M8.6 3l2.4 2.4' stroke='%232f7d32' stroke-width='1'/></svg>"); }
.ico.cross   { background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 14 14'><path d='M3 3l8 8M11 3l-8 8' stroke='%23d84b3a' stroke-width='2.6' stroke-linecap='round'/></svg>"); }
.ico.link    { background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 14 14'><path d='M5.5 8.5l3-3M6 4.5l1.5-1.5a2.1 2.1 0 013 3L9 7.5M8 9.5l-1.5 1.5a2.1 2.1 0 01-3-3L5 6.5' fill='none' stroke='%231a3ec8' stroke-width='1.5' stroke-linecap='round'/></svg>"); }
.ico.refresh { background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 14 14'><path d='M11 7a4 4 0 11-1.2-2.8' fill='none' stroke='%233aa655' stroke-width='1.8'/><path d='M11 2v3H8' fill='none' stroke='%233aa655' stroke-width='1.8'/></svg>"); }
.ico.minus   { background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 14 14'><rect x='1.5' y='1.5' width='11' height='11' fill='white' stroke='%23888'/><path d='M4 7h6' stroke='%23333' stroke-width='1.5'/></svg>"); }
.ico.plusbox { background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 14 14'><rect x='1.5' y='1.5' width='11' height='11' fill='white' stroke='%23888'/><path d='M4 7h6M7 4v6' stroke='%23333' stroke-width='1.5'/></svg>"); }

/* ---------- results table ---------- */
.panel.results { margin-top: 2px; flex: 1; min-height: 0; display: flex; flex-direction: column; }
.sheet { flex: 1; min-height: 0; overflow: auto; }
.filters, .apphead, .accentbar, .banner { flex: none; }
.panel.results { margin-top: 8px; }
.empty { color: var(--muted); padding: 30px; text-align: center; }
table.list { width: 100%; border-collapse: collapse; }
.list th { text-align: left; font-weight: 600; padding: 5px 8px; background: var(--group); color: var(--tl-heading); border-bottom: 1px solid var(--border); border-right: 1px solid var(--border-soft); white-space: nowrap; position: sticky; top: 0; }
.list th:last-child { border-right: 0; }
.list td { padding: 4px 8px; border-bottom: 1px solid var(--border-soft); vertical-align: middle; }
.list tbody tr.wl:nth-child(even) td { background: var(--stripe); }
.list tbody tr.wl:hover td { background: var(--hover); }
.list td.num, .list th.num { text-align: right; font-variant-numeric: tabular-nums; }
.list td.key { white-space: nowrap; font-weight: 600; }
.list td.key img { width: 14px; height: 14px; vertical-align: -2px; margin-right: 4px; }
.list td.title { max-width: 520px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.list td.comment { color: var(--muted); max-width: 320px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.list td.date { white-space: nowrap; }
.list td.actions { white-space: nowrap; text-align: center; }
.list td.actions .ico { cursor: pointer; margin: 0 3px; }
.list td.actions .ico:hover { transform: scale(1.15); }
.list tr.group td { background: var(--stripe); font-weight: 700; padding: 6px 8px; border-top: 1px solid var(--border); border-left: 3px solid var(--tl-blue); }
.list tr.group.today td { background: var(--today); }
.list tr.group .toggle { cursor: pointer; margin-right: 4px; }
.list tr.group .ginfo { font-weight: 700; }
.list tr.group .glinks { font-weight: normal; margin-left: 14px; }
.list tr.group .glinks a { margin-right: 14px; display: inline-flex; align-items: center; gap: 4px; }
.list tr.group .gtotal { float: right; font-weight: 700; }
/* a weekday under 8h for one person: a nudge, not a judgement */
.short { color: var(--warn) !important; }
.list tr.subtotal td.hours.short { color: var(--warn); }
.list tr.group .gempty { color: var(--muted); font-weight: normal; margin-left: 8px; }
.list tr.subtotal td { padding: 4px 8px 8px; font-weight: 700; }
.list tr.subtotal td.label { color: var(--muted); }
.list tr.subtotal td.hours { text-align: right; }
.list tr.collapsed-hidden { display: none; }
.dow { color: var(--muted); font-weight: normal; margin-left: 4px; }

.sumbar { flex: none; display: flex; flex-wrap: wrap; gap: 12px; padding: 6px 8px; border-top: 1px solid var(--border); background: var(--group); font-weight: 600; color: var(--tl-heading); }
.sumbar .sep { border-left: 1px solid var(--border); }

/* ---------- weekly grid (alternate view) ---------- */
table.grid { width: 100%; border-collapse: separate; border-spacing: 0; table-layout: fixed; min-width: 900px; }
.grid th, .grid td { border-bottom: 1px solid var(--border-soft); border-right: 1px solid var(--border-soft); vertical-align: top; }
.grid thead th { background: var(--panel-head); padding: 6px 8px; text-align: center; font-weight: 600; }
.grid thead th.issuecol { text-align: left; }
.grid th .dowl { display: block; font-size: 11px; color: var(--muted); }
.grid th.today, .grid td.today { background: var(--today); }
.grid th.weekend, .grid td.weekend { background: var(--stripe); }
.issuecol { width: 300px; }
.grid td.issue { padding: 6px 8px; }
.grid .issue .k { font-weight: 600; }
.grid .issue .summary { display: block; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.grid .issue .rowtotal { display: block; color: var(--muted); font-size: 11px; }
.grid td.cell { padding: 3px; cursor: pointer; min-height: 40px; }
.grid td.cell:hover { background: var(--hover); }
.chip { display: block; background: #e3fcef; color: #006644; border-radius: 3px; padding: 2px 5px; margin: 2px 0; cursor: pointer; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
:root[data-theme="dark"] .chip { background: #1c3329; color: #7ee2b8; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .chip { background: #1c3329; color: #7ee2b8; }
}
.chip .dur { font-weight: 700; }
.chip .cmt { color: var(--muted); margin-left: 5px; }
.grid tfoot td { background: var(--panel-head); padding: 6px 8px; text-align: center; font-weight: 700; }
.grid tfoot td.issue { text-align: left; }

/* ---------- dialog ---------- */
.dlg { border: 1px solid var(--border); border-radius: 4px; padding: 0; width: 560px; max-width: calc(100vw - 32px); background: var(--panel); color: var(--text); box-shadow: 0 8px 30px rgba(0,0,0,.35); }
.dlg::backdrop { background: rgba(0, 0, 0, .45); }
.dlg form { display: flex; flex-direction: column; gap: 12px; padding: 0 16px 14px; }
.dlg header { display: flex; align-items: center; justify-content: space-between; margin: 0 -16px 2px; padding: 8px 12px 8px 16px; background: var(--panel-head); border-bottom: 1px solid var(--border); }
.dlg h2 { margin: 0; font-size: 13px; font-weight: 700; }
.dlg footer { display: flex; align-items: center; gap: 8px; margin-top: 4px; }
.spacer { flex: 1; }
.field { display: flex; flex-direction: column; gap: 3px; }
.field label { font-size: 11px; color: var(--muted); }
.row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
textarea { resize: vertical; }
.hint { color: var(--muted); font-size: 11px; }
.error { background: var(--danger-soft); color: var(--danger); padding: 6px 8px; border-radius: var(--radius); }

.picker { position: relative; }
.results.hidden { display: none; }
.picker .results {
  position: absolute; left: 0; right: 0; top: calc(100% + 2px); z-index: 10; max-height: 260px; overflow: auto;
  background: var(--panel); border: 1px solid var(--border); box-shadow: 0 4px 12px rgba(0,0,0,.2); margin: 0;
}
.picker .group { padding: 5px 8px 2px; font-size: 10px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.picker .item { padding: 5px 8px; cursor: pointer; display: flex; gap: 8px; align-items: center; }
.picker .item:hover, .picker .item.active { background: var(--hover); }
.picker .item img { width: 14px; height: 14px; flex: none; }
.picker .item .k { font-weight: 600; flex: none; }
.picker .item .s { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.picker .none { padding: 8px; color: var(--muted); }
.selected { display: flex; align-items: center; gap: 8px; margin-top: 4px; padding: 6px 8px; background: var(--hover); border-radius: var(--radius); }
.selected img { width: 14px; height: 14px; }
.selected .k { font-weight: 700; }
.selected .s { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.selected .change { color: var(--link); cursor: pointer; background: none; border: 0; font: inherit; }

/* ---------- toasts ---------- */
.toasts { position: fixed; right: 14px; bottom: 14px; display: flex; flex-direction: column; gap: 6px; z-index: 50; }
.toast { background: #333; color: #fff; padding: 8px 12px; border-radius: 3px; max-width: 380px; box-shadow: 0 2px 8px rgba(0,0,0,.3); }
.toast.error { background: var(--danger); }
.toast.success { background: var(--success); }

@media (max-width: 800px) {
  .apptitle { display: none; }
  .filters { flex-direction: column; }
  .row { grid-template-columns: 1fr 1fr; }
}

/* ---------- users filter ---------- */
.userlinks { display: flex; gap: 12px; margin-top: 2px; }
.peruser { margin-left: auto; font-weight: normal; color: var(--muted); }
.peruser b { color: var(--text); }
.list td.usercol { white-space: nowrap; }
.list tr.wl.other td { color: var(--muted); }
.list tr.wl.other td.key a, .list tr.wl.other td.title { color: var(--text); }
.list td.actions .ico.disabled { opacity: .25; cursor: default; pointer-events: none; }

/* ---------- context menu ---------- */
.ctx {
  position: fixed; z-index: 60; min-width: 230px; padding: 3px; background: var(--panel); color: var(--text);
  border: 1px solid var(--border); border-radius: 3px; box-shadow: 0 4px 14px rgba(0,0,0,.28);
}
.ctx .mi { display: flex; align-items: center; gap: 8px; padding: 6px 10px 6px 8px; cursor: pointer; border-radius: 2px; color: var(--link); white-space: nowrap; }
.ctx .mi:hover, .ctx .mi:focus { background: var(--hover); outline: none; }
.ctx .mi.disabled { color: var(--muted); cursor: default; }
.ctx .mi.disabled:hover { background: none; }
.ctx .mi .ico { flex: none; }
.ctx .sepline { border-top: 1px solid var(--border-soft); margin: 3px 4px; }
.ctx .mhead { padding: 4px 8px 2px; font-size: 11px; color: var(--muted); }
.ico.open   { background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 14 14'><rect x='1.5' y='2.5' width='11' height='9' rx='1' fill='white' stroke='%23555'/><path d='M1.5 4.5h11' stroke='%23555'/><path d='M4 8.5l2-2 1.5 1.5 2.5-2.5' fill='none' stroke='%232f7d32' stroke-width='1.3'/></svg>"); }
.ico.copy   { background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 14 14'><rect x='4' y='4' width='8' height='9' rx='1' fill='white' stroke='%23555'/><rect x='2' y='1.5' width='8' height='9' rx='1' fill='%23e9eef7' stroke='%23555'/></svg>"); }
.ico.pencilm{ background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 14 14'><path d='M2 12l.8-3.2L9.6 2l2.4 2.4-6.8 6.8z' fill='%23f5c542' stroke='%232f7d32' stroke-width='1'/></svg>"); }
.ico.move   { background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 14 14'><rect x='1' y='3' width='5' height='8' rx='1' fill='white' stroke='%23555'/><rect x='8' y='3' width='5' height='8' rx='1' fill='%23e9eef7' stroke='%23555'/><path d='M4.5 7h4M7 5.5L8.8 7 7 8.5' fill='none' stroke='%231a3ec8' stroke-width='1.4' stroke-linecap='round' stroke-linejoin='round'/></svg>"); }
.ico.del    { background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 14 14'><circle cx='7' cy='7' r='6' fill='%23d84b3a'/><path d='M4.5 4.5l5 5M9.5 4.5l-5 5' stroke='white' stroke-width='1.8' stroke-linecap='round'/></svg>"); }

.chip.other { background: var(--stripe); color: var(--muted); border: 1px dashed var(--border); }


/* ---------- header toggles ---------- */
.headright { flex-direction: column; align-items: flex-end; gap: 6px; }
.toggles { display: flex; gap: 6px; }
.toggles.stacked { flex-direction: column; align-items: stretch; gap: 4px; }
.toggles.stacked .segmented { display: flex; }
.toggles.stacked .seg { flex: 1; text-align: center; }
.segmented.tiny .seg { padding: 2px 8px; font-size: 11px; }
.titlebar { display: flex; align-items: center; gap: 10px; padding-top: 4px; padding-bottom: 4px; }
.titlebar > span { flex: 1; }
.titlebar .btn.exportbtn { flex: 0 0 auto !important; width: auto; margin-left: auto; }
.ico.export { background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 14 14'><path d='M7 1.5v7.5M4 6.5l3 3 3-3' fill='none' stroke='white' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/><path d='M2 10v2.5h10V10' fill='none' stroke='white' stroke-width='1.6' stroke-linecap='round'/></svg>"); width: 12px; height: 12px; }
.dlg .field select[multiple] { height: 120px; }
.hint.warn { color: var(--warn); }
#moveDlg form { min-height: 330px; }
#moveWhat .muted { margin-left: auto; white-space: nowrap; }

/* ---------- jump to top / bottom of a long report ---------- */
.jump { position: fixed; right: max(6px, calc((100% - var(--page-max)) / 2 - 42px)); bottom: 64px; display: flex; flex-direction: column; gap: 6px; z-index: 40; }
.jumpbtn { width: 34px; height: 34px; border-radius: 50%; border: 1px solid var(--border); background: var(--panel); color: var(--muted); font: inherit; font-size: 16px; cursor: pointer; box-shadow: 0 2px 8px rgba(0,0,0,.18); opacity: .75; }
.jumpbtn:hover, .jumpbtn:focus-visible { opacity: 1; color: var(--primary); border-color: var(--primary); }

/* ---------- columns dialog ---------- */
.collist { list-style: none; margin: 0; padding: 0; border: 1px solid var(--border); border-radius: var(--radius); max-height: 380px; overflow: auto; background: var(--panel); }
.collist li { display: flex; align-items: center; gap: 8px; padding: 6px 8px; border-bottom: 1px solid var(--border-soft); background: var(--panel); }
.collist li:last-child { border-bottom: 0; }
.collist li.dragging { opacity: .4; }
.collist li.over { box-shadow: inset 0 2px 0 var(--primary); }
.collist .grip { cursor: grab; color: var(--muted); user-select: none; width: 14px; text-align: center; font-size: 14px; letter-spacing: -2px; }
.collist label { flex: 1; display: flex; align-items: center; gap: 8px; cursor: pointer; color: var(--text); }
.collist label input { width: auto; }
.collist li.fixed label { color: var(--muted); }
.collist .arrows { display: inline-flex; gap: 2px; }
.collist .arrows button { font: inherit; width: 24px; height: 22px; border: 1px solid var(--border); background: var(--panel); color: var(--text); border-radius: 3px; cursor: pointer; line-height: 1; }
.collist .arrows button:disabled { opacity: .3; cursor: default; }
.collist .arrows button:hover:not(:disabled) { background: var(--hover); }
.dlg .check { margin-top: 0 !important; color: var(--text) !important; }
.dlg .check input { width: auto; }

/* ---------- account links in header ---------- */

/* ---------- skin switching ---------- */
:root:not([data-skin="modern"]) .modern-only { display: none !important; }
:root[data-skin="modern"] .classic-only { display: none !important; }

/* ============================================================================
   MODERN skin - "ledger" layout: filter bar, summary strip, day cards
   ========================================================================== */
:root[data-skin="modern"] {
  --bg: #e9f0f8;
  --panel: #ffffff;
  --panel-head: #ffffff;
  --border: #d9dee7;
  --border-soft: #e9edf3;
  --group: #dbe6f4;
  --stripe: #f8fafd;
  --hover: #eef3fa;
  --radius: 8px;
  --m-navy: #00529A;          /* brand primary */
  --m-blue: #105FAA;          /* brand accent */
  --m-band: #C8DAF3;          /* brand pale blue - table-head fill, used for day headings */
  --m-head: #F7F9FC;
  --m-mono: "Geist Mono", ui-monospace, "Cascadia Mono", "JetBrains Mono", Consolas, "Courier New", monospace;
  --m-sans: "Geist", "Segoe UI Variable Text", "Segoe UI", ui-sans-serif, system-ui, -apple-system, Roboto, sans-serif;
  --m-shadow: 0 1px 2px rgba(30, 41, 59, .06), 0 8px 24px -12px rgba(0, 82, 154, .22);
  font-family: var(--m-sans);
  font-size: 13.5px;
}
:root[data-skin="modern"][data-theme="dark"],
:root[data-skin="modern"]:not([data-theme="light"]).dark-auto {
  --bg: #0F141B; --panel: #161D26; --panel-head: #161D26; --border: #28313D; --border-soft: #222a35;
  --group: #18304C; --stripe: #1C2530; --hover: #12283E; --m-navy: #9BC6EC; --m-blue: #6FAAE2; --m-band: #18304C; --m-head: #1C2530;
  --m-shadow: 0 1px 2px rgba(0,0,0,.45), 0 8px 24px -12px rgba(0,0,0,.65);
}
@media (prefers-color-scheme: dark) {
  :root[data-skin="modern"]:not([data-theme="light"]) {
    --bg: #0F141B; --panel: #161D26; --panel-head: #161D26; --border: #28313D; --border-soft: #222a35;
    --group: #18304C; --stripe: #1C2530; --hover: #12283E; --m-navy: #9BC6EC; --m-blue: #6FAAE2; --m-band: #18304C; --m-head: #1C2530;
    --m-shadow: 0 1px 2px rgba(0,0,0,.45), 0 8px 24px -12px rgba(0,0,0,.65);
  }
}

:root[data-skin="modern"] body { padding: 0 0 12px; }
:root[data-skin="modern"] .apphead { padding-top: 10px; padding-bottom: 10px; }
:root[data-skin="modern"] .apptitle h1 { color: var(--m-navy); font-size: 21px; }
:root[data-skin="modern"] .accentbar { margin: 0 0 12px; }

/* labels */
:root[data-skin="modern"] .mlabel,
:root[data-skin="modern"] .mfield > label { font-size: 10.5px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }

/* filter bar */
:root[data-skin="modern"] .mfilters { flex: none; display: flex; flex-direction: column; gap: 10px; padding: 2px 0 12px; border-bottom: 1px solid var(--border); margin-bottom: 12px; }
:root[data-skin="modern"] .mrow { display: flex; gap: 14px; align-items: flex-end; flex-wrap: wrap; }
:root[data-skin="modern"] .mfield { display: flex; flex-direction: column; gap: 5px; }
:root[data-skin="modern"] .mfield select, :root[data-skin="modern"] .mfield input[type=date] {
  height: 38px; padding: 6px 10px; border-radius: 6px; border: 1px solid var(--border); background: var(--panel); font: inherit; color: var(--text); min-width: 160px;
}
:root[data-skin="modern"] .mfield input[type=date] { font-family: var(--m-mono); font-size: 13px; min-width: 130px; }
:root[data-skin="modern"] .mperiod, :root[data-skin="modern"] .mseg { display: inline-flex; gap: 0; }
:root[data-skin="modern"] .mbtn {
  height: 38px; padding: 0 14px; border: 1px solid var(--border); background: var(--panel); color: var(--text); font: inherit; font-weight: 500;
  cursor: pointer; border-radius: 6px; white-space: nowrap;
}
:root[data-skin="modern"] .mbtn:hover { background: var(--hover); }
:root[data-skin="modern"] .mbtn.active { background: var(--m-band); color: var(--m-navy); border-color: var(--m-blue); font-weight: 600; }
:root[data-skin="modern"] .mbtn.primary { background: var(--m-navy); color: #fff; border-color: var(--m-navy); font-weight: 600; }
:root[data-skin="modern"][data-theme="dark"] .mbtn.primary { background: #1d5fa5; border-color: #1d5fa5; }
:root[data-skin="modern"] .mbtn.primary:hover { filter: brightness(1.1); }
:root[data-skin="modern"] .mbtn.mono { font-family: var(--m-mono); font-size: 12.5px; }
:root[data-skin="modern"] .mperiod .mbtn + .mbtn, :root[data-skin="modern"] .mseg .mbtn + .mbtn { margin-left: 6px; }
:root[data-skin="modern"] .mseg .mbtn { padding: 0 10px; }
:root[data-skin="modern"] .mtools { justify-content: flex-end; gap: 8px; }

/* Person: a checkbox panel, any combination of people at once */
:root[data-skin="modern"] .mpersonwrap { position: relative; }
:root[data-skin="modern"] .mpersonbtn { min-width: 160px; text-align: left; display: inline-flex; align-items: center; justify-content: space-between; gap: 8px; font-weight: 500; }
:root[data-skin="modern"] .mpersonbtn .caret { color: var(--muted); font-size: 11px; }
:root[data-skin="modern"] .mdrop { position: absolute; left: 0; top: calc(100% + 4px); z-index: 30; background: var(--panel); border: 1px solid var(--border); border-radius: 8px; box-shadow: var(--m-shadow), 0 8px 24px rgba(0,0,0,.15); padding: 6px; min-width: 240px; display: flex; flex-direction: column; }
:root[data-skin="modern"] .mdropbar { display: flex; gap: 4px; padding: 2px 4px 6px; border-bottom: 1px solid var(--border-soft); margin-bottom: 4px; }
:root[data-skin="modern"] .mlink { font: inherit; font-size: 12.5px; font-weight: 600; color: var(--m-blue); background: none; border: 0; padding: 4px 6px; border-radius: 4px; cursor: pointer; }
:root[data-skin="modern"] .mlink:hover { background: var(--hover); }
:root[data-skin="modern"] .mdroplist { max-height: 320px; overflow: auto; display: flex; flex-direction: column; }
:root[data-skin="modern"] .mdroplist label { display: flex; align-items: center; gap: 8px; padding: 6px 8px; border-radius: 5px; cursor: pointer; white-space: nowrap; }
:root[data-skin="modern"] .mdroplist label:hover { background: var(--hover); }
:root[data-skin="modern"] .mdroplist label input { width: auto; margin: 0; }
:root[data-skin="modern"] .mdroplist label.me { font-weight: 600; }

/* summary strip */
:root[data-skin="modern"] .msummary { flex: none; display: flex; align-items: flex-end; gap: 28px; padding: 4px 0 16px; flex-wrap: wrap; }
:root[data-skin="modern"] .mtotal .mbig { font-size: 40px; font-weight: 800; line-height: 1; color: var(--m-navy); letter-spacing: -.5px; font-variant-numeric: tabular-nums; margin-top: 6px; }
:root[data-skin="modern"] .mstat { display: flex; flex-direction: column; align-items: center; gap: 3px; padding-bottom: 4px; }
:root[data-skin="modern"] .mstat .mnum { font-size: 19px; font-weight: 700; color: var(--m-navy); font-variant-numeric: tabular-nums; }
:root[data-skin="modern"] .mscope { color: var(--muted); padding-bottom: 8px; }
:root[data-skin="modern"] .mscope b { color: var(--text); }

/* results container becomes transparent; cards inside scroll */
:root[data-skin="modern"] .panel.results { background: transparent; border: 0; box-shadow: none; margin-top: 0; }
:root[data-skin="modern"] .sheet { padding-bottom: 8px; }
:root[data-skin="modern"] .mcard { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--m-shadow); margin-bottom: 14px; overflow: hidden; }
:root[data-skin="modern"] .mcard.today { border-color: var(--m-blue); }
:root[data-skin="modern"] .mchead { display: flex; align-items: center; gap: 12px; padding: 8px 12px; background: var(--m-band); }
:root[data-skin="modern"] .mchead .mtoggle { width: 26px; height: 26px; border: 1px solid var(--border); background: var(--panel); border-radius: 5px; cursor: pointer; font: inherit; font-weight: 700; color: var(--text); line-height: 1; }
:root[data-skin="modern"] .mchead .mdow { font-family: var(--m-mono); font-size: 12px; font-weight: 700; color: var(--m-blue); letter-spacing: .05em; }
:root[data-skin="modern"] .mchead .mdate { font-size: 15px; font-weight: 700; color: var(--text); }
:root[data-skin="modern"] .mchead .mcount { color: var(--muted); white-space: nowrap; }
:root[data-skin="modern"] .mchead .mkeyh { font-family: var(--m-mono); font-size: 13px; font-weight: 700; color: var(--m-blue); white-space: nowrap; }
:root[data-skin="modern"] .mchead .mtitleh { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
:root[data-skin="modern"] .mcard.ticket .mchead .mctotal { margin-left: 0; }
:root[data-skin="modern"] .mchead .mctotal { margin-left: auto; font-weight: 700; font-family: var(--m-mono); font-size: 14px; color: var(--text); }
:root[data-skin="modern"] .mchead .mlogbtn { height: 26px; padding: 0 10px; border: 1px solid var(--border); background: var(--panel); border-radius: 5px; font: inherit; font-size: 12px; font-weight: 600; cursor: pointer; color: var(--text); }
:root[data-skin="modern"] .mchead .mlogbtn:hover { background: var(--hover); }
:root[data-skin="modern"] table.mtable { width: 100%; border-collapse: collapse; table-layout: fixed; }
:root[data-skin="modern"] .mtable col.c-date { width: 105px; }
:root[data-skin="modern"] .mtable col.c-day { width: 60px; }
:root[data-skin="modern"] .mtable col.c-key { width: 110px; }
:root[data-skin="modern"] .mtable col.c-user { width: 150px; }
:root[data-skin="modern"] .mtable col.c-project { width: 160px; }
:root[data-skin="modern"] .mtable col.c-title { width: auto; }
:root[data-skin="modern"] .mtable col.c-type { width: 90px; }
:root[data-skin="modern"] .mtable col.c-status { width: 150px; }
:root[data-skin="modern"] .mtable col.c-priority { width: 90px; }
:root[data-skin="modern"] .mtable col.c-assignee { width: 140px; }
:root[data-skin="modern"] .mtable col.c-parent { width: 150px; }
:root[data-skin="modern"] .mtable col.c-labels { width: 140px; }
:root[data-skin="modern"] .mtable col.c-components { width: 140px; }
:root[data-skin="modern"] .mtable col.c-start { width: 70px; }
:root[data-skin="modern"] .mtable col.c-comment { width: 34%; }
:root[data-skin="modern"] .mtable col.c-hours { width: 90px; }
:root[data-skin="modern"] .mtable td.mono { font-family: var(--m-mono); font-size: 12.5px; }
:root[data-skin="modern"] .mtable td.mparent a { color: var(--m-blue); font-family: var(--m-mono); font-size: 12px; }
:root[data-skin="modern"] .mtable td.mparent .ps { display: block; color: var(--muted); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
:root[data-skin="modern"] .mchead .mctotal.short { color: var(--warn); }
:root[data-skin="modern"] .mtable td { overflow-wrap: anywhere; }
:root[data-skin="modern"] .mtable th { text-align: left; font-size: 10.5px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); padding: 9px 12px; background: var(--m-head); border-bottom: 1px solid var(--border-soft); }
:root[data-skin="modern"] .mtable td { padding: 11px 12px; border-bottom: 1px solid var(--border-soft); vertical-align: top; }
:root[data-skin="modern"] .mtable tr:last-child td { border-bottom: 0; }
:root[data-skin="modern"] .mtable tr.wl:hover td { background: var(--stripe); }
:root[data-skin="modern"] .mtable tr.wl.other td { color: var(--muted); }
:root[data-skin="modern"] .mtable td.mkey a { font-family: var(--m-mono); font-size: 12.5px; font-weight: 600; color: var(--m-blue); white-space: nowrap; }
:root[data-skin="modern"] .mtable td.mtitle { color: var(--text); }
:root[data-skin="modern"] .mtable td.mcomment { color: #4A5568; }
:root[data-skin="modern"][data-theme="dark"] .mtable td.mcomment { color: var(--muted); }
:root[data-skin="modern"] .mtable th.num, :root[data-skin="modern"] .mtable td.num { text-align: right; white-space: nowrap; }
:root[data-skin="modern"] .mtable td.num { font-family: var(--m-mono); font-weight: 700; font-size: 13px; position: relative; }
:root[data-skin="modern"] .mtable td.num .mact { position: absolute; right: 12px; top: 8px; display: none; gap: 4px; background: var(--panel); padding: 2px 4px; border-radius: 5px; box-shadow: var(--m-shadow); }
:root[data-skin="modern"] .mtable tr.wl:hover td.num .mact { display: inline-flex; }
:root[data-skin="modern"] .mtable tr.wl:hover td.num .mhours { visibility: hidden; }
:root[data-skin="modern"] .mact .ico { cursor: pointer; margin: 0 2px; }
:root[data-skin="modern"] .mact .ico.disabled { opacity: .3; pointer-events: none; }
:root[data-skin="modern"] .mempty { color: var(--muted); padding: 40px; text-align: center; background: var(--panel); border: 1px dashed var(--border); border-radius: var(--radius); }
:root[data-skin="modern"] .mmuted { color: var(--muted); }

/* status chips */
.chip-status { display: inline-block; padding: 2px 9px; border-radius: 4px; font-size: 11.5px; font-weight: 600; white-space: nowrap; background: #eceff3; color: #44546a; border: 1px solid transparent; }
.chip-status.indeterminate { background: #fdf3d2; color: #6b4e00; }
.chip-status.done { background: #dff5e6; color: #1b5e37; }
.chip-status.new { background: #eceff3; color: #44546a; }
:root[data-theme="dark"] .chip-status { background: #2b3340; color: #c9d2de; }
:root[data-theme="dark"] .chip-status.indeterminate { background: #4a3d12; color: #f3d98a; }
:root[data-theme="dark"] .chip-status.done { background: #1f3f2c; color: #8fd9a8; }

/* dialogs / menus in modern */
:root[data-skin="modern"] .dlg { border-radius: 12px; border: 0; box-shadow: 0 20px 60px rgba(0,0,0,.35); }
:root[data-skin="modern"] .dlg header { background: var(--panel); border-bottom: 1px solid var(--border-soft); padding: 14px 16px 12px 20px; margin: 0 -20px 0; }
:root[data-skin="modern"] .dlg form { padding: 0 20px 18px; gap: 14px; }
:root[data-skin="modern"] .dlg h2 { font-size: 15px; color: var(--m-navy); }
:root[data-skin="modern"] .btn { border-radius: 6px; background: var(--panel); }
:root[data-skin="modern"] .btn.primary { background: var(--m-navy); border-color: var(--m-navy); }
:root[data-skin="modern"] .ctx, :root[data-skin="modern"] .picker .results { border-radius: 8px; padding: 5px; }
:root[data-skin="modern"] .ctx .mi { border-radius: 5px; }
:root[data-skin="modern"] .segmented { border-radius: 6px; }
:root[data-skin="modern"] .seg.active { background: var(--m-navy); }
:root[data-skin="modern"] .user { border-radius: 6px; }
