:root{
  --bg:#0b1220;
  --bg2:#0f172a;
  --card:rgba(255,255,255,0.06);
  --card2:rgba(255,255,255,0.08);
  --text:#e5e7eb;
  --muted:rgba(229,231,235,0.72);
  --border:rgba(255,255,255,0.10);
  --shadow:0 12px 30px rgba(0,0,0,0.28);
  --primary:#0ea5e9;
  --primary2:#22c55e;
  --danger:#ef4444;
  --warn:#f59e0b;
  --radius:16px;
}

:root[data-theme="light"]{
  --bg:#f7fafc;
  --bg2:#ffffff;
  --card:#ffffff;
  --card2:#ffffff;
  --text:#0f172a;
  --muted:rgba(15,23,42,0.65);
  --border:rgba(15,23,42,0.10);
  --shadow:0 10px 26px rgba(15,23,42,0.10);
  --primary:#0284c7;
}

*{box-sizing:border-box}
html,body{height:100%}
body{
  margin:0;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Arial, "Tajawal", sans-serif;
  background: radial-gradient(1200px 800px at 20% -10%, rgba(14,165,233,0.22), transparent 55%),
              radial-gradient(900px 700px at 90% 10%, rgba(34,197,94,0.14), transparent 55%),
              linear-gradient(180deg, var(--bg) 0%, var(--bg2) 100%);
  color:var(--text);
}

a{color:inherit; text-decoration:none}
img{max-width:100%;}

.container{max-width:1100px; margin:0 auto; padding:16px}

.small{font-size:12px}
.muted{color:var(--muted)}

.grid{display:flex; flex-wrap:wrap; gap:12px}
[class^="col-"]{min-width:0}
.col-12{flex:0 0 100%}
.col-11{flex:0 0 91.666%}
.col-10{flex:0 0 83.333%}
.col-9{flex:0 0 75%}
.col-8{flex:0 0 66.666%}
.col-7{flex:0 0 58.333%}
.col-6{flex:0 0 50%}
.col-5{flex:0 0 41.666%}
.col-4{flex:0 0 33.333%}
.col-3{flex:0 0 25%}
.col-2{flex:0 0 16.666%}
.col-1{flex:0 0 8.333%}
@media (max-width: 980px){
  .col-7,.col-6,.col-5,.col-4,.col-3{flex:0 0 100%}
}

.card{
  background:var(--card);
  border:1px solid var(--border);
  border-radius:var(--radius);
  box-shadow:var(--shadow);
  padding:14px;
  backdrop-filter: blur(10px);
}

.hero{display:flex; justify-content:space-between; align-items:center; gap:14px; flex-wrap:wrap}

.btn{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  gap:8px;
  padding:10px 12px;
  border-radius:14px;
  border:1px solid var(--border);
  background:rgba(255,255,255,0.06);
  color:var(--text);
  cursor:pointer;
  transition: transform .08s ease, background .15s ease, border-color .15s ease;
  user-select:none;
}
.btn:hover{transform: translateY(-1px); background: rgba(255,255,255,0.10)}
.btn:active{transform: translateY(0px)}
.btn.primary{background: linear-gradient(135deg, rgba(14,165,233,0.95), rgba(34,197,94,0.70)); border-color: rgba(255,255,255,0.18)}
.btn.danger{background: rgba(239,68,68,0.18); border-color: rgba(239,68,68,0.35)}

.badge{
  display:inline-flex;
  align-items:center;
  padding:6px 10px;
  border-radius:999px;
  border:1px solid var(--border);
  background: rgba(255,255,255,0.06);
  font-size:12px;
  font-weight:700;
}
.badge.pill{font-weight:700}
.badge.ok{background: rgba(34,197,94,0.18); border-color: rgba(34,197,94,0.35)}
.badge.danger{background: rgba(239,68,68,0.18); border-color: rgba(239,68,68,0.35)}
.badge.warn{background: rgba(245,158,11,0.18); border-color: rgba(245,158,11,0.35)}

.notice{border-radius:14px; padding:12px; border:1px solid var(--border); background: rgba(255,255,255,0.06)}
.notice.ok{background: rgba(34,197,94,0.16); border-color: rgba(34,197,94,0.32)}
.notice.danger{background: rgba(239,68,68,0.14); border-color: rgba(239,68,68,0.30)}

.table{width:100%; border-collapse:collapse; overflow:hidden}
.table th,.table td{padding:10px 10px; border-bottom:1px solid rgba(255,255,255,0.08); text-align:start; vertical-align:top}
:root[data-theme="light"] .table th, :root[data-theme="light"] .table td{border-bottom:1px solid rgba(15,23,42,0.08)}
.table th{font-size:12px; color:var(--muted); font-weight:800}

