/*! Pulse — a Neuraft product
 *  Copyright (c) 2026 Neuraft Studio (Hossein Zandinejad). All rights reserved.
 *  Bundled typefaces are SIL OFL 1.1 — see NOTICE.md.
 */
/* ============================================================
   Pulse — a Neuraft product
   ------------------------------------------------------------
   Built on the Neuraft brand system: same typefaces, same radii
   and offset shadow, same obsidian/cream duality.

   One deliberate difference — Neuraft leads with amber and uses
   indigo as support. This app flips that: indigo carries actions
   and identity, amber is reserved for "needs your attention".
   Amber can't be read as text on a light ground anyway (2.2:1
   against cream), so giving it a signalling job rather than a
   structural one suits both the brand and the eye.

   Every text colour below was measured against its background.
   Body text clears 4.5:1, large text and chips clear 3:1.

   No inline styles anywhere — the Content-Security-Policy is
   style-src 'self', so bar widths come from utility classes.
   ============================================================ */

/* ---------------- typefaces (self-hosted, SIL OFL) ---------------- */

@font-face {
  font-family: "Space Grotesk";
  src: url("/static/fonts/SpaceGrotesk-Variable.woff2") format("woff2-variations");
  font-weight: 300 700; font-style: normal; font-display: swap;
}
@font-face {
  font-family: "IBM Plex Sans";
  src: url("/static/fonts/IBMPlexSans-Regular.woff2") format("woff2");
  font-weight: 400; font-style: normal; font-display: swap;
}
@font-face {
  font-family: "IBM Plex Sans";
  src: url("/static/fonts/IBMPlexSans-Medium.woff2") format("woff2");
  font-weight: 500; font-style: normal; font-display: swap;
}
@font-face {
  font-family: "IBM Plex Sans";
  src: url("/static/fonts/IBMPlexSans-SemiBold.woff2") format("woff2");
  font-weight: 600; font-style: normal; font-display: swap;
}
@font-face {
  font-family: "IBM Plex Sans";
  src: url("/static/fonts/IBMPlexSans-Bold.woff2") format("woff2");
  font-weight: 700; font-style: normal; font-display: swap;
}
@font-face {
  font-family: "IBM Plex Mono";
  src: url("/static/fonts/IBMPlexMono-Regular.woff2") format("woff2");
  font-weight: 400; font-style: normal; font-display: swap;
}
@font-face {
  font-family: "IBM Plex Mono";
  src: url("/static/fonts/IBMPlexMono-Medium.woff2") format("woff2");
  font-weight: 500; font-style: normal; font-display: swap;
}

/* ---------------- tokens ---------------- */

:root {
  /* Neuraft core palette */
  --obsidian:     #141822;
  --graphite:     #1C2030;
  --slate-border: #2D3142;
  --warm-white:   #E8E6E1;
  --silver:       #8B8580;
  --cream:        #F5EFE4;
  --paper:        #FFFFFF;
  --sand-border:  #D4CFC4;
  --ink:          #1A1E2A;
  --stone:        #6B6660;
  --amber:        #E8A33D;
  --amber-deep:   #C4861A;
  --indigo:       #6C5CE7;
  --indigo-deep:  #5B4BD6;

  --font-display: "Space Grotesk", "Segoe UI", system-ui, sans-serif;
  --font-body:    "IBM Plex Sans", "Segoe UI", system-ui, sans-serif;
  --font-mono:    "IBM Plex Mono", ui-monospace, "Cascadia Mono", monospace;

  /* Motion. Short and decelerating — things arrive and settle, they don't
     bounce. Nothing here runs longer than half a second. */
  --ease-out:    cubic-bezier(.22, 1, .36, 1);
  --ease-in-out: cubic-bezier(.65, 0, .35, 1);
  --t-fast: 140ms;
  --t-base: 220ms;
  --t-slow: 420ms;

  --radius:    14px;
  --radius-sm:  8px;
  --offset:     6px;

  /* Light theme — cream ground, paper surfaces */
  --bg:         var(--cream);
  --surface:    var(--paper);
  --surface-2:  #FAF7F1;
  --line:       var(--sand-border);
  --line-soft:  #E6E1D6;
  --text:       var(--ink);
  --text-soft:  #3D4354;
  --text-muted: var(--stone);

  --accent:      var(--indigo);
  --accent-text: var(--indigo-deep);        /* 5.4:1 on cream */
  --accent-bg:   #EDEAFC;
  --personal: #0E7C7B;   --personal-bg: #E3F4F2;   --personal-text: #0B6362;   --on-personal: #FFFFFF;

  --ok:      #3D6E1F;      --ok-bg:      #E6F0DC;   /* 5.2:1 */
  --attn:    #964219;      --attn-bg:    #FBEBDA;   /* 5.9:1 */
  --alert:   #A12C7B;      --alert-bg:   #FAE4F1;   /* 5.8:1 */
  --neutral: var(--stone); --neutral-bg: #EFEBE2;

  --shadow-offset: var(--offset) var(--offset) 0 var(--ink);
  --sidebar: 250px;
  color-scheme: light;
}

/* Dark tokens apply when the OS asks for dark (unless the person picked light),
   or when the person explicitly picked dark. The choice lives in data-theme on
   <html>, set by theme-init.js before first paint so there's no flash. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg:         var(--obsidian);
    --surface:    var(--graphite);
    --surface-2:  #232839;
    --line:       var(--slate-border);
    --line-soft:  #252A38;
    --text:       var(--warm-white);
    --text-soft:  #C7C4BE;
    --text-muted: var(--silver);

    --accent:      #8477F0;
    --accent-text: #9B8DF5;                 /* 5.8:1 on graphite */
    --accent-bg:   #262445;
    --personal: #4FD1C5; --personal-bg: #133634;   --personal-text: #7BE3D8;   --on-personal: #0B2423;

    --ok:      #7FC45C;       --ok-bg:      #1B2E1A;   /* 7.7:1 */
    --attn:    var(--amber);  --attn-bg:    #332614;   /* 7.5:1 */
    --alert:   #E884BE;       --alert-bg:   #33203A;   /* 6.5:1 */
    --neutral: var(--silver); --neutral-bg: #242938;

    --shadow-offset: var(--offset) var(--offset) 0 #0A0D14;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
    --bg:         var(--obsidian);
    --surface:    var(--graphite);
    --surface-2:  #232839;
    --line:       var(--slate-border);
    --line-soft:  #252A38;
    --text:       var(--warm-white);
    --text-soft:  #C7C4BE;
    --text-muted: var(--silver);

    --accent:      #8477F0;
    --accent-text: #9B8DF5;                 /* 5.8:1 on graphite */
    --accent-bg:   #262445;
    --personal: #4FD1C5; --personal-bg: #133634;   --personal-text: #7BE3D8;   --on-personal: #0B2423;

    --ok:      #7FC45C;       --ok-bg:      #1B2E1A;   /* 7.7:1 */
    --attn:    var(--amber);  --attn-bg:    #332614;   /* 7.5:1 */
    --alert:   #E884BE;       --alert-bg:   #33203A;   /* 6.5:1 */
    --neutral: var(--silver); --neutral-bg: #242938;

    --shadow-offset: var(--offset) var(--offset) 0 #0A0D14;
    color-scheme: dark;
}

* { box-sizing: border-box; }

html, body {
  margin: 0; padding: 0;
  background: var(--bg); color: var(--text);
  font-family: var(--font-body);
  font-size: 15px; line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent-text); text-decoration: none; }
a:hover { text-decoration: underline; }

h1, h2, h3, .brand, .metric-value, .login-brand, .board-head, .empty-title {
  font-family: var(--font-display);
}
h1 { font-size: 1.7rem; font-weight: 700; letter-spacing: -.025em; margin: 0 0 .2rem; }
h2 { font-size: 1.1rem; font-weight: 600; letter-spacing: -.012em; margin: 0 0 .75rem; }
h3 { font-size: .94rem; font-weight: 600; margin: 0 0 .4rem; }
p  { margin: 0 0 .7rem; }

.muted { color: var(--text-muted); font-size: .84rem; }
.small { font-size: .8rem; }
.num, td.num, .metric-value, .mono {
  font-family: var(--font-mono); font-variant-numeric: tabular-nums;
}
.right { text-align: right; }
.spacer { height: 20px; }
.nowrap { white-space: nowrap; }

/* ---------------- layout ---------------- */

.shell { display: flex; min-height: 100vh; }

.sidebar {
  width: var(--sidebar); flex: 0 0 var(--sidebar);
  background: var(--surface); border-right: 1px solid var(--line);
  padding: 22px 15px; display: flex; flex-direction: column; gap: 3px;
  position: sticky; top: 0; height: 100vh; overflow-y: auto;
}

.brand {
  font-size: 1.05rem; font-weight: 700; letter-spacing: -.02em;
  color: var(--text); padding: 0 8px; display: flex; align-items: center; gap: 9px;
}
.brand-mark { width: 27px; height: 27px; flex: 0 0 27px; display: block; }
.brand-mark img { width: 100%; height: 100%; display: block; }

/* The brand book asks for clear space around the studio symbol equal to
   a quarter of its height, and no use below 16px. Both respected here. */
.studio-mark { width: 18px; height: 18px; flex: 0 0 18px; display: block; }
.studio-line { display: flex; align-items: center; gap: 8px; }

.app-footer {
  margin-top: 40px; padding-top: 18px; border-top: 1px solid var(--line-soft);
  color: var(--text-muted); font-family: var(--font-mono);
  font-size: .68rem; letter-spacing: .05em;
  display: flex; justify-content: space-between; gap: 14px; flex-wrap: wrap;
}
.app-footer a { color: var(--text-muted); }
.brand-sub {
  padding: 4px 8px 16px; color: var(--text-muted);
  font-family: var(--font-mono); font-size: .67rem;
  letter-spacing: .09em; text-transform: uppercase;
}

.nav a {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px; border-radius: var(--radius-sm);
  color: var(--text-soft); font-weight: 500; font-size: .89rem;
}
.nav a:hover { background: var(--surface-2); color: var(--text); text-decoration: none; }
.nav a.active { background: var(--accent-bg); color: var(--accent-text); font-weight: 600; }
.nav .nav-icon { width: 17px; text-align: center; font-size: .95rem; }

