/* TinyWoolf Studio components. Values come from tokens.css. */

/* Base */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  display: flex; flex-direction: column; min-height: 100vh; min-height: 100dvh;
  margin: 0;
  background: var(--surface-page);
  color: var(--text);
  font-family: var(--font-body);
  font-size: var(--text-base);
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}
body > main { flex: 1 0 auto; width: 100%; }
h1, h2, h3 {
  margin: 0;
  font-family: var(--font-heading);
  font-weight: var(--weight-regular);
  line-height: 1.2;
}
h1 { font-size: var(--text-2xl); letter-spacing: -0.01em; }
h2 { font-size: var(--text-lg); }
h3 { font-size: var(--text-base); }
p { margin: 0; }
ul, ol { margin: 0; padding: 0; list-style: none; }
dl, dd { margin: 0; }
img { display: block; }
code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 0.95em; }
a { color: var(--link); text-underline-offset: 2px; }
a:hover { color: var(--primary-hover); }
[data-theme="dark"] a:hover { color: var(--link); }
button, input, select, textarea { font: inherit; color: inherit; }
:focus { outline: none; }
:focus-visible { outline: 2px solid var(--focus-ring); outline-offset: 2px; border-radius: var(--radius-sm); }
main:focus-visible, h2[tabindex="-1"]:focus-visible { outline: none; }
[id^="section-"], [id^="group-"] { scroll-margin-top: calc(var(--topbar-height) + var(--space-4)); }
::selection { background: var(--primary-tint); color: var(--text); }

.icon { width: 18px; height: 18px; flex: none; }
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0;
}
.skip-link {
  position: absolute; left: var(--space-3); top: -60px; z-index: 100;
  padding: var(--space-2) var(--space-3); background: var(--surface);
  border: 1px solid var(--border-control); border-radius: var(--radius-md);
}
.skip-link:focus { top: var(--space-2); }
.muted { color: var(--text-muted); }
.preserve-lines { white-space: pre-wrap; overflow-wrap: anywhere; }
.stack > * + * { margin-top: var(--space-4); }
.kbd {
  display: inline-flex; align-items: center; justify-content: center; min-width: 16px; height: 16px;
  margin-left: var(--space-1); padding: 0 4px; vertical-align: 0;
  border: 1px solid var(--border-strong); border-bottom-width: 2px; border-radius: var(--radius-sm);
  background: var(--surface); color: var(--text-muted);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 10.5px; line-height: 1;
}

/* Page shells */
.page { max-width: var(--page-max); margin: 0 auto; padding: var(--space-6) var(--space-5) var(--space-7); }
.page--wide { max-width: var(--page-max-wide); }
.page--narrow { max-width: var(--page-max-narrow); }
.page-head {
  display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between;
  gap: var(--space-3) var(--space-4); margin-bottom: var(--space-5);
}
.page-sub { margin-top: var(--space-1); color: var(--text-muted); font-size: var(--text-md); }
.eyebrow { font-size: var(--text-sm); color: var(--text-muted); margin-bottom: var(--space-1); }
.eyebrow a { color: inherit; text-decoration: none; }
.eyebrow a:hover { color: var(--link); text-decoration: underline; }

/* Top bar */
.topbar {
  position: sticky; top: 0; z-index: 20;
  background: var(--surface-topbar); border-bottom: 1px solid var(--border);
  -webkit-backdrop-filter: saturate(1.4) blur(12px); backdrop-filter: saturate(1.4) blur(12px);
}
.topbar__inner {
  display: flex; align-items: center; gap: var(--space-5);
  max-width: var(--page-max-wide); min-height: var(--topbar-height);
  margin: 0 auto; padding: var(--space-2) var(--space-5);
}
.brand { display: flex; align-items: center; flex: none; border-radius: var(--radius-md); }
.brand__logo { height: 30px; width: auto; }
.mainnav { display: flex; gap: var(--space-1); flex: 1; min-width: 0; }
.mainnav a {
  display: inline-flex; align-items: center; gap: var(--space-2);
  padding: 7px var(--space-3); border-radius: var(--radius-pill);
  color: var(--text-muted); text-decoration: none; font-size: var(--text-md);
  transition: background-color 0.15s var(--ease), color 0.15s var(--ease);
}
.mainnav a .icon { width: 17px; height: 17px; }
.mainnav a:hover { color: var(--text); background: var(--surface-sunken); }
.mainnav a[aria-current="page"] { color: var(--link); background: var(--primary-tint); }
.topbar__tools { display: flex; align-items: center; gap: var(--space-2); margin-left: auto; }

.theme-switch {
  display: inline-flex; align-items: center; flex: none; padding: 3px; margin: 0;
  background: none; border: 0; border-radius: var(--radius-pill); cursor: pointer; color: inherit;
}
.theme-switch__track {
  position: relative; display: flex; align-items: center; justify-content: space-between;
  width: 56px; height: 30px; padding: 0 7px; border-radius: var(--radius-pill);
  background: var(--surface-sunken); box-shadow: inset 0 0 0 1px var(--border-strong);
  color: var(--text-muted); transition: background-color 0.2s var(--ease);
}
.theme-switch__track > .icon { width: 14px; height: 14px; }
.theme-switch__thumb {
  position: absolute; top: 3px; left: 3px; display: flex; align-items: center; justify-content: center;
  width: 24px; height: 24px; border-radius: 50%; background: var(--surface); color: var(--tw-blue);
  box-shadow: 0 1px 3px rgba(30, 30, 30, 0.25); transition: transform 0.2s var(--ease);
}
.theme-switch__thumb .icon { width: 14px; height: 14px; }
.theme-switch__thumb .theme-switch__moon { display: none; }
.theme-switch:hover .theme-switch__track { box-shadow: inset 0 0 0 1px var(--text-muted); }
.theme-switch:focus-visible { outline-offset: 1px; border-radius: var(--radius-pill); }
[data-theme="dark"] .theme-switch__track { background: var(--primary-tint); }
[data-theme="dark"] .theme-switch__thumb { transform: translateX(26px); background: var(--primary); color: #fff; box-shadow: none; }
[data-theme="dark"] .theme-switch__thumb .theme-switch__sun { display: none; }
[data-theme="dark"] .theme-switch__thumb .theme-switch__moon { display: block; }

.account-menu { position: relative; }
.account-menu summary {
  display: flex; align-items: center; gap: var(--space-2); cursor: pointer; list-style: none;
  padding: 4px var(--space-2) 4px 4px; border-radius: var(--radius-pill); font-size: var(--text-md);
  transition: background-color 0.15s var(--ease);
}
.account-menu summary::-webkit-details-marker { display: none; }
.account-menu summary:hover, .account-menu[open] summary { background: var(--surface-sunken); }
.account-menu summary .avatar { width: 30px; height: 30px; font-size: 11.5px; }
.account-menu__chevron { width: 15px; height: 15px; color: var(--text-muted); transition: transform 0.15s var(--ease); }
.account-menu[open] .account-menu__chevron { transform: rotate(180deg); }
.account-menu__panel {
  position: absolute; right: 0; top: calc(100% + 6px); z-index: 30; min-width: 230px;
  padding: var(--space-2); background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow-menu);
}
.account-menu__who {
  display: flex; flex-direction: column; gap: 2px; padding: var(--space-2);
  margin-bottom: var(--space-1); border-bottom: 1px solid var(--border); font-size: var(--text-md);
}
.account-menu__who strong { font-weight: var(--weight-strong); }
.account-menu__who span { color: var(--text-muted); font-size: var(--text-sm); }
.account-menu__panel a, .account-menu__panel button {
  display: flex; align-items: center; gap: var(--space-2); width: 100%; padding: 7px var(--space-2); text-align: left;
  background: none; border: 0; border-radius: var(--radius-md); color: var(--text);
  font-size: var(--text-md); text-decoration: none; cursor: pointer;
}
.account-menu__panel .icon { width: 16px; height: 16px; color: var(--text-muted); }
.account-menu__panel a:hover, .account-menu__panel button:hover { background: var(--surface-sunken); color: var(--text); }

/* Footer */
.site-footer { border-top: 1px solid var(--border); color: var(--text-muted); font-size: var(--text-sm); }
.site-footer__inner {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--space-2) var(--space-4);
  max-width: var(--page-max-wide); margin: 0 auto; padding: var(--space-4) var(--space-5);
}
.site-footer__meta, .site-footer__end { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2) var(--space-3); }
.site-footer__version { font-variant-numeric: tabular-nums; }
.site-footer__credit a {
  display: inline-flex; align-items: center; gap: 5px; vertical-align: bottom;
  color: var(--text); font-weight: var(--weight-strong); text-decoration: none;
}
.site-footer__credit a:hover { color: var(--link); text-decoration: underline; }
.site-footer__credit .icon { width: 15px; height: 15px; }
.site-footer .theme-switch { margin-right: var(--space-2); }
.badge {
  display: inline-flex; align-items: center; padding: 1px 8px; border-radius: var(--radius-pill);
  font-size: 11px; font-weight: var(--weight-strong); letter-spacing: 0.05em; text-transform: uppercase; line-height: 18px;
}
.badge--beta { background: var(--primary-tint); color: var(--link); }