label{display:block; font-size:12px; color:var(--muted); margin:6px 0}
input,select,textarea{
  width:100%;
  padding:10px 12px;
  border-radius:14px;
  border:1px solid var(--border);
  background: rgba(255,255,255,0.06);
  color:var(--text);
  outline:none;
}
textarea{min-height:90px; resize:vertical}

.row{display:flex; gap:10px}

/* Topbar (public) */
.topbar{position:sticky; top:0; z-index:50; backdrop-filter: blur(10px); background: rgba(2,6,23,0.55); border-bottom:1px solid rgba(255,255,255,0.08)}
:root[data-theme="light"] .topbar{background: rgba(255,255,255,0.75); border-bottom:1px solid rgba(15,23,42,0.08)}
.topbar .in{max-width:1100px; margin:0 auto; padding:10px 16px; display:flex; align-items:center; justify-content:space-between; gap:10px}
.topbar .brand{display:flex; align-items:center; gap:10px}
.topbar .brand img{width:34px; height:34px; border-radius:10px; object-fit:cover}

/* Panel layout */
.panel-layout{display:flex; min-height:100vh}
.panel-overlay{display:none}
.panel-sidebar{width:270px; flex:0 0 270px; padding:12px; border-inline-end:1px solid rgba(255,255,255,0.08); background: rgba(2,6,23,0.55); backdrop-filter: blur(12px); position:sticky; top:0; height:100vh; overflow:auto}
:root[data-theme="light"] .panel-sidebar{background: rgba(255,255,255,0.75); border-inline-end:1px solid rgba(15,23,42,0.08)}
.panel-sidebar__brand{display:flex; align-items:center; gap:10px; padding:10px; border:1px solid var(--border); border-radius:18px; background: rgba(255,255,255,0.06)}
.panel-sidebar__brand img{width:44px; height:44px; border-radius:14px}
.panel-sidebar__brand .title{font-weight:900}
.panel-sidebar__search{margin-top:10px}
.panel-nav{display:flex; flex-direction:column; gap:6px; margin-top:10px}
.panel-nav__item{display:flex; align-items:center; gap:10px; padding:10px 12px; border-radius:16px; border:1px solid transparent}
.panel-nav__item:hover{background: rgba(255,255,255,0.06)}
.panel-nav__item.active{border-color: rgba(14,165,233,0.32); background: rgba(14,165,233,0.12)}
.panel-nav__item .ic{width:26px; text-align:center}
.panel-sidebar__foot{margin-top:12px; padding-top:10px; border-top:1px solid rgba(255,255,255,0.10)}

.panel-main{flex:1; min-width:0; display:flex; flex-direction:column}
.panel-topbar{position:sticky; top:0; z-index:40; backdrop-filter: blur(10px); background: rgba(2,6,23,0.45); border-bottom:1px solid rgba(255,255,255,0.08); padding:10px 14px; display:flex; justify-content:space-between; align-items:center; gap:10px}
:root[data-theme="light"] .panel-topbar{background: rgba(255,255,255,0.75); border-bottom:1px solid rgba(15,23,42,0.08)}
.panel-topbar__left{display:flex; align-items:center; gap:10px}
.panel-topbar__title .panel-page-title{font-weight:900}
.panel-content{padding:14px 14px 24px}

/* Sidebar collapse */
.panel-layout.is-collapsed .panel-sidebar{width:86px; flex:0 0 86px}
.panel-layout.is-collapsed .panel-sidebar__brand .txt{display:none}
.panel-layout.is-collapsed .panel-nav__item .lb{display:none}
.panel-layout.is-collapsed .panel-sidebar__search{display:none}
.panel-layout.is-collapsed .sb-collapse{transform: rotate(180deg)}
.sb-collapse{border:none; background:transparent; color:var(--text); cursor:pointer}

@media (max-width: 980px){
  .panel-sidebar{position:fixed; inset:0 auto 0 0; transform: translateX(-105%); transition: transform .2s ease; z-index:60}
  .panel-layout.is-rtl .panel-sidebar{inset:0 0 0 auto; transform: translateX(105%)}
  .panel-sidebar.is-open{transform: translateX(0)}
  .panel-overlay{display:block; position:fixed; inset:0; background: rgba(0,0,0,0.45); z-index:55; opacity:0; pointer-events:none; transition: opacity .2s ease}
  .panel-overlay.is-open{opacity:1; pointer-events:auto}
}

