/* =========================================================
   WebSMS — giao diện
   ========================================================= */
:root {
  --bg: #f4f6fa;
  --surface: #ffffff;
  --surface-2: #f6f8fb;
  --surface-3: #eef2f7;
  --border: #e3e8ef;
  --border-strong: #cfd7e3;
  --text: #0f172a;
  --text-2: #334155;
  --muted: #64748b;
  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --primary-soft: #eaf1ff;
  --on-primary: #ffffff;
  --success: #047857;
  --success-soft: #e2f6ee;
  --warning: #b45309;
  --warning-soft: #fff4e0;
  --danger: #c2262d;
  --danger-soft: #fdecec;
  --neutral-soft: #eef1f5;

  --sidebar-bg: #0f172a;
  --sidebar-text: #aab6c8;
  --sidebar-text-strong: #f1f5f9;
  --sidebar-hover: #1b2539;
  --sidebar-active: #233150;
  --sidebar-border: #1e293b;

  --shadow-sm: 0 1px 2px rgba(15, 23, 42, .05);
  --shadow: 0 1px 3px rgba(15, 23, 42, .06), 0 1px 2px rgba(15, 23, 42, .04);
  --shadow-lg: 0 18px 48px rgba(15, 23, 42, .18);
  --radius: 12px;
  --radius-sm: 8px;
  --focus: 0 0 0 3px rgba(37, 99, 235, .25);
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0b1018;
    --surface: #121925;
    --surface-2: #161f2d;
    --surface-3: #1c2636;
    --border: #253043;
    --border-strong: #334057;
    --text: #e8edf4;
    --text-2: #c3ccd9;
    --muted: #8d9ab0;
    --primary: #5b8cff;
    --primary-hover: #7ba3ff;
    --primary-soft: #1a2747;
    --on-primary: #081020;
    --success: #4ccf8f;
    --success-soft: #12301f;
    --warning: #f0b252;
    --warning-soft: #33260f;
    --danger: #ff7b80;
    --danger-soft: #3a1619;
    --neutral-soft: #1f2a3b;

    --sidebar-bg: #0a0f17;
    --sidebar-text: #93a1b7;
    --sidebar-text-strong: #eef2f8;
    --sidebar-hover: #141c2a;
    --sidebar-active: #1a2747;
    --sidebar-border: #161f2d;

    --shadow-sm: none;
    --shadow: 0 1px 2px rgba(0, 0, 0, .35);
    --shadow-lg: 0 18px 48px rgba(0, 0, 0, .5);
    --focus: 0 0 0 3px rgba(91, 140, 255, .35);
    color-scheme: dark;
  }
}