/* Request progress line */
.request-bar {
  position: fixed; top: 0; left: 0; z-index: 50; width: 100%; height: 2px;
  background: var(--primary); opacity: 0; transition: opacity 0.1s;
}
.request-bar.is-active { opacity: 1; }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--space-2);
  min-height: var(--control-h); padding: 0 16px; background: var(--surface);
  border: 1px solid var(--border-control); border-radius: var(--radius-md);
  color: var(--text); font-size: var(--text-md); line-height: 1.2;
  text-decoration: none; cursor: pointer; white-space: nowrap;
  transition: background-color 0.15s var(--ease), border-color 0.15s var(--ease), box-shadow 0.15s var(--ease), color 0.15s var(--ease);
}
.btn:hover { color: var(--text); background: var(--surface-sunken); }
.btn .icon { width: 16px; height: 16px; }
.btn--primary { background: var(--primary); border-color: var(--primary); color: var(--text-on-primary); box-shadow: 0 1px 2px rgba(30, 30, 30, 0.12); }
.btn--primary:hover { background: var(--primary-hover); border-color: var(--primary-hover); color: var(--text-on-primary); }
.btn--danger { background: var(--danger-solid); border-color: var(--danger-solid); color: #fff; }
.btn--danger:hover { background: var(--danger-hover); border-color: var(--danger-hover); color: #fff; }
[data-theme="dark"] .btn--danger:hover { background: var(--danger-solid); filter: brightness(1.1); }
.btn--danger-quiet { color: var(--danger); border-color: var(--danger); }
.btn--danger-quiet:hover { color: var(--danger); background: var(--danger-tint); }
.btn--small { min-height: var(--control-h-sm); padding: 0 12px; font-size: var(--text-sm); }
.btn--block { width: 100%; }
.btn[disabled], .btn[aria-busy="true"] { opacity: 0.6; cursor: progress; }
.link-button {
  padding: 0; background: none; border: 0; color: var(--link);
  font-size: var(--text-sm); text-decoration: underline; text-underline-offset: 2px; cursor: pointer;
}
.link-button:hover { color: var(--primary-hover); }
.button-row { display: flex; flex-wrap: wrap; gap: var(--space-2); }

/* Segmented navigation */
.segmented {
  display: inline-flex; max-width: 100%; overflow-x: auto; scrollbar-width: none;
  padding: 3px; gap: 2px; background: var(--surface-sunken); border-radius: var(--radius-md);
}
.segmented::-webkit-scrollbar { display: none; }
.segmented a {
  display: inline-flex; align-items: center; gap: 6px; min-height: calc(var(--control-h) - 6px);
  padding: 0 var(--space-3); border-radius: var(--radius-sm); color: var(--text-muted);
  font-size: var(--text-md); text-decoration: none; white-space: nowrap;
  transition: background-color 0.15s var(--ease), color 0.15s var(--ease);
}
.segmented a .icon { width: 16px; height: 16px; }
.segmented a:hover { color: var(--text); }
.segmented a[aria-current] { background: var(--surface); color: var(--text); box-shadow: 0 0 0 1px var(--border), var(--shadow-card); }
.segmented--small a { min-height: calc(var(--control-h-sm) - 6px); padding: 0 10px; font-size: var(--text-sm); }

/* Forms */
.field { margin: 0 0 var(--space-4); padding: 0; border: 0; min-width: 0; }
.field label, .field legend, .filters__field label {
  display: block; margin-bottom: 6px; padding: 0;
  font-size: var(--text-sm); line-height: 18px;
}
input[type="text"], input[type="search"], input[type="email"], input[type="password"],
input[type="date"], input[type="url"], select, textarea {
  width: 100%; min-height: var(--control-h); padding: 7px var(--control-px); background: var(--surface);
  border: 1px solid var(--border-control); border-radius: var(--radius-md); font-size: var(--text-md);
  transition: border-color 0.15s var(--ease), box-shadow 0.15s var(--ease);
}
/* Our own chevron, inset like the text, instead of the browser's arrow at the very edge. */
select {
  appearance: none; -webkit-appearance: none; padding-right: 38px; cursor: pointer;
  background-image: var(--chevron); background-repeat: no-repeat;
  background-position: right 12px center; background-size: 16px 16px;
  text-overflow: ellipsis;
}
select[multiple], select[size] { padding-right: var(--control-px); background-image: none; }
input[type="text"]:hover, input[type="search"]:hover, input[type="email"]:hover, input[type="password"]:hover,
input[type="date"]:hover, input[type="url"]:hover, select:hover, textarea:hover { border-color: var(--text-muted); }
input[type="text"]:focus-visible, input[type="search"]:focus-visible, input[type="email"]:focus-visible, input[type="password"]:focus-visible,
input[type="date"]:focus-visible, input[type="url"]:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-tint), 0 0 0 1px var(--primary);
  border-radius: var(--radius-md);
}
input[type="date"] { min-width: 0; }
textarea { display: block; resize: vertical; line-height: 1.45; }
::placeholder { color: var(--text-muted); opacity: 1; }
.field--error input, .field--error select, .field--error textarea { border-color: var(--danger); }
.field__help { margin-top: var(--space-1); font-size: var(--text-sm); color: var(--text-muted); }
.field__error { margin-top: var(--space-1); font-size: var(--text-sm); color: var(--danger); }
.field-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 var(--space-3); }
.field-row--3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.form-actions { display: flex; flex-wrap: wrap; gap: var(--space-2); margin-top: var(--space-2); }
.form-alert {
  margin-bottom: var(--space-4); padding: var(--space-3); border-radius: var(--radius-md);
  background: var(--danger-tint); color: var(--danger); font-size: var(--text-md);
}
.password-field { position: relative; }
.password-field input { padding-right: 64px; }
.password-field__toggle {
  position: absolute; top: 4px; right: 4px; bottom: 4px; min-width: 52px;
  background: none; border: 0; border-radius: var(--radius-sm); color: var(--link);
  font-size: var(--text-sm); cursor: pointer;
}
.password-field__toggle:hover { background: var(--primary-tint); }
.check-grid > div { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 2px var(--space-3); }
.check-grid label { display: flex; align-items: center; gap: var(--space-2); margin: 0; padding: 4px 0; font-size: var(--text-md); cursor: pointer; }
input[type="checkbox"], input[type="radio"] { width: 16px; height: 16px; margin: 0; flex: none; accent-color: var(--primary); }

