@font-face {
  font-family: 'DM Sans';
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url('/fonts/dm-sans-latin-ext.woff2') format('woff2');
  unicode-range: U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+0304,U+0308,U+0329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF;
}
@font-face {
  font-family: 'DM Sans';
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url('/fonts/dm-sans-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD;
}
@font-face {
  font-family: 'Noto Sans Thai';
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url('/fonts/noto-thai-latin.woff2') format('woff2');
}
@font-face {
  font-family: 'Noto Sans Thai';
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url('/fonts/noto-thai-thai.woff2') format('woff2');
  unicode-range: U+02D7,U+0303,U+0331,U+0E01-0E5B,U+200C-200D,U+25CC;
}

/* Based on UXUI Knowledge Vault soft-elevated design language (MIT) */
:root {
  color-scheme: light;
  --rail-width: clamp(264px, 16vw, 304px);
  --radius-panel: 20px;
  --radius-control: 12px;
  --radius-chip: 999px;
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
  font-size: 16px;

  --bg: #f4f6fc;
  --bg-soft: #ebeef8;
  --card: #ffffff;
  --surface-subtle: #f7f8fd;
  --surface-hover: #f2f4fb;
  --line: #e4e7f2;
  --line-subtle: #eef0f8;
  --control-border: #d4d9e8;

  --ink: #141726;
  --label: #3b4058;
  --mute: #666c86;

  --brand: #3b5bfd;
  --brand-hover: #2d4ce8;
  --brand2: rgba(59, 91, 253, 0.1);
  --brand-border: rgba(59, 91, 253, 0.24);
  --grad: linear-gradient(125deg, #2f6bff 0%, #5b5cf6 56%, #8b5cf6 100%);
  --grad-ok: linear-gradient(120deg, #059669 0%, #10b981 100%);

  --shadow-sm: 0 1px 2px rgba(20, 23, 38, 0.05);
  --shadow-card: 0 1px 2px rgba(20, 23, 38, 0.04), 0 12px 32px -18px rgba(20, 23, 38, 0.16);
  --shadow-hover: 0 4px 10px rgba(20, 23, 38, 0.05), 0 18px 40px -18px rgba(59, 91, 253, 0.22);
  --shadow-cta: 0 10px 24px -10px rgba(79, 91, 250, 0.78);
  --shadow-dialog: 0 24px 64px -20px rgba(20, 23, 38, 0.34);

  --gray: #f1f3fa;
  --grayt: #4a5168;
  --grayb: #dde1ee;
  --blue: #e0f2fe;
  --bluet: #0369a1;
  --blueb: #bae6fd;
  --amber: #fef3c7;
  --ambert: #92400e;
  --amberb: #fde68a;
  --purple: #ede9fe;
  --purplet: #5b21b6;
  --purpleb: #ddd6fe;
  --teal: #ccfbf1;
  --tealt: #0f766e;
  --tealb: #99f6e4;
  --orange: #ffedd5;
  --oranget: #9a3412;
  --orangeb: #fed7aa;
  --green: #dcfce7;
  --greent: #047857;
  --greenb: #a7f3d0;
  --red: #fee2e2;
  --redt: #b91c1c;
  --redb: #fecaca;
}

.dark {
  color-scheme: dark;
  --bg: #0b0d14;
  --bg-soft: #11141e;
  --card: #141824;
  --surface-subtle: #191e2e;
  --surface-hover: #1e2437;
  --line: #23293b;
  --line-subtle: #1d2233;
  --control-border: #313850;

  --ink: #eef0f8;
  --label: #c4c9dc;
  --mute: #8d94ab;

  --brand: #6382ff;
  --brand-hover: #7692ff;
  --brand2: rgba(109, 139, 255, 0.15);
  --brand-border: rgba(109, 139, 255, 0.3);
  --grad: linear-gradient(125deg, #527bff 0%, #7668ff 56%, #a78bfa 100%);
  --grad-ok: linear-gradient(120deg, #10b981 0%, #34d399 100%);

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.38);
  --shadow-card: 0 1px 2px rgba(0, 0, 0, 0.35), 0 14px 36px -18px rgba(0, 0, 0, 0.72);
  --shadow-hover: 0 6px 14px rgba(0, 0, 0, 0.4), 0 18px 42px -18px rgba(99, 130, 255, 0.28);
  --shadow-cta: 0 10px 26px -10px rgba(109, 139, 255, 0.6);
  --shadow-dialog: 0 30px 80px -20px rgba(0, 0, 0, 0.8);

  --gray: #1d2335;
  --grayt: #c4c9dc;
  --grayb: #303750;
  --blue: rgba(56, 189, 248, 0.14);
  --bluet: #7dd3fc;
  --blueb: rgba(56, 189, 248, 0.28);
  --amber: rgba(251, 191, 36, 0.14);
  --ambert: #fde68a;
  --amberb: rgba(251, 191, 36, 0.3);
  --purple: rgba(167, 139, 250, 0.15);
  --purplet: #ddd6fe;
  --purpleb: rgba(167, 139, 250, 0.3);
  --teal: rgba(45, 212, 191, 0.14);
  --tealt: #5eead4;
  --tealb: rgba(45, 212, 191, 0.28);
  --orange: rgba(251, 146, 60, 0.14);
  --oranget: #fdba74;
  --orangeb: rgba(251, 146, 60, 0.3);
  --green: rgba(52, 211, 153, 0.14);
  --greent: #6ee7b7;
  --greenb: rgba(52, 211, 153, 0.28);
  --red: rgba(248, 113, 113, 0.14);
  --redt: #fca5a5;
  --redb: rgba(248, 113, 113, 0.3);
}

* { box-sizing: border-box; }
::selection { background: var(--brand2); color: var(--brand); }
.dark ::selection { color: #9bb1ff; }

* { scrollbar-width: thin; scrollbar-color: var(--control-border) transparent; }
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--control-border); border-radius: 999px; }

[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; border-radius: 10px; }

body {
  margin: 0;
  min-width: 300px;
  font-family: "DM Sans", "Noto Sans Thai", "Leelawadee UI", Tahoma, sans-serif;
  font-size: 1rem;
  line-height: 1.55;
  color: var(--ink);
  background:
    radial-gradient(680px 320px at 14% -4%, rgba(59, 91, 253, 0.08), transparent 64%),
    radial-gradient(560px 300px at 94% 0%, rgba(139, 92, 246, 0.07), transparent 64%),
    var(--bg);
  background-attachment: fixed;
  caret-color: var(--brand);
  font-variant-numeric: tabular-nums;
  -webkit-font-smoothing: antialiased;
}
.dark body {
  background:
    radial-gradient(680px 340px at 14% -4%, rgba(99, 130, 255, 0.12), transparent 64%),
    radial-gradient(560px 320px at 94% 0%, rgba(167, 139, 250, 0.1), transparent 64%),
    var(--bg);
  background-attachment: fixed;
}

a { color: var(--brand); text-underline-offset: 3px; }
.dark a { color: #9bb1ff; }
h1, h2, h3, p { overflow-wrap: break-word; }

h1 {
  font-size: 1.625rem;
  font-weight: 700;
  line-height: 1.25;
  letter-spacing: -0.025em;
  margin: 0 0 6px;
  color: var(--ink);
}
h2 {
  font-size: 1.0625rem;
  font-weight: 650;
  line-height: 1.38;
  letter-spacing: -0.015em;
  margin: 26px 0 12px;
  color: var(--ink);
}
h3 {
  font-size: 0.96875rem;
  font-weight: 650;
  line-height: 1.45;
  margin: 0 0 8px;
  color: var(--ink);
}
.sub { color: var(--mute); font-size: 0.875rem; margin: 0 0 16px; }
.meta { font-size: 0.8125rem; color: var(--mute); }
.na { color: var(--mute); }

/* Inline SVG Icon Utility */
.ui-ico {
  display: inline-block;
  width: 14px;
  height: 14px;
  vertical-align: -2px;
  flex-shrink: 0;
  margin-right: 5px;
}
.chip .ui-ico { width: 12px; height: 12px; margin-right: 3px; vertical-align: -1px; }

/* Soft Sculpted Navigation Rail (matches /office/) */
#hdr {
  background: color-mix(in srgb, var(--card) 92%, transparent);
  backdrop-filter: saturate(1.4) blur(12px);
  -webkit-backdrop-filter: saturate(1.4) blur(12px);
  border-right: 1px solid var(--line);
  z-index: 12;
}
.brand-row {
  padding: 18px 18px 16px;
  border-bottom: 1px dashed var(--line);
}
.brand {
  display: inline-flex;
  gap: 11px;
  align-items: center;
  color: var(--ink);
  text-decoration: none;
  white-space: nowrap;
}
.brand-mark {
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  color: #ffffff;
  background: var(--grad);
  border-radius: 11px;
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  box-shadow: 0 8px 18px -8px rgba(79, 91, 250, 0.75);
}
.brand-copy { display: grid; line-height: 1.28; }
.brand-copy strong { font-size: 0.96875rem; font-weight: 700; color: var(--ink); letter-spacing: -0.01em; }
.brand-copy small { font-size: 0.72rem; color: var(--mute); font-weight: 500; }

#navigation { display: flex; flex-direction: column; flex: 1; }
#nav { padding: 16px 14px 14px; display: grid; gap: 16px; }
#nav .office-link {
  display: flex;
  align-items: center;
  gap: 11px;
  min-height: 40px;
  padding: 8px 12px;
  color: var(--label);
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--radius-control);
  text-decoration: none;
  font-size: 0.875rem;
  font-weight: 550;
  transition: background-color 160ms var(--ease), color 160ms var(--ease);
}
#nav .office-link:hover { background: var(--surface-hover); color: var(--ink); }
.nav-group { display: grid; gap: 3px; }
.nav-group > span {
  color: var(--mute);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  padding: 0 12px 4px;
}
.nav-group a {
  display: flex;
  align-items: center;
  gap: 11px;
  min-height: 40px;
  padding: 8px 12px;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--label);
  border-radius: var(--radius-control);
  text-decoration: none;
  transition: background-color 160ms var(--ease), color 160ms var(--ease);
}
.nav-group a svg, #nav .office-link svg {
  flex: none;
  width: 17px;
  height: 17px;
  opacity: 0.78;
}
.nav-group a:hover { background: var(--surface-hover); color: var(--ink); }
.nav-group a.on { color: var(--brand); background: var(--brand2); font-weight: 650; }
.dark .nav-group a.on { color: #9bb1ff; }
.nav-group a.on svg { opacity: 1; color: var(--brand); }

.account {
  display: flex;
  flex-direction: column;
  gap: 10px;
  border-top: 1px dashed var(--line);
  padding: 14px 16px 16px;
  margin-top: auto;
}
.who { font-weight: 600; font-size: 0.8125rem; color: var(--ink); }
.account-actions { display: flex; gap: 6px; flex-wrap: wrap; }

/* Frosted Glass Sticky Top Context Bar */
.workspace-bar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  min-height: 64px;
  align-items: center;
  gap: 14px;
  padding: 10px clamp(18px, 2.6vw, 34px);
  background: color-mix(in srgb, var(--bg) 80%, transparent);
  backdrop-filter: saturate(1.6) blur(14px);
  -webkit-backdrop-filter: saturate(1.6) blur(14px);
  border-bottom: 1px solid var(--line);
}
.workspace-firm { font-size: 0.9rem; font-weight: 650; color: var(--ink); white-space: nowrap; }
.period-select-wrap { display: flex; align-items: center; gap: 8px; margin-left: auto; }
.workspace-bar label { color: var(--mute); font-size: 0.8125rem; font-weight: 600; }
.period-actions { display: flex; flex-wrap: wrap; gap: 8px; }