/* ---------- Nền tảng ---------- */
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font: 14px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", "Noto Sans", "Hiragino Sans", "Microsoft YaHei", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { margin: 0; line-height: 1.25; letter-spacing: -.01em; }
h1 { font-size: 22px; font-weight: 700; }
h2 { font-size: 15px; font-weight: 650; }
p { margin: 0; }
svg.icon { width: 18px; height: 18px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
[hidden] { display: none !important; }

.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.mono { font-family: ui-monospace, "Cascadia Mono", "SF Mono", Consolas, monospace; }
.nowrap { white-space: nowrap; }
.grow { flex: 1; min-width: 0; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.row.nowrap { flex-wrap: nowrap; }

/* ---------- Nút ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 36px; padding: 0 14px;
  border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  background: var(--surface); color: var(--text);
  font: inherit; font-weight: 600; white-space: nowrap; cursor: pointer;
  transition: background .12s, border-color .12s, color .12s, box-shadow .12s;
}
.btn:hover { background: var(--surface-2); }
.btn:focus-visible { outline: none; box-shadow: var(--focus); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn svg.icon { width: 16px; height: 16px; }
.btn-primary { background: var(--primary); border-color: var(--primary); color: var(--on-primary); }
.btn-primary:hover { background: var(--primary-hover); border-color: var(--primary-hover); }
.btn-danger { color: var(--danger); border-color: var(--border-strong); }
.btn-danger:hover { background: var(--danger-soft); border-color: var(--danger); }
.btn-danger-solid { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn-danger-solid:hover { filter: brightness(.95); }
.btn-ghost { border-color: transparent; background: transparent; }
.btn-ghost:hover { background: var(--surface-3); }
.btn-sm { height: 30px; padding: 0 10px; font-size: 13px; border-radius: 7px; }
.btn-lg { height: 44px; padding: 0 22px; font-size: 15px; }
.btn-block { width: 100%; }

/* ---------- Ô nhập ---------- */
.input, select.input, textarea.input {
  width: 100%; height: 36px; padding: 0 11px;
  border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  background: var(--surface); color: var(--text); font: inherit;
  transition: border-color .12s, box-shadow .12s;
}
textarea.input { height: auto; min-height: 76px; padding: 8px 11px; resize: vertical; }
.input:focus { outline: none; border-color: var(--primary); box-shadow: var(--focus); }
.input-sm { height: 30px; font-size: 13px; padding: 0 9px; }
.input-plain { border-color: transparent; background: transparent; }
.input-plain:hover { border-color: var(--border); }
.input-plain:focus { background: var(--surface); }
.field { display: grid; gap: 6px; }
.field label { font-size: 12.5px; font-weight: 600; color: var(--text-2); }
.field .hint { font-size: 12px; color: var(--muted); }

.search { position: relative; display: flex; align-items: center; min-width: 200px; }
.search svg.icon { position: absolute; left: 10px; width: 16px; height: 16px; color: var(--muted); pointer-events: none; }
.search .input { padding-left: 32px; }

.lang-picker { position: relative; display: inline-flex; align-items: center; }
.lang-picker svg.icon { position: absolute; left: 9px; width: 15px; height: 15px; color: var(--muted); pointer-events: none; }
.lang-picker .lang-select { width: auto; height: 32px; padding: 0 28px 0 30px; font-size: 13px; cursor: pointer; }

/* Ô chọn (select): tắt kiểu vẽ riêng của iPhone/Safari (vốn bỏ qua lề trái và làm quả cầu đè lên chữ),
   tự vẽ mũi tên ▾ để mọi trình duyệt hiển thị giống nhau. */
select.input {
  -webkit-appearance: none; -moz-appearance: none; appearance: none;
  padding-right: 30px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 9px center; background-size: 14px 14px;
  text-overflow: ellipsis;
}
select.input::-ms-expand { display: none; }
input[type="search"].input { -webkit-appearance: none; appearance: none; }
input[type="search"].input::-webkit-search-decoration { -webkit-appearance: none; }

/* iPhone tự phóng to trang khi chạm vào ô có chữ nhỏ hơn 16px: dùng 16px trên thiết bị iOS */
@supports (-webkit-touch-callout: none) {
  .input, select.input, textarea.input, .input-sm, .lang-picker .lang-select { font-size: 16px; }
}

/* Công tắc bật/tắt */
.switch { position: relative; display: inline-flex; width: 38px; height: 22px; flex: none; }
.switch input { position: absolute; inset: 0; opacity: 0; margin: 0; cursor: pointer; z-index: 1; }
.switch .track {
  width: 100%; height: 100%; border-radius: 999px; background: var(--border-strong);
  transition: background .15s; position: relative;
}
.switch .track::after {
  content: ""; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%;
  background: #fff; box-shadow: 0 1px 2px rgba(0, 0, 0, .25); transition: transform .15s;
}
.switch input:checked + .track { background: var(--success); }
.switch input:checked + .track::after { transform: translateX(16px); }
.switch input:focus-visible + .track { box-shadow: var(--focus); }

/* ---------- Thẻ, khối ---------- */
.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow); min-width: 0;
}
.card-body { padding: 18px; }
.card-head {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  padding: 14px 18px; border-bottom: 1px solid var(--border);
}
.card-head .actions { margin-left: auto; display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.card-head .sub { color: var(--muted); font-size: 12.5px; }
.toolbar { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; padding: 12px 18px; border-bottom: 1px solid var(--border); background: var(--surface-2); }
.toolbar .spacer { flex: 1; }
.toolbar select.input { width: auto; }

.page-head { display: flex; align-items: flex-end; gap: 16px; flex-wrap: wrap; margin-bottom: 18px; }
.page-head .desc { color: var(--muted); margin-top: 4px; }
.page-head .actions { margin-left: auto; display: flex; gap: 8px; flex-wrap: wrap; }

.empty { text-align: center; color: var(--muted); padding: 36px 12px; }
.load-more { display: flex; justify-content: center; padding: 12px; }

/* ---------- Bảng ---------- */
.table-wrap { overflow: auto; max-width: 100%; }
.table-wrap.tall { max-height: 620px; }
table.table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 13.5px; }
.table th, .table td { padding: 10px 14px; border-bottom: 1px solid var(--border); text-align: left; vertical-align: middle; }
.table th {
  position: sticky; top: 0; z-index: 1;
  background: var(--surface-2); color: var(--muted);
  font-size: 11.5px; font-weight: 650; text-transform: uppercase; letter-spacing: .05em; white-space: nowrap;
}
.table tbody tr:hover td { background: var(--surface-2); }
.table tbody tr:last-child td { border-bottom: 0; }
.table .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.table .cell-title { font-weight: 600; }
.table .cell-sub { color: var(--muted); font-size: 12px; margin-top: 1px; }
.table .input-sm { min-width: 80px; }
.table input[type="number"].input-sm { width: 80px; }
.table td.actions { text-align: right; white-space: nowrap; }

