/* ===== Silkroad4Arab client portal ===== */
[hidden] { display: none !important; }
:root {
  /* الوضع الليلي: رمادي غامق محايد بدل الكحلي، مع فرق أوضح بين الخلفية والكروت ونص ثانوي مقروء */
  --bg: #0b0d12; --bg2: #12151c; --panel: #181c25; --panel2: #20252f; --line: #2b313e; --line2: #3d4556;
  --text: #e9ecf2; --muted: #a6afbf; --faint: #838da0; --ctl: #cbd2de;
  --accent: #4f7cff; --accent2: #7c5cff; --accent-soft: rgba(79, 124, 255, .14);
  --ok: #22c55e; --ok-soft: rgba(34, 197, 94, .13); --danger: #ef4444; --danger-soft: rgba(239, 68, 68, .13);
  --warn: #f59e0b; --warn-soft: rgba(245, 158, 11, .13); --violet-soft: rgba(124, 92, 255, .15);
  --input: #11141b; --shadow: 0 1px 2px rgba(0,0,0,.45), 0 10px 28px rgba(0,0,0,.35);
  --r: 14px; --r-sm: 10px; --side: 256px;
  color-scheme: dark;
}
:root[data-theme="light"] {
  --bg: #f4f6fb; --bg2: #eef2f9; --panel: #ffffff; --panel2: #f7f9fd; --line: #e4e9f2; --line2: #d5dce9;
  --text: #101828; --muted: #5b6b86; --faint: #98a3b8; --ctl: #5b6b86;
  --accent: #3b6cf6; --accent-soft: rgba(59, 108, 246, .1);
  --input: #ffffff; --shadow: 0 1px 2px rgba(16,24,40,.05), 0 6px 20px rgba(16,24,40,.06);
  color-scheme: light;
}
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    --bg: #f4f6fb; --bg2: #eef2f9; --panel: #ffffff; --panel2: #f7f9fd; --line: #e4e9f2; --line2: #d5dce9;
    --text: #101828; --muted: #5b6b86; --faint: #98a3b8; --ctl: #5b6b86;
    --accent: #3b6cf6; --accent-soft: rgba(59, 108, 246, .1);
    --input: #ffffff; --shadow: 0 1px 2px rgba(16,24,40,.05), 0 6px 20px rgba(16,24,40,.06);
    color-scheme: light;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text);
  font: 15px/1.6 "IBM Plex Sans Arabic", "Segoe UI", Tahoma, system-ui, sans-serif; -webkit-font-smoothing: antialiased; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 22px; margin: 0 0 16px; font-weight: 700; }
h2 { font-size: 17px; margin: 28px 0 12px; font-weight: 600; }
h3 { font-size: 16px; margin: 0; font-weight: 600; }
.card h2:first-child, .card h1:first-child { margin-top: 0; }
.muted { color: var(--muted); } .warn { color: var(--warn); }
small { font-size: 12.5px; }
code { background: var(--bg2); border: 1px solid var(--line); padding: 1px 7px; border-radius: 6px; font: 13px/1.6 ui-monospace, "Cascadia Code", Consolas, monospace; }

.ic { width: 18px; height: 18px; flex: none; }
.ic.xs { width: 13px; height: 13px; vertical-align: -2px; }
[dir="rtl"] .ic-flip { transform: scaleX(-1); }

/* ---------- App shell ---------- */
.side { position: fixed; inset-block: 0; inset-inline-start: 0; width: var(--side); background: var(--panel);
  border-inline-end: 1px solid var(--line); display: flex; flex-direction: column; z-index: 40; transition: transform .25s ease; }
.shell { margin-inline-start: var(--side); min-height: 100vh; display: flex; flex-direction: column; }
.brand { display: flex; align-items: center; gap: 10px; color: var(--text); font-size: 16px; padding: 18px 20px; }
.brand:hover { text-decoration: none; }
.logo { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 10px; color: #fff;
  background: linear-gradient(135deg, var(--accent), var(--accent2)); box-shadow: 0 6px 18px rgba(79,124,255,.35); }
.logo .ic { width: 19px; height: 19px; }
.logo.lg { width: 56px; height: 56px; border-radius: 16px; } .logo.lg .ic { width: 28px; height: 28px; }

.side nav { flex: 1; overflow-y: auto; padding: 6px 12px 16px; }
.nav-label { font-size: 11.5px; letter-spacing: .04em; text-transform: uppercase; color: var(--faint); padding: 16px 10px 6px; font-weight: 600; }
.side nav a { display: flex; align-items: center; gap: 11px; padding: 9px 12px; border-radius: var(--r-sm); color: var(--muted);
  font-weight: 500; margin-bottom: 2px; position: relative; }
.side nav a:hover { background: var(--bg2); color: var(--text); text-decoration: none; }
.side nav a.on { background: var(--accent-soft); color: var(--accent); }
.side nav a.on::before { content: ""; position: absolute; inset-inline-start: -12px; top: 8px; bottom: 8px; width: 3px;
  border-radius: 3px; background: var(--accent); }