/* Main Content — Fluid Full-Workspace Width */
#app {
  width: 100%;
  max-width: none;
  min-width: 0;
  margin: 0;
  padding: clamp(24px, 2vw, 38px) clamp(22px, 2.6vw, 48px) 64px;
}

@media (min-width: 1680px) {
  :root { font-size: 17px; }
}
@media (min-width: 2100px) {
  :root { font-size: 18.5px; }
}

/* Sculpted Controls & Buttons */
button, a.btn2, input:not([type=checkbox]):not([type=radio]), select, textarea {
  font: inherit;
  font-size: 0.875rem;
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: var(--radius-control);
  background: var(--card);
  padding: 7px 12px;
  max-width: 100%;
  box-shadow: var(--shadow-sm);
  transition: background-color 160ms var(--ease), border-color 160ms var(--ease), color 160ms var(--ease), transform 160ms var(--ease), box-shadow 160ms var(--ease);
}
button, a.btn2, select { min-height: 38px; }
button { font-weight: 600; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; }
button.sm { font-size: 0.8125rem; padding: 5px 12px; min-height: 34px; border-radius: 10px; }
button:hover:not(:disabled), a.btn2:hover {
  background: var(--surface-subtle);
  border-color: var(--control-border);
  transform: translateY(-1px);
}
button:active:not(:disabled) { transform: translateY(0); }
button:disabled { opacity: 0.45; cursor: not-allowed; box-shadow: none; }
button.p {
  color: #ffffff;
  background: var(--grad);
  border-color: transparent;
  box-shadow: var(--shadow-cta);
}
button.p:hover:not(:disabled) {
  transform: translateY(-1.5px);
  box-shadow: 0 14px 28px -10px rgba(79, 91, 250, 0.9);
}
button.d {
  color: var(--redt);
  border-color: var(--redb);
  background: var(--card);
}
button.d:hover:not(:disabled) { background: var(--red); border-color: var(--redt); }
select:hover:not(:disabled), input:not([type=checkbox]):not([type=radio]):hover:not(:disabled), textarea:hover:not(:disabled) {
  border-color: var(--control-border);
}
select:focus, input:not([type=checkbox]):not([type=radio]):focus, textarea:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 4px var(--brand2);
}
textarea { width: 100%; min-height: 82px; }
input[type=checkbox], input[type=radio] { accent-color: var(--brand); width: 16px; height: 16px; }
a.btn2 { display: inline-flex; align-items: center; gap: 4px; text-decoration: none; font-weight: 550; color: var(--ink); }
a.cl { color: var(--brand); text-decoration: none; font-weight: 600; }
.dark a.cl { color: #9bb1ff; }
a.cl:hover { text-decoration: underline; }
a.lk { text-decoration: none; color: var(--mute); display: inline-flex; align-items: center; vertical-align: middle; margin-left: 5px; }
a.lk:hover { color: var(--brand); }

.icon-btn {
  display: none;
  place-items: center;
  width: 38px;
  height: 38px;
  min-height: 38px;
  padding: 0;
  border-radius: 11px;
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--label);
}
.icon-btn svg { width: 20px; height: 20px; }

