/* ============================================================
   EICF Workspace · shared design system
   Tokens derived from the live eicf.org production CSS.
   See brand-spec.md for the extraction record.
   ============================================================ */

/* ---------- 1 · tokens ---------- */
:root{
  --brand:#fd4f01;
  --brand-hover:#fd4f02;
  --brand-strong:#f04a00;
  --brand-deep:#ad3300;
  --brand-soft:#fff0eb;
  --brand-line:#ffa286;
  --brand-on:#1e1c1b;

  --ink:#1e1c1b;
  --navy:#243238;
  --muted:#4a5565;
  --muted-strong:#364153;
  --surface:#f2f2f2;
  --surface-2:#f8f8f8;
  --surface-3:#fbfbfb;
  --line:#e6e6e6;
  --line-strong:#d6d6d6;
  --white:#fff;

  --ok-fg:#0f6b3f; --ok-bg:#e6f4ec;
  --warn-fg:#8a5300; --warn-bg:#fdf1dc;
  --err-fg:#a02020; --err-bg:#fbe9e9;
  --neutral-fg:#4a5565; --neutral-bg:#f2f2f2;

  --font-display:'Montserrat',system-ui,-apple-system,sans-serif;
  --font-body:'Open Sans',system-ui,-apple-system,sans-serif;
  --font-mono:ui-monospace,'SF Mono',Menlo,Consolas,monospace;

  --r-xs:6px; --r-sm:8px; --r-md:10px; --r-lg:14px; --r-pill:999px;
  --sh-1:0 1px 2px rgba(30,28,27,.05);
  --sh-2:0 6px 20px -8px rgba(30,28,27,.16);
  --sh-3:0 18px 48px -18px rgba(30,28,27,.28);

  --sidebar-w:264px;
  --topbar-h:60px;
  --ease:cubic-bezier(.2,.6,.2,1);
}

/* ---------- 2 · base ---------- */
*,*::before,*::after{box-sizing:border-box}
html,body{height:100%}
body{
  margin:0;
  font-family:var(--font-body);
  font-size:14px;
  line-height:1.55;
  color:var(--ink);
  background:var(--surface-3);
  -webkit-font-smoothing:antialiased;
  text-rendering:optimizeLegibility;
}
img{max-width:100%;display:block}
button,input,select,textarea{font:inherit;color:inherit}
button{background:none;border:0;padding:0;cursor:pointer}
a{color:var(--brand-deep);text-decoration:none}
h1,h2,h3,h4,h5{margin:0;font-family:var(--font-display);font-weight:700;line-height:1.25;color:var(--ink)}
p{margin:0}
ul,ol{margin:0;padding:0;list-style:none}
table{border-collapse:collapse;width:100%}
:focus-visible{
  outline:2px solid var(--brand);
  outline-offset:2px;
  border-radius:var(--r-xs);
}
::selection{background:var(--brand-soft);color:var(--ink)}
.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}

/* ---------- 3 · type helpers ---------- */
.micro{font-size:11px;font-weight:600;letter-spacing:.08em;text-transform:uppercase;color:var(--muted)}
.muted{color:var(--muted)}
.mono{font-family:var(--font-mono);font-size:12.5px;letter-spacing:-.1px}
.display-xl{font-family:var(--font-display);font-size:40px;font-weight:700;line-height:1.15;letter-spacing:-.02em}
.display-lg{font-family:var(--font-display);font-size:28px;font-weight:700;line-height:1.2;letter-spacing:-.015em}
.display-md{font-family:var(--font-display);font-size:20px;font-weight:700;line-height:1.3}
.title{font-size:15px;font-weight:600;line-height:1.4}
.label{font-size:13px;font-weight:500;line-height:1.4}
.caption{font-size:12px;line-height:1.45;color:var(--muted)}
.accent{color:var(--brand)}

/* the EICF heading rule — 52x3 orange bar under every heading */
.rule{position:relative}
.rule::after{content:'';display:block;width:52px;height:3px;background:var(--brand-hover);margin-top:6px;border-radius:2px}