/* Appearance choice on Settings */
.theme-choice { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--space-3); margin: 0; padding: 0; border: 0; min-width: 0; }
.theme-choice__option {
  display: grid; grid-template-columns: auto 1fr; align-items: center; gap: var(--space-2);
  padding: var(--space-3); border: 1px solid var(--border-strong); border-radius: var(--radius-md);
  font-size: var(--text-md); cursor: pointer; transition: border-color 0.15s var(--ease), background-color 0.15s var(--ease);
}
.theme-choice__option:hover { background: var(--surface-hover); }
.theme-choice__option:has(input:checked) { border-color: var(--primary); box-shadow: 0 0 0 1px var(--primary); background: var(--primary-tint); }
.theme-choice__swatch { grid-column: 1 / -1; grid-row: 1; height: 44px; border-radius: var(--radius-sm); border: 1px solid var(--border-strong); }
.theme-choice__option input { grid-row: 2; }
.theme-choice__option > span:last-child { grid-row: 2; }
/* Tiny previews: a page, a card and a blue accent line. */
.theme-choice__swatch--light {
  background:
    linear-gradient(#3663E4, #3663E4) 12px 28px / 32% 5px no-repeat,
    linear-gradient(#FFFFFF, #FFFFFF) 8px 8px / calc(100% - 16px) 30px no-repeat,
    #F7F5F1;
}
.theme-choice__swatch--dark {
  background:
    linear-gradient(#5A80F0, #5A80F0) 12px 28px / 32% 5px no-repeat,
    linear-gradient(#2C2B29, #2C2B29) 8px 8px / calc(100% - 16px) 30px no-repeat,
    #141413;
}
.theme-choice__swatch--system {
  background:
    linear-gradient(#3663E4, #3663E4) 12px 28px / 32% 5px no-repeat,
    linear-gradient(90deg, #FFFFFF 0 50%, #2C2B29 50%) 8px 8px / calc(100% - 16px) 30px no-repeat,
    linear-gradient(90deg, #F7F5F1 0 50%, #141413 50%);
}

/* Sign-in */
.auth-page {
  background:
    radial-gradient(circle at 15% 10%, var(--primary-tint), transparent 45%),
    radial-gradient(circle at 85% 90%, var(--surface-sunken), transparent 50%),
    var(--surface-page);
}
.auth { display: flex; align-items: center; justify-content: center; padding: var(--space-6) var(--space-4); }
.auth__card {
  width: 100%; max-width: 400px; padding: var(--space-6);
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow-raised);
}
.auth__logo { height: 56px; width: auto; margin-bottom: var(--space-5); }
.auth__card h1 { font-size: var(--text-xl); margin-bottom: var(--space-4); }
.auth__lead { margin: calc(var(--space-2) * -1) 0 var(--space-4); color: var(--text-muted); font-size: var(--text-md); }
.auth__note { margin-top: var(--space-4); font-size: var(--text-sm); color: var(--text-muted); }
.auth__signout { margin-top: var(--space-4); }
.auth-page .site-footer { border-top: 0; background: transparent; }

/* Messages */
.flash-stack { margin-bottom: var(--space-4); display: grid; gap: var(--space-2); }
.flash { padding: var(--space-2) var(--space-3); border-radius: var(--radius-md); font-size: var(--text-md); background: var(--surface-sunken); }
.flash--success { background: var(--status-done-bg); color: var(--status-done-text); }
.flash--error { background: var(--danger-tint); color: var(--danger); }
.toasts {
  position: fixed; left: 50%; bottom: var(--space-5); transform: translateX(-50%); z-index: 90;
  display: grid; gap: var(--space-2); width: max-content; max-width: min(92vw, 480px);
}
.toast {
  padding: 10px var(--space-4); background: var(--toast-bg); color: var(--toast-text);
  border-radius: var(--radius-md); font-size: var(--text-md); box-shadow: var(--shadow-menu);
  animation: toast-in 0.2s var(--ease);
}
.toast--error { background: var(--danger-solid); color: #fff; }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } }
.banner {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--space-2) var(--space-3);
  margin-bottom: var(--space-4); padding: var(--space-3); border-radius: var(--radius-md);
  background: var(--status-waiting_client-bg); color: var(--status-waiting_client-text); font-size: var(--text-md);
}

/* Cards and sections */
.card {
  container-type: inline-size;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
}
.card > :last-child { border-bottom-left-radius: inherit; border-bottom-right-radius: inherit; }
.card--pad { padding: var(--space-5); }
.card__head {
  display: flex; align-items: center; gap: var(--space-2);
  padding: var(--space-3) var(--space-4); border-bottom: 1px solid var(--border);
}
.card__head h2 { font-size: var(--text-base); }
.card__more { padding: var(--space-2) var(--space-4); border-top: 1px solid var(--border); font-size: var(--text-sm); color: var(--text-muted); }
.count {
  min-width: 22px; padding: 0 7px; background: var(--surface-sunken); border-radius: var(--radius-pill);
  color: var(--text-muted); font-size: var(--text-xs); line-height: 20px; text-align: center;
  font-variant-numeric: tabular-nums;
}
.count--alert { background: var(--danger-tint); color: var(--danger); }
.settings-section { margin-bottom: var(--space-4); }
form.card + .card { margin-top: var(--space-4); }
.settings-section h2 { margin-bottom: var(--space-2); }
.settings-section > p.muted { margin-bottom: var(--space-3); font-size: var(--text-md); }
.facts { display: grid; gap: var(--space-3); margin: var(--space-3) 0; }
.facts dt { font-size: var(--text-sm); color: var(--text-muted); }
.copy-row { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2); }
.copy-row code { padding: 4px 8px; background: var(--surface-sunken); border-radius: var(--radius-sm); font-size: var(--text-base); }

/* Empty, filtered and error states */
.empty-state {
  display: flex; flex-direction: column; align-items: center;
  padding: var(--space-7) var(--space-5); text-align: center;
  background: var(--surface); border: 1px dashed var(--border-strong); border-radius: var(--radius-lg);
}
.empty-state__icon {
  width: 44px; height: 44px; margin-bottom: var(--space-3); padding: 10px;
  border-radius: 50%; background: var(--primary-tint); color: var(--link);
}
.empty-state h2 { margin-bottom: var(--space-1); }
.empty-state p { max-width: 46ch; margin-bottom: var(--space-4); color: var(--text-muted); font-size: var(--text-md); }
.empty-state p:last-child { margin-bottom: 0; }
.empty-state--compact { padding: var(--space-4); }
.empty-inline { padding: var(--space-4); color: var(--text-muted); font-size: var(--text-md); }
.state-page { max-width: 480px; margin: var(--space-7) auto; text-align: center; }
.state-page img { margin: 0 auto var(--space-4); }
.state-page h1 { font-size: var(--text-xl); margin-bottom: var(--space-2); }
.state-page p { margin-bottom: var(--space-4); color: var(--text-muted); }

/* Chips */
.chip {
  display: inline-block; padding: 1px 8px; border-radius: var(--radius-pill);
  font-size: var(--text-xs); line-height: 18px; white-space: nowrap;
  background: var(--status-todo-bg); color: var(--status-todo-text);
}
.chip--neutral, .chip--todo, .chip--planned, .chip--sched-upcoming, .chip--project-completed { background: var(--status-todo-bg); color: var(--status-todo-text); }
.chip--in_progress, .chip--active, .chip--sched-started { background: var(--status-in_progress-bg); color: var(--status-in_progress-text); }
.chip--internal_review { background: var(--status-internal_review-bg); color: var(--status-internal_review-text); }
.chip--waiting_client, .chip--on_hold, .chip--sched-today { background: var(--status-waiting_client-bg); color: var(--status-waiting_client-text); }
.chip--done, .chip--completed { background: var(--status-done-bg); color: var(--status-done-text); }
.chip--urgent, .chip--sched-overdue { background: var(--danger-tint); color: var(--danger); }

.status-dot { display: inline-block; width: 8px; height: 8px; margin-right: 7px; border-radius: 50%; vertical-align: 1px; background: var(--status-todo-text); }
.status-dot--in_progress { background: var(--status-in_progress-text); }
.status-dot--internal_review { background: var(--status-internal_review-text); }
.status-dot--waiting_client { background: var(--status-waiting_client-text); }
.status-dot--done { background: var(--status-done-text); }

/* Avatars */
.avatar {
  display: inline-flex; align-items: center; justify-content: center; flex: none;
  width: 26px; height: 26px; border-radius: 50%;
  background: var(--surface-sunken); color: var(--text);
  font-size: 10.5px; font-weight: var(--weight-strong); letter-spacing: 0.02em;
}
.avatar--tone-0 { background: var(--tone-0-bg); color: var(--tone-0-text); }
.avatar--tone-1 { background: var(--tone-1-bg); color: var(--tone-1-text); }
.avatar--tone-2 { background: var(--tone-2-bg); color: var(--tone-2-text); }
.avatar--tone-3 { background: var(--tone-3-bg); color: var(--tone-3-text); }
.avatar--tone-4 { background: var(--tone-4-bg); color: var(--tone-4-text); }
.avatar--tone-5 { background: var(--tone-5-bg); color: var(--tone-5-text); }
.avatar--empty { background: none; border: 1px dashed var(--border-control); color: var(--text-muted); font-weight: var(--weight-regular); }
.avatar--inactive { opacity: 0.55; }
.avatar-stack { display: flex; flex-wrap: wrap; align-items: center; gap: 3px; }
/* Several people on one task: overlapping, with a ring so each stays distinct. */
.avatar-group { display: inline-flex; align-items: center; flex: none; }
.avatar-group .avatar { box-shadow: 0 0 0 2px var(--surface); }
.avatar-group .avatar + .avatar { margin-left: -3px; }
.avatar--more { background: var(--surface-sunken); color: var(--text-muted); font-size: 10px; }

/* Assignee picker in list rows */
.assign-picker { position: relative; flex: 1; min-width: 0; }
/* Lift the open menu's cell above the rows below it, which are raised too. */
.raised:has(.assign-picker[open]) { z-index: 20; }
.assign-picker summary {
  display: flex; align-items: center; gap: var(--space-2); min-height: var(--control-h-sm); padding: 2px 9px 2px 3px;
  border: 1px solid transparent; border-radius: var(--radius-md); cursor: pointer; list-style: none;
}
.assign-picker summary::-webkit-details-marker { display: none; }
.assign-picker summary:hover, .assign-picker[open] summary { border-color: var(--border-control); background: var(--surface); }
.assign-picker__names { flex: 1; min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; color: var(--text); }
.assign-picker__chevron { width: 14px; height: 14px; color: var(--text-muted); }
.assign-picker__panel {
  position: absolute; left: 0; top: calc(100% + 4px); z-index: 30; width: max(100%, 250px); max-height: 320px; overflow-y: auto;
  padding: var(--space-2); background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow-menu);
}
.assign-picker__title { padding: 2px var(--space-2) var(--space-1); font-size: var(--text-xs); color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.04em; }
.assign-picker__option {
  display: flex; align-items: center; gap: var(--space-2); padding: 6px var(--space-2);
  border-radius: var(--radius-md); font-size: var(--text-md); color: var(--text); cursor: pointer;
}
.assign-picker__option:hover { background: var(--surface-sunken); }
.assign-picker__option.is-saving { opacity: 0.6; }
.task-row__names { min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.assignee-field .field__help { margin-top: var(--space-2); }
/* The menu hangs from the whole row, not the button, so it never runs off the panel's edge. */
.assignee-chips { position: relative; display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2); min-height: var(--control-h); }
.assignee-chips__empty { font-size: var(--text-md); }
.assignee-chip {
  display: inline-flex; align-items: center; gap: 6px; height: var(--control-h-sm); padding: 0 4px 0 3px;
  background: var(--surface-sunken); border: 1px solid var(--border); border-radius: var(--radius-pill);
  font-size: var(--text-md);
}
.assignee-chip[hidden], .assignee-chips [hidden] { display: none; }
.assignee-chip__note { color: var(--text-muted); font-size: var(--text-sm); }
.assignee-chip__remove {
  display: inline-flex; align-items: center; justify-content: center; width: 24px; height: 24px; padding: 0;
  background: none; border: 0; border-radius: 50%; color: var(--text-muted); cursor: pointer;
}
.assignee-chip__remove .icon { width: 14px; height: 14px; }
.assignee-chip__remove:hover { background: var(--surface); color: var(--danger); }
.assignee-chip__remove:focus-visible { border-radius: 50%; }
.assignee-add { position: static; }
.assignee-add summary { list-style: none; }
.assignee-add summary::-webkit-details-marker { display: none; }
.assignee-add__button { border-style: dashed; border-radius: var(--radius-pill); color: var(--text-muted); gap: 4px; padding: 0 12px 0 9px; }
.assignee-add__button:hover, .assignee-add[open] .assignee-add__button { color: var(--text); border-style: solid; }
.assignee-add__panel {
  position: absolute; left: 0; top: calc(100% + 6px); z-index: 30; width: min(280px, 100%); max-height: 300px; overflow-y: auto;
  padding: var(--space-2); background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow-menu);
}
.assignee-add__panel .assign-picker__option { width: 100%; background: none; border: 0; text-align: left; font: inherit; }
.assignee-add__panel .assign-picker__option[disabled] { opacity: 0.5; cursor: not-allowed; }
.assignee-add__none { padding: var(--space-2); font-size: var(--text-sm); }

/* Progress */
.progress { display: inline-flex; align-items: center; gap: var(--space-2); font-size: var(--text-sm); color: var(--text-muted); }
.progress progress {
  appearance: none; -webkit-appearance: none; width: 80px; height: 6px;
  border: 0; border-radius: 3px; overflow: hidden; background: var(--surface-sunken);
}
.progress progress::-webkit-progress-bar { background: var(--surface-sunken); }
.progress progress::-webkit-progress-value { background: var(--primary); border-radius: 3px; }
.progress progress::-moz-progress-bar { background: var(--primary); border-radius: 3px; }
.progress__empty { font-size: var(--text-sm); color: var(--text-muted); }

/* Task rows */
.stretched::after { content: ""; position: absolute; inset: 0; }
.raised { position: relative; z-index: 1; }
.task-rows__head, .project-rows__head, .team-rows__head {
  font-size: var(--text-xs); color: var(--text-muted); letter-spacing: 0.04em; text-transform: uppercase;
}
.task-rows__head, .task-row {
  display: grid; grid-template-columns: minmax(0, 1fr) 210px 130px 130px;
  gap: var(--space-2) var(--space-3); align-items: center;
  padding: var(--space-2) var(--space-4);
}
@container (min-width: 1000px) {
  .task-rows__head, .task-row { grid-template-columns: minmax(0, 1fr) 240px 210px 180px; gap: var(--space-2) var(--space-4); }
}
.task-rows__head { padding-block: var(--space-2); border-bottom: 1px solid var(--border); }
.task-row { position: relative; min-height: 52px; border-top: 1px solid var(--border); font-size: var(--text-md); transition: background-color 0.12s var(--ease); }
.task-rows > .task-row:first-child, .task-rows__head + .task-row { border-top: 0; }
.task-row:hover { background: var(--surface-hover); }
.task-rows > .task-row:last-child { border-bottom-left-radius: inherit; border-bottom-right-radius: inherit; }
.task-row__main { min-width: 0; }
.task-link { color: var(--text); text-decoration: none; overflow-wrap: anywhere; }
.task-link:hover { color: var(--link); text-decoration: underline; }
.task-row__main .chip { margin-left: var(--space-1); }
.task-row__project { display: block; margin-top: 1px; color: var(--text-muted); font-size: var(--text-sm); overflow-wrap: anywhere; }
.task-row__checks { margin-left: var(--space-2); color: var(--text-muted); font-size: var(--text-sm); white-space: nowrap; }
.task-row__assignee { display: flex; align-items: center; gap: var(--space-2); min-width: 0; font-size: var(--text-sm); color: var(--text-muted); }
.task-row__assignee .quick { flex: 1; min-width: 0; }
.task-row__assignee .quick-select { color: var(--text); }
.task-dates { display: flex; flex-wrap: wrap; align-items: center; gap: 2px var(--space-2); }
.task-dates__range { font-size: var(--text-md); white-space: nowrap; }

/* @container keeps rows readable in narrow cards such as the Overview side column. */
@container (max-width: 700px) {
  .task-rows__head { display: none; }
  .task-row {
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas: "main status" "dates dates" "assignee assignee";
    gap: var(--space-1) var(--space-3);
    padding-block: var(--space-3);
  }
  .task-row__main { grid-area: main; }
  .task-row__status { grid-area: status; }
  .task-row__dates { grid-area: dates; }
  .task-row__assignee { grid-area: assignee; }
  .task-row .quick-select { max-width: 170px; }
}

/* Quick edits */
.quick { display: block; position: relative; }
.quick-select {
  min-height: var(--control-h-sm); padding: 0 30px 0 10px; font-size: var(--text-sm);
  border-color: var(--border-control); background-position: right 9px center; background-size: 14px 14px;
}
.quick-select--todo { background-color: var(--status-todo-bg); color: var(--status-todo-text); }
.quick-select--in_progress { background-color: var(--status-in_progress-bg); color: var(--status-in_progress-text); }
.quick-select--internal_review { background-color: var(--status-internal_review-bg); color: var(--status-internal_review-text); }
.quick-select--waiting_client { background-color: var(--status-waiting_client-bg); color: var(--status-waiting_client-text); }
.quick-select--done { background-color: var(--status-done-bg); color: var(--status-done-text); }
.quick-select option { background: var(--surface); color: var(--text); }
.quick.is-saving select { opacity: 0.55; }
.quick.is-saving::after {
  content: "Saving…"; position: absolute; left: 0; top: 100%; z-index: 2;
  padding: 0 4px; background: var(--surface); font-size: var(--text-xs); color: var(--text-muted);
}

/* Filters */
.filters {
  display: flex; flex-wrap: wrap; gap: var(--space-2) var(--space-3); margin-bottom: var(--space-4);
}
.filters__field { flex: 0 1 170px; min-width: 130px; }
.filters__field--grow { flex: 1 1 240px; }
.filters__field label { color: var(--text-muted); font-size: var(--text-xs); }
.filters--inline { flex: 1; justify-content: flex-end; margin: 0; }

/* Overview */
.stat-tiles { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--space-3); margin-bottom: var(--space-4); }
.stat-tile {
  display: grid; grid-template-columns: auto 1fr; grid-template-areas: "icon value" "icon label";
  align-items: center; column-gap: var(--space-3);
  padding: var(--space-4); background: var(--surface); color: var(--text); text-decoration: none;
  border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow-card);
  transition: box-shadow 0.15s var(--ease), transform 0.15s var(--ease), border-color 0.15s var(--ease);
}
.stat-tile:hover { color: var(--text); border-color: var(--border-strong); box-shadow: var(--shadow-raised); transform: translateY(-1px); }
.stat-tile__icon {
  grid-area: icon; display: inline-flex; align-items: center; justify-content: center;
  width: 40px; height: 40px; border-radius: var(--radius-md);
  background: var(--status-todo-bg); color: var(--status-todo-text);
}
.stat-tile__icon .icon { width: 20px; height: 20px; }
.stat-tile__value { grid-area: value; font-family: var(--font-heading); font-size: var(--text-3xl); line-height: 1; font-variant-numeric: tabular-nums; }
.stat-tile__label { grid-area: label; margin-top: 2px; font-size: var(--text-sm); color: var(--text-muted); }
.stat-tile--alert .stat-tile__icon { background: var(--danger-tint); color: var(--danger); }
.stat-tile--alert .stat-tile__value { color: var(--danger); }
.stat-tile--today .stat-tile__icon { background: var(--status-waiting_client-bg); color: var(--status-waiting_client-text); }
.stat-tile--week .stat-tile__icon { background: var(--status-in_progress-bg); color: var(--status-in_progress-text); }
.stat-tile--waiting .stat-tile__icon { background: var(--status-internal_review-bg); color: var(--status-internal_review-text); }
.overview { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); gap: var(--space-4); align-items: start; }
.overview__main, .overview__side { display: grid; gap: var(--space-4); min-width: 0; }
.mini-project { position: relative; display: grid; gap: 3px; padding: var(--space-3) var(--space-4); border-top: 1px solid var(--border); transition: background-color 0.12s var(--ease); }
.mini-project:first-child { border-top: 0; }
.mini-project:last-child { border-bottom-left-radius: var(--radius-lg); border-bottom-right-radius: var(--radius-lg); }
.mini-project:hover { background: var(--surface-hover); }
.mini-project a { color: var(--text); text-decoration: none; font-size: var(--text-md); }
.mini-project a:hover { color: var(--link); text-decoration: underline; }
.mini-project__client, .mini-project__deadline { font-size: var(--text-sm); color: var(--text-muted); }
.mini-project__deadline strong { color: var(--text); font-weight: var(--weight-strong); }