.sidebar-foot { margin-top: auto; padding-top: 15px; border-top: 1px solid var(--line); }
.studio {
  padding: 13px 8px 0; color: var(--text-muted);
  font-family: var(--font-mono); font-size: .63rem;
  letter-spacing: .08em; text-transform: uppercase; line-height: 1.7;
}
.studio a { color: var(--text-muted); }

.who { display: flex; align-items: center; gap: 10px; padding: 4px 8px 12px; }
.avatar {
  width: 34px; height: 34px; border-radius: 50%; flex: 0 0 34px;
  background: var(--accent-bg); color: var(--accent-text);
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-display); font-weight: 700; font-size: .78rem;
}
.who-name { font-weight: 600; font-size: .86rem; line-height: 1.3; }
.who-role { color: var(--text-muted); font-size: .73rem; }

.main { flex: 1; min-width: 0; padding: 28px 32px 64px; max-width: 1520px; }
.page-head { margin-bottom: 22px; }

/* ---------------- cards ---------------- */

.card {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 17px 19px;
}
.card + .card { margin-top: 15px; }
.card-tight { padding: 13px 15px; }

.grid { display: grid; gap: 15px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (max-width: 1150px) { .grid-4 { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 900px)  { .grid-2, .grid-3 { grid-template-columns: 1fr; } }

/* ---------------- metrics ---------------- */

.metric {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 16px 18px;
  border-left: 3px solid var(--line);
}
.metric-label {
  color: var(--text-muted); font-family: var(--font-mono);
  font-size: .66rem; font-weight: 500;
  text-transform: uppercase; letter-spacing: .09em;
}
.metric-value { font-size: 1.95rem; font-weight: 700; letter-spacing: -.035em;
                line-height: 1.12; margin-top: 5px; }
.metric-note { font-size: .74rem; color: var(--text-muted); margin-top: 1px; }
.metric.alert { border-left-color: var(--alert); }
.metric.alert .metric-value { color: var(--alert); }
.metric.attn { border-left-color: var(--attn); }
.metric.good { border-left-color: var(--ok); }

/* ---------------- chips ---------------- */

.chip {
  display: inline-block; padding: 2px 9px; border-radius: 999px;
  font-family: var(--font-mono); font-size: .69rem; font-weight: 500;
  line-height: 1.7; white-space: nowrap; margin-right: 4px;
  background: var(--neutral-bg); color: var(--neutral);
}
.chip-red   { background: var(--alert-bg);   color: var(--alert); }
.chip-amber { background: var(--attn-bg);    color: var(--attn); }
.chip-green { background: var(--ok-bg);      color: var(--ok); }
.chip-blue  { background: var(--accent-bg);  color: var(--accent-text); }
.chip-grey  { background: var(--neutral-bg); color: var(--neutral); }

/* ---------------- list items ---------------- */

.item {
  border: 1px solid var(--line); border-radius: var(--radius-sm);
  padding: 12px 14px; margin-bottom: 9px; background: var(--surface);
  transition: border-color .14s ease, transform .14s ease;
}
.item:hover { border-color: var(--accent); transform: translateY(-1px); }
.item-title { font-weight: 600; font-size: .91rem; line-height: 1.4; }
.item-title a { color: var(--text); }
.item-title a:hover { color: var(--accent-text); }
.item-meta { color: var(--text-muted); font-size: .76rem; margin: 3px 0 7px; }

/* ---------------- progress ---------------- */

.bar { height: 5px; border-radius: 999px; background: var(--neutral-bg);
       overflow: hidden; margin: 8px 0 2px; }
.bar-fill { height: 100%; border-radius: 999px; background: var(--accent);
            display: block; }
.bar-fill.done { background: var(--ok); }

.w0{width:0}.w5{width:5%}.w10{width:10%}.w15{width:15%}.w20{width:20%}
.w25{width:25%}.w30{width:30%}.w35{width:35%}.w40{width:40%}.w45{width:45%}
.w50{width:50%}.w55{width:55%}.w60{width:60%}.w65{width:65%}.w70{width:70%}
.w75{width:75%}.w80{width:80%}.w85{width:85%}.w90{width:90%}.w95{width:95%}
.w100{width:100%}

/* ---------------- tables ---------------- */

.table-wrap { overflow-x: auto; border: 1px solid var(--line);
              border-radius: var(--radius); background: var(--surface); }
table { width: 100%; border-collapse: collapse; font-size: .86rem; }
th {
  text-align: left; font-family: var(--font-mono); font-weight: 500;
  font-size: .67rem; color: var(--text-muted);
  text-transform: uppercase; letter-spacing: .08em;
  padding: 12px 14px; border-bottom: 1px solid var(--line);
  white-space: nowrap; background: var(--surface-2);
}
td { padding: 12px 14px; border-bottom: 1px solid var(--line-soft); vertical-align: middle; }
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover { background: var(--surface-2); }
td.num { text-align: right; }

/* ---------------- forms ---------------- */

label { display: block; font-size: .79rem; font-weight: 500;
        color: var(--text-soft); margin-bottom: 5px; }
.field { margin-bottom: 14px; }
.field-row   { display: grid; gap: 13px; grid-template-columns: repeat(2, minmax(0,1fr)); }
.field-row-3 { display: grid; gap: 13px; grid-template-columns: repeat(3, minmax(0,1fr)); }
@media (max-width: 820px) { .field-row, .field-row-3 { grid-template-columns: 1fr; } }

input[type=text], input[type=password], input[type=email], input[type=date],
input[type=number], input[type=search], select, textarea {
  width: 100%; padding: 9px 12px; font-family: var(--font-body); font-size: .88rem;
  color: var(--text); background: var(--surface);
  border: 1px solid var(--line); border-radius: var(--radius-sm);
  outline: none; transition: border-color .12s ease, box-shadow .12s ease;
}
input:focus, select:focus, textarea:focus {
  border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-bg);
}
input[readonly], select:disabled, textarea[readonly] {
  background: var(--surface-2); color: var(--text-muted);
}
textarea { min-height: 96px; resize: vertical; line-height: 1.55; }
select[multiple] { min-height: 136px; padding: 6px; }
select[multiple] option { padding: 5px 8px; border-radius: 5px; }
input[type=range] { width: 100%; accent-color: var(--accent); }

.check { display: flex; align-items: center; gap: 9px; font-size: .85rem;
         color: var(--text-soft); margin-bottom: 10px; }
.check input { width: 16px; height: 16px; accent-color: var(--accent); margin: 0;
               flex: 0 0 16px; }
.check label { margin: 0; font-weight: 400; }

.hint { font-size: .76rem; color: var(--text-muted); margin-top: 4px; }

/* ---------------- buttons ---------------- */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  padding: 9px 16px; font-family: var(--font-body); font-size: .85rem; font-weight: 600;
  border-radius: var(--radius-sm); border: 1px solid var(--line);
  background: var(--surface); color: var(--text); cursor: pointer;
  transition: background .12s ease, border-color .12s ease, transform .1s ease;
}
.btn:hover { background: var(--surface-2); border-color: var(--text-muted);
             text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--accent-solid); border-color: var(--accent-solid); color: #fff; }