/* Theme toggle button becomes switch via JS */
.theme-switch{width:48px; height:28px; border-radius:999px; border:1px solid var(--border); background: rgba(255,255,255,0.10); position:relative}
.theme-switch::after{content:""; position:absolute; top:3px; left:3px; width:22px; height:22px; border-radius:999px; background: rgba(255,255,255,0.92); transition: transform .2s ease}
:root[data-theme="light"] .theme-switch::after{transform: translateX(20px)}

/* Timeline */
.timeline{display:flex; flex-direction:column; gap:10px}
.tl-item{display:flex; gap:12px; align-items:flex-start}
.tl-rail{position:relative; width:14px; flex:0 0 14px}
.tl-dot{width:10px; height:10px; border-radius:999px; border:2px solid rgba(255,255,255,0.22); background: rgba(255,255,255,0.10); position:absolute; top:4px; left:2px}
:root[data-theme="light"] .tl-dot{border-color: rgba(15,23,42,0.22); background: rgba(15,23,42,0.06)}
.tl-dot.ok{border-color: rgba(34,197,94,0.55); background: rgba(34,197,94,0.18)}
.tl-dot.warn{border-color: rgba(245,158,11,0.55); background: rgba(245,158,11,0.18)}
.tl-dot.danger{border-color: rgba(239,68,68,0.55); background: rgba(239,68,68,0.18)}
.tl-line{position:absolute; top:16px; bottom:-8px; left:6px; width:2px; background: rgba(255,255,255,0.12)}
:root[data-theme="light"] .tl-line{background: rgba(15,23,42,0.10)}
.tl-body{flex:1; min-width:0}
.tl-title{font-weight:900}
.tl-meta{font-size:12px; color:var(--muted); margin-top:2px; line-height:1.45}
.tl-time{font-size:12px; color:var(--muted); white-space:nowrap}

/* Small helpers */
.copybox{display:flex; gap:8px; align-items:center; flex-wrap:wrap}
.copybox input{flex:1; min-width:220px}
.kv{display:flex; justify-content:space-between; gap:10px; align-items:flex-start}
.kv .k{color:var(--muted); font-size:12px}
.kv .v{font-weight:800}
/* ============================================================
   UI/UX Upgrade — Patch_11_UIUX
   - Better focus states & accessibility
   - Responsive tables, chips, auth layout, KPI cards
   ============================================================ */
:root{
  --ring: rgba(14,165,233,0.25);
  --radius-sm: 12px;
  --radius-lg: 22px;
}

.container.narrow{max-width:920px}
.container.wide{max-width:1200px}

hr.sep{border:none;border-top:1px solid rgba(255,255,255,0.10); margin:14px 0}
:root[data-theme="light"] hr.sep{border-top:1px solid rgba(15,23,42,0.10)}

input:focus,select:focus,textarea:focus{
  border-color: rgba(14,165,233,0.55);
  box-shadow: 0 0 0 4px var(--ring);
  background: rgba(255,255,255,0.08);
}
:root[data-theme="light"] input:focus,
:root[data-theme="light"] select:focus,
:root[data-theme="light"] textarea:focus{
  background:#fff;
}

.btn:focus-visible{
  outline:none;
  border-color: rgba(14,165,233,0.55);
  box-shadow: 0 0 0 4px var(--ring);
}
.btn:disabled,.btn.disabled{opacity:.55; pointer-events:none; filter:saturate(.7)}

/* ============================================================
   Patch_11C_UIUX — Forms, Tabs, Sticky Actions
   ============================================================ */

.page-head{display:flex;justify-content:space-between;align-items:flex-start;gap:12px;flex-wrap:wrap;margin-bottom:12px}
.page-head .title{font-weight:1000; font-size:18px; margin:0}
.page-head .desc{color:var(--muted); font-size:12px; margin-top:4px; line-height:1.5}
.page-head .actions{display:flex; gap:8px; flex-wrap:wrap; align-items:center}