/* ---------- Nhãn ---------- */
.badge {
  display: inline-flex; align-items: center; gap: 5px; height: 22px; padding: 0 9px;
  border-radius: 999px; font-size: 12px; font-weight: 600; white-space: nowrap;
  background: var(--neutral-soft); color: var(--muted);
}
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .8; }
.badge.plain::before { display: none; }
.badge-waiting, .badge-pending { background: var(--warning-soft); color: var(--warning); }
.badge-success, .badge-on { background: var(--success-soft); color: var(--success); }
.badge-failed, .badge-off { background: var(--danger-soft); color: var(--danger); }
.badge-role { background: var(--primary-soft); color: var(--primary); }
.chip {
  display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 10px; border-radius: 999px;
  background: var(--primary-soft); color: var(--primary); font-size: 13px; font-weight: 600; border: 0; cursor: pointer; font-family: inherit;
}

/* ---------- Ô chỉ số ---------- */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(175px, 1fr)); gap: 14px; margin-bottom: 18px; }
.stat {
  display: flex; gap: 14px; align-items: flex-start;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow);
}
.stat-icon { width: 40px; height: 40px; border-radius: 10px; display: grid; place-items: center; flex: none; background: var(--primary-soft); color: var(--primary); }
.stat-icon.green { background: var(--success-soft); color: var(--success); }
.stat-icon.amber { background: var(--warning-soft); color: var(--warning); }
.stat-icon.slate { background: var(--neutral-soft); color: var(--text-2); }
.stat-label { font-size: 12.5px; color: var(--muted); font-weight: 600; }
.stat-value { font-size: 24px; font-weight: 750; margin-top: 2px; font-variant-numeric: tabular-nums; letter-spacing: -.02em; line-height: 1.2; }
.stat-sub { font-size: 12px; color: var(--muted); margin-top: 3px; }
.alert { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: var(--radius-sm); font-size: 13.5px; margin-bottom: 16px; }
.alert-danger { background: var(--danger-soft); color: var(--danger); }
.alert-warning { background: var(--warning-soft); color: var(--warning); }

/* =========================================================
   Bố cục trang quản trị (thanh bên trái)
   ========================================================= */