.btn-primary:hover { background: var(--indigo-deep); border-color: var(--indigo-deep);
                     color: #fff; }
.btn-danger { color: var(--alert); border-color: var(--alert); background: transparent; }
.btn-danger:hover { background: var(--alert-bg); border-color: var(--alert); }
.btn-sm { padding: 5px 11px; font-size: .78rem; }
.btn-block { width: 100%; }
.btn-row { display: flex; gap: 9px; flex-wrap: wrap; align-items: center; }

/* ---------------- filters ---------------- */

.filters {
  display: grid; gap: 11px; align-items: end;
  grid-template-columns: repeat(6, minmax(0,1fr));
  margin-bottom: 18px; padding: 15px 17px;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius);
}
@media (max-width: 1250px) { .filters { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 720px)  { .filters { grid-template-columns: 1fr 1fr; } }
.filters .field { margin: 0; }

/* ---------------- board ---------------- */

.board { display: grid; gap: 14px; grid-template-columns: repeat(4, minmax(0,1fr)); }
@media (max-width: 1150px) { .board { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 720px)  { .board { grid-template-columns: 1fr; } }
.board-col { background: var(--surface); border: 1px solid var(--line);
             border-radius: var(--radius); padding: 13px; }
.board-head { display: flex; justify-content: space-between; align-items: center;
              font-weight: 600; font-size: .85rem; margin-bottom: 12px;
              padding-bottom: 9px; border-bottom: 1px solid var(--line); }
.board-count { color: var(--text-muted); font-family: var(--font-mono);
               font-size: .72rem; }

/* ---------------- flash ---------------- */

.flash {
  padding: 12px 16px; border-radius: var(--radius-sm); margin-bottom: 18px;
  font-size: .87rem; font-weight: 500; border: 1px solid;
}
.flash-success { background: var(--ok-bg);    color: var(--ok);    border-color: var(--ok); }
.flash-error   { background: var(--alert-bg); color: var(--alert); border-color: var(--alert); }
.flash-warning { background: var(--attn-bg);  color: var(--attn);  border-color: var(--attn); }
.flash-info    { background: var(--accent-bg); color: var(--accent-text);
                 border-color: var(--accent); }

.empty { text-align: center; padding: 46px 20px; color: var(--text-muted); }
.empty-title { font-weight: 600; color: var(--text); margin-bottom: 5px; font-size: 1rem; }

/* ---------------- collapsible sections ---------------- */

details.section { margin-bottom: 14px; }
details.section > summary {
  display: inline-flex; align-items: center; gap: 8px; cursor: pointer; list-style: none;
  padding: 7px 12px 7px 10px; border-radius: 999px; font-family: var(--font-display);
  font-weight: 600; font-size: .86rem; color: var(--text-soft);
}
details.section > summary::-webkit-details-marker { display: none; }
details.section > summary::before {
  content: ""; width: 7px; height: 7px; border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor; transform: rotate(-45deg);
  transition: transform var(--t-base) var(--ease-out); margin-right: 2px;
}
details.section[open] > summary::before { transform: rotate(45deg); }
details.section > summary:hover { color: var(--text); background: var(--surface-2); }
details.section > .section-body {
  margin-top: 8px; padding: 18px; background: var(--surface);
  border: 1px solid var(--line-soft); border-radius: var(--radius);
}

.section-title { display: flex; justify-content: space-between; align-items: flex-end;
                 gap: 14px; margin-bottom: 13px; flex-wrap: wrap; }

/* ---------------- login ---------------- */

.login-wrap { min-height: 100vh; display: flex; align-items: center;
              justify-content: center; padding: 24px; background: var(--bg); }
.login-card {
  width: 100%; max-width: 400px; background: var(--surface);
  border: 1px solid var(--ink); border-radius: var(--radius);
  padding: 34px 32px; box-shadow: var(--shadow-offset);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .login-card { border-color: var(--slate-border); }
}
:root[data-theme="dark"] .login-card { border-color: var(--slate-border); }
.login-lockup { display: flex; align-items: center; gap: 14px; margin-bottom: 4px; }
.lockup-symbol { width: 54px; height: 54px; flex: 0 0 54px; display: block;
                 border-radius: 13px; }
.login-brand { font-size: 1.42rem; font-weight: 700; letter-spacing: -.035em;
               line-height: 1.15; }
.lockup-tagline { font-family: var(--font-mono); font-size: .68rem;
                  letter-spacing: .28em; text-transform: uppercase;
                  color: var(--text-muted); margin-top: 3px; }
.login-studio { margin-top: 26px; padding-top: 16px;
                display: flex; align-items: center; justify-content: center; gap: 8px;
                border-top: 1px solid var(--line-soft);
                font-family: var(--font-mono); font-size: .65rem;
                letter-spacing: .07em; text-transform: uppercase;
                color: var(--text-muted); text-align: center; }
.login-studio a { color: var(--text-muted); }

/* ---------------- tabs ---------------- */

.tabs { display: flex; gap: 7px; margin-bottom: 18px; flex-wrap: wrap; }
.tabs a { padding: 6px 15px; border-radius: 999px; font-size: .84rem;
          font-weight: 600; color: var(--text-soft); border: 1px solid var(--line);
          background: var(--surface); }
.tabs a.active { background: var(--accent-solid); border-color: var(--accent-solid); color: #fff; }
.tabs a:hover { text-decoration: none; border-color: var(--accent); }

/* ---------------- notes ---------------- */

.note-card { border-left: 3px solid var(--line); }
.note-default { border-left-color: var(--neutral); }
.note-amber   { border-left-color: var(--amber); }
.note-green   { border-left-color: var(--ok); }
.note-blue    { border-left-color: var(--accent); }
.note-red     { border-left-color: var(--alert); }
.note-body { white-space: pre-wrap; font-size: .88rem; color: var(--text-soft);
             line-height: 1.6; }

/* ---------------- accessibility ---------------- */

.skip { position: absolute; left: -9999px; }
.skip:focus { left: 10px; top: 10px; background: var(--surface); padding: 9px 13px;
              border-radius: var(--radius-sm); z-index: 99;
              border: 1px solid var(--accent); }

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


@media print {
  .sidebar, .filters, .btn, details.section { display: none; }
  .main { padding: 0; }
}

/* ============================================================
   MOTION
   ------------------------------------------------------------
   Every animation here answers a question the person has:
   "did the page load?", "how far along is this?", "did my
   change land?", "where did that card go?". Nothing loops,
   nothing runs longer than half a second, and all of it
   switches off under prefers-reduced-motion.
   ============================================================ */

@keyframes rise-in {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: none; }
}
@keyframes fade-in   { from { opacity: 0; } to { opacity: 1; } }
@keyframes bar-fill  { from { transform: scaleX(0); } to { transform: scaleX(1); } }
@keyframes pop-in {
  0%   { opacity: 0; transform: scale(.4); }
  70%  { opacity: 1; transform: scale(1.08); }
  100% { opacity: 1; transform: scale(1); }
}
@keyframes draw      { to { stroke-dashoffset: 0; } }
@keyframes slide-in-right {
  from { opacity: 0; transform: translateX(24px); }
  to   { opacity: 1; transform: none; }
}
@keyframes shrink    { from { transform: scaleX(1); } to { transform: scaleX(0); } }
@keyframes spin      { to { transform: rotate(360deg); } }
@keyframes landed {
  0%   { box-shadow: 0 0 0 0 var(--accent-bg); border-color: var(--accent); }
  100% { box-shadow: 0 0 0 10px transparent; }
}
@keyframes shake {
  20%, 60% { transform: translateX(-5px); }
  40%, 80% { transform: translateX(5px); }
}

/* ---- page entrance: content rises in, a beat apart ---- */
.page-head, .main > .flash                { animation: rise-in var(--t-slow) var(--ease-out) both; }
.main > .grid, .main > .card,
.main > .table-wrap, .main > .filters,
.main > .tabs, .main > .board,
.main > details.section, .main > h2       { animation: rise-in var(--t-slow) var(--ease-out) both; }

.main > :nth-child(2) { animation-delay: 40ms; }
.main > :nth-child(3) { animation-delay: 80ms; }
.main > :nth-child(4) { animation-delay: 120ms; }
.main > :nth-child(5) { animation-delay: 160ms; }
.main > :nth-child(6) { animation-delay: 200ms; }
.main > :nth-child(n+7) { animation-delay: 240ms; }

.grid > .metric { animation: rise-in var(--t-slow) var(--ease-out) both; }
.grid > .metric:nth-child(2) { animation-delay: 60ms; }
.grid > .metric:nth-child(3) { animation-delay: 120ms; }
.grid > .metric:nth-child(4) { animation-delay: 180ms; }

.board-col { animation: rise-in var(--t-slow) var(--ease-out) both; }
.board-col:nth-child(2) { animation-delay: 60ms; }
.board-col:nth-child(3) { animation-delay: 120ms; }
.board-col:nth-child(4) { animation-delay: 180ms; }

/* ---- progress fills from the left, whatever its width class ---- */
.bar-fill {
  transform-origin: left center;
  animation: bar-fill 700ms var(--ease-out) 150ms both;
}

/* ---- disclosure sections open with a short slide ---- */
details.section[open] > .section-body { animation: rise-in var(--t-base) var(--ease-out); }
details.section > summary { transition: background var(--t-fast) ease; }
details.section > summary:hover { background: var(--surface-2); }

/* ---- hover and press feedback ---- */
.metric, .card, .board-col {
  transition: border-color var(--t-base) ease, transform var(--t-base) var(--ease-out),
              box-shadow var(--t-base) ease;
}
.metric:hover { transform: translateY(-2px); border-color: var(--text-muted); }

.item {
  transition: border-color var(--t-fast) ease, transform var(--t-base) var(--ease-out),
              box-shadow var(--t-base) ease;
}
.item:hover { box-shadow: 0 6px 18px -10px rgba(26,30,42,.35); }

.nav a {
  position: relative;
  transition: background var(--t-fast) ease, color var(--t-fast) ease,
              padding-left var(--t-base) var(--ease-out);
}
.nav a:hover { padding-left: 13px; }
.nav a.active::before {
  content: ""; position: absolute; left: -15px; top: 7px; bottom: 7px;
  width: 3px; border-radius: 0 3px 3px 0; background: var(--accent);
  animation: fade-in var(--t-base) ease both;
}

.btn { transition: background var(--t-fast) ease, border-color var(--t-fast) ease,
                   transform 90ms ease, box-shadow var(--t-fast) ease; }
.btn-primary:hover { box-shadow: 0 4px 14px -6px var(--accent); }
.btn:active { transform: translateY(1px) scale(.985); }

tbody tr { transition: background var(--t-fast) ease; }
tr[data-href] { cursor: pointer; }

/* ---- a form that's submitting: button shows a spinner and locks ---- */
.btn.is-busy { pointer-events: none; opacity: .75; }
.btn.is-busy::before {
  content: ""; width: 12px; height: 12px; flex: 0 0 12px;
  border: 2px solid currentColor; border-right-color: transparent;
  border-radius: 50%; animation: spin .7s linear infinite;
}

/* ---- rejected input shakes once ---- */
.flash-error { animation: rise-in var(--t-slow) var(--ease-out) both,
                         shake 360ms ease 380ms; }

/* ---- the P draws itself on the sign-in screen ---- */
.lockup-symbol-live { width: 54px; height: 54px; flex: 0 0 54px; display: block; }
.lockup-symbol-live .w-plate { animation: pop-in 480ms var(--ease-out) both; transform-origin: 60px 60px; }
.lockup-symbol-live .w-stroke {
  stroke-dasharray: 60; stroke-dashoffset: 60;
  animation: draw 520ms var(--ease-out) forwards;
}
.lockup-symbol-live .w-s1 { animation-delay: 260ms; }
.lockup-symbol-live .w-s2 { animation-delay: 360ms; }
.lockup-symbol-live .w-s3 { animation-delay: 460ms; }
.lockup-symbol-live .w-s4 { animation-delay: 540ms; }
.lockup-symbol-live .w-node { transform-box: fill-box; transform-origin: center;
                              animation: pop-in 380ms var(--ease-out) both; }
.lockup-symbol-live .w-n1 { animation-delay: 200ms; }
.lockup-symbol-live .w-n2 { animation-delay: 300ms; }
.lockup-symbol-live .w-n3 { animation-delay: 400ms; }
.lockup-symbol-live .w-n4 { animation-delay: 480ms; }
.lockup-symbol-live .w-hub { animation-delay: 760ms; }
.login-card { animation: rise-in 520ms var(--ease-out) both; }

/* ============================================================
   TOASTS
   ============================================================ */

.toasts {
  position: fixed; right: 20px; bottom: 20px; z-index: 60;
  display: flex; flex-direction: column; gap: 10px; align-items: flex-end;
  pointer-events: none;
}
.toast {
  pointer-events: auto; position: relative; overflow: hidden;
  display: flex; align-items: flex-start; gap: 12px;
  min-width: 260px; max-width: 380px; padding: 13px 14px 15px 16px;
  background: var(--surface); color: var(--text);
  border: 1px solid var(--line); border-left: 3px solid var(--accent);
  border-radius: var(--radius-sm); font-size: .86rem; font-weight: 500;
  box-shadow: 0 12px 32px -14px rgba(20,24,34,.45);
  animation: slide-in-right var(--t-slow) var(--ease-out) both;
}
.toast-success { border-left-color: var(--ok); }
.toast-error   { border-left-color: var(--alert); }
.toast-warning { border-left-color: var(--attn); }
.toast-body { flex: 1; line-height: 1.45; }
.toast-close {
  background: none; border: 0; color: var(--text-muted); cursor: pointer;
  font-size: 1.05rem; line-height: 1; padding: 0 2px;
}
.toast-close:hover { color: var(--text); }
.toast-timer {
  position: absolute; left: 0; right: 0; bottom: 0; height: 2px;
  background: var(--accent); opacity: .5; transform-origin: left center;
  animation: shrink linear forwards;
}
.toast-success .toast-timer { background: var(--ok); }
.toast-error   .toast-timer { background: var(--alert); }
.toast.is-leaving { opacity: 0; transform: translateX(24px);
                    transition: opacity var(--t-base) ease, transform var(--t-base) ease; }
.toast:hover .toast-timer { animation-play-state: paused; }

/* ============================================================
   DIALOGS  (confirm, keyboard shortcuts)
   ============================================================ */

dialog.wm-dialog {
  width: min(440px, calc(100vw - 32px)); padding: 0;
  background: var(--surface); color: var(--text);
  border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: 0 24px 60px -20px rgba(20,24,34,.55);
}
dialog.wm-dialog[open] { animation: rise-in var(--t-base) var(--ease-out); }
dialog.wm-dialog::backdrop { background: rgba(20,24,34,.45); backdrop-filter: blur(2px);
                             animation: fade-in var(--t-base) ease; }
.dialog-body { padding: 22px 24px 8px; }
.dialog-body h2 { margin-bottom: .5rem; }
.dialog-foot { padding: 14px 24px 20px; display: flex; gap: 10px; justify-content: flex-end; }

.shortcut-list { display: grid; grid-template-columns: auto 1fr; gap: 9px 16px;
                 align-items: center; margin: 6px 0 12px; font-size: .86rem; }
kbd {
  font-family: var(--font-mono); font-size: .74rem; font-weight: 500;
  padding: 2px 7px; border-radius: 5px; white-space: nowrap;
  background: var(--surface-2); border: 1px solid var(--line);
  border-bottom-width: 2px; color: var(--text);
}

/* ============================================================
   BOARD DRAG AND DROP
   ============================================================ */

.board .item[draggable="true"] { cursor: grab; }
.board .item[draggable="true"]:active { cursor: grabbing; }
.board .item.is-dragging { opacity: .45; transform: rotate(1.5deg) scale(.98); }
.board-col.is-over {
  border-color: var(--accent); background: var(--accent-bg);
  box-shadow: inset 0 0 0 1px var(--accent);
}
.board-col .drop-hint {
  display: none; border: 1.5px dashed var(--accent); border-radius: var(--radius-sm);
  padding: 12px; text-align: center; font-size: .78rem; color: var(--accent-text);
  margin-bottom: 9px;
}
.board-col.is-over .drop-hint { display: block; animation: fade-in var(--t-fast) ease; }
.item.just-landed { animation: landed 900ms var(--ease-out); }
.board-hint { font-size: .78rem; color: var(--text-muted); margin: -8px 0 14px; }

/* ============================================================
   TOP BAR  (theme toggle, shortcuts) and MOBILE NAVIGATION
   ============================================================ */

.topbar { display: flex; justify-content: flex-end; align-items: center; gap: 8px;
          margin: -6px 0 14px; }
.icon-btn {
  width: 36px; height: 36px; display: inline-flex; align-items: center;
  justify-content: center; border-radius: var(--radius-sm);
  border: 1px solid var(--line); background: var(--surface); color: var(--text-soft);
  cursor: pointer; font-size: .95rem; font-family: var(--font-mono);
  transition: background var(--t-fast) ease, border-color var(--t-fast) ease,
              transform var(--t-base) var(--ease-out);
}
.icon-btn:hover { background: var(--surface-2); border-color: var(--text-muted); color: var(--text); }
.icon-btn:active { transform: scale(.94); }
.theme-toggle .theme-icon { display: inline-block;
                            transition: transform var(--t-slow) var(--ease-out); }
.theme-toggle:hover .theme-icon { transform: rotate(25deg); }

.menu-btn { display: none; }
.scrim { display: none; }

@media (max-width: 860px) {
  .shell { display: block; }
  .main  { padding: 18px 16px 48px; }

  .sidebar {
    position: fixed; z-index: 50; left: 0; top: 0; bottom: 0; height: 100%;
    transform: translateX(-100%); visibility: hidden;
    transition: transform var(--t-slow) var(--ease-out), visibility 0s linear var(--t-slow);
    box-shadow: 0 0 40px -10px rgba(20,24,34,.5);
  }
  body.nav-open .sidebar {
    transform: none; visibility: visible;
    transition: transform var(--t-slow) var(--ease-out), visibility 0s;
  }
  .scrim {
    display: block; position: fixed; inset: 0; z-index: 40;
    background: rgba(20,24,34,.45); opacity: 0; pointer-events: none;
    transition: opacity var(--t-base) ease;
  }
  body.nav-open .scrim { opacity: 1; pointer-events: auto; }
  body.nav-open { overflow: hidden; }

  .topbar { justify-content: space-between; position: sticky; top: 0; z-index: 30;
            margin: -18px -16px 16px; padding: 10px 16px;
            background: var(--bg); border-bottom: 1px solid var(--line); }
  .menu-btn { display: inline-flex; }
  .topbar-brand { display: flex; align-items: center; gap: 8px; margin-right: auto;
                  font-family: var(--font-display); font-weight: 700; }
  .topbar-brand img { width: 24px; height: 24px; }

  h1 { font-size: 1.4rem; }
  .metric-value { font-size: 1.6rem; }
  .toasts { left: 12px; right: 12px; bottom: 12px; align-items: stretch; }
  .toast { max-width: none; }
}
@media (min-width: 861px) { .topbar-brand { display: none; } }

/* ============================================================
   REDUCED MOTION
   ------------------------------------------------------------
   Everything still appears and works; it just doesn't move.
   Durations collapse to near-zero rather than none, so any
   script waiting on animationend still gets its event.
   ============================================================ */

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 1ms !important;
    animation-delay: 0ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 1ms !important;
    scroll-behavior: auto !important;
  }
  .btn.is-busy::before { animation: none !important; }
  .lockup-symbol-live .w-stroke { stroke-dashoffset: 0; }
}