/* Project index */
.project-rows__head, .project-row {
  display: grid; grid-template-columns: minmax(0, 1fr) 110px 170px 110px 170px;
  gap: var(--space-2) var(--space-4); align-items: center; padding: var(--space-2) var(--space-4);
}
.project-rows__head { border-bottom: 1px solid var(--border); }
.project-row { position: relative; min-height: 60px; border-top: 1px solid var(--border); font-size: var(--text-md); transition: background-color 0.12s var(--ease); }
.project-rows__head + .project-row { border-top: 0; }
.project-row:hover { background: var(--surface-hover); }
.project-row:last-child { border-bottom-left-radius: var(--radius-lg); border-bottom-right-radius: var(--radius-lg); }
.project-row__main { min-width: 0; }
.project-row__main a { color: var(--text); text-decoration: none; overflow-wrap: anywhere; }
.project-row__main a:hover { color: var(--link); text-decoration: underline; }
.project-row__client { display: block; font-size: var(--text-sm); color: var(--text-muted); }
.project-rows--archived .project-rows__head, .project-rows--archived .project-row { grid-template-columns: minmax(0, 1fr) 170px 120px 170px 100px; }
.project-row__archived { font-size: var(--text-md); }
.project-row__action { display: flex; justify-content: flex-end; }
.project-row__client .chip { vertical-align: 1px; }
.list-bar { display: flex; flex-wrap: wrap; align-items: flex-end; gap: var(--space-3) var(--space-4); margin-bottom: var(--space-4); }
.segmented a .count { margin-left: 2px; background: var(--surface-sunken); }
.segmented a[aria-current] .count { background: var(--primary-tint); color: var(--link); }
@container (max-width: 760px) {
  .project-rows__head { display: none; }
  .project-row, .project-rows--archived .project-row { grid-template-columns: minmax(0, 1fr) auto; }
  .project-row__main { grid-column: 1; }
  .project-row__dates { grid-column: 1 / -1; }
}

