/* =========================================================
   Strands by Scale Wise — design system

   Editorial palette: crimson, ochre and ink on paper.
   Crimson means attention. Ochre means caution. Ink means act.
   White background, generous air, one idea per screen.
   ========================================================= */

:root{
  /* Surface */
  --bg:            #FFFFFF;
  --bg-subtle:     #FCFBF9;
  --bg-sunken:     #F6F5F1;
  --bg-hover:      #F2F1EC;
  --bg-active:     #EBE9E3;

  /* Line & text — warm neutrals drawn from the brand ink */
  --border:        #E8E6DF;
  --border-strong: #D9D6CC;
  --text:          #191E1C;
  --text-2:        #585C57;
  --text-3:        #90938B;
  --text-4:        #B4B6AE;

  /* Brand */
  --ink:           #191E1C;
  --crimson:       #8C2233;
  --crimson-light: #B03A4A;
  --ochre:         #B98A2E;

  /* Accent — the brand crimson, used sparingly */
  --accent:        #8C2233;
  --accent-hover:  #701B28;
  --accent-soft:   #FBF1F2;
  --accent-border: #EBD1D5;

  /* Signal */
  --red:    #9E2334;  --red-soft:    #FBF1F2;  --red-border:    #EBD1D5;
  --amber:  #8A6414;  --amber-soft:  #FBF5E8;  --amber-border:  #EDDCB8;
  --green:  #1A6B4C;  --green-soft:  #EDF6F1;  --green-border:  #CBE4D7;
  --blue:   #22557F;  --blue-soft:   #EFF4F8;  --blue-border:   #CEDEEA;
  --violet: #6B3FA0;  --violet-soft: #F6F1FC;  --violet-border: #E4D7F3;

  /* Form */
  --radius:    10px;
  --radius-sm: 7px;
  --radius-lg: 14px;

  --shadow-xs: 0 1px 2px rgba(26,25,23,.05);
  --shadow-sm: 0 1px 3px rgba(26,25,23,.07), 0 1px 2px rgba(26,25,23,.04);
  --shadow-md: 0 6px 16px -4px rgba(26,25,23,.10), 0 2px 6px -2px rgba(26,25,23,.06);
  --shadow-lg: 0 20px 48px -12px rgba(26,25,23,.18), 0 6px 16px -8px rgba(26,25,23,.10);

  --side-w: 252px;
  --topbar-h: 57px;

  --ease: cubic-bezier(.32,.72,0,1);

  /* Two voices: an editorial serif for anything that speaks,
     a neutral sans for anything that works. */
  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  --font-display: 'Instrument Serif', 'Hoefler Text', Georgia, 'Times New Roman', serif;
}

*,*::before,*::after{ box-sizing:border-box; }

html,body{ height:100%; }

body{
  margin:0;
  background:var(--bg);
  color:var(--text);
  font-family:var(--font);
  font-size:14px;
  line-height:1.5;
  -webkit-font-smoothing:antialiased;
  -moz-osx-font-smoothing:grayscale;
  font-feature-settings:'cv11','ss01';
}

h1,h2,h3,h4{ margin:0; font-weight:600; letter-spacing:-0.018em; }
p{ margin:0; }
button{ font:inherit; color:inherit; }
input,select,textarea{ font:inherit; color:inherit; }
a{ color:inherit; text-decoration:none; }
[hidden]{ display:none !important; }

kbd{
  font-family:var(--font); font-size:10.5px; font-weight:600;
  color:var(--text-3); background:var(--bg-sunken);
  border:1px solid var(--border); border-radius:4px;
  padding:1px 5px; line-height:1.4;
}

::selection{ background:var(--accent-soft); }

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