/* ---------- 4 · buttons ---------- */
.btn{
  display:inline-flex;align-items:center;justify-content:center;gap:8px;
  height:38px;padding:0 16px;border-radius:var(--r-md);
  font-size:13.5px;font-weight:600;white-space:nowrap;
  border:1px solid transparent;
  transition:background-color .18s var(--ease),border-color .18s var(--ease),color .18s var(--ease),box-shadow .18s var(--ease),transform .18s var(--ease);
}
.btn svg{width:16px;height:16px;flex:none}
.btn--primary{background:var(--brand);color:var(--brand-on);border-color:var(--brand)}
.btn--primary:hover{background:var(--brand-strong);border-color:var(--brand-strong)}
.btn--primary:active{background:var(--brand-deep);border-color:var(--brand-deep);color:var(--white)}
.btn--ghost{background:var(--white);color:var(--ink);border-color:var(--line-strong)}
.btn--ghost:hover{background:var(--surface-2);border-color:var(--brand-line);color:var(--ink)}
.btn--ghost:active{background:var(--surface)}
.btn--quiet{background:transparent;color:var(--muted-strong);padding:0 10px}
.btn--quiet:hover{background:var(--surface);color:var(--ink)}
.btn--dark{background:var(--ink);color:var(--white);border-color:var(--ink)}
.btn--dark:hover{background:var(--navy);border-color:var(--navy);color:var(--white)}
.btn--sm{height:32px;padding:0 12px;font-size:12.5px;border-radius:var(--r-sm)}
.btn--danger{background:var(--white);color:var(--err-fg);border-color:var(--line-strong)}
.btn--danger:hover{background:var(--err-bg);border-color:var(--err-fg);color:var(--err-fg)}
.btn[disabled],.btn[aria-disabled="true"]{opacity:.45;cursor:not-allowed}
.btn--icon{width:38px;padding:0}
.btn--icon.btn--sm{width:32px}

/* icon button: quiet, only reveals affordance on hover but keeps contrast */
.iconbtn{
  display:inline-flex;align-items:center;justify-content:center;
  width:28px;height:28px;border-radius:var(--r-sm);
  color:var(--muted);transition:background-color .18s var(--ease),color .18s var(--ease);
}
.iconbtn svg{width:15px;height:15px}
.iconbtn:hover{background:var(--surface);color:var(--ink)}
.iconbtn--danger:hover{background:var(--err-bg);color:var(--err-fg)}