/* Team */
.team-rows__head, .team-row {
  display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr) 80px 170px 150px;
  gap: var(--space-2) var(--space-4); align-items: center; padding: var(--space-2) var(--space-4);
}
.team-rows__head { border-bottom: 1px solid var(--border); }
.team-row { position: relative; min-height: 52px; border-top: 1px solid var(--border); font-size: var(--text-md); }
.team-rows__head + .team-row { border-top: 0; }
.team-row:hover { background: var(--surface-hover); }
.team-row:last-child { border-bottom-left-radius: var(--radius-lg); border-bottom-right-radius: var(--radius-lg); }
.team-row__name { display: flex; align-items: center; gap: var(--space-2); min-width: 0; }
.team-row__name a { color: var(--text); text-decoration: none; }
.team-row__name a:hover { color: var(--link); text-decoration: underline; }
.team-row--inactive { color: var(--text-muted); }
@container (max-width: 700px) {
  .team-rows__head { display: none; }
  .team-row { grid-template-columns: minmax(0, 1fr) auto; }
}

/* Project page */
.project-head {
  display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: var(--space-4) var(--space-5);
  margin-bottom: var(--space-4); padding: var(--space-5);
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow-card);
}
.project-head__title { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2); }
.project-head__desc { margin-top: var(--space-1); color: var(--text-muted); font-size: var(--text-md); max-width: 68ch; }
.project-head__actions { grid-column: 2; grid-row: 1; display: flex; flex-wrap: wrap; justify-content: flex-end; align-items: flex-start; gap: var(--space-2); }
.project-head__facts {
  grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: var(--space-3) var(--space-6);
  padding-top: var(--space-4); border-top: 1px solid var(--border);
}
.project-head__facts dt { font-size: var(--text-xs); color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.04em; }
.project-head__facts dd { display: flex; align-items: center; min-height: 28px; font-size: var(--text-md); }
.view-bar { display: flex; flex-wrap: wrap; align-items: flex-end; gap: var(--space-3) var(--space-4); margin-bottom: var(--space-3); }
.quick-add { display: flex; flex-wrap: wrap; gap: var(--space-2); margin-bottom: var(--space-4); }
.quick-add input[type="text"] { flex: 1 1 240px; }
.quick-add__error { flex-basis: 100%; margin-top: 0; }
.list-note { margin-bottom: var(--space-3); font-size: var(--text-md); }
.list-footer { margin-top: var(--space-3); font-size: var(--text-sm); }
.view-hint { margin-bottom: var(--space-3); font-size: var(--text-sm); color: var(--text-muted); }

/* Board */
.board {
  display: grid; grid-auto-flow: column; grid-auto-columns: minmax(264px, 1fr);
  gap: var(--space-3); overflow-x: auto; padding-bottom: var(--space-3); position: relative;
  scroll-snap-type: x proximity; scroll-padding-inline: var(--space-1);
}
.board-col {
  display: flex; flex-direction: column; min-height: 360px; scroll-snap-align: start;
  background: var(--surface-column); border: 1px solid var(--border); border-radius: var(--radius-lg);
  border-top: 3px solid var(--status-todo-text);
  transition: background-color 0.15s var(--ease), box-shadow 0.15s var(--ease);
}
.board-col--in_progress { border-top-color: var(--status-in_progress-text); }
.board-col--internal_review { border-top-color: var(--status-internal_review-text); }
.board-col--waiting_client { border-top-color: var(--status-waiting_client-text); }
.board-col--done { border-top-color: var(--status-done-text); }
.board-col.is-drop-target { background: var(--primary-tint); box-shadow: inset 0 0 0 2px var(--primary); }
.board-col__head { display: flex; align-items: center; justify-content: space-between; gap: var(--space-2); padding: var(--space-3) var(--space-3) var(--space-2); }
.board-col__head h2 { font-family: var(--font-body); font-size: var(--text-md); font-weight: var(--weight-strong); }
.board-col__head .count { background: var(--surface); box-shadow: 0 0 0 1px var(--border); }
.board-col__note { margin: calc(var(--space-1) * -1) var(--space-3) var(--space-2); font-size: var(--text-xs); color: var(--text-muted); }
.board-col__cards { flex: 1; display: grid; align-content: start; gap: var(--space-2); padding: var(--space-1) var(--space-2) var(--space-2); }
.board-col__cards:not(:has(.board-card))::before {
  content: "No tasks"; display: flex; align-items: center; justify-content: center; min-height: 72px;
  border: 1px dashed var(--border-strong); border-radius: var(--radius-md);
  color: var(--text-muted); font-size: var(--text-sm);
}
.board-col.is-drop-target .board-col__cards:not(:has(.board-card))::before { content: "Drop here"; border-color: var(--primary); color: var(--link); }
.board-card {
  position: relative; display: grid; gap: var(--space-2); padding: var(--space-3);
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-md);
  box-shadow: var(--shadow-card); cursor: pointer;
  transition: box-shadow 0.15s var(--ease), border-color 0.15s var(--ease), transform 0.15s var(--ease);
}
.board-card:hover { border-color: var(--border-strong); box-shadow: var(--shadow-raised); transform: translateY(-1px); }
.board-card[draggable="true"]:active { cursor: grabbing; }
.board-card.is-dragging { opacity: 0.45; transform: rotate(1.5deg); }
.board-card--urgent { box-shadow: inset 3px 0 0 var(--danger), var(--shadow-card); }
.board-card--urgent:hover { box-shadow: inset 3px 0 0 var(--danger), var(--shadow-raised); }
.board-card--done .board-card__title .task-link { color: var(--text-muted); }
.board-card__project { font-size: var(--text-xs); color: var(--text-muted); overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.board-card__title { font-family: var(--font-body); font-size: var(--text-md); line-height: 1.4; }
.board-card__title .task-link:hover { text-decoration: underline; }
.board-card__meta { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-1) var(--space-2); }
.board-card__meta .task-dates__range { font-size: var(--text-sm); color: var(--text-muted); }
.board-card__checks { display: inline-flex; align-items: center; gap: 4px; font-size: var(--text-sm); color: var(--text-muted); font-variant-numeric: tabular-nums; }
.board-card__checks .icon { width: 14px; height: 14px; }
.board-card__checks.is-complete { color: var(--status-done-text); }
.board-card__foot { display: flex; align-items: center; gap: var(--space-2); padding-top: var(--space-2); border-top: 1px solid var(--border); }
.board-card__foot .quick { flex: 1; min-width: 0; }