/* =====================================================================
   v4 — Pulse
   ===================================================================== */

/* ---------------- brand ---------------- */
.brand { text-decoration: none; color: var(--text); }
.brand:hover { text-decoration: none; }
.brand-word { font-family: var(--font-display); font-weight: 700; letter-spacing: .14em; font-size: 1.02rem; }
.brand-gap { height: 14px; }
.login-brand { letter-spacing: .12em; }
.lockup-symbol-live .w-long { stroke-dasharray: 110; stroke-dashoffset: 110; }

.org-badge {
  display: flex; align-items: center; gap: 10px; margin: 14px 0 18px;
  padding: 9px 11px; border-radius: var(--radius-sm); background: var(--surface-2);
}
.org-badge img { width: 30px; height: 30px; object-fit: contain; flex: 0 0 30px; }
.org-name { font-weight: 600; font-size: .86rem; line-height: 1.2; }
.org-local { font-size: .8rem; color: var(--text-muted); line-height: 1.3; }
.topbar-org { height: 22px; width: auto; margin-left: 6px; }

/* ---------------- header: title left, small actions right ---------------- */
/* The header row sits above everything after it, so its "New …" dropdown can
   never be painted over by the cards below (they animate in, and an animating
   element is its own layer). */
.head-wrap {
  position: relative; z-index: 20; display: flex; justify-content: space-between; align-items: flex-start;
  gap: 16px; flex-wrap: wrap; margin-bottom: 20px;
}
.head-wrap > .page-head { margin-bottom: 0; }
.head-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

.btn-ghost { background: transparent; border-color: transparent; color: var(--text-soft); }
.btn-ghost:hover { background: var(--surface-2); color: var(--text); }

/* The "New …" control: a compact pill, not a full-width bar. */
details.create { position: static; }
details.create > summary { list-style: none; cursor: pointer; }
details.create > summary::-webkit-details-marker { display: none; }
.create-btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 8px 16px 8px 9px; border-radius: 999px;
  background: var(--accent-solid); color: #fff; font-weight: 600; font-size: .86rem;
  font-family: var(--font-display); letter-spacing: .01em;
  box-shadow: 0 6px 16px -8px var(--accent);
  transition: transform var(--t-fast) ease, box-shadow var(--t-fast) ease, background var(--t-fast) ease;
  user-select: none;
}
.create-btn:hover { background: var(--indigo-deep); transform: translateY(-1px);
                    box-shadow: 0 10px 22px -10px var(--accent); }
.create-btn:active { transform: translateY(0); }
.create-plus {
  display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 50%;
  background: rgba(255,255,255,.2); font-size: 1rem; line-height: 1; font-weight: 500;
  transition: transform var(--t-base) var(--ease-out);
}
details.create[open] > .create-btn .create-plus { transform: rotate(45deg); }
details.create[open] > .create-btn { background: var(--indigo-deep); }

.create-panel {
  position: absolute; z-index: 40; right: 0; top: calc(100% + 10px);
  width: min(720px, 100%); padding: 18px 20px 20px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: 0 24px 60px -24px rgba(20, 24, 34, .35);
  animation: rise-in var(--t-base) var(--ease-out);
}
.create-panel-head h2 { margin: 0 0 12px; font-size: 1rem; }
.create-panel h3 { font-size: .9rem; margin: 16px 0 8px; }
.create-mini { position: relative; }
.create-mini > .create-panel { width: min(360px, 88vw); top: calc(100% + 6px); }
.create-panel-left { right: auto; left: 0; }

.icon-btn-sm { width: 26px; height: 26px; font-size: .95rem; }
.seg { display: inline-flex; background: var(--surface-2); border-radius: 999px; padding: 3px; }
.seg a { padding: 5px 12px; border-radius: 999px; font-size: .82rem; color: var(--text-soft);
         text-decoration: none; font-weight: 500; }
.seg a.active { background: var(--surface); color: var(--text); box-shadow: 0 1px 3px rgba(0,0,0,.08); }
.inline-form { display: inline-flex; }
.inline-form select { min-width: 150px; }
.rule { border: 0; border-top: 1px solid var(--line-soft); margin: 18px 0 12px; }
.count-pill { display: inline-grid; place-items: center; min-width: 22px; height: 22px; padding: 0 7px;
              border-radius: 999px; background: var(--amber); color: #2A1E08; font-size: .75rem;
              font-family: var(--font-mono); margin-left: 6px; vertical-align: 2px; }
