/* ============================================================
   UnlockServiceTool Panel Theme — white + orange
   ============================================================ */
:root {
  --bg: #ffffff;
  --bg-soft: #f1f3f9;
  --surface: #ffffff;
  --surface-2: #f8fafc;
  --border: rgba(15, 23, 42, .10);
  --border-soft: rgba(15, 23, 42, .06);
  --text: #0f172a;
  --text-muted: #64748b;
  --text-dim: #94a3b8;
  --primary: #FF6B35;
  --primary-2: #E85A2B;
  --primary-dark: #E85A2B;
  --primary-soft: rgba(255, 107, 53, .12);
  --cyan: #00D4FF;
  --cyan-soft: rgba(0, 212, 255, .12);
  --green: #10B981;
  --green-soft: rgba(16, 185, 129, .12);
  --orange: #FF6B35;
  --orange-soft: rgba(255, 107, 53, .12);
  --red: #ef4444;
  --red-soft: rgba(239, 68, 68, .10);
  --purple: #00D4FF;
  --purple-soft: rgba(0, 212, 255, .12);
  --pink: #ec4899;
  --yellow: #F59E0B;
  --radius: 14px;
  --radius-sm: 10px;
  --radius-lg: 22px;
  --sidebar-w: 260px;
  --shadow: 0 4px 24px rgba(15, 23, 42, .10);
  --shadow-sm: 0 4px 18px rgba(15, 23, 42, .08);
  --glow: 0 0 32px rgba(255, 107, 53, .25);
  --glow-accent: 0 0 32px rgba(0, 212, 255, .18);
  --glass-bg: #ffffff;
  --glass-border: rgba(15, 23, 42, .10);
  --glass-blur: 24px;
  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-heading: 'Space Grotesk', 'Inter', sans-serif;
}
* { margin: 0; padding: 0; box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--font);
  background:
    radial-gradient(1200px 700px at 85% -10%, rgba(255, 107, 53, .08), transparent 60%),
    radial-gradient(900px 550px at 5% 115%, rgba(0, 212, 255, .07), transparent 60%),
    var(--bg);
  background-attachment: fixed;
  color: var(--text);
  font-size: 14px;
  line-height: 1.6;
  min-height: 100vh;
}
h1, h2, h3, h4, .brand-name, .stat-value, .page-head h1, .card-title, .modal-head h3 { font-family: var(--font-heading); letter-spacing: -.3px; }
::-webkit-scrollbar { width: 9px; height: 9px; }
::-webkit-scrollbar-track { background: var(--bg-soft); }
::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 10px; }
::-webkit-scrollbar-thumb:hover { background: var(--primary); }
a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--primary-dark); }
img { max-width: 100%; }
::selection { background: var(--primary); color: #fff; }

/* ---------- Layout ---------- */
.layout { display: flex; min-height: 100vh; }
.sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  background: linear-gradient(180deg, var(--surface), var(--bg-soft));
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  transition: margin .3s ease;
  z-index: 50;
}
.sidebar.collapsed { margin-left: calc(-1 * var(--sidebar-w)); }
.sidebar-overlay {
  position: fixed; inset: 0; z-index: 79;
  background: rgba(4, 8, 16, .5); backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
  opacity: 0; pointer-events: none; transition: opacity .3s ease;
}
.sidebar-overlay.show { opacity: 1; pointer-events: auto; }
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.brand {
  display: flex; align-items: center; gap: 12px;
  padding: 20px 22px;
  border-bottom: 1px solid var(--border);
}
.brand-logo {
  width: 40px; height: 40px; border-radius: 12px;
  background: linear-gradient(135deg, var(--primary), var(--cyan));
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: 18px; font-weight: 800;
  box-shadow: var(--glow);
  flex-shrink: 0;
}
.brand-name { font-weight: 800; font-size: 15px; letter-spacing: -.2px; line-height: 1.2; font-family: var(--font-heading); color: var(--text); }
.brand-sub { font-size: 11px; color: var(--text-muted); }
.brand-role {
  display: inline-block; margin-top: 4px;
  font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .6px;
  padding: 2px 8px; border-radius: 100px;
}
.brand-role.admin { background: var(--red-soft); color: var(--red); }
.brand-role.reseller { background: var(--orange-soft); color: var(--orange); }
.brand-role.user { background: var(--green-soft); color: var(--green); }