/* Timeline */
.timeline-bar { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2) var(--space-3); margin-bottom: var(--space-3); }
.timeline-bar__nav { display: flex; gap: var(--space-1); }
.timeline-bar__title { font-size: var(--text-base); }
.timeline {
  --name-width: 280px; --day-width: 72px;
  margin-bottom: var(--space-3); overflow-x: auto; position: relative; background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow-card);
}
.timeline--month { --day-width: 36px; }
.tl-grid {
  display: grid; grid-template-columns: var(--name-width) repeat(var(--days), minmax(var(--day-width), 1fr));
  min-width: calc(var(--name-width) + var(--days) * var(--day-width));
}
.tl-corner, .tl-name { position: sticky; left: 0; z-index: 3; background: var(--surface); border-right: 1px solid var(--border); }
.tl-corner { display: flex; align-items: flex-end; padding: var(--space-2) var(--space-3); border-bottom: 1px solid var(--border); font-size: var(--text-xs); color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.04em; }
.tl-day { display: grid; justify-items: center; padding: var(--space-1) 0; border-bottom: 1px solid var(--border); font-size: var(--text-xs); color: var(--text-muted); }
.tl-day__num { font-size: var(--text-sm); color: var(--text); }
.tl-day.is-weekend { background: var(--surface-hover); }
.tl-day.is-today .tl-day__name, .tl-day.is-today .tl-day__num { color: var(--link); font-weight: var(--weight-strong); }
.tl-day.is-today { box-shadow: inset 0 -2px 0 var(--primary); }
.tl-name { padding: var(--space-2) var(--space-3); border-bottom: 1px solid var(--border); font-size: var(--text-md); min-width: 0; }
.tl-name .task-link { display: block; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.tl-name__meta { display: block; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; font-size: var(--text-xs); color: var(--text-muted); }
.tl-track {
  grid-column: 2 / -1; display: grid; grid-template-columns: repeat(var(--days), minmax(var(--day-width), 1fr));
  align-items: center; border-bottom: 1px solid var(--border);
  background-image: linear-gradient(to right, var(--border) 1px, transparent 1px);
  background-size: calc(100% / var(--days)) 100%;
}
.tl-shade { grid-row: 1; align-self: stretch; background: var(--surface-sunken); opacity: 0.55; }
.tl-shade--today { background: var(--primary-tint); opacity: 1; }
.tl-bar {
  grid-row: 1; z-index: 1; display: flex; align-items: center; min-width: 0; height: 26px; margin-inline: 2px;
  padding: 0 8px; overflow: hidden; border-radius: var(--radius-sm); border: 1px solid transparent;
  font-size: var(--text-xs); text-decoration: none; white-space: nowrap;
}
.tl-bar:hover { filter: brightness(0.96); text-decoration: underline; }
[data-theme="dark"] .tl-bar:hover { filter: brightness(1.15); }
.tl-bar__text { overflow: hidden; text-overflow: ellipsis; }
.tl-bar--todo { background: var(--status-todo-bg); color: var(--status-todo-text); border-color: var(--status-todo-text); }
.tl-bar--in_progress { background: var(--status-in_progress-bg); color: var(--status-in_progress-text); border-color: var(--status-in_progress-text); }
.tl-bar--internal_review { background: var(--status-internal_review-bg); color: var(--status-internal_review-text); border-color: var(--status-internal_review-text); }
.tl-bar--waiting_client { background: var(--status-waiting_client-bg); color: var(--status-waiting_client-text); border-color: var(--status-waiting_client-text); }
.tl-bar--done { background: var(--status-done-bg); color: var(--status-done-text); border-color: var(--status-done-text); }
.tl-bar--overdue { border-color: var(--danger); border-width: 2px; }
.tl-bar--cont-before { margin-left: 0; border-left-style: dashed; border-top-left-radius: 0; border-bottom-left-radius: 0; }
.tl-bar--cont-after { margin-right: 0; border-right-style: dashed; border-top-right-radius: 0; border-bottom-right-radius: 0; }
.tl-marker { grid-row: 1; z-index: 1; display: flex; flex-direction: column; align-items: center; gap: 1px; color: var(--status-todo-text); font-size: 10px; line-height: 1; text-decoration: none; }
.tl-marker__diamond { width: 12px; height: 12px; transform: rotate(45deg); background: var(--status-todo-text); border-radius: 2px; margin-bottom: 2px; }
.tl-marker--in_progress .tl-marker__diamond { background: var(--status-in_progress-text); }
.tl-marker--internal_review .tl-marker__diamond { background: var(--status-internal_review-text); }
.tl-marker--waiting_client .tl-marker__diamond { background: var(--status-waiting_client-text); }
.tl-marker--done .tl-marker__diamond { background: var(--status-done-text); }
.timeline-group { margin-bottom: var(--space-3); }

/* Gantt */
.gantt-bar { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2) var(--space-4); margin-bottom: var(--space-3); }
.gantt-bar__actions { display: flex; gap: var(--space-2); margin-left: auto; }
.gantt-legend { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-1) var(--space-4); font-size: var(--text-sm); color: var(--text-muted); }
.gantt-legend li { display: inline-flex; align-items: center; gap: 6px; }
.gantt-legend__bar { width: 22px; height: 10px; border-radius: 3px; background: var(--status-in_progress-bg); box-shadow: inset 0 0 0 1px var(--status-in_progress-text); }
.gantt-legend__baseline { width: 22px; height: 5px; border-radius: 3px; background: var(--gantt-baseline); }
.gantt-legend__link { width: 22px; height: 0; border-top: 1.5px solid var(--text-muted); }
.gantt-legend__late { color: var(--danger); }
.gantt-legend .icon { width: 15px; height: 15px; }
.gantt {
  --table-width: 470px; --day-width: 30px; --row-height: 44px; --grid-step: 1;
  --gantt-baseline: rgba(30, 30, 30, 0.32); --gantt-weekend: rgba(30, 30, 30, 0.035);
  margin-bottom: var(--space-3); overflow: auto; max-height: 75vh; position: relative;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow-card);
}
[data-theme="dark"] .gantt { --gantt-baseline: rgba(255, 255, 255, 0.34); --gantt-weekend: rgba(255, 255, 255, 0.03); }
.gantt--week { --day-width: 12px; --grid-step: 7; }
.gantt--month { --day-width: 4px; --grid-step: 7; --gantt-weekend: transparent; }
.gantt--baseline { --table-width: 530px; }
.gantt__grid {
  position: relative; display: grid;
  grid-template-columns: var(--table-width) calc(var(--days) * var(--day-width));
  width: max-content; min-width: 100%;
}
.gantt__cols { display: grid; grid-template-columns: minmax(0, 1fr) 58px 58px 40px; gap: var(--space-2); align-items: center; }
.gantt--baseline .gantt__cols { grid-template-columns: minmax(0, 1fr) 58px 58px 40px 56px; }
.gantt__corner, .gantt__cell {
  position: sticky; left: 0; z-index: 5; padding: 0 var(--space-3) 0 var(--space-4);
  background: var(--surface); border-right: 1px solid var(--border-strong);
}
.gantt__corner {
  top: 0; z-index: 6; min-height: 52px; border-bottom: 1px solid var(--border);
  font-size: var(--text-xs); color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.04em;
}
.gantt__scale {
  position: sticky; top: 0; z-index: 4; display: grid;
  grid-template-columns: repeat(var(--days), var(--day-width)); grid-template-rows: 26px 26px;
  background: var(--surface); border-bottom: 1px solid var(--border);
}
.gantt--month .gantt__scale { grid-template-rows: 52px; }
.gantt__month, .gantt__minor {
  overflow: hidden; padding: 0 6px; white-space: nowrap; font-size: var(--text-xs); color: var(--text-muted);
  border-left: 1px solid var(--border); display: flex; align-items: center;
}
.gantt__month { grid-row: 1; color: var(--text); font-weight: var(--weight-strong); }
.gantt__minor { grid-row: 2; padding: 0; justify-content: center; }
.gantt--week .gantt__minor { justify-content: flex-start; padding-left: 4px; }
.gantt__cell { min-height: var(--row-height); border-bottom: 1px solid var(--border); font-size: var(--text-md); }
.gantt__title { display: flex; align-items: center; gap: 6px; min-width: 0; }
.gantt__title .task-link { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.gantt__flag { display: inline-flex; flex: none; color: var(--text-muted); }
.gantt__flag .icon { width: 15px; height: 15px; }
.gantt__flag--late { color: var(--danger); }
.gantt__date, .gantt__num, .gantt__slip { font-size: var(--text-sm); color: var(--text-muted); white-space: nowrap; font-variant-numeric: tabular-nums; }
.gantt__num { text-align: right; }
.gantt__slip.is-late { color: var(--danger); font-weight: var(--weight-strong); }
.gantt__slip.is-early { color: var(--status-done-text); }
.gantt__track {
  display: grid; grid-template-columns: repeat(var(--days), var(--day-width)); grid-template-rows: 30px 1fr;
  min-height: var(--row-height); padding-top: 4px; border-bottom: 1px solid var(--border);
  background-image:
    repeating-linear-gradient(to right, transparent 0 calc(5 * var(--day-width)), var(--gantt-weekend) calc(5 * var(--day-width)) calc(7 * var(--day-width))),
    repeating-linear-gradient(to right, var(--border) 0 1px, transparent 1px calc(var(--grid-step) * var(--day-width)));
}
.gantt__bar {
  position: relative; z-index: 3; grid-row: 1; align-self: center; display: flex; align-items: center;
  height: 24px; min-width: 6px; padding: 0 8px; overflow: hidden;
  border: 1px solid var(--status-todo-text); border-radius: var(--radius-sm);
  background: var(--status-todo-bg); color: var(--status-todo-text);
  font-size: var(--text-xs); text-decoration: none; white-space: nowrap; cursor: pointer;
}
.gantt__bar:hover { filter: brightness(0.96); }
[data-theme="dark"] .gantt__bar:hover { filter: brightness(1.15); }
.gantt__bar-text { overflow: hidden; text-overflow: ellipsis; }
.gantt__bar--in_progress { background: var(--status-in_progress-bg); color: var(--status-in_progress-text); border-color: var(--status-in_progress-text); }
.gantt__bar--internal_review { background: var(--status-internal_review-bg); color: var(--status-internal_review-text); border-color: var(--status-internal_review-text); }
.gantt__bar--waiting_client { background: var(--status-waiting_client-bg); color: var(--status-waiting_client-text); border-color: var(--status-waiting_client-text); }
.gantt__bar--done { background: var(--status-done-bg); color: var(--status-done-text); border-color: var(--status-done-text); }
.gantt__bar--late { box-shadow: 0 0 0 2px var(--danger); }
.gantt__bar--clip-before { border-left-style: dashed; border-top-left-radius: 0; border-bottom-left-radius: 0; }
.gantt__bar--clip-after { border-right-style: dashed; border-top-right-radius: 0; border-bottom-right-radius: 0; }
.gantt__bar--milestone, .gantt__bar--start { padding: 0; }
.gantt__bar--milestone {
  justify-self: center; width: 14px; min-width: 14px; height: 14px; border-radius: 2px; transform: rotate(45deg);
  background: var(--status-todo-text); border-color: transparent;
}
.gantt__bar--milestone.gantt__bar--in_progress { background: var(--status-in_progress-text); }
.gantt__bar--milestone.gantt__bar--internal_review { background: var(--status-internal_review-text); }
.gantt__bar--milestone.gantt__bar--waiting_client { background: var(--status-waiting_client-text); }
.gantt__bar--milestone.gantt__bar--done { background: var(--status-done-text); }
.gantt__bar--start { border-right-style: dashed; border-top-right-radius: 0; border-bottom-right-radius: 0; }
.gantt__baseline { grid-row: 2; align-self: start; height: 5px; margin-top: 1px; border-radius: 3px; background: var(--gantt-baseline); }
.gantt__baseline--point { justify-self: center; width: 7px; height: 7px; border-radius: 1px; transform: rotate(45deg); margin-top: 0; }
.gantt__today {
  position: absolute; top: 0; bottom: 0; z-index: 2; width: 2px; pointer-events: none;
  left: calc(var(--table-width) + (var(--col) - 0.5) * var(--day-width) - 1px);
  background: var(--primary); opacity: 0.55;
}
.gantt__links { position: absolute; top: 0; left: 0; z-index: 2; overflow: visible; pointer-events: none; }
.gantt__links path { fill: none; stroke: var(--text-muted); stroke-width: 1.5; }
.gantt__links path.is-late { stroke: var(--danger); stroke-dasharray: 4 3; }
.gantt__links .gantt__arrow { fill: var(--text-muted); stroke: none; }
.gantt__links .gantt__arrow--late { fill: var(--danger); stroke: none; }

/* Calendar */
.cal-bar { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2) var(--space-3); margin-bottom: var(--space-3); }
.cal {
  margin-bottom: var(--space-3); overflow: hidden;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow-card);
}
.cal__weekdays { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); border-bottom: 1px solid var(--border); }
.cal__weekdays span { padding: var(--space-2) var(--space-3); font-size: var(--text-xs); color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.04em; }
.cal-week {
  display: grid; grid-template-columns: repeat(7, minmax(0, 1fr));
  grid-template-rows: 30px repeat(var(--lanes), 26px) minmax(26px, 1fr);
  row-gap: 3px; min-height: 124px; border-bottom: 1px solid var(--border);
}
.cal-week:last-child { border-bottom: 0; }
.cal--week .cal-week { grid-template-rows: 34px repeat(var(--lanes), 34px) minmax(40px, 1fr); min-height: 420px; row-gap: 4px; }
.cal-day {
  grid-row: 1 / -1; display: flex; flex-direction: column; justify-content: space-between;
  min-width: 0; padding: 6px 8px; border-left: 1px solid var(--border); transition: background-color 0.12s var(--ease);
}
.cal-day:first-child { border-left: 0; }
.cal-day.is-weekend { background: var(--surface-hover); }
.cal-day.is-outside { background: var(--surface-sunken); }
.cal-day.is-outside .cal-day__num { color: var(--text-muted); opacity: 0.7; }
.cal-day.is-drop-target { background: var(--primary-tint); box-shadow: inset 0 0 0 2px var(--primary); }
.cal-day__num { align-self: flex-start; padding: 0 6px; border-radius: var(--radius-pill); font-size: var(--text-sm); line-height: 22px; font-variant-numeric: tabular-nums; }
.cal-day.is-today .cal-day__num { background: var(--primary); color: var(--text-on-primary); font-weight: var(--weight-strong); }
.cal-day__more { position: relative; z-index: 2; align-self: flex-start; font-size: var(--text-xs); }
.cal-item {
  position: relative; z-index: 1; display: flex; align-items: center; gap: 6px; min-width: 0; margin: 0 4px;
  padding: 0 8px; overflow: hidden; border-radius: var(--radius-sm); border-left: 3px solid var(--status-todo-text);
  background: var(--status-todo-bg); color: var(--status-todo-text);
  font-size: var(--text-xs); line-height: 1.2; text-decoration: none; white-space: nowrap; cursor: pointer;
}
.cal-item:hover { filter: brightness(0.96); color: var(--status-todo-text); }
[data-theme="dark"] .cal-item:hover { filter: brightness(1.15); }
.cal-item[draggable="true"]:active { cursor: grabbing; }
.cal-item.is-dragging { opacity: 0.45; }
.cal-item.is-saving { opacity: 0.6; }
.cal-item__text { overflow: hidden; text-overflow: ellipsis; }
.cal-item__mark { flex: none; width: 7px; height: 7px; border-radius: 1px; transform: rotate(45deg); background: currentColor; }
.cal-item__who { flex: none; margin-left: auto; padding: 0 5px; border-radius: var(--radius-pill); background: var(--surface); font-size: 10px; line-height: 16px; }
.cal--week .cal-item { font-size: var(--text-sm); }
.cal-item--in_progress { background: var(--status-in_progress-bg); color: var(--status-in_progress-text); border-left-color: var(--status-in_progress-text); }
.cal-item--internal_review { background: var(--status-internal_review-bg); color: var(--status-internal_review-text); border-left-color: var(--status-internal_review-text); }
.cal-item--waiting_client { background: var(--status-waiting_client-bg); color: var(--status-waiting_client-text); border-left-color: var(--status-waiting_client-text); }
.cal-item--done { background: var(--status-done-bg); color: var(--status-done-text); border-left-color: var(--status-done-text); opacity: 0.75; }
.cal-item--done .cal-item__text { text-decoration: line-through; }
.cal-item--overdue { box-shadow: inset 0 0 0 1px var(--danger); }
.cal-item--cont-before { margin-left: 0; border-left-style: dashed; border-top-left-radius: 0; border-bottom-left-radius: 0; }
.cal-item--cont-after { margin-right: 0; border-top-right-radius: 0; border-bottom-right-radius: 0; }
.cal-undated summary { cursor: pointer; list-style: none; }
.cal-undated summary::-webkit-details-marker { display: none; }
.cal-undated:not([open]) summary { border-bottom: 0; }

