
    :root {
      --bg0: #0f1419;
      --bg1: #171d25;
      --bg2: #1e2630;
      --bg3: #273140;
      --line: #334155;
      --text: #e8eef6;
      --muted: #94a3b8;
      --accent: #2dd4bf;
      --accent2: #38bdf8;
      --ok: #4ade80;
      --blocking: #fb7185;
      --important: #fbbf24;
      --nice: #94a3b8;
      --radius: 14px;
      --font: "IRANSans", Tahoma, sans-serif;
      --topbar-h: 0px;
      --bottombar-h: 0px;
      --safe-t: env(safe-area-inset-top, 0px);
      --safe-b: env(safe-area-inset-bottom, 0px);
      --safe-l: env(safe-area-inset-left, 0px);
      --safe-r: env(safe-area-inset-right, 0px);
    }
    * { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
    html { scroll-behavior: smooth; }
    body {
      margin: 0;
      font-family: var(--font);
      color: var(--text);
      background:
        radial-gradient(900px 480px at 100% -10%, rgba(45,212,191,.10), transparent 55%),
        radial-gradient(700px 400px at -10% 10%, rgba(56,189,248,.08), transparent 50%),
        var(--bg0);
      min-height: 100dvh;
      overflow-x: hidden;
    }
    button, input, textarea, label { font-family: inherit; }
    /* prevent iOS zoom */
    input, textarea, select { font-size: 16px !important; }

    /* ===== Desktop layout ===== */
    .app {
      display: grid;
      grid-template-columns: minmax(280px, 320px) 1fr;
      min-height: 100dvh;
    }
    .sidebar {
      background: rgba(15,20,25,.96);
      border-left: 1px solid var(--line);
      padding: 1.1rem 1.1rem calc(1.1rem + var(--safe-b));
      position: sticky;
      top: 0;
      height: 100dvh;
      overflow: auto;
      z-index: 40;
    }
    .main {
      padding: 1.25rem clamp(.85rem, 2.5vw, 2rem) 3rem;
      max-width: 980px;
      width: 100%;
      margin: 0 auto;
    }

    /* ===== Mobile chrome (hidden on desktop) ===== */
    .mobile-top, .mobile-bottom, .drawer-backdrop, .chip-strip-wrap { display: none; }

    .brand h1 { margin: 0; font-size: 1.15rem; font-weight: 800; }
    .brand p { margin: .35rem 0 0; color: var(--muted); font-size: .82rem; line-height: 1.55; }
    .badge-row { display: flex; flex-wrap: wrap; gap: .4rem; margin: .85rem 0; }
    .badge {
      font-size: .72rem; font-weight: 600; padding: .28rem .55rem; border-radius: 999px;
      border: 1px solid var(--line); color: var(--muted); background: var(--bg2);
    }
    .badge.accent { color: #042f2e; background: var(--accent); border-color: transparent; }
    .stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: .45rem; margin-bottom: .75rem; }
    .stat {
      background: var(--bg2); border: 1px solid var(--line); border-radius: 10px; padding: .55rem .3rem;
      text-align: center;
    }
    .stat b { display: block; font-size: .95rem; }
    .stat span { font-size: .68rem; color: var(--muted); line-height: 1.3; }
    .progress-wrap { margin: .85rem 0 1rem; }
    .progress-label {
      display: flex; justify-content: space-between; font-size: .78rem; color: var(--muted); margin-bottom: .35rem;
    }
    .progress {
      height: 10px; background: var(--bg3); border-radius: 999px; overflow: hidden; border: 1px solid var(--line);
    }
    .progress > span {
      display: block; height: 100%; width: 0%;
      background: linear-gradient(90deg, var(--accent), var(--accent2));
      transition: width .25s ease;
    }
    .search {
      width: 100%; padding: .75rem .85rem; border-radius: 12px; border: 1px solid var(--line);
      background: var(--bg2); color: var(--text); margin-bottom: .75rem;
    }
    .filters { display: grid; gap: .55rem; margin-bottom: 1rem; }
    .filters label {
      display: flex; align-items: center; gap: .65rem; font-size: .86rem; color: var(--muted);
      min-height: 44px; cursor: pointer; padding: .15rem 0;
    }
    .filters input { width: 18px; height: 18px; accent-color: var(--accent); flex-shrink: 0; }
    .nav-sections { display: grid; gap: .35rem; }
    .nav-btn {
      text-align: right; border: 1px solid transparent; background: transparent; color: var(--muted);
      padding: .7rem .75rem; border-radius: 12px; cursor: pointer; font-size: .84rem; min-height: 48px;
    }
    .nav-btn:hover, .nav-btn.active { background: var(--bg2); color: var(--text); border-color: var(--line); }
    .nav-btn .meta { display: block; font-size: .72rem; opacity: .75; margin-top: .2rem; }
    .side-actions { display: grid; gap: .5rem; margin-top: 1.1rem; }
    .btn {
      appearance: none; border: 1px solid var(--line); background: var(--bg2); color: var(--text);
      border-radius: 12px; padding: .85rem 1rem; font-weight: 600; cursor: pointer; font-size: .9rem;
      min-height: 48px;
    }
    .btn.primary {
      background: linear-gradient(135deg, #14b8a6, #0ea5e9); border: none; color: #042f2e;
    }
    .btn.ghost { background: transparent; }
    .btn.danger { border-color: #7f1d1d; color: #fecaca; }
    .btn:active { transform: scale(.98); }

    .hero {
      background: linear-gradient(145deg, rgba(30,38,48,.95), rgba(23,29,37,.9));
      border: 1px solid var(--line); border-radius: 16px;
      padding: 1.15rem 1.2rem; margin-bottom: 1rem;
    }
    .hero h2 { margin: 0 0 .45rem; font-size: clamp(1.05rem, 4vw, 1.4rem); line-height: 1.45; }
    .hero p { margin: 0; color: var(--muted); line-height: 1.75; font-size: .88rem; }
    .legend { display: flex; flex-wrap: wrap; gap: .45rem; margin-top: .85rem; }
    .pill {
      font-size: .72rem; font-weight: 700; padding: .28rem .55rem; border-radius: 999px;
      border: 1px solid var(--line); display: inline-block;
    }
    .pill.blocking { color: #fff1f2; background: rgba(251,113,133,.15); border-color: rgba(251,113,133,.35); }
    .pill.important { color: #fffbeb; background: rgba(251,191,36,.12); border-color: rgba(251,191,36,.35); }
    .pill.nice { color: #e2e8f0; background: rgba(148,163,184,.12); }

    .section {
      margin: 0 0 1rem; border: 1px solid var(--line); border-radius: 14px;
      background: rgba(23,29,37,.78); overflow: hidden;
    }
    .section-head {
      padding: .95rem 1rem; border-bottom: 1px solid var(--line);
      background: rgba(39,49,64,.45); display: flex; justify-content: space-between; gap: .75rem;
      align-items: flex-start; cursor: pointer; user-select: none; min-height: 56px;
    }
    .section-head h3 { margin: 0; font-size: .98rem; line-height: 1.45; }
    .section-head p { margin: .3rem 0 0; color: var(--muted); font-size: .8rem; line-height: 1.55; }
    .section-head-right { display: flex; flex-direction: column; align-items: flex-end; gap: .35rem; flex-shrink: 0; }
    .role-tag {
      font-size: .68rem; font-weight: 700; color: #042f2e;
      background: var(--accent2); padding: .28rem .5rem; border-radius: 8px;
    }
    .chev {
      width: 28px; height: 28px; border-radius: 8px; border: 1px solid var(--line);
      display: grid; place-items: center; color: var(--muted); font-size: .85rem;
      transition: transform .2s;
    }
    .section.open .chev { transform: rotate(180deg); }
    .section:not(.open) .section-body { display: none; }
    .section:not(.open) .section-head { border-bottom: none; }
    .sec-count { font-size: .7rem; color: var(--muted); }

    .q {
      padding: 1rem; border-bottom: 1px solid rgba(51,65,85,.65);
      scroll-margin-top: calc(var(--topbar-h) + 12px);
    }
    .q:last-child { border-bottom: none; }
    .q.hidden { display: none; }
    .q-top {
      display: flex; gap: .5rem; align-items: flex-start; justify-content: space-between;
      margin-bottom: .7rem; flex-wrap: wrap;
    }
    .q-id {
      font-size: .7rem; font-weight: 800; color: var(--accent); background: rgba(45,212,191,.08);
      border: 1px solid rgba(45,212,191,.25); padding: .22rem .45rem; border-radius: 7px; white-space: nowrap;
    }
    .q-text { margin: 0; font-size: .95rem; font-weight: 600; line-height: 1.7; flex: 1 1 200px; }
    .q-hint { margin: 0 0 .65rem; color: var(--muted); font-size: .8rem; line-height: 1.55; }
    .options { display: grid; gap: .5rem; }
    .opt {
      display: flex; gap: .7rem; align-items: flex-start; padding: .85rem .9rem;
      border: 1px solid var(--line); border-radius: 12px; background: var(--bg1); cursor: pointer;
      min-height: 52px;
    }
    .opt:active { background: var(--bg2); }
    .opt:has(input:checked) {
      border-color: rgba(45,212,191,.55); background: rgba(45,212,191,.08);
    }
    .opt input { margin-top: .15rem; width: 20px; height: 20px; accent-color: var(--accent); flex-shrink: 0; }
    .opt span { font-size: .9rem; line-height: 1.55; }
    textarea, .text-input {
      width: 100%; min-height: 110px; resize: vertical; border-radius: 12px; border: 1px solid var(--line);
      background: var(--bg1); color: var(--text); padding: .85rem; line-height: 1.7;
    }
    .text-input { min-height: 48px; }
    .note-input {
      margin-top: .55rem; width: 100%; min-height: 48px; border-radius: 12px; border: 1px dashed var(--line);
      background: transparent; color: var(--muted); padding: .75rem .85rem;
    }
    .answered { box-shadow: inset 3px 0 0 var(--ok); }
    .unanswered-blocking { box-shadow: inset 3px 0 0 var(--blocking); }
    .q.bookmarked { background: rgba(251,191,36,.04); }

    .q-answer-row {
      display: grid;
      grid-template-columns: 1fr auto;
      gap: .55rem;
      align-items: start;
    }
    .q-bookmark-slot {
      padding-top: .15rem;
      position: sticky;
      top: calc(var(--topbar-h, 56px) + 8px);
    }
    .q-bookmark {
      display: inline-flex; align-items: center; justify-content: center;
      width: 40px; height: 40px; border-radius: 12px;
      border: 1px solid var(--line); background: var(--bg1); color: var(--muted);
      cursor: pointer; transition: .15s var(--ease, ease);
      flex-shrink: 0;
    }
    .q-bookmark:hover { border-color: rgba(251,191,36,.45); color: #fbbf24; }
    .q-bookmark.on {
      color: #0b1016; background: linear-gradient(145deg, #fbbf24, #f59e0b);
      border-color: transparent; box-shadow: 0 6px 18px rgba(245,158,11,.28);
    }
    .q-bookmark.on .icon { stroke-width: 2.25; fill: currentColor; }
    .pill.bookmark-pill {
      display: inline-flex; align-items: center; gap: .3rem;
      background: rgba(251,191,36,.14); color: #fbbf24;
      border: 1px solid rgba(251,191,36,.35);
    }

    .footer-note { color: var(--muted); font-size: .78rem; line-height: 1.7; margin: 1.5rem 0 2rem; }
    .toast {
      position: fixed; bottom: calc(1rem + var(--bottombar-h) + var(--safe-b)); left: 50%;
      transform: translateX(-50%); background: #052e2b; color: #99f6e4; border: 1px solid #115e59;
      padding: .7rem 1rem; border-radius: 999px; font-size: .82rem; opacity: 0; pointer-events: none;
      transition: .2s; z-index: 80; max-width: 90vw; text-align: center;
    }
    .toast.show { opacity: 1; }
    .desktop-only-toggle { display: none; }

    /* ===== Mobile / tablet ===== */
    @media (max-width: 960px) {
      :root {
        --topbar-h: 56px;
        --bottombar-h: 64px;
      }
      .app { grid-template-columns: 1fr; }
      .desktop-only-toggle { display: none !important; }

      .mobile-top {
        display: flex; align-items: center; gap: .55rem;
        position: sticky; top: 0; z-index: 50;
        height: calc(var(--topbar-h) + var(--safe-t));
        padding: var(--safe-t) .75rem 0;
        background: rgba(15,20,25,.94);
        border-bottom: 1px solid var(--line);
        backdrop-filter: blur(12px);
        -webkit-backdrop-filter: blur(12px);
      }
      .mobile-top .icon-btn {
        width: 44px; height: 44px; border-radius: 12px; border: 1px solid var(--line);
        background: var(--bg2); color: var(--text); display: grid; place-items: center;
        font-size: 1.2rem; flex-shrink: 0; cursor: pointer;
      }
      .mobile-top .mt-meta { flex: 1; min-width: 0; }
      .mobile-top .mt-title {
        font-size: .86rem; font-weight: 800; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
      }
      .mobile-top .mt-sub {
        display: flex; gap: .55rem; align-items: center; margin-top: .15rem; font-size: .72rem; color: var(--muted);
      }
      .mobile-top .mini-progress {
        flex: 1; height: 6px; background: var(--bg3); border-radius: 999px; overflow: hidden; border: 1px solid var(--line);
      }
      .mobile-top .mini-progress > span {
        display: block; height: 100%; width: 0%; background: linear-gradient(90deg, var(--accent), var(--accent2));
      }

      .chip-strip-wrap {
        display: block; position: sticky; top: calc(var(--topbar-h) + var(--safe-t)); z-index: 45;
        background: rgba(15,20,25,.92); border-bottom: 1px solid var(--line);
        backdrop-filter: blur(10px);
      }
      .chip-strip {
        display: flex; gap: .45rem; overflow-x: auto; padding: .55rem .75rem;
        -webkit-overflow-scrolling: touch; scrollbar-width: none;
      }
      .chip-strip::-webkit-scrollbar { display: none; }
      .chip {
        flex: 0 0 auto; border: 1px solid var(--line); background: var(--bg2); color: var(--muted);
        border-radius: 999px; padding: .45rem .75rem; font-size: .75rem; font-weight: 600;
        min-height: 36px; white-space: nowrap; cursor: pointer;
      }
      .chip.active { color: #042f2e; background: var(--accent); border-color: transparent; }
      .chip .n { opacity: .75; margin-right: .25rem; }

      .drawer-backdrop {
        display: block; position: fixed; inset: 0; background: rgba(0,0,0,.55);
        z-index: 55; opacity: 0; pointer-events: none; transition: opacity .2s;
      }
      .drawer-backdrop.show { opacity: 1; pointer-events: auto; }

      .sidebar {
        position: fixed; top: 0; right: 0; bottom: 0;
        width: min(92vw, 360px); height: 100dvh;
        transform: translateX(105%);
        transition: transform .25s ease;
        border-left: 1px solid var(--line);
        z-index: 60;
        padding-top: calc(.85rem + var(--safe-t));
      }
      .sidebar.open { transform: translateX(0); }
      body.drawer-open { overflow: hidden; }

      .main {
        padding: .85rem .75rem calc(1.25rem + var(--bottombar-h) + var(--safe-b));
      }
      .hero { padding: .95rem; border-radius: 14px; }
      .legend .pill { font-size: .68rem; }

      .q-top { flex-direction: column; align-items: stretch; gap: .45rem; }
      .q-top .pill { align-self: flex-start; }
      .q-text { flex-basis: auto; font-size: .92rem; }

      .mobile-bottom {
        display: grid;
        grid-template-columns: repeat(4, 1fr);
        position: fixed; left: 0; right: 0; bottom: 0; z-index: 50;
        height: calc(var(--bottombar-h) + var(--safe-b));
        padding: .35rem .35rem calc(.35rem + var(--safe-b));
        background: rgba(15,20,25,.96);
        border-top: 1px solid var(--line);
        backdrop-filter: blur(12px);
        -webkit-backdrop-filter: blur(12px);
      }
      .mobile-bottom button {
        border: none; background: transparent; color: var(--muted);
        display: flex; flex-direction: column; align-items: center; justify-content: center;
        gap: .15rem; font-size: .68rem; font-weight: 600; min-height: 52px; cursor: pointer;
      }
      .mobile-bottom button .ico { font-size: 1.15rem; line-height: 1; }
      .mobile-bottom button:active { color: var(--accent); }
    }

    @media (max-width: 420px) {
      .stats { gap: .35rem; }
      .stat { padding: .45rem .2rem; }
      .stat b { font-size: .88rem; }
      .opt { padding: .75rem; }
      .q-answer-row { gap: .4rem; }
      .q-bookmark { width: 36px; height: 36px; border-radius: 10px; }
    }
  
/* ===== App extras (login / admin / toast variants) ===== */
.toast.ok { border-color: rgba(74,222,128,.45); }
.toast.err { border-color: rgba(251,113,133,.55); color: #fecaca; }
.login-wrap { min-height: 100dvh; display:grid; place-items:center; padding: 1.25rem; }
.login-card { width:min(420px,100%); background: var(--bg1); border:1px solid var(--line); border-radius:16px; padding:1.35rem; }
.login-card h1 { margin:0 0 .35rem; font-size:1.25rem; }
.login-card p { margin:0 0 1rem; color:var(--muted); font-size:.88rem; }
.field { display:grid; gap:.35rem; margin-bottom:.85rem; }
.field label { font-size:.82rem; color:var(--muted); }
.field input, .field select, .field textarea {
  width:100%; padding:.75rem .85rem; border-radius:12px; border:1px solid var(--line);
  background:var(--bg2); color:var(--text);
}
.admin-shell { display:grid; grid-template-columns: minmax(220px,260px) 1fr; min-height:100dvh; }
.admin-nav { background:rgba(15,20,25,.96); border-left:1px solid var(--line); padding:1rem; position:sticky; top:0; height:100dvh; }
.admin-nav a { display:block; color:var(--muted); text-decoration:none; padding:.65rem .75rem; border-radius:12px; margin-bottom:.25rem; }
.admin-nav a:hover, .admin-nav a.active { background:var(--bg2); color:var(--text); }
.admin-main { padding:1.25rem clamp(.85rem,2.5vw,2rem) 3rem; max-width:1100px; }
.table { width:100%; border-collapse:collapse; font-size:.88rem; }
.table th, .table td { border-bottom:1px solid var(--line); padding:.65rem .4rem; text-align:right; vertical-align:top; }
.table th { color:var(--muted); font-weight:600; }
.card { background:var(--bg1); border:1px solid var(--line); border-radius:14px; padding:1rem; margin-bottom:1rem; }
.grid-2 { display:grid; gap:.75rem; grid-template-columns:1fr 1fr; }
.flash-error { color:#fecaca; font-size:.85rem; margin:.35rem 0; }
.muted { color:var(--muted); }
.stack { display:grid; gap:.75rem; }
.inline-form { display:flex; flex-wrap:wrap; gap:.5rem; align-items:end; }
.checkbox-row { display:flex; align-items:center; gap:.45rem; font-size:.86rem; color:var(--muted); }
.save-row { display:flex; gap:.5rem; align-items:center; margin-top:.65rem; flex-wrap:wrap; }
.save-row .status { font-size:.78rem; color:var(--muted); }
.save-row .status.ok { color: var(--ok); }
.save-row .status.err { color: var(--blocking); }
@media (max-width: 960px) {
  .admin-shell { grid-template-columns: 1fr; }
  .admin-nav { position:relative; height:auto; border-left:none; border-bottom:1px solid var(--line); }
  .grid-2 { grid-template-columns: 1fr; }
}