/* Scrollbars */
*::-webkit-scrollbar{ width:11px; height:11px; }
*::-webkit-scrollbar-track{ background:transparent; }
*::-webkit-scrollbar-thumb{
  background:#DAD8D2; border-radius:8px;
  border:3px solid var(--bg);
}
*::-webkit-scrollbar-thumb:hover{ background:#C2BFB7; }

/* =========================================================
   Sign-in gate
   ========================================================= */
.gate{
  position:fixed; inset:0; z-index:200;
  display:grid; place-items:center;
  background:
    radial-gradient(1200px 620px at 50% -14%, #FAF3F0 0%, rgba(255,255,255,0) 64%),
    var(--bg);
  padding:24px;
  overflow:hidden;
}
.gate-card{
  position:relative; z-index:1;
  width:100%; max-width:380px; text-align:center;
  animation:rise .5s var(--ease) both;
}
.gate-mark{ display:flex; justify-content:center; margin-bottom:26px; }
.gate-title{ font-family:var(--font-display); font-weight:400; font-size:54px; letter-spacing:-0.005em; line-height:.95; }
.gate-wordmark{
  font-size:9.5px; font-weight:600; color:var(--text-3);
  text-transform:uppercase; letter-spacing:.26em; margin-top:10px;
}
.gate-rule{ margin:11px auto 0; width:208px; }
.gate-rule .weave{ margin:0 auto; }
.gate-sub{ color:var(--text-3); margin-top:28px; font-size:13.5px; }
.gate-list{ display:flex; flex-direction:column; gap:7px; margin-top:26px; text-align:left; }
.gate-person{
  display:flex; align-items:center; gap:11px;
  padding:10px 12px; width:100%; text-align:left;
  background:var(--bg); border:1px solid var(--border);
  border-radius:var(--radius); cursor:pointer;
  transition:border-color .13s, background .13s, transform .13s var(--ease);
}
.gate-person:hover{ border-color:var(--border-strong); background:var(--bg-subtle); transform:translateY(-1px); }
.gate-person .pm{ flex:1; min-width:0; }
.gate-person .pn{ font-weight:550; font-size:13.5px; }
.gate-person .pe{ color:var(--text-3); font-size:11.5px; margin-top:1px; }
.gate-divider{
  position:relative; margin:20px 0 14px;
  color:var(--text-4); font-size:11.5px;
}
.gate-divider::before{
  content:''; position:absolute; left:0; right:0; top:50%;
  height:1px; background:var(--border);
}
.gate-divider span{ position:relative; background:var(--bg); padding:0 10px; }
.gate-foot{ color:var(--text-4); font-size:11.5px; margin-top:20px; line-height:1.6; }

@keyframes rise{ from{ opacity:0; transform:translateY(10px); } to{ opacity:1; transform:none; } }

/* =========================================================
   Shell
   ========================================================= */
.app{ display:flex; min-height:100vh; }

.sidebar{
  width:var(--side-w); flex:none;
  background:var(--bg-subtle);
  border-right:1px solid var(--border);
  display:flex; flex-direction:column;
  position:sticky; top:0; height:100vh;
  padding:12px 10px 10px;
  z-index:60;
}

.side-head{ display:flex; align-items:center; gap:6px; padding:2px 6px 14px; }
.brand{ display:flex; align-items:center; gap:9px; min-width:0; flex:1; }
.brand-mark{ display:flex; flex:none; }
.brand-text{ display:flex; flex-direction:column; min-width:0; }
.brand-name{
  font-family:var(--font-display); font-weight:400;
  font-size:19px; letter-spacing:0; line-height:1.1;
  white-space:nowrap; overflow:hidden; text-overflow:ellipsis;
}
.brand-sub{
  font-size:10.5px; color:var(--text-3); font-weight:500;
  display:flex; align-items:center; gap:4px; margin-top:1px;
}
.brand-sub::before{
  content:''; width:5px; height:5px; border-radius:50%;
  background:var(--text-4); flex:none;
}
.brand-sub.live::before{ background:#16A34A; box-shadow:0 0 0 2.5px rgba(22,163,74,.16); }
.brand-sub.err::before{ background:var(--red); }
.side-close{ display:none; }

.new-btn{
  display:flex; align-items:center; gap:8px; width:100%;
  padding:8px 10px; margin-bottom:14px;
  background:var(--text); color:#fff;
  border:none; border-radius:var(--radius-sm);
  font-size:13px; font-weight:550; cursor:pointer;
  box-shadow:var(--shadow-xs);
  transition:background .13s, transform .13s var(--ease);
}
.new-btn:hover{ background:#000; transform:translateY(-1px); }
.new-btn:active{ transform:none; }
.new-btn kbd{
  margin-left:auto; background:rgba(255,255,255,.14);
  border-color:rgba(255,255,255,.18); color:rgba(255,255,255,.75);
}

.side-nav{ display:flex; flex-direction:column; gap:1px; }

.nav-item{
  display:flex; align-items:center; gap:9px;
  padding:6.5px 9px; border-radius:var(--radius-sm);
  color:var(--text-2); font-size:13px; font-weight:500;
  cursor:pointer; border:none; background:none; width:100%; text-align:left;
  transition:background .12s, color .12s;
}
.nav-item svg{ flex:none; opacity:.72; }
.nav-item:hover{ background:var(--bg-hover); color:var(--text); }
.nav-item.on{ background:var(--bg-active); color:var(--text); font-weight:600; }
.nav-item.on svg{ opacity:1; }
.nav-item span{ flex:1; min-width:0; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }

.nav-count{
  flex:none !important; font-size:11px; font-weight:600;
  color:var(--text-3); background:var(--bg-active);
  border-radius:20px; padding:1px 6px; min-width:19px; text-align:center;
}
.nav-count:empty{ display:none; }
.nav-count-alert{ color:var(--red); background:var(--red-soft); }

.side-section{ margin-top:20px; flex:1; min-height:0; display:flex; flex-direction:column; }
.side-label{
  display:flex; align-items:center; gap:6px;
  padding:0 9px 7px; font-size:10.5px; font-weight:650;
  color:var(--text-4); text-transform:uppercase; letter-spacing:.07em;
}
.side-label span{ flex:1; }
.line-list{ display:flex; flex-direction:column; gap:1px; overflow-y:auto; }

.line-item{
  display:flex; align-items:center; gap:9px;
  padding:6.5px 9px; border-radius:var(--radius-sm);
  color:var(--text-2); font-size:13px; font-weight:500; cursor:pointer;
  transition:background .12s, color .12s;
}
.line-item:hover{ background:var(--bg-hover); color:var(--text); }
.line-item.on{ background:var(--bg-active); color:var(--text); font-weight:600; }
.line-item .dot{ width:7px; height:7px; border-radius:50%; flex:none; }
.line-item .nm{ flex:1; min-width:0; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.line-item .ct{ font-size:11px; color:var(--text-4); font-variant-numeric:tabular-nums; }

.side-foot{
  border-top:1px solid var(--border); margin-top:12px; padding-top:9px;
  display:flex; flex-direction:column; gap:1px;
}
.whoami{
  display:flex; align-items:center; gap:9px;
  padding:7px 9px; margin-top:4px; border-radius:var(--radius-sm);
  background:none; border:none; cursor:pointer; text-align:left; width:100%;
  transition:background .12s;
}
.whoami:hover{ background:var(--bg-hover); }
.whoami .wm{ flex:1; min-width:0; }
.whoami .wn{ font-size:12.5px; font-weight:550; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.whoami .wr{ font-size:10.5px; color:var(--text-3); }

/* Main */
.main{ flex:1; min-width:0; display:flex; flex-direction:column; }

.topbar{
  height:var(--topbar-h); flex:none;
  display:flex; align-items:center; gap:10px;
  padding:0 22px;
  border-bottom:1px solid var(--border);
  background:rgba(255,255,255,.86);
  backdrop-filter:saturate(180%) blur(12px);
  -webkit-backdrop-filter:saturate(180%) blur(12px);
  position:sticky; top:0; z-index:40;
}
.topbar-spacer{ flex:1; }
.menu-btn{ display:none; }

.crumbs{ display:flex; align-items:center; gap:7px; min-width:0; }
.crumbs .cb{ font-size:13px; color:var(--text-3); white-space:nowrap; }
.crumbs .cb.now{ color:var(--text); font-weight:600; letter-spacing:-0.01em; }
.crumbs .sep{ color:var(--text-4); font-size:12px; }
.crumbs .dot{ width:8px; height:8px; border-radius:50%; flex:none; }

.search{
  display:flex; align-items:center; gap:7px;
  background:var(--bg-sunken); border:1px solid transparent;
  border-radius:var(--radius-sm); padding:0 9px; height:32px;
  width:268px; max-width:38vw;
  transition:border-color .13s, background .13s;
}
.search:focus-within{ background:var(--bg); border-color:var(--accent-border); box-shadow:0 0 0 3px var(--accent-soft); }
.search svg{ color:var(--text-4); flex:none; }
.search input{
  flex:1; min-width:0; border:none; background:none; outline:none;
  font-size:13px; padding:0;
}
.search input::placeholder{ color:var(--text-4); }
.search input::-webkit-search-cancel-button{ display:none; }
.search kbd{ flex:none; }
.search:focus-within kbd{ display:none; }

.view{ flex:1; min-width:0; }

/* =========================================================
   Page scaffolding
   ========================================================= */
.page{ padding:30px 28px 90px; max-width:1180px; }
.page-wide{ max-width:none; }

.page-head{ margin-bottom:24px; }
.page-title{
  font-family:var(--font-display); font-weight:400;
  font-size:33px; letter-spacing:-0.005em; line-height:1.05;
  display:flex; align-items:center; gap:12px;
}
.page-title .dot{ width:11px; height:11px; border-radius:50%; flex:none; }
.page-sub{ color:var(--text-3); font-size:13.5px; margin-top:5px; }

.page-actions{ display:flex; align-items:center; gap:8px; flex-wrap:wrap; }

.row-between{ display:flex; align-items:flex-start; justify-content:space-between; gap:16px; flex-wrap:wrap; }

/* =========================================================
   Buttons
   ========================================================= */
.btn{
  display:inline-flex; align-items:center; justify-content:center; gap:6px;
  height:32px; padding:0 12px;
  border-radius:var(--radius-sm); border:1px solid var(--border-strong);
  background:var(--bg); color:var(--text);
  font-size:13px; font-weight:550; cursor:pointer; white-space:nowrap;
  box-shadow:var(--shadow-xs);
  transition:background .13s, border-color .13s, transform .1s var(--ease), box-shadow .13s;
}
.btn:hover{ background:var(--bg-subtle); border-color:#CFCCC4; }
.btn:active{ transform:scale(.985); }
.btn svg{ flex:none; opacity:.8; }

.btn-primary{ background:var(--text); color:#fff; border-color:var(--text); }
.btn-primary:hover{ background:#000; border-color:#000; }
.btn-primary svg{ opacity:1; }

.btn-accent{ background:var(--accent); color:#fff; border-color:var(--accent); }
.btn-accent:hover{ background:var(--accent-hover); border-color:var(--accent-hover); }

.btn-danger{ color:var(--red); border-color:var(--red-border); background:var(--bg); }
.btn-danger:hover{ background:var(--red-soft); border-color:#EBBFC5; }

.btn-ghost{ border-color:transparent; box-shadow:none; background:none; color:var(--text-2); }
.btn-ghost:hover{ background:var(--bg-hover); color:var(--text); }

.btn-sm{ height:27px; padding:0 9px; font-size:12px; border-radius:6px; }
.btn-block{ width:100%; }

.icon-btn{
  display:inline-flex; align-items:center; justify-content:center;
  width:29px; height:29px; flex:none;
  border:none; background:none; border-radius:6px;
  color:var(--text-3); cursor:pointer;
  transition:background .12s, color .12s;
}
.icon-btn:hover{ background:var(--bg-hover); color:var(--text); }
.icon-btn.tiny{ width:21px; height:21px; border-radius:5px; }

/* =========================================================
   Avatars & chips
   ========================================================= */
/* Person rows stack name over email. These wrappers are <span>s, so they
   need an explicit column — without it the two lines run together. */
.gate-person .pm,
.pick .pm,
.whoami .wm{ display:flex; flex-direction:column; min-width:0; }

.av{
  display:inline-flex; align-items:center; justify-content:center; flex:none;
  width:26px; height:26px; border-radius:50%;
  font-size:10.5px; font-weight:650; color:#fff;
  letter-spacing:.01em; user-select:none;
}
.av-sm{ width:21px; height:21px; font-size:9px; }
.av-lg{ width:34px; height:34px; font-size:12.5px; }
.av-xl{ width:44px; height:44px; font-size:15px; }
.av-none{ background:var(--bg-sunken); color:var(--text-4); border:1px dashed var(--border-strong); }

.chip{
  display:inline-flex; align-items:center; gap:5px;
  height:22px; padding:0 8px; border-radius:20px;
  font-size:11.5px; font-weight:600; white-space:nowrap;
  border:1px solid transparent; background:var(--bg-sunken); color:var(--text-2);
}
.chip .cd{ width:5.5px; height:5.5px; border-radius:50%; flex:none; }

.chip-red{    background:var(--red-soft);    color:var(--red);    border-color:var(--red-border); }
.chip-amber{  background:var(--amber-soft);  color:var(--amber);  border-color:var(--amber-border); }
.chip-green{  background:var(--green-soft);  color:var(--green);  border-color:var(--green-border); }
.chip-blue{   background:var(--blue-soft);   color:var(--blue);   border-color:var(--blue-border); }
.chip-violet{ background:var(--violet-soft); color:var(--violet); border-color:var(--violet-border); }
.chip-gray{   background:var(--bg-sunken);   color:var(--text-2); border-color:var(--border); }

.chip-sm{ height:19px; padding:0 7px; font-size:10.5px; }

/* Priority flag */
.pri{ display:inline-flex; align-items:center; gap:4px; font-size:11.5px; font-weight:600; }
.pri-critical{ color:var(--red); }
.pri-high{ color:var(--amber); }
.pri-medium{ color:var(--text-2); }
.pri-low{ color:var(--text-4); }

/* =========================================================
   Cards & stats
   ========================================================= */
.card{
  background:var(--bg); border:1px solid var(--border);
  border-radius:var(--radius-lg); box-shadow:var(--shadow-xs);
}
.card-pad{ padding:18px; }

.stat-grid{
  display:grid; gap:12px; margin-bottom:26px;
  grid-template-columns:repeat(auto-fit,minmax(168px,1fr));
}
.stat{
  background:var(--bg); border:1px solid var(--border);
  border-radius:var(--radius-lg); padding:15px 16px;
  box-shadow:var(--shadow-xs);
  transition:border-color .14s, box-shadow .14s, transform .14s var(--ease);
  cursor:pointer;
}
.stat:hover{ border-color:var(--border-strong); box-shadow:var(--shadow-sm); transform:translateY(-1px); }
.stat-k{
  font-size:11px; font-weight:600; color:var(--text-3);
  text-transform:uppercase; letter-spacing:.06em;
  display:flex; align-items:center; gap:6px;
}
.stat-v{
  font-family:var(--font-display); font-weight:400;
  font-size:36px; letter-spacing:-0.01em;
  margin-top:7px; line-height:1;
}
.stat-v.alert{ color:var(--red); }
.stat-v.warn{ color:var(--amber); }
.stat-v.good{ color:var(--green); }
.stat-f{ font-size:11.5px; color:var(--text-4); margin-top:7px; }

/* Section header */
.sec{ margin-bottom:30px; }
.sec-head{
  display:flex; align-items:center; gap:9px;
  padding-bottom:10px; margin-bottom:12px;
  border-bottom:1px solid var(--border);
}
.sec-title{ font-size:14.5px; font-weight:650; letter-spacing:-0.018em; display:flex; align-items:center; gap:8px; }
.sec-count{
  font-size:11px; font-weight:600; color:var(--text-3);
  background:var(--bg-sunken); border-radius:20px; padding:1px 7px;
  font-variant-numeric:tabular-nums;
}
.sec-head .sp{ flex:1; }

/* =========================================================
   Item list
   ========================================================= */
.items{
  border:1px solid var(--border); border-radius:var(--radius-lg);
  overflow:hidden; background:var(--bg); box-shadow:var(--shadow-xs);
}
.items + .items{ margin-top:12px; }

.item{
  display:flex; align-items:center; gap:12px;
  padding:11px 15px; cursor:pointer;
  border-bottom:1px solid var(--border);
  background:var(--bg);
  transition:background .11s;
  position:relative;
}
.item:last-child{ border-bottom:none; }
.item:hover{ background:var(--bg-subtle); }
.item::before{
  content:''; position:absolute; left:0; top:0; bottom:0; width:2.5px;
  background:transparent; transition:background .13s;
}
.item:hover::before{ background:var(--border-strong); }
.item.is-overdue::before{ background:var(--red); }

.item-status{ flex:none; width:20px; display:flex; justify-content:center; align-items:center; }
.sdot{
  width:9px; height:9px; border-radius:50%;
  border:2px solid currentColor; background:transparent;
}
.sdot.fill{ background:currentColor; }
.sdot.half{ background:linear-gradient(90deg,currentColor 50%,transparent 50%); }

.item-main{ flex:1; min-width:0; }
.item-title{
  font-size:13.5px; font-weight:550; letter-spacing:-0.008em;
  white-space:nowrap; overflow:hidden; text-overflow:ellipsis;
}
.item-title.done{ color:var(--text-3); text-decoration:line-through; text-decoration-color:var(--text-4); }
.item-meta{
  display:flex; align-items:center; gap:7px; margin-top:3px;
  font-size:11.5px; color:var(--text-3); min-width:0;
}
.item-meta .mm{ white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.item-meta .sp{ color:var(--text-4); }
.item-remark{
  color:var(--text-3); font-size:11.5px;
  white-space:nowrap; overflow:hidden; text-overflow:ellipsis;
  max-width:100%;
}

.item-side{ display:flex; align-items:center; gap:14px; flex:none; }
.item-col{
  display:flex; flex-direction:column; align-items:flex-end; gap:2px;
  min-width:84px;
}
.item-col-k{ font-size:10px; color:var(--text-4); text-transform:uppercase; letter-spacing:.05em; font-weight:600; }
.item-col-v{ font-size:12px; font-weight:500; font-variant-numeric:tabular-nums; white-space:nowrap; }
.item-col-v.late{ color:var(--red); font-weight:600; }
.item-col-v.soon{ color:var(--amber); font-weight:600; }
.item-col-v.muted{ color:var(--text-4); }

.item-pending{ display:flex; align-items:center; gap:6px; min-width:132px; }
.item-pending .pn{ font-size:12px; font-weight:500; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }

/* Empty state */
.empty{
  text-align:center; padding:52px 24px;
  border:1px dashed var(--border-strong); border-radius:var(--radius-lg);
  background:var(--bg-subtle);
}
/* The weave is the illustration — it does not want a box around it. */
.empty-ico{
  display:flex; justify-content:center;
  margin:0 auto 16px; color:var(--text-4);
}
.empty-t{ font-family:var(--font-display); font-size:19px; font-weight:400; letter-spacing:-0.004em; }
.empty-s{ color:var(--text-3); font-size:12.5px; margin-top:5px; max-width:340px; margin-inline:auto; line-height:1.6; }
.empty .btn{ margin-top:16px; }

/* =========================================================
   Filter bar
   ========================================================= */
.filters{
  display:flex; align-items:center; gap:7px; flex-wrap:wrap;
  margin-bottom:16px;
}
.fsel{
  display:inline-flex; align-items:center; gap:6px;
  height:30px; padding:0 9px; padding-right:26px;
  border:1px solid var(--border-strong); border-radius:var(--radius-sm);
  background:var(--bg); font-size:12.5px; font-weight:500; cursor:pointer;
  box-shadow:var(--shadow-xs);
  appearance:none; -webkit-appearance:none;
  background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 10 10'%3E%3Cpath d='M2.5 4L5 6.5 7.5 4' stroke='%2396928A' stroke-width='1.3' fill='none' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat:no-repeat; background-position:right 8px center;
  transition:border-color .13s, background-color .13s;
}
.fsel:hover{ border-color:#CFCCC4; }
/* Active filters read as "set", not as "alarm" — crimson is reserved
   for things that genuinely need attention. */
.fsel.active{ border-color:var(--ink); background-color:var(--bg-active); color:var(--ink); font-weight:600; }
.fsel.active{ background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 10 10'%3E%3Cpath d='M2.5 4L5 6.5 7.5 4' stroke='%23191E1C' stroke-width='1.6' fill='none' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E"); }

.seg{
  display:inline-flex; background:var(--bg-sunken);
  border-radius:var(--radius-sm); padding:2px; gap:2px;
}
.seg button{
  height:26px; padding:0 11px; border:none; background:none;
  border-radius:5px; font-size:12.5px; font-weight:550;
  color:var(--text-3); cursor:pointer;
  transition:background .13s, color .13s, box-shadow .13s;
}
.seg button:hover{ color:var(--text); }
.seg button.on{ background:var(--bg); color:var(--text); box-shadow:var(--shadow-xs); }

.filters-sp{ flex:1; }

/* =========================================================
   Theme group (line view)
   ========================================================= */
.theme-grp{ margin-bottom:22px; }
.theme-head{
  display:flex; align-items:center; gap:9px;
  padding:0 2px 9px;
}
.theme-ico{
  width:25px; height:25px; border-radius:7px; flex:none;
  display:grid; place-items:center; font-size:13px;
  background:var(--bg-sunken); border:1px solid var(--border);
}
.theme-name{ font-size:13.5px; font-weight:650; letter-spacing:-0.015em; }
.theme-head .sp{ flex:1; }

/* =========================================================
   Drawer
   ========================================================= */
.drawer-scrim{
  position:fixed; inset:0; background:rgba(26,25,23,.22); z-index:90;
  animation:fade .18s ease both;
  backdrop-filter:blur(1px);
}
.drawer{
  position:fixed; top:0; right:0; bottom:0; width:min(560px,100vw);
  background:var(--bg); border-left:1px solid var(--border);
  box-shadow:var(--shadow-lg); z-index:91;
  display:flex; flex-direction:column;
  animation:slide .3s var(--ease) both;
}
@keyframes fade{ from{opacity:0} to{opacity:1} }
@keyframes slide{ from{ transform:translateX(26px); opacity:0 } to{ transform:none; opacity:1 } }

.dr-head{
  display:flex; align-items:center; gap:9px;
  padding:13px 16px; border-bottom:1px solid var(--border); flex:none;
}
.dr-head .sp{ flex:1; }
.dr-crumb{ display:flex; align-items:center; gap:6px; font-size:11.5px; color:var(--text-3); min-width:0; }
.dr-crumb .dot{ width:7px; height:7px; border-radius:50%; flex:none; }
.dr-crumb span{ white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }

.dr-body{ flex:1; overflow-y:auto; padding:20px 22px 40px; }

.dr-title{
  font-family:var(--font-display); font-size:25px; font-weight:400; letter-spacing:-0.004em;
  line-height:1.3; width:100%; border:none; background:none;
  resize:none; outline:none; padding:0; margin-bottom:4px;
  font-family:var(--font); overflow:hidden;
}
.dr-title::placeholder{ color:var(--text-4); }

.dr-sub{ font-size:11.5px; color:var(--text-4); margin-bottom:20px; }

.props{ display:flex; flex-direction:column; gap:1px; margin-bottom:26px; }
.prop{
  display:flex; align-items:center; gap:12px;
  min-height:34px; padding:3px 7px; border-radius:var(--radius-sm);
  transition:background .12s;
}
.prop:hover{ background:var(--bg-subtle); }
.prop-k{
  width:122px; flex:none; font-size:12.5px; color:var(--text-3);
  display:flex; align-items:center; gap:7px; font-weight:500;
}
.prop-k svg{ opacity:.65; flex:none; }
.prop-v{ flex:1; min-width:0; }

.inline-sel{
  border:1px solid transparent; background:none;
  border-radius:6px; padding:3px 24px 3px 7px; margin-left:-7px;
  font-size:13px; font-weight:500; cursor:pointer; width:100%;
  appearance:none; -webkit-appearance:none;
  background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 10 10'%3E%3Cpath d='M2.5 4L5 6.5 7.5 4' stroke='%2396928A' stroke-width='1.3' fill='none' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat:no-repeat; background-position:right 7px center;
  transition:background-color .12s, border-color .12s;
}
.inline-sel:hover{ background-color:var(--bg-hover); border-color:var(--border); }

.inline-date{
  border:1px solid transparent; background:none; border-radius:6px;
  padding:3px 7px; margin-left:-7px; font-size:13px; font-weight:500;
  cursor:pointer; font-family:var(--font);
  transition:background-color .12s, border-color .12s;
}
.inline-date:hover{ background-color:var(--bg-hover); border-color:var(--border); }

.prop-person{
  display:flex; align-items:center; gap:8px;
  padding:3px 7px; margin-left:-7px; border-radius:6px;
  border:1px solid transparent; cursor:pointer; width:100%;
  background:none; text-align:left; font-size:13px; font-weight:500;
  transition:background-color .12s, border-color .12s;
}
.prop-person:hover{ background-color:var(--bg-hover); border-color:var(--border); }
.prop-person .nm{ flex:1; min-width:0; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.prop-person.none{ color:var(--text-4); }

/* Remarks / notes */
.dr-sec{ margin-top:26px; }
.dr-sec-head{
  display:flex; align-items:center; gap:8px; margin-bottom:12px;
  font-size:12px; font-weight:650; color:var(--text-3);
  text-transform:uppercase; letter-spacing:.06em;
}
.dr-sec-head .sp{ flex:1; }

.note-form{ margin-bottom:16px; }
.note-input{
  width:100%; min-height:72px; padding:11px 12px;
  border:1px solid var(--border); border-radius:var(--radius);
  background:var(--bg-subtle); font-family:var(--font); font-size:13px;
  resize:vertical; outline:none; line-height:1.6;
  transition:border-color .13s, background .13s, box-shadow .13s;
}
.note-input:focus{ background:var(--bg); border-color:var(--accent-border); box-shadow:0 0 0 3px var(--accent-soft); }
.note-input::placeholder{ color:var(--text-4); }
.note-bar{ display:flex; align-items:center; gap:8px; margin-top:8px; }
.note-bar .sp{ flex:1; }
.note-hint{ font-size:11px; color:var(--text-4); }

.notes{ display:flex; flex-direction:column; gap:2px; }
.note{
  display:flex; gap:11px; padding:10px 9px; border-radius:var(--radius);
  transition:background .12s; position:relative;
}
.note:hover{ background:var(--bg-subtle); }
.note-b{ flex:1; min-width:0; }
.note-h{ display:flex; align-items:baseline; gap:7px; margin-bottom:3px; }
.note-who{ font-size:12.5px; font-weight:600; }
.note-when{ font-size:11px; color:var(--text-4); }
.note-txt{ font-size:13px; color:var(--text-2); line-height:1.62; white-space:pre-wrap; word-break:break-word; }
.note-del{ opacity:0; transition:opacity .12s; }
.note:hover .note-del{ opacity:1; }

.note-sys .note-txt{ color:var(--text-3); font-size:12px; }
.note-sys-ico{
  width:26px; height:26px; border-radius:50%; flex:none;
  background:var(--bg-sunken); border:1px solid var(--border);
  display:grid; place-items:center; color:var(--text-4);
}

/* =========================================================
   Modal
   ========================================================= */
.modal-scrim{
  position:fixed; inset:0; z-index:120;
  background:rgba(26,25,23,.26);
  display:grid; place-items:center; padding:22px;
  animation:fade .16s ease both;
  backdrop-filter:blur(2px);
}
.modal{
  width:100%; max-width:480px; max-height:86vh; overflow-y:auto;
  background:var(--bg); border-radius:var(--radius-lg);
  box-shadow:var(--shadow-lg); border:1px solid var(--border);
  animation:pop .22s var(--ease) both;
}
.modal-lg{ max-width:620px; }
@keyframes pop{ from{ opacity:0; transform:translateY(8px) scale(.985) } to{ opacity:1; transform:none } }

.mo-head{
  display:flex; align-items:flex-start; gap:12px;
  padding:19px 20px 0;
}
.mo-head .sp{ flex:1; min-width:0; }
.mo-title{ font-family:var(--font-display); font-size:21px; font-weight:400; letter-spacing:-0.004em; }
.mo-sub{ font-size:12.5px; color:var(--text-3); margin-top:4px; line-height:1.6; }
.mo-body{ padding:18px 20px; }
.mo-foot{
  display:flex; align-items:center; gap:8px;
  padding:14px 20px; border-top:1px solid var(--border);
  background:var(--bg-subtle);
  border-radius:0 0 var(--radius-lg) var(--radius-lg);
}
.mo-foot .sp{ flex:1; }

/* Fields */
.field{ margin-bottom:15px; }
.field:last-child{ margin-bottom:0; }
.field-k{
  display:block; font-size:12px; font-weight:600;
  color:var(--text-2); margin-bottom:6px;
}
.field-hint{ font-size:11.5px; color:var(--text-4); margin-top:5px; line-height:1.55; }

.inp, .sel, .ta{
  width:100%; padding:8px 10px;
  border:1px solid var(--border-strong); border-radius:var(--radius-sm);
  background:var(--bg); font-size:13.5px; font-family:var(--font);
  outline:none;
  transition:border-color .13s, box-shadow .13s;
}
.inp:focus, .sel:focus, .ta:focus{
  border-color:var(--accent); box-shadow:0 0 0 3px var(--accent-soft);
}
.inp::placeholder, .ta::placeholder{ color:var(--text-4); }
.ta{ resize:vertical; min-height:76px; line-height:1.6; }
.sel{
  appearance:none; -webkit-appearance:none; cursor:pointer; padding-right:28px;
  background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 10 10'%3E%3Cpath d='M2.5 4L5 6.5 7.5 4' stroke='%2396928A' stroke-width='1.3' fill='none' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat:no-repeat; background-position:right 9px center;
}

.field-row{ display:grid; grid-template-columns:1fr 1fr; gap:12px; }

/* Colour picker */
.swatches{ display:flex; gap:7px; flex-wrap:wrap; }
.swatch{
  width:27px; height:27px; border-radius:50%; cursor:pointer;
  border:2px solid transparent; box-shadow:inset 0 0 0 1px rgba(0,0,0,.07);
  transition:transform .13s var(--ease);
  position:relative;
}
.swatch:hover{ transform:scale(1.12); }
.swatch.on{ border-color:var(--text); }

/* Picker list (person select) */
.picker{ max-height:290px; overflow-y:auto; margin:-4px -6px; padding:4px 6px; }
.pick{
  display:flex; align-items:center; gap:10px; width:100%;
  padding:8px 9px; border-radius:var(--radius-sm);
  border:none; background:none; cursor:pointer; text-align:left;
  transition:background .12s;
}
.pick:hover{ background:var(--bg-hover); }
.pick.on{ background:var(--bg-active); }
.pick .pm{ flex:1; min-width:0; }
.pick .pn{ font-size:13px; font-weight:550; }
.pick .pe{ font-size:11.5px; color:var(--text-3); white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.pick .tick{ color:var(--accent); flex:none; }

/* =========================================================
   People table
   ========================================================= */
.ppl{ display:flex; flex-direction:column; gap:1px; }
.prow{
  display:flex; align-items:center; gap:13px;
  padding:12px 15px; border:1px solid var(--border);
  border-radius:var(--radius); background:var(--bg);
  transition:border-color .13s, box-shadow .13s;
}
.prow:hover{ border-color:var(--border-strong); box-shadow:var(--shadow-xs); }
.prow .pm{ flex:1; min-width:0; }
.prow .pn{ font-size:13.5px; font-weight:600; display:flex; align-items:center; gap:7px; }
.prow .pe{ font-size:12px; color:var(--text-3); margin-top:2px; }
.prow .pw{ font-size:11.5px; color:var(--text-4); text-align:right; white-space:nowrap; font-variant-numeric:tabular-nums; }

.role-sel{ width:auto; min-width:104px; padding:5px 26px 5px 9px; font-size:12.5px; }

/* =========================================================
   Reminder digest
   ========================================================= */
.digest{
  border:1px solid var(--border); border-radius:var(--radius-lg);
  overflow:hidden; background:var(--bg); margin-bottom:14px;
  box-shadow:var(--shadow-xs);
}
.digest-head{
  display:flex; align-items:center; gap:11px;
  padding:13px 16px; background:var(--bg-subtle);
  border-bottom:1px solid var(--border);
}
.digest-head .dm{ flex:1; min-width:0; }
.digest-head .dn{ font-family:var(--font-display); font-size:18px; font-weight:400; letter-spacing:-0.004em; }
.digest-head .de{ font-size:11.5px; color:var(--text-3); margin-top:1px; }
.digest-body{ padding:4px 0; }
.digest-row{
  display:flex; align-items:center; gap:11px;
  padding:9px 16px; cursor:pointer; transition:background .11s;
}
.digest-row:hover{ background:var(--bg-subtle); }
.digest-row .dt{ flex:1; min-width:0; font-size:13px; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.digest-row .dd{ font-size:11.5px; font-variant-numeric:tabular-nums; white-space:nowrap; }

/* Preview box */
.preview{
  background:var(--bg-sunken); border:1px solid var(--border);
  border-radius:var(--radius); padding:13px 14px;
  font-size:12.5px; line-height:1.68; color:var(--text-2);
  white-space:pre-wrap; max-height:260px; overflow-y:auto;
  font-family:var(--font);
}

/* =========================================================
   Settings
   ========================================================= */
.set-grp{ margin-bottom:26px; }
.set-grp-t{ font-family:var(--font-display); font-size:19px; font-weight:400; margin-bottom:5px; letter-spacing:-0.004em; }
.set-grp-s{ font-size:12.5px; color:var(--text-3); margin-bottom:14px; line-height:1.6; max-width:620px; }

.note-box{
  border:1px solid var(--amber-border); background:var(--amber-soft);
  border-radius:var(--radius); padding:12px 14px;
  font-size:12.5px; color:#8A5209; line-height:1.65;
}
.note-box.info{ border-color:var(--blue-border); background:var(--blue-soft); color:#17457C; }
.note-box strong{ font-weight:650; }

.code{
  font-family:ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size:11.5px; background:var(--bg-sunken);
  border:1px solid var(--border); border-radius:var(--radius);
  padding:12px 13px; overflow-x:auto; white-space:pre;
  color:var(--text-2); line-height:1.6;
}

/* =========================================================
   Toasts
   ========================================================= */
.toasts{
  position:fixed; bottom:18px; left:50%; transform:translateX(-50%);
  z-index:300; display:flex; flex-direction:column; gap:8px;
  align-items:center; pointer-events:none;
}
.toast{
  display:flex; align-items:center; gap:9px;
  background:var(--text); color:#fff;
  padding:9px 15px; border-radius:20px;
  font-size:13px; font-weight:500;
  box-shadow:var(--shadow-lg);
  animation:toast .3s var(--ease) both;
  pointer-events:auto; max-width:min(440px,92vw);
}
.toast svg{ flex:none; opacity:.85; }
.toast.out{ animation:toastOut .22s ease both; }
.toast button{
  background:rgba(255,255,255,.16); border:none; color:#fff;
  border-radius:14px; padding:3px 10px; font-size:12px;
  font-weight:600; cursor:pointer; margin-left:3px;
}
.toast button:hover{ background:rgba(255,255,255,.26); }
@keyframes toast{ from{ opacity:0; transform:translateY(12px) scale(.96) } to{ opacity:1; transform:none } }
@keyframes toastOut{ to{ opacity:0; transform:translateY(8px) scale(.97) } }

/* =========================================================
   The weave — mark, rule, and the animation of both

   Every weave path carries pathLength="100", so a draw runs for
   the same duration whatever the real geometry.
   ========================================================= */

.weave{ display:block; overflow:visible; flex:none; }

.mark-tile{
  display:grid; place-items:center; flex:none;
  background:var(--ink); border-radius:23%;
  box-shadow:0 1px 2px rgba(25,30,28,.18);
}

/* Draw-on: the two strands lay themselves down, crimson a beat later. */
.weave .w-b, .weave .w-a{
  stroke-dasharray:100; stroke-dashoffset:100;
  animation:weave-draw 1.5s var(--ease) forwards;
}
.weave .w-a{ animation-delay:.18s; }
/* The over-strand only appears once both are down, or the knot
   assembles in the wrong order and looks broken mid-draw. */
.weave .w-knock, .weave .w-over{ opacity:0; animation:weave-reveal .01s 1.5s forwards; }

@keyframes weave-draw  { to{ stroke-dashoffset:0; } }
@keyframes weave-reveal{ to{ opacity:1; } }

/* The mark breathes: the knot tightens and loosens very slightly. */
.weave-live .w-b, .weave-live .w-over{
  animation:weave-draw 1.5s var(--ease) forwards, weave-breathe 7s 1.7s ease-in-out infinite;
}
.weave-live .w-over{ animation:weave-reveal .01s 1.5s forwards, weave-breathe 7s 1.7s ease-in-out infinite; }
.weave-live .w-a{
  animation:weave-draw 1.5s .18s var(--ease) forwards, weave-breathe 7s 1.7s ease-in-out infinite reverse;
}
@keyframes weave-breathe{
  0%,100%{ transform:translateY(0) }
  50%    { transform:translateY(.6px) }
}

/* Syncing: the knot pulses while data is in motion. */
.weave-mark.is-syncing path{ animation:weave-pulse 1.25s ease-in-out infinite; }
@keyframes weave-pulse{ 0%,100%{opacity:1} 50%{opacity:.3} }

/* Rules draw left to right, unhurried. */
.weave-rule .w-b, .weave-rule .w-a{ animation-duration:1.9s; }
.weave-rule .w-a{ animation-delay:.1s; }
.weave-rule .w-knock, .weave-rule .w-over{ animation-delay:1.9s; }

/* Empty states: the weave draws itself once and then breathes.
   An earlier version unravelled on a loop, which meant the illustration
   was simply absent for two seconds in every six — it read as broken. */
.weave-loop .w-b, .weave-loop .w-a{
  animation:weave-draw 2.2s var(--ease) forwards,
            weave-fade 5.5s 2.2s ease-in-out infinite;
}
.weave-loop .w-a{
  animation:weave-draw 2.2s .25s var(--ease) forwards,
            weave-fade 5.5s 2.45s ease-in-out infinite reverse;
}
.weave-loop .w-knock, .weave-loop .w-over{ display:none; }
@keyframes weave-fade{
  0%,100%{ opacity:1 }
  50%    { opacity:.55 }
}

/* A single line of business: one thread, drawn once. */
.line-glyph{ flex:none; display:block; }
.line-glyph path{
  stroke-dasharray:100; stroke-dashoffset:100;
  animation:weave-draw 1.1s var(--ease) forwards;
}

/* The sign-in backdrop: woven rules, stacked and barely there. */
.weave-field{
  position:absolute; inset:0; overflow:hidden;
  pointer-events:none; z-index:0;
}
.weave-field .band{
  position:absolute; left:50%; transform:translateX(-50%);
  width:min(1500px, 150vw);
}
.weave-field .weave{ width:100%; }

/* Item rows: the hover edge unspools from the middle. */
.item::before{
  transform:scaleY(.25);
  transform-origin:center;
  transition:background .13s, transform .22s var(--ease);
}
.item:hover::before{ transform:scaleY(1); }
.item.is-overdue::before{ transform:scaleY(1); }

/* A woven rule under a page title. */
.title-rule{ margin:11px 0 0; max-width:420px; }

/* =========================================================
   Scrim (mobile sidebar)
   ========================================================= */
.scrim{
  position:fixed; inset:0; background:rgba(26,25,23,.3);
  z-index:55; animation:fade .18s ease both;
}

/* =========================================================
   Responsive
   ========================================================= */
@media (max-width: 1080px){
  .item-col:nth-last-child(2){ display:none; }
}

@media (max-width: 900px){
  .sidebar{
    position:fixed; left:0; top:0; bottom:0;
    transform:translateX(-100%);
    transition:transform .28s var(--ease);
    box-shadow:var(--shadow-lg);
  }
  .sidebar.open{ transform:none; }
  .side-close{ display:inline-flex; font-size:20px; line-height:1; }
  .menu-btn{ display:inline-flex; }
  .page{ padding:22px 16px 90px; }
  .topbar{ padding:0 12px; }
  .search{ width:auto; }
  .search kbd{ display:none; }
}

@media (max-width: 720px){
  .item{ align-items:flex-start; padding:12px 14px; gap:10px; }
  .item-status{ margin-top:3px; }
  .item-side{
    display:none;
  }
  .item-meta{ flex-wrap:wrap; }
  .page-title{ font-size:21px; }
  .stat-grid{ grid-template-columns:repeat(2,1fr); gap:9px; }
  .stat{ padding:13px; }
  .stat-v{ font-size:23px; }
  .field-row{ grid-template-columns:1fr; }
  .prop-k{ width:98px; font-size:12px; }
  .dr-body{ padding:16px 15px 40px; }
  .search input{ font-size:16px; }
  .inp,.sel,.ta,.note-input{ font-size:16px; }
}

@media (max-width: 420px){
  .stat-grid{ grid-template-columns:1fr; }
}

@media (prefers-reduced-motion: reduce){
  *,*::before,*::after{
    animation-duration:.01ms !important;
    animation-iteration-count:1 !important;
    transition-duration:.01ms !important;
  }
}

@media print{
  .sidebar,.topbar,.toasts,.drawer,.drawer-scrim{ display:none !important; }
  .page{ padding:0; max-width:none; }
  .item{ break-inside:avoid; }
}