/* Dependencies in the task panel */
.panel-subhead { margin: var(--space-3) 0 var(--space-1); font-size: var(--text-xs); color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.04em; }
.panel-section > .panel-subhead:first-of-type { margin-top: 0; }
.dep-list { display: grid; gap: var(--space-2); margin-bottom: var(--space-2); }
.dep-list__item {
  display: flex; align-items: flex-start; justify-content: space-between; gap: var(--space-3);
  padding: var(--space-2) var(--space-3); border: 1px solid var(--border); border-radius: var(--radius-md); font-size: var(--text-md);
}
.dep-list__item.is-late { border-color: var(--danger); background: var(--danger-tint); }
.dep-list__main { display: grid; gap: 2px; min-width: 0; }
.dep-list__meta { font-size: var(--text-sm); color: var(--text-muted); }
.dep-list__warning { display: inline-flex; align-items: center; gap: 4px; font-size: var(--text-sm); color: var(--danger); }
.dep-list__warning .icon { width: 14px; height: 14px; }
#task-dependencies .inline-form select { flex: 1 1 220px; width: auto; }

/* Task panel */
.panel {
  position: fixed; inset: 0 0 0 auto; margin: 0; padding: 0;
  width: min(660px, 100vw); max-width: 100vw; height: 100vh; height: 100dvh; max-height: none;
  overflow-y: auto; background: var(--surface); color: var(--text);
  border: 0; border-left: 1px solid var(--border); box-shadow: var(--shadow-panel);
}
.panel[open] #panel-content { animation: panel-in 0.22s var(--ease); }
.panel::backdrop { background: var(--backdrop); }
@keyframes panel-in { from { transform: translateX(24px); opacity: 0.6; } }
#task-dialog #panel-content { padding: var(--space-5); }
.panel-loading { padding: var(--space-5) 0; color: var(--text-muted); }
.panel-head { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--space-3); margin-bottom: var(--space-4); }
.panel-head__text { min-width: 0; }
.panel-head h2 { font-size: var(--text-xl); overflow-wrap: anywhere; }
.panel-head__chips { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-1) var(--space-2); margin-top: var(--space-2); }
.panel-head__close { flex: none; }
.panel-section { margin-top: var(--space-5); padding-top: var(--space-4); border-top: 1px solid var(--border); }
.panel-section > h3 { margin-bottom: var(--space-2); }
.panel-section .empty-inline { padding: 0; margin-bottom: var(--space-2); }
.panel-activity summary { cursor: pointer; }
.panel-activity summary h3 { display: inline; }
.panel-activity .activity { margin-top: var(--space-3); }
.panel-activity .field__help { margin-top: var(--space-2); }
.panel-foot { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--space-2); margin-top: var(--space-5); padding-top: var(--space-4); border-top: 1px solid var(--border); }
.task-readonly { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.facts__wide { grid-column: 1 / -1; }
.checklist { display: grid; gap: var(--space-1); margin-bottom: var(--space-2); }
.checklist__item { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--space-3); padding: 2px 0; font-size: var(--text-md); }
.checklist__label { display: flex; align-items: flex-start; gap: var(--space-2); min-width: 0; overflow-wrap: anywhere; cursor: pointer; }
.checklist__label input { margin-top: 2px; }
.checklist__item.is-done .checklist__label span { color: var(--text-muted); text-decoration: line-through; }
.inline-form { display: flex; flex-wrap: wrap; gap: var(--space-2); }
.inline-form input[type="text"] { flex: 1 1 200px; width: auto; }
.inline-form .field__error { flex-basis: 100%; margin-top: 0; }
.link-list { display: grid; gap: var(--space-1); margin-bottom: var(--space-2); }
.link-list__item { display: flex; align-items: baseline; justify-content: space-between; gap: var(--space-3); font-size: var(--text-md); overflow-wrap: anywhere; }
.comments { display: grid; gap: var(--space-3); margin-bottom: var(--space-3); }
.comment__meta { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-1) var(--space-2); font-size: var(--text-sm); }
.comment__meta strong { font-weight: var(--weight-strong); }
.comment__meta time { color: var(--text-muted); }
.comment__body { margin-top: var(--space-1); padding-left: 34px; font-size: var(--text-md); }
.comment-form { display: grid; gap: var(--space-2); justify-items: start; }
.conflict { margin-bottom: var(--space-4); padding: var(--space-3); border: 1px solid var(--status-waiting_client-text); border-radius: var(--radius-md); background: var(--status-waiting_client-bg); font-size: var(--text-md); }
.conflict h3 { margin-bottom: var(--space-1); }
.conflict__table { width: 100%; margin: var(--space-3) 0; border-collapse: collapse; background: var(--surface); font-size: var(--text-sm); }
.conflict__table th, .conflict__table td { padding: var(--space-1) var(--space-2); border: 1px solid var(--border); text-align: left; vertical-align: top; font-weight: var(--weight-regular); }
.conflict__table thead th, .conflict__table tbody th { font-weight: var(--weight-strong); }
.task-page .panel-head__close { display: inline-flex; }

