:root{--maroon:#720812;--maroon2:#8d0c18;--maroon3:#b00013;--pink:#f8e9ec;--bg:#fafafa;--panel:#fff;--text:#232323;--muted:#7c7c86;--line:#e9e9ee;--shadow:0 4px 16px rgba(24,24,32,.05);--radius:10px}*{box-sizing:border-box}body{margin:0;background:var(--bg);color:var(--text);font-family:Inter,system-ui,sans-serif;font-size:14px}.admin-shell{display:grid;grid-template-columns:270px 1fr;min-height:100vh}.sidebar{background:linear-gradient(180deg,#6f0610,#5b050d);color:white;padding:18px 12px;position:sticky;top:0;height:100vh;overflow:auto}.brand{display:flex;gap:12px;align-items:center;padding:0 8px 24px}.brand-logo{width:43px;height:43px;border-radius:50%;background:white;color:var(--maroon);display:grid;place-items:center;font-weight:900;font-size:23px;box-shadow:inset 0 0 0 3px rgba(114,8,18,.12)}.brand strong{display:block;font-size:17px;line-height:1.15}.brand span{display:block;font-size:12px;color:#e7c1c5;margin-top:2px}.side-section{font-size:12px;color:#e4abb2;font-weight:700;padding:10px 8px 8px}.side-nav{display:grid;gap:4px}.side-link{height:39px;border:0;background:transparent;color:#fff;border-radius:7px;text-align:left;padding:0 10px;display:flex;align-items:center;gap:10px;font-weight:700;font-size:14px;cursor:pointer}.side-link:hover{background:rgba(255,255,255,.08)}.side-link.active{background:rgba(185,22,37,.72);box-shadow:inset 0 0 0 1px rgba(255,255,255,.06)}.side-link svg,.collapse-btn svg{width:17px;height:17px;stroke:currentColor;fill:none;stroke-width:2}.side-link em{margin-left:auto;background:rgba(255,255,255,.2);font-style:normal;font-size:10px;padding:3px 6px;border-radius:5px}.main-panel{min-width:0}.topbar{height:64px;background:white;border-bottom:1px solid var(--line);display:flex;align-items:center;justify-content:space-between;padding:0 24px;position:sticky;top:0;z-index:20}.collapse-btn{width:34px;height:34px;border:0;background:white;color:#333;display:grid;place-items:center;cursor:pointer}.top-actions{display:flex;align-items:center;gap:12px;margin-left:auto}.search input,.top-actions select{height:38px;border:1px solid var(--line);background:white;border-radius:8px;padding:0 12px;outline:0}.search input{width:280px}.search input:focus,.top-actions select:focus{border-color:var(--maroon3)}.refresh{height:38px;border:0;background:var(--maroon3);color:white;border-radius:8px;font-weight:800;padding:0 14px;cursor:pointer}.profile{display:flex;align-items:center;gap:10px;margin-left:8px}.profile span{width:31px;height:31px;border-radius:50%;background:var(--maroon3);display:grid;place-items:center;color:white;font-weight:800}.profile strong{display:block;font-size:13px}.profile small{display:block;font-size:10px;color:#777;font-weight:800}.content{padding:28px}.page-head{display:flex;align-items:flex-start;justify-content:space-between;gap:16px;margin-bottom:22px}.page-head h1{margin:0;color:#7d1018;font-size:28px;line-height:1.1}.page-head p{margin:4px 0 0;color:#777}.range{display:flex;gap:8px}.range button{height:32px;border:1px solid var(--line);background:white;border-radius:6px;padding:0 12px;font-weight:700;color:#555}.range button.active{background:var(--maroon3);border-color:var(--maroon3);color:white}.cards{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:18px;margin-bottom:22px}.stat-card{background:white;border:1px solid var(--line);border-radius:8px;min-height:105px;padding:21px 22px;display:flex;align-items:center;gap:18px;box-shadow:var(--shadow)}.stat-icon{width:47px;height:47px;border-radius:8px;background:#f8e9ec;color:#9c1020;display:grid;place-items:center}.stat-icon svg{width:22px;height:22px;stroke:currentColor;fill:none;stroke-width:2}.stat-card small{display:block;text-transform:uppercase;letter-spacing:.06em;color:#777;font-weight:700;font-size:12px}.stat-card strong{display:block;font-size:28px;line-height:1.15;margin-top:5px}.stat-card span{display:block;color:#777;font-size:12px}.panel{background:white;border:1px solid var(--line);border-radius:8px;padding:24px;box-shadow:var(--shadow);margin-bottom:22px}.panel h2,.panel h3{margin:0 0 18px;font-size:17px;color:#222}.grid-2{display:grid;grid-template-columns:1fr 1fr;gap:22px}.table-wrap{overflow:auto;border:1px solid var(--line);border-radius:8px}table{width:100%;border-collapse:collapse;min-width:720px}th,td{padding:12px 14px;border-bottom:1px solid #f0f0f3;text-align:left;vertical-align:top;font-size:13px}th{background:#fbfbfc;color:#777;text-transform:uppercase;font-size:11px;letter-spacing:.05em}tr:hover td{background:#fff8f9}.chart{height:270px;border-left:1px solid #ddd;border-bottom:1px solid #999;background:repeating-linear-gradient(to top,#fff 0,#fff 53px,#f1f1f4 54px),repeating-linear-gradient(to right,transparent 0,transparent 80px,#f1f1f4 81px);position:relative;margin:8px 0 28px 54px}.line-chart svg{position:absolute;inset:0;overflow:visible}.axis-y{position:absolute;left:-45px;top:-4px;height:100%;display:flex;flex-direction:column;justify-content:space-between;color:#888;font-size:12px}.axis-x{position:absolute;left:0;right:0;bottom:-26px;display:flex;justify-content:space-between;color:#888;font-size:11px}.legend{text-align:center;color:#7d1018;font-size:13px}.bar-chart{height:270px;display:flex;align-items:flex-end;gap:8px;border-left:1px solid #ddd;border-bottom:1px solid #999;padding:0 28px;margin-left:42px;background:repeating-linear-gradient(to top,#fff 0,#fff 53px,#f1f1f4 54px)}.bar{flex:1;background:var(--maroon3);border-radius:4px 4px 0 0;min-width:18px;position:relative}.bar span{position:absolute;bottom:-26px;left:50%;transform:translateX(-50%);font-size:10px;color:#777;white-space:nowrap}.hbar-list{display:grid;gap:10px}.hbar{display:grid;grid-template-columns:170px 1fr 36px;gap:12px;align-items:center}.hbar-name{font-size:12px;text-align:right;color:#666}.hbar-track{height:18px;background:#eee;border-radius:3px;overflow:hidden}.hbar-fill{height:100%;background:linear-gradient(90deg,#d9091d,#8d0c18);border-radius:3px}.badge{display:inline-block;padding:4px 8px;border-radius:999px;background:#f8e9ec;color:#8d0c18;font-weight:800;font-size:11px}.badge.super{background:rgba(255,255,255,.2);color:#fff;border-radius:4px}.muted{color:#777}.three-pane{display:grid;grid-template-columns:300px 1fr 320px;gap:18px}.list{display:grid;gap:8px;max-height:620px;overflow:auto}.list-item{border:1px solid var(--line);background:white;border-radius:8px;padding:12px;cursor:pointer}.list-item:hover{border-color:#d9091d}.list-item strong{display:block}.list-item p{margin:4px 0;color:#777;font-size:12px}.bubble{border:1px solid var(--line);border-radius:8px;padding:12px;margin:0 0 10px;max-width:84%;background:white}.bubble.out{margin-left:auto;background:#fff3f5}.tabs{display:flex;gap:8px;flex-wrap:wrap;margin-bottom:18px}.tab{height:34px;border:1px solid var(--line);background:white;border-radius:6px;padding:0 12px;font-weight:700;cursor:pointer}.tab.active{background:var(--maroon3);border-color:var(--maroon3);color:white}.editor{display:grid;grid-template-columns:1fr 360px;gap:18px}.form{display:grid;gap:12px}.field{display:grid;gap:5px}.field span{font-size:12px;color:#777;font-weight:800;text-transform:uppercase}.field input,.field textarea,.field select{border:1px solid var(--line);border-radius:6px;padding:11px;outline:0}.field textarea{min-height:150px;resize:vertical}.primary{height:40px;border:0;background:var(--maroon3);color:white;border-radius:6px;font-weight:800;cursor:pointer}.ghost-btn{border:1px solid var(--line);background:white;border-radius:6px;padding:7px 10px;font-weight:700;cursor:pointer}.toast{position:fixed;right:22px;bottom:22px;background:#111;color:white;padding:12px 16px;border-radius:8px}.loading,.empty{background:white;border:1px solid var(--line);border-radius:8px;padding:48px;text-align:center;color:#777}.branch-grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(240px,1fr));gap:16px}.branch-card{background:white;border:1px solid var(--line);border-radius:8px;padding:18px;box-shadow:var(--shadow)}@media(max-width:1100px){.admin-shell{grid-template-columns:1fr}.sidebar{position:relative;height:auto}.cards{grid-template-columns:repeat(2,1fr)}.three-pane,.grid-2,.editor{grid-template-columns:1fr}.topbar{height:auto;padding:14px;align-items:flex-start}.top-actions{flex-wrap:wrap}.search input{width:220px}}@media(max-width:640px){.content{padding:16px}.cards{grid-template-columns:1fr}.stat-card{min-height:92px}.page-head{display:block}.range{margin-top:12px}.search input{width:100%}.top-actions{width:100%}.top-actions select,.refresh{flex:1}.hbar{grid-template-columns:1fr}.hbar-name{text-align:left}.chart,.bar-chart{margin-left:0}.axis-y{display:none}.sidebar{padding:14px 8px}}
/* mobile emergency fix: do not let sidebar consume the full screen */
@media(max-width:900px){
  .admin-shell{display:block!important;min-height:100vh!important}
  .sidebar{position:relative!important;top:auto!important;height:auto!important;min-height:0!important;max-height:none!important;overflow:visible!important;padding:12px 10px 10px!important;background:#720812!important}
  .brand{padding:0 4px 10px!important;gap:9px!important}.brand-logo{width:34px!important;height:34px!important;font-size:18px!important}.brand strong{font-size:13px!important}.brand span{font-size:10px!important}.side-section{display:none!important}
  .side-nav{display:grid!important;grid-template-columns:repeat(2,minmax(0,1fr))!important;gap:6px!important}.side-link{height:34px!important;font-size:10px!important;padding:0 8px!important;border-radius:6px!important;gap:6px!important}.side-link svg{width:13px!important;height:13px!important}.side-link em{font-size:8px!important;padding:2px 4px!important}
  .topbar{position:relative!important;top:auto!important;height:auto!important;display:block!important;padding:10px!important;background:#fff!important}.collapse-btn{display:none!important}.top-actions{display:grid!important;grid-template-columns:1fr 1fr!important;gap:8px!important;margin:0!important;width:100%!important}.search{grid-column:1/-1!important}.search input{width:100%!important;height:36px!important}.top-actions select,.refresh{height:36px!important;width:100%!important}.profile{grid-column:1/-1!important;justify-content:flex-end!important;margin:0!important}
  .content{padding:14px!important}.page-head{margin-bottom:14px!important}.page-head h1{font-size:22px!important}.page-head p{font-size:12px!important}.range{display:none!important}.cards{grid-template-columns:1fr!important;gap:10px!important}.stat-card{padding:14px!important;min-height:78px!important}.stat-icon{width:38px!important;height:38px!important}.stat-card strong{font-size:23px!important}.panel{padding:14px!important;margin-bottom:14px!important}.chart,.bar-chart{height:190px!important;margin-left:0!important}.axis-y{display:none!important}.hbar{grid-template-columns:1fr!important;gap:5px!important}.hbar-name{text-align:left!important}.three-pane,.grid-2,.editor{grid-template-columns:1fr!important}.table-wrap{max-width:100%!important}
}
@media(max-width:420px){.side-nav{grid-template-columns:1fr!important}.side-link{font-size:11px!important}.top-actions{grid-template-columns:1fr!important}.profile{justify-content:flex-start!important}}
/* mobile sidebar v3: collapsed drawer instead of full-screen red block */
.mobile-nav-toggle{display:none;margin-left:auto;width:38px;height:34px;border:0;background:rgba(255,255,255,.12);border-radius:8px;padding:8px;cursor:pointer}.mobile-nav-toggle span{display:block;height:2px;background:#fff;border-radius:2px;margin:4px 0}
@media(max-width:900px){
  .sidebar{position:sticky!important;top:0!important;z-index:60!important;padding:10px!important;box-shadow:0 3px 18px rgba(0,0,0,.18)!important}
  .brand{padding:0!important;margin:0!important}.mobile-nav-toggle{display:block!important}.side-nav{display:none!important;margin-top:10px!important}.sidebar.menu-open .side-nav{display:grid!important}.sidebar.menu-open{max-height:80vh!important;overflow:auto!important}.sidebar:not(.menu-open){height:56px!important;overflow:hidden!important}.sidebar:not(.menu-open) .side-section{display:none!important}
  .side-link{height:38px!important;font-size:11px!important;background:rgba(255,255,255,.045)!important}.side-link.active{background:rgba(185,22,37,.85)!important}.topbar{position:sticky!important;top:56px!important;z-index:50!important}.content{min-height:calc(100vh - 120px)!important}
}
@media(max-width:420px){.sidebar:not(.menu-open){height:54px!important}.topbar{top:54px!important}.brand strong{font-size:12px!important}.brand span{font-size:9px!important}}