.section{border:1px solid var(--border); background:rgba(255,255,255,0.04); border-radius:18px; padding:14px}
:root[data-theme="light"] .section{background:#fff}
.section + .section{margin-top:12px}
.section__head{display:flex; justify-content:space-between; align-items:flex-start; gap:10px; flex-wrap:wrap; margin-bottom:10px}
.section__title{font-weight:950; margin:0}
.section__hint{font-size:12px; color:var(--muted); margin-top:4px; line-height:1.5}

.table-wrap{overflow:auto; border-radius:16px; border:1px solid var(--border)}
.table-wrap .table{min-width:720px}

.tabs{display:flex; gap:8px; flex-wrap:wrap; padding:10px; border:1px solid var(--border); background:rgba(255,255,255,0.05); border-radius:18px}
:root[data-theme="light"] .tabs{background:#fff}
.tab{display:inline-flex; align-items:center; gap:8px; padding:9px 12px; border-radius:999px; border:1px solid transparent; background:transparent; color:var(--text); cursor:pointer; font-weight:800; font-size:12px}
.tab:hover{background:rgba(255,255,255,0.06)}
.tab.is-active{border-color: rgba(14,165,233,0.35); background: rgba(14,165,233,0.14)}
.tab .dot{width:8px;height:8px;border-radius:999px;background:rgba(255,255,255,0.18)}
.tab.is-active .dot{background: rgba(14,165,233,0.75)}

.form-actions{display:flex; gap:10px; flex-wrap:wrap}
.sticky-actions{position:sticky; bottom:10px; z-index:10; margin-top:14px; padding:10px; border-radius:18px; border:1px solid var(--border); background: rgba(2,6,23,0.65); backdrop-filter: blur(10px); display:flex; justify-content:space-between; align-items:center; gap:10px; flex-wrap:wrap}
:root[data-theme="light"] .sticky-actions{background: rgba(255,255,255,0.85)}
.sticky-actions .left{display:flex; align-items:center; gap:10px; flex-wrap:wrap}
.sticky-actions .right{display:flex; align-items:center; gap:10px; flex-wrap:wrap}
.sticky-actions .dirty{display:none}
.sticky-actions.is-dirty .dirty{display:inline-flex}

.uploader{border:1px dashed rgba(255,255,255,0.22); border-radius:18px; padding:12px; background:rgba(255,255,255,0.04)}
:root[data-theme="light"] .uploader{border-color: rgba(15,23,42,0.18)}
.uploader .small{opacity:.85}

.img-grid{display:grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap:10px}
@media (max-width: 980px){ .img-grid{grid-template-columns: repeat(2, minmax(0,1fr));} }
.img-tile{border:1px solid var(--border); border-radius:16px; overflow:hidden; background:rgba(255,255,255,0.04)}
.img-tile img{width:100%; height:130px; object-fit:cover; display:block}
.img-tile .pad{padding:10px}

.kpi-grid{display:grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap:12px}
@media (max-width: 980px){ .kpi-grid{grid-template-columns: repeat(2, minmax(0,1fr));} }
.kpi{border:1px solid var(--border); background:rgba(255,255,255,0.04); border-radius:18px; padding:12px}
.kpi .k{color:var(--muted); font-size:12px; font-weight:800}
.kpi .v{font-size:18px; font-weight:1000; margin-top:6px}

.btn.sm{padding:7px 10px; border-radius:12px; font-size:13px}
.btn.block{width:100%}
.btn.ghost{background:transparent}
.btn.secondary{background: rgba(34,197,94,0.14); border-color: rgba(34,197,94,0.28)}

.page-head{display:flex; justify-content:space-between; align-items:flex-end; gap:12px; flex-wrap:wrap}
.page-title{margin:0; font-weight:950; font-size:20px; letter-spacing:-0.2px}
.page-sub{margin-top:6px; font-size:12px; color:var(--muted)}
.actions{display:flex; gap:8px; flex-wrap:wrap; align-items:center}

.chips{display:flex; gap:6px; flex-wrap:wrap; margin-top:10px}
.chip{display:inline-flex; align-items:center; gap:8px; padding:6px 10px; border-radius:999px; border:1px solid var(--border); background: rgba(255,255,255,0.06); font-size:12px; font-weight:800}
.chip:hover{background: rgba(255,255,255,0.10)}
.chip.active{background: rgba(14,165,233,0.14); border-color: rgba(14,165,233,0.30)}

.table-wrap{overflow:auto; border-radius:var(--radius); border:1px solid rgba(255,255,255,0.08); margin-top:12px}
:root[data-theme="light"] .table-wrap{border-color: rgba(15,23,42,0.08)}
.table{min-width:820px}
.table th{
  position:sticky; top:0;
  background: rgba(2,6,23,0.60);
  backdrop-filter: blur(10px);
}
:root[data-theme="light"] .table th{background: rgba(255,255,255,0.92)}

.empty{padding:22px 10px; text-align:center; color:var(--muted)}
.empty .ic{font-size:32px; margin-bottom:6px}
.empty b{display:block; color:var(--text); margin-bottom:4px}

.code{
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  font-size:12px;
  line-height:1.55;
  white-space:pre-wrap;
  word-break:break-word;
  padding:12px;
  border-radius:16px;
  border:1px solid var(--border);
  background: rgba(0,0,0,0.18);
}
:root[data-theme="light"] .code{background: rgba(15,23,42,0.04)}

.hr{height:1px; background: rgba(255,255,255,0.10); margin:12px 0}
:root[data-theme="light"] .hr{background: rgba(15,23,42,0.10)}

.stack{display:flex; flex-direction:column; gap:10px}
.kv-grid{display:grid; grid-template-columns: repeat(2, 1fr); gap:10px}
@media(max-width:700px){ .kv-grid{grid-template-columns:1fr} }
.kv-box{padding:12px; border-radius:16px; border:1px solid rgba(255,255,255,0.10); background: rgba(255,255,255,0.04)}
:root[data-theme="light"] .kv-box{background:#fff}
.kv-box .k{font-size:12px; color:var(--muted); font-weight:800}
.kv-box .v{font-weight:950; margin-top:6px}

.media{display:flex; align-items:center; gap:10px; min-width:0}
.media .thumb{width:42px; height:42px; border-radius:12px; background: rgba(255,255,255,0.06); display:flex; align-items:center; justify-content:center; overflow:hidden; flex:0 0 42px}
.media .thumb img{width:100%; height:100%; object-fit:cover}
.media .title{font-weight:900}
.media .meta{font-size:12px; color:var(--muted); margin-top:2px}

.auth-layout{display:grid; grid-template-columns: 1.1fr 0.9fr; gap:14px}
@media(max-width:980px){ .auth-layout{grid-template-columns:1fr} }
.auth-side{min-height:420px; border-radius:var(--radius-lg); padding:16px; border:1px solid var(--border); background: radial-gradient(900px 600px at 20% 0%, rgba(14,165,233,0.25), transparent 55%), radial-gradient(700px 600px at 90% 10%, rgba(34,197,94,0.18), transparent 55%), rgba(255,255,255,0.04)}
.auth-side .brand{display:flex; align-items:center; gap:10px}
.auth-side .brand img{width:40px; height:40px; border-radius:14px}
.auth-side .brand b{font-size:16px}
.auth-side .bullet{display:flex; gap:10px; align-items:flex-start}
.auth-side .bullet .b-ic{width:30px; height:30px; border-radius:12px; background: rgba(255,255,255,0.10); display:flex; align-items:center; justify-content:center; flex:0 0 30px}
.auth-side .bullet .b-t{font-weight:900}
.auth-side .bullet .b-d{font-size:12px; color:var(--muted); margin-top:2px}

.kpi-grid{display:grid; grid-template-columns: repeat(3, 1fr); gap:12px; margin-top:12px}
@media(max-width:980px){ .kpi-grid{grid-template-columns: repeat(2, 1fr)} }
@media(max-width:520px){ .kpi-grid{grid-template-columns: 1fr} }
.kpi{padding:14px; border-radius:var(--radius); background:var(--card); border:1px solid var(--border); box-shadow:var(--shadow)}
.kpi .k{font-size:12px; color:var(--muted); font-weight:900}
.kpi .v{font-size:22px; font-weight:950; margin-top:8px; letter-spacing:-0.3px}
.kpi .m{margin-top:6px; font-size:12px; color:var(--muted)}

.dash-card-head{display:flex; justify-content:space-between; align-items:flex-start; gap:10px; flex-wrap:wrap}
.dash-card-title{font-weight:950}
.dash-card-sub{font-size:12px; color:var(--muted); margin-top:4px}
.dash-spark{height:92px; display:flex; align-items:flex-end; gap:4px; margin-top:10px}
.dash-spark i{display:block; width:10px; border-radius:8px 8px 0 0; background: rgba(14,165,233,0.35)}
.dash-spark.rev i{background: rgba(34,197,94,0.30)}


/* ============================================================
   UI/UX Upgrade — Patch_11B_UIUX
   - Panel interactions (sidebar/theme)
   - Better forms (input groups) + details cards
   ============================================================ */
.input-group{display:flex; gap:8px; align-items:center; flex-wrap:wrap}
.input-group input,.input-group select,.input-group textarea{flex:1; min-width:220px}
.icon-btn{width:44px; height:44px; border-radius:14px; border:1px solid var(--border); background: rgba(255,255,255,0.06); color:var(--text); cursor:pointer}
.icon-btn:hover{background: rgba(255,255,255,0.10)}

details.card > summary{list-style:none; cursor:pointer}
details.card > summary::-webkit-details-marker{display:none}
details.card > summary{display:flex; align-items:center; justify-content:space-between; gap:10px; flex-wrap:wrap}
.details-head{display:flex; align-items:center; gap:10px; flex-wrap:wrap; min-width:0}
.details-head .title{font-weight:950}
.details-head .sub{font-size:12px; color:var(--muted)}
