/* =========================================================
   Ocean Panel – giao diện
   ========================================================= */
@font-face { font-family: "Inter"; font-style: normal; font-weight: 100 900; font-display: swap;
  src: url(../fonts/inter-vietnamese-wght-normal.woff2) format("woff2");
  unicode-range: U+0102-0103, U+0110-0111, U+0128-0129, U+0168-0169, U+01A0-01A1, U+01AF-01B0, U+0300-0301, U+0303-0304, U+0308-0309, U+0323, U+0329, U+1EA0-1EF9, U+20AB; }
@font-face { font-family: "Inter"; font-style: normal; font-weight: 100 900; font-display: swap;
  src: url(../fonts/inter-latin-ext-wght-normal.woff2) format("woff2");
  unicode-range: U+0100-02AF, U+0304, U+0308, U+0329, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: "Inter"; font-style: normal; font-weight: 100 900; font-display: swap;
  src: url(../fonts/inter-latin-wght-normal.woff2) format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }

:root {
  --bg: #f3f5f9;
  --bg-grad: radial-gradient(1200px 400px at 100% -10%, #e0ebff 0, transparent 60%), #f3f5f9;
  --surface: #ffffff;
  --surface-2: #f7f9fc;
  --surface-3: #eef2f8;
  --border: #e2e8f0;
  --border-strong: #cbd5e1;
  --text: #0f172a;
  --text-2: #334155;
  --muted: #64748b;
  --primary: #2563eb;
  --primary-2: #4f46e5;
  --primary-hover: #1d4ed8;
  --primary-soft: #eaf1ff;
  --success: #16a34a;
  --success-soft: #e6f6ec;
  --warning: #d97706;
  --warning-soft: #fdf2e0;
  --danger: #dc2626;
  --danger-soft: #fdecec;
  --info: #0891b2;
  --info-soft: #e0f5fa;
  --violet: #7c3aed;
  --violet-soft: #f1eafe;
  --pink: #db2777;
  --pink-soft: #fdeaf3;
  --sidebar: #0b1424;
  --sidebar-2: #0f1b30;
  --sidebar-text: #a9b6ca;
  --sidebar-muted: #5e6f8a;
  --sidebar-active: rgba(59, 130, 246, .16);
  --code-bg: #0b1220;
  --code-text: #dbe4f0;
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, .05);
  --shadow: 0 1px 2px rgba(15, 23, 42, .04), 0 6px 20px -6px rgba(15, 23, 42, .08);
  --shadow-lg: 0 24px 60px -12px rgba(15, 23, 42, .3);
  --radius: 14px;
  --radius-sm: 10px;
  --font: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, monospace;
  --sidebar-w: 256px;
  color-scheme: light;
}
:root[data-theme="dark"] {
  --bg: #080e1a;
  --bg-grad: radial-gradient(1200px 400px at 100% -10%, #13234a 0, transparent 60%), #080e1a;
  --surface: #0f1829;
  --surface-2: #0c1424;
  --surface-3: #16223a;
  --border: #1e2b44;
  --border-strong: #2b3b5a;
  --text: #e6edf7;
  --text-2: #c3cede;
  --muted: #8796ae;
  --primary: #4f8cff;
  --primary-hover: #74a5ff;
  --primary-soft: #14264a;
  --success: #22c55e;
  --success-soft: #0e2a1b;
  --warning: #f59e0b;
  --warning-soft: #2c2210;
  --danger: #f05252;
  --danger-soft: #331618;
  --info: #22b8d6;
  --info-soft: #0c2a33;
  --violet: #a78bfa;
  --violet-soft: #231a40;
  --pink: #f472b6;
  --pink-soft: #3a1328;
  --sidebar: #060b15;
  --sidebar-2: #0a1222;
  --shadow: 0 1px 2px rgba(0, 0, 0, .35);
  --shadow-lg: 0 24px 60px -12px rgba(0, 0, 0, .7);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { background: var(--bg-grad); background-attachment: fixed; color: var(--text); font: 14px/1.55 var(--font); -webkit-font-smoothing: antialiased; font-feature-settings: "cv11", "ss01"; }
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
code, pre, .mono { font-family: var(--mono); font-size: 12.5px; }
code { background: var(--surface-3); padding: 1px 6px; border-radius: 5px; }
h1, h2, h3, h4 { margin: 0; font-weight: 650; letter-spacing: -.015em; }
h1 { font-size: 23px; }
h2 { font-size: 15.5px; }
h3 { font-size: 14px; }
[v-cloak] { display: none; }
::selection { background: var(--primary-soft); }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 10px; border: 2px solid transparent; background-clip: padding-box; }

.icon { width: 18px; height: 18px; flex: none; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.icon.xs { width: 13px; height: 13px; }
.icon.sm { width: 15px; height: 15px; }
.icon.lg { width: 22px; height: 22px; }
.icon.xl { width: 28px; height: 28px; }

/* ================= layout ================= */
.layout { display: flex; min-height: 100vh; }
.sidebar {
  width: var(--sidebar-w); flex: none; background: linear-gradient(180deg, var(--sidebar) 0%, var(--sidebar-2) 100%); color: var(--sidebar-text);
  display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; z-index: 50; transition: width .2s ease;
  border-right: 1px solid rgba(255, 255, 255, .04);
}
.sidebar-scroll { overflow-y: auto; flex: 1; padding-bottom: 12px; scrollbar-width: thin; }
.brand { display: flex; align-items: center; gap: 12px; padding: 18px 18px 14px; color: #fff; font-weight: 700; font-size: 16px; white-space: nowrap; }
.brand img { flex: none; filter: drop-shadow(0 4px 12px rgba(59, 130, 246, .45)); }
.brand small { display: block; font-weight: 500; font-size: 11.5px; color: var(--sidebar-muted); }
.server-chip { margin: 0 14px 10px; padding: 10px 12px; border-radius: 12px; background: rgba(255, 255, 255, .04); border: 1px solid rgba(255, 255, 255, .06); font-size: 12px; }
.server-chip .row { justify-content: space-between; }
.server-chip .mini-bar { height: 4px; border-radius: 4px; background: rgba(255, 255, 255, .08); overflow: hidden; margin-top: 4px; }
.server-chip .mini-bar > div { height: 100%; background: linear-gradient(90deg, #3b82f6, #22d3ee); }
.server-chip .mini-bar.warn > div { background: linear-gradient(90deg, #f59e0b, #f97316); }
.server-chip .mini-bar.danger > div { background: linear-gradient(90deg, #ef4444, #f97316); }
.server-chip .lbl { color: var(--sidebar-muted); }
.server-chip .val { color: #e2e8f0; font-weight: 600; }
.nav-group { padding: 16px 22px 6px; font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .09em; color: var(--sidebar-muted); white-space: nowrap; }
.nav a {
  position: relative; display: flex; align-items: center; gap: 12px; margin: 1px 12px; padding: 8px 12px; border-radius: 10px;
  color: var(--sidebar-text); text-decoration: none; font-size: 13.5px; font-weight: 500; white-space: nowrap;
}
.nav a .icon { opacity: .85; }
.nav a:hover { background: rgba(255, 255, 255, .05); color: #fff; }
.nav a.active { background: var(--sidebar-active); color: #fff; }
.nav a.active::before { content: ""; position: absolute; left: -12px; top: 8px; bottom: 8px; width: 3px; border-radius: 0 3px 3px 0; background: #3b82f6; }
.nav a.active .icon { color: #60a5fa; opacity: 1; }
.nav a .nav-badge { margin-left: auto; font-size: 11px; padding: 0 7px; border-radius: 10px; background: rgba(239, 68, 68, .2); color: #fca5a5; }
.sidebar-foot { padding: 12px 18px; font-size: 12px; border-top: 1px solid rgba(255, 255, 255, .06); display: flex; align-items: center; gap: 8px; color: var(--sidebar-muted); white-space: nowrap; }
.sidebar-foot button { margin-left: auto; color: var(--sidebar-text); }
.sidebar-foot button:hover { background: rgba(255, 255, 255, .06); }
.layout.collapsed .sidebar { width: 72px; }
.layout.collapsed .brand div, .layout.collapsed .nav-group, .layout.collapsed .nav a span, .layout.collapsed .server-chip, .layout.collapsed .sidebar-foot span, .layout.collapsed .nav-badge { display: none; }
.layout.collapsed .nav a { justify-content: center; padding: 10px; }
.layout.collapsed .brand { justify-content: center; padding: 18px 0 14px; }
.layout.collapsed .sidebar-foot { justify-content: center; }
.layout.collapsed .sidebar-foot button { margin: 0; }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  height: 62px; display: flex; align-items: center; gap: 10px; padding: 0 28px;
  background: color-mix(in srgb, var(--surface) 82%, transparent); backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 40;
}
.topbar .crumbs { display: flex; align-items: center; gap: 6px; color: var(--muted); font-size: 13px; min-width: 0; }
.topbar .crumbs b { color: var(--text); font-weight: 600; }
.topbar .spacer { flex: 1; }
.search-trigger { display: flex; align-items: center; gap: 8px; height: 36px; padding: 0 10px 0 12px; width: 280px; border-radius: 10px; border: 1px solid var(--border); background: var(--surface-2); color: var(--muted); cursor: pointer; font: 13px var(--font); }
.search-trigger:hover { border-color: var(--border-strong); }
.search-trigger .kbd { margin-left: auto; }
.kbd { font: 600 11px var(--mono); padding: 1px 6px; border-radius: 5px; border: 1px solid var(--border); background: var(--surface); color: var(--muted); }
.status-pill { display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 12px; border-radius: 99px; font-size: 12.5px; font-weight: 600; background: var(--success-soft); color: var(--success); }
.status-pill.bad { background: var(--danger-soft); color: var(--danger); }
.icon-btn { position: relative; display: inline-grid; place-items: center; width: 38px; height: 38px; border-radius: 10px; border: 0; background: transparent; color: var(--text-2); cursor: pointer; }
.icon-btn:hover { background: var(--surface-3); }
.icon-btn .count { position: absolute; top: 4px; right: 4px; min-width: 17px; height: 17px; padding: 0 4px; border-radius: 9px; background: var(--danger); color: #fff; font-size: 10.5px; font-weight: 700; display: grid; place-items: center; border: 2px solid var(--surface); }
.user-btn { display: flex; align-items: center; gap: 10px; padding: 4px 10px 4px 4px; border-radius: 12px; border: 0; background: transparent; cursor: pointer; color: var(--text); font: 500 13.5px var(--font); }
.user-btn:hover { background: var(--surface-3); }
.user-btn small { display: block; color: var(--muted); font-size: 11.5px; text-align: left; }
.menu-btn { display: none !important; }
.content { padding: 26px 28px 40px; max-width: 1480px; width: 100%; margin: 0 auto; animation: fade .25s ease; }
@keyframes fade { from { opacity: 0; transform: translateY(4px); } }
.impersonate-bar { background: linear-gradient(90deg, #d97706, #ea580c); color: #fff; padding: 9px 28px; display: flex; align-items: center; gap: 12px; font-weight: 500; }
.impersonate-bar .btn { background: rgba(255, 255, 255, .2); color: #fff; border-color: transparent; }

/* ================= page head ================= */
.page-head { display: flex; align-items: center; gap: 16px; margin-bottom: 22px; flex-wrap: wrap; }
.page-head .ph-icon { width: 46px; height: 46px; border-radius: 13px; display: grid; place-items: center; flex: none; color: #fff; background: linear-gradient(135deg, var(--primary), var(--primary-2)); box-shadow: 0 8px 20px -8px rgba(37, 99, 235, .6); }
.page-head .ph-icon .icon { width: 22px; height: 22px; }
.page-head .titles { flex: 1; min-width: 220px; }
.page-head p { margin: 3px 0 0; color: var(--muted); font-size: 13.5px; }
.page-head .actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

/* hero */
.hero { position: relative; overflow: hidden; border-radius: 18px; padding: 24px 26px; color: #fff; margin-bottom: 20px;
  background: linear-gradient(120deg, #1d4ed8 0%, #4f46e5 55%, #0891b2 100%); box-shadow: 0 18px 40px -18px rgba(37, 99, 235, .7); }
.hero::after { content: ""; position: absolute; right: -60px; top: -80px; width: 320px; height: 320px; border-radius: 50%; background: radial-gradient(circle, rgba(255, 255, 255, .18), transparent 65%); }
.hero h1 { font-size: 24px; }
.hero p { margin: 4px 0 0; opacity: .85; }
.hero .hero-stats { display: flex; gap: 28px; margin-top: 18px; flex-wrap: wrap; position: relative; z-index: 1; }
.hero .hero-stats div { min-width: 90px; }
.hero .hero-stats b { display: block; font-size: 22px; font-weight: 700; }
.hero .hero-stats span { font-size: 12.5px; opacity: .8; }
.hero .hero-actions { position: absolute; right: 24px; top: 22px; display: flex; gap: 8px; z-index: 1; }
.hero .btn { background: rgba(255, 255, 255, .16); color: #fff; border-color: rgba(255, 255, 255, .22); backdrop-filter: blur(6px); }
.hero .btn:hover { background: rgba(255, 255, 255, .26); }

/* ================= cards ================= */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); min-width: 0; }
.card + .card { margin-top: 18px; }
.grid > .card + .card, .grid > .card { margin-top: 0; }
.card-head { display: flex; align-items: center; gap: 10px; padding: 14px 18px; border-bottom: 1px solid var(--border); min-height: 56px; }
.card-head h2 { flex: 1; display: flex; align-items: center; gap: 8px; }
.card-head h2 .icon { color: var(--primary); }
.card-head .sub { color: var(--muted); font-size: 12.5px; font-weight: 400; }
.card-body { padding: 18px; }
.card-body.flush { padding: 0; }
.card-foot { padding: 12px 18px; border-top: 1px solid var(--border); background: var(--surface-2); border-radius: 0 0 var(--radius) var(--radius); }
.grid { display: grid; gap: 18px; }
.grid.cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid.cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid.cols-5 { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.grid.side { grid-template-columns: minmax(0, 1fr) 340px; }
.grid.gap-sm { gap: 12px; }
.span-2 { grid-column: span 2; }

/* KPI / stat */
.kpi { padding: 16px 18px; display: flex; flex-direction: column; gap: 10px; position: relative; overflow: hidden; }
.kpi .kpi-top { display: flex; align-items: center; gap: 12px; }
.kpi .kpi-label { color: var(--muted); font-size: 12.5px; font-weight: 500; }
.kpi .kpi-value { font-size: 24px; font-weight: 700; letter-spacing: -.02em; line-height: 1.15; }
.kpi .kpi-value small { font-size: 13px; color: var(--muted); font-weight: 500; margin-left: 4px; }
.kpi .kpi-sub { color: var(--muted); font-size: 12px; }
.kpi .spark { margin: -6px -18px -16px; }
.tile-icon { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; flex: none; background: var(--primary-soft); color: var(--primary); }
.tile-icon.green { background: var(--success-soft); color: var(--success); }
.tile-icon.amber { background: var(--warning-soft); color: var(--warning); }
.tile-icon.red { background: var(--danger-soft); color: var(--danger); }
.tile-icon.cyan { background: var(--info-soft); color: var(--info); }
.tile-icon.violet { background: var(--violet-soft); color: var(--violet); }
.tile-icon.pink { background: var(--pink-soft); color: var(--pink); }
.tile-icon.solid { color: #fff; background: linear-gradient(135deg, var(--primary), var(--primary-2)); }

.meter { height: 7px; background: var(--surface-3); border-radius: 99px; overflow: hidden; }
.meter > div { height: 100%; background: linear-gradient(90deg, #3b82f6, #6366f1); border-radius: 99px; transition: width .5s ease; }
.meter.ok > div { background: linear-gradient(90deg, #22c55e, #16a34a); }
.meter.warn > div { background: linear-gradient(90deg, #f59e0b, #f97316); }
.meter.danger > div { background: linear-gradient(90deg, #ef4444, #dc2626); }
.meter.lg { height: 10px; }

/* gauges (live monitoring) */
.gauges { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 14px; }
.gauge-box { text-align: center; padding: 14px 10px 12px; border-radius: 14px; background: var(--surface-2); border: 1px solid var(--border); }
.gauge-box .g-title { font-weight: 600; font-size: 13px; color: var(--text-2); }
.gauge-box .g-sub { color: var(--muted); font-size: 12px; }

/* hardware info */
.hw-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.hw-item { padding: 11px 13px; border-radius: 12px; border: 1px solid var(--border); background: var(--surface-2); display: flex; gap: 11px; align-items: flex-start; min-width: 0; }
.hw-item .icon { color: var(--primary); margin-top: 2px; }
.hw-item .hw-label { font-size: 11.5px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.hw-item .hw-value { font-weight: 600; font-size: 13.5px; word-break: break-word; }
.chip { display: inline-flex; align-items: center; gap: 4px; padding: 1px 8px; border-radius: 99px; border: 1px solid var(--border); background: var(--surface); font-size: 12px; font-weight: 600; margin: 2px 4px 2px 0; }
.pill-type { display: inline-block; padding: 0 6px; border-radius: 5px; font: 700 10.5px var(--font); letter-spacing: .04em; background: var(--primary-soft); color: var(--primary); margin-right: 6px; }

/* quick tools (cPanel) */
.tool-section + .tool-section { margin-top: 18px; }
.tool-section .card-head h2 .icon { color: var(--text-2); }
.tools { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 6px; }
.tool {
  display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 12px; color: var(--text); font-weight: 500; font-size: 13.5px;
  border: 1px solid transparent; transition: background .15s, border-color .15s;
}
.tool:hover { background: var(--surface-2); border-color: var(--border); text-decoration: none; }
.tool .tile-icon { width: 38px; height: 38px; }
.tools.big { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 12px; }
.tools.big .tool { flex-direction: column; text-align: center; padding: 18px 10px; border-color: var(--border); background: var(--surface-2); }
.tools.big .tool:hover { border-color: var(--primary); transform: translateY(-1px); box-shadow: var(--shadow); }

/* info list */
.kv { display: grid; grid-template-columns: auto 1fr; gap: 0; }
.kv > div { padding: 9px 0; border-bottom: 1px dashed var(--border); font-size: 13px; }
.kv > div:nth-last-child(-n+2) { border-bottom: 0; }
.kv .k { color: var(--muted); padding-right: 16px; white-space: nowrap; }
.kv .v { font-weight: 600; text-align: right; word-break: break-all; }

/* timeline */
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { position: relative; padding: 0 0 14px 22px; font-size: 13px; }
.timeline li::before { content: ""; position: absolute; left: 4px; top: 6px; width: 8px; height: 8px; border-radius: 50%; background: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
.timeline li::after { content: ""; position: absolute; left: 7.5px; top: 18px; bottom: 0; width: 1px; background: var(--border); }
.timeline li:last-child::after { display: none; }
.timeline li.red::before { background: var(--danger); box-shadow: 0 0 0 3px var(--danger-soft); }
.timeline li.amber::before { background: var(--warning); box-shadow: 0 0 0 3px var(--warning-soft); }
.timeline .t-time { color: var(--muted); font-size: 11.5px; }

/* alerts list */
.alert-item { display: flex; gap: 12px; padding: 12px 18px; border-bottom: 1px solid var(--border); align-items: flex-start; color: var(--text); }
.alert-item:last-child { border-bottom: 0; }
.alert-item:hover { background: var(--surface-2); text-decoration: none; }
.alert-item .ai-icon { width: 32px; height: 32px; border-radius: 9px; display: grid; place-items: center; flex: none; }
.alert-item.danger .ai-icon { background: var(--danger-soft); color: var(--danger); }
.alert-item.warning .ai-icon { background: var(--warning-soft); color: var(--warning); }
.alert-item.info .ai-icon { background: var(--info-soft); color: var(--info); }
.alert-item .ai-title { font-weight: 600; font-size: 13.5px; }
.alert-item .ai-detail { color: var(--muted); font-size: 12.5px; }

/* services list */
.svc { display: flex; align-items: center; gap: 12px; padding: 12px 18px; border-bottom: 1px solid var(--border); }
.svc:last-child { border-bottom: 0; }
.svc .svc-name { font-weight: 600; }
.svc .svc-meta { color: var(--muted); font-size: 12px; }

/* ================= buttons & forms ================= */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px; height: 36px; padding: 0 14px;
  border-radius: 10px; border: 1px solid var(--border); background: var(--surface); color: var(--text);
  font: 550 13.5px var(--font); cursor: pointer; white-space: nowrap; text-decoration: none !important; transition: background .15s, border-color .15s, box-shadow .15s;
  box-shadow: var(--shadow-sm);
}
.btn:hover { background: var(--surface-2); border-color: var(--border-strong); }
.btn:focus-visible { outline: 0; box-shadow: 0 0 0 3px var(--primary-soft); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.primary { background: linear-gradient(180deg, #3b82f6, var(--primary)); border-color: var(--primary); color: #fff; box-shadow: 0 4px 12px -4px rgba(37, 99, 235, .55), inset 0 1px 0 rgba(255, 255, 255, .15); }
.btn.primary:hover { background: var(--primary-hover); }
.btn.success { background: var(--success); border-color: var(--success); color: #fff; }
.btn.danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn.warning { background: var(--warning); border-color: var(--warning); color: #fff; }
.btn.soft { background: var(--primary-soft); color: var(--primary); border-color: transparent; box-shadow: none; }
.btn.danger-ghost { color: var(--danger); }
.btn.danger-ghost:hover { background: var(--danger-soft); border-color: transparent; }
.btn.ghost { border-color: transparent; background: transparent; box-shadow: none; }
.btn.ghost:hover { background: var(--surface-3); }
.btn.sm { height: 30px; padding: 0 10px; font-size: 12.5px; border-radius: 8px; }
.btn.xs { height: 24px; padding: 0 8px; font-size: 12px; border-radius: 7px; }
.btn.icon-only { width: 36px; padding: 0; }
.btn.sm.icon-only { width: 30px; }
.btn-group { display: inline-flex; gap: 4px; }
.seg { display: inline-flex; padding: 3px; border-radius: 10px; background: var(--surface-3); gap: 2px; }
.seg button { border: 0; background: transparent; padding: 5px 12px; border-radius: 8px; font: 550 12.5px var(--font); color: var(--muted); cursor: pointer; display: inline-flex; align-items: center; gap: 6px; }
.seg button.active { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); }
.seg button .n { font-size: 11px; color: var(--muted); }

.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.field label { font-weight: 600; font-size: 13px; color: var(--text-2); }
.field .hint { color: var(--muted); font-size: 12px; }
.input, select.input, textarea.input {
  width: 100%; height: 38px; padding: 0 12px; border-radius: 10px; border: 1px solid var(--border);
  background: var(--surface); color: var(--text); font: 14px var(--font); outline: none; transition: border-color .15s, box-shadow .15s;
}
select.input { appearance: none; padding-right: 32px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2.5'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 11px center; }
.input.sm { height: 32px; font-size: 13px; border-radius: 8px; }
textarea.input { height: auto; padding: 10px 12px; resize: vertical; font-family: var(--mono); font-size: 12.5px; }
.input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
.input-icon { position: relative; }
.input-icon .icon { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
.input-icon .input { padding-left: 36px; }
.input-group { display: flex; align-items: stretch; }
.input-group .addon { display: flex; align-items: center; padding: 0 11px; border: 1px solid var(--border); background: var(--surface-2); color: var(--muted); font-size: 13px; font-family: var(--mono); }
.input-group .addon:first-child { border-radius: 10px 0 0 10px; border-right: 0; }
.input-group .addon:last-child { border-radius: 0 10px 10px 0; border-left: 0; }
.input-group > .btn { border-radius: 0; box-shadow: none; }
.input-group > .btn:last-child { border-radius: 0 10px 10px 0; }
.input-group > .btn + .btn { border-left: 0; }
.input-group .input:not(:first-child) { border-top-left-radius: 0; border-bottom-left-radius: 0; }
.input-group .input:not(:last-child) { border-top-right-radius: 0; border-bottom-right-radius: 0; }
.check { display: flex; align-items: center; gap: 9px; cursor: pointer; margin-bottom: 10px; }
.check input { width: 16px; height: 16px; accent-color: var(--primary); }
.form-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; }

.switch { position: relative; width: 40px; height: 23px; flex: none; cursor: pointer; display: inline-block; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch span { position: absolute; inset: 0; background: var(--border-strong); border-radius: 99px; transition: .2s; }
.switch span::before { content: ""; position: absolute; width: 17px; height: 17px; left: 3px; top: 3px; background: #fff; border-radius: 50%; transition: .2s; box-shadow: 0 1px 3px rgba(0, 0, 0, .2); }
.switch input:checked + span { background: var(--success); }
.switch input:checked + span::before { transform: translateX(17px); }
.switch input:disabled + span { opacity: .5; }

/* ================= tables ================= */
.table-wrap { overflow-x: auto; }
table.table { width: 100%; border-collapse: collapse; }
.table th { text-align: left; font-weight: 600; color: var(--muted); font-size: 11.5px; text-transform: uppercase; letter-spacing: .05em; padding: 11px 16px; border-bottom: 1px solid var(--border); background: var(--surface-2); white-space: nowrap; }
.table th:first-child { border-top-left-radius: var(--radius); }
.table th:last-child { border-top-right-radius: var(--radius); }
.table td { padding: 12px 16px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr { transition: background .1s; }
.table tbody tr:hover { background: var(--surface-2); }
.table .actions { text-align: right; white-space: nowrap; }
.table .row-actions { opacity: .55; transition: opacity .15s; }
.table tr:hover .row-actions { opacity: 1; }
.table .clickable { cursor: pointer; }
.table .sel { width: 40px; }
.table tr.selected { background: var(--primary-soft) !important; }
.table.compact td { padding: 8px 16px; }

.avatar { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; font-weight: 700; font-size: 14px; text-transform: uppercase; flex: none; color: #fff; }
.avatar.round { border-radius: 50%; }
.avatar.sm { width: 28px; height: 28px; font-size: 12px; border-radius: 8px; }
.cell-main { display: flex; align-items: center; gap: 12px; min-width: 0; }
.cell-main b { display: block; font-weight: 600; }
.cell-main .muted { font-size: 12px; }

.badge { display: inline-flex; align-items: center; gap: 5px; height: 23px; padding: 0 9px; border-radius: 99px; font-size: 12px; font-weight: 600; background: var(--surface-3); color: var(--muted); white-space: nowrap; }
.badge .icon { width: 13px; height: 13px; }
.badge.green { background: var(--success-soft); color: var(--success); }
.badge.amber { background: var(--warning-soft); color: var(--warning); }
.badge.red { background: var(--danger-soft); color: var(--danger); }
.badge.blue { background: var(--primary-soft); color: var(--primary); }
.badge.cyan { background: var(--info-soft); color: var(--info); }
.badge.violet { background: var(--violet-soft); color: var(--violet); }
.badge.outline { background: transparent; border: 1px solid var(--border); }
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; background: var(--muted); flex: none; }
.dot.green { background: var(--success); box-shadow: 0 0 0 3px var(--success-soft); }
.dot.red { background: var(--danger); box-shadow: 0 0 0 3px var(--danger-soft); }
.dot.amber { background: var(--warning); box-shadow: 0 0 0 3px var(--warning-soft); }
.dot.pulse { animation: pulse 2s infinite; }
@keyframes pulse { 50% { box-shadow: 0 0 0 6px transparent; } }

.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.xsmall { font-size: 11.5px; }
.bold { font-weight: 600; }
.nowrap { white-space: nowrap; }
.right { text-align: right; }
.center { text-align: center; }
.row { display: flex; align-items: center; gap: 8px; }
.row.wrap { flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.col { display: flex; flex-direction: column; gap: 4px; }
.grow { flex: 1; min-width: 0; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mt { margin-top: 18px; }
.mt-sm { margin-top: 10px; }
.mb { margin-bottom: 18px; }
.mb-sm { margin-bottom: 10px; }
.sep { height: 1px; background: var(--border); margin: 18px 0; }
.text-green { color: var(--success); }
.text-red { color: var(--danger); }
.text-amber { color: var(--warning); }

.empty { padding: 52px 20px; text-align: center; color: var(--muted); }
.empty .empty-icon { width: 64px; height: 64px; margin: 0 auto 14px; border-radius: 18px; display: grid; place-items: center; background: var(--surface-3); color: var(--muted); }
.empty .empty-icon .icon { width: 28px; height: 28px; }
.empty .empty-title { font-weight: 600; color: var(--text-2); font-size: 15px; }
.alert { display: flex; gap: 11px; padding: 12px 15px; border-radius: 12px; background: var(--primary-soft); color: var(--text); margin-bottom: 16px; align-items: flex-start; border: 1px solid transparent; }
.alert .icon { color: var(--primary); margin-top: 1px; }
.alert.warn { background: var(--warning-soft); }
.alert.warn .icon { color: var(--warning); }
.alert.error { background: var(--danger-soft); }
.alert.error .icon { color: var(--danger); }
.alert.success { background: var(--success-soft); }
.alert.success .icon { color: var(--success); }
pre.log { margin: 0; padding: 14px 16px; background: var(--code-bg); color: var(--code-text); border-radius: 0 0 var(--radius) var(--radius); max-height: 560px; overflow: auto; white-space: pre-wrap; word-break: break-all; font-size: 12px; line-height: 1.6; }
pre.output { white-space: pre-wrap; background: var(--surface-2); border: 1px solid var(--border); border-radius: 10px; padding: 12px; max-height: 260px; overflow: auto; margin: 0; }

/* tabs */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 18px; overflow-x: auto; }
.tabs button { background: none; border: 0; padding: 11px 14px; color: var(--muted); font: 600 13.5px var(--font); cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; display: inline-flex; gap: 7px; align-items: center; }
.tabs button:hover { color: var(--text); }
.tabs button.active { color: var(--primary); border-bottom-color: var(--primary); }
.card > .tabs { padding: 0 12px; margin-bottom: 0; }

/* code editor */
.editor { display: flex; border: 1px solid var(--border); border-radius: 12px; overflow: hidden; background: var(--code-bg); }
.editor .gutter { padding: 12px 8px; text-align: right; color: #4b5b75; user-select: none; font: 12.5px/1.6 var(--mono); min-width: 48px; overflow: hidden; background: rgba(255, 255, 255, .02); border-right: 1px solid rgba(255, 255, 255, .05); }
.editor textarea { flex: 1; border: 0; outline: none; resize: none; padding: 12px 14px; background: transparent; color: var(--code-text); font: 12.5px/1.6 var(--mono); white-space: pre; tab-size: 4; overflow: auto; }

/* dropdown */
.dropdown { position: relative; display: inline-block; }
.dropdown-menu { position: fixed; min-width: 210px; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; box-shadow: var(--shadow-lg); padding: 6px; z-index: 160; animation: pop .12s ease-out; }
.dropdown-menu.wide { min-width: 360px; padding: 0; }
.dropdown-menu .dm-head { padding: 12px 14px; border-bottom: 1px solid var(--border); font-weight: 600; }
.dropdown-menu button, .dropdown-menu a { display: flex; width: 100%; align-items: center; gap: 10px; padding: 8px 10px; border: 0; background: none; border-radius: 8px; color: var(--text); font: 500 13.5px var(--font); cursor: pointer; text-align: left; text-decoration: none; }
.dropdown-menu button:hover, .dropdown-menu a:hover { background: var(--surface-3); }
.dropdown-menu .danger { color: var(--danger); }
.dropdown-menu hr { border: 0; border-top: 1px solid var(--border); margin: 6px 0; }
@keyframes pop { from { opacity: 0; transform: translateY(-4px) scale(.98); } }

/* modal */
.modal-backdrop { position: fixed; inset: 0; background: rgba(8, 14, 26, .55); backdrop-filter: blur(3px); display: flex; align-items: flex-start; justify-content: center; padding: 6vh 16px; z-index: 100; overflow-y: auto; animation: fadein .15s; }
@keyframes fadein { from { opacity: 0; } }
.modal { background: var(--surface); border-radius: 16px; width: 100%; max-width: 540px; box-shadow: var(--shadow-lg); animation: pop .18s ease-out; border: 1px solid var(--border); }
.modal.wide { max-width: 780px; }
.modal.xwide { max-width: 1140px; }
.modal-head { display: flex; align-items: center; gap: 12px; padding: 16px 20px; border-bottom: 1px solid var(--border); }
.modal-head h2 { flex: 1; font-size: 16px; }
.modal-body { padding: 20px; }
.modal-foot { display: flex; justify-content: flex-end; align-items: center; gap: 8px; padding: 14px 20px; border-top: 1px solid var(--border); background: var(--surface-2); border-radius: 0 0 16px 16px; }

/* command palette */
.palette { position: fixed; inset: 0; background: rgba(8, 14, 26, .5); backdrop-filter: blur(3px); z-index: 150; display: flex; justify-content: center; padding-top: 12vh; animation: fadein .12s; }
.palette-box { width: 100%; max-width: 620px; margin: 0 16px; background: var(--surface); border-radius: 16px; box-shadow: var(--shadow-lg); border: 1px solid var(--border); overflow: hidden; align-self: flex-start; animation: pop .15s; }
.palette-input { display: flex; align-items: center; gap: 10px; padding: 0 16px; border-bottom: 1px solid var(--border); }
.palette-input input { flex: 1; height: 54px; border: 0; outline: 0; background: transparent; color: var(--text); font: 16px var(--font); }
.palette-list { max-height: 420px; overflow-y: auto; padding: 6px; }
.palette-group { padding: 8px 10px 4px; font-size: 11px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
.palette-item { display: flex; align-items: center; gap: 12px; padding: 9px 10px; border-radius: 10px; cursor: pointer; }
.palette-item.active { background: var(--primary-soft); }
.palette-item .icon { color: var(--muted); }
.palette-item.active .icon { color: var(--primary); }
.palette-item small { color: var(--muted); margin-left: auto; }

/* toast */
.toasts { position: fixed; right: 22px; bottom: 22px; display: flex; flex-direction: column; gap: 10px; z-index: 200; max-width: min(420px, calc(100vw - 44px)); }
.toast { display: flex; gap: 11px; padding: 13px 15px; border-radius: 12px; background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow-lg); animation: slide .2s ease-out; white-space: pre-wrap; word-break: break-word; font-weight: 500; }
.toast.success { border-left: 4px solid var(--success); }
.toast.success .icon { color: var(--success); }
.toast.error { border-left: 4px solid var(--danger); }
.toast.error .icon { color: var(--danger); }
@keyframes slide { from { transform: translateX(20px); opacity: 0; } }

.spinner { width: 18px; height: 18px; border: 2px solid var(--border); border-top-color: var(--primary); border-radius: 50%; animation: spin .7s linear infinite; display: inline-block; flex: none; }
.btn .spinner { width: 14px; height: 14px; border-color: rgba(255, 255, 255, .4); border-top-color: #fff; }
.btn:not(.primary):not(.danger) .spinner { border-color: var(--border); border-top-color: var(--primary); }
.loading-block { display: flex; justify-content: center; padding: 48px; }
@keyframes spin { to { transform: rotate(360deg); } }
.skeleton { background: linear-gradient(90deg, var(--surface-3) 25%, var(--surface-2) 50%, var(--surface-3) 75%); background-size: 200% 100%; animation: shimmer 1.2s infinite; border-radius: 8px; }
@keyframes shimmer { to { background-position: -200% 0; } }

/* file manager */
.fm { display: grid; grid-template-columns: 230px minmax(0, 1fr); gap: 18px; }
.fm-side .card-body { padding: 8px; }
.fm-side a { display: flex; align-items: center; gap: 9px; padding: 7px 10px; border-radius: 8px; color: var(--text-2); font-size: 13px; font-weight: 500; text-decoration: none; }
.fm-side a:hover { background: var(--surface-3); }
.fm-side a .icon { color: #eab308; }
.fm-side .side-title { padding: 10px 10px 4px; font-size: 11px; color: var(--muted); font-weight: 700; text-transform: uppercase; letter-spacing: .06em; }
.breadcrumbs { display: flex; align-items: center; gap: 2px; flex-wrap: wrap; font-size: 13.5px; }
.breadcrumbs button { background: none; border: 0; color: var(--text-2); cursor: pointer; padding: 3px 6px; border-radius: 6px; font: 500 13.5px var(--font); display: inline-flex; align-items: center; }
.breadcrumbs button:hover { background: var(--primary-soft); color: var(--primary); }
.breadcrumbs button:last-child { color: var(--text); font-weight: 650; }
.file-name { display: flex; align-items: center; gap: 10px; }
.file-name .ficon { width: 30px; height: 30px; border-radius: 8px; display: grid; place-items: center; background: var(--surface-3); color: var(--muted); flex: none; }
.file-name .ficon.dir { background: #fef3c7; color: #d97706; }
:root[data-theme="dark"] .file-name .ficon.dir { background: #3a2a07; color: #fbbf24; }
.file-name .ficon.code { background: var(--violet-soft); color: var(--violet); }
.file-name .ficon.img { background: var(--pink-soft); color: var(--pink); }
.file-name .ficon.zip { background: var(--warning-soft); color: var(--warning); }
.file-name .ficon.link { background: var(--info-soft); color: var(--info); }
.file-name a { color: var(--text); font-weight: 500; }
.file-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: 8px; padding: 14px; }
.file-tile { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 14px 8px 10px; border-radius: 12px; border: 1px solid transparent; cursor: pointer; text-align: center; font-size: 12.5px; word-break: break-all; user-select: none; }
.file-tile:hover { background: var(--surface-2); border-color: var(--border); }
.file-tile.selected { background: var(--primary-soft); border-color: var(--primary); }
.file-tile .ficon { width: 48px; height: 48px; border-radius: 12px; }
.file-tile .ficon .icon { width: 24px; height: 24px; }
.toolbar { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; padding: 10px 14px; border-bottom: 1px solid var(--border); }
.toolbar .vsep { width: 1px; height: 22px; background: var(--border); margin: 0 4px; }
.ctx-menu { position: fixed; z-index: 120; }
.dragging { outline: 2px dashed var(--primary); outline-offset: -6px; background: var(--primary-soft); }

/* login */
.login-wrap { min-height: 100vh; display: grid; grid-template-columns: 1.1fr 1fr; background: var(--surface); }
.login-art { position: relative; overflow: hidden; color: #fff; padding: 48px; display: flex; flex-direction: column; justify-content: space-between;
  background: radial-gradient(800px 500px at 0% 0%, #2563eb 0, transparent 60%), radial-gradient(700px 500px at 100% 100%, #0891b2 0, transparent 55%), linear-gradient(135deg, #0b1424, #111d38); }
.login-art h1 { font-size: 34px; line-height: 1.2; max-width: 460px; }
.login-art p { opacity: .75; max-width: 440px; font-size: 15px; }
.login-art .feat { display: flex; gap: 12px; align-items: center; margin: 12px 0; font-size: 14.5px; }
.login-art .feat .tile-icon { background: rgba(255, 255, 255, .1); color: #93c5fd; }
.login-art .grid-bg { position: absolute; inset: 0; background-image: linear-gradient(rgba(255, 255, 255, .04) 1px, transparent 1px), linear-gradient(90deg, rgba(255, 255, 255, .04) 1px, transparent 1px); background-size: 40px 40px; mask-image: radial-gradient(circle at 30% 40%, #000, transparent 70%); pointer-events: none; }
.login-side { display: grid; place-items: center; padding: 32px 20px; }
.login-card { width: 100%; max-width: 380px; }
.login-card h2 { font-size: 24px; margin-bottom: 6px; }
.login-card .brand { padding: 0 0 28px; color: var(--text); font-size: 18px; }

/* charts */
.apexcharts-tooltip { box-shadow: var(--shadow-lg) !important; border-radius: 10px !important; }
.apexcharts-tooltip.apexcharts-theme-light { background: var(--surface) !important; border-color: var(--border) !important; color: var(--text); }
.apexcharts-tooltip-title { background: var(--surface-2) !important; border-color: var(--border) !important; font-family: var(--font) !important; }
.apexcharts-xaxistooltip { display: none; }
.chart-legend { display: flex; gap: 16px; flex-wrap: wrap; }
.chart-legend .lg { display: flex; flex-direction: column; }
.chart-legend .lg span { font-size: 12px; color: var(--muted); display: flex; align-items: center; gap: 6px; }
.chart-legend .lg span i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
.chart-legend .lg b { font-size: 17px; font-weight: 700; }

/* responsive */
@media (max-width: 1200px) {
  .grid.cols-5 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .grid.cols-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid.side { grid-template-columns: minmax(0, 1fr); }
  .search-trigger { width: 200px; }
}
@media (max-width: 900px) {
  .login-wrap { grid-template-columns: 1fr; }
  .login-art { display: none; }
  .fm { grid-template-columns: 1fr; }
  .fm-side { display: none; }
}
@media (max-width: 820px) {
  .sidebar { position: fixed; left: 0; top: 0; transform: translateX(-100%); transition: transform .2s; width: var(--sidebar-w) !important; }
  .sidebar.open { transform: none; box-shadow: 0 0 60px rgba(0, 0, 0, .5); }
  .layout.collapsed .brand div, .layout.collapsed .nav-group, .layout.collapsed .nav a span, .layout.collapsed .server-chip { display: revert; }
  .menu-btn { display: inline-grid !important; }
  .content { padding: 18px 16px 32px; }
  .topbar { padding: 0 12px; }
  .search-trigger { width: auto; }
  .search-trigger span, .search-trigger .kbd { display: none; }
  .grid.cols-2, .grid.cols-3, .grid.cols-4, .grid.cols-5 { grid-template-columns: minmax(0, 1fr); }
  .span-2 { grid-column: auto; }
  .hw-list { grid-template-columns: 1fr; }
  .hide-sm { display: none !important; }
  .hero .hero-actions { position: static; margin-top: 14px; }
}

/* ================= File manager (toàn màn hình, chỉ cuộn trong card) ================= */
.content.fill { max-width: none; padding: 16px 20px; height: calc(100vh - 62px); display: flex; flex-direction: column; }
.layout:has(.impersonate-bar) .content.fill { height: calc(100vh - 62px - 40px); }
.fmx { flex: 1; min-height: 0; display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; position: relative; }
.fmx-head { display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.fmx-head .ttl { display: flex; align-items: center; gap: 10px; font-weight: 650; font-size: 15px; margin-right: 6px; }
.fmx-head .ttl .ph-icon { width: 32px; height: 32px; border-radius: 9px; display: grid; place-items: center; color: #fff; background: linear-gradient(135deg, var(--primary), var(--primary-2)); }
.fmx-path { flex: 1; min-width: 220px; display: flex; align-items: center; height: 34px; border: 1px solid var(--border); border-radius: 9px; background: var(--surface-2); padding: 0 4px; overflow: hidden; }
.fmx-path input { flex: 1; border: 0; background: transparent; outline: 0; font: 13px var(--mono); color: var(--text); padding: 0 8px; }
.fmx-path .breadcrumbs { flex: 1; flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; cursor: text; }
.fmx-path .breadcrumbs button { white-space: nowrap; }
.fmx-tools { display: flex; align-items: center; gap: 4px; padding: 8px 14px; border-bottom: 1px solid var(--border); flex-wrap: wrap; background: var(--surface-2); }
.fmx-tools .vsep { width: 1px; height: 22px; background: var(--border); margin: 0 6px; }
.fmx-body { flex: 1; min-height: 0; display: flex; }
.fmx-side { width: 230px; flex: none; border-right: 1px solid var(--border); overflow-y: auto; padding: 8px; background: var(--surface-2); }
.fmx-side a { display: flex; align-items: center; gap: 9px; padding: 6px 10px; border-radius: 8px; color: var(--text-2); font-size: 13px; font-weight: 500; text-decoration: none; }
.fmx-side a:hover { background: var(--surface-3); }
.fmx-side a.on { background: var(--primary-soft); color: var(--primary); }
.fmx-side a.drop { outline: 2px dashed var(--primary); }
.fmx-side .side-title { padding: 12px 10px 4px; font-size: 10.5px; color: var(--muted); font-weight: 700; text-transform: uppercase; letter-spacing: .07em; }
.fmx-main { flex: 1; min-width: 0; overflow: auto; position: relative; outline: 0; }
.fmx-main .table th { position: sticky; top: 0; z-index: 2; cursor: pointer; user-select: none; }
.fmx-main .table th:first-child, .fmx-main .table th:last-child { border-radius: 0; }
.fmx-main .table th .icon { width: 12px; height: 12px; vertical-align: -1px; }
.fmx-main .table td { padding-top: 7px; padding-bottom: 7px; }
.fmx-main .table tr { user-select: none; }
.fmx-main .table tr.drop-target td { background: var(--primary-soft); box-shadow: inset 0 0 0 2px var(--primary); }
.fmx-main .table tr.cut { opacity: .5; }
.fmx-main .file-name a { color: var(--text); }
.fmx-main .file-name .hidden-file { opacity: .6; }
.fmx-foot { display: flex; align-items: center; gap: 14px; padding: 7px 14px; border-top: 1px solid var(--border); background: var(--surface-2); font-size: 12px; color: var(--muted); }
.fmx-drop { position: absolute; inset: 0; z-index: 30; background: color-mix(in srgb, var(--primary) 12%, transparent); border: 3px dashed var(--primary); border-radius: var(--radius); display: grid; place-items: center; pointer-events: none; }
.fmx-drop div { background: var(--surface); padding: 18px 26px; border-radius: 14px; box-shadow: var(--shadow-lg); font-weight: 600; display: flex; gap: 10px; align-items: center; }
.fmx-search-bar { display: flex; align-items: center; gap: 8px; padding: 8px 14px; background: var(--primary-soft); border-bottom: 1px solid var(--border); font-size: 13px; }

/* hàng đợi upload */
.upq { position: absolute; right: 16px; bottom: 44px; width: 400px; max-width: calc(100% - 32px); z-index: 40; background: var(--surface); border: 1px solid var(--border); border-radius: 14px; box-shadow: var(--shadow-lg); overflow: hidden; display: flex; flex-direction: column; max-height: 60%; }
.upq-head { display: flex; align-items: center; gap: 8px; padding: 10px 12px; border-bottom: 1px solid var(--border); font-weight: 600; font-size: 13.5px; }
.upq-total { padding: 8px 12px; border-bottom: 1px solid var(--border); font-size: 12px; }
.upq-list { overflow-y: auto; }
.upq-item { padding: 8px 12px; border-bottom: 1px solid var(--border); font-size: 12.5px; }
.upq-item:last-child { border-bottom: 0; }
.upq-item .row { gap: 6px; }
.upq-item .nm { font-weight: 600; }
.upq-item .meta { color: var(--muted); font-size: 11.5px; }
.upq-item .meter { margin-top: 5px; height: 5px; }
.upq-item.done .meter > div { background: var(--success); }
.upq-item.error .meter > div { background: var(--danger); }

/* preview */
.pv { display: grid; place-items: center; min-height: 300px; background: repeating-conic-gradient(var(--surface-3) 0 25%, var(--surface) 0 50%) 0 / 20px 20px; border-radius: 10px; overflow: hidden; }
.pv img, .pv video { max-width: 100%; max-height: 70vh; display: block; }
.pv iframe { width: 100%; height: 72vh; border: 0; background: #fff; }

/* chmod grid */
.perm-grid { display: grid; grid-template-columns: 110px repeat(3, 1fr); gap: 0; border: 1px solid var(--border); border-radius: 10px; overflow: hidden; }
.perm-grid > div { padding: 9px 12px; border-bottom: 1px solid var(--border); display: flex; align-items: center; gap: 6px; }
.perm-grid > div:nth-last-child(-n+4) { border-bottom: 0; }
.perm-grid .h { font-weight: 600; background: var(--surface-2); font-size: 12.5px; }

.editor.tall { height: 68vh !important; }
@media (max-width: 900px) { .fmx-side { display: none; } .upq { width: auto; left: 16px; } }

.editor.wrap textarea { white-space: pre-wrap; word-break: break-all; }
.editor.wrap .gutter { display: none; }
@media (max-width: 1640px) { .fmx-tools .lbl { display: none; } }
.ctx-menu { max-height: calc(100vh - 16px); overflow-y: auto; }

/* ================= Điện thoại (≤ 640px) ================= */
@media (max-width: 640px) {
  .content { padding: 14px 12px 28px; }
  .content.fill { padding: 8px; height: calc(100vh - 62px); height: calc(100dvh - 62px); }
  .layout:has(.impersonate-bar) .content.fill { height: calc(100dvh - 62px - 40px); }
  .topbar { gap: 4px; }
  .impersonate-bar { font-size: 12.5px; flex-wrap: wrap; }

  /* tiêu đề trang */
  .page-head { gap: 12px; margin-bottom: 16px; }
  .page-head .ph-icon { width: 38px; height: 38px; border-radius: 11px; }
  .page-head .ph-icon .icon { width: 19px; height: 19px; }
  .page-head .titles { min-width: 0; flex: 1 1 calc(100% - 60px); }
  .page-head h1 { font-size: 19px; }
  .page-head p { font-size: 12.5px; }
  .page-head .actions { width: 100%; }
  .page-head .actions > .btn.primary:last-child { margin-left: auto; }

  /* thẻ số liệu: 2 cột */
  .grid.cols-3:has(> .kpi), .grid.cols-4:has(> .kpi), .grid.cols-5:has(> .kpi) { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .kpi { padding: 12px 13px; gap: 8px; }
  .kpi .kpi-value { font-size: 20px; }
  .kpi .kpi-top { gap: 9px; }
  .kpi .tile-icon { width: 32px; height: 32px; border-radius: 10px; }
  .kpi .tile-icon .icon { width: 16px; height: 16px; }
  .kpi .spark { margin: -4px -13px -12px; }

  .card-head { flex-wrap: wrap; padding: 12px 14px; min-height: 0; }
  .card-body { padding: 14px; }
  .toolbar { padding: 10px 12px; }
  .toolbar .input-icon, .toolbar form.input-icon { width: 100% !important; flex: 1 1 100%; }
  .seg { max-width: 100%; overflow-x: auto; scrollbar-width: none; }
  .seg button { white-space: nowrap; flex: none; }
  .tabs { margin-bottom: 14px; scrollbar-width: none; }
  .tabs button { padding: 10px 11px; font-size: 13px; }
  .form-row { grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); }

  /* iOS phóng to khi focus ô nhập < 16px */
  .input, select.input, textarea.input, .input.sm, .fmx-path input { font-size: 16px; }

  /* bảng → thẻ */
  .table[data-cards] thead { display: none; }
  .table[data-cards], .table[data-cards] tbody { display: block; width: 100%; }
  .table[data-cards] tr { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px; padding: 12px 14px; border-bottom: 1px solid var(--border); }
  .table[data-cards] tbody tr:last-child { border-bottom: 0; }
  .table[data-cards] td { display: block; padding: 0; border: 0; min-width: 0; text-align: left; }
  .table[data-cards] td[data-main] { flex: 1 1 calc(100% - 48px); }
  .table[data-cards] td.sel { flex: none; width: auto; }
  .table[data-cards] td[data-full] { flex: 1 1 100%; }
  .table[data-cards] td[data-label]:not([data-label=""]):not([data-main])::before { content: attr(data-label); display: block; font-size: 10.5px; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); margin-bottom: 3px; }
  .table[data-cards] td.actions { flex: 1 1 100%; display: flex; justify-content: flex-end; align-items: center; gap: 6px; flex-wrap: wrap; }
  .table[data-cards] td.actions::before { display: none !important; }
  .table[data-cards] td:empty, .table[data-cards] td[data-empty] { display: none; }
  .table[data-cards] .row-actions { opacity: 1; }
  .table[data-cards] .truncate { max-width: calc(100vw - 120px) !important; }

  /* hộp thoại dạng bottom sheet */
  .modal-backdrop { padding: 0; align-items: flex-end; }
  .modal, .modal.wide, .modal.xwide { max-width: none; border-radius: 18px 18px 0 0; max-height: 94vh; max-height: 94dvh; display: flex; flex-direction: column; border-bottom: 0; }
  .modal-head { padding: 12px 16px; }
  .modal-body { padding: 16px; overflow-y: auto; flex: 1; min-height: 0; -webkit-overflow-scrolling: touch; }
  .modal-foot { padding: 12px 16px calc(12px + env(safe-area-inset-bottom)); border-radius: 0; flex-wrap: wrap; }
  .modal-foot .btn { flex: 1 1 auto; justify-content: center; }

  .dropdown-menu.wide { min-width: 0; }
  .dropdown-menu button, .dropdown-menu a { padding: 11px 12px; font-size: 14.5px; }
  .toasts { left: 12px; right: 12px; bottom: calc(12px + env(safe-area-inset-bottom)); max-width: none; }

  /* quản lý file */
  .fmx-head { padding: 8px 10px; gap: 8px; }
  .fmx-head .ttl { display: none; }
  .fmx-path { order: 5; flex: 1 1 100%; min-width: 0; }
  .fmx-head form.input-icon { width: auto !important; flex: 1 1 140px; }
  .fmx-head .account-picker, .fmx-head > select, .fmx-head > .dropdown { flex: 1 1 140px; }
  .fmx-tools { flex-wrap: nowrap; overflow-x: auto; padding: 6px 10px; scrollbar-width: none; }
  .fmx-tools > * { flex: none; }
  .fmx-tools .grow { display: none; }
  .fmx-tools .input-icon { width: 130px !important; }
  .fmx-main .table td { padding-top: 10px; padding-bottom: 10px; }
  .fmx-main .table th, .fmx-main .table td { padding-left: 8px; padding-right: 8px; }
  .fmx-foot { gap: 8px; flex-wrap: wrap; }
  .upq { left: 8px; right: 8px; width: auto; bottom: 40px; }
  .editor.tall { height: 60vh !important; }
  .pv iframe { height: 60vh; }
}
@media (hover: none) {
  .table .row-actions { opacity: 1; }
}
.sidebar-backdrop { display: none; }
@media (max-width: 820px) {
  .sidebar { z-index: 120; }
  .sidebar-backdrop { display: block; position: fixed; inset: 0; z-index: 110; background: rgba(8, 14, 26, .5); backdrop-filter: blur(2px); animation: fadein .15s; }
}
@media (max-width: 640px) {
  .gauges { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; gap: 10px; }
  .gauge-box { padding: 10px 6px; }
  .hero { padding: 18px; }
  .hero .hero-stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px 10px; }
}
.login-brand { display: none; align-items: center; gap: 10px; margin-bottom: 28px; font-size: 17px; }
@media (max-width: 900px) {
  .login-brand { display: flex; }
  .login-side { align-items: flex-start; padding-top: max(12vh, 40px); }
}

/* Sidebar khu vực Proxy VPS */
.back-link { display: flex; align-items: center; gap: 9px; margin: 0 14px 10px; padding: 8px 12px; border-radius: 10px; color: var(--sidebar-muted); font-size: 13px; font-weight: 600; text-decoration: none; border: 1px dashed rgba(255, 255, 255, .14); }
.back-link:hover { color: #fff; background: rgba(255, 255, 255, .06); border-style: solid; }
.vps-chip { background: linear-gradient(135deg, rgba(14, 165, 233, .16), rgba(124, 58, 237, .14)); border-color: rgba(56, 189, 248, .25); }
.vps-chip .vps-title { gap: 7px; color: #e2e8f0; margin-bottom: 6px; justify-content: flex-start; }
.vps-chip .vps-title .icon { color: #38bdf8; }
.layout.collapsed .back-link span { display: none; }
.layout.collapsed .back-link { justify-content: center; padding: 8px 0; }
.layout.collapsed .vps-chip { display: none; }
@media (max-width: 820px) {
  .layout.collapsed .back-link span { display: revert; }
  .layout.collapsed .vps-chip { display: block; }
}