/* Soft Elevated Panels & Cards */
.card, .task, .tile, .tw {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius-panel);
  box-shadow: var(--shadow-card);
}
.card { padding: 22px; }
.card h2:first-child { margin-top: 0; }

.tiles {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 14px;
  margin-bottom: 16px;
}
.tile {
  padding: 16px 18px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  transition: transform 180ms var(--ease), box-shadow 200ms var(--ease);
}
.tile:hover { transform: translateY(-2px); box-shadow: var(--shadow-hover); }
.tile b { display: block; font-size: 1.9rem; font-weight: 700; line-height: 1.12; letter-spacing: -0.025em; color: var(--ink); }
.tile span { color: var(--mute); font-size: 0.8125rem; font-weight: 550; }
.tile.warn { border-color: var(--redb); background: var(--red); }
.tile.warn b, .tile.warn span { color: var(--redt); }

/* Soft Rounded Tables */
.tw { min-width: 0; max-width: 100%; overflow: auto; }
table {
  width: 100%;
  border-collapse: collapse;
  background: var(--card);
  font-size: 0.875rem;
  font-variant-numeric: tabular-nums;
}
th, td {
  padding: 11px 13px;
  border-bottom: 1px solid var(--line-subtle);
  text-align: left;
  vertical-align: middle;
}
th {
  font-size: 0.75rem;
  color: var(--mute);
  font-weight: 650;
  background: var(--surface-subtle);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 1;
  white-space: nowrap;
}
tr:last-child td { border-bottom: 0; }
tr:hover td { background: var(--surface-hover); }
td.wrap { white-space: pre-wrap; word-break: break-word; min-width: 220px; }