.shell { display: grid; grid-template-columns: 248px minmax(0, 1fr); min-height: 100vh; }
.sidebar {
  position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; gap: 8px;
  background: var(--sidebar-bg); color: var(--sidebar-text); padding: 18px 14px; border-right: 1px solid var(--sidebar-border);
}
.sidebar-brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px 18px; color: var(--sidebar-text-strong); }
.sidebar-brand b { display: block; font-size: 15.5px; }
.sidebar-brand small { display: block; font-size: 12px; color: var(--sidebar-text); }
.side-nav { display: grid; gap: 2px; }
.nav-label { font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--sidebar-text); opacity: .7; padding: 10px 10px 4px; }
.nav-item {
  display: flex; align-items: center; gap: 11px; width: 100%; padding: 9px 10px; border-radius: 8px;
  border: 0; background: transparent; color: var(--sidebar-text); font: inherit; font-weight: 550; text-align: left; cursor: pointer;
  text-decoration: none;
}
.nav-item:hover { background: var(--sidebar-hover); color: var(--sidebar-text-strong); text-decoration: none; }
.nav-item.active { background: var(--sidebar-active); color: var(--sidebar-text-strong); }
.nav-item.active svg.icon { color: #7aa5ff; }
.sidebar-foot { margin-top: auto; display: grid; gap: 10px; border-top: 1px solid var(--sidebar-border); padding-top: 14px; }
.sidebar .lang-select { width: 100%; background-color: var(--sidebar-hover); color: var(--sidebar-text-strong); border-color: var(--sidebar-border); }
.sidebar .lang-picker { display: flex; }
.sidebar .lang-picker svg.icon { color: var(--sidebar-text); }
.user-box { display: flex; align-items: center; gap: 10px; padding: 6px 4px; color: var(--sidebar-text-strong); }
.avatar {
  width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; flex: none;
  background: var(--primary); color: #fff; font-weight: 700; text-transform: uppercase;
}
.avatar.sm { width: 30px; height: 30px; font-size: 13px; }
.dialog-head .avatar { width: 40px; height: 40px; font-size: 16px; }
.user-box .name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-box .role { font-size: 12px; color: var(--sidebar-text); }
.sidebar .btn-ghost { color: var(--sidebar-text); }
.sidebar .btn-ghost:hover { background: var(--sidebar-hover); color: var(--sidebar-text-strong); }
.main { padding: 28px 32px 48px; min-width: 0; }
.main > section { max-width: 1240px; }

/* =========================================================
   Thanh trên cùng (trang khách)
   ========================================================= */
.brand { display: flex; align-items: center; gap: 10px; font-weight: 750; font-size: 16.5px; letter-spacing: -.01em; }
a.brand, a.sidebar-brand { text-decoration: none; cursor: pointer; }
a.brand { color: inherit; }
a.brand:hover, a.sidebar-brand:hover { text-decoration: none; opacity: .88; }
.has-bg .topbar a.brand { color: #fff; }
.brand-mark {
  width: 32px; height: 32px; border-radius: 9px; flex: none;
  background: linear-gradient(135deg, #3b82f6, #1d4ed8); color: #fff; display: grid; place-items: center;
  box-shadow: 0 2px 6px rgba(37, 99, 235, .35);
}
.brand-mark svg.icon { width: 18px; height: 18px; stroke-width: 2; }
.topbar {
  position: sticky; top: 0; z-index: 10; display: flex; align-items: center; gap: 16px;
  padding: 10px 24px; background: color-mix(in srgb, var(--surface) 92%, transparent);
  backdrop-filter: saturate(1.4) blur(8px); border-bottom: 1px solid var(--border);
}
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 8px; min-width: 0; }

.menu { position: relative; }
.menu-list {
  position: absolute; right: 0; top: calc(100% + 6px); min-width: 190px; z-index: 30;
  background: var(--surface); border: 1px solid var(--border); border-radius: 10px; box-shadow: var(--shadow-lg); padding: 6px;
}
.sidebar .menu-list { right: auto; left: 0; top: auto; bottom: calc(100% + 6px); }
.menu-list button {
  display: flex; align-items: center; gap: 9px; width: 100%; text-align: left; border: 0; background: none;
  padding: 8px 10px; border-radius: 7px; color: var(--text); font: inherit; cursor: pointer;
}
.menu-list button:hover { background: var(--surface-2); }
.menu-list svg.icon { width: 16px; height: 16px; color: var(--muted); }

.container { max-width: 1200px; margin: 0 auto; padding: 24px 20px 48px; display: grid; gap: 18px; }
.customer-grid { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); gap: 18px; align-items: start; }

/* ---------- Chọn dịch vụ ---------- */
.service-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px;
  max-height: 360px; overflow-y: auto; padding: 16px 18px; align-content: start;
}
.service-grid > .empty { grid-column: 1 / -1; }
.service-item {
  border: 1.5px solid var(--border); border-radius: 10px; background: var(--surface);
  padding: 10px 12px; text-align: left; cursor: pointer; font: inherit; color: var(--text);
  transition: border-color .12s, background .12s, box-shadow .12s; min-height: 46px;
}
.service-item:hover { border-color: var(--primary); }
.service-item.selected { border-color: var(--primary); background: var(--primary-soft); box-shadow: inset 0 0 0 1px var(--primary); }
.service-item .svc-name { font-weight: 600; font-size: 13.5px; display: block; overflow-wrap: anywhere; }
.rent-bar { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding: 14px 18px; border-top: 1px solid var(--border); background: var(--surface-2); border-radius: 0 0 var(--radius) var(--radius); }