.side nav a span { flex: 1; }
.count { font-style: normal; background: var(--danger); color: #fff; border-radius: 20px; padding: 0 7px; font-size: 11.5px; line-height: 19px; min-width: 19px; text-align: center; }

.side-foot { border-top: 1px solid var(--line); padding: 12px 14px; display: flex; align-items: center; gap: 8px; }
.me { display: flex; align-items: center; gap: 10px; flex: 1; min-width: 0; }
.me div { min-width: 0; display: flex; flex-direction: column; line-height: 1.35; }
.me b { font-size: 13.5px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.me small { color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.avatar { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; flex: none; font-weight: 700;
  background: var(--violet-soft); color: var(--accent2); }

.topbar { position: sticky; top: 0; z-index: 30; display: flex; align-items: center; gap: 12px; padding: 12px 28px;
  min-height: 64px; background: color-mix(in srgb, var(--bg) 82%, transparent); backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line); }
.page-title { font-size: 19px; margin: 0; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tools { display: flex; gap: 6px; align-items: center; }
.icon-btn { display: inline-flex; align-items: center; justify-content: center; gap: 5px; min-width: 38px; height: 38px; padding: 0 9px;
  border-radius: var(--r-sm); border: 1px solid var(--line); background: var(--panel); color: var(--ctl, var(--muted)); cursor: pointer; font: inherit; font-size: 13px; font-weight: 600; }
.icon-btn:hover { color: var(--text); border-color: var(--line2); text-decoration: none; }
.icon-btn.sm { min-width: 30px; height: 30px; padding: 0 6px; border-radius: 8px; }
.icon-btn.sm .ic { width: 15px; height: 15px; }
.icon-btn .i-done { display: none; color: var(--ok); }
.icon-btn.copied .i-done { display: block; } .icon-btn.copied .ic:not(.i-done) { display: none; }
.i-light { display: none; }
:root[data-theme="light"] .i-light { display: block; } :root[data-theme="light"] .i-dark { display: none; }
@media (prefers-color-scheme: light) { :root:not([data-theme]) .i-light { display: block; } :root:not([data-theme]) .i-dark { display: none; } }
.menu-btn { display: none; }
.chip-balance { display: inline-flex; align-items: center; gap: 7px; height: 38px; padding: 0 13px; border-radius: var(--r-sm);
  background: var(--ok-soft); color: var(--ok); font-weight: 600; font-size: 14px; white-space: nowrap; }
.chip-balance:hover { text-decoration: none; filter: brightness(1.1); }

.content { padding: 26px 28px 70px; width: 100%; max-width: 1760px; }
.scrim { display: none; }

/* ---------- Auth ---------- */
body.bare { min-height: 100vh; background:
  radial-gradient(900px 500px at 10% -10%, rgba(79,124,255,.18), transparent 60%),
  radial-gradient(700px 500px at 110% 110%, rgba(124,92,255,.16), transparent 60%), var(--bg); }
.auth-top { display: flex; justify-content: space-between; align-items: center; padding: 14px 24px; max-width: 1100px; margin: 0 auto; }
.auth-top .brand { padding: 0; }
main.auth { max-width: 1100px; margin: 0 auto; padding: 24px 16px 60px; }
.auth-wrap { display: grid; grid-template-columns: 1.1fr 1fr; background: var(--panel); border: 1px solid var(--line);
  border-radius: 22px; overflow: hidden; box-shadow: var(--shadow); max-width: 920px; margin: 4vh auto 0; }
.auth-art { padding: 44px; color: #fff; position: relative;
  background: linear-gradient(150deg, #1d3a8f 0%, #3b2a8f 60%, #4c2a8a 100%); }
.auth-art::after { content: ""; position: absolute; inset: 0; background:
  radial-gradient(400px 220px at 90% 10%, rgba(255,255,255,.14), transparent 70%); pointer-events: none; }
.auth-art .logo { background: rgba(255,255,255,.16); box-shadow: none; }
.auth-art h2 { font-size: 26px; margin: 22px 0 6px; }
.auth-art p { color: rgba(255,255,255,.78); margin: 0 0 26px; }
.auth-art ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 14px; }
.auth-art li { display: flex; align-items: center; gap: 12px; color: rgba(255,255,255,.92); }
.auth-art li .ic { width: 34px; height: 34px; padding: 8px; border-radius: 10px; background: rgba(255,255,255,.12); }
.auth-card { padding: 44px 40px; }
.auth-card h1 { margin-bottom: 4px; }
.auth-card > p { margin: 0 0 24px; }
.card.narrow { max-width: 440px; margin: 6vh auto; padding: 28px; }
.card.narrow.left { margin: 0; }

/* ---------- Cards / overview ---------- */
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); padding: 20px; margin-bottom: 16px; box-shadow: var(--shadow); }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(330px, 1fr)); gap: 16px; margin-bottom: 8px; }
.grid > .card { margin-bottom: 0; }
.overview { display: grid; grid-template-columns: 1.35fr repeat(3, 1fr); gap: 16px; margin-bottom: 18px; align-items: start; }
.overview > .stat { align-self: stretch; align-items: center; }
.overview.admin { grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }
.hero { position: relative; overflow: hidden; border-radius: var(--r); padding: 20px 22px; color: #fff;
  background: linear-gradient(135deg, #2f5bea 0%, #5b3fe0 100%); box-shadow: 0 10px 30px rgba(63,90,234,.3); }
.hero::after { content: ""; position: absolute; width: 220px; height: 220px; border-radius: 50%; inset-inline-end: -60px; top: -90px;
  background: rgba(255,255,255,.09); }
.hero.slim { max-width: 420px; margin-bottom: 18px; }
.hero-top { display: flex; justify-content: space-between; align-items: center; color: rgba(255,255,255,.8); font-weight: 500; }
.hero-amount { font-size: 30px; font-weight: 700; margin: 6px 0 14px; letter-spacing: -.01em; text-align: start; }
[dir="rtl"] .hero-amount { text-align: end; }
.hero-foot { display: flex; gap: 8px; flex-wrap: wrap; position: relative; z-index: 1; }
.stat { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); padding: 18px; display: flex; gap: 14px;
  align-items: flex-start; box-shadow: var(--shadow); }
.stat > div { display: flex; flex-direction: column; min-width: 0; }
.stat small { color: var(--muted); font-size: 13px; }
.stat b { font-size: 21px; font-weight: 700; line-height: 1.35; white-space: nowrap; }
.stat em { font-style: normal; font-size: 12.5px; color: var(--faint); }
.stat-ic { display: grid; place-items: center; width: 42px; height: 42px; border-radius: 12px; flex: none; }
.stat-ic.sm { width: 30px; height: 30px; border-radius: 9px; } .stat-ic.sm .ic { width: 15px; height: 15px; }
.stat-ic.blue { background: var(--accent-soft); color: var(--accent); }
.stat-ic.green { background: var(--ok-soft); color: var(--ok); }
.stat-ic.red { background: var(--danger-soft); color: var(--danger); }
.stat-ic.amber { background: var(--warn-soft); color: var(--warn); }
.stat-ic.violet { background: var(--violet-soft); color: var(--accent2); }

.section-head { display: flex; align-items: center; gap: 10px; margin: 26px 0 12px; }
.section-head h2 { margin: 0; }
.section-head .muted { background: var(--panel2); border: 1px solid var(--line); border-radius: 20px; padding: 0 9px; font-size: 12.5px; }
.empty { text-align: center; padding: 46px 20px; border: 1px dashed var(--line2); border-radius: var(--r); color: var(--muted); }
.empty .stat-ic { margin: 0 auto 10px; }

/* ---------- VPS cards ---------- */
.vps-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(380px, 1fr)); gap: 16px; }
.vps { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow);
  display: flex; flex-direction: column; overflow: hidden; transition: border-color .2s; }
.vps:hover { border-color: var(--line2); }
.vps.state-suspended { border-color: color-mix(in srgb, var(--danger) 45%, var(--line)); }
.vps-head { display: flex; align-items: center; gap: 12px; padding: 18px 18px 14px; }
.os-tile { display: grid; place-items: center; width: 44px; height: 44px; border-radius: 12px; flex: none;
  background: var(--accent-soft); color: var(--accent); }