table.mx th, table.mx td { padding: 10px 10px; }
table.mx th.grp {
  text-align: center;
  border-left: 1px solid var(--line);
  background: var(--surface-subtle);
  color: var(--label);
}
table.mx tbody td:nth-child(2) { min-width: 180px; max-width: 260px; }
table.mx tbody td:nth-child(3) { white-space: nowrap; }
table.mx td.pg { white-space: nowrap; min-width: 126px; }
table.mx td.pg span { font-size: 0.8125rem; color: var(--mute); margin-left: 8px; font-weight: 600; }
.prog {
  display: inline-block;
  width: 68px;
  height: 7px;
  border-radius: 999px;
  background: var(--bg-soft);
  overflow: hidden;
  vertical-align: middle;
}
.prog i { display: block; height: 100%; background: var(--grad); border-radius: 999px; }
table.mx tr.sum td {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--label);
  background: var(--surface-subtle);
  border-top: 1px solid var(--line);
}

/* Pill Status Chips */
.chip {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: var(--radius-chip);
  font-size: 0.75rem;
  line-height: 1.4;
  white-space: nowrap;
  background: var(--gray);
  color: var(--grayt);
  border: 1px solid var(--grayb);
}
.s-todo { background: var(--gray); color: var(--grayt); border-color: var(--grayb); }
.s-doing { background: var(--blue); color: var(--bluet); border-color: var(--blueb); }
.s-review { background: var(--amber); color: var(--ambert); border-color: var(--amberb); }
.s-approve { background: var(--purple); color: var(--purplet); border-color: var(--purpleb); }
.s-tofile { background: var(--teal); color: var(--tealt); border-color: var(--tealb); }
.s-filed, .s-pay { background: var(--orange); color: var(--oranget); border-color: var(--orangeb); }
.s-done { background: var(--green); color: var(--greent); border-color: var(--greenb); }
.chip.w { border-color: var(--ambert); border-style: dashed; }
.late { border-color: var(--redt) !important; background: var(--red) !important; color: var(--redt) !important; }
.flag { background: var(--red); color: var(--redt); border-color: var(--redb); }
.chip.k-comment { background: var(--amber); color: var(--ambert); border-color: var(--amberb); }
.chip.k-back { background: var(--red); color: var(--redt); border-color: var(--redb); }
.chip.k-ai { background: var(--blue); color: var(--bluet); border-color: var(--blueb); }