.nav { flex: 1; overflow-y: auto; padding: 14px 12px; }
.nav-label {
  font-size: 10px; font-weight: 700; text-transform: uppercase;
  letter-spacing: 1px; color: var(--text-dim);
  padding: 14px 12px 8px;
}
.nav-link {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 12px; margin-bottom: 2px;
  border-radius: var(--radius-sm);
  color: var(--text-muted); font-weight: 500; font-size: 13px;
  transition: all .2s; border: 1px solid transparent;
}
.nav-link i { width: 18px; text-align: center; font-size: 15px; }
.nav-link:hover { color: var(--text); background: var(--surface-2); }
.nav-link.active {
  color: #fff; background: linear-gradient(135deg, var(--primary), var(--primary-2));
  box-shadow: 0 6px 20px rgba(255, 107, 53, .25);
}
.nav-link.active i { color: #fff; }
.nav-badge {
  margin-left: auto; font-size: 10px; font-weight: 700;
  padding: 2px 8px; border-radius: 100px;
  background: var(--orange-soft); color: var(--orange);
}
.sidebar-foot {
  padding: 16px 20px; border-top: 1px solid var(--border);
  font-size: 11px; color: var(--text-dim);
}

/* ---------- Topbar ---------- */
.topbar {
  height: 64px;
  display: flex; align-items: center; gap: 16px;
  padding: 0 24px;
  background: rgba(255, 255, 255, .85);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 40;
}
.toggle-btn {
  width: 38px; height: 38px; border-radius: 10px;
  background: var(--surface-2); border: 1px solid var(--border);
  color: var(--text); cursor: pointer; font-size: 16px;
  transition: all .2s; display: flex; align-items: center; justify-content: center;
}
.toggle-btn:hover { border-color: var(--primary); color: var(--primary); }
.page-title { font-size: 16px; font-weight: 700; color: var(--text); }
.page-crumb { font-size: 12px; color: var(--text-muted); }
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 12px; }
.balance-chip {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 14px; border-radius: 100px;
  background: linear-gradient(135deg, rgba(255,107,53,.12), rgba(0,212,255,.08));
  border: 1px solid rgba(255,107,53,.3);
  font-weight: 700; font-size: 13px; color: #ff6b35;
}
.balance-chip i { color: var(--yellow); }
.user-chip {
  display: flex; align-items: center; gap: 10px;
  padding: 6px 12px 6px 6px; border-radius: 100px;
  background: var(--surface-2); border: 1px solid var(--border);
  cursor: pointer; transition: all .2s;
}
.user-chip:hover { border-color: var(--primary); }
.user-avatar {
  width: 32px; height: 32px; border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--cyan));
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: 13px; font-weight: 800;
}
.user-chip-name { font-weight: 600; font-size: 13px; line-height: 1.2; color: var(--text); }
.user-chip-role { font-size: 10px; color: var(--text-muted); }
.user-menu {
  position: absolute; top: 54px; right: 24px; width: 210px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 8px; z-index: 60;
}
.user-menu a {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px; border-radius: var(--radius-sm);
  color: var(--text); font-size: 13px; transition: all .15s;
}
.user-menu a:hover { background: var(--surface-2); color: var(--primary); }
.user-menu a.danger:hover { color: var(--red); background: var(--red-soft); }

/* ---------- Content ---------- */
.content { padding: 24px; flex: 1; }
.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 22px; flex-wrap: wrap; }
.page-head h1 { font-size: 22px; font-weight: 800; letter-spacing: -.4px; color: var(--text); }
.page-head p { color: var(--text-muted); font-size: 13px; margin-top: 4px; }

/* ---------- Cards & stats ---------- */
.card {
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  padding: 20px;
  box-shadow: var(--shadow-sm);
}
.card-title { font-size: 15px; font-weight: 700; margin-bottom: 16px; display: flex; align-items: center; gap: 8px; color: var(--text); }
.card-title i { color: var(--primary); }

