  :root{
    --navy:#0a2540;--navy-2:#0d2e4d;--blue-900:#0d3b66;--blue-700:#1457a0;
    --blue-600:#1b6fc4;--blue-500:#2f8bdf;--sky:#4cb8e8;--teal:#12b3c4;--teal-d:#0e9aa9;
    --bg:#eef4fa;--paper:#ffffff;--ink:#0c2438;--muted:#6a7f92;--line:#e2ebf3;
    --green:#12a36b;--green-bg:#e4f6ee;--amber:#d98a1f;--amber-bg:#fcf2e0;--blue-bg:#e7f1fb;
    --shadow:0 10px 34px -18px rgba(13,59,102,.4);--shadow-lg:0 26px 60px -28px rgba(10,37,64,.5);
    --f:"Vazirmatn",sans-serif;
  }
  *{margin:0;padding:0;box-sizing:border-box;-webkit-tap-highlight-color:transparent}
  html{overflow-x:hidden;width:100%;-webkit-text-size-adjust:100%}
  body{font-family:var(--f);background:var(--bg);color:var(--ink);overflow-x:hidden;width:100%;line-height:1.8;-webkit-font-smoothing:antialiased}
  ::selection{background:var(--teal);color:#fff}
  button,input,select,textarea{font-family:var(--f)}
  svg{max-width:100%}

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

  /* ===== SIDEBAR ===== */
  .sidebar{
    width:268px;flex-shrink:0;background:linear-gradient(185deg,var(--navy),var(--navy-2));
    color:#fff;display:flex;flex-direction:column;position:fixed;top:0;bottom:0;right:0;z-index:50;
    transition:transform .3s ease
  }
  .sb-brand{display:flex;align-items:center;gap:11px;padding:22px 22px 18px}
  .sb-logo{width:42px;height:42px;border-radius:12px;background:linear-gradient(135deg,var(--blue-500),var(--teal));display:grid;place-items:center;font-weight:800;font-size:21px;box-shadow:0 8px 18px -6px rgba(76,184,232,.6)}
  .sb-brand b{font-size:14px;display:block;line-height:1.3}
  .sb-brand span{font-size:11px;color:var(--sky)}
  .sb-nav{padding:8px 14px;flex:1;overflow-y:auto}
  .sb-label{font-size:11px;color:rgba(255,255,255,.4);padding:14px 12px 6px;font-weight:600;letter-spacing:.5px}
  .sb-item{display:flex;align-items:center;gap:12px;padding:12px 14px;border-radius:12px;color:rgba(255,255,255,.72);font-size:14.5px;font-weight:500;cursor:pointer;margin-bottom:3px;transition:.2s;border:none;background:none;width:100%;text-align:right}
  .sb-item svg{width:20px;height:20px;stroke:currentColor;fill:none;stroke-width:1.9;flex-shrink:0}
  .sb-item:hover{background:rgba(255,255,255,.07);color:#fff}
  .sb-item.active{background:linear-gradient(135deg,var(--blue-600),var(--blue-700));color:#fff;box-shadow:0 10px 22px -12px rgba(27,111,196,.9)}
  .sb-item .badge{margin-right:auto;background:var(--teal);color:#fff;font-size:11px;font-weight:700;min-width:21px;height:21px;border-radius:11px;display:grid;place-items:center;padding:0 6px}
  .sb-item.active .badge{background:rgba(255,255,255,.25)}
  .sb-foot{padding:14px;border-top:1px solid rgba(255,255,255,.1)}
  .sb-doc{display:flex;align-items:center;gap:11px;padding:8px}
  .sb-doc .ava{width:42px;height:42px;border-radius:50%;background:linear-gradient(135deg,var(--blue-500),var(--teal));display:grid;place-items:center;font-weight:800;font-size:18px;flex-shrink:0}
  .sb-doc b{font-size:13px;display:block}
  .sb-doc span{font-size:11px;color:rgba(255,255,255,.5)}

  /* ===== MAIN ===== */
  .main{flex:1;margin-right:268px;min-width:0;display:flex;flex-direction:column}
  .topbar{background:var(--paper);border-bottom:1px solid var(--line);padding:14px 26px;display:flex;align-items:center;gap:16px;position:sticky;top:0;z-index:30}
  .burger{display:none;background:none;border:none;cursor:pointer;padding:4px}
  .burger svg{width:26px;height:26px;stroke:var(--navy);fill:none;stroke-width:2}
  .topbar h1{font-size:20px;font-weight:800;color:var(--navy)}
  .top-search{margin-right:auto;position:relative;max-width:300px;width:100%}
  .top-search input{width:100%;background:var(--bg);border:1.5px solid var(--line);border-radius:12px;padding:10px 40px 10px 14px;font-size:14px;outline:none;transition:.2s}
  .top-search input:focus{border-color:var(--blue-500);background:#fff}
  .top-search svg{position:absolute;right:13px;top:50%;transform:translateY(-50%);width:18px;height:18px;stroke:var(--muted);fill:none;stroke-width:2}
  .content{padding:26px;flex:1}

  /* views */
  .view{display:none;animation:fade .4s ease}
  .view.active{display:block}
  @keyframes fade{from{transform:translateY(10px)}to{transform:none}}

  /* stat cards */
  .stats{display:grid;grid-template-columns:repeat(4,1fr);gap:16px;margin-bottom:26px}
  .stat{background:var(--paper);border:1px solid var(--line);border-radius:18px;padding:20px;box-shadow:var(--shadow);position:relative;overflow:hidden}
  .stat .ic{width:46px;height:46px;border-radius:13px;display:grid;place-items:center;margin-bottom:14px}
  .stat .ic svg{width:23px;height:23px;fill:none;stroke-width:2}
  .stat b{font-size:30px;font-weight:800;color:var(--navy);display:block;line-height:1}
  .stat span{font-size:13px;color:var(--muted)}

  .panel{background:var(--paper);border:1px solid var(--line);border-radius:20px;box-shadow:var(--shadow);overflow:hidden}
  .panel-head{display:flex;align-items:center;justify-content:space-between;padding:18px 22px;border-bottom:1px solid var(--line);gap:12px;flex-wrap:wrap}
  .panel-head h2{font-size:17px;font-weight:700;color:var(--navy)}
  .filters{display:flex;gap:8px;flex-wrap:wrap}
  .chip{background:var(--bg);border:1.5px solid var(--line);border-radius:50px;padding:7px 15px;font-size:13px;font-weight:600;color:var(--muted);cursor:pointer;transition:.2s}
  .chip:hover{border-color:var(--blue-500)}
  .chip.on{background:var(--blue-600);border-color:var(--blue-600);color:#fff}

  /* request rows */
  .req-list{display:flex;flex-direction:column}
  .req{display:flex;align-items:center;gap:15px;padding:16px 22px;border-bottom:1px solid var(--line);cursor:pointer;transition:.18s}
  .req:last-child{border-bottom:none}
  .req:hover{background:var(--bg)}
  .req .svc-ic{width:46px;height:46px;border-radius:13px;background:linear-gradient(135deg,#e8f4fc,#d7ecfa);display:grid;place-items:center;flex-shrink:0}
  .req .svc-ic svg{width:24px;height:24px;stroke:var(--blue-600);fill:none;stroke-width:1.8}
  .req .info{min-width:0;flex:1}
  .req .info .top{display:flex;align-items:center;gap:9px;flex-wrap:wrap}
  .req .info b{font-size:15px;color:var(--navy)}
  .req .code{font-size:11.5px;font-weight:700;color:var(--blue-700);background:var(--blue-bg);padding:2px 9px;border-radius:6px;direction:ltr}
  .req .info .sub{font-size:13px;color:var(--muted);margin-top:2px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
  .req .meta{text-align:left;flex-shrink:0;display:flex;flex-direction:column;align-items:flex-end;gap:7px}
  .req .date{font-size:12px;color:var(--muted)}
  .status{font-size:11.5px;font-weight:700;padding:5px 12px;border-radius:50px;white-space:nowrap}
  .st-new{background:var(--blue-bg);color:var(--blue-700)}
  .st-prog{background:var(--amber-bg);color:var(--amber)}
  .st-done{background:var(--green-bg);color:var(--green)}
  .req .chev{width:18px;height:18px;stroke:var(--muted);fill:none;stroke-width:2;flex-shrink:0}
  .empty{padding:50px 20px;text-align:center;color:var(--muted)}
  .empty svg{width:48px;height:48px;stroke:var(--line);fill:none;stroke-width:1.5;margin-bottom:10px}

  /* ===== MODAL ===== */
  .overlay{position:fixed;inset:0;background:rgba(10,37,64,.55);z-index:90;display:none;align-items:flex-start;justify-content:center;padding:30px 16px;overflow-y:auto}
  .overlay.open{display:flex}
  .modal{background:var(--bg);width:100%;max-width:680px;border-radius:24px;box-shadow:var(--shadow-lg);overflow:hidden;animation:pop .35s cubic-bezier(.2,1.2,.4,1)}
  @keyframes pop{from{transform:scale(.96) translateY(14px)}to{transform:none}}
  .m-head{background:linear-gradient(135deg,var(--blue-700),var(--navy));color:#fff;padding:22px 24px;position:relative}
  .m-close{position:absolute;left:18px;top:18px;width:34px;height:34px;border-radius:10px;background:rgba(255,255,255,.14);border:none;color:#fff;cursor:pointer;display:grid;place-items:center;transition:.2s}
  .m-close:hover{background:rgba(255,255,255,.26)}
  .m-close svg{width:18px;height:18px;stroke:#fff;fill:none;stroke-width:2.4}
  .m-patient{display:flex;align-items:center;gap:14px}
  .m-ava{width:56px;height:56px;border-radius:16px;background:rgba(255,255,255,.16);display:grid;place-items:center;font-size:24px;font-weight:800;flex-shrink:0}
  .m-patient h3{font-size:20px;font-weight:800}
  .m-patient .pcode{font-size:13px;color:var(--sky);font-weight:600;direction:ltr;display:inline-block}
  .m-body{padding:22px 24px}
  .m-grid{display:grid;grid-template-columns:1fr 1fr;gap:12px;margin-bottom:20px}
  .m-cell{background:var(--paper);border:1px solid var(--line);border-radius:13px;padding:12px 14px}
  .m-cell .k{font-size:11.5px;color:var(--muted);margin-bottom:3px}
  .m-cell .v{font-size:14px;font-weight:600;color:var(--navy)}
  .m-cell .v.ltr{direction:ltr;text-align:right}
  .sec-t{font-size:13.5px;font-weight:700;color:var(--navy);margin:18px 0 10px;display:flex;align-items:center;gap:8px}
  .sec-t svg{width:18px;height:18px;stroke:var(--blue-600);fill:none;stroke-width:2}
  .note-box{background:var(--paper);border:1px solid var(--line);border-radius:13px;padding:14px;font-size:14px;color:#3a5266;line-height:1.85}
  .file-pill{display:inline-flex;align-items:center;gap:8px;background:var(--paper);border:1px solid var(--line);border-radius:10px;padding:9px 13px;font-size:13px;font-weight:600;color:var(--blue-700);margin:0 0 8px 8px}
  .file-pill svg{width:17px;height:17px;stroke:var(--blue-600);fill:none;stroke-width:1.9}

  /* history timeline */
  .timeline{border-right:2px solid var(--line);padding-right:18px;margin-right:6px}
  .tl-item{position:relative;padding-bottom:16px}
  .tl-item::before{content:"";position:absolute;right:-25px;top:4px;width:12px;height:12px;border-radius:50%;background:var(--blue-600);box-shadow:0 0 0 3px var(--blue-bg)}
  .tl-item .tl-date{font-size:11.5px;color:var(--muted);margin-bottom:3px}
  .tl-item .tl-text{font-size:13.5px;color:#3a5266;background:var(--paper);border:1px solid var(--line);border-radius:11px;padding:10px 13px}
  .tl-files{margin-top:6px}

  /* doctor review card */
  .review{background:var(--paper);border:1.5px solid var(--blue-500);border-radius:16px;padding:18px;margin-top:8px;box-shadow:0 0 0 4px rgba(47,139,223,.08)}
  .review h4{font-size:15px;font-weight:800;color:var(--navy);margin-bottom:14px;display:flex;align-items:center;gap:8px}
  .review h4 svg{width:20px;height:20px;stroke:var(--blue-600);fill:none;stroke-width:2}
  .fld{margin-bottom:14px}
  .fld label{display:block;font-size:13px;font-weight:600;color:var(--navy);margin-bottom:7px}
  .fld textarea,.fld select{width:100%;background:var(--bg);border:1.5px solid var(--line);border-radius:12px;padding:12px 14px;font-size:15px;color:var(--ink);outline:none;transition:.2s}
  .fld textarea{resize:vertical;min-height:90px;line-height:1.85}
  .fld textarea:focus,.fld select:focus{border-color:var(--blue-500);background:#fff;box-shadow:0 0 0 4px rgba(47,139,223,.12)}
  .upload{border:2px dashed var(--line);border-radius:13px;padding:16px;text-align:center;cursor:pointer;transition:.2s;background:var(--bg)}
  .upload:hover{border-color:var(--blue-500);background:#fff}
  .upload svg{width:26px;height:26px;stroke:var(--blue-600);fill:none;stroke-width:1.8;margin-bottom:6px}
  .upload .t{font-size:13.5px;font-weight:600;color:var(--blue-700)}
  .upload .s{font-size:11.5px;color:var(--muted)}
  .upload input{display:none}
  .attached{margin-top:10px;display:flex;flex-wrap:wrap;gap:8px}
  .att{display:inline-flex;align-items:center;gap:7px;background:var(--blue-bg);border-radius:9px;padding:7px 11px;font-size:12.5px;font-weight:600;color:var(--blue-700)}
  .att svg{width:15px;height:15px;stroke:var(--blue-700);fill:none;stroke-width:2;cursor:pointer}
  .m-actions{display:flex;gap:10px;margin-top:6px}
  .btn{border:none;cursor:pointer;font-family:var(--f);font-weight:700;font-size:15px;border-radius:13px;padding:14px;transition:.2s;display:inline-flex;align-items:center;justify-content:center;gap:8px}
  .btn svg{width:18px;height:18px;stroke:#fff;fill:none;stroke-width:2.2}
  .btn-save{background:var(--blue-600);color:#fff;flex:1;box-shadow:0 12px 26px -12px rgba(27,111,196,.8)}
  .btn-save:hover{background:var(--blue-700)}

  /* toast */
  .toast{position:fixed;bottom:26px;right:50%;transform:translate(50%,30px);background:var(--green);color:#fff;padding:13px 22px;border-radius:14px;font-weight:600;font-size:14px;box-shadow:0 16px 40px -14px rgba(18,163,107,.7);opacity:0;pointer-events:none;transition:.35s;z-index:120;display:flex;align-items:center;gap:9px}
  .toast.show{opacity:1;transform:translate(50%,0)}
  .toast svg{width:19px;height:19px;stroke:#fff;fill:none;stroke-width:2.6}

  .scrim{position:fixed;inset:0;background:rgba(10,37,64,.5);z-index:45;display:none}
  .scrim.show{display:block}

  /* ===== RESPONSIVE ===== */
  @media(max-width:980px){.stats{grid-template-columns:1fr 1fr}}
  @media(max-width:820px){
    .sidebar{transform:translateX(100%)}
    .sidebar.open{transform:translateX(0);box-shadow:-20px 0 60px -20px rgba(0,0,0,.5)}
    .main{margin-right:0}
    .burger{display:block}
    .top-search{display:none}
  }
  @media(max-width:560px){
    .content{padding:16px}
    .stats{grid-template-columns:1fr 1fr;gap:11px}
    .stat{padding:15px}
    .stat b{font-size:24px}
    .m-grid{grid-template-columns:1fr}
    .req{padding:14px 16px;gap:11px}
    .req .svc-ic{width:40px;height:40px}
    .req .meta{gap:5px}
    .topbar{padding:12px 16px}
  }