.small { font-size: .8rem; }

/* A calmer surface overall: softer card edges. */
.card { border-color: var(--line-soft); }

/* ---------------- sidebar badge ---------------- */
.nav a { position: relative; }
.nav-label { flex: 1; }
.nav-badge { min-width: 19px; height: 19px; padding: 0 6px; border-radius: 999px; background: var(--amber);
             color: #2A1E08; font-size: .7rem; font-family: var(--font-mono); font-weight: 600;
             display: inline-grid; place-items: center; }
.nav-badge[hidden] { display: none; }

/* ---------------- login / public ---------------- */
.login-intro { margin: 4px 0 18px; }
.login-org { display: flex; align-items: center; gap: 12px; padding: 12px 14px; margin: 4px 0 18px;
             border-radius: var(--radius-sm); background: var(--surface-2); }
.login-org-mark { width: 44px; height: 44px; object-fit: contain; }
.login-org-wordmark { height: 40px; width: auto; max-width: 60%; object-fit: contain; }
.login-org-name { font-weight: 600; }
.login-alt { display: flex; align-items: center; justify-content: center; gap: 8px; margin-top: 16px; }
.login-card-wide { max-width: 560px; }
.public-title { font-size: 1.35rem; margin: 6px 0 6px; }
.signup-form { margin-top: 14px; }
.hp { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }
.done-mark { width: 54px; height: 54px; border-radius: 50%; background: var(--accent-bg); color: var(--accent-text);
             display: grid; place-items: center; font-size: 1.6rem; margin: 10px 0; animation: pop-in 420ms var(--ease-out) both; }
.creds { max-width: 620px; }
.creds-row { display: flex; justify-content: space-between; align-items: center; gap: 12px;
             padding: 10px 0; border-bottom: 1px solid var(--line-soft); }
.creds-row code { font-size: .95rem; word-break: break-all; cursor: copy; }
.creds-row code.token { font-size: .8rem; }

/* ---------------- approval queue / platform ---------------- */
.request-row { display: grid; grid-template-columns: 1fr auto auto; gap: 12px; align-items: center;
               padding: 12px 0; border-top: 1px solid var(--line-soft); }
.request-approve { display: flex; gap: 6px; flex-wrap: wrap; }
.request-approve input, .request-approve select { width: auto; min-width: 110px; padding: 6px 9px; }
.request-msg { font-size: .85rem; color: var(--text-soft); margin-top: 4px; white-space: pre-wrap; }
@media (max-width: 860px) { .request-row { grid-template-columns: 1fr; } }
.org-list { display: grid; gap: 12px; }
.org-card-head { display: flex; align-items: center; gap: 12px; margin-bottom: 8px; }
.org-card-logo { width: 40px; height: 40px; object-fit: contain; border-radius: 10px; }
.org-card-blank { display: grid; place-items: center; background: var(--accent-bg); color: var(--accent-text);
                  font-weight: 700; font-family: var(--font-display); }
.org-card-names { flex: 1; }
.org-card.is-muted { opacity: .6; }
.org-card details.section { margin: 0; }

/* ---------------- calendar ---------------- */
.cal { border: 1px solid var(--line-soft); border-radius: var(--radius); overflow: hidden; background: var(--surface); }
.cal-row { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); }
.cal-row + .cal-row { border-top: 1px solid var(--line-soft); }
.cal-dow { padding: 9px 10px; font-size: .74rem; font-weight: 600; color: var(--text-muted);
           text-transform: uppercase; letter-spacing: .06em; background: var(--surface-2); }
.cal-cell { min-height: 108px; padding: 7px 7px 9px; border-left: 1px solid var(--line-soft);
            display: flex; flex-direction: column; gap: 3px; position: relative; min-width: 0; }
.cal-row > :first-child { border-left: 0; }
.cal-pad { background: var(--surface-2); opacity: .5; }
.cal-weekend { background: color-mix(in srgb, var(--surface-2) 45%, transparent); }
.cal-date { display: flex; justify-content: space-between; align-items: center; margin-bottom: 2px; }
.cal-num { font-family: var(--font-mono); font-size: .82rem; color: var(--text-soft);
           width: 25px; height: 25px; display: grid; place-items: center; border-radius: 50%; }
.cal-cell.is-today .cal-num { background: var(--accent-solid); color: #fff; font-weight: 600; }
.cal-add { opacity: 0; width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center;
           color: var(--accent-text); text-decoration: none; font-weight: 600;
           transition: opacity var(--t-fast) ease, background var(--t-fast) ease; }
.cal-cell:hover .cal-add, .cal-add:focus-visible { opacity: 1; }
.cal-add:hover { background: var(--accent-bg); text-decoration: none; }
.cal-item { display: block; font-size: .76rem; line-height: 1.35; padding: 3px 7px; border-radius: 6px;
            white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-decoration: none;
            background: var(--surface-2); color: var(--text); border-left: 3px solid var(--neutral); }
.cal-item:hover { text-decoration: none; filter: brightness(.97); }
.cal-red   { border-left-color: var(--alert); }
.cal-amber { border-left-color: var(--attn); }
.cal-green { border-left-color: var(--ok); }
.cal-grey  { border-left-color: var(--accent); }
.cal-project { border-left-color: var(--indigo); background: var(--accent-bg); color: var(--accent-text); }
.cal-item.is-closed { color: var(--text-muted); text-decoration: line-through; }
.cal-more { font-size: .72rem; color: var(--text-muted); padding-left: 4px; }
.cal-dot { display: none; }
.agenda-title { margin: 26px 0 10px; font-size: 1.05rem; }
.agenda { display: grid; gap: 8px; }
.agenda-day { display: grid; grid-template-columns: 120px 1fr; gap: 14px; padding: 12px 14px;
              background: var(--surface); border: 1px solid var(--line-soft); border-radius: var(--radius); }
.agenda-day.is-today { border-color: var(--accent); }
.agenda-num { font-family: var(--font-display); font-weight: 600; display: block; }
.agenda-items { display: grid; gap: 4px; }
.agenda-item { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
@media (max-width: 760px) {
  .cal-cell { min-height: 58px; padding: 4px; }
  .cal-item, .cal-more, .cal-add { display: none; }
  .cal-dot { display: grid; place-items: center; align-self: center; min-width: 20px; height: 20px;
             border-radius: 999px; background: var(--accent-bg); color: var(--accent-text);
             font-size: .7rem; font-family: var(--font-mono); margin-top: auto; }
  .cal-dow { padding: 7px 4px; text-align: center; font-size: .66rem; }
  .cal-date { justify-content: center; }
  .agenda-day { grid-template-columns: 1fr; gap: 6px; }
}

/* ---------------- Jalali date picker ---------------- */
.date-field { position: relative; display: block; }
.date-field input { padding-right: 42px; }
.date-btn { position: absolute; right: 4px; top: 50%; transform: translateY(-50%); width: 34px; height: 34px;
            border: 0; border-radius: 8px; background: none; color: var(--text-muted); cursor: pointer;
            display: grid; place-items: center; }
.date-btn:hover { background: var(--surface-2); color: var(--accent-text); }
.date-btn svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; }
.date-line { display: block; min-height: 1.2em; margin-top: 4px; font-size: .78rem; color: var(--text-muted); }
.date-line.is-bad { color: var(--alert); }
.jp { position: absolute; z-index: 80; width: 300px; padding: 12px; background: var(--surface);
      border: 1px solid var(--line); border-radius: var(--radius); box-shadow: 0 22px 50px -20px rgba(0,0,0,.4);
      animation: fade-in var(--t-fast) ease; }
.jp-head { display: flex; align-items: center; justify-content: space-between; gap: 6px; margin-bottom: 8px; }
.jp-selects { display: flex; gap: 6px; flex: 1; justify-content: center; }
.jp-month { width: 116px; } .jp-year { width: 90px; }
.jp-selects select {  padding: 5px 26px 5px 9px; font-size: .86rem; font-weight: 600; font-family: var(--font-display); }
.jp-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; text-align: center; }
.jp-dow { font-size: .66rem; color: var(--text-muted); padding: 4px 0; text-transform: uppercase; font-weight: 600; }
.jp-dow.is-weekend, .jp-day.is-weekend { color: var(--alert); }
.jp-day { border: 0; background: none; padding: 0; height: 34px; border-radius: 9px; cursor: pointer;
          font-family: var(--font-mono); font-size: .82rem; color: var(--text); position: relative; }
.jp-day:hover:not(:disabled) { background: var(--surface-2); }
.jp-day:disabled { opacity: .3; cursor: not-allowed; }
.jp-day.in-range { background: var(--accent-bg); border-radius: 0; }
.jp-day.is-anchor { box-shadow: inset 0 0 0 1.5px var(--accent); }
.jp-day.is-today { font-weight: 700; color: var(--accent-text); }
.jp-day.is-today::after { content: ""; position: absolute; left: 50%; bottom: 4px; width: 4px; height: 4px;
                          margin-left: -2px; border-radius: 50%; background: currentColor; }
.jp-day.is-cursor { box-shadow: inset 0 0 0 2px var(--accent); }
.jp-day.is-selected { background: var(--accent-solid); color: #fff; border-radius: 9px; }
.jp-quick { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--line-soft); }
.jp-chip { border: 1px solid var(--line); background: var(--surface); color: var(--text-soft); border-radius: 999px;
           padding: 4px 10px; font-size: .76rem; cursor: pointer; font-family: inherit; }
.jp-chip:hover:not(:disabled) { border-color: var(--accent); color: var(--accent-text); }
.jp-chip:disabled { opacity: .35; cursor: not-allowed; }
.jp-clear { margin-left: auto; }
.jp-hint { font-size: .74rem; color: var(--text-muted); margin-top: 8px; }
.jp.jp-sheet { position: fixed; left: 0; right: 0; bottom: 0; top: auto; width: auto; border-radius: 18px 18px 0 0;
               padding: 16px 16px calc(16px + env(safe-area-inset-bottom)); animation: rise-in var(--t-base) var(--ease-out); }