.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; margin-bottom: 20px; }
.stat {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 13px 15px;
  position: relative; overflow: hidden;
  display: grid;
  grid-template-columns: auto 1fr;
  grid-template-areas: "icon value" "icon label" "icon sub";
  column-gap: 12px;
  row-gap: 1px;
  align-items: center;
  transition: transform .2s, border-color .2s, box-shadow .2s;
}
.stat:hover { transform: translateY(-2px); border-color: var(--primary); box-shadow: var(--shadow-sm); }
.stat::after {
  content: ''; position: absolute; top: -45%; right: -35%;
  width: 140px; height: 140px; border-radius: 50%;
  background: radial-gradient(circle, var(--stat-glow, rgba(255,107,53,.10)), transparent 70%);
  pointer-events: none;
}
.stat-icon {
  grid-area: icon;
  width: 40px; height: 40px; border-radius: 11px;
  display: flex; align-items: center; justify-content: center; font-size: 15px;
}
.stat-icon.blue { background: var(--primary-soft); color: var(--primary); }
.stat-icon.green { background: var(--green-soft); color: var(--green); }
.stat-icon.orange { background: var(--orange-soft); color: var(--orange); }
.stat-icon.red { background: var(--red-soft); color: var(--red); }
.stat-icon.purple { background: var(--purple-soft); color: var(--purple); }
.stat-icon.pink { background: rgba(236,72,153,.10); color: var(--pink); }
.stat-icon.cyan { background: var(--cyan-soft); color: var(--cyan); }
.stat-value { grid-area: value; font-size: 20px; font-weight: 800; letter-spacing: -.4px; line-height: 1.15; color: var(--text); white-space: nowrap; }
.stat-label { grid-area: label; color: var(--text-muted); font-size: 10.5px; text-transform: uppercase; letter-spacing: .5px; font-weight: 700; }
.stat-sub { grid-area: sub; font-size: 10.5px; color: var(--text-dim); }

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.grid-3 { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 16px; }
.mb-16 { margin-bottom: 16px; }
.mb-24 { margin-bottom: 24px; }
.mt-16 { margin-top: 16px; }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; border-radius: var(--radius); }
table { width: 100%; border-collapse: collapse; }
thead th {
  text-align: left; padding: 12px 16px;
  font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .8px;
  color: var(--text-dim);
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
tbody td {
  padding: 13px 16px;
  border-bottom: 1px solid var(--border-soft);
  font-size: 13px;
  vertical-align: middle;
  color: var(--text-2, var(--text));
}
tbody tr { transition: background .15s; }
tbody tr:hover { background: rgba(255, 107, 53, .04); }
tbody tr:last-child td { border-bottom: 0; }
.tbl-name { font-weight: 600; }
.tbl-sub { font-size: 12px; color: var(--text-muted); }

/* ---------- Badges ---------- */
.badge {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 12px; border-radius: 100px;
  font-size: 11px; font-weight: 700; letter-spacing: .3px; white-space: nowrap;
}
.badge i { font-size: 6px; }
.badge.green { background: var(--green-soft); color: var(--green); }
.badge.green i { color: var(--green); animation: pulse 1.8s infinite; }
.badge.red { background: var(--red-soft); color: var(--red); }
.badge.orange { background: var(--orange-soft); color: var(--orange); }
.badge.blue { background: var(--primary-soft); color: var(--primary); }
.badge.purple { background: var(--purple-soft); color: var(--purple); }
.badge.gray { background: rgba(132,150,184,.12); color: var(--text-muted); }
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: .3; } }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 9px 18px; border-radius: var(--radius-sm);
  font-weight: 600; font-size: 13px; border: 1px solid transparent;
  cursor: pointer; transition: all .2s; white-space: nowrap; line-height: 1.4;
}
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary { background: linear-gradient(135deg, #FF6B35, #E85A2B); color: #fff; border: none; border-radius: 12px; padding: 12px 24px; box-shadow: 0 4px 18px rgba(255, 107, 53, .25); }
.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 8px 30px rgba(255, 107, 53, .35); color: #fff; }
.btn-outline { background: transparent; border-color: rgba(15, 23, 42, .18); color: var(--text-muted); }
.btn-outline:hover { border-color: var(--primary); color: var(--primary); }
.btn-danger { background: var(--red-soft); color: var(--red); }
.btn-danger:hover { background: var(--red); color: #fff; }
.btn-success { background: var(--green-soft); color: var(--green); }
.btn-success:hover { background: var(--green); color: #fff; }
.btn-ghost { background: transparent; color: var(--text-muted); }
.btn-ghost:hover { background: var(--surface-2); color: var(--text); }
.btn-sm { height: 32px; padding: 0 14px; display: inline-flex; align-items: center; gap: 6px; font-size: 12px; }
.btn-block { width: 100%; justify-content: center; }

/* ---------- Forms ---------- */
.form-group { margin-bottom: 16px; }
.form-label { display: block; font-size: 12px; font-weight: 600; color: var(--text-muted); margin-bottom: 7px; letter-spacing: .2px; }
.form-control {
  width: 100%; padding: 10px 14px;
  background: var(--bg-soft); border: 1px solid var(--border);
  border-radius: var(--radius-sm); color: var(--text);
  font-size: 13px; font-family: var(--font); transition: all .2s;
}
.form-control:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(255,107,53,.12); }
.form-control::placeholder { color: var(--text-dim); }
textarea.form-control { resize: vertical; min-height: 90px; }
select.form-control { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%2364748b' viewBox='0 0 16 16'%3E%3Cpath d='M8 11L3 6h10l-5 5z'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 14px center; padding-right: 36px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form-hint { font-size: 11px; color: var(--text-dim); margin-top: 5px; }
.input-group { display: flex; gap: 0; }
.input-group .form-control { border-radius: var(--radius-sm) 0 0 var(--radius-sm); }
.input-group .btn { border-radius: 0 var(--radius-sm) var(--radius-sm) 0; }
.checkbox {
  display: inline-flex; align-items: center; gap: 9px;
  font-size: 13px; cursor: pointer; color: var(--text-muted);
}
.checkbox input { accent-color: var(--primary); width: 16px; height: 16px; }

/* ---------- Alerts ---------- */
.alert {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 13px 16px; border-radius: var(--radius-sm);
  font-size: 13px; margin-bottom: 16px; border: 1px solid;
}
.alert-success { background: var(--green-soft); border-color: rgba(16,185,129,.25); color: #047857; }
.alert-error { background: var(--red-soft); border-color: rgba(239,68,68,.25); color: #dc2626; }
.alert-warning { background: var(--orange-soft); border-color: rgba(255,107,53,.25); color: #b45309; }
.alert-info { background: var(--primary-soft); border-color: rgba(255,107,53,.25); color: var(--primary); }

/* ---------- Modal ---------- */
.modal {
  position: fixed; inset: 0; z-index: 100;
  display: none; align-items: center; justify-content: center; padding: 20px;
}
.modal.open { display: flex; }
.modal-overlay {
  position: absolute; inset: 0;
  background: rgba(4, 8, 16, .55); backdrop-filter: blur(8px);
}
.modal-box {
  position: relative; background: #ffffff;
  border: 1px solid var(--border); border-radius: var(--radius-lg);
  width: 100%; max-width: 520px; max-height: 90vh; overflow-y: auto;
  box-shadow: var(--shadow);
  animation: modalIn .25s ease;
}
.modal-box.modal-wide { max-width: 860px; }
@keyframes modalIn { from { opacity: 0; transform: translateY(12px) scale(.98); } to { opacity: 1; transform: none; } }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 18px 22px; border-bottom: 1px solid var(--border); }
.modal-head h3, .modal-head span { font-size: 16px; font-weight: 700; color: var(--text); font-family: var(--font-heading); }
.modal-x, .modal-close { background: none; border: 0; color: var(--text-muted); font-size: 20px; cursor: pointer; padding: 4px; line-height: 1; }
.modal-x:hover, .modal-close:hover { color: var(--red); }
.modal-body { padding: 22px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 10px; padding: 16px 22px; border-top: 1px solid var(--border); }

/* ---------- Pagination ---------- */
.pagination { display: flex; gap: 6px; align-items: center; justify-content: flex-end; margin-top: 18px; flex-wrap: wrap; }
.pagination a, .pagination span {
  padding: 7px 13px; border-radius: var(--radius-sm);
  background: var(--surface-2); border: 1px solid var(--border);
  color: var(--text-muted); font-size: 12px; font-weight: 600;
}
.pagination .active { background: var(--primary); border-color: var(--primary); color: #fff; }
.pagination a:hover { border-color: var(--primary); color: var(--primary); }
.pagination .disabled { opacity: .4; pointer-events: none; }

/* ---------- Filter bar ---------- */
.table-tools {
  display: flex; align-items: center; gap: 12px;
  margin-bottom: 16px; flex-wrap: wrap;
}
.table-tools form { flex: 1; min-width: 280px; }
.table-tools > .btn:last-child { margin-left: auto; }
.filters { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 16px; }
.filters .form-control { width: auto; height: 32px; padding: 0 11px; border-radius: 8px; font-size: 12.5px; min-width: 170px; }
.filters .form-control.search { min-width: 220px; flex: 1; max-width: 340px; }
.filters select.form-control { padding-right: 36px; }

/* ---------- Empty state ---------- */
.empty {
  text-align: center; padding: 48px 20px; color: var(--text-dim);
}
.empty i { font-size: 44px; opacity: .35; display: block; margin-bottom: 14px; }

/* ---------- Timeline / log rows ---------- */
.log-row {
  display: flex; gap: 14px; padding: 14px 0;
  border-bottom: 1px solid var(--border-soft);
}
.log-row:last-child { border-bottom: 0; }
.log-dot {
  width: 34px; height: 34px; border-radius: 10px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center; font-size: 14px;
}
.log-row .tbl-sub { margin-top: 2px; }

/* ---------- Code block ---------- */
.code-block {
  background: #0b1020; border: 1px solid rgba(255, 255, 255, .12);
  border-radius: var(--radius-sm); padding: 14px;
  font-family: 'Cascadia Code', Consolas, monospace; font-size: 12px;
  overflow-x: auto; white-space: pre-wrap; word-break: break-all; color: #9be8ff;
  max-height: 320px; overflow-y: auto;
}
.key-display {
  background: #0b1020; border: 1px dashed rgba(255, 255, 255, .2);
  border-radius: var(--radius-sm); padding: 14px 18px;
  font-family: Consolas, monospace; font-size: 13px; color: #7fe3ff;
  word-break: break-all; position: relative;
}
.key-display .copy-btn { position: absolute; top: 10px; right: 10px; }

.copy-box {
  display: flex; gap: 8px; align-items: center;
}
.copy-box .form-control { flex: 1; }
.copy-box .form-control.code { font-family: Consolas, monospace; }

.info-rows { display: flex; flex-direction: column; }
.info-row {
  display: flex; justify-content: space-between; align-items: center;
  gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--border);
  font-size: 13px;
}
.info-row:last-child { border-bottom: 0; }
.info-row .tbl-sub { flex-shrink: 0; }


/* ---------- Toggle switch ---------- */
.switch { position: relative; display: inline-block; width: 44px; height: 24px; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch .slider {
  position: absolute; cursor: pointer; inset: 0;
  background: #cbd5e1; border-radius: 100px; transition: .25s;
}
.switch .slider::before {
  content: ''; position: absolute; width: 18px; height: 18px;
  left: 3px; bottom: 3px; background: #fff; border-radius: 50%; transition: .25s;
}
.switch input:checked + .slider { background: var(--green); }
.switch input:checked + .slider::before { transform: translateX(20px); }

/* ---------- Landing re-used bits ---------- */
.text-center { text-align: center; }
.text-right { text-align: right; }
.flex { display: flex; }
.flex-between { display: flex; align-items: center; justify-content: space-between; }
.flex-center { display: flex; align-items: center; justify-content: center; }
.gap-8 { gap: 8px; }
.gap-12 { gap: 12px; }
.hidden { display: none !important; }

/* ---------- Offcanvas (right slide-in panel) ---------- */
.offcanvas { position: fixed; inset: 0; z-index: 95; display: none; }
.offcanvas.open { display: block; }
.offcanvas-overlay {
  position: absolute; inset: 0; background: rgba(4, 8, 16, .45);
  backdrop-filter: blur(2px); opacity: 0; transition: opacity .28s ease;
}
.offcanvas.open .offcanvas-overlay { opacity: 1; }
.offcanvas-box {
  position: absolute; top: 0; right: 0; bottom: 0;
  width: 480px; max-width: 94vw;
  background: #ffffff;
  border-left: 1px solid var(--border);
  box-shadow: -18px 0 60px rgba(15, 23, 42, .12);
  transform: translateX(100%); transition: transform .3s cubic-bezier(.22,.8,.36,1);
  display: flex; flex-direction: column;
}
.offcanvas.open .offcanvas-box { transform: translateX(0); }
.offcanvas-head {
  display: flex; align-items: center; gap: 14px;
  padding: 20px 24px; border-bottom: 1px solid var(--border);
}
.offcanvas-head .off-title { flex: 1; min-width: 0; }
.offcanvas-head .off-title h3 { font-size: 17px; font-weight: 800; letter-spacing: -.3px; color: var(--text); }
.offcanvas-head .off-title .tbl-sub { margin-top: 2px; }
.offcanvas-close {
  background: var(--bg); border: 1px solid var(--border); color: var(--text-muted);
  width: 34px; height: 34px; border-radius: 10px; cursor: pointer; font-size: 16px;
  display: flex; align-items: center; justify-content: center; transition: .2s;
}
.offcanvas-close:hover { color: var(--red); border-color: var(--red); }
.offcanvas-body { flex: 1; overflow-y: auto; padding: 22px 24px; }
.offcanvas-foot {
  padding: 16px 24px; border-top: 1px solid var(--border);
  display: flex; justify-content: space-between; align-items: center; gap: 10px;
  background: var(--bg-soft);
}
.oc-section {
  background: var(--bg); border: 1px solid var(--border-soft);
  border-radius: var(--radius-sm); padding: 16px; margin-bottom: 14px;
}
.oc-section .oc-sec-title {
  font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .6px;
  color: var(--text-muted); display: flex; align-items: center; gap: 8px; margin-bottom: 14px;
}
.oc-section .oc-sec-title i { color: var(--primary); }
.oc-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.oc-grid .form-group { margin-bottom: 0; }
.oc-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 14px; }
.oc-stat {
  background: var(--bg); border: 1px solid var(--border-soft); border-radius: var(--radius-sm);
  padding: 12px 14px; text-align: center;
}
.oc-stat .oc-stat-v { font-size: 17px; font-weight: 800; color: var(--text); }
.oc-stat .oc-stat-l { font-size: 10.5px; color: var(--text-dim); text-transform: uppercase; letter-spacing: .5px; margin-top: 2px; }
.oc-contact .row { display: flex; gap: 10px; align-items: flex-start; padding: 8px 0; border-bottom: 1px dashed var(--border-soft); }
.oc-contact .row:last-child { border-bottom: 0; }
.oc-contact .row i { width: 20px; text-align: center; color: var(--primary); margin-top: 3px; }
.oc-contact .row span { color: var(--text-muted); font-size: 12.5px; word-break: break-all; }
table tbody tr.row-click { cursor: pointer; }
table tbody tr.row-click:hover td { background: var(--primary-soft); }

/* ---------- Toasts ---------- */
.toast-wrap {
  position: fixed; top: 18px; right: 18px; z-index: 999;
  display: flex; flex-direction: column; gap: 10px; max-width: 360px;
}
.toast {
  display: flex; align-items: flex-start; gap: 12px;
  background: #ffffff;
  border: 1px solid var(--border); border-left-width: 4px;
  border-radius: var(--radius-sm); padding: 13px 16px;
  box-shadow: var(--shadow); min-width: 280px; max-width: 360px;
  animation: toastIn .3s cubic-bezier(.22,.8,.36,1);
}
.toast.out { animation: toastOut .3s ease forwards; }
.toast.success { border-left-color: var(--green); }
.toast.error { border-left-color: var(--red); }
.toast.info { border-left-color: var(--primary); }
.toast.warning { border-left-color: var(--orange); }
.toast .toast-ic {
  width: 30px; height: 30px; border-radius: 9px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center; font-size: 13px;
}
.toast.success .toast-ic { background: var(--green-soft); color: var(--green); }
.toast.error .toast-ic { background: var(--red-soft); color: var(--red); }
.toast.info .toast-ic { background: var(--primary-soft); color: var(--primary); }
.toast.warning .toast-ic { background: var(--orange-soft); color: var(--orange); }
.toast-ic .toast-ic-img { width: 24px; height: 24px; object-fit: contain; border-radius: 6px; }
.toast .toast-body { flex: 1; font-size: 13px; line-height: 1.45; padding-top: 4px; color: var(--text); }
.toast .toast-x { background: none; border: 0; color: var(--text-dim); cursor: pointer; font-size: 14px; padding: 4px; }
.toast .toast-x:hover { color: var(--text); }
@keyframes toastIn { from { opacity: 0; transform: translateX(60px); } to { opacity: 1; transform: translateX(0); } }
@keyframes toastOut { to { opacity: 0; transform: translateX(60px); } }

/* ---------- Responsive ---------- */
@media (max-width: 1200px) {
  .stats-grid { grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); }
}
@media (max-width: 992px) {
  .grid-2 { grid-template-columns: 1fr; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .offcanvas-box { width: 420px; }
  .sidebar {
    position: fixed; z-index: 80; margin-left: 0;
    transform: translateX(-100%);
    transition: transform .3s cubic-bezier(.22,.8,.36,1);
    box-shadow: 18px 0 60px rgba(15, 23, 42, .25);
  }
  .sidebar.collapsed { margin-left: 0; transform: translateX(0); box-shadow: 18px 0 60px rgba(15, 23, 42, .25); }
}
@media (max-width: 640px) {
  .content { padding: 16px; }
  .topbar { height: 56px; padding: 0 12px; gap: 10px; }
  .page-title, .page-crumb { display: none; }
  .form-row { grid-template-columns: 1fr; }
  .page-head { margin-bottom: 16px; }
  .page-head h1 { font-size: 19px; }
  .page-head .btn { width: 100%; justify-content: center; }
  .oc-grid { grid-template-columns: 1fr; }
  .oc-stats { grid-template-columns: repeat(3, 1fr); }
  .stats-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .filters { width: 100%; }
  .filters .form-control { flex: 1; min-width: 0; }
  .filters .form-control.search { min-width: 0; max-width: none; }
  .filters .btn { flex-shrink: 0; }
  .table-tools form { min-width: 100%; }
  .modal { padding: 12px; }
  .modal-box { max-height: 94vh; }
  .modal-body { padding: 18px; }
  .modal-head { padding: 15px 18px; }
  .modal-foot { padding: 14px 18px; flex-wrap: wrap; }
  .offcanvas-head { padding: 16px 18px; }
  .offcanvas-body { padding: 18px; }
  .offcanvas-foot { padding: 14px 18px; flex-wrap: wrap; }
  .user-menu { right: 12px; }
  .user-chip-name, .user-chip-role { display: none; }
  .user-chip { padding: 4px 9px 4px 4px; }
  .balance-chip { padding: 6px 11px; font-size: 12px; }
  .brand { padding: 16px 18px; }
  .toast-wrap { left: 12px; right: 12px; max-width: none; }
  .toast { min-width: 0; max-width: none; }
  .pagination { justify-content: center; }
}
@media (max-width: 420px) {
  .stats-grid { grid-template-columns: 1fr; }
  .oc-stats { grid-template-columns: repeat(2, 1fr); }
  .card { padding: 16px; }
  thead th, tbody td { padding: 11px 12px; }
}

/* ---------- SweetAlert2 theme (panel match) ---------- */
.swal2-popup.swal2-theme-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow), var(--glow);
  font-family: var(--font);
  padding: 28px 30px 30px;
}
.swal2-popup.swal2-theme-panel .swal2-title {
  font-family: var(--font-heading);
  font-size: 20px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -.3px;
  margin-top: 6px;
}
.swal2-popup.swal2-theme-panel .swal2-html-container {
  font-size: 13.5px;
  color: var(--text-muted);
  margin-top: 4px;
}
.swal2-popup.swal2-theme-panel .swal2-icon {
  border-radius: 50%;
}
.swal2-popup.swal2-theme-panel .swal2-icon.swal2-success {
  border-color: var(--green);
  color: var(--green);
}
.swal2-popup.swal2-theme-panel .swal2-icon.swal2-success [class^='swal2-success-line'] {
  background-color: var(--green);
}
.swal2-popup.swal2-theme-panel .swal2-icon.swal2-success .swal2-success-ring {
  border-color: rgba(16, 185, 129, .25);
}
.swal2-popup.swal2-theme-panel .swal2-styled.swal2-confirm {
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  border-radius: var(--radius-sm);
  font-family: var(--font);
  font-weight: 600;
  font-size: 14px;
  letter-spacing: .2px;
  padding: 10px 34px;
  box-shadow: 0 4px 14px rgba(255, 107, 53, .35);
  transition: all .2s;
}
.swal2-popup.swal2-theme-panel .swal2-styled.swal2-confirm:hover {
  filter: brightness(1.08);
  transform: translateY(-1px);
  box-shadow: 0 6px 18px rgba(255, 107, 53, .4);
}
.swal2-popup.swal2-theme-panel .swal2-actions { margin-top: 22px; }