.by {
  display: inline-block;
  margin-left: 4px;
  padding: 2px 7px;
  border-radius: 999px;
  font-size: 0.6875rem;
  font-weight: 600;
  line-height: 1.35;
  background: var(--amber);
  color: var(--ambert);
  border: 1px solid var(--amberb);
  vertical-align: middle;
  white-space: nowrap;
}

/* Monthly Overview Dashboard */
.monthly-dashboard { display: grid; gap: 18px; }
.monthly-dashboard h2 { margin: 0 0 12px; font-size: 1.03125rem; font-weight: 650; }
.dashboard-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}
.dashboard-heading p { margin: 3px 0 0; color: var(--mute); font-size: 0.875rem; }
.due-details { position: relative; }
.due-details summary, .dash-legend summary {
  color: var(--label);
  font-size: 0.8125rem;
  font-weight: 600;
  cursor: pointer;
}
.due-details summary {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius-control);
  padding: 8px 14px;
  box-shadow: var(--shadow-sm);
  transition: background-color 160ms var(--ease), border-color 160ms var(--ease);
}
.due-details summary:hover { background: var(--surface-subtle); border-color: var(--control-border); }
.due-details ul {
  position: absolute;
  right: 0;
  z-index: 8;
  min-width: 260px;
  padding: 16px 22px 16px 32px;
  margin: 8px 0;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: var(--shadow-dialog);
  font-size: 0.875rem;
}
.dashboard-summary {
  display: grid;
  grid-template-columns: minmax(270px, 1fr) 2fr;
  gap: 18px;
}
.dashboard-summary section, .dashboard-panel {
  border-radius: var(--radius-panel);
  padding: 22px;
  border: 1px solid var(--line);
  background: var(--card);
  box-shadow: var(--shadow-card);
}