.os-tile.win { background: rgba(14,165,233,.14); color: #0ea5e9; }
.vps-title { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.vps-title h3 { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.vps-title small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; text-align: start; }
[dir="rtl"] .vps-title small { text-align: end; }
.vps > .flash { margin: 0 18px 12px; }
.ip-row { display: flex; align-items: center; gap: 8px; margin: 0 18px; padding: 10px 12px; background: var(--bg2);
  border: 1px solid var(--line); border-radius: var(--r-sm); }
.ip-row code { background: none; border: 0; padding: 0; font-size: 14px; flex: 1; text-align: start; }
[dir="rtl"] .ip-row code { text-align: end; }
.specs-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; padding: 12px 18px; }
.specs-row > div { display: grid; grid-template-columns: auto 1fr; column-gap: 8px; align-items: center; padding: 10px;
  border: 1px solid var(--line); border-radius: var(--r-sm); min-width: 0; }
.specs-row .ic { grid-row: span 2; color: var(--faint); width: 17px; height: 17px; }
.specs-row small { color: var(--muted); font-size: 11.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.specs-row b { font-size: 13.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.renew { padding: 2px 18px 16px; }
.renew-top { display: flex; justify-content: space-between; gap: 8px; font-size: 13.5px; margin-bottom: 7px; flex-wrap: wrap; }
.bar { height: 6px; border-radius: 6px; background: var(--bg2); border: 1px solid var(--line); overflow: hidden; }
.bar i { display: block; height: 100%; border-radius: 6px; background: linear-gradient(90deg, var(--accent), var(--accent2)); }
.bar i.low { background: linear-gradient(90deg, var(--warn), var(--danger)); }
.renew-foot { font-size: 13px; margin-top: 7px; }
.renew-foot b { color: var(--text); font-weight: 600; }
.vps-actions { margin-top: auto; display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; padding: 12px 18px; border-top: 1px solid var(--line); background: var(--panel2); }
.vps-actions form { margin: 0; display: flex; }
.vps-actions .btn { padding: 8px 10px; font-size: 13.5px; flex: 1; width: 100%; }
.act-start:not(:disabled) { color: var(--ok); }
.act-stop:not(:disabled), .act-poweroff:not(:disabled) { color: var(--danger); }
.act-restart:not(:disabled) { color: var(--warn); }

/* ---------- Badges ---------- */
.badge { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 20px; font-size: 12.5px; font-weight: 600;
  background: var(--panel2); color: var(--muted); border: 1px solid var(--line); white-space: nowrap; }
.badge i { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.badge.active, .badge.running, .badge.approved, .badge.paid { color: var(--ok); background: var(--ok-soft); border-color: transparent; }
.badge.running i { box-shadow: 0 0 0 0 currentColor; animation: pulse 2s infinite; }
.badge.suspended, .badge.rejected, .badge.failed { color: var(--danger); background: var(--danger-soft); border-color: transparent; }
.badge.pending { color: var(--warn); background: var(--warn-soft); border-color: transparent; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(34,197,94,.55); } 70% { box-shadow: 0 0 0 6px rgba(34,197,94,0); } 100% { box-shadow: 0 0 0 0 rgba(34,197,94,0); } }

/* ---------- Forms ---------- */
form label { display: block; margin-bottom: 14px; color: var(--muted); font-size: 13.5px; font-weight: 500; }
form label.check { display: flex; gap: 9px; align-items: center; color: var(--text); }
input, select, textarea { display: block; width: 100%; margin-top: 6px; padding: 10px 12px; background: var(--input); color: var(--text);
  border: 1px solid var(--line2); border-radius: var(--r-sm); font: inherit; font-size: 14.5px; transition: border-color .15s, box-shadow .15s; }
input[type=checkbox], input[type=radio] { width: 17px; height: 17px; margin: 0; display: inline-block; accent-color: var(--accent); }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
input[readonly] { background: var(--bg2); }
form.row { display: flex; gap: 10px; align-items: flex-end; flex-wrap: wrap; }
form.row label { flex: 1 1 140px; margin: 0; }
form.row.tight { gap: 6px; flex-wrap: nowrap; align-items: center; }
form.row.tight input, form.row.tight select { width: auto; margin: 0; padding: 6px 9px; }
form.inline { margin: 0 0 6px; }
span.row { display: flex; gap: 6px; align-items: center; margin-top: 6px; }
span.row input { margin: 0; flex: 1; }

/* ---------- Buttons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; padding: 9px 15px; border-radius: var(--r-sm);
  border: 1px solid var(--line2); background: var(--panel); color: var(--text); font: inherit; font-size: 14px; font-weight: 600;
  cursor: pointer; white-space: nowrap; transition: background .15s, border-color .15s, filter .15s, transform .05s; }
.btn .ic { width: 16px; height: 16px; }
.btn:hover:not(:disabled) { border-color: var(--faint); text-decoration: none; background: var(--panel2); }
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn:disabled { opacity: .4; cursor: not-allowed; }
.btn.sm { padding: 5px 10px; font-size: 13px; }
.btn.block { width: 100%; padding: 11px; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; box-shadow: 0 4px 14px rgba(79,124,255,.3); }
.btn.primary:hover:not(:disabled) { background: var(--accent); filter: brightness(1.1); }
.btn.ok { background: var(--ok-soft); border-color: transparent; color: var(--ok); }
.btn.danger { background: var(--danger-soft); border-color: transparent; color: var(--danger); }
.btn.ok:hover:not(:disabled), .btn.danger:hover:not(:disabled) { filter: brightness(1.15); border-color: currentColor; background: inherit; }
.btn.light { background: #fff; color: #2f3fbf; border-color: #fff; }
.btn.light:hover { background: #fff; filter: brightness(.96); }
.btn.ghost-light { background: rgba(255,255,255,.12); color: #fff; border-color: rgba(255,255,255,.25); }
.btn.ghost-light:hover { background: rgba(255,255,255,.2); }
.btn.loading { position: relative; color: transparent !important; pointer-events: none; }
.btn.loading::after { content: ""; position: absolute; width: 16px; height: 16px; border-radius: 50%;
  border: 2px solid var(--muted); border-top-color: transparent; animation: spin .7s linear infinite; }
.btn.primary.loading::after { border-color: #fff; border-top-color: transparent; }
@keyframes spin { to { transform: rotate(360deg); } }
.actions { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.actions form { margin: 0; }

/* ---------- Flash ---------- */
.flash { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-radius: var(--r-sm); margin-bottom: 14px;
  border: 1px solid transparent; font-size: 14px; }
.flash > div { flex: 1; }
.flash form { margin: 0; }
.flash.ok { background: var(--ok-soft); color: var(--ok); }
.flash.error { background: var(--danger-soft); color: var(--danger); }
.flash.warn { background: var(--warn-soft); color: var(--warn); }
.flash > div { color: var(--text); }
.flash.compact { padding: 9px 12px; font-size: 13px; }

/* ---------- Tables ---------- */
.table-card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); overflow-x: auto; box-shadow: var(--shadow); margin-bottom: 16px; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { padding: 11px 14px; border-bottom: 1px solid var(--line); text-align: start; vertical-align: middle; }
tr:last-child td { border-bottom: 0; }
th { color: var(--muted); font-weight: 600; font-size: 12.5px; background: var(--panel2); white-space: nowrap; }
tbody tr:hover td, table tr:hover td { background: color-mix(in srgb, var(--panel2) 60%, transparent); }
tr.row-warn td { background: var(--warn-soft) !important; } tr.row-muted td { opacity: .5; }
td.neg { color: var(--danger); font-weight: 600; } td.pos { color: var(--ok); font-weight: 600; }

/* ---------- Misc ---------- */
.specs { display: grid; grid-template-columns: auto 1fr; gap: 6px 16px; margin: 0 0 16px; }
.specs dt { color: var(--muted); } .specs dd { margin: 0; }
.subnav { display: none; }
.methods { list-style: none; padding: 0; margin: 0 0 16px; display: grid; gap: 8px; }
.methods li { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--bg2); }
.methods code { margin-inline-start: auto; }
.big { font-size: 24px; font-weight: 700; }
.balance-card { display: flex; justify-content: space-between; align-items: center; gap: 12px; color: #fff;
  background: linear-gradient(135deg, #2f5bea, #5b3fe0); border-radius: var(--r); padding: 18px 22px; margin-bottom: 16px; }
.balance-card .muted { color: rgba(255,255,255,.8); }
.vnc-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.vnc-head .vps-title { flex: 0 1 auto; }
.vnc-screen { box-shadow: var(--shadow); border: 1px solid var(--line); }
.vnc-screen:fullscreen { height: 100vh !important; border: 0; border-radius: 0 !important; }
.vnc-details { margin-top: 16px; }
.vnc-details summary { cursor: pointer; font-weight: 600; }
details summary::marker { color: var(--muted); }

/* ---------- Responsive ---------- */
@media (max-width: 1180px) {
  .overview { grid-template-columns: 1fr 1fr; }
  .overview .hero { grid-column: 1 / -1; }
}
@media (max-width: 900px) {
  .side { transform: translateX(-100%); box-shadow: var(--shadow); }
  [dir="rtl"] .side { transform: translateX(100%); }
  #navtoggle:checked ~ .side { transform: none; }
  #navtoggle:checked ~ .scrim { display: block; position: fixed; inset: 0; background: rgba(2,6,23,.55); z-index: 35; }
  .shell { margin-inline-start: 0; }
  .menu-btn { display: inline-flex; }
  .topbar { padding: 10px 16px; min-height: 58px; }
  .content { padding: 18px 16px 60px; }
  .auth-wrap { grid-template-columns: 1fr; }
  .auth-art { padding: 28px; } .auth-art ul { display: none; } .auth-art p { margin: 0; }
  .auth-card { padding: 28px 22px; }
}
@media (max-width: 640px) {
  .overview { grid-template-columns: 1fr; }
  .vps-grid, .grid { grid-template-columns: 1fr; }
  .chip-balance span { display: none; } .chip-balance { padding: 0 10px; }
  .lang-btn span { display: none; }
  .specs-row { gap: 6px; padding: 12px 14px; }
  .specs-row > div { grid-template-columns: 1fr; padding: 8px; }
  .specs-row .ic { display: none; }
  .vps-head, .renew { padding-inline: 14px; } .ip-row { margin: 0 14px; } .vps > .flash { margin-inline: 14px; }
  .vps-actions { grid-template-columns: 2fr repeat(5, 1fr); padding: 12px 14px; }
  .vps-actions .btn span { display: none; }
  .vps-actions .btn { padding: 9px 0; }
  .stat { padding: 14px; } .stat b { font-size: 19px; }
  form.row.tight { flex-wrap: wrap; }
  .page-title { font-size: 17px; }
  .hero-amount { font-size: 26px; }
}

/* ---------- Reinstall ---------- */
.vps-actions .btn.wide { grid-column: 1 / -1; color: var(--muted); }
.vps-actions .btn.wide:hover { color: var(--text); }
@media (max-width: 640px) { .vps-actions .btn.wide span { display: inline; } }
.card h2 { display: flex; align-items: center; gap: 8px; }
.steps { margin: 16px 0 0; padding-inline-start: 20px; font-size: 13.5px; display: grid; gap: 4px; }
.flash .btn.sm { flex: none; }
.media-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 6px 14px; margin: 8px 0 16px; }
.media-list label { margin: 0; font-weight: 400; }
.media-list code { font-size: 12.5px; word-break: break-all; }

/* ---------- VNC toolbar (noVNC style) ---------- */
.vnc-wrap { position: relative; }
.vnc-wrap:fullscreen { background: #000; }
.vnc-wrap:fullscreen .vnc-screen { height: 100vh !important; border-radius: 0 !important; border: 0; }
.vbar { position: absolute; top: 50%; left: 10px; transform: translateY(-50%); display: flex; flex-direction: column; gap: 6px;
  padding: 8px 6px; border-radius: 12px; background: rgba(15,23,42,.82); backdrop-filter: blur(6px); box-shadow: 0 6px 24px rgba(0,0,0,.4); z-index: 5; }
.vb { width: 40px; height: 40px; display: grid; place-items: center; border-radius: 9px; border: 1px solid rgba(255,255,255,.12);
  background: rgba(255,255,255,.06); color: #e5ecf6; cursor: pointer; font: 600 18px/1 sans-serif; }
.vb:hover { background: rgba(255,255,255,.16); }
.vb.on { background: var(--accent); border-color: var(--accent); }
.vb .ic { width: 19px; height: 19px; }
.vb-min { height: 26px; font-size: 16px; }
.vbar-show { position: absolute; top: 50%; left: 0; transform: translateY(-50%); width: 18px; height: 56px; border: 0; border-radius: 0 8px 8px 0;
  background: rgba(15,23,42,.8); color: #fff; cursor: pointer; z-index: 5; }
.vpanel { position: absolute; top: 50%; left: 64px; transform: translateY(-50%); width: min(420px, calc(100% - 80px)); max-height: calc(100% - 24px); overflow: auto;
  background: var(--panel); color: var(--text); border: 1px solid var(--line2); border-radius: 14px; padding: 14px; box-shadow: 0 12px 40px rgba(0,0,0,.45); z-index: 6; }
.vpanel-h { display: flex; align-items: center; gap: 8px; font-weight: 700; margin-bottom: 6px; }
.vpanel-h .vx { margin-inline-start: auto; border: 0; background: none; color: var(--muted); font-size: 22px; cursor: pointer; line-height: 1; }
.vpanel textarea { width: 100%; resize: vertical; font: 13px/1.5 ui-monospace, Consolas, monospace; padding: 10px; border-radius: var(--r-sm);
  border: 1px solid var(--line2); background: var(--input); color: var(--text); margin: 6px 0 10px; }
.vpanel p { margin: 4px 0 8px; }
.vrow { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
.vprog { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.vprog .bar { flex: 1; }
.vpanel .vnc-details { margin-top: 10px; }
.vtoast { position: absolute; bottom: 18px; left: 50%; transform: translateX(-50%); background: rgba(15,23,42,.92); color: #fff;
  padding: 8px 14px; border-radius: 10px; font-size: 13.5px; z-index: 7; pointer-events: none; }
@media (max-width: 640px) { .vpanel { left: 58px; width: calc(100% - 66px); } .vb { width: 36px; height: 36px; } }

/* ---------- روابط إضافية تحت كارت السيرفر ---------- */
.vps-more { display: flex; flex-wrap: wrap; border-top: 1px solid var(--line); background: var(--panel2); }
.vps-more a { flex: 1 1 auto; white-space: nowrap; box-shadow: 0 -1px 0 var(--line); display: flex; align-items: center; justify-content: center; gap: 6px; padding: 10px 6px;
  font-size: 13px; color: var(--muted); text-decoration: none; white-space: nowrap; }
.vps-more a + a { border-inline-start: 1px solid var(--line); }
.vps-more a:hover { color: var(--text); background: var(--accent-soft); }
.vps-more .ic { width: 15px; height: 15px; flex: none; }
@media (max-width: 640px) { .vps-more a span { font-size: 12px; } }
@media (max-width: 380px) { .vps-more a span { display: none; } }

/* ---------- segmented control ---------- */
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: var(--r-sm); overflow: hidden; background: var(--panel); }
.seg > * { padding: 7px 13px; font-size: 13px; color: var(--muted); background: none; border: 0; cursor: pointer; text-decoration: none; font: inherit; }
.seg > * + * { border-inline-start: 1px solid var(--line); }
.seg > .on { color: var(--text); background: var(--accent-soft); font-weight: 600; }

/* ---------- رسوم الاستهلاك ---------- */
.chart-card h2 { display: flex; align-items: center; gap: 8px; }
.chart { position: relative; width: 100%; min-height: 200px; }
.chart svg { display: block; overflow: visible; }
.chart .grid { stroke: var(--line); stroke-width: 1; }
.chart .ax { fill: var(--faint); font-size: 10.5px; }
.chart .line { fill: none; stroke-width: 1.8; stroke-linejoin: round; }
.chart .area { stroke: none; opacity: .14; }
.chart svg { direction: ltr; }
.chart .line.s0 { stroke: var(--accent); } .chart .area.s0 { fill: var(--accent); } .chart .dot.s0 { background: var(--accent); }
.chart .line.s1 { stroke: var(--warn); } .chart .area.s1 { fill: var(--warn); } .chart .dot.s1 { background: var(--warn); }
.chart .cross { stroke: var(--muted); stroke-dasharray: 3 3; visibility: hidden; }
.chart .cross.on { visibility: visible; }
.chart .tip { position: absolute; top: 4px; min-width: 150px; background: var(--panel2); border: 1px solid var(--line2);
  border-radius: var(--r-sm); padding: 6px 9px; font-size: 12px; pointer-events: none; box-shadow: var(--shadow); direction: ltr; }
.chart .dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-inline-end: 4px; }
.legend { display: flex; gap: 14px; font-size: 12.5px; color: var(--muted); margin: -4px 0 8px; }
.legend span::before { content: ''; display: inline-block; width: 10px; height: 3px; border-radius: 2px; margin-inline-end: 6px; vertical-align: middle; }
.legend .lg-a::before { background: var(--accent); } .legend .lg-b::before { background: var(--warn); }

/* ---------- التذاكر ---------- */
.thread { display: flex; flex-direction: column; gap: 12px; margin-bottom: 16px; }
.msg { max-width: 760px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); padding: 12px 16px; }
.msg.staff { border-color: var(--accent); background: var(--accent-soft); margin-inline-start: auto; }
.msg-head { display: flex; justify-content: space-between; gap: 10px; margin-bottom: 6px; font-size: 13px; }
.msg-body { white-space: normal; overflow-wrap: anywhere; line-height: 1.7; }
textarea { width: 100%; font: inherit; color: var(--text); background: var(--input); border: 1px solid var(--line); border-radius: var(--r-sm); padding: 10px 12px; resize: vertical; }
.badge.tk-open, .badge.tk-customer_reply { color: var(--warn); background: var(--warn-soft); border-color: transparent; }
.badge.tk-answered { color: var(--ok); background: var(--ok-soft); border-color: transparent; }
.badge.tk-closed { color: var(--muted); }

/* ---------- كود الإحالة ---------- */
.ref-code { display: flex; align-items: center; gap: 8px; margin: 10px 0 14px; }
.ref-code code { font-size: 22px; letter-spacing: 3px; padding: 8px 14px; border: 1px dashed var(--line2); border-radius: var(--r-sm); background: var(--panel2); }

/* ---------- Organization pass: nav groups, search, ops center, tabs ---------- */
.nav-fold { margin-top: 14px; border-top: 1px solid var(--line); padding-top: 8px; }
.nav-fold summary { display: flex; align-items: center; justify-content: space-between; cursor: pointer; list-style: none; padding: 9px 10px;
  color: var(--faint); font-size: 11.5px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; border-radius: var(--r-sm); }
.nav-fold summary::-webkit-details-marker { display: none; }
.nav-fold summary:hover { color: var(--text); }
.nav-fold summary .ic { width: 15px; height: 15px; transition: transform .2s; }
.nav-fold[open] summary .ic { transform: rotate(180deg); }

.gsearch { position: relative; display: flex; align-items: center; width: min(330px, 32vw); margin: 0; }
.gsearch .ic { position: absolute; inset-inline-start: 11px; width: 16px; height: 16px; color: var(--faint); pointer-events: none; }
.gsearch input { width: 100%; height: 38px; margin: 0; padding: 0 12px; padding-inline-start: 34px; border-radius: var(--r-sm);
  border: 1px solid var(--line); background: var(--input); color: var(--text); font: inherit; font-size: 13.5px; }
.gsearch input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
@media (max-width: 900px) {
  .topbar { flex-wrap: wrap; }
  .gsearch { order: 9; width: 100%; flex: 1 0 100%; }
}

.attn-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(185px, 1fr)); gap: 12px; margin-bottom: 18px; }
.attn { position: relative; display: flex; flex-direction: column; gap: 3px; padding: 14px 16px; background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--r); color: var(--text); box-shadow: var(--shadow); transition: border-color .15s, transform .15s; }
.attn:hover { text-decoration: none; border-color: var(--line2); transform: translateY(-1px); }
.attn small { color: var(--muted); font-size: 13px; padding-inline-end: 38px; }
.attn b { font-size: 27px; line-height: 1.25; }
.attn em { font-style: normal; font-size: 12px; color: var(--faint); }
.attn .stat-ic { position: absolute; inset-inline-end: 12px; top: 12px; }
.attn.todo { border-color: color-mix(in srgb, var(--warn) 50%, var(--line)); background: color-mix(in srgb, var(--warn-soft) 55%, var(--panel)); }
.attn.todo b { color: var(--warn); }
.attn.bad { border-color: color-mix(in srgb, var(--danger) 50%, var(--line)); background: color-mix(in srgb, var(--danger-soft) 55%, var(--panel)); }
.attn.bad b { color: var(--danger); }
.attn.fine b { color: var(--ok); }

.sys-grid { display: grid; grid-template-columns: 1.1fr 1fr; gap: 16px; margin-bottom: 18px; align-items: start; }
.sys-grid > .card { margin-bottom: 0; }
@media (max-width: 900px) { .sys-grid { grid-template-columns: 1fr; } }
.kv { display: flex; align-items: center; gap: 10px; padding: 9px 0; border-bottom: 1px dashed var(--line); font-size: 14px; }
.kv:last-of-type { border-bottom: 0; }
.kv > span:first-of-type { flex: 1; min-width: 0; }
.led { width: 9px; height: 9px; border-radius: 50%; background: var(--faint); flex: none; }
.led.ok { background: var(--ok); } .led.bad { background: var(--danger); } .led.warn { background: var(--warn); }
.feed { list-style: none; margin: 0; padding: 0; }
.feed li { display: flex; gap: 10px; padding: 8px 0; border-bottom: 1px dashed var(--line); font-size: 13.5px; align-items: baseline; }
.feed li:last-child { border-bottom: 0; }
.feed time { color: var(--faint); font-size: 12px; white-space: nowrap; }
.feed .bad { color: var(--danger); }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 8px; }
.card-head h2 { margin: 0; }
.quick { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 18px; }