.jp.jp-sheet .jp-day { height: 42px; font-size: .95rem; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

/* ---------------- checklist ---------------- */
.checklist { list-style: none; margin: 0; padding: 0; }
.check-item { display: flex; align-items: center; gap: 10px; padding: 7px 4px;
              border-bottom: 1px solid var(--line-soft); transition: opacity var(--t-base) ease; }
.check-item form { margin: 0; display: contents; }
.check-box { width: 20px; height: 20px; flex: 0 0 20px; border-radius: 6px; border: 2px solid var(--line);
             background: var(--surface); cursor: pointer; padding: 0; position: relative;
             transition: background var(--t-fast) ease, border-color var(--t-fast) ease; }
.check-box:hover { border-color: var(--accent); }
.check-item.is-done .check-box { background: var(--ok); border-color: var(--ok); }
.check-item.is-done .check-box::after { content: ""; position: absolute; left: 5px; top: 1px; width: 5px; height: 10px;
             border: solid #fff; border-width: 0 2px 2px 0; transform: rotate(45deg); animation: pop-in 220ms var(--ease-out); }
.check-title { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.check-item.is-done .check-title { color: var(--text-muted); text-decoration: line-through; }
.check-meta { font-size: .74rem; color: var(--text-muted); }
.check-delete .icon-btn { opacity: 0; }
.check-item:hover .check-delete .icon-btn, .check-delete .icon-btn:focus-visible { opacity: 1; }
.check-add { display: flex; gap: 8px; margin-top: 12px; }
.check-add input { flex: 1; }
@media (hover: none) { .check-delete .icon-btn { opacity: .6; } }

/* ---------------- reports ---------------- */
.report-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 14px; }
.report-card { display: flex; flex-direction: column; gap: 6px; padding: 18px; text-decoration: none; color: var(--text);
               background: var(--surface); border: 1px solid var(--line-soft); border-radius: var(--radius);
               transition: transform var(--t-fast) ease, box-shadow var(--t-fast) ease, border-color var(--t-fast) ease; }
.report-card:hover { text-decoration: none; transform: translateY(-2px); border-color: var(--accent);
                     box-shadow: 0 14px 30px -18px rgba(20,24,34,.4); }
.report-icon { font-size: 1.5rem; }
.report-title { font-family: var(--font-display); font-weight: 600; }
.report-foot { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: auto; padding-top: 8px; }
.report-frame-wrap { border: 1px solid var(--line-soft); border-radius: var(--radius); overflow: hidden; background: #fff; }
.report-frame { display: block; width: 100%; height: calc(100vh - 210px); min-height: 520px; border: 0; }

/* ---------------- chat ---------------- */
.chat { display: grid; grid-template-columns: 250px 1fr; height: calc(100vh - 150px); min-height: 460px;
        border: 1px solid var(--line-soft); border-radius: var(--radius); background: var(--surface); overflow: hidden; }
.chat-list { border-right: 1px solid var(--line-soft); overflow-y: auto; padding: 12px 10px; background: var(--surface-2); }
.chat-search input { width: 100%; padding: 7px 10px; font-size: .84rem; }
.chat-group { margin-top: 14px; }
.chat-group-head { display: flex; justify-content: space-between; align-items: center; padding: 0 6px 6px;
                   font-size: .72rem; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: var(--text-muted); }
.chat-link { display: flex; align-items: center; gap: 8px; width: 100%; padding: 6px 8px; border-radius: 8px;
             color: var(--text-soft); text-decoration: none; font-size: .88rem; border: 0; background: none;
             cursor: pointer; text-align: left; font-family: inherit; }
.chat-link:hover { background: var(--surface); text-decoration: none; color: var(--text); }
.chat-link.active { background: var(--accent-bg); color: var(--accent-text); font-weight: 600; }
.chat-link.has-unread { color: var(--text); font-weight: 600; }
.chat-link.is-muted { opacity: .55; }
.chat-link-icon { width: 16px; text-align: center; color: var(--text-muted); font-size: .85rem; }
.chat-link-label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-link-join { opacity: .7; }
.chat-join { margin: 0; }
.chat-badge { min-width: 19px; height: 19px; padding: 0 6px; border-radius: 999px; background: var(--neutral);
              color: #fff; font-size: .7rem; font-family: var(--font-mono); display: inline-grid; place-items: center; }
.chat-badge.is-mention { background: var(--amber); color: #2A1E08; }
.chat-badge[hidden] { display: none; }
.chat-avatar-sm { width: 20px; height: 20px; border-radius: 50%; background: var(--accent-bg); color: var(--accent-text);
                  display: grid; place-items: center; font-size: .66rem; font-weight: 700; }
.chat-dm-new { display: flex; gap: 6px; margin-top: 8px; padding: 0 4px; }
.chat-dm-new select { flex: 1; min-width: 0; font-size: .82rem; padding: 5px 8px; }
.chat-main { display: flex; flex-direction: column; min-width: 0; min-height: 0; position: relative; }
.chat-head { display: flex; align-items: center; gap: 10px; padding: 11px 16px; border-bottom: 1px solid var(--line-soft); }
.chat-head-text { flex: 1; min-width: 0; }
.chat-title { font-size: 1rem; margin: 0; }
.chat-back { display: none; }
.chat-head .create-panel { width: min(340px, 90vw); }
.member-list { margin: 0 0 12px; padding-left: 18px; font-size: .88rem; }
.chat-stream { flex: 1; overflow-y: auto; padding: 12px 16px 16px; overscroll-behavior: contain; }
.chat-older { display: block; text-align: center; font-size: .8rem; padding: 6px; margin-bottom: 6px; }
.chat-empty { text-align: center; padding: 50px 20px; }
.chat-empty-full { margin: auto; max-width: 420px; }
.chat-day { display: flex; align-items: center; gap: 10px; margin: 16px 0 8px; font-size: .74rem;
            color: var(--text-muted); font-weight: 600; }
.chat-day::before, .chat-day::after { content: ""; flex: 1; border-top: 1px solid var(--line-soft); }
.chat-unread-line { display: flex; align-items: center; gap: 8px; margin: 10px 0; color: var(--alert); font-size: .72rem; font-weight: 700; }
.chat-unread-line::before { content: ""; flex: 1; border-top: 1px solid var(--alert); }
.msg { display: grid; grid-template-columns: 34px 1fr auto; gap: 10px; padding: 5px 8px; margin: 0 -8px;
       border-radius: 8px; position: relative; }
.msg:hover { background: var(--surface-2); }
.msg.msg-grouped { padding-top: 1px; }
.msg.msg-grouped .msg-avatar { visibility: hidden; height: 0; }
.msg.msg-grouped .msg-head { display: none; }
.msg-avatar { width: 34px; height: 34px; border-radius: 10px; background: var(--accent-bg); color: var(--accent-text);
              display: grid; place-items: center; font-size: .76rem; font-weight: 700; font-family: var(--font-display); }
.msg-mine .msg-avatar { background: var(--amber); color: #2A1E08; }
.msg-main { min-width: 0; }
.msg-head { display: flex; align-items: baseline; gap: 8px; }
.msg-author { font-weight: 600; font-size: .88rem; }
.msg-head time, .msg-edited { font-size: .72rem; color: var(--text-muted); }
.msg-body { font-size: .92rem; line-height: 1.5; white-space: pre-wrap; overflow-wrap: anywhere; }
.msg-mention { background: color-mix(in srgb, var(--amber) 14%, transparent); }
.msg-mention:hover { background: color-mix(in srgb, var(--amber) 20%, transparent); }
.msg-deleted .msg-body { opacity: .7; }
.msg-pending { opacity: .55; }
.msg-failed .msg-body { color: var(--alert); }
.msg-new { animation: rise-in var(--t-base) var(--ease-out); }
.msg-actions { display: flex; gap: 2px; align-items: flex-start; opacity: 0; transition: opacity var(--t-fast) ease; }
.msg:hover .msg-actions, .msg:focus-within .msg-actions { opacity: 1; }
@media (hover: none) { .msg-actions { opacity: .7; } }
.msg-actions form { margin: 0; }
.msg-edit > summary { list-style: none; }
.msg-edit > summary::-webkit-details-marker { display: none; }
.msg-edit-form { position: absolute; right: 8px; top: 100%; z-index: 30; width: min(420px, 80vw); padding: 10px;
                 background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-sm);
                 box-shadow: 0 16px 40px -20px rgba(0,0,0,.4); display: grid; gap: 6px; }
.mention { background: var(--accent-bg); color: var(--accent-text); border-radius: 5px; padding: 0 3px; font-weight: 600; }
.mention-me { background: var(--amber); color: #2A1E08; }
.task-ref { font-family: var(--font-mono); font-size: .86em; background: var(--surface-2); padding: 0 4px; border-radius: 4px; }
.chat-jump { position: absolute; left: 50%; bottom: 96px; transform: translateX(-50%); z-index: 5;
             border: 0; border-radius: 999px; padding: 7px 14px; background: var(--accent-solid); color: #fff;
             font-weight: 600; font-size: .8rem; cursor: pointer; box-shadow: 0 10px 24px -10px var(--accent);
             animation: rise-in var(--t-base) var(--ease-out); }
.chat-jump[hidden] { display: none; }
.composer { display: grid; grid-template-columns: 1fr auto; gap: 8px; padding: 10px 14px 8px;
            border-top: 1px solid var(--line-soft); }
.composer textarea { resize: none; min-height: 42px; max-height: 180px; line-height: 1.45; padding: 10px 12px; }
.composer-send { align-self: end; height: 42px; }
.composer-hint { grid-column: 1 / -1; }
.composer-hint code { font-size: .74rem; }
.chat-closed { padding: 14px; text-align: center; border-top: 1px solid var(--line-soft); }
.search-bar { display: flex; gap: 8px; margin-bottom: 14px; }
.search-bar input { flex: 1; }
.search-hit { display: block; }
@media (max-width: 860px) {
  .chat { grid-template-columns: 1fr; height: calc(100vh - 130px); border-radius: 0; margin: 0 -16px; border-left: 0; border-right: 0; }
  .chat .chat-list { display: none; }
  .chat.show-list .chat-list { display: block; border-right: 0; }
  .chat.show-list .chat-main { display: none; }
  .chat-back { display: inline-grid; }
  .composer-hint { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  .create-btn, .report-card { transition: none; }
  .create-btn:hover, .report-card:hover { transform: none; }
}
.check-item.is-leaving { opacity: .35; }

/* ---------------- legal + email settings ---------------- */
.legal { line-height: 1.65; max-width: 72ch; }
.legal h2 { font-size: 1rem; margin: 22px 0 6px; }
.legal ul { padding-left: 20px; }
.legal li { margin: 4px 0; }
.legal-meta { color: var(--text-muted); font-size: .82rem; }
.legal-box { max-height: 52vh; overflow-y: auto; }
.legal-accept { margin-top: 12px; }
.legal-decline { margin-top: 10px; }
.consent { margin: 6px 0 14px; font-size: .88rem; }
.notify-kinds { display: grid; gap: 8px; margin: 6px 0 16px; }
.spacer-top { margin-top: 10px; }

/* ---- brand: PULSE with a small "by Neuraft Studio", set slightly in ---- */
.brand { display: flex; align-items: center; gap: 10px; }
.brand-text { display: flex; flex-direction: column; line-height: 1.05; }
.brand-by { font-family: var(--font-mono); font-size: .6rem; letter-spacing: .06em;
            color: var(--text-muted); padding-left: 16px; margin-top: 3px; white-space: nowrap; }

/* ---- sharing a dashboard ---- */
.drop { position: relative; display: flex; flex-direction: column; align-items: center; gap: 4px; text-align: center;
        padding: 22px 16px; margin-bottom: 14px; border: 1.5px dashed var(--line); border-radius: var(--radius);
        background: var(--surface-2); cursor: pointer; transition: border-color var(--t-fast) ease, background var(--t-fast) ease; }
.drop:hover, .drop.is-over { border-color: var(--accent); background: var(--accent-bg); }
.drop.has-file { border-style: solid; border-color: var(--ok); }
.drop input[type=file] { position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; }
.drop-icon { font-size: 1.6rem; }
.drop-title { font-weight: 600; font-family: var(--font-display); overflow-wrap: anywhere; }
.drop-sm { padding: 12px; flex-direction: row; justify-content: center; }
.audience { border: 0; padding: 0; margin: 4px 0 16px; }
.audience legend { font-weight: 600; font-size: .86rem; margin-bottom: 8px; }
.audience-opt { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border: 1px solid var(--line-soft);
                border-radius: var(--radius-sm); margin-bottom: 6px; cursor: pointer; }
.audience-opt:has(input:checked) { border-color: var(--accent); background: var(--accent-bg); }
.audience-opt input { margin-top: 3px; }
.audience-opt span { display: flex; flex-direction: column; gap: 2px; }
.people-pick { display: grid; gap: 6px; max-height: 190px; overflow-y: auto; padding: 8px 12px;
               border: 1px solid var(--line-soft); border-radius: var(--radius-sm); margin-top: 4px; }
.people-pick[hidden] { display: none; }

/* ---- sign-in, welcome, invitation ---- */
.login-title { font-size: 1.15rem; margin: 2px 0 14px; }
.login-help { margin: 12px 0 0; line-height: 1.5; text-align: center; }
.pw-field { position: relative; display: block; }
.pw-field input { padding-right: 64px; }
.pw-toggle { position: absolute; right: 5px; top: 50%; transform: translateY(-50%); border: 0; background: none;
             color: var(--accent-text); font-weight: 600; font-size: .78rem; padding: 6px 8px; border-radius: 6px; cursor: pointer; }
.pw-toggle:hover { background: var(--accent-bg); }
.pw-rules { list-style: none; padding: 0; margin: -4px 0 14px; display: flex; gap: 14px; flex-wrap: wrap; font-size: .78rem; color: var(--text-muted); }
.pw-rules li::before { content: "○ "; }
.pw-rules li.is-met { color: var(--ok); }
.pw-rules li.is-met::before { content: "✓ "; }
.welcome { max-width: 560px; margin: 20px auto; }
.welcome-head { text-align: center; margin-bottom: 18px; }
.welcome-head h1 { margin: 8px 0 4px; }
.welcome-org { width: 56px; height: 56px; object-fit: contain; }
.welcome-card { padding: 22px; }
.welcome-step { display: flex; gap: 14px; padding-bottom: 18px; margin-bottom: 18px; border-bottom: 1px solid var(--line-soft); }
.step-num { flex: 0 0 28px; height: 28px; border-radius: 50%; background: var(--accent-solid); color: #fff; display: grid;
            place-items: center; font-weight: 700; font-family: var(--font-display); font-size: .85rem; }
.step-body { flex: 1; min-width: 0; }
.step-body h2 { font-size: 1rem; margin: 3px 0 2px; }
.welcome-out { text-align: center; margin-top: 12px; }
.invite { max-width: 680px; }
.creds-value { display: flex; align-items: center; gap: 8px; min-width: 0; }
.creds-value code { overflow-wrap: anywhere; }
.invite-h { font-size: .95rem; margin: 20px 0 8px; }
.invite-msg { width: 100%; font-family: var(--font-mono); font-size: .82rem; line-height: 1.55; resize: vertical; background: var(--surface-2); }
.is-copied { color: var(--ok) !important; }

/* ---- platform: addresses and administrators ---- */
.org-links { display: grid; gap: 6px; margin: 4px 0 12px; }
.org-link { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.org-link .metric-label { min-width: 150px; }
.org-link code { background: var(--surface-2); padding: 3px 8px; border-radius: 6px; overflow-wrap: anywhere; }
.org-admins { margin: 6px 0 10px; padding-top: 10px; border-top: 1px solid var(--line-soft); }
.admin-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 8px 0; }
.admin-row.is-muted { opacity: .55; }
.admin-who { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.platform-note { margin: -6px 0 14px; }


/* =====================================================================
   Personal tasks — the same components as work. The only difference is a
   small teal marker (a dot, or the calendar bar's colour) and the label.
   ===================================================================== */
.personal-dot, .work-dot { display: inline-block; width: 8px; height: 8px; flex: 0 0 8px; vertical-align: 1px; }
.personal-dot { background: var(--personal); border-radius: 50%; }
.work-dot { background: var(--accent); border-radius: 2px; }

/* sidebar: a quiet entry, like the navigation below it */
.quick-personal-btn { display: flex; align-items: center; gap: 10px; margin: 0 0 12px; padding: 8px 12px;
  border: 1px solid var(--line-soft); border-radius: 10px; background: var(--surface); color: var(--text-soft);
  font-weight: 600; font-size: .86rem; text-decoration: none;
  transition: background var(--t-fast) ease, color var(--t-fast) ease; }
.quick-personal-btn:hover { background: var(--surface-2); color: var(--text); text-decoration: none; }
.quick-personal-btn .quick-plus { display: inline-grid; place-items: center; width: 20px; height: 20px; border-radius: 6px;
  background: var(--accent-bg); color: var(--accent-text); font-size: .95rem; line-height: 1; }
.quick-personal-btn span:nth-child(2) { flex: 1; }
.quick-personal-btn kbd { font-size: .7rem; opacity: .7; }

/* quick add */
.quick-add { display: grid; gap: 10px; margin: 0 0 14px; }
.quick-when { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.qchip { border: 1px solid var(--line); background: var(--surface); color: var(--text-soft); border-radius: 999px;
  padding: 5px 11px; font: inherit; font-size: .8rem; cursor: pointer; line-height: 1.2;
  transition: background var(--t-fast) ease, border-color var(--t-fast) ease, color var(--t-fast) ease; }
.qchip:hover { border-color: var(--accent); color: var(--accent-text); }
.qchip.is-on { background: var(--accent-bg); border-color: var(--accent); color: var(--accent-text); font-weight: 600; }
.quick-date { flex: 1 1 130px; min-width: 130px; max-width: 170px; }
.quick-date .date-field input { padding: 5px 36px 5px 11px; font-size: .8rem; border-radius: 999px; height: 30px; }
.quick-date .date-btn { width: 28px; height: 28px; right: 2px; }
.quick-date .date-line { display: none; }
.quick-bottom { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.quick-preview { font-size: .82rem; color: var(--text-soft); min-width: 0; overflow-wrap: anywhere; line-height: 1.4; }
.quick-preview.is-empty { color: var(--text-muted); }
.quick-bottom .btn { flex: 0 0 auto; }

/* My work: work on the left, personal on the right — both ordinary cards */
.mywork { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 22px; align-items: start; }
.mywork-label { display: flex; align-items: center; gap: 8px; font-size: .74rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: .08em; color: var(--text-muted); margin-bottom: 6px; }
.personal-panel { position: sticky; top: 16px; }
.personal-head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; margin-bottom: 10px; }
.personal-head h2 { display: flex; align-items: center; gap: 8px; margin: 0; font-size: 1.02rem; }
@media (max-width: 1100px) { .mywork { grid-template-columns: 1fr; } .personal-panel { position: static; order: -1; } }

/* rows: the same as a task checklist */
.plist { list-style: none; margin: 0; padding: 0; }
.prow { display: flex; align-items: center; gap: 10px; padding: 7px 4px; border-bottom: 1px solid var(--line-soft); position: relative; }
.prow form { margin: 0; }
.p-toggle { display: contents; }
.p-box { position: relative; }
.prow.is-done .p-box, .agenda-personal.is-done .p-box { background: var(--ok); border-color: var(--ok); }
.prow.is-done .p-box::after, .agenda-personal.is-done .p-box::after { content: ""; position: absolute; left: 5px; top: 1px;
  width: 5px; height: 10px; border: solid #fff; border-width: 0 2px 2px 0; transform: rotate(45deg); }
.p-title { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.prow.is-done .p-title { color: var(--text-muted); text-decoration: line-through; }
.p-due { font-family: var(--font-mono); font-size: .72rem; color: var(--text-soft); background: var(--surface-2);
  padding: 2px 7px; border-radius: 999px; white-space: nowrap; }
.prow.is-overdue .p-due { color: var(--alert); background: color-mix(in srgb, var(--alert) 10%, transparent); }
.prow.is-new { animation: rise-in var(--t-base) var(--ease-out); }
.p-more > summary { list-style: none; opacity: .45; }
.p-more > summary::-webkit-details-marker { display: none; }
.prow:hover .p-more > summary, .p-more[open] > summary, .p-more > summary:focus-visible { opacity: 1; }
.p-panel { position: absolute; right: 0; top: 100%; z-index: 30; width: min(320px, 86vw); padding: 12px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-sm);
  box-shadow: 0 18px 40px -20px rgba(0,0,0,.4); }
.p-delete { margin-top: 6px; }
.plist-empty { margin: 8px 2px 4px; line-height: 1.5; }
.plist-empty[hidden] { display: none; }
.p-done { margin: 12px 0 0; }

/* calendar: the same bar as work items, in teal */
.seg-show a { display: inline-flex; align-items: center; gap: 6px; }
.cal-legend { display: flex; flex-wrap: wrap; gap: 16px; margin: -6px 0 10px; font-size: .76rem; color: var(--text-muted); }
.cal-legend > span { display: inline-flex; align-items: center; gap: 6px; }
.legend-swatch { display: inline-block; width: 18px; height: 11px; border-radius: 3px; background: var(--surface-2); }
.legend-work { border-left: 3px solid var(--accent); }
.legend-project { background: var(--accent-bg); border-left: 3px solid var(--indigo); }
.legend-personal { border-left: 3px solid var(--personal); }
.cal-pform { margin: 0; display: block; }
.cal-personal { width: 100%; text-align: start; cursor: pointer; font-family: inherit; border: 0;
  border-left: 3px solid var(--personal); }
.cal-personal.is-done { color: var(--text-muted); text-decoration: line-through; }
.agenda-personal { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin: 0; padding: 10px 12px;
  border: 1px solid var(--line-soft); border-radius: var(--radius-sm); background: var(--surface); }
.agenda-personal .item-meta { display: inline-flex; align-items: center; gap: 6px; }
.agenda-personal.is-done .item-title { text-decoration: line-through; color: var(--text-muted); }
.cal-add { opacity: 0; }
.cal-cell:hover .cal-add, .cal-add:focus-visible { opacity: 1; }
@media (hover: none) { .cal-add { opacity: .6; } }

/* dashboard: an ordinary row */
.personal-nudge { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin: 12px 0 0; padding: 10px 14px;
  border: 1px solid var(--line-soft); border-radius: var(--radius-sm); background: var(--surface); color: var(--text);
  text-decoration: none; font-size: .88rem; }
.personal-nudge:hover { text-decoration: none; border-color: var(--line); }
.personal-nudge .muted { margin-left: auto; }

/* the quick-add dialog: an ordinary Pulse dialog */
dialog.quick-dialog { width: min(500px, calc(100vw - 24px)); overflow: visible; }
.quick-dialog-body { padding: 18px 20px 4px; }
.quick-dialog-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.quick-dialog-head h2 { margin: 0; font-size: 1.05rem; }
.quick-dialog .quick-add { margin-bottom: 8px; }
.quick-foot { display: flex; align-items: center; gap: 7px; flex-wrap: wrap; margin: 0; padding: 11px 20px 14px;
  border-top: 1px solid var(--line-soft); font-size: .8rem; color: var(--text-muted); }
.quick-foot [hidden] { display: none; }
/* a calendar inside a dialog belongs to the dialog's layer */
dialog .jp { z-index: 5; }

/* =====================================================================
   Focus (Pomodoro) — ordinary Pulse components around one clock
   ===================================================================== */
.focus-btn { width: 100%; cursor: pointer; font-family: inherit; text-align: start; }
.focus-btn.is-running .quick-plus { background: var(--accent-solid); color: #fff; }
.focus-btn.is-break .quick-plus { background: var(--ok); color: var(--on-ok); }
.focus-btn [data-focus-side] { font-variant-numeric: tabular-nums; }
dialog.focus-dialog { width: min(420px, calc(100vw - 24px)); }
.focus-phases { display: flex; width: 100%; }
.focus-phases button { flex: 1; border: 0; background: none; font: inherit; font-size: .82rem; padding: 6px 8px;
  border-radius: 999px; color: var(--text-soft); cursor: pointer; }
.focus-phases button.active { background: var(--surface); color: var(--text); box-shadow: 0 1px 3px rgba(0,0,0,.08); font-weight: 600; }
.focus-phases button:disabled { cursor: not-allowed; opacity: .55; }
.focus-clock { position: relative; width: 210px; height: 210px; margin: 18px auto 8px; }
.focus-ring { width: 100%; height: 100%; transform: rotate(-90deg); }
.focus-track, .focus-progress { fill: none; stroke-width: 6; }
.focus-track { stroke: var(--surface-2); }
.focus-progress { stroke: var(--accent); stroke-linecap: round; stroke-dasharray: 339.29; stroke-dashoffset: 339.29;
  transition: stroke-dashoffset .5s linear, stroke .3s ease; }
.focus-dialog.is-break .focus-progress { stroke: var(--ok); }
.focus-readout { position: absolute; inset: 0; display: grid; place-content: center; text-align: center; }
.focus-time { font-family: var(--font-display); font-size: 3rem; font-weight: 700; letter-spacing: .02em;
  font-variant-numeric: tabular-nums; line-height: 1; }
.focus-state { margin-top: 6px; font-size: .8rem; color: var(--text-muted); }
.focus-cycle { display: flex; justify-content: center; gap: 7px; margin-bottom: 14px; }
.focus-cycle span { width: 8px; height: 8px; border-radius: 50%; background: var(--surface-2); border: 1px solid var(--line); }
.focus-cycle span.is-done { background: var(--accent); border-color: var(--accent); }
.focus-controls { display: flex; justify-content: center; align-items: center; gap: 10px; margin-bottom: 16px; }
.focus-main { min-width: 120px; }
.focus-target { margin-bottom: 6px; }
.focus-today { font-size: .8rem; color: var(--text-muted); margin: 0 0 10px; min-height: 1.2em; }
.focus-settings { margin: 0 0 8px; }
.focus-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 0 12px; }
.focus-pill { position: fixed; right: 18px; bottom: calc(18px + env(safe-area-inset-bottom)); z-index: 70;
  display: inline-flex; align-items: center; gap: 8px; padding: 8px 14px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--surface); color: var(--text); cursor: pointer;
  font: 600 .9rem var(--font-display); font-variant-numeric: tabular-nums;
  box-shadow: 0 12px 30px -14px rgba(20,24,34,.45); animation: rise-in var(--t-base) var(--ease-out); }
.focus-pill[hidden] { display: none; }
.focus-pill::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--accent); }
.focus-pill.is-break::before { background: var(--ok); }
.focus-pill.is-paused::before { background: var(--text-muted); }
.focus-note { display: inline-block; margin-left: 8px; color: var(--text-soft); }
.focus-note-line { margin: 10px 0 0; font-size: .88rem; color: var(--text-soft); }
.focus-task-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin: 10px 0 4px; }
.p-focus { margin-top: 6px; }
@media (prefers-reduced-motion: reduce) { .focus-progress { transition: none; } }

/* links inside running text are underlined, not just coloured */
p a, .hint a, .muted a, .legal a, .login-help a, .flash a, .empty a { text-decoration: underline; text-underline-offset: 2px; }
.table-wrap:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }


/* ---- tokens tuned to WCAG AA (checked by the accessibility sweep) ---- */
:root { --accent-solid: var(--accent); --on-ok: #fff; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) {
  --silver: #A6A29D; --text-muted: #A6A29D; --neutral: #A6A29D; --accent-solid: #6C5CE7; --on-ok: #10210F; } }
:root[data-theme="dark"] { --silver: #A6A29D; --text-muted: #A6A29D; --neutral: #A6A29D; --accent-solid: #6C5CE7; --on-ok: #10210F; }


/* =====================================================================
   v4.5 — a calmer, more professional surface
   ===================================================================== */
.ico { flex: none; display: block; }

/* sidebar: grouped navigation with one icon family */
.side-actions { display: grid; gap: 6px; margin: 0 0 16px; }
.side-actions .quick-personal-btn { margin: 0; padding: 7px 10px; }
.quick-personal-btn .quick-plus { width: 22px; height: 22px; border-radius: 7px; }
.nav-group + .nav-group { margin-top: 16px; }
.nav-group-label { font-family: var(--font-mono); font-size: .64rem; letter-spacing: .1em; text-transform: uppercase;
  color: var(--text-muted); padding: 0 12px 6px; }
.nav a { gap: 12px; }
.nav-icon { display: grid; place-items: center; width: 20px; color: var(--text-muted); transition: color var(--t-fast) ease; }
.nav a:hover .nav-icon { color: var(--text); }
.nav a.active .nav-icon { color: var(--accent-text); }

/* surfaces: hairline borders with a whisper of depth, not hard edges */
.card, .metric, .cal, .report-card, .personal-panel, .table-wrap {
  box-shadow: 0 1px 2px rgba(20, 24, 34, .04), 0 1px 1px rgba(20, 24, 34, .03); }
:root[data-theme="dark"] .card, :root[data-theme="dark"] .metric, :root[data-theme="dark"] .cal { box-shadow: none; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .card, :root:not([data-theme="light"]) .metric,
  :root:not([data-theme="light"]) .cal { box-shadow: none; } }

/* sign-in: a soft, lifted card instead of a hard offset shadow */
.login-card { border-color: var(--line); border-radius: 18px;
  box-shadow: 0 30px 70px -34px rgba(20, 24, 34, .38), 0 2px 8px rgba(20, 24, 34, .06); }
.report-icon { color: var(--accent-text); width: 40px; height: 40px; display: grid; place-items: center;
  background: var(--accent-bg); border-radius: 10px; }
.chat-link-icon { display: inline-grid; place-items: center; }
.create-plus .ico, .quick-plus .ico { margin: 0; }
.focus-note, .focus-note-line, .focus-task-row .btn { display: inline-flex; align-items: center; gap: 6px; }
.btn .ico { display: inline-block; vertical-align: -3px; margin-right: 4px; }
.chip .ico { display: inline-block; vertical-align: -2px; }
.cal-item .ico { display: inline-block; vertical-align: -2px; margin-right: 2px; }
.item-title .ico { display: inline-block; vertical-align: -3px; margin-right: 4px; }

/* metric cards: an even hairline border; only cards that mean something get a coloured edge */
.metric { border-left-width: 1px; border-left-color: var(--line-soft); border-color: var(--line-soft); position: relative; overflow: hidden; }
.metric.alert, .metric.attn, .metric.good { border-left-width: 1px; }
.metric.alert::before, .metric.attn::before, .metric.good::before {
  content: ""; position: absolute; left: 0; top: 12px; bottom: 12px; width: 3px; border-radius: 0 3px 3px 0; }
.metric.alert::before { background: var(--alert); } .metric.attn::before { background: var(--attn); } .metric.good::before { background: var(--ok); }
.metric:hover { transform: none; border-color: var(--line); }
.card, .board-col { border-color: var(--line-soft); }
.card:hover, .board-col:hover { border-color: var(--line-soft); }