/* Sculpted Completion Ring Card (inspired by UXUI Knowledge Vault Goal Tracker) */
.completion {
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 14px;
}
.completion::before {
  content: "";
  position: absolute;
  inset: -40% -20% auto auto;
  width: 200px;
  height: 200px;
  border-radius: 50%;
  background: radial-gradient(circle, var(--brand2), transparent 70%);
  pointer-events: none;
}
.completion-body {
  position: relative;
  display: flex;
  align-items: center;
  gap: 18px;
}
.completion-ring-wrap {
  position: relative;
  width: 92px;
  height: 92px;
  flex: none;
  display: grid;
  place-items: center;
}
.completion-ring {
  width: 92px;
  height: 92px;
  transform: rotate(-90deg);
}
.completion-ring .ring-bg { fill: none; stroke: var(--bg-soft); stroke-width: 9; }
.completion-ring .ring-fg {
  fill: none;
  stroke: url(#anRingGrad);
  stroke-width: 9;
  stroke-linecap: round;
  transition: stroke-dashoffset 450ms var(--ease);
}
.completion-ring-pct {
  position: absolute;
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--ink);
  letter-spacing: -0.02em;
}
.completion-total strong {
  font-size: 2.35rem;
  font-weight: 700;
  line-height: 1.08;
  letter-spacing: -0.03em;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}
.completion-total strong small { font-size: 1.2rem; font-weight: 600; color: var(--mute); margin-left: 2px; }
.completion-total p { margin: 4px 0 0; font-size: 0.8125rem; color: var(--mute); }
.completion progress {
  position: relative;
  width: 100%;
  height: 8px;
  appearance: none;
  border: 0;
  border-radius: 999px;
  overflow: hidden;
  background: var(--bg-soft);
}
.completion progress::-webkit-progress-bar { background: var(--bg-soft); border-radius: 999px; }
.completion progress::-webkit-progress-value { background: var(--grad); border-radius: 999px; }
.completion progress::-moz-progress-bar { background: var(--grad); border-radius: 999px; }

/* Soft Sculpted Follow-up Tiles */
.follow-up, .dashboard-panel { min-width: 0; }
.follow-up { display: flex; flex-direction: column; }
.follow-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  flex: 1;
}
.metric {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 6px;
  text-decoration: none;
  border: 1px solid var(--line-subtle);
  border-radius: 15px;
  padding: 13px 15px;
  background: var(--surface-subtle);
  transition: transform 180ms var(--ease), background-color 160ms var(--ease), border-color 160ms var(--ease), box-shadow 180ms var(--ease);
}
.metric span { font-size: 0.8125rem; color: var(--label); font-weight: 550; }
.metric strong {
  font-size: 1.625rem;
  font-weight: 700;
  line-height: 1.15;
  letter-spacing: -0.02em;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}
.follow-up .urgent { color: var(--redt); }
.metric:hover {
  transform: translateY(-2px);
  background: var(--card);
  border-color: var(--brand-border);
  box-shadow: var(--shadow-sm);
}
.metric.selected {
  background: var(--brand2);
  border-color: var(--brand);
  box-shadow: 0 0 0 3px var(--brand2);
}
.metric.selected span, .metric.selected strong { color: var(--brand); }
.dark .metric.selected span, .dark .metric.selected strong { color: #9bb1ff; }

.dashboard-panel .bar { margin: 12px 0; }
.dashboard-panel .dash-legend { margin: 0 0 14px; font-size: 0.8125rem; }
.dashboard-panel .tw {
  border-radius: 14px;
  border: 1px solid var(--line-subtle);
  box-shadow: none;
}

.filter-count {
  margin-left: auto;
  font-size: 0.8125rem;
  color: var(--mute);
  white-space: nowrap;
}

.legend { display: flex; gap: 6px; flex-wrap: wrap; margin: 10px 0 4px; align-items: center; }
.section-heading { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }

/* Rows, Bars, Task Cards */
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.bar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 14px; }
.grid2 { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 420px), 1fr)); gap: 18px; }