.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 18px; overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tab { position: relative; display: inline-flex; align-items: center; gap: 7px; padding: 11px 16px; background: none; border: 0; border-radius: 0;
  color: var(--muted); font: inherit; font-weight: 600; font-size: 14px; cursor: pointer; white-space: nowrap; }
.tab:hover { color: var(--text); }
.tab.on { color: var(--accent); }
.tab.on::after { content: ""; position: absolute; inset-inline: 10px; bottom: -1px; height: 2px; background: var(--accent); border-radius: 2px; }
.tab small { background: var(--bg2); color: var(--muted); border-radius: 20px; padding: 0 7px; font-size: 11.5px; line-height: 19px; font-weight: 600; }
.tab small.hot { background: var(--danger); color: #fff; }

.cust-head { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--r); padding: 18px 20px; margin-bottom: 18px; box-shadow: var(--shadow); }
.cust-id { display: flex; align-items: center; gap: 14px; flex: 1; min-width: 240px; }
.avatar.lg { width: 52px; height: 52px; font-size: 21px; }
.cust-id h1 { margin: 0; font-size: 20px; }
.cust-id small { color: var(--muted); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.chip { display: inline-flex; align-items: center; gap: 5px; padding: 2px 9px; border-radius: 20px; font-size: 12px; font-weight: 600;
  background: var(--bg2); color: var(--muted); border: 1px solid var(--line); }
.chip.ok { color: var(--ok); background: var(--ok-soft); border-color: transparent; }
.chip.bad { color: var(--danger); background: var(--danger-soft); border-color: transparent; }
.cust-bal { text-align: center; padding-inline: 10px; }
.cust-bal small { display: block; color: var(--muted); font-size: 12.5px; }
.cust-bal b { font-size: 24px; white-space: nowrap; }
details.fold { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); padding: 14px 18px; margin-bottom: 16px; box-shadow: var(--shadow); }
details.fold > summary { cursor: pointer; font-weight: 600; list-style: none; display: flex; align-items: center; gap: 8px; }
details.fold > summary::-webkit-details-marker { display: none; }
details.fold[open] > summary { margin-bottom: 14px; }
.filters { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 14px; }
.filters .seg { flex-wrap: wrap; }
.sr-title { display: flex; align-items: center; gap: 8px; margin: 22px 0 10px; }
.sr-title small { color: var(--muted); }
.savebar { margin-top: 4px; margin-bottom: 18px; }
.card.narrow.left { max-width: 640px; margin-inline: 0; }
kbd { display: inline-block; padding: 0 6px; border: 1px solid var(--line2); border-bottom-width: 2px; border-radius: 5px; background: var(--bg2); font: 12px/18px ui-monospace, monospace; }
@media (max-width: 640px) {
  .card-head { flex-wrap: wrap; }
  .card-head .quick { width: 100%; margin-bottom: 0; }
  .card-head .quick > * { flex: 1; }
  .card-head .quick .btn { width: 100%; }
  .attn-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
  .attn { padding: 12px 13px; }
  .attn .stat-ic { position: static; margin-bottom: 4px; }
  .attn small { padding-inline-end: 0; font-size: 12.5px; }
  .attn b { font-size: 23px; }
  .overview.admin { grid-template-columns: 1fr 1fr; gap: 10px; }
  .overview.admin .stat { padding: 12px; gap: 10px; }
  .cust-head { padding: 14px; }
  .cust-bal { text-align: start; padding-inline: 0; }
}
@media (max-width: 640px) {
  .overview.admin { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .overview.admin .stat b { font-size: 19px; white-space: nowrap; }
  .attn-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* ---------- Panels page ---------- */
.toolbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 16px; }
.toolbar form { margin: 0; }
.fgrid { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 14px 18px; margin-bottom: 4px; }
.fgrid label { margin: 0; }
.fgrid label small { display: block; margin-top: 5px; font-weight: 400; }
.fgrid .span { grid-column: 1 / -1; }
.card-foot { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; justify-content: space-between; margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--line); }
.card-foot form { margin: 0; }
tr.grp td, tr.grp:hover td { background: var(--panel2); color: var(--muted); font-weight: 600; font-size: 13px; padding: 8px 14px; }
.grp-in { display: flex; flex-wrap: wrap; gap: 4px 16px; align-items: center; }
.grp-in b { color: var(--text); font-size: 14px; }
.grp-in span { font-weight: 400; }
td.num { white-space: nowrap; }
td.num b { font-size: 16px; }
.sub { display: block; margin-top: 2px; }
.fail-msg { display: block; max-width: 260px; margin-top: 4px; line-height: 1.5; overflow-wrap: anywhere; text-align: start; }
td.acts { width: 1%; white-space: nowrap; }
td.acts .actions { flex-wrap: nowrap; }
@media (max-width: 640px) {
  .hide-sm { display: none; }
  .ptable, .ptable tbody, .ptable tr, .ptable td { display: block; }
  .ptable tr.hdr, .ptable td.hide-sm { display: none; }
  .ptable tr.prow td { min-width: 0; }
  .ptable tr.grp td { border: 0; }
  .ptable tr.prow { display: grid; grid-template-columns: 1fr auto; grid-template-areas: "name stat" "num stat" "acts acts"; gap: 4px 12px; padding: 12px 14px; border-bottom: 1px solid var(--line); }
  .ptable tr.prow td { border: 0; padding: 0; background: none !important; }
  .ptable td.pname { grid-area: name; font-size: 15px; }
  .ptable td.num { grid-area: num; }
  .ptable td.num .sub { display: inline; margin-inline-start: 6px; }
  .ptable td.pstat { grid-area: stat; text-align: end; }
  .ptable td.pstat .fail-msg { max-width: 150px; }
  .ptable td.acts { grid-area: acts; width: auto; margin-top: 8px; }
  .ptable td.acts .actions { flex-wrap: wrap; }
  .ptable td.acts .btn { flex: 1; }
  .ptable td.acts form { flex: 1; display: flex; }
  .ptable tr.row-warn { background: var(--warn-soft); }
}