/* ---------- Thẻ số đang dùng ---------- */
.order-list { display: grid; gap: 12px; padding: 16px 18px; }
.order-card {
  border: 1px solid var(--border); border-radius: 10px; padding: 14px; display: grid; gap: 10px;
  background: var(--surface); border-left: 4px solid var(--warning);
}
.order-card.is-success { border-left-color: var(--success); }
.oc-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.oc-head .svc { font-weight: 700; }
.oc-head .timer { margin-left: auto; font-variant-numeric: tabular-nums; color: var(--muted); font-weight: 600; }
.oc-line { display: flex; flex-wrap: wrap; align-items: center; gap: 2px 10px; background: var(--surface-2); border-radius: 8px; padding: 8px 12px 10px; }
.oc-line .label { width: 100%; font-size: 11.5px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }
.oc-line .value {
  flex: 1 1 auto; white-space: nowrap;
  font-size: 19px; font-weight: 700; letter-spacing: .02em; font-variant-numeric: tabular-nums;
}
.oc-line .btn { margin-left: auto; flex: none; }
.oc-code { background: var(--success-soft); }
.oc-code .value { color: var(--success); font-size: 24px; letter-spacing: .14em; }
.oc-sms { font-size: 12.5px; color: var(--muted); overflow-wrap: anywhere; }
.oc-actions { display: flex; justify-content: flex-end; }
.waiting-text { display: flex; align-items: center; gap: 8px; color: var(--warning); font-weight: 600; font-size: 13.5px; }
.spinner { width: 14px; height: 14px; border-radius: 50%; border: 2px solid currentColor; border-right-color: transparent; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Hộp thoại ---------- */
dialog {
  border: 1px solid var(--border); border-radius: 14px; padding: 0;
  background: var(--surface); color: var(--text); width: min(460px, calc(100vw - 32px));
  box-shadow: var(--shadow-lg);
}
dialog.wide { width: min(560px, calc(100vw - 32px)); }
dialog::backdrop { background: rgba(8, 12, 22, .5); }
.dialog-head { display: flex; align-items: center; gap: 10px; padding: 16px 20px; border-bottom: 1px solid var(--border); }
.dialog-head h2 { font-size: 16px; }
.dialog-head .close { margin-left: auto; }
.dialog-body { padding: 20px; display: grid; gap: 14px; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; padding: 14px 20px; border-top: 1px solid var(--border); background: var(--surface-2); border-radius: 0 0 14px 14px; }
.dialog-actions .left { margin-right: auto; }
.credential-box {
  background: var(--surface-2); border: 1px dashed var(--border-strong); border-radius: 8px;
  padding: 12px 14px; white-space: pre-wrap; font-family: ui-monospace, Consolas, monospace; font-size: 13.5px;
}
.mini-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.mini-stat { background: var(--surface-2); border-radius: 8px; padding: 10px 12px; }
.mini-stat .k { font-size: 12px; color: var(--muted); }
.mini-stat .v { font-size: 17px; font-weight: 700; font-variant-numeric: tabular-nums; }
.action-list { display: grid; gap: 8px; }
.action-list .btn { justify-content: flex-start; }

/* ---------- Thông báo nhanh ---------- */
.toast-wrap { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); z-index: 100; display: grid; gap: 8px; width: min(440px, calc(100vw - 32px)); }
.toast {
  background: #111827; color: #f9fafb; padding: 11px 16px; border-radius: 10px;
  box-shadow: var(--shadow-lg); font-size: 13.5px; animation: toast-in .18s ease-out;
}
.toast.toast-error { background: var(--danger); color: #fff; }
.toast.toast-success { background: #047857; color: #fff; }
@keyframes toast-in { from { opacity: 0; transform: translateY(6px); } }

/* ---------- Trang đăng nhập ---------- */
.login-page {
  min-height: 100vh; display: grid; place-items: center; align-content: center; gap: 14px; padding: 16px;
  background:
    radial-gradient(1200px 500px at 50% -10%, color-mix(in srgb, var(--primary) 14%, transparent), transparent 70%),
    var(--bg);
}
.login-card { width: min(400px, 100%); display: grid; gap: 16px; padding: 30px; }
.login-card .brand { justify-content: center; font-size: 21px; margin-bottom: 4px; }
.login-card .brand-mark { width: 38px; height: 38px; border-radius: 11px; }
.login-card p { text-align: center; }
.login-lang { position: fixed; top: 14px; right: 16px; z-index: 5; }
.form-error { color: var(--danger); font-size: 13px; min-height: 1.2em; }
.page-footer { text-align: center; }

/* =========================================================
   Ảnh nền Nhật Bản (sóng Seigaiha) + sao băng
   ========================================================= */
body.has-bg { background: #0c1736; }
body.has-bg::before {
  content: ""; position: fixed; inset: 0; z-index: -2;
  background: #0c1736 url("/static/bg/mau-4-song.svg") 50% 50% / cover no-repeat;
}
.sky-fx { position: fixed; inset: 0; z-index: -1; overflow: hidden; pointer-events: none; }

/* Sao băng: chỉ chạy ở vùng bầu trời phía trên (khoảng 4–24% chiều cao màn hình).
   Mỗi vệt hiện ra, lướt chéo xuống bên trái khoảng 1/3 màn hình rồi tắt, không rơi xuống dưới. */
.meteor {
  position: absolute; left: 70%; top: 10%;
  width: 240px; height: 2.5px; border-radius: 3px;
  background: linear-gradient(90deg, rgba(255, 253, 245, 1), rgba(255, 232, 185, .6) 22%, rgba(255, 220, 160, 0));
  filter: drop-shadow(0 0 4px rgba(255, 224, 170, .7));
  opacity: 0; transform-origin: left center;
  animation: meteor 10s linear infinite;
}
.meteor::before {
  content: ""; position: absolute; left: -4px; top: -3px; width: 8px; height: 8px; border-radius: 50%;
  background: #fffdf5;
  box-shadow: 0 0 10px 4px rgba(255, 238, 190, .95), 0 0 28px 10px rgba(255, 205, 130, .45);
}
@keyframes meteor {
  0%   { transform: rotate(-12deg) translateX(0);      opacity: 0; }
  2%   { opacity: 1; }
  12%  { opacity: 1; }
  17%  { transform: rotate(-12deg) translateX(-34vw);  opacity: 0; }
  100% { transform: rotate(-12deg) translateX(-34vw);  opacity: 0; }
}
.meteor:nth-child(1) { top: 7%;  left: 60%;  width: 270px; animation-duration: 9s;  animation-delay: .2s; }
.meteor:nth-child(2) { top: 15%; left: 94%;  width: 210px; animation-duration: 11s; animation-delay: 1.8s; }
.meteor:nth-child(3) { top: 4%;  left: 82%;  width: 310px; animation-duration: 13s; animation-delay: 3.6s; }
.meteor:nth-child(4) { top: 20%; left: 50%;  width: 190px; animation-duration: 10s; animation-delay: 5.3s; }
.meteor:nth-child(5) { top: 11%; left: 102%; width: 240px; animation-duration: 12s; animation-delay: 7s; }
.meteor:nth-child(6) { top: 24%; left: 72%;  width: 170px; animation-duration: 14s; animation-delay: 8.6s; }
@media (prefers-reduced-motion: reduce) { .sky-fx { display: none; } }

/* Chữ và thanh trên nền tối */
.has-bg .topbar {
  background: rgba(10, 20, 50, .55); border-bottom-color: rgba(255, 255, 255, .08); color: #fff;
  backdrop-filter: saturate(1.3) blur(10px);
}
.has-bg .page-head h1 { color: #fff; }
.has-bg .page-head .desc, .has-bg .page-footer, .has-bg .page-footer a { color: rgba(226, 232, 255, .75); }
.has-bg .card, .has-bg .stat { box-shadow: 0 10px 30px rgba(2, 6, 23, .35); border-color: rgba(255, 255, 255, .06); }
.has-bg .login-page { background: transparent; }
.has-bg .login-card { box-shadow: 0 24px 60px rgba(2, 6, 23, .55); }
.has-bg .main { background: transparent; }

/* =========================================================
   Màn hình nhỏ
   ========================================================= */
@media (max-width: 960px) {
  .customer-grid { grid-template-columns: 1fr; }
}
@media (max-width: 900px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  .sidebar {
    position: sticky; top: 0; z-index: 20; height: auto; flex-direction: row; flex-wrap: wrap; align-items: center;
    padding: 10px 14px; gap: 8px; min-width: 0;
  }
  .side-nav { min-width: 0; }
  .sidebar-brand { padding: 0; }
  .sidebar-brand small { display: none; }
  .side-nav { order: 3; width: 100%; display: flex; gap: 4px; overflow-x: auto; scrollbar-width: none; }
  .nav-label { display: none; }
  .nav-item { width: auto; white-space: nowrap; padding: 7px 10px; }
  .sidebar-foot { margin: 0 0 0 auto; border: 0; padding: 0; display: flex; align-items: center; gap: 6px; }
  .sidebar .lang-select { width: auto; }
  .user-box .meta, .sidebar-foot .nav-item.customer-link span { display: none; }
  .sidebar .menu-list { left: auto; right: 0; top: calc(100% + 6px); bottom: auto; }
  .main { padding: 18px 14px 40px; }
}
@media (max-width: 480px) {
  .sidebar-brand div, .sidebar-foot .customer-link, .user-box > svg.icon { display: none; }
  .user-box { padding: 2px; }
  .topbar .btn-label, .topbar .chevron, .oc-line .btn-label { display: none; }
  .oc-line .btn { width: 34px; padding: 0; }
  .oc-code .value { font-size: 22px; letter-spacing: .1em; }
  .lang-picker .lang-select { max-width: 150px; }
  .hide-xs { display: none; }
  .table th, .table td { padding: 9px 10px; }
}
@media (max-width: 640px) {
  body.has-bg::before { background-position: 76% 50%; }  /* điện thoại: lệch ảnh để thấy mặt trời đỏ */
  .sky-fx .meteor:nth-child(n) { width: 140px; }
  .topbar { padding: 10px 14px; gap: 8px; }
  .brand .brand-text { display: none; }
  .container { padding: 14px 12px 40px; gap: 14px; }
  .card-head, .toolbar { padding: 12px 14px; }
  .service-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); padding: 12px 14px; max-height: 300px; }
  .order-list { padding: 12px 14px; }
  .rent-bar { padding: 12px 14px; }
  .rent-bar .btn { width: 100%; }
  .search { min-width: 0; flex: 1; }
  .toolbar .search { flex: 1 1 100%; }
  .toolbar .spacer { display: none; }
  .hide-sm { display: none; }
  .page-head .actions { margin-left: 0; }
  h1 { font-size: 19px; }
  .stats { grid-template-columns: 1fr 1fr; gap: 10px; }
  .stat { padding: 12px; gap: 10px; }
  .stat-icon { width: 34px; height: 34px; }
  .stat-value { font-size: 19px; }
  .mini-stats { grid-template-columns: 1fr 1fr 1fr; gap: 6px; }
}