.task {
  padding: 20px 22px;
  display: flex;
  flex-direction: column;
  gap: 13px;
  min-width: 0;
  overflow-wrap: anywhere;
  transition: transform 200ms var(--ease), box-shadow 220ms var(--ease), border-color 200ms var(--ease);
}
.task:hover { box-shadow: var(--shadow-hover); }
.task.latecard {
  background: var(--card);
  border-color: var(--redb);
  box-shadow: 0 1px 2px rgba(185, 28, 28, 0.06), 0 12px 32px -18px rgba(185, 28, 28, 0.28);
}
.task h3 {
  margin: 0;
  font-size: 1.03125rem;
  display: flex;
  justify-content: space-between;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}
.steps { display: flex; gap: 5px; }
.steps i { flex: 1; height: 6px; border-radius: 999px; background: var(--bg-soft); }
.steps i.on { background: var(--grad); }
.steps i.fin { background: var(--grad-ok); }

.slot {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  font-size: 0.8125rem;
  padding: 9px 12px;
  border: 1px dashed var(--control-border);
  border-radius: 13px;
  background: var(--surface-subtle);
}
.slot.ok { border-style: solid; border-color: var(--greenb); background: var(--green); }
.slot a { color: var(--brand); font-weight: 600; }
.dark .slot a { color: #9bb1ff; }

.note {
  padding: 10px 14px;
  border-radius: 13px;
  font-size: 0.8125rem;
  border: 1px solid transparent;
}
.note.r { background: var(--red); color: var(--redt); border-color: var(--redb); }
.note.a { background: var(--amber); color: var(--ambert); border-color: var(--amberb); }
.note.b { background: var(--blue); color: var(--bluet); border-color: var(--blueb); }

.log {
  font-size: 0.8125rem;
  color: var(--mute);
  max-height: 220px;
  overflow: auto;
  border-top: 1px dashed var(--line);
  padding-top: 10px;
  line-height: 1.65;
}
.log div { padding: 3px 0; }
.log .k-comment { color: var(--ink); background: var(--amber); border-radius: 10px; padding: 6px 10px; margin: 4px 0; }
.log .k-back { color: var(--redt); font-weight: 500; }
.log .k-ai { color: var(--ink); background: var(--blue); border-radius: 10px; padding: 6px 10px; margin: 4px 0; white-space: pre-wrap; }

/* Client Registry & Checklists */
.card.reg { margin-bottom: 18px; }
.reg .kv {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr));
  gap: 14px 20px;
  margin-top: 14px;
}
.reg .kv div span { display: block; font-size: 0.75rem; color: var(--mute); font-weight: 550; }
.reg .kv div b { font-weight: 600; color: var(--ink); font-size: 0.875rem; }

.cklist {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 4px 0;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface-subtle);
}
.cklist b { font-size: 0.8125rem; color: var(--ink); }
.cklist label { display: flex; gap: 9px; align-items: flex-start; font-size: 0.875rem; color: var(--label); }
.cklist input { margin-top: 3px; }
.aick {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.75rem;
  font-weight: 550;
  margin-top: 4px;
  padding: 2px 10px;
  border-radius: 999px;
  border: 1px solid transparent;
}
.aick.ok { background: var(--blue); color: var(--bluet); border-color: var(--blueb); }
.aick.bad { background: var(--red); color: var(--redt); border-color: var(--redb); }
.aick.un { background: var(--amber); color: var(--ambert); border-color: var(--amberb); }

.watch {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 4px 0;
  padding: 14px 16px;
  border: 1px dashed var(--control-border);
  border-radius: 14px;
  font-size: 0.8125rem;
  background: var(--surface-subtle);
}
.watch .wl { display: flex; flex-direction: column; gap: 3px; }

table.scope { width: 100%; border-collapse: collapse; }
table.scope th { text-align: left; font-size: 0.75rem; color: var(--mute); padding: 8px 0 3px; background: transparent; border: 0; position: static; }
table.scope td { padding: 5px 0; border-bottom: 1px solid var(--line-subtle); }