/* ---------- Brand logo image ---------- */
.brand.has-img { padding: 14px 16px; }
.logo-img { display: inline-flex; align-items: center; justify-content: center; padding: 8px 14px; border-radius: 12px;
  background: #0b1120; border: 1px solid var(--line); max-width: 100%; }
.logo-img img { display: block; height: 38px; width: auto; max-width: 100%; }
.auth-top .brand.has-img { padding: 0; }
.auth-top .logo-img img { height: 32px; }
.auth-art .logo-img.big { background: none; border: 0; padding: 0; }
.auth-art .logo-img.big img { height: 78px; }
.auth-art .logo-img.big + p { margin-top: 18px; }

/* ==========================================================================
   Silkroad4Arab Portal — UI/UX Modernization & Responsive Polish
   ========================================================================== */

:root {
  --bg: #0b0f19;
  --bg2: #111827;
  --panel: #131b2c;
  --panel2: #1a2438;
  --line: rgba(148, 163, 184, 0.13);
  --line2: rgba(148, 163, 184, 0.24);
  --text: #f1f5f9;
  --muted: #94a3b8;
  --faint: #64748b;
  --accent: #4f7cff;
  --accent2: #7c5cff;
  --accent-soft: rgba(79, 124, 255, 0.16);
  --input: #0e1422;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.35), 0 8px 24px rgba(0, 0, 0, 0.28);
  --r: 14px;
  --r-sm: 10px;
}

:root[data-theme="light"] {
  --bg: #f5f7fb;
  --bg2: #eef2f8;
  --panel: #ffffff;
  --panel2: #f8fafd;
  --line: #e5eaf3;
  --line2: #cfd8e8;
  --text: #0f172a;
  --muted: #52627d;
  --faint: #8a99b3;
  --accent: #3b6cf6;
  --accent2: #6d4aff;
  --accent-soft: rgba(59, 108, 246, 0.11);
  --input: #ffffff;
  --shadow: 0 1px 2px rgba(15, 23, 42, 0.04), 0 6px 20px rgba(15, 23, 42, 0.055);
}

@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    --bg: #f5f7fb;
    --bg2: #eef2f8;
    --panel: #ffffff;
    --panel2: #f8fafd;
    --line: #e5eaf3;
    --line2: #cfd8e8;
    --text: #0f172a;
    --muted: #52627d;
    --faint: #8a99b3;
    --accent: #3b6cf6;
    --accent2: #6d4aff;
    --accent-soft: rgba(59, 108, 246, 0.11);
    --input: #ffffff;
    --shadow: 0 1px 2px rgba(15, 23, 42, 0.04), 0 6px 20px rgba(15, 23, 42, 0.055);
  }
}