/* ---------- 5 · fields ---------- */
.field{display:flex;flex-direction:column;gap:6px}
.field__label{font-size:12.5px;font-weight:600;color:var(--muted-strong)}
.field__hint{font-size:11.5px;color:var(--muted)}
.field__error{font-size:11.5px;font-weight:500;color:var(--err-fg);display:none}
.field.is-invalid .field__error{display:block}
.input,.select,.textarea{
  width:100%;height:38px;padding:0 12px;
  background:var(--white);border:1px solid var(--line-strong);border-radius:var(--r-sm);
  font-size:13.5px;color:var(--ink);
  transition:border-color .18s var(--ease),box-shadow .18s var(--ease);
}
.textarea{height:auto;min-height:88px;padding:10px 12px;resize:vertical;line-height:1.5}
.select{appearance:none;padding-right:34px;cursor:pointer;
  background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%234a5565' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat:no-repeat;background-position:right 10px center;background-size:15px}
.input::placeholder,.textarea::placeholder{color:#8a93a1}
.input:hover,.select:hover,.textarea:hover{border-color:var(--brand-line)}
.input:focus,.select:focus,.textarea:focus{outline:none;border-color:var(--brand);box-shadow:0 0 0 3px var(--brand)}
.field.is-invalid .input,.field.is-invalid .select,.field.is-invalid .textarea{border-color:var(--err-fg)}
.field.is-invalid .input:focus,.field.is-invalid .select:focus{border-color:var(--err-fg);box-shadow:0 0 0 3px var(--err-bg)}
.input-wrap{position:relative;display:flex;align-items:center}
.input-wrap>svg{position:absolute;left:11px;width:16px;height:16px;color:var(--muted);pointer-events:none}
.input-wrap .input{padding-left:34px}

.switch{position:relative;display:inline-flex;align-items:center;gap:10px;cursor:pointer}
.switch input{position:absolute;opacity:0;width:0;height:0}
.switch__track{width:40px;height:22px;border-radius:var(--r-pill);background:var(--line-strong);transition:background-color .18s var(--ease);flex:none;position:relative}
.switch__track::after{content:'';position:absolute;top:2px;left:2px;width:18px;height:18px;border-radius:50%;background:var(--white);box-shadow:var(--sh-1);transition:transform .18s var(--ease)}
.switch input:checked+.switch__track{background:var(--brand)}
.switch input:checked+.switch__track::after{transform:translateX(18px)}
.switch input:focus-visible+.switch__track{outline:2px solid var(--brand);outline-offset:2px}
.switch__label{font-size:13px;color:var(--ink)}

.checkbox{width:16px;height:16px;accent-color:var(--brand);cursor:pointer}

/* ---------- 6 · chips ---------- */
.chip{
  display:inline-flex;align-items:center;gap:6px;height:24px;padding:0 9px;
  border-radius:var(--r-xs);font-size:11.5px;font-weight:600;white-space:nowrap;
  background:var(--neutral-bg);color:var(--neutral-fg);
}
.chip__dot{width:6px;height:6px;border-radius:50%;background:currentColor;flex:none}
.chip--ok{background:var(--ok-bg);color:var(--ok-fg)}
.chip--warn{background:var(--warn-bg);color:var(--warn-fg)}
.chip--err{background:var(--err-bg);color:var(--err-fg)}
.chip--brand{background:var(--brand-soft);color:var(--brand-deep)}

/* ---------- 7 · app shell ---------- */
.app{display:grid;grid-template-columns:var(--sidebar-w) 1fr;min-height:100vh}
.sidebar{
  position:sticky;top:0;height:100vh;display:flex;flex-direction:column;
  background:var(--white);border-right:1px solid var(--line);overflow:hidden;
}
.sidebar__brand{display:flex;align-items:center;gap:12px;padding:18px 18px 16px}
.sidebar__brand img{height:34px;width:auto;flex:none}
.sidebar__brand .micro{line-height:1.25;letter-spacing:.06em}
.sidebar__scroll{flex:1;overflow-y:auto;overscroll-behavior:contain;padding:0 10px 8px}
.sidebar__scroll::-webkit-scrollbar{width:8px}
.sidebar__scroll::-webkit-scrollbar-thumb{background:var(--line);border-radius:8px;border:2px solid var(--white)}
.sidebar__foot{border-top:1px solid var(--line);padding:10px}

.navitem{
  display:flex;align-items:center;gap:10px;width:100%;
  padding:8px 10px;border-radius:var(--r-sm);
  font-size:13.5px;color:var(--muted-strong);text-align:left;
  transition:background-color .16s var(--ease),color .16s var(--ease);
}
.navitem svg{width:17px;height:17px;flex:none;color:var(--muted);transition:color .16s var(--ease)}
.navitem:hover{background:var(--surface-2);color:var(--ink)}
.navitem:hover svg{color:var(--ink)}
.navitem.is-active{background:var(--brand-soft);color:var(--ink);font-weight:600}
.navitem.is-active svg{color:var(--brand-deep)}
.navitem__count{margin-left:auto;font-size:11px;font-weight:600;color:var(--muted);
  background:var(--surface);border-radius:var(--r-pill);padding:1px 7px}
.navitem.is-active .navitem__count{background:var(--white);color:var(--brand-deep)}
.navitem__chev{margin-left:auto;width:14px!important;height:14px!important;color:var(--muted)}

.sidegroup{margin-top:18px}
.sidegroup__head{display:flex;align-items:center;justify-content:space-between;padding:0 10px 8px}
.sidegroup__head .micro{color:var(--muted)}
.sidegroup__count{font-size:11px;font-weight:600;color:var(--muted)}

.conv{
  display:flex;align-items:center;gap:9px;width:100%;
  padding:7px 10px;border-radius:var(--r-sm);
  font-size:13px;color:var(--muted-strong);text-align:left;
  transition:background-color .16s var(--ease),color .16s var(--ease);
}
.conv svg{width:14px;height:14px;flex:none;color:#9aa3b0}
.conv__text{flex:1;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.conv__x{width:20px;height:20px;flex:none;border-radius:var(--r-xs);color:#9aa3b0;
  display:inline-flex;align-items:center;justify-content:center;opacity:0;transition:opacity .16s var(--ease),background-color .16s var(--ease),color .16s var(--ease)}
.conv__x svg{width:12px;height:12px}
.conv:hover{background:var(--surface-2);color:var(--ink)}
.conv:hover .conv__x{opacity:1}
.conv__x:hover{background:var(--line);color:var(--ink)}
.conv.is-active{background:var(--surface);color:var(--ink);font-weight:600}

.sidefoot{display:flex;flex-direction:column;gap:2px}
.sidestatus{display:flex;align-items:center;gap:8px;padding:8px 10px;font-size:12px;color:var(--muted-strong)}
.sidestatus__dot{width:7px;height:7px;border-radius:50%;background:#128a4a;flex:none;box-shadow:0 0 0 3px #e6f4ec}

.main{min-width:0;display:flex;flex-direction:column}
.topbar{
  position:sticky;top:0;z-index:30;height:var(--topbar-h);
  display:flex;align-items:center;gap:16px;padding:0 24px;
  background:rgba(255,255,255,.92);backdrop-filter:blur(8px);
  border-bottom:1px solid var(--line);
}
.crumbs{display:flex;align-items:center;gap:8px;font-size:13px;color:var(--muted);min-width:0}
.crumbs svg{width:14px;height:14px;color:#9aa3b0;flex:none}
.crumbs__sep{color:#c3c9d2}
.crumbs__current{color:var(--ink);font-weight:600;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.topbar__spacer{flex:1}
.topbar__right{display:flex;align-items:center;gap:10px;flex:none}

.pill{
  display:inline-flex;align-items:center;gap:7px;height:34px;padding:0 10px 0 11px;
  border:1px solid var(--line-strong);border-radius:var(--r-sm);background:var(--white);
  font-size:12.5px;color:var(--muted-strong);max-width:280px;
  transition:border-color .18s var(--ease),background-color .18s var(--ease);
}
.pill:hover{border-color:var(--brand-line);background:var(--surface-2)}
.pill__label{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.pill__mono{font-family:var(--font-mono);font-size:11.5px;color:var(--muted);letter-spacing:-.2px}
.pill svg{width:14px;height:14px;color:var(--muted);flex:none}
.pill__chev{width:13px!important;height:13px!important}

.menu{
  position:absolute;z-index:60;min-width:250px;padding:6px;
  background:var(--white);border:1px solid var(--line);border-radius:var(--r-md);box-shadow:var(--sh-3);
  animation:menuIn .14s var(--ease);
}
@keyframes menuIn{from{opacity:0;transform:translateY(-4px)}to{opacity:1;transform:none}}
.menu__label{padding:8px 10px 6px}
.menu__item{
  display:flex;align-items:center;gap:9px;width:100%;padding:8px 10px;border-radius:var(--r-sm);
  font-size:13px;color:var(--muted-strong);text-align:left;
  transition:background-color .14s var(--ease),color .14s var(--ease);
}
.menu__item svg{width:15px;height:15px;color:var(--muted);flex:none}
.menu__item:hover{background:var(--surface-2);color:var(--ink)}
.menu__item:hover svg{color:var(--ink)}
.menu__item.is-active{background:var(--brand-soft);color:var(--ink);font-weight:600}
.menu__item.is-active svg{color:var(--brand-deep)}
.menu__item.is-danger{color:var(--err-fg)}
.menu__item.is-danger svg{color:var(--err-fg)}
.menu__item.is-danger:hover{background:var(--err-bg);color:var(--err-fg)}
.menu__sep{height:1px;background:var(--line);margin:6px 4px}

/* ---------- 8 · chat workspace ---------- */
.chat{flex:1;display:flex;flex-direction:column;min-height:0}
.chat__stage{flex:1;display:flex;flex-direction:column;justify-content:flex-end;min-height:0;padding:0 24px}
.chat__inner{width:100%;max-width:828px;margin:0 auto}

.empty{text-align:center;padding:40px 0 26px}
.empty__logo{display:flex;justify-content:center;margin-bottom:22px}
.empty__logo img{height:72px;width:auto}
.empty__tag{font-size:11px;font-weight:600;letter-spacing:.18em;text-transform:uppercase;color:var(--brand);margin-bottom:12px}
.empty__title{font-family:var(--font-display);font-size:40px;font-weight:700;line-height:1.15;letter-spacing:-.02em;color:var(--ink)}
.empty__sub{max-width:540px;margin:14px auto 0;font-size:15px;line-height:1.6;color:var(--muted)}
.empty__grid{display:grid;grid-template-columns:1fr 1fr;gap:12px;max-width:576px;margin:26px auto 0;text-align:left}
.suggest{
  display:flex;align-items:center;gap:12px;padding:14px 15px;
  background:var(--white);border:1px solid var(--line);border-radius:var(--r-md);
  transition:border-color .18s var(--ease),box-shadow .18s var(--ease),transform .18s var(--ease);
}
.suggest:hover{border-color:var(--brand-line);box-shadow:var(--sh-2);transform:translateY(-1px)}
.suggest__icon{width:34px;height:34px;flex:none;border-radius:var(--r-sm);background:var(--surface);
  display:flex;align-items:center;justify-content:center;color:var(--navy);
  transition:background-color .18s var(--ease),color .18s var(--ease)}
.suggest__icon svg{width:17px;height:17px}
.suggest:hover .suggest__icon{background:var(--brand-soft);color:var(--brand-deep)}
.suggest__label{flex:1;font-size:13.5px;font-weight:600;color:var(--ink)}
.suggest__go{width:15px;height:15px;color:#9aa3b0;flex:none;transition:color .18s var(--ease),transform .18s var(--ease)}
.suggest:hover .suggest__go{color:var(--brand);transform:translate(2px,-2px)}

.composer{padding:0 24px 20px}
.composer__inner{max-width:828px;margin:0 auto}
.composer__box{
  background:var(--white);border:1px solid var(--line-strong);border-radius:var(--r-lg);
  box-shadow:var(--sh-2);transition:border-color .18s var(--ease),box-shadow .18s var(--ease);
}
.composer__box:focus-within{border-color:var(--brand);box-shadow:var(--sh-2),0 0 0 3px var(--brand)}
.composer__input{
  width:100%;border:0;outline:none;resize:none;background:none;
  padding:16px 18px 6px;font-size:14.5px;line-height:1.55;color:var(--ink);max-height:180px;
}
.composer__input::placeholder{color:#8a93a1}
.composer__bar{display:flex;align-items:center;gap:4px;padding:6px 10px 10px 12px}
.composer__tool{
  display:inline-flex;align-items:center;gap:7px;height:32px;padding:0 10px;border-radius:var(--r-sm);
  font-size:12.5px;font-weight:500;color:var(--muted-strong);
  transition:background-color .18s var(--ease),color .18s var(--ease);
}
.composer__tool svg{width:15px;height:15px;color:var(--muted);transition:color .18s var(--ease)}
.composer__tool:hover{background:var(--surface-2);color:var(--ink)}
.composer__tool:hover svg{color:var(--brand)}
.composer__spacer{flex:1}
.composer__send{
  width:36px;height:36px;border-radius:50%;flex:none;
  display:inline-flex;align-items:center;justify-content:center;
  background:var(--brand);color:var(--brand-on);
  transition:background-color .18s var(--ease),transform .18s var(--ease);
}
.composer__send svg{width:18px;height:18px}
.composer__send:hover{background:var(--brand-strong)}
.composer__send:active{transform:scale(.94)}
.composer__send[disabled]{opacity:.4;cursor:not-allowed}
.composer__note{max-width:828px;margin:10px auto 0;text-align:center;font-size:11.5px;color:var(--muted)}

.messages{max-width:828px;margin:0 auto;width:100%;padding:26px 0 8px;display:flex;flex-direction:column;gap:18px}
.msg{display:flex;gap:13px}
.msg__avatar{
  width:30px;height:30px;flex:none;border-radius:var(--r-sm);
  display:flex;align-items:center;justify-content:center;
  font-family:var(--font-display);font-size:12px;font-weight:700;letter-spacing:.02em;
}
.msg__avatar--user{background:var(--surface);color:var(--muted-strong)}
.msg__avatar--ai{background:var(--brand);color:var(--brand-on)}
.msg__body{flex:1;min-width:0}
.msg__who{font-size:12px;font-weight:600;color:var(--muted);margin-bottom:4px}
.msg__text{font-size:14.5px;line-height:1.65;color:var(--ink)}
.msg__text p+p{margin-top:10px}
.msg__sources{display:flex;flex-wrap:wrap;gap:8px;margin-top:11px}
.source{
  display:inline-flex;align-items:center;gap:6px;height:26px;padding:0 10px;
  border:1px solid var(--line);border-radius:var(--r-xs);background:var(--surface-3);
  font-size:11.5px;color:var(--muted-strong);
  transition:border-color .18s var(--ease),color .18s var(--ease);
}
.source:hover{border-color:var(--brand-line);color:var(--ink)}
.source svg{width:12px;height:12px;color:var(--muted)}

.typing{display:inline-flex;gap:4px;align-items:center;height:22px}
.typing i{width:6px;height:6px;border-radius:50%;background:#b6bdc7;animation:blink 1.2s infinite}
.typing i:nth-child(2){animation-delay:.18s}
.typing i:nth-child(3){animation-delay:.36s}
@keyframes blink{0%,60%,100%{opacity:.25;transform:translateY(0)}30%{opacity:1;transform:translateY(-2px)}}

/* ---------- 9 · admin ---------- */
.page{padding:26px 24px 48px}
.page__inner{max-width:1160px;margin:0 auto}
.page__head{display:flex;align-items:flex-start;gap:20px;flex-wrap:wrap;margin-bottom:22px}
.page__head .rule{margin-bottom:16px}
.page__lede{max-width:620px;font-size:13.5px;color:var(--muted);margin-top:8px}
.page__actions{margin-left:auto;display:flex;gap:10px;flex:none}

.tabs{display:flex;gap:2px;border-bottom:1px solid var(--line);margin-bottom:22px}
.tab{
  position:relative;display:inline-flex;align-items:center;gap:8px;
  padding:11px 14px;font-size:13.5px;font-weight:600;color:var(--muted);
  transition:color .18s var(--ease);
}
.tab svg{width:16px;height:16px;color:var(--muted);transition:color .18s var(--ease)}
.tab:hover{color:var(--ink)}
.tab:hover svg{color:var(--ink)}
.tab.is-active{color:var(--ink)}
.tab.is-active svg{color:var(--brand-deep)}
.tab.is-active::after{content:'';position:absolute;left:8px;right:8px;bottom:-1px;height:2px;background:var(--brand);border-radius:2px}
.tab__badge{margin-left:2px;font-size:11px;font-weight:600;color:var(--muted);background:var(--surface);border-radius:var(--r-pill);padding:1px 7px}
.tab.is-active .tab__badge{background:var(--brand-soft);color:var(--brand-deep)}

.stats{display:grid;grid-template-columns:repeat(4,1fr);gap:12px;margin-bottom:20px}
.stat{background:var(--white);border:1px solid var(--line);border-radius:var(--r-md);padding:15px 16px}
.stat__label{display:flex;align-items:center;gap:7px;font-size:11.5px;font-weight:600;letter-spacing:.05em;text-transform:uppercase;color:var(--muted)}
.stat__label svg{width:14px;height:14px;color:var(--muted)}
.stat__value{font-family:var(--font-display);font-size:28px;font-weight:700;line-height:1.2;margin-top:8px;color:var(--ink);letter-spacing:-.01em}
.stat__value small{font-family:var(--font-body);font-size:12px;font-weight:500;color:var(--muted);letter-spacing:0;margin-left:4px}
.stat__delta{margin-top:4px;font-size:11.5px;color:var(--muted)}
.stat__delta strong{color:var(--ok-fg);font-weight:600}

.panel{background:var(--white);border:1px solid var(--line);border-radius:var(--r-md);overflow:hidden}
.panel__head{display:flex;align-items:center;gap:12px;padding:14px 16px;border-bottom:1px solid var(--line);flex-wrap:wrap}
.panel__head h3{font-size:14.5px}
.panel__head .spacer{flex:1}
.panel__body{padding:16px}

.toolbar{display:flex;align-items:center;gap:10px;padding:12px 16px;border-bottom:1px solid var(--line);flex-wrap:wrap;background:var(--surface-3)}
.toolbar .input-wrap{flex:1;min-width:200px}
.toolbar .input,.toolbar .select{height:34px;font-size:13px}
.toolbar .select{width:auto;min-width:150px}

.bulkbar{
  display:none;align-items:center;gap:12px;padding:10px 16px;
  background:var(--brand-soft);border-bottom:1px solid var(--brand-line);font-size:13px;color:var(--ink);
}
.bulkbar.is-on{display:flex}
.bulkbar strong{font-weight:700}
.bulkbar .spacer{flex:1}
.bulkbar .btn{height:30px}

.tablewrap{position:relative;overflow-x:auto}
.tbl{min-width:760px;font-size:13px}
.tbl thead th{
  padding:9px 16px;text-align:left;font-size:11px;font-weight:600;letter-spacing:.06em;text-transform:uppercase;
  color:var(--muted);background:var(--surface-3);border-bottom:1px solid var(--line);white-space:nowrap;
}
.tbl tbody td{padding:11px 16px;border-bottom:1px solid var(--line);color:var(--muted-strong);vertical-align:middle}
.tbl tbody tr:last-child td{border-bottom:0}
.tbl tbody tr:hover{background:var(--surface-3)}
.tbl .col-check{width:40px;padding-right:0}
.tbl .col-act{width:52px;text-align:right}
.tbl tbody tr.is-off td{opacity:.62}

.user{display:flex;align-items:center;gap:10px;min-width:0}
.avatar{
  width:32px;height:32px;flex:none;border-radius:50%;
  display:flex;align-items:center;justify-content:center;
  font-family:var(--font-display);font-size:11.5px;font-weight:700;color:var(--brand-on);
  background:var(--brand-soft);letter-spacing:.01em;
}
.avatar--navy{background:var(--navy);color:var(--white)}
.avatar--ink{background:var(--ink);color:var(--white)}
.user__name{font-size:13.5px;font-weight:600;color:var(--ink);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.user__mail{font-size:12px;color:var(--muted);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}

.empty-row{padding:44px 16px;text-align:center}
.empty-row__icon{width:44px;height:44px;margin:0 auto 12px;border-radius:var(--r-md);background:var(--surface);display:flex;align-items:center;justify-content:center;color:var(--muted)}
.empty-row__icon svg{width:21px;height:21px}
.empty-row h4{font-family:var(--font-body);font-size:14px;font-weight:600;margin-bottom:4px}
.empty-row p{font-size:13px;color:var(--muted)}

.pager{display:flex;align-items:center;gap:10px;padding:12px 16px;border-top:1px solid var(--line);background:var(--surface-3)}
.pager__info{font-size:12.5px;color:var(--muted)}
.pager .spacer{flex:1}

/* upload */
.drop{
  border:1.5px dashed var(--line-strong);border-radius:var(--r-md);
  background:var(--surface-3);padding:30px 24px;text-align:center;
  transition:border-color .18s var(--ease),background-color .18s var(--ease);
  cursor:pointer;
}
.drop:hover{border-color:var(--brand-line);background:var(--white)}
.drop.is-over{border-color:var(--brand);background:var(--brand-soft)}
.drop__icon{width:46px;height:46px;margin:0 auto 12px;border-radius:50%;background:var(--white);
  border:1px solid var(--line);display:flex;align-items:center;justify-content:center;color:var(--brand)}
.drop__icon svg{width:21px;height:21px}
.drop h4{font-family:var(--font-body);font-size:14.5px;font-weight:600;margin-bottom:5px}
.drop p{font-size:12.5px;color:var(--muted)}
.drop p b{color:var(--muted-strong);font-weight:600}

.filelist{margin-top:14px;display:flex;flex-direction:column;gap:8px}
.filerow{
  display:flex;align-items:center;gap:12px;padding:10px 12px;
  background:var(--white);border:1px solid var(--line);border-radius:var(--r-sm);
}
.filerow__icon{width:32px;height:32px;flex:none;border-radius:var(--r-xs);background:var(--surface);
  display:flex;align-items:center;justify-content:center;color:var(--muted-strong)}
.filerow__icon svg{width:16px;height:16px}
.filerow__main{flex:1;min-width:0}
.filerow__name{font-size:13px;font-weight:600;color:var(--ink);overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.filerow__meta{font-size:11.5px;color:var(--muted);margin-top:1px}
.filerow__progress{height:4px;border-radius:2px;background:var(--surface);margin-top:7px;overflow:hidden}
.filerow__progress i{display:block;height:100%;background:var(--brand);border-radius:2px;transition:width .25s var(--ease)}

.docname{display:flex;align-items:center;gap:10px;min-width:0}
.docname__icon{width:28px;height:28px;flex:none;border-radius:var(--r-xs);background:var(--surface);display:flex;align-items:center;justify-content:center;color:var(--muted-strong)}
.docname__icon svg{width:15px;height:15px}
.docname__text{min-width:0}
.docname__title{font-size:13px;font-weight:600;color:var(--ink);overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.docname__sub{font-size:11.5px;color:var(--muted)}

/* admin drawer lists */
.activitylist{display:flex;flex-direction:column;gap:2px}
.activity{display:flex;gap:11px;align-items:flex-start;padding:11px 2px;border-bottom:1px solid var(--line)}
.activity:last-child{border-bottom:0}
.activity__dot{width:7px;height:7px;margin-top:6px;flex:none;border-radius:50%;background:var(--brand)}
.activity__text{font-size:13px;color:var(--ink);line-height:1.45}
.activity .caption{margin-top:2px;font-family:var(--font-mono);font-size:11px}

.keylist{display:flex;flex-direction:column;gap:10px}
.keyrow{display:flex;align-items:flex-start;gap:12px;padding:13px;border:1px solid var(--line);border-radius:var(--r-sm);background:var(--white)}
.keyrow__main{flex:1;min-width:0}
.keyrow__label{font-size:13.5px;font-weight:600;color:var(--ink)}
.keyrow__value{margin:4px 0 5px}
.keyrow__value code{font-family:var(--font-mono);font-size:11.5px;color:var(--muted-strong);background:var(--surface);padding:3px 7px;border-radius:var(--r-xs);word-break:break-all}
.keyrow__acts{display:flex;gap:4px;flex:none}

.checklist{display:flex;flex-direction:column;gap:2px}
.checklist__row{display:flex;gap:12px;align-items:flex-start;padding:12px 2px;border-bottom:1px solid var(--line)}
.checklist__row:last-child{border-bottom:0}
.checklist__icon{color:var(--ok-fg);flex:none;display:flex;margin-top:1px}
.checklist__icon svg{width:18px;height:18px}
.checklist__step{width:24px;height:24px;flex:none;border-radius:50%;background:var(--brand-soft);color:var(--brand-deep);
  font-size:12px;font-weight:700;display:flex;align-items:center;justify-content:center}
.checklist__title{font-size:13.5px;font-weight:600;color:var(--ink)}

.profilelist{display:flex;flex-direction:column;gap:0;margin:0}
.profilelist__row{display:flex;gap:16px;padding:11px 2px;border-bottom:1px solid var(--line)}
.profilelist__row:last-child{border-bottom:0}
.profilelist dt{font-size:12.5px;color:var(--muted);width:150px;flex:none}
.profilelist dd{margin:0;font-size:13px;color:var(--ink);font-weight:500;word-break:break-word}

/* ---------- 10 · overlays ---------- */
.scrim{position:fixed;inset:0;z-index:70;background:rgba(30,28,27,.42);
  display:flex;align-items:center;justify-content:center;padding:24px;animation:fadeIn .16s var(--ease)}
@keyframes fadeIn{from{opacity:0}to{opacity:1}}
.modal{
  width:100%;max-width:520px;max-height:calc(100vh - 48px);display:flex;flex-direction:column;
  background:var(--white);border-radius:var(--r-lg);box-shadow:var(--sh-3);
  animation:modalIn .2s var(--ease);
}
.modal--sm{max-width:420px}
@keyframes modalIn{from{opacity:0;transform:translateY(10px) scale(.985)}to{opacity:1;transform:none}}
.modal__head{display:flex;align-items:flex-start;gap:14px;padding:18px 20px 14px;border-bottom:1px solid var(--line)}
.modal__head h3{font-size:16px}
.modal__head p{font-size:12.5px;color:var(--muted);margin-top:3px}
.modal__body{padding:18px 20px;overflow-y:auto}
.modal__foot{display:flex;align-items:center;gap:10px;padding:14px 20px;border-top:1px solid var(--line);background:var(--surface-3)}
.modal__foot .spacer{flex:1}
.formgrid{display:flex;flex-direction:column;gap:14px}
.formrow{display:grid;grid-template-columns:1fr 1fr;gap:14px}

.drawer{position:fixed;top:0;right:0;bottom:0;z-index:70;width:min(460px,92vw);
  background:var(--white);border-left:1px solid var(--line);box-shadow:var(--sh-3);
  display:flex;flex-direction:column;animation:drawerIn .24s var(--ease)}
@keyframes drawerIn{from{transform:translateX(100%)}to{transform:none}}
.drawer__head{display:flex;align-items:flex-start;gap:12px;padding:16px 18px;border-bottom:1px solid var(--line)}
.drawer__head h3{font-size:15px}
.drawer__head p{font-size:12px;color:var(--muted);margin-top:3px;word-break:break-word}
.drawer__body{flex:1;overflow-y:auto;padding:16px 18px}
.drawer__foot{padding:12px 18px;border-top:1px solid var(--line);background:var(--surface-3)}

.chunk{border:1px solid var(--line);border-radius:var(--r-sm);padding:12px;margin-bottom:10px;background:var(--white)}
.chunk__head{display:flex;align-items:center;gap:8px;margin-bottom:7px}
.chunk__id{font-family:var(--font-mono);font-size:11px;color:var(--muted)}
.chunk__page{margin-left:auto;font-size:11px;color:var(--muted)}
.chunk__text{font-size:12.5px;line-height:1.6;color:var(--muted-strong)}

.toasts{position:fixed;right:20px;bottom:20px;z-index:90;display:flex;flex-direction:column;gap:8px;pointer-events:none}
.toast{
  display:flex;align-items:center;gap:10px;padding:11px 14px;min-width:260px;max-width:380px;
  background:var(--ink);color:var(--white);border-radius:var(--r-sm);box-shadow:var(--sh-3);
  font-size:13px;animation:toastIn .22s var(--ease);pointer-events:auto;
}
@keyframes toastIn{from{opacity:0;transform:translateY(8px)}to{opacity:1;transform:none}}
.toast svg{width:16px;height:16px;flex:none}
.toast--ok svg{color:#5fd39a}
.toast--err svg{color:#ff8b8b}
.toast__text{flex:1}
.toast__undo{color:#ffb27a;font-weight:600;font-size:12.5px}
.toast__undo:hover{text-decoration:underline}

.notice{display:flex;align-items:flex-start;gap:10px;padding:10px 13px;border-radius:var(--r-sm);
  background:var(--surface);border:1px solid var(--line);font-size:12.5px;color:var(--muted-strong);margin-bottom:16px}
.notice svg{width:16px;height:16px;flex:none;color:var(--muted);margin-top:1px}
.notice b{color:var(--ink);font-weight:600}

/* ---------- 11 · responsive ---------- */
@media (max-width:1100px){
  .stats{grid-template-columns:repeat(2,1fr)}
}
@media (max-width:920px){
  .app{grid-template-columns:1fr}
  .sidebar{position:fixed;z-index:80;top:0;left:0;width:284px;transform:translateX(-100%);
    transition:transform .24s var(--ease);box-shadow:var(--sh-3)}
  .sidebar.is-open{transform:none}
  .menu-toggle{display:inline-flex!important}
  .page{padding:18px 16px 40px}
  .chat__stage,.composer{padding-left:16px;padding-right:16px}
  .empty__grid{grid-template-columns:1fr}
  .display-xl,.empty__title{font-size:32px}
}
.menu-toggle{display:none}
@media (max-width:640px){
  .stats{grid-template-columns:1fr}
  .formrow{grid-template-columns:1fr}
  .topbar{padding:0 14px;gap:10px}
  .topbar__right .pill{display:none}
  .empty__title{font-size:27px}
  .page__actions{width:100%;margin-left:0}
  .page__actions .btn{flex:1}
  .empty__sub{font-size:14px}
}