/* Modals */
#modal {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  max-width: none;
  max-height: none;
  margin: 0;
  border: 0;
  background: transparent;
  display: none;
  align-items: flex-start;
  justify-content: center;
  padding: 40px 16px;
  z-index: 24;
  overflow: auto;
  color: var(--ink);
}
#modal.on { display: flex; }
#modal::backdrop { background: rgba(11, 13, 20, 0.5); backdrop-filter: blur(4px); }
#modal .box {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 22px;
  box-shadow: var(--shadow-dialog);
  padding: clamp(20px, 3vw, 28px);
  width: 100%;
  max-width: 640px;
}
#modal h2 { margin-top: 0; }
.attachment-link { margin: 16px 0; padding: 12px 0; border-block: 1px solid var(--line); }
.attachment-link summary { cursor: pointer; color: var(--label); }
.attachment-link[open] summary { margin-bottom: 12px; }
.f { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.f > span { font-size: 0.8125rem; font-weight: 600; color: var(--label); }
.f input[type=text], .f input[type=number], .f select { width: 100%; }
.checks { display: flex; gap: 14px; flex-wrap: wrap; }
pre.mail {
  white-space: pre-wrap;
  background: var(--surface-subtle);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 14px 16px;
  font: inherit;
  font-size: 0.8125rem;
  max-height: 300px;
  overflow: auto;
}
.proto {
  background: var(--amber);
  border-bottom: 1px solid var(--amberb);
  color: var(--ambert);
  font-size: 0.8125rem;
  padding: 6px 20px;
}

/* Login Screen */
.login {
  padding: 36px 32px;
  max-width: 440px;
  margin: 12vh auto;
  text-align: center;
  border-radius: 24px;
}
main.login { width: calc(100% - 32px); }
.login .brand-mark {
  margin: 0 auto 16px;
  width: 48px;
  height: 48px;
  border-radius: 14px;
  font-size: 1.35rem;
}
.login a.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--grad);
  color: #ffffff;
  padding: 11px 22px;
  border-radius: var(--radius-control);
  text-decoration: none;
  font-weight: 600;
  box-shadow: var(--shadow-cta);
}

/* Responsive Layout */
@media (min-width: 1024px) {
  body:has(#hdr:not([hidden])) { padding-left: var(--rail-width); }
  #hdr {
    position: fixed;
    inset: 0 auto 0 0;
    display: flex;
    flex-direction: column;
    width: var(--rail-width);
    overflow-y: auto;
  }
}
@media (max-width: 1023px) {
  table.mx tbody td:nth-child(2), table.mx tbody td:nth-child(3) { min-width: 150px; }
  .brand-row {
    min-height: 58px;
    padding: 9px 14px;
    display: flex;
    align-items: center;
    gap: 10px;
    border-bottom: 1px solid var(--line);
  }
  .icon-btn { display: grid; }
  .brand-mark { width: 32px; height: 32px; font-size: 0.9rem; border-radius: 10px; }
  .brand-copy small { display: none; }
  .workspace-firm { display: none; }
  .period-select-wrap { margin-left: 0; }
  #navigation { display: none; }
  #hdr.expanded #navigation { display: flex; border-bottom: 1px solid var(--line); }
  #nav { padding-top: 12px; }
  .nav-group a, #nav .office-link { min-height: 44px; }
  .account { flex-direction: row; align-items: center; justify-content: space-between; }
}
@media (max-width: 720px) {
  .workspace-bar { flex-wrap: wrap; padding: 8px 14px; gap: 6px; min-height: 52px; }
  .period-actions { margin-left: auto; }
  #app { padding: 16px 14px 40px; }
  .dashboard-heading { flex-wrap: wrap; align-items: center; gap: 8px 14px; }
  .due-details ul { position: static; }
  .dashboard-summary { grid-template-columns: minmax(0, 1fr); gap: 14px; }
  .dashboard-panel, .dashboard-summary section, .card, .task { padding: 18px; border-radius: 18px; }
  .follow-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .filter-count { margin-left: 0; flex-basis: 100%; }
  .bar, .row, .bar > *, .row > * { max-width: 100%; }
  button.sm { min-height: 36px; }
  .bar .sub { flex-basis: 100%; }
  .tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: 0.01ms !important; animation-duration: 0.01ms !important; }
}