html, body { overflow-x: clip; }
.shell, .content { min-width: 0; }

/* Frosted glass sticky topbar */
.topbar {
  position: sticky;
  top: 0;
  z-index: 25;
  background: color-mix(in srgb, var(--panel) 84%, transparent);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}

/* Elevated sidebar polish */
.side {
  background: var(--panel);
  border-inline-end: 1px solid var(--line);
}
.side nav a {
  border-radius: 10px;
  font-weight: 500;
  transition: background 0.15s ease, color 0.15s ease, transform 0.12s ease;
}
.side nav a.on,
.side nav a.active {
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 600;
}

/* Fix broken <select> height & caret wrapping across all pages */
select {
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  min-height: 42px;
  line-height: 1.35;
  padding: 9px 14px;
  padding-inline-end: 38px;
  cursor: pointer;
  background-color: var(--input);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 15px 15px;
}
[dir="rtl"] select {
  background-position: left 12px center;
}
form.row.tight select {
  min-height: 36px;
  padding: 6px 10px;
  padding-inline-end: 32px;
}
input:not([type=checkbox]):not([type=radio]):not([type=file]), textarea {
  min-height: 42px;
}
form.row.tight input {
  min-height: 36px;
}

/* Fix wasted empty column on topup.php & tickets.php */
.grid {
  grid-template-columns: repeat(auto-fit, minmax(340px, 1fr));
  align-items: start;
}