/* Activity */
.activity { display: grid; gap: var(--space-3); }
.activity__line { font-size: var(--text-md); }
.activity__line strong { font-weight: var(--weight-strong); }
.activity__time { display: block; font-size: var(--text-xs); color: var(--text-muted); }
.activity__changes { margin-top: 2px; font-size: var(--text-sm); color: var(--text-muted); }

/* Small screens */
@media (max-width: 1000px) {
  .stat-tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 900px) {
  .overview { grid-template-columns: minmax(0, 1fr); }
  .filters--inline { flex-basis: 100%; justify-content: flex-start; }
  .project-head { grid-template-columns: minmax(0, 1fr); }
  .project-head__actions { grid-column: 1; grid-row: auto; justify-content: flex-start; }
}
@media (max-width: 640px) {
  .page { padding: var(--space-4) var(--space-4) var(--space-6); }
  .page-head { margin-bottom: var(--space-4); }
  .topbar__inner { flex-wrap: wrap; gap: var(--space-1) var(--space-3); padding: var(--space-2) var(--space-4); }
  .mainnav { order: 3; flex-basis: 100%; }
  .mainnav a { flex: 1; justify-content: center; padding-inline: var(--space-2); }
  .account-menu__name { display: none; }
  .site-footer__inner { padding: var(--space-4); }
  .field-row, .field-row--3 { grid-template-columns: minmax(0, 1fr); }
  .filters { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--space-2); }
  .filters__field { min-width: 0; }
  .filters__field--grow { grid-column: 1 / -1; }
  .filters select { padding-inline: 6px; }
  .kbd { display: none; }
  .stat-tile { padding: var(--space-3); column-gap: var(--space-2); }
  .stat-tile__icon { width: 34px; height: 34px; }
  .stat-tile__value { font-size: var(--text-2xl); }
  .project-head { padding: var(--space-4); }
  .board { grid-auto-columns: minmax(78vw, 1fr); }
  #task-dialog #panel-content { padding: var(--space-4); }
  .timeline { --name-width: 150px; --day-width: 56px; }
  .segmented--icons a .icon { display: none; }
  .segmented--icons a { padding-inline: 10px; }
  .gantt, .gantt--baseline { --table-width: 168px; }
  .gantt__cols, .gantt--baseline .gantt__cols { grid-template-columns: minmax(0, 1fr); }
  .gantt__cols > :not(:first-child) { display: none; }
  .gantt-bar__actions { margin-left: 0; }
  .cal-day { padding: 4px; }
  .cal-day__num { padding: 0 4px; font-size: var(--text-xs); }
  .cal-item { margin: 0 1px; padding: 0 4px; font-size: 10.5px; }
  .cal__weekdays span { padding: var(--space-2) 4px; text-align: center; }
  .timeline--month { --day-width: 32px; }
  .auth__card { padding: var(--space-5); }
  .theme-choice { grid-template-columns: minmax(0, 1fr); }
  /* iOS zooms into inputs below 16px. */
  input[type="text"], input[type="search"], input[type="email"], input[type="password"],
  input[type="date"], input[type="url"], select, textarea { font-size: 16px; }
  .quick-add .btn { flex: 1 1 100%; }
}
@media (hover: none) {
  .kbd { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
  .board-card:hover, .stat-tile:hover { transform: none; }
}
