  :root{
    --bg:#F3F8F6; --bg-elevated:#FFFFFF;
    --glass: rgba(255,255,255,0.62); --glass-strong: rgba(255,255,255,0.82); --glass-border: rgba(255,255,255,0.9);
    --ink:#12302B; --ink-soft:#4B6B63; --ink-faint:#7C948C;
    --brand:#1C6E8C; --brand-deep:#12506A; --brand-soft:#DCEEF3;
    --vital:#2F9E6E; --vital-soft:#DEF3E7;
    --warning:#B9791F; --warning-soft:#FBEEDA;
    --critical:#B8443A; --critical-soft:#FBE4E1;
    --border: #D8E6E1; --border-strong:#C3D9D2;
    --shadow-sm: 0 2px 10px rgba(18,48,43,0.06);
    --shadow-md: 0 10px 30px rgba(18,48,43,0.10);
    --shadow-lg: 0 24px 60px rgba(18,48,43,0.16);
    --radius-lg:22px; --radius-md:14px; --radius-sm:9px;
    --font-display:'Iowan Old Style','Palatino Linotype', Georgia, 'Times New Roman', serif;
    --font-body:-apple-system, BlinkMacSystemFont,'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    --font-mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    --seq-1:#E6F2ED; --seq-2:#C9E5DA; --seq-3:#A6D6C2; --seq-4:#7EC5A9; --seq-5:#52AF8C; --seq-6:#2E8E6E; --seq-7:#146650;
    --sidebar-w: 232px;
  }
  @media (prefers-color-scheme: dark){
    :root{
      --bg:#0B1815; --bg-elevated:#102420;
      --glass: rgba(20,42,37,0.58); --glass-strong: rgba(20,42,37,0.78); --glass-border: rgba(255,255,255,0.08);
      --ink:#E9F5F0; --ink-soft:#AFC9C1; --ink-faint:#75948B;
      --brand:#63C4DA; --brand-deep:#8FDCEA; --brand-soft: rgba(99,196,218,0.14);
      --vital:#4ED198; --vital-soft: rgba(78,209,152,0.14);
      --warning:#E3A94C; --warning-soft: rgba(227,169,76,0.14);
      --critical:#E58177; --critical-soft: rgba(229,129,119,0.14);
      --border: rgba(255,255,255,0.10); --border-strong: rgba(255,255,255,0.16);
      --shadow-sm: 0 2px 10px rgba(0,0,0,0.30);
      --shadow-md: 0 10px 30px rgba(0,0,0,0.38);
      --shadow-lg: 0 24px 60px rgba(0,0,0,0.5);
      --seq-1:#2A6E5A; --seq-2:#2F7F68; --seq-3:#3B9177; --seq-4:#48A386; --seq-5:#57B695; --seq-6:#6FCBA8; --seq-7:#8FE2C2;
    }
  }
  :root[data-theme="dark"]{
    --bg:#0B1815; --bg-elevated:#102420;
    --glass: rgba(20,42,37,0.58); --glass-strong: rgba(20,42,37,0.78); --glass-border: rgba(255,255,255,0.08);
    --ink:#E9F5F0; --ink-soft:#AFC9C1; --ink-faint:#75948B;
    --brand:#63C4DA; --brand-deep:#8FDCEA; --brand-soft: rgba(99,196,218,0.14);
    --vital:#4ED198; --vital-soft: rgba(78,209,152,0.14);
    --warning:#E3A94C; --warning-soft: rgba(227,169,76,0.14);
    --critical:#E58177; --critical-soft: rgba(229,129,119,0.14);
    --border: rgba(255,255,255,0.10); --border-strong: rgba(255,255,255,0.16);
    --shadow-sm: 0 2px 10px rgba(0,0,0,0.30);
    --shadow-md: 0 10px 30px rgba(0,0,0,0.38);
    --shadow-lg: 0 24px 60px rgba(0,0,0,0.5);
    --seq-1:#2A6E5A; --seq-2:#2F7F68; --seq-3:#3B9177; --seq-4:#48A386; --seq-5:#57B695; --seq-6:#6FCBA8; --seq-7:#8FE2C2;
  }
  :root[data-theme="light"]{
    --bg:#F3F8F6; --bg-elevated:#FFFFFF;
    --glass: rgba(255,255,255,0.62); --glass-strong: rgba(255,255,255,0.82); --glass-border: rgba(255,255,255,0.9);
    --ink:#12302B; --ink-soft:#4B6B63; --ink-faint:#7C948C;
    --brand:#1C6E8C; --brand-deep:#12506A; --brand-soft:#DCEEF3;
    --vital:#2F9E6E; --vital-soft:#DEF3E7;
    --warning:#B9791F; --warning-soft:#FBEEDA;
    --critical:#B8443A; --critical-soft:#FBE4E1;
    --border: #D8E6E1; --border-strong:#C3D9D2;
  }

  *,*::before,*::after{ box-sizing:border-box; }
  html,body{ height:100%; }
  body{
    margin:0; background:var(--bg); color:var(--ink); font-family:var(--font-body);
    font-size:15px; line-height:1.55; -webkit-font-smoothing:antialiased;
  }
  h1,h2,h3,h4{ font-family:var(--font-display); font-weight:600; margin:0; text-wrap:balance; }
  p{ margin:0; }
  button,input,select,textarea{ font-family:inherit; font-size:inherit; color:inherit; }
  button{ cursor:pointer; }
  a{ color:inherit; }
  ::selection{ background:var(--brand-soft); }
  :focus-visible{ outline:2.5px solid var(--brand); outline-offset:2px; border-radius:6px; }
  .num{ font-family:var(--font-mono); font-variant-numeric:tabular-nums; }
  .visually-hidden{ position:absolute; width:1px; height:1px; overflow:hidden; clip:rect(0,0,0,0); white-space:nowrap; }
  @media (prefers-reduced-motion: reduce){
    *{ animation-duration:0.001ms !important; animation-iteration-count:1 !important; transition-duration:0.001ms !important; scroll-behavior:auto !important; }
  }

  /* ---------- Vitals signature trace ---------- */
  .vitals-trace{ display:block; width:100%; height:100%; }
  .vitals-trace path{
    fill:none; stroke:var(--vital); stroke-width:1.6; stroke-linecap:round; stroke-linejoin:round;
    stroke-dasharray: var(--trace-len, 620); stroke-dashoffset: var(--trace-len, 620);
    animation: trace-draw 3.6s ease-in-out infinite;
  }
  @keyframes trace-draw{
    0%{ stroke-dashoffset: var(--trace-len, 620); }
    55%{ stroke-dashoffset: 0; }
    100%{ stroke-dashoffset: calc(var(--trace-len, 620) * -1); }
  }

  /* ---------- Glass primitives ---------- */
  .glass{
    background:var(--glass); backdrop-filter:blur(18px) saturate(140%); -webkit-backdrop-filter:blur(18px) saturate(140%);
    border:1px solid var(--glass-border); border-radius:var(--radius-lg); box-shadow:var(--shadow-md);
  }
  .glass-strong{ background:var(--glass-strong); backdrop-filter:blur(22px) saturate(150%); -webkit-backdrop-filter:blur(22px) saturate(150%); }

  /* ---------- Buttons ---------- */
  .btn{
    display:inline-flex; align-items:center; gap:8px; padding:10px 16px; border-radius:999px; border:1px solid transparent;
    font-weight:600; font-size:13.5px; letter-spacing:.1px; transition:transform 150ms ease, box-shadow 150ms ease, background 150ms ease, border-color 150ms ease;
    min-height:40px; white-space:nowrap;
  }
  .btn:active{ transform:scale(0.97); }
  .btn-primary{ background:var(--brand); color:#fff; box-shadow:var(--shadow-sm); }
  .btn-primary:hover{ background:var(--brand-deep); }
  .btn-ghost{ background:transparent; border-color:var(--border-strong); color:var(--ink); }
  .btn-ghost:hover{ background:var(--brand-soft); border-color:var(--brand); }
  .btn-soft{ background:var(--brand-soft); color:var(--brand-deep); }
  .btn-soft:hover{ filter:brightness(0.97); }
  .btn-danger{ background:transparent; border-color:var(--critical); color:var(--critical); }
  .btn-danger:hover{ background:var(--critical-soft); }
  .btn-sm{ padding:6px 12px; min-height:30px; font-size:12.5px; border-radius:999px; }
  .btn-icon{ width:38px; height:38px; padding:0; border-radius:50%; display:inline-flex; align-items:center; justify-content:center; background:transparent; border:1px solid var(--border-strong); }
  .btn-icon:hover{ background:var(--brand-soft); border-color:var(--brand); }
  .btn:disabled{ opacity:.45; cursor:not-allowed; }
  .btn svg{ width:16px; height:16px; flex:none; }

  /* ---------- Forms ---------- */
  .field{ display:flex; flex-direction:column; gap:6px; }
  .field label{ font-size:12.5px; font-weight:600; color:var(--ink-soft); }
  .field .hint{ font-size:11.5px; color:var(--ink-faint); }
  .input, select.input, textarea.input{
    width:100%; padding:11px 13px; border-radius:var(--radius-sm); border:1.5px solid var(--border-strong);
    background:var(--bg-elevated); color:var(--ink); transition:border-color 150ms ease, box-shadow 150ms ease;
  }
  .input:focus{ border-color:var(--brand); box-shadow:0 0 0 3.5px var(--brand-soft); outline:none; }
  textarea.input{ resize:vertical; min-height:84px; }
  .input-icon-wrap{ position:relative; }
  .input-icon-wrap svg{ position:absolute; left:13px; top:50%; transform:translateY(-50%); width:16px; height:16px; color:var(--ink-faint); }
  .input-icon-wrap .input{ padding-left:38px; }
  .checkbox-row{ display:flex; align-items:center; gap:8px; font-size:13px; color:var(--ink-soft); }

  /* ---------- Chips / badges ---------- */
  .chip{ display:inline-flex; align-items:center; gap:5px; padding:4px 10px; border-radius:999px; font-size:11.5px; font-weight:700; letter-spacing:.2px; }
  .chip svg{ width:12px; height:12px; }
  .chip-good{ background:var(--vital-soft); color:var(--vital); }
  .chip-warn{ background:var(--warning-soft); color:var(--warning); }
  .chip-bad{ background:var(--critical-soft); color:var(--critical); }
  .chip-neutral{ background:var(--brand-soft); color:var(--brand-deep); }
  .role-pill{ padding:3px 9px; border-radius:999px; font-size:11px; font-weight:700; text-transform:uppercase; letter-spacing:.4px; }
  .role-admin{ background:var(--critical-soft); color:var(--critical); }
  .role-supervisor{ background:var(--brand-soft); color:var(--brand-deep); }
  .role-student{ background:var(--vital-soft); color:var(--vital); }

  /* ---------- Layout: auth ---------- */
  #auth-screen{ min-height:100vh; display:grid; grid-template-columns:1fr; place-items:center; padding:32px 18px; position:relative; overflow:hidden; }
  #auth-screen::before{
    content:""; position:absolute; inset:0; z-index:0;
    background:
      radial-gradient(700px 420px at 12% 8%, var(--brand-soft), transparent 60%),
      radial-gradient(600px 420px at 92% 92%, var(--vital-soft), transparent 60%);
  }
  .auth-trace-bg{ position:absolute; inset:0; z-index:0; opacity:.5; }
  .auth-card{ position:relative; z-index:1; width:100%; max-width:400px; padding:36px 32px 30px; }
  .brand-mark{ display:flex; align-items:center; gap:10px; margin-bottom:22px; }
  .brand-mark .mark{ width:38px; height:38px; border-radius:11px; background:linear-gradient(155deg,var(--brand),var(--vital)); display:flex; align-items:center; justify-content:center; flex:none; box-shadow:var(--shadow-sm); }
  .brand-mark .mark svg{ width:20px; height:20px; color:#fff; }
  .brand-mark .wordmark{ font-family:var(--font-display); font-size:22px; font-weight:700; letter-spacing:.4px; }
  .brand-mark .tagline{ font-size:10.5px; color:var(--ink-faint); text-transform:uppercase; letter-spacing:1.4px; margin-top:1px; }
  .auth-title{ font-size:23px; margin-bottom:4px; }
  .auth-sub{ color:var(--ink-soft); font-size:13.5px; margin-bottom:22px; }
  .auth-form{ display:flex; flex-direction:column; gap:14px; }
  .auth-foot{ margin-top:18px; font-size:13px; color:var(--ink-soft); display:flex; justify-content:space-between; flex-wrap:wrap; gap:8px; }
  .auth-foot button.link{ background:none; border:none; padding:0; color:var(--brand); font-weight:600; }
  .demo-divider{ display:flex; align-items:center; gap:10px; margin:20px 0 14px; color:var(--ink-faint); font-size:11px; text-transform:uppercase; letter-spacing:.8px; }
  .demo-divider::before,.demo-divider::after{ content:""; flex:1; height:1px; background:var(--border); }
  .demo-grid{ display:grid; grid-template-columns:repeat(3,1fr); gap:8px; }
  .demo-account{ padding:10px 8px; border-radius:var(--radius-sm); border:1.5px solid var(--border-strong); background:var(--bg-elevated); text-align:center; transition:border-color 150ms, background 150ms; }
  .demo-account:hover{ border-color:var(--brand); background:var(--brand-soft); }
  .demo-account .r{ font-size:10.5px; text-transform:uppercase; letter-spacing:.5px; color:var(--ink-faint); font-weight:700; }
  .demo-account .n{ font-size:12px; font-weight:600; margin-top:2px; }
  .notice-box{ display:flex; gap:10px; padding:12px 14px; border-radius:var(--radius-sm); background:var(--brand-soft); color:var(--brand-deep); font-size:12.5px; line-height:1.5; }
  .notice-box svg{ width:16px; height:16px; flex:none; margin-top:1px; }

  /* ---------- App shell ---------- */
  #app{ display:none; min-height:100vh; }
  #app.active{ display:block; }
  .topbar{
    position:sticky; top:0; z-index:40; height:64px; display:flex; align-items:center; gap:16px;
    padding:0 20px; border-bottom:1px solid var(--border); background:var(--glass-strong);
    backdrop-filter:blur(20px) saturate(150%); -webkit-backdrop-filter:blur(20px) saturate(150%);
  }
  .topbar .brand-mark{ margin-bottom:0; }
  .topbar .brand-mark .wordmark{ font-size:18px; }
  .topbar .vitals-divider{ height:22px; width:70px; flex:none; opacity:.85; display:none; }
  @media(min-width:720px){ .topbar .vitals-divider{ display:block; } }
  .global-search{ flex:1; max-width:440px; position:relative; }
  .global-search .input{ border-radius:999px; padding-left:38px; background:var(--bg); }
  .search-results{ position:absolute; top:calc(100% + 8px); left:0; right:0; max-height:360px; overflow:auto; z-index:50; padding:8px; display:none; }
  .search-results.show{ display:block; }
  .search-results .sr-group-label{ font-size:10.5px; text-transform:uppercase; letter-spacing:.6px; color:var(--ink-faint); font-weight:700; padding:8px 10px 4px; }
  .search-hit{ display:flex; align-items:center; gap:10px; padding:9px 10px; border-radius:var(--radius-sm); }
  .search-hit:hover{ background:var(--brand-soft); }
  .search-hit .t{ font-size:13px; font-weight:600; }
  .search-hit .s{ font-size:11.5px; color:var(--ink-faint); }
  .topbar-actions{ display:flex; align-items:center; gap:10px; margin-left:auto; }
  .role-switch{ display:flex; align-items:center; gap:8px; padding:5px 6px 5px 12px; border-radius:999px; border:1.5px dashed var(--border-strong); }
  .role-switch label{ font-size:10.5px; color:var(--ink-faint); text-transform:uppercase; letter-spacing:.4px; }
  .role-switch select{ border:none; background:var(--brand-soft); color:var(--brand-deep); font-weight:700; font-size:12px; padding:6px 10px; border-radius:999px; }
  .avatar{ width:36px; height:36px; border-radius:50%; display:flex; align-items:center; justify-content:center; font-weight:700; font-size:12.5px; flex:none; }
  .avatar-sm{ width:26px; height:26px; font-size:10.5px; }
  .avatar-xs{ width:20px; height:20px; font-size:9px; }

  .app-body{ display:flex; align-items:flex-start; }
  .sidebar{ width:var(--sidebar-w); flex:none; position:sticky; top:64px; height:calc(100vh - 64px); padding:18px 12px; border-right:1px solid var(--border); display:flex; flex-direction:column; gap:2px; }
  .nav-item{ display:flex; align-items:center; gap:12px; padding:10px 12px; border-radius:var(--radius-sm); background:none; border:none; text-align:left; color:var(--ink-soft); font-weight:600; font-size:13.5px; width:100%; transition:background 150ms,color 150ms; }
  .nav-item svg{ width:18px; height:18px; flex:none; }
  .nav-item:hover{ background:var(--brand-soft); color:var(--brand-deep); }
  .nav-item.active{ background:var(--brand); color:#fff; box-shadow:var(--shadow-sm); }
  .nav-section-label{ font-size:10.5px; text-transform:uppercase; letter-spacing:.6px; color:var(--ink-faint); font-weight:700; padding:14px 12px 6px; }
  .sidebar-foot{ margin-top:auto; padding-top:12px; border-top:1px solid var(--border); }

  main.view-root{ flex:1; min-width:0; padding:26px 30px 60px; }
  .view{ display:none; animation:view-in 260ms ease; }
  .view.active{ display:block; }
  @keyframes view-in{ from{ opacity:0; transform:translateY(6px); } to{ opacity:1; transform:none; } }
  .view-head{ display:flex; align-items:flex-end; justify-content:space-between; gap:16px; margin-bottom:22px; flex-wrap:wrap; }
  .view-eyebrow{ font-size:11px; text-transform:uppercase; letter-spacing:.8px; color:var(--brand); font-weight:700; margin-bottom:4px; }
  .view-title{ font-size:25px; }
  .view-desc{ color:var(--ink-soft); font-size:13.5px; margin-top:4px; max-width:56ch; }
  .scope-banner{ display:flex; align-items:center; gap:9px; padding:9px 14px; border-radius:999px; background:var(--vital-soft); color:var(--vital); font-size:12px; font-weight:600; margin-bottom:20px; }
  .scope-banner svg{ width:15px; height:15px; flex:none; }

  /* ---------- Stat tiles / analytics ---------- */
  .stat-grid{ display:grid; grid-template-columns:repeat(4,1fr); gap:14px; margin-bottom:22px; }
  .stat-tile{ padding:18px 20px; }
  .stat-tile .label{ font-size:11.5px; text-transform:uppercase; letter-spacing:.5px; color:var(--ink-faint); font-weight:700; }
  .stat-tile .value{ font-size:30px; font-family:var(--font-mono); font-weight:600; margin-top:8px; }
  .stat-tile .delta{ font-size:11.5px; margin-top:6px; display:flex; align-items:center; gap:4px; }
  .stat-tile .delta.up{ color:var(--vital); } .stat-tile .delta.down{ color:var(--critical); }
  .analytics-grid{ display:grid; grid-template-columns:1.3fr 1fr; gap:16px; margin-bottom:16px; }
  .panel{ padding:20px 22px; }
  .panel-head{ display:flex; align-items:center; justify-content:space-between; margin-bottom:14px; }
  .panel-title{ font-size:14.5px; font-weight:700; font-family:var(--font-display); }
  .panel-sub{ font-size:11.5px; color:var(--ink-faint); }
  .seq-chart{ display:flex; align-items:flex-end; gap:10px; height:150px; padding-top:8px; }
  .seq-bar-col{ flex:1; display:flex; flex-direction:column; align-items:center; gap:8px; height:100%; justify-content:flex-end; }
  .seq-bar{ width:100%; border-radius:6px 6px 3px 3px; position:relative; min-height:4px; transition:height 500ms cubic-bezier(.2,.8,.2,1); }
  .seq-bar-count{ font-size:11px; font-family:var(--font-mono); color:var(--ink-soft); }
  .seq-bar-label{ font-size:9.5px; color:var(--ink-faint); text-align:center; line-height:1.25; }
  .trend-chart{ width:100%; height:140px; }
  .activity-list, .deadline-list{ display:flex; flex-direction:column; gap:2px; }
  .activity-row, .deadline-row{ display:flex; align-items:center; gap:10px; padding:9px 4px; border-bottom:1px solid var(--border); }
  .activity-row:last-child, .deadline-row:last-child{ border-bottom:none; }
  .activity-row .dot{ width:7px; height:7px; border-radius:50%; background:var(--brand); flex:none; }
  .activity-row .txt{ font-size:12.5px; flex:1; }
  .activity-row .t{ font-size:10.5px; color:var(--ink-faint); font-family:var(--font-mono); flex:none; }
  .deadline-row .n{ font-size:12.5px; font-weight:600; flex:1; }
  .deadline-row .d{ font-size:11px; font-family:var(--font-mono); color:var(--ink-faint); }

  /* ---------- Toolbar (search/filter row) ---------- */
  .toolbar{ display:flex; align-items:center; gap:10px; margin-bottom:18px; flex-wrap:wrap; }
  .toolbar .input-icon-wrap{ flex:1; min-width:200px; }
  .filter-select{ padding:9px 12px; border-radius:999px; border:1.5px solid var(--border-strong); background:var(--bg-elevated); font-size:12.5px; font-weight:600; }

  /* ---------- Kanban ---------- */
  .kanban{ display:grid; grid-auto-flow:column; grid-auto-columns:246px; gap:14px; overflow-x:auto; padding-bottom:10px; }
  .kanban-col{ display:flex; flex-direction:column; gap:10px; min-height:200px; }
  .kanban-col-head{ display:flex; align-items:center; gap:8px; padding:2px 4px 8px; }
  .kanban-col-num{ width:20px; height:20px; border-radius:50%; display:flex; align-items:center; justify-content:center; font-size:10px; font-weight:800; color:var(--ink); background:var(--bg-elevated); border:2px solid var(--border-strong); flex:none; }
  .kanban-col-title{ font-size:12px; font-weight:700; flex:1; }
  .kanban-col-count{ font-size:11px; color:var(--ink-faint); font-family:var(--font-mono); }
  .kanban-drop{ flex:1; display:flex; flex-direction:column; gap:10px; border-radius:var(--radius-md); padding:4px; min-height:120px; transition:background 150ms; }
  .kanban-drop.drag-over{ background:var(--brand-soft); }
  .paper-card{ padding:14px; cursor:pointer; transition:transform 150ms, box-shadow 150ms; }
  .paper-card:hover{ transform:translateY(-2px); box-shadow:var(--shadow-lg); }
  .paper-card.dragging{ opacity:.4; }
  .paper-card .grp-tag{ font-size:9.5px; text-transform:uppercase; letter-spacing:.4px; font-weight:700; color:var(--brand); margin-bottom:6px; }
  .paper-card .ptitle{ font-size:12.5px; font-weight:700; line-height:1.35; margin-bottom:10px; }
  .paper-card .pmeta{ display:flex; align-items:center; justify-content:space-between; margin-bottom:8px; }
  .paper-card .avatars{ display:flex; }
  .paper-card .avatars .avatar-xs{ margin-left:-6px; border:2px solid var(--bg-elevated); }
  .paper-card .avatars .avatar-xs:first-child{ margin-left:0; }
  .progress-track{ height:6px; border-radius:99px; background:var(--border); overflow:hidden; position:relative; }
  .progress-fill{ height:100%; border-radius:99px; background:linear-gradient(90deg,var(--brand),var(--vital)); position:relative; transition:width 500ms cubic-bezier(.2,.8,.2,1); }
  .progress-fill::after{ content:""; position:absolute; right:-1px; top:50%; width:8px; height:8px; background:var(--vital); border-radius:50%; transform:translate(50%,-50%); box-shadow:0 0 0 3px var(--vital-soft); }
  .progress-pct{ font-size:10.5px; font-family:var(--font-mono); color:var(--ink-faint); margin-top:5px; text-align:right; }

  /* ---------- Grids: groups/tools/people ---------- */
  .card-grid{ display:grid; grid-template-columns:repeat(auto-fill,minmax(230px,1fr)); gap:14px; }
  .group-card{ padding:20px; display:flex; flex-direction:column; gap:10px; cursor:pointer; transition:transform 150ms, box-shadow 150ms; }
  .group-card:hover{ transform:translateY(-2px); box-shadow:var(--shadow-lg); }
  .group-icon{ width:42px; height:42px; border-radius:12px; display:flex; align-items:center; justify-content:center; background:var(--brand-soft); color:var(--brand-deep); }
  .group-icon svg{ width:22px; height:22px; }
  .group-card h3{ font-size:15px; }
  .group-card .field-tag{ font-size:11px; color:var(--ink-faint); }
  .group-stats{ display:flex; gap:14px; margin-top:4px; }
  .group-stats .gs{ font-size:11px; color:var(--ink-soft); }
  .group-stats .gs b{ display:block; font-family:var(--font-mono); font-size:15px; color:var(--ink); }

  .tool-card{ padding:18px; display:flex; flex-direction:column; gap:10px; text-align:left; transition:transform 150ms, box-shadow 150ms, border-color 150ms; cursor:pointer; }
  .tool-card:hover{ transform:translateY(-2px); box-shadow:var(--shadow-lg); border-color:var(--brand); }
  .tool-icon{ width:38px; height:38px; border-radius:11px; display:flex; align-items:center; justify-content:center; }
  .tool-icon svg{ width:19px; height:19px; }
  .tool-card h4{ font-size:14px; }
  .tool-card p{ font-size:12px; color:var(--ink-soft); line-height:1.5; }
  .tool-card .phase-tag{ font-size:10px; font-weight:700; color:var(--brand); text-transform:uppercase; letter-spacing:.3px; }

  table.data-table{ width:100%; border-collapse:collapse; }
  .data-table thead th{ text-align:left; font-size:10.5px; text-transform:uppercase; letter-spacing:.5px; color:var(--ink-faint); font-weight:700; padding:10px 12px; border-bottom:1.5px solid var(--border); }
  .data-table tbody td{ padding:12px; border-bottom:1px solid var(--border); font-size:13px; vertical-align:middle; }
  .data-table tbody tr:last-child td{ border-bottom:none; }
  .person-cell{ display:flex; align-items:center; gap:10px; }
  .person-cell .name{ font-weight:600; font-size:13px; }
  .person-cell .email{ font-size:11px; color:var(--ink-faint); font-family:var(--font-mono); }
  .row-actions{ display:flex; gap:6px; justify-content:flex-end; }

  /* ---------- Modal ---------- */
  .modal-backdrop{ position:fixed; inset:0; background:rgba(10,26,22,0.42); backdrop-filter:blur(3px); z-index:100; display:none; align-items:center; justify-content:center; padding:20px; }
  .modal-backdrop.show{ display:flex; }
  .modal{ width:100%; max-width:640px; max-height:88vh; overflow:auto; padding:0; }
  .modal.modal-lg{ max-width:920px; }
  .modal-head{ display:flex; align-items:flex-start; justify-content:space-between; gap:14px; padding:22px 24px 16px; position:sticky; top:0; background:var(--glass-strong); backdrop-filter:blur(16px); z-index:1; border-bottom:1px solid var(--border); }
  .modal-body{ padding:20px 24px 26px; }
  .modal-title{ font-size:18px; }
  .modal-eyebrow{ font-size:11px; text-transform:uppercase; letter-spacing:.6px; color:var(--brand); font-weight:700; margin-bottom:3px; }

  /* Paper detail modal specifics */
  .stepper{ display:flex; align-items:center; gap:4px; margin:6px 0 20px; overflow-x:auto; padding-bottom:4px; }
  .step{ display:flex; align-items:center; gap:6px; flex:none; }
  .step-dot{ width:22px; height:22px; border-radius:50%; display:flex; align-items:center; justify-content:center; font-size:10px; font-weight:800; flex:none; border:2px solid var(--border-strong); color:var(--ink-faint); background:var(--bg-elevated); }
  .step.done .step-dot{ background:var(--vital); border-color:var(--vital); color:#fff; }
  .step.current .step-dot{ background:var(--brand); border-color:var(--brand); color:#fff; box-shadow:0 0 0 4px var(--brand-soft); }
  .step-label{ font-size:10.5px; color:var(--ink-faint); font-weight:600; white-space:nowrap; }
  .step.current .step-label, .step.done .step-label{ color:var(--ink); }
  .step-line{ width:20px; height:2px; background:var(--border-strong); flex:none; }
  .step.done + .step-line{ background:var(--vital); }

  .detail-grid{ display:grid; grid-template-columns:1.2fr 1fr; gap:22px; }
  .section-list{ display:flex; flex-direction:column; gap:8px; }
  .section-row{ display:flex; align-items:center; gap:10px; padding:10px 12px; border-radius:var(--radius-sm); border:1px solid var(--border); }
  .section-row .sname{ flex:1; font-size:13px; font-weight:600; }
  .status-dot{ width:9px; height:9px; border-radius:50%; flex:none; }
  .status-done{ background:var(--vital); } .status-progress{ background:var(--warning); } .status-none{ background:var(--ink-faint); opacity:.4; }

  .dropzone{ border:1.8px dashed var(--border-strong); border-radius:var(--radius-md); padding:22px; text-align:center; transition:border-color 150ms, background 150ms; }
  .dropzone.drag-over{ border-color:var(--brand); background:var(--brand-soft); }
  .dropzone svg{ width:26px; height:26px; color:var(--ink-faint); margin-bottom:8px; }
  .file-row{ display:flex; align-items:center; gap:10px; padding:9px 4px; border-bottom:1px solid var(--border); }
  .file-row:last-child{ border-bottom:none; }
  .file-icon{ width:30px; height:30px; border-radius:8px; background:var(--brand-soft); color:var(--brand-deep); display:flex; align-items:center; justify-content:center; flex:none; }
  .file-icon svg{ width:15px; height:15px; }
  .file-meta{ flex:1; min-width:0; }
  .file-meta .fn{ font-size:12.5px; font-weight:600; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
  .file-meta .fs{ font-size:10.5px; color:var(--ink-faint); font-family:var(--font-mono); }

  .assignee-row{ display:flex; align-items:center; gap:10px; padding:8px 0; }
  .assignee-row .who{ flex:1; }
  .assignee-row .who .n{ font-size:12.5px; font-weight:600; }
  .assignee-row .who .r{ font-size:10.5px; color:var(--ink-faint); }

  /* Tool panel output */
  .tool-output{ background:var(--bg); border:1px solid var(--border); border-radius:var(--radius-md); padding:16px 18px; font-size:12.8px; line-height:1.7; }
  .tool-output h5{ font-family:var(--font-body); font-size:11px; text-transform:uppercase; letter-spacing:.5px; color:var(--brand); margin:0 0 6px; }
  .tool-output + .tool-output{ margin-top:12px; }
  .pico-grid{ display:grid; grid-template-columns:1fr 1fr; gap:10px; }
  .pico-cell{ background:var(--bg); border:1px solid var(--border); border-radius:var(--radius-sm); padding:12px; }
  .pico-cell .k{ font-size:10px; font-weight:800; text-transform:uppercase; letter-spacing:.5px; color:var(--vital); margin-bottom:5px; }
  .pico-cell .v{ font-size:12.5px; }
  .validator-row{ display:flex; gap:10px; padding:10px; border-radius:var(--radius-sm); border:1px solid var(--border); margin-bottom:8px; }
  .template-card{ border:1.5px solid var(--border); border-radius:var(--radius-md); padding:14px; margin-bottom:10px; display:flex; align-items:flex-start; justify-content:space-between; gap:12px; }
  .template-card .match{ font-family:var(--font-mono); font-weight:700; color:var(--vital); font-size:13px; }

  /* ---------- Toasts ---------- */
  #toast-stack{ position:fixed; bottom:22px; right:22px; z-index:200; display:flex; flex-direction:column; gap:10px; max-width:320px; }
  .toast{ padding:12px 16px; display:flex; align-items:center; gap:10px; font-size:12.8px; font-weight:600; animation:toast-in 220ms ease; }
  .toast svg{ width:16px; height:16px; color:var(--vital); flex:none; }
  @keyframes toast-in{ from{ opacity:0; transform:translateY(8px);} to{opacity:1; transform:none;} }

  /* ---------- Responsive ---------- */
  @media (max-width: 1080px){
    .stat-grid{ grid-template-columns:repeat(2,1fr); }
    .analytics-grid{ grid-template-columns:1fr; }
    .detail-grid{ grid-template-columns:1fr; }
  }
  @media (max-width: 860px){
    .sidebar{ position:fixed; left:0; top:64px; z-index:39; background:var(--bg-elevated); box-shadow:var(--shadow-lg); transform:translateX(-100%); transition:transform 200ms ease; }
    .sidebar.open{ transform:translateX(0); }
    main.view-root{ padding:18px 16px 50px; }
    .global-search{ display:none; }
    .stat-grid{ grid-template-columns:1fr 1fr; }
  }
  @media (max-width: 560px){
    .stat-grid{ grid-template-columns:1fr; }
    .auth-card{ padding:26px 20px 22px; }
    .demo-grid{ grid-template-columns:1fr 1fr; }
    .topbar{ padding:0 12px; gap:10px; }
  }
  .menu-btn{ display:none; }
  @media (max-width:860px){ .menu-btn{ display:inline-flex; } }
/* =====================================================================
   CoAuthored additions (same palette as the original prototype)
   ===================================================================== */
html{ -webkit-text-size-adjust:100%; }
body{ overscroll-behavior-y:none; }
[hidden]{ display:none !important; }
.muted{ color:var(--ink-soft); } .faint{ color:var(--ink-faint); } .small{ font-size:12px; } .tiny{ font-size:11px; }
.row-flex{ display:flex; align-items:center; gap:10px; } .wrap-flex{ flex-wrap:wrap; } .grow{ flex:1; min-width:0; } .right{ margin-left:auto; }
.stack{ display:flex; flex-direction:column; gap:12px; } .stack-sm{ display:flex; flex-direction:column; gap:6px; }
.two-col{ display:grid; grid-template-columns:1fr 1fr; gap:14px; } .three-col{ display:grid; grid-template-columns:repeat(3,1fr); gap:14px; }
.truncate{ white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.logo-img{ display:block; }
@media (prefers-color-scheme: dark){ :root:not([data-theme="light"]) .logo-img{ filter:invert(1); } }
:root[data-theme="dark"] .logo-img{ filter:invert(1); }

/* ----- Brand lockup: logo + CoAuthored + "By AMRA" ----- */
.brand{ display:flex; align-items:center; gap:10px; text-decoration:none; color:inherit; background:none; border:none; padding:0; text-align:left; }
.brand .mark-img{ height:30px; width:30px; flex:none; }
.brand .bn{ font-family:var(--font-display); font-weight:700; font-size:19px; line-height:1.05; letter-spacing:.2px; }
.brand .bby{ font-size:9.5px; letter-spacing:1.6px; text-transform:uppercase; color:var(--ink-faint); font-weight:700; margin-top:3px; }
.auth-brand{ text-align:center; margin-bottom:20px; }
.auth-brand .logo-img{ height:72px; margin:0 auto 12px; max-width:100%; object-fit:contain; }
.auth-brand .bn{ font-family:var(--font-display); font-size:27px; font-weight:700; letter-spacing:.3px; line-height:1.1; }
.auth-brand .bby{ font-size:10.5px; letter-spacing:2px; text-transform:uppercase; color:var(--ink-faint); font-weight:700; margin-top:4px; }
.auth-card{ max-width:420px; }
.code-input{ text-align:center; font-family:var(--font-mono); font-size:28px; letter-spacing:10px; padding:12px; }
.form-error{ color:var(--critical); background:var(--critical-soft); padding:10px 13px; border-radius:var(--radius-sm); font-size:12.8px; display:none; }
.form-error.show{ display:block; }
.form-ok{ color:var(--vital); background:var(--vital-soft); padding:10px 13px; border-radius:var(--radius-sm); font-size:12.8px; }

/* ----- App shell tweaks ----- */
.topbar{ padding-top:env(safe-area-inset-top,0); height:calc(64px + env(safe-area-inset-top,0)); }
.sidebar{ top:calc(64px + env(safe-area-inset-top,0)); height:calc(100vh - 64px - env(safe-area-inset-top,0)); overflow-y:auto; }
.nav-item{ position:relative; }
.nav-badge{ margin-left:auto; min-width:20px; height:20px; padding:0 6px; border-radius:999px; background:var(--critical); color:#fff; font-size:10.5px; font-weight:800; display:inline-flex; align-items:center; justify-content:center; }
.nav-item.active .nav-badge{ background:#fff; color:var(--brand-deep); }
.menu-wrap{ position:relative; }
.pop{ position:absolute; right:0; top:calc(100% + 8px); min-width:230px; max-width:min(92vw,360px); z-index:60; padding:8px; display:none; }
.pop.show{ display:block; animation:view-in 160ms ease; }
.pop-item{ display:flex; align-items:center; gap:10px; width:100%; text-align:left; padding:10px 12px; border:none; background:none; border-radius:var(--radius-sm); font-weight:600; font-size:13px; color:var(--ink); }
.pop-item:hover{ background:var(--brand-soft); } .pop-item svg{ width:16px; height:16px; color:var(--ink-soft); }
.pop-sep{ height:1px; background:var(--border); margin:6px 4px; }
.pop-head{ padding:8px 12px 6px; } .pop-head b{ display:block; font-size:13.5px; } .pop-head span{ font-size:11.5px; color:var(--ink-faint); }
.notif-pop{ width:360px; padding:0; } .notif-head{ display:flex; align-items:center; justify-content:space-between; padding:12px 14px; border-bottom:1px solid var(--border); font-weight:700; font-size:13.5px; }
.notif-list{ max-height:min(70vh,420px); overflow:auto; }
.notif{ display:block; width:100%; text-align:left; background:none; border:none; padding:12px 14px; border-bottom:1px solid var(--border); position:relative; }
.notif:hover{ background:var(--brand-soft); } .notif.unread::before{ content:""; position:absolute; left:5px; top:19px; width:6px; height:6px; border-radius:50%; background:var(--brand); }
.notif .t{ font-size:12.8px; font-weight:700; } .notif .b{ font-size:12px; color:var(--ink-soft); margin-top:2px; } .notif .w{ font-size:10.5px; color:var(--ink-faint); margin-top:3px; }
.btn-icon{ position:relative; flex:none; }
.btn-icon .dot-badge{ position:absolute; top:-3px; right:-3px; min-width:17px; height:17px; padding:0 4px; border-radius:99px; background:var(--critical); color:#fff; font-size:10px; font-weight:800; display:flex; align-items:center; justify-content:center; border:2px solid var(--bg); }
.avatar-btn{ border:none; padding:0; cursor:pointer; }
.av-1{ background:#DCEEF3; color:#12506A; } .av-2{ background:#DEF3E7; color:#1d6b49; } .av-3{ background:#E7E4F7; color:#4b3d94; } .av-4{ background:#FBEEDA; color:#8c5a12; } .av-5{ background:#FBE4E1; color:#8a2c24; } .av-6{ background:#E3EEF9; color:#1f4f86; }
@media (prefers-color-scheme: dark){ :root:not([data-theme="light"]) .av-1,:root:not([data-theme="light"]) .av-2,:root:not([data-theme="light"]) .av-3,:root:not([data-theme="light"]) .av-4,:root:not([data-theme="light"]) .av-5,:root:not([data-theme="light"]) .av-6{ background:rgba(255,255,255,.12); color:var(--ink); } }
:root[data-theme="dark"] [class*="av-"]{ background:rgba(255,255,255,.12); color:var(--ink); }
.avatars{ display:flex; } .avatars .avatar{ margin-left:-7px; border:2px solid var(--bg-elevated); } .avatars .avatar:first-child{ margin-left:0; }
.avatar-xs{ width:22px; height:22px; font-size:9px; }

/* ----- Bottom nav (phones / small tablets) ----- */
.bottom-nav{ display:none; }
@media (max-width:860px){
  .bottom-nav{ display:flex; position:fixed; left:0; right:0; bottom:0; z-index:45; background:var(--glass-strong); backdrop-filter:blur(20px) saturate(150%); -webkit-backdrop-filter:blur(20px) saturate(150%); border-top:1px solid var(--border); padding:6px 4px calc(6px + env(safe-area-inset-bottom,0)); }
  .bottom-nav button{ flex:1; display:flex; flex-direction:column; align-items:center; gap:2px; background:none; border:none; padding:6px 2px; font-size:10.5px; font-weight:700; color:var(--ink-faint); position:relative; min-height:48px; }
  .bottom-nav button svg{ width:22px; height:22px; } .bottom-nav button.active{ color:var(--brand); }
  .bottom-nav .nav-badge{ position:absolute; top:2px; left:calc(50% + 6px); margin:0; min-width:16px; height:16px; font-size:9.5px; }
  main.view-root{ padding-bottom:calc(86px + env(safe-area-inset-bottom,0)); }
  .sidebar-scrim{ position:fixed; inset:0; background:rgba(10,26,22,.4); z-index:38; display:none; } .sidebar.open ~ .sidebar-scrim{ display:block; }
  .notif-pop{ position:fixed; left:8px; right:8px; top:calc(70px + env(safe-area-inset-top,0)); width:auto; max-width:none; }
  #toast-stack{ left:12px; right:12px; bottom:calc(76px + env(safe-area-inset-bottom,0)); max-width:none; }
  .topbar .brand .bby{ display:none; } .topbar .brand .bn{ font-size:17px; }
  .view-title{ font-size:22px; } .two-col,.three-col{ grid-template-columns:1fr; }
}
.sidebar-scrim{ display:none; }
.sidebar{ overflow-y:auto; }
.sidebar .brand-side{ display:none; }

/* ----- Tabs / toggles ----- */
.tabs{ display:flex; gap:2px; overflow-x:auto; border-bottom:1px solid var(--border); margin-bottom:18px; scrollbar-width:none; }
.tabs::-webkit-scrollbar{ display:none; }
.tab{ padding:11px 14px; border:none; background:none; font-weight:700; font-size:13px; color:var(--ink-soft); border-bottom:2.5px solid transparent; white-space:nowrap; display:inline-flex; align-items:center; gap:7px; margin-bottom:-1px; }
.tab:hover{ color:var(--brand-deep); } .tab.active{ color:var(--brand-deep); border-bottom-color:var(--brand); }
.tab .count{ font-size:10.5px; background:var(--brand-soft); color:var(--brand-deep); border-radius:99px; padding:1px 7px; font-family:var(--font-mono); }
.tab .count.alert{ background:var(--critical-soft); color:var(--critical); }
.seg{ display:inline-flex; background:var(--brand-soft); border-radius:999px; padding:3px; gap:2px; }
.seg button{ border:none; background:none; padding:6px 14px; border-radius:999px; font-weight:700; font-size:12.5px; color:var(--brand-deep); }
.seg button.active{ background:var(--bg-elevated); box-shadow:var(--shadow-sm); }
.switch{ position:relative; display:inline-block; width:42px; height:24px; flex:none; }
.switch input{ opacity:0; width:0; height:0; position:absolute; }
.switch span{ position:absolute; inset:0; background:var(--border-strong); border-radius:99px; transition:background 150ms; cursor:pointer; }
.switch span::after{ content:""; position:absolute; left:3px; top:3px; width:18px; height:18px; border-radius:50%; background:#fff; transition:transform 150ms; box-shadow:0 1px 3px rgba(0,0,0,.25); }
.switch input:checked + span{ background:var(--vital); } .switch input:checked + span::after{ transform:translateX(18px); }
.switch input:focus-visible + span{ outline:2.5px solid var(--brand); outline-offset:2px; }
.switch input:disabled + span{ opacity:.5; cursor:not-allowed; }

/* ----- Cards / generic ----- */
.card{ padding:18px 20px; }
.card-title{ font-family:var(--font-display); font-size:15px; font-weight:700; margin-bottom:10px; display:flex; align-items:center; gap:8px; }
.card-title .right{ font-family:var(--font-body); font-weight:600; }
.empty{ text-align:center; padding:34px 16px; color:var(--ink-faint); font-size:13px; }
.empty svg{ width:34px; height:34px; margin-bottom:8px; opacity:.55; } .empty b{ display:block; color:var(--ink-soft); font-size:14px; margin-bottom:3px; }
.skeleton{ height:84px; border-radius:var(--radius-md); background:linear-gradient(90deg,var(--border) 25%,var(--brand-soft) 50%,var(--border) 75%); background-size:200% 100%; animation:sk 1.2s infinite; margin-bottom:12px; }
@keyframes sk{ to{ background-position:-200% 0; } }
.link-btn{ background:none; border:none; padding:0; color:var(--brand); font-weight:700; cursor:pointer; font-size:inherit; }
.link-btn:hover{ text-decoration:underline; }
.hello{ font-family:var(--font-display); font-size:26px; margin-bottom:2px; }
.stat-tile{ cursor:default; } .stat-tile.click{ cursor:pointer; transition:transform 150ms; } .stat-tile.click:hover{ transform:translateY(-2px); }
.alert-box{ display:flex; gap:10px; align-items:flex-start; padding:11px 14px; border-radius:var(--radius-sm); font-size:12.8px; margin-bottom:8px; background:var(--warning-soft); color:var(--warning); font-weight:600; cursor:pointer; }
.alert-box.bad{ background:var(--critical-soft); color:var(--critical); } .alert-box svg{ width:16px; height:16px; flex:none; margin-top:2px; }
.chip-link{ cursor:pointer; }

/* ----- Paper cards / mini stepper ----- */
.paper-grid{ display:grid; grid-template-columns:repeat(auto-fill,minmax(300px,1fr)); gap:14px; }
.paper-card .ptitle{ font-size:14px; }
.phase-mini{ display:flex; gap:3px; margin:2px 0 10px; } .phase-mini i{ flex:1; height:5px; border-radius:3px; background:var(--border-strong); } .phase-mini i.on{ background:var(--vital); } .phase-mini i.cur{ background:var(--brand); }
.phase-name{ font-size:11px; font-weight:700; color:var(--brand-deep); margin-bottom:4px; }
.kanban{ grid-auto-columns:minmax(250px,270px); }
.paper-hero{ padding:22px 24px; margin-bottom:16px; }
.paper-hero h1{ font-size:23px; line-height:1.25; margin:6px 0 10px; }
.crumbs{ font-size:12px; color:var(--ink-faint); display:flex; gap:6px; flex-wrap:wrap; align-items:center; }
.crumbs a{ color:var(--brand); text-decoration:none; font-weight:600; } .crumbs a:hover{ text-decoration:underline; }
.meta-row{ display:flex; flex-wrap:wrap; gap:8px 16px; font-size:12.5px; color:var(--ink-soft); align-items:center; }
.stepper{ margin-top:16px; } .step{ cursor:default; } .step.clickable{ cursor:pointer; } .step.clickable:hover .step-label{ color:var(--brand); }

/* ----- Tasks ----- */
.task{ display:flex; gap:12px; padding:14px 16px; border:1px solid var(--border); border-radius:var(--radius-md); background:var(--bg-elevated); }
.task + .task{ margin-top:10px; } .task.done{ opacity:.65; }
.task-check{ width:22px; height:22px; border-radius:50%; border:2px solid var(--border-strong); flex:none; margin-top:1px; display:flex; align-items:center; justify-content:center; background:none; padding:0; color:#fff; }
.task-check.done{ background:var(--vital); border-color:var(--vital); } .task-check svg{ width:12px; height:12px; }
.task-title{ font-weight:700; font-size:13.8px; } .task.done .task-title{ text-decoration:line-through; }
.task-meta{ display:flex; flex-wrap:wrap; gap:6px 12px; font-size:11.8px; color:var(--ink-faint); margin-top:5px; align-items:center; }
.task-actions{ display:flex; flex-wrap:wrap; gap:6px; margin-top:10px; }
.prio-high{ color:var(--critical); } .prio-medium{ color:var(--warning); } .prio-low{ color:var(--ink-faint); }
.review-note{ margin-top:8px; padding:8px 11px; border-left:3px solid var(--warning); background:var(--warning-soft); border-radius:0 8px 8px 0; font-size:12.3px; }
.status-chip-todo{ background:var(--brand-soft); color:var(--brand-deep); } .status-chip-in_progress{ background:var(--warning-soft); color:var(--warning); } .status-chip-in_review{ background:#E7E4F7; color:#4b3d94; } .status-chip-done{ background:var(--vital-soft); color:var(--vital); }
:root[data-theme="dark"] .status-chip-in_review{ background:rgba(160,140,255,.16); color:#bdb0ff; }
@media (prefers-color-scheme: dark){ :root:not([data-theme="light"]) .status-chip-in_review{ background:rgba(160,140,255,.16); color:#bdb0ff; } }

/* ----- Sections list & editor ----- */
.sec-row{ display:flex; align-items:center; gap:12px; padding:13px 14px; border:1px solid var(--border); border-radius:var(--radius-md); background:var(--bg-elevated); cursor:pointer; transition:border-color 150ms, transform 150ms; }
.sec-row + .sec-row{ margin-top:8px; } .sec-row:hover{ border-color:var(--brand); transform:translateY(-1px); }
.sec-num{ width:26px; height:26px; border-radius:50%; background:var(--brand-soft); color:var(--brand-deep); font-size:11.5px; font-weight:800; display:flex; align-items:center; justify-content:center; flex:none; }
.editor-layout{ display:grid; grid-template-columns:minmax(0,1fr) 290px; gap:18px; align-items:start; }
@media (max-width:1000px){ .editor-layout{ grid-template-columns:1fr; } }
.editor-bar{ display:flex; flex-wrap:wrap; gap:4px; padding:8px; border:1.5px solid var(--border-strong); border-bottom:none; border-radius:var(--radius-md) var(--radius-md) 0 0; background:var(--bg-elevated); position:sticky; top:calc(64px + env(safe-area-inset-top,0)); z-index:5; }
.editor-bar button{ min-width:34px; height:34px; border:none; background:none; border-radius:8px; font-weight:800; color:var(--ink-soft); font-size:13px; display:inline-flex; align-items:center; justify-content:center; }
.editor-bar button:hover{ background:var(--brand-soft); color:var(--brand-deep); } .editor-bar .sep{ width:1px; background:var(--border); margin:4px 4px; }
.editor{ min-height:380px; padding:22px 24px; border:1.5px solid var(--border-strong); border-radius:0 0 var(--radius-md) var(--radius-md); background:var(--bg-elevated); font-family:var(--font-display); font-size:16.5px; line-height:1.75; outline:none; overflow-wrap:anywhere; }
.editor:focus{ border-color:var(--brand); box-shadow:0 0 0 3.5px var(--brand-soft); }
.editor[contenteditable="false"]{ background:var(--bg); }
.prose h2,.editor h2{ font-size:20px; margin:18px 0 6px; } .prose h3,.editor h3{ font-size:17px; margin:14px 0 4px; } .prose h4,.editor h4{ font-size:15px; margin:12px 0 4px; }
.prose p,.editor p{ margin:0 0 10px; } .prose ul,.prose ol,.editor ul,.editor ol{ margin:0 0 10px; padding-left:24px; }
.prose blockquote,.editor blockquote{ margin:10px 0; padding:4px 14px; border-left:3px solid var(--brand); color:var(--ink-soft); }
.prose table,.editor table{ border-collapse:collapse; width:100%; margin:10px 0; font-size:14px; font-family:var(--font-body); } .prose td,.prose th,.editor td,.editor th{ border:1px solid var(--border-strong); padding:6px 9px; vertical-align:top; } .prose th,.editor th{ background:var(--brand-soft); text-align:left; }
.prose{ font-family:var(--font-display); font-size:16px; line-height:1.75; overflow-wrap:anywhere; }
.save-state{ font-size:11.5px; color:var(--ink-faint); font-weight:600; } .save-state.saving{ color:var(--warning); } .save-state.saved{ color:var(--vital); } .save-state.err{ color:var(--critical); }
.readonly-banner{ display:flex; gap:10px; padding:11px 14px; border-radius:var(--radius-sm); background:var(--brand-soft); color:var(--brand-deep); font-size:12.8px; margin-bottom:12px; font-weight:600; }
.readonly-banner svg{ width:16px; height:16px; flex:none; margin-top:2px; }
.read-doc{ max-width:760px; margin:0 auto; } .read-doc .sec-h{ font-family:var(--font-display); font-size:20px; margin:26px 0 8px; padding-bottom:6px; border-bottom:1px solid var(--border); }
.hist-row{ display:flex; align-items:center; gap:10px; padding:9px 0; border-bottom:1px solid var(--border); font-size:12.5px; }

/* ----- Files / ethics ----- */
.folder-chips{ display:flex; flex-wrap:wrap; gap:8px; margin-bottom:14px; }
.fchip{ display:inline-flex; align-items:center; gap:7px; padding:7px 13px; border-radius:999px; border:1.5px solid var(--border-strong); background:var(--bg-elevated); font-size:12.5px; font-weight:700; color:var(--ink-soft); }
.fchip.active{ background:var(--brand); border-color:var(--brand); color:#fff; } .fchip .n{ font-family:var(--font-mono); font-size:10.5px; opacity:.75; }
.file-row{ padding:11px 4px; } .file-row .file-icon svg{ width:16px; height:16px; }
.upload-card{ border:1.8px dashed var(--border-strong); border-radius:var(--radius-md); padding:16px; margin-bottom:14px; }
.upload-card.drag{ border-color:var(--brand); background:var(--brand-soft); }
.progress-line{ height:5px; background:var(--border); border-radius:99px; overflow:hidden; margin-top:8px; } .progress-line i{ display:block; height:100%; width:0; background:var(--brand); transition:width 150ms; }
.ethics-status{ display:flex; align-items:center; gap:12px; padding:14px 16px; border-radius:var(--radius-md); background:var(--brand-soft); margin-bottom:14px; }
.ethics-status.good{ background:var(--vital-soft); } .ethics-status.bad{ background:var(--critical-soft); } .ethics-status.warn{ background:var(--warning-soft); }
.ethics-status .big{ font-family:var(--font-display); font-size:18px; font-weight:700; }
.exp-badge{ font-size:10.5px; font-weight:800; padding:2px 8px; border-radius:99px; } .exp-ok{ background:var(--vital-soft); color:var(--vital); } .exp-soon{ background:var(--warning-soft); color:var(--warning); } .exp-bad{ background:var(--critical-soft); color:var(--critical); }

/* ----- Chat ----- */
.chat-shell{ display:grid; grid-template-columns:300px minmax(0,1fr); gap:0; height:calc(100vh - 190px); min-height:420px; overflow:hidden; padding:0; }
.chat-side{ border-right:1px solid var(--border); overflow-y:auto; }
.chan{ display:flex; gap:10px; align-items:center; width:100%; text-align:left; padding:12px 14px; border:none; border-bottom:1px solid var(--border); background:none; }
.chan:hover,.chan.active{ background:var(--brand-soft); } .chan .nm{ font-weight:700; font-size:13px; } .chan .pv{ font-size:11.8px; color:var(--ink-faint); }
.chan .ico{ width:36px; height:36px; border-radius:11px; background:var(--brand-soft); color:var(--brand-deep); display:flex; align-items:center; justify-content:center; flex:none; } .chan .ico svg{ width:18px; height:18px; }
.chat{ display:flex; flex-direction:column; min-height:0; height:100%; }
.chat-head{ padding:12px 16px; border-bottom:1px solid var(--border); display:flex; align-items:center; gap:10px; }
.chat-scroll{ flex:1; overflow-y:auto; padding:14px 16px; display:flex; flex-direction:column; gap:3px; }
.msg-wrap{ display:flex; flex-direction:column; align-items:flex-start; max-width:82%; } .msg-wrap.me{ align-self:flex-end; align-items:flex-end; }
.msg-name{ font-size:10.8px; font-weight:700; color:var(--ink-faint); margin:8px 8px 2px; }
.msg{ padding:9px 13px; border-radius:16px 16px 16px 5px; background:var(--brand-soft); color:var(--ink); font-size:13.5px; white-space:pre-wrap; overflow-wrap:anywhere; }
.msg-wrap.me .msg{ background:var(--brand); color:#fff; border-radius:16px 16px 5px 16px; }
.msg.kind-question{ background:var(--warning-soft); color:var(--ink); border:1px solid var(--warning); } .msg.kind-review{ background:#E7E4F7; color:#2f2570; }
.msg .kind{ display:block; font-size:10px; text-transform:uppercase; letter-spacing:.6px; font-weight:800; margin-bottom:3px; opacity:.8; }
.msg-time{ font-size:10px; color:var(--ink-faint); margin:2px 8px 0; }
.day-sep{ text-align:center; font-size:10.5px; color:var(--ink-faint); font-weight:700; margin:12px 0 4px; text-transform:uppercase; letter-spacing:.5px; }
.chat-form{ display:flex; gap:8px; padding:10px 12px calc(10px + env(safe-area-inset-bottom,0)); border-top:1px solid var(--border); align-items:flex-end; }
.chat-form textarea{ flex:1; resize:none; min-height:42px; max-height:120px; border-radius:20px; padding:11px 15px; }
.paper-chat{ height:calc(100vh - 360px); min-height:380px; padding:0; overflow:hidden; display:flex; flex-direction:column; }
@media (max-width:860px){
  .chat-shell{ grid-template-columns:1fr; height:calc(100vh - 170px - env(safe-area-inset-bottom,0)); } .chat-shell.in-thread .chat-side{ display:none; } .chat-shell:not(.in-thread) .chat-main{ display:none; }
  .msg-wrap{ max-width:90%; } .paper-chat{ height:calc(100vh - 330px); }
}

/* ----- Calendar ----- */
.cal-head{ display:flex; align-items:center; gap:10px; margin-bottom:12px; flex-wrap:wrap; } .cal-title{ font-family:var(--font-display); font-size:20px; font-weight:700; min-width:150px; }
.cal-grid{ display:grid; grid-template-columns:repeat(7,1fr); border:1px solid var(--border); border-radius:var(--radius-md); overflow:hidden; background:var(--bg-elevated); }
.cal-dow{ padding:8px 4px; text-align:center; font-size:10.5px; font-weight:800; text-transform:uppercase; letter-spacing:.5px; color:var(--ink-faint); background:var(--bg); border-bottom:1px solid var(--border); }
.cal-cell{ min-height:96px; padding:6px; border-right:1px solid var(--border); border-bottom:1px solid var(--border); cursor:pointer; position:relative; background:none; text-align:left; display:block; border-top:none; border-left:none; font:inherit; color:inherit; }
.cal-cell:nth-child(7n){ border-right:none; } .cal-cell:hover{ background:var(--brand-soft); } .cal-cell.other{ opacity:.45; }
.cal-cell .d{ font-size:12px; font-weight:700; display:inline-flex; width:24px; height:24px; align-items:center; justify-content:center; border-radius:50%; } .cal-cell.today .d{ background:var(--brand); color:#fff; } .cal-cell.sel{ box-shadow:inset 0 0 0 2px var(--brand); }
.cal-ev{ display:block; font-size:10.5px; font-weight:700; padding:2px 6px; border-radius:6px; margin-top:3px; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; background:var(--brand-soft); color:var(--brand-deep); }
.cal-ev.t-task{ background:var(--warning-soft); color:var(--warning); } .cal-ev.t-paper{ background:var(--critical-soft); color:var(--critical); } .cal-ev.k-reminder{ background:var(--vital-soft); color:var(--vital); }
.cal-dots{ display:none; gap:3px; margin-top:4px; flex-wrap:wrap; } .cal-dots i{ width:6px; height:6px; border-radius:50%; background:var(--brand); } .cal-dots i.t-task{ background:var(--warning); } .cal-dots i.t-paper{ background:var(--critical); }
@media (max-width:700px){ .cal-cell{ min-height:54px; padding:4px; } .cal-ev{ display:none; } .cal-dots{ display:flex; } }
.agenda-item{ display:flex; gap:12px; padding:11px 0; border-bottom:1px solid var(--border); cursor:pointer; } .agenda-item:last-child{ border-bottom:none; }
.agenda-time{ width:58px; flex:none; font-family:var(--font-mono); font-size:11.5px; color:var(--ink-soft); padding-top:2px; }
.kind-bar{ width:4px; border-radius:4px; background:var(--brand); flex:none; } .kind-bar.t-task{ background:var(--warning); } .kind-bar.t-paper{ background:var(--critical); } .kind-bar.k-reminder{ background:var(--vital); }

/* ----- Library ----- */
.lib-card{ padding:18px; display:flex; flex-direction:column; gap:8px; cursor:pointer; text-align:left; border:1px solid var(--glass-border); transition:transform 150ms, box-shadow 150ms; }
.lib-card:hover{ transform:translateY(-2px); box-shadow:var(--shadow-lg); } .lib-card h4{ font-size:15px; } .lib-card p{ font-size:12.3px; color:var(--ink-soft); }
.lib-short{ display:inline-block; font-family:var(--font-mono); font-weight:800; font-size:11px; padding:3px 9px; border-radius:8px; background:var(--brand-soft); color:var(--brand-deep); align-self:flex-start; }
.lib-items{ display:flex; flex-direction:column; gap:0; margin:12px 0; border:1px solid var(--border); border-radius:var(--radius-md); overflow:hidden; }
.lib-item{ display:grid; grid-template-columns:170px 1fr; gap:14px; padding:11px 14px; border-bottom:1px solid var(--border); font-size:13px; } .lib-item:last-child{ border-bottom:none; } .lib-item b{ color:var(--brand-deep); }
@media (max-width:620px){ .lib-item{ grid-template-columns:1fr; gap:2px; } }

/* ----- Roles matrix ----- */
.roles-layout{ display:grid; grid-template-columns:260px minmax(0,1fr); gap:18px; align-items:start; } @media (max-width:860px){ .roles-layout{ grid-template-columns:1fr; } }
.role-item{ display:flex; align-items:center; gap:10px; width:100%; text-align:left; padding:12px 14px; border:1px solid var(--border); background:var(--bg-elevated); border-radius:var(--radius-md); margin-bottom:8px; }
.role-item.active{ border-color:var(--brand); box-shadow:0 0 0 3px var(--brand-soft); } .role-item b{ font-size:13.5px; }
.perm-group{ margin-bottom:16px; } .perm-group h5{ font-family:var(--font-body); font-size:11px; letter-spacing:.6px; text-transform:uppercase; color:var(--brand); margin:0 0 6px; }
.perm-row{ display:flex; align-items:center; gap:12px; padding:10px 0; border-bottom:1px solid var(--border); font-size:13px; } .perm-row .k{ font-family:var(--font-mono); font-size:10.5px; color:var(--ink-faint); }

/* ----- Misc ----- */
.table-wrap{ overflow-x:auto; padding:6px; } .data-table th,.data-table td{ white-space:nowrap; } .data-table td.wrap{ white-space:normal; min-width:180px; }
.mono{ font-family:var(--font-mono); } .invite-box{ display:flex; gap:8px; align-items:center; background:var(--bg); border:1px solid var(--border); border-radius:var(--radius-sm); padding:8px 10px; } .invite-box input{ flex:1; border:none; background:none; font-family:var(--font-mono); font-size:11.5px; min-width:0; }
.member-row{ display:flex; align-items:center; gap:10px; padding:10px 0; border-bottom:1px solid var(--border); } .member-row:last-child{ border-bottom:none; }
.feed-row{ display:flex; gap:10px; padding:9px 0; border-bottom:1px solid var(--border); font-size:12.8px; } .feed-row:last-child{ border-bottom:none; } .feed-row .dot{ width:7px; height:7px; border-radius:50%; background:var(--brand); margin-top:7px; flex:none; } .feed-row .t{ margin-left:auto; font-size:10.5px; color:var(--ink-faint); white-space:nowrap; font-family:var(--font-mono); }
.modal-foot{ display:flex; gap:10px; justify-content:flex-end; margin-top:18px; flex-wrap:wrap; }
.modal{ max-width:560px; } .modal.modal-lg{ max-width:900px; }
@media (max-width:620px){ .modal-backdrop{ padding:0; align-items:flex-end; } .modal{ max-height:94vh; border-radius:22px 22px 0 0; max-width:none !important; } }
.field-row{ display:grid; grid-template-columns:1fr 1fr; gap:12px; } @media (max-width:520px){ .field-row{ grid-template-columns:1fr; } }
.dropdown-menu{ position:absolute; right:0; top:calc(100% + 6px); z-index:30; min-width:210px; padding:6px; display:none; } .dropdown-menu.show{ display:block; }
.help-card{ display:flex; gap:12px; padding:14px 16px; border-radius:var(--radius-md); background:var(--brand-soft); color:var(--brand-deep); font-size:12.8px; } .help-card svg{ width:18px; height:18px; flex:none; margin-top:1px; }
.chip svg{ width:12px; height:12px; }
.btn svg{ flex:none; }
.input[type="date"],.input[type="time"]{ min-height:44px; }
select.input{ appearance:auto; }
@media (hover:none){ .paper-card:hover,.group-card:hover,.tool-card:hover,.lib-card:hover{ transform:none; } }
@media print{ .topbar,.sidebar,.bottom-nav,.tabs,.btn,.view-head .btn{ display:none !important; } main.view-root{ padding:0 !important; } .glass{ box-shadow:none; border:none; background:none; backdrop-filter:none; } }

/* ---- polish: link + icon sizing fixes ---- */
a.nav-item, .bottom-nav a, a.btn, a.pop-item, .brand, a.search-hit, a.notif { text-decoration:none; }
.btn-icon svg { width:18px; height:18px; flex:none; }
.row-flex svg, .pmeta svg, .tiny svg, .chip svg, .pop-item svg, .notif svg, .empty > svg { flex:none; }
.row-flex svg, .pmeta svg, .tiny svg { width:14px; height:14px; }
.empty > svg { width:34px; height:34px; }
/* default icon size — class rules above override this */
svg { width:16px; height:16px; }
svg.vitals-trace, svg.auth-trace-bg { width:100%; height:100%; }
.tabs a, .tab, a.chip, .chip a, .kv a, .stat-tile a, .view-head a.btn, a.link-btn:not(.u) { text-decoration:none; }
.tabs a:hover, .tab:hover { text-decoration:none; }

/* ======================= v1.1 — Arabic / RTL, chat media, notes, pickers, bulk import ======================= */
@font-face{ font-family:'Cairo'; font-weight:400; font-display:swap; src:url(../fonts/cairo-arabic-400-normal.woff2) format('woff2'); unicode-range:U+0600-06FF,U+0750-077F,U+08A0-08FF,U+FB50-FDFF,U+FE70-FEFC,U+200C-200F; }
@font-face{ font-family:'Cairo'; font-weight:600; font-display:swap; src:url(../fonts/cairo-arabic-600-normal.woff2) format('woff2'); unicode-range:U+0600-06FF,U+0750-077F,U+08A0-08FF,U+FB50-FDFF,U+FE70-FEFC,U+200C-200F; }
@font-face{ font-family:'Cairo'; font-weight:700; font-display:swap; src:url(../fonts/cairo-arabic-700-normal.woff2) format('woff2'); unicode-range:U+0600-06FF,U+0750-077F,U+08A0-08FF,U+FB50-FDFF,U+FE70-FEFC,U+200C-200F; }
:root{ --font-body:-apple-system, BlinkMacSystemFont,'Segoe UI', Roboto, 'Cairo', Helvetica, Arial, sans-serif; --font-display:'Iowan Old Style','Palatino Linotype', Georgia, 'Cairo', 'Times New Roman', serif; }
/* text the user wrote picks its own direction (Arabic reads right-to-left, English left-to-right) */
.msg-text,.note-body,.note-title,.ptitle-auto,[dir=auto]{ unicode-bidi:plaintext; }
.editor[data-dir=auto] p,.editor[data-dir=auto] li,.editor[data-dir=auto] h2,.editor[data-dir=auto] h3,.editor[data-dir=auto] h4,.editor[data-dir=auto] blockquote,
.prose[data-dir=auto] p,.prose[data-dir=auto] li,.prose[data-dir=auto] h2,.prose[data-dir=auto] h3{ unicode-bidi:plaintext; text-align:start; }
.editor[dir=rtl] ul,.editor[dir=rtl] ol,.prose[dir=rtl] ul,.prose[dir=rtl] ol,.editor [dir=rtl] ul,.editor li[dir=rtl]{ padding-left:0; padding-right:24px; }
.editor[dir=rtl] blockquote,.editor blockquote[dir=rtl]{ border-left:none; border-right:3px solid var(--brand); }
.editor [dir=rtl]{ text-align:right; } .editor [dir=ltr]{ text-align:left; }
.dir-seg{ display:inline-flex; border:1.5px solid var(--border-strong); border-radius:999px; overflow:hidden; background:var(--bg-elevated); }
.dir-seg button{ border:none; background:none; padding:6px 12px; font-size:12px; font-weight:700; color:var(--ink-soft); cursor:pointer; }
.dir-seg button.active{ background:var(--brand); color:#fff; }

/* chat: mentions, photos, links, composer extras */
.mention{ color:var(--brand-deep); background:var(--brand-soft); border-radius:6px; padding:0 4px; font-weight:700; }
.msg-wrap.me .mention{ background:rgba(255,255,255,.22); color:#fff; }
.msg a{ color:inherit; text-decoration:underline; text-underline-offset:2px; word-break:break-all; } .msg a .dom{ opacity:.7; font-size:11px; margin-left:4px; }
.msg-photo{ display:block; max-width:min(280px,100%); max-height:240px; border-radius:12px; margin:4px 0 2px; cursor:zoom-in; background:var(--bg); object-fit:cover; }
.msg.has-photo{ padding:5px; } .msg.has-photo .msg-text{ display:block; padding:4px 8px 3px; }
.photo-expired{ display:flex; align-items:center; gap:8px; padding:12px 14px; border:1.5px dashed var(--border-strong); border-radius:12px; font-size:12px; color:var(--ink-faint); background:var(--bg); }
.photo-expired svg{ width:18px; height:18px; flex:none; }
.msg-wrap.me .photo-expired{ background:rgba(255,255,255,.14); color:rgba(255,255,255,.85); border-color:rgba(255,255,255,.4); }
.chat-compose{ position:relative; border-top:1px solid var(--border); }
.chat-compose .chat-form{ border-top:none; }
.chat-attach{ flex:none; width:42px; height:42px; border-radius:50%; border:none; background:var(--brand-soft); color:var(--brand-deep); display:inline-flex; align-items:center; justify-content:center; cursor:pointer; }
.chat-attach svg{ width:19px; height:19px; } .chat-attach:hover{ filter:brightness(.96); }
.chat-preview{ display:none; align-items:center; gap:10px; padding:8px 14px 0; } .chat-preview.show{ display:flex; }
.chat-preview img{ width:54px; height:54px; border-radius:10px; object-fit:cover; border:1px solid var(--border); }
.chat-hint{ padding:0 16px 8px; font-size:11px; color:var(--ink-faint); }
.mention-pop{ position:absolute; left:12px; right:12px; bottom:calc(100% - 4px); max-width:340px; background:var(--bg-elevated); border:1px solid var(--border-strong); border-radius:14px; box-shadow:var(--shadow-md); padding:6px; display:none; z-index:20; max-height:240px; overflow:auto; }
.mention-pop.show{ display:block; } .mention-item{ display:flex; align-items:center; gap:9px; padding:7px 9px; border-radius:9px; cursor:pointer; font-size:13px; } .mention-item.sel,.mention-item:hover{ background:var(--brand-soft); }
.chat-drop{ outline:3px dashed var(--brand); outline-offset:-6px; }
.lightbox{ text-align:center; } .lightbox img{ max-width:100%; max-height:76vh; border-radius:12px; }

/* notes */
.notes-grid{ display:grid; grid-template-columns:repeat(auto-fill,minmax(280px,1fr)); gap:14px; align-items:start; }
.note-card{ padding:16px 18px; border-radius:var(--radius-md); } .note-card.pinned{ border-color:var(--warning); box-shadow:0 0 0 1px var(--warning) inset; }
.note-card .note-title{ font-weight:700; font-size:14.5px; margin-bottom:6px; display:flex; gap:8px; align-items:flex-start; } .note-card .note-title svg{ width:15px; height:15px; color:var(--warning); flex:none; margin-top:3px; }
.note-body{ font-size:13.5px; white-space:pre-wrap; overflow-wrap:anywhere; color:var(--ink); line-height:1.6; max-height:260px; overflow:auto; }
.note-body a{ color:var(--brand); word-break:break-all; }
.note-meta{ display:flex; align-items:center; gap:6px; margin-top:10px; font-size:11.5px; color:var(--ink-faint); flex-wrap:wrap; }
.note-meta .grow{ flex:1; } .note-meta .btn-icon{ width:30px; height:30px; }
.note-mini{ padding:9px 0; border-bottom:1px solid var(--border); } .note-mini:last-child{ border-bottom:none; } .note-mini b{ font-size:13px; } .note-mini div{ font-size:12.5px; color:var(--ink-soft); overflow:hidden; display:-webkit-box; -webkit-line-clamp:2; -webkit-box-orient:vertical; }

/* people picker (add specific people to a paper) */
.pick-box{ border:1.5px solid var(--border-strong); border-radius:var(--radius-md); padding:10px; background:var(--bg-elevated); }
.pick-chips{ display:flex; flex-wrap:wrap; gap:8px; margin-bottom:8px; }
.pick-chip{ display:inline-flex; align-items:center; gap:7px; background:var(--brand-soft); color:var(--brand-deep); border-radius:999px; padding:4px 6px 4px 4px; font-size:12.5px; font-weight:700; }
.pick-chip select{ border:none; background:transparent; font-size:11.5px; font-weight:700; color:inherit; padding:0 2px; } .pick-chip button{ border:none; background:rgba(0,0,0,.08); width:20px; height:20px; border-radius:50%; cursor:pointer; line-height:1; color:inherit; }
.pick-results{ max-height:210px; overflow:auto; margin-top:6px; } .pick-row{ display:flex; align-items:center; gap:10px; padding:7px 6px; border-radius:10px; cursor:pointer; } .pick-row:hover{ background:var(--brand-soft); }
.pick-row .nm{ font-weight:700; font-size:13px; } .pick-row .sub{ font-size:11.5px; color:var(--ink-faint); } .pick-row .grow{ flex:1; min-width:0; }
.chip-outside{ background:var(--warning-soft); color:var(--warning); }

/* bulk import wizard */
.imp-steps{ display:flex; gap:6px; margin-bottom:16px; flex-wrap:wrap; } .imp-steps div{ flex:1; min-width:90px; text-align:center; padding:8px 4px; border-radius:10px; background:var(--bg); color:var(--ink-faint); font-size:12px; font-weight:700; }
.imp-steps div.on{ background:var(--brand); color:#fff; } .imp-steps div.done{ background:var(--vital-soft); color:var(--vital); }
.drop-zone{ border:2px dashed var(--border-strong); border-radius:var(--radius-md); padding:26px 16px; text-align:center; cursor:pointer; background:var(--bg); transition:.15s; } .drop-zone:hover,.drop-zone.over{ border-color:var(--brand); background:var(--brand-soft); }
.drop-zone svg{ width:30px; height:30px; color:var(--brand); } .drop-zone b{ display:block; margin-top:6px; }
.imp-tiles{ display:grid; grid-template-columns:repeat(auto-fit,minmax(110px,1fr)); gap:10px; margin:12px 0; } .imp-tile{ padding:12px; border-radius:12px; background:var(--bg); text-align:center; } .imp-tile b{ display:block; font-size:24px; font-family:var(--font-mono); }
.imp-tile.good b{ color:var(--vital); } .imp-tile.warn b{ color:var(--warning); } .imp-tile.bad b{ color:var(--critical); } .imp-tile span{ font-size:11.5px; color:var(--ink-faint); font-weight:700; }
.imp-table{ max-height:300px; overflow:auto; border:1px solid var(--border); border-radius:12px; } .imp-table table{ width:100%; border-collapse:collapse; font-size:12.5px; } .imp-table th,.imp-table td{ padding:7px 9px; text-align:start; border-bottom:1px solid var(--border); vertical-align:top; } .imp-table th{ position:sticky; top:0; background:var(--bg-elevated); z-index:1; }
.progress-big{ height:12px; border-radius:7px; background:var(--border); overflow:hidden; margin:10px 0; } .progress-big i{ display:block; height:100%; background:linear-gradient(90deg,var(--brand),var(--vital)); width:0; transition:width .25s; }
.opt-row{ display:flex; align-items:flex-start; gap:9px; font-size:13px; padding:5px 0; } .opt-row input{ margin-top:3px; }
.modal-xl{ max-width:980px !important; }

.paper-hero .title-row{ display:flex; flex-wrap:wrap; gap:10px 14px; align-items:flex-start; } .paper-hero .title-row h1{ flex:1 1 300px; min-width:0; } .paper-hero .title-row > .row-flex{ margin-inline-start:auto; }

/* =====================================================================
   v1.2 additions
   ===================================================================== */
.select{ padding:9px 12px; border-radius:999px; border:1.5px solid var(--border-strong); background:var(--bg-elevated); color:var(--ink); font-size:12.5px; font-weight:600; max-width:100%; }
.select:focus{ outline:none; border-color:var(--brand); box-shadow:0 0 0 3px var(--brand-soft); }
.stack-sm{ display:flex; flex-direction:column; gap:8px; }
/* avatars with photos + clickable people */
.avatar.has-pic{ background-size:cover; background-position:center; color:transparent; }
.avatar-xl{ width:56px; height:56px; font-size:19px; } .avatar-xxl{ width:92px; height:92px; font-size:31px; }
.uc{ cursor:pointer; } .avatar.uc:hover{ box-shadow:0 0 0 3px var(--brand-soft); }
.uname{ color:inherit; text-decoration:none; font-weight:inherit; border-bottom:1px dotted transparent; }
.uname:hover{ color:var(--brand); border-bottom-color:var(--brand); }
.user-card{ position:fixed; z-index:200; width:min(320px, calc(100vw - 20px)); padding:16px; border-radius:var(--radius-md); box-shadow:var(--shadow-lg); border:1px solid var(--glass-border); background:var(--bg-elevated); animation:ucIn .14s ease-out; }
@keyframes ucIn{ from{ opacity:0; transform:translateY(4px) scale(.98); } to{ opacity:1; transform:none; } }
.user-card .uc-top{ display:flex; gap:12px; align-items:center; }
.user-card .uc-id{ display:flex; flex-direction:column; min-width:0; } .user-card .uc-id b{ font-size:15px; overflow-wrap:anywhere; } .user-card .uc-id span{ font-size:12.5px; color:var(--ink-soft); } .user-card .uc-role{ color:var(--ink-faint) !important; font-size:11.5px !important; }
.user-card .uc-rows{ margin:12px 0 12px; display:flex; flex-direction:column; gap:7px; font-size:12.8px; }
.user-card .uc-row{ display:flex; align-items:center; gap:8px; min-width:0; overflow-wrap:anywhere; } .user-card .uc-row svg{ width:15px; height:15px; flex:none; color:var(--ink-faint); } .user-card .uc-row a{ color:var(--brand); }
.user-card .uc-btn{ width:100%; justify-content:center; } .uc-load{ padding:14px; font-size:13px; color:var(--ink-soft); text-align:center; }
.orcid-link{ display:inline-flex !important; align-items:center; gap:6px; color:var(--ink) !important; text-decoration:none; font-size:12.5px; } .orcid-link:hover span{ text-decoration:underline; }
.orcid-ico{ width:16px !important; height:16px !important; flex:none; color:initial !important; }
.profile-hero .profile-line{ display:flex; align-items:center; gap:8px; margin-top:8px; font-size:13.5px; } .profile-line svg{ width:16px; height:16px; color:var(--ink-faint); flex:none; } .profile-line a{ color:var(--brand); }
.bio-text{ font-size:14px; line-height:1.65; margin:0; }
.link-chip{ text-decoration:none; } .link-chip svg{ width:13px; height:13px; }
.list-link{ display:flex; align-items:center; gap:10px; padding:9px 4px; text-decoration:none; color:var(--ink); border-bottom:1px solid var(--border); font-size:13.5px; } .list-link:last-child{ border-bottom:none; } .list-link svg{ width:16px; height:16px; color:var(--ink-faint); flex:none; } .list-link span:not(.chip){ flex:1; min-width:0; overflow-wrap:anywhere; } .list-link:hover{ color:var(--brand); }
.link-row{ display:flex; gap:8px; align-items:center; } .link-row .input{ flex:1; min-width:0; } .link-row .select{ flex:none; width:150px; }
/* footer */
.app-foot{ display:flex; flex-wrap:wrap; gap:4px 8px; justify-content:center; padding:26px 16px 22px; margin-top:30px; font-size:11.8px; color:var(--ink-faint); text-align:center; border-top:1px solid var(--border); } .app-foot a{ color:var(--brand); text-decoration:none; font-weight:600; } .app-foot a:hover{ text-decoration:underline; } .app-foot .dotsep{ opacity:.5; }
.auth-foot{ position:absolute; left:0; right:0; bottom:0; border:none; margin:0; padding:14px; }
@media (max-width:700px){ .app-foot .dotsep{ display:none; } .app-foot span{ flex-basis:100%; } .view-root{ padding-bottom:calc(var(--bottom-nav-h, 64px) + 10px); } }
/* sections list: drag, status */
.sec-grip{ cursor:grab; color:var(--ink-faint); letter-spacing:-2px; padding:6px 4px; user-select:none; touch-action:none; font-weight:800; font-size:15px; } .sec-grip:hover{ color:var(--brand); } .sec-grip:active{ cursor:grabbing; }
.sec-row.dragging{ position:fixed; z-index:150; opacity:.96; box-shadow:var(--shadow-lg); pointer-events:none; transform:none !important; border-color:var(--brand); }
.sec-ph{ border:2px dashed var(--brand); border-radius:var(--radius-md); background:var(--brand-soft); margin-top:8px; opacity:.7; }
body.dragging-sec{ user-select:none; cursor:grabbing; }
.chip-btn{ border:none; cursor:pointer; font-family:inherit; } .chip-btn svg{ width:11px; height:11px; } .chip-btn:hover{ filter:brightness(.96); box-shadow:0 0 0 2px var(--brand-soft); }
.dropdown-menu{ min-width:190px; }
/* tasks: multi assign */
.assign-grid{ display:grid; grid-template-columns:repeat(auto-fill,minmax(190px,1fr)); gap:6px; max-height:190px; overflow:auto; padding:8px; border:1.5px solid var(--border-strong); border-radius:var(--radius-md); background:var(--bg-elevated); }
.assign-pick{ display:flex; align-items:center; gap:8px; padding:6px 8px; border-radius:9px; font-size:13px; cursor:pointer; } .assign-pick:hover{ background:var(--brand-soft); } .assign-pick:has(input:checked){ background:var(--brand-soft); font-weight:700; }
.pick-mail{ color:var(--ink); font-weight:700; } .pick-invite{ border:1.5px dashed var(--warning); background:var(--warning-soft); }
/* chat event card */
.msg-wrap.event{ align-self:stretch; max-width:100%; margin:8px 0; }
.event-card{ border:1px solid var(--border-strong); border-left:4px solid var(--brand); border-radius:var(--radius-md); background:var(--bg-elevated); padding:12px 14px; max-width:420px; box-shadow:var(--shadow-sm); } .event-card.k-deadline{ border-left-color:var(--critical); } .event-card.k-reminder{ border-left-color:var(--warning); } .event-card.removed{ opacity:.7; border-left-color:var(--ink-faint); }
.ec-top{ display:flex; align-items:center; gap:8px; font-size:11.8px; font-weight:700; color:var(--ink-soft); text-transform:uppercase; letter-spacing:.4px; } .ec-top svg{ width:15px; height:15px; color:var(--brand); }
.ec-body{ display:flex; gap:12px; align-items:center; margin:10px 0; } .ec-date{ width:48px; flex:none; text-align:center; border-radius:10px; background:var(--brand-soft); color:var(--brand-deep); padding:5px 0; } .ec-date b{ display:block; font-size:19px; line-height:1.1; } .ec-date span{ font-size:10.5px; text-transform:uppercase; font-weight:700; }
.ec-title{ font-weight:700; font-size:14.5px; overflow-wrap:anywhere; } .ec-meta{ font-size:12.3px; color:var(--ink-soft); margin-top:2px; } .ec-actions{ display:flex; flex-wrap:wrap; gap:8px; }
/* people admin */
.pe-status{ margin-bottom:12px; flex-wrap:wrap; } .pe-filters{ gap:8px; } .pe-filters .select{ flex:none; }
.sortable{ cursor:pointer; user-select:none; white-space:nowrap; } .sortable:hover{ color:var(--brand); } .sortable.sorted{ color:var(--brand-deep); } .sort-arrow{ margin-left:4px; font-size:11px; }
.pe-table tr.selected td{ background:var(--brand-soft); } .pe-table input[type=checkbox]{ width:16px; height:16px; accent-color:var(--brand); cursor:pointer; }
.bulk-bar{ position:sticky; top:68px; z-index:20; display:flex; flex-wrap:wrap; align-items:center; gap:8px; padding:10px 14px; margin-bottom:10px; border-radius:var(--radius-md); border:1px solid var(--brand); box-shadow:var(--shadow-md); }
.pager{ display:flex; align-items:center; gap:10px; margin-top:12px; flex-wrap:wrap; }
/* ---- Editor ---- */
.ek-bar{ position:sticky; top:62px; z-index:30; align-items:center; gap:2px !important; }
.ek-bar button.ek{ min-width:32px; height:32px; padding:0 6px; border:none; background:none; border-radius:8px; font-weight:700; color:var(--ink-soft); font-size:13px; display:inline-flex; align-items:center; justify-content:center; gap:3px; cursor:pointer; }
.ek-bar button.ek svg{ width:16px; height:16px; } .ek-bar button.ek:hover{ background:var(--brand-soft); color:var(--brand-deep); } .ek-bar button.ek.on{ background:var(--brand); color:#fff; }
.ek-bar .ek-wide{ padding:0 8px; } .ek-bar .car{ font-size:9px; opacity:.7; } .ek-A{ font-family:var(--font-display); font-weight:800; border-bottom:3px solid var(--critical); line-height:1.1; padding:0 2px; } .ek-hl svg{ background:#FFE066; border-radius:3px; padding:1px; color:#5b4a00; } .ek-cite{ font-size:11px; font-family:var(--font-mono); }
.ek-dd{ position:relative; display:inline-flex; } .ek-menu{ display:none; position:absolute; top:100%; left:0; margin-top:4px; min-width:150px; padding:6px; z-index:60; border-radius:var(--radius-md); box-shadow:var(--shadow-lg); border:1px solid var(--glass-border); background:var(--bg-elevated); flex-direction:column; gap:2px; } .ek-dd.open .ek-menu{ display:flex; }
.ek-menu > button{ text-align:left; border:none; background:none; padding:7px 10px; border-radius:8px; font-size:13px; color:var(--ink); cursor:pointer; } .ek-menu > button:hover{ background:var(--brand-soft); }
.ek-s-h2{ font-size:18px !important; font-weight:800; } .ek-s-h3{ font-size:16px !important; font-weight:700; } .ek-s-h4{ font-size:14px !important; font-weight:700; } .ek-s-q{ font-style:italic; border-left:3px solid var(--brand) !important; border-radius:0 !important; }
.ek-sw{ display:flex; gap:6px; padding:4px 6px 6px; } .sw{ width:24px; height:24px; border-radius:50% !important; border:2px solid var(--bg-elevated) !important; box-shadow:0 0 0 1px var(--border-strong); cursor:pointer; padding:0 !important; min-width:24px !important; } .sw:hover{ transform:scale(1.15); }
.ek-note{ font-size:11px; color:var(--ink-faint); padding:4px 8px; max-width:200px; }
.ek-grid{ display:grid; grid-template-columns:repeat(6,22px); gap:3px; padding:6px; } .ek-grid i{ width:22px; height:22px; border:1.5px solid var(--border-strong); border-radius:4px; cursor:pointer; } .ek-grid i.on{ background:var(--brand); border-color:var(--brand); }
.ek-ctx{ display:flex; flex-wrap:wrap; gap:6px; align-items:center; padding:6px 10px; border:1.5px solid var(--border-strong); border-top:none; background:var(--brand-soft); font-size:12px; } .ek-ctx[hidden]{ display:none; }
.ek-txt{ border:1px solid var(--border-strong); background:var(--bg-elevated); border-radius:8px; padding:4px 9px; font-size:12px; font-weight:600; cursor:pointer; color:var(--ink); } .ek-txt:hover{ border-color:var(--brand); } .ek-danger{ color:var(--critical); }
.ek-find{ display:flex; flex-wrap:wrap; gap:6px; align-items:center; padding:8px 10px; border:1.5px solid var(--border-strong); border-top:none; background:var(--bg-elevated); } .ek-find[hidden]{ display:none; } .ek-find .input{ width:170px; padding:6px 10px; }
.ek-bubble{ position:fixed; z-index:160; display:flex; align-items:center; gap:3px; padding:5px 7px; border-radius:12px; box-shadow:var(--shadow-lg); border:1px solid var(--glass-border); background:var(--bg-elevated); } .ek-bubble[hidden]{ display:none; }
.ek-bubble button{ border:none; background:none; min-width:28px; height:28px; border-radius:7px; cursor:pointer; color:var(--ink); } .ek-bubble button:hover{ background:var(--brand-soft); } .ek-bubble .sw{ min-width:20px; width:20px; height:20px; } .ek-bubble .sep{ width:1px; height:18px; background:var(--border); margin:0 3px; } .ek-bubble svg{ width:15px; height:15px; }
.editor.ek-on{ min-height:60vh; background:var(--bg-elevated); }
.editor img, .prose img{ max-width:100%; height:auto; border-radius:6px; } .img-s{ width:240px; } .img-m{ width:420px; } .img-l{ width:620px; } .img-full{ width:100%; }
.editor img.img-sel{ outline:3px solid var(--brand); outline-offset:2px; cursor:default; }
mark, .editor mark, .prose mark{ background:#FFE066; color:inherit; padding:0 1px; border-radius:3px; } mark.hl-g{ background:#9BE3B4; } mark.hl-b{ background:#9AD1F5; } mark.hl-p{ background:#F8B4D4; } mark.hl-o{ background:#FFC48A; }
:root[data-theme=dark] mark, :root[data-theme=dark] .editor mark{ color:#12302B; } @media (prefers-color-scheme:dark){ :root:not([data-theme=light]) mark, :root:not([data-theme=light]) .editor mark{ color:#12302B; } }
.c-red{ color:#C0392B; } .c-orange{ color:#D9730D; } .c-green{ color:#1E8449; } .c-blue{ color:#1F5FBF; } .c-purple{ color:#7B3FA0; } .c-gray{ color:#6B7C77; }
.fs-sm{ font-size:.82em; } .fs-lg{ font-size:1.25em; } .fs-xl{ font-size:1.6em; }
.ta-l{ text-align:left; } .ta-c{ text-align:center; } .ta-r{ text-align:right; } .ta-j{ text-align:justify; } .ind-1{ margin-left:2em !important; } .ind-2{ margin-left:4em !important; } .ind-3{ margin-left:6em !important; }
.cite{ color:var(--brand); font-weight:700; font-family:var(--font-body); font-size:.86em; cursor:default; white-space:nowrap; } .cite.cite-missing{ color:var(--critical); background:var(--critical-soft); border-radius:4px; }
.hl-flash{ outline:3px solid var(--brand); outline-offset:1px; animation:hlf 1.4s ease-out; } @keyframes hlf{ from{ outline-color:var(--brand); } to{ outline-color:transparent; } }
.hl-item{ display:flex; align-items:center; gap:8px; padding:5px 0; border-bottom:1px solid var(--border); } .hl-dot{ width:14px; height:14px; border-radius:50%; border:none; background:#FFE066; flex:none; cursor:pointer; } .hl-dot.hl-g{ background:#9BE3B4; } .hl-dot.hl-b{ background:#9AD1F5; } .hl-dot.hl-p{ background:#F8B4D4; } .hl-dot.hl-o{ background:#FFC48A; }
.hl-txt{ flex:1; text-align:left; border:none; background:none; font-size:12.5px; color:var(--ink); cursor:pointer; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; } .hl-txt:hover{ color:var(--brand); }
body.ed-fullscreen .editor-layout{ position:fixed; inset:0; z-index:120; background:var(--bg); padding:14px 18px; overflow:auto; grid-template-columns:minmax(0,1fr) 0; } body.ed-fullscreen .editor-layout > .stack{ display:none; } body.ed-fullscreen .ek-bar{ top:0; } body.ed-fullscreen .editor{ max-width:860px; margin:0 auto; }
/* references */
.ref-card{ display:flex; gap:14px; align-items:flex-start; padding:14px 16px; border-radius:var(--radius-md); } .ref-card.cited{ border-left:4px solid var(--vital); }
.ref-num{ min-width:34px; text-align:center; font-weight:800; font-family:var(--font-mono); font-size:13px; color:var(--brand-deep); padding-top:1px; }
.ref-text{ font-size:13.8px; line-height:1.55; overflow-wrap:anywhere; } .ref-meta{ display:flex; flex-wrap:wrap; gap:6px; margin-top:8px; align-items:center; } .ref-meta a.chip{ text-decoration:none; } .ref-meta svg{ width:11px; height:11px; }
.lookup-box{ padding:12px; border:1.5px dashed var(--brand); border-radius:var(--radius-md); background:var(--brand-soft); } .lookup-box label{ font-weight:700; font-size:12.5px; display:block; margin-bottom:6px; }
.ref-fields{ display:grid; grid-template-columns:1fr 1fr; gap:10px 12px; } @media (max-width:640px){ .ref-fields{ grid-template-columns:1fr; } .link-row{ flex-wrap:wrap; } }
.cite-list{ max-height:42vh; overflow:auto; border:1px solid var(--border); border-radius:var(--radius-md); } .cite-pick{ display:flex; gap:10px; align-items:flex-start; padding:9px 12px; border-bottom:1px solid var(--border); cursor:pointer; font-size:13px; } .cite-pick:hover{ background:var(--brand-soft); } .cite-pick input{ margin-top:3px; accent-color:var(--brand); }
.bib-preview{ max-height:55vh; overflow:auto; border:1px solid var(--border); border-radius:var(--radius-md); padding:14px 18px; font-size:14px; line-height:1.6; }
@media print{ .app-foot, .ek-bar, .ek-ctx, .ek-find, .ek-bubble{ display:none !important; } }

/* v1.2 fix: an open status menu must paint above the rows below it */
.sec-row{ position:relative; }
.sec-row:focus-within, .sec-row:has(.dropdown-menu.show){ z-index:40; }
.up-ph{ display:inline-block; padding:2px 10px; border-radius:99px; background:var(--brand-soft, rgba(28,110,140,.12)); color:var(--brand); font-size:12px; font-style:italic; }
.save-state{ white-space:nowrap; }
@media (max-width:720px){ .ed-fullscreen .editor-bar{ position:sticky; top:0; } }
.mention-all{ background:rgba(47,158,110,.16); color:#1f7a53; }
.spam-note{ margin-top:12px; font-size:12.5px; color:var(--text-muted, #5c716c); display:flex; gap:8px; align-items:flex-start; }