/* Refined cards & subtle hover elevation */
.card {
  border: 1px solid var(--line);
  border-radius: var(--r);
  padding: 22px;
  transition: border-color 0.18s ease, box-shadow 0.18s ease;
}
.stat {
  min-width: 0;
  border: 1px solid var(--line);
  transition: border-color 0.18s ease, transform 0.18s ease, box-shadow 0.18s ease;
}
.stat:hover {
  border-color: var(--line2);
}
.stat b {
  white-space: normal;
  overflow-wrap: anywhere;
}
.hero {
  background: linear-gradient(135deg, #3b6cf6 0%, #6d4aff 55%, #8b5cf6 100%);
  box-shadow: 0 12px 32px rgba(79, 124, 255, 0.28);
}

/* Refined 5-card Needs Action grid on Overview */
.attn-grid {
  grid-template-columns: repeat(auto-fit, minmax(175px, 1fr));
  gap: 12px;
}

/* Refined Tabs bar */
.tabs {
  gap: 6px;
  padding-bottom: 2px;
  border-bottom: 1px solid var(--line);
  -webkit-overflow-scrolling: touch;
}
.tab {
  border-radius: 10px 10px 0 0;
  padding: 10px 15px;
  transition: color 0.15s ease, background 0.15s ease;
}
.tab:hover {
  background: color-mix(in srgb, var(--panel2) 70%, transparent);
}
.tab.on {
  background: color-mix(in srgb, var(--accent-soft) 55%, transparent);
}
.tab.on::after {
  inset-inline: 8px;
  height: 2.5px;
}

/* Refined Tables — prevent clipping on desktop */
.table-card {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
th {
  letter-spacing: 0.01em;
  padding: 12px 14px;
}
td {
  padding: 12px 14px;
}

/* Refined Buttons */
.btn {
  border-radius: 10px;
  min-height: 38px;
}
.btn.sm {
  min-height: 31px;
  border-radius: 8px;
  padding: 5px 11px;
  font-size: 12.5px;
}
.btn.primary {
  background: linear-gradient(135deg, var(--accent) 0%, #4368f5 100%);
  border-color: transparent;
  box-shadow: 0 4px 14px rgba(59, 108, 246, 0.28);
}

/* Backups interactive note/public links -> readable pill controls */
.bk-note-ed > summary,
.bk-table button.link-like,
.bk-table a.bk-act {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 9px;
  border-radius: 7px;
  background: var(--bg2);
  border: 1px solid var(--line);
  color: var(--text) !important;
  font-size: 12px;
  font-weight: 500;
  transition: border-color 0.15s ease, background 0.15s ease;
}
.bk-note-ed > summary:hover {
  border-color: var(--accent);
  color: var(--accent) !important;
}

/* Storage Box unified toolbar */
.sbx-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin: 0 0 14px;
  padding: 10px 12px;
  background: var(--panel2);
  border: 1px solid var(--line);
  border-radius: 12px;
}
.sbx-bar input[type=search] {
  flex: 1 1 220px;
  min-width: 160px;
  margin: 0;
  min-height: 36px;
  padding: 6px 12px;
}
.sbx-bar .btn,
.sbx-bar label.btn {
  margin: 0;
  min-height: 36px;
}
.sbx-bar details.sbx-more {
  margin: 0;
}
.sbx-bar details.sbx-more[open] {
  flex: 1 0 100%;
  margin-top: 6px;
  padding-top: 8px;
  border-top: 1px dashed var(--line);
}

/* Mobile Sidebar & Overflow Hard Fix */
@media (max-width: 900px) {
  .side {
    transform: translateX(-105%);
    visibility: hidden;
    pointer-events: none;
    transition: transform 0.24s ease, visibility 0.24s ease;
  }
  [dir="rtl"] .side {
    transform: translateX(105%);
  }
  #navtoggle:checked ~ .side {
    transform: translateX(0);
    visibility: visible;
    pointer-events: auto;
  }
  .shell {
    margin-inline-start: 0 !important;
    width: 100%;
    max-width: 100vw;
  }
}

@media (max-width: 640px) {
  .content {
    padding: 14px 12px 56px;
  }
  .card {
    padding: 15px 14px;
  }
  .overview.admin {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }
  .overview.admin .stat {
    padding: 12px;
    gap: 8px;
    min-width: 0;
  }
  .overview.admin .stat b {
    font-size: clamp(14px, 4vw, 18px);
    white-space: normal;
    line-height: 1.3;
  }
  .overview.admin .stat-ic {
    width: 34px;
    height: 34px;
    border-radius: 10px;
  }
  .tabs {
    margin-inline: -4px;
    padding-inline: 4px;
  }
  .tab {
    padding: 9px 12px;
    font-size: 13px;
  }
  .sbx-bar {
    padding: 10px;
  }
  .sbx-bar input[type=search] {
    flex: 1 0 100%;
  }
}

/* Tighten select height & suppress Chromium picker-icon line break */
select { height: 42px; max-height: 42px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
form.row.tight select { height: 36px; max-height: 36px; }
select::picker-icon { display: none !important; }

/* ==========================================================================
   Backups Hub — Comprehensive Operations Center Layout
   ========================================================================== */
.bk-dest-bar {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 18px;
}
.bk-dest-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 13px 16px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: var(--shadow);
  min-width: 0;
  transition: border-color 0.16s ease, transform 0.14s ease;
}
.bk-dest-card:hover {
  border-color: var(--line2);
}
.bk-dest-left {
  display: flex;
  align-items: center;
  gap: 11px;
  min-width: 0;
}
.bk-dest-left > div {
  min-width: 0;
}
.bk-dest-left b {
  display: block;
  font-size: 13.5px;
  line-height: 1.3;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.bk-dest-left small {
  display: block;
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Categorized Backups Hub Navigation */
.bk-hub-nav {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 18px;
  padding: 10px 14px;
  margin-bottom: 18px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: var(--shadow);
}
.bk-nav-grp {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
}
.bk-nav-lbl {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--faint);
  padding-inline: 4px 6px;
}
.bk-nav-sep {
  width: 1px;
  height: 26px;
  background: var(--line2);
}
.bk-hub-nav .tab {
  border-radius: 9px;
  padding: 7px 12px;
  font-size: 13.5px;
  border: 1px solid transparent;
}
.bk-hub-nav .tab:hover {
  background: var(--panel2);
  border-color: var(--line);
}
.bk-hub-nav .tab.on {
  background: var(--accent-soft);
  border-color: color-mix(in srgb, var(--accent) 45%, transparent);
  color: var(--accent);
}
.bk-hub-nav .tab.on::after {
  display: none;
}

/* Settings 2-column organized layout */
.bk-settings-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  align-items: start;
}
.bk-settings-grid > .card {
  margin-bottom: 0;
}

/* ISO 2-column top layout */
.bk-iso-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(360px, 1fr));
  gap: 16px;
  margin-bottom: 16px;
  align-items: start;
}
.bk-iso-grid > .card {
  margin-bottom: 0;
}

/* Collapsible templates card inside Saved Backups */
.bk-tpl-fold {
  margin-bottom: 16px;
}
.bk-tpl-fold > summary {
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
}
.bk-tpl-fold .bk-tpl-title {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

/* Low disk space pill on ISO hosts */
.bk-space-low {
  color: var(--danger);
  font-weight: 700;
}

@media (max-width: 980px) {
  .bk-dest-bar {
    grid-template-columns: 1fr;
  }
  .bk-settings-grid {
    grid-template-columns: 1fr;
  }
  .bk-nav-sep {
    display: none;
  }
}
@media (max-width: 640px) {
  .bk-hub-nav {
    padding: 10px;
    gap: 8px;
  }
  .bk-nav-lbl {
    width: 100%;
    padding: 2px 2px 0;
  }
  .bk-hub-nav .tab {
    padding: 6px 10px;
    font-size: 12.5px;
  }
  .bk-iso-grid {
    grid-template-columns: 1fr;
  }
}
/* Final RTL/Desktop micro-polish for Backups Hub */
.stat em span { white-space: nowrap; }
.bk-hub-nav {
  flex-direction: column;
  align-items: stretch;
  gap: 8px;
  padding: 12px 16px;
}
.bk-nav-sep {
  width: 100%;
  height: 1px;
  background: var(--line);
}
.bk-nav-lbl {
  min-width: 92px;
}

/* Dashboard welcome card & ticket screenshot thumbnails */
.dash-welcome{display:flex;align-items:flex-start;gap:16px;padding:24px}
.dash-welcome h3{margin:0;font-size:17px}
.tk-att{margin-top:10px}
.tk-att img{max-width:340px;max-height:240px;width:auto;height:auto;border-radius:10px;border:1px solid var(--line2);display:block;transition:transform .15s ease}
.tk-att img:hover{transform:scale(1.02)}
@media(max-width:640px){.dash-welcome{flex-direction:column;gap:12px}.tk-att img{max-width:100%}}

/* Audit polish: wrap long log/URL text in tables & prevent clipping on 1280px */
.table-card { max-width: 100%; overflow-x: auto; }
.table-card td { overflow-wrap: anywhere; }
.table-card td.num, .table-card td.st, .table-card td.acts, .table-card th { overflow-wrap: normal; }
@media (max-width: 1360px) { .table-card th, .table-card td { padding: 9px 10px; font-size: 13.5px; } }
