/* FF.Dev Xray Pro — refined control-plane interface */

/* ============================================================
   DESIGN TOKENS
   ============================================================ */
:root {
  color-scheme: dark;

  --bg: #090b0d;
  --bg-elevated: #0d1013;
  --sidebar-bg: #0c0f12;
  --topbar-bg: rgba(9, 11, 13, .88);
  --modal-header-bg: rgba(17, 21, 25, .94);
  --login-intro-bg: linear-gradient(145deg, rgba(103, 226, 178, .075), transparent 43%), linear-gradient(180deg, #101519 0%, #0c1013 100%);
  --surface: #111519;
  --surface-2: #151a1f;
  --surface-3: #1a2026;
  --surface-hover: #14191e;
  --subtle-surface: rgba(255, 255, 255, .018);
  --subtle-row: rgba(0, 0, 0, .12);
  --code-bg: rgba(4, 7, 8, .38);
  --overlay: rgba(4, 6, 8, .78);

  --border: rgba(235, 245, 241, .075);
  --divider: rgba(235, 245, 241, .055);
  --border-strong: rgba(235, 245, 241, .13);
  --border-focus: rgba(103, 226, 178, .72);
  --scrollbar-thumb: rgba(255, 255, 255, .11);
  --scrollbar-thumb-hover: rgba(255, 255, 255, .19);

  --text: #f0f4f2;
  --text-soft: #c4ceca;
  --text-muted: #89948f;
  --text-dim: #5f6965;

  --accent: #67e2b2;
  --accent-hover: #7ce9be;
  --accent-ink: #07140f;
  --accent-soft: rgba(103, 226, 178, .105);
  --accent-border: rgba(103, 226, 178, .28);

  --green: #67e2b2;
  --green-soft: rgba(103, 226, 178, .10);
  --yellow: #f2c66d;
  --yellow-soft: rgba(242, 198, 109, .105);
  --red: #f18a8a;
  --red-soft: rgba(241, 138, 138, .105);
  --blue: #78aef8;
  --blue-soft: rgba(120, 174, 248, .11);
  --violet: #ab9df2;
  --violet-soft: rgba(171, 157, 242, .11);

  --chart-grid: rgba(255, 255, 255, .055);
  --chart-label: rgba(240, 244, 242, .45);
  --chart-stroke: #67e2b2;
  --chart-fill-top: rgba(103, 226, 178, .26);
  --chart-fill-bottom: rgba(103, 226, 178, .01);

  --font-sans: "Plus Jakarta Sans", Inter, "Inter Variable", ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-mono: "JetBrains Mono", "SFMono-Regular", "Cascadia Code", "Roboto Mono", Consolas, monospace;

  --text-xs: 11px;
  --text-sm: 12px;
  --text-base: 14px;
  --text-md: 15px;
  --text-lg: 17px;
  --text-xl: 21px;
  --text-2xl: 28px;
  --text-3xl: 38px;

  --sp-1: 4px;
  --sp-2: 8px;
  --sp-3: 12px;
  --sp-4: 16px;
  --sp-5: 20px;
  --sp-6: 24px;
  --sp-7: 28px;
  --sp-8: 32px;
  --sp-10: 40px;
  --sp-12: 48px;

  --r-xs: 6px;
  --r-sm: 9px;
  --r-md: 12px;
  --r-lg: 16px;
  --r-xl: 22px;
  --r-full: 999px;

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .22);
  --shadow-md: 0 14px 38px -24px rgba(0, 0, 0, .86);
  --shadow-lg: 0 28px 80px -32px rgba(0, 0, 0, .88);
  --shadow-accent: 0 10px 24px -16px rgba(103, 226, 178, .55);
  --card-hover-shadow: 0 10px 28px -18px rgba(0, 0, 0, .75), 0 0 0 1px rgba(103, 226, 178, .12);

  --sidebar-w: 236px;
  --sidebar-w-compact: 72px;
  --topbar-h: 60px;
  --content-max: 1560px;

  --ease: cubic-bezier(.16, 1, .3, 1);
  --dur-fast: 140ms;
  --dur: 190ms;
}

:root[data-theme="light"] {
  color-scheme: light;

  --bg: #f3f5f8;
  --bg-elevated: #f8fafc;
  --sidebar-bg: #ffffff;
  --topbar-bg: rgba(255, 255, 255, .90);
  --modal-header-bg: rgba(255, 255, 255, .95);
  --login-intro-bg: linear-gradient(145deg, rgba(5, 150, 105, .08), transparent 46%), linear-gradient(180deg, #f8fafc 0%, #eef2f6 100%);
  --surface: #ffffff;
  --surface-2: #f8fafc;
  --surface-3: #f1f5f9;
  --surface-hover: #f9fbfd;
  --subtle-surface: rgba(15, 23, 42, .028);
  --subtle-row: rgba(15, 23, 42, .026);
  --code-bg: #f1f5f9;
  --overlay: rgba(15, 23, 42, .45);

  --border: rgba(15, 23, 42, .09);
  --divider: rgba(15, 23, 42, .065);
  --border-strong: rgba(15, 23, 42, .16);
  --border-focus: rgba(5, 150, 105, .65);
  --scrollbar-thumb: rgba(15, 23, 42, .16);
  --scrollbar-thumb-hover: rgba(15, 23, 42, .28);

  --text: #0f172a;
  --text-soft: #334155;
  --text-muted: #526071;
  --text-dim: #7b8794;

  --accent: #059669;
  --accent-hover: #047857;
  --accent-ink: #ffffff;
  --accent-soft: rgba(5, 150, 105, .10);
  --accent-border: rgba(5, 150, 105, .28);

  --green: #059669;
  --green-soft: rgba(5, 150, 105, .10);
  --yellow: #b45309;
  --yellow-soft: rgba(217, 119, 6, .11);
  --red: #dc2626;
  --red-soft: rgba(220, 38, 38, .10);
  --blue: #2563eb;
  --blue-soft: rgba(37, 99, 235, .10);
  --violet: #6d28d9;
  --violet-soft: rgba(109, 40, 217, .10);

  --chart-grid: rgba(15, 23, 42, .07);
  --chart-label: rgba(15, 23, 42, .52);
  --chart-stroke: #059669;
  --chart-fill-top: rgba(5, 150, 105, .20);
  --chart-fill-bottom: rgba(5, 150, 105, .01);

  --shadow-sm: 0 1px 2px rgba(15, 23, 42, .05);
  --shadow-md: 0 12px 30px -16px rgba(15, 23, 42, .16);
  --shadow-lg: 0 24px 60px -24px rgba(15, 23, 42, .22);
  --shadow-accent: 0 8px 20px -12px rgba(5, 150, 105, .45);
  --card-hover-shadow: 0 10px 24px -16px rgba(15, 23, 42, .16), 0 0 0 1px rgba(5, 150, 105, .14);
}

/* ============================================================
   RESET & BASE
   ============================================================ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { height: 100%; -webkit-text-size-adjust: 100%; }
body {
  min-height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: var(--text-base);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
button, input, select, textarea { color: inherit; font: inherit; }
button, [role="button"] { -webkit-tap-highlight-color: transparent; }
a { color: var(--accent); text-decoration: none; }
img, svg { display: block; }
strong { font-weight: 650; }
h1, h2, h3, h4 { letter-spacing: -.025em; line-height: 1.2; }
hr { height: 1px; border: 0; background: var(--border); }
code, .mono { font-family: var(--font-mono); }
code { color: var(--text-soft); font-size: .9em; }
::selection { color: var(--text); background: rgba(103, 226, 178, .22); }
.hidden { display: none !important; }

.icon-sprite { position: fixed; width: 0; height: 0; overflow: hidden; pointer-events: none; }
.icon,
.ui-icon {
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.ui-icon { display: inline-block; vertical-align: -4px; }
.eyebrow,
.topbar-kicker,
.card-kicker,
.nav-section {
  color: var(--text-dim);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .13em;
  text-transform: uppercase;
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--scrollbar-thumb); border: 2px solid transparent; border-radius: 99px; background-clip: padding-box; }
::-webkit-scrollbar-thumb:hover { background: var(--scrollbar-thumb-hover); border: 2px solid transparent; background-clip: padding-box; }
* { scrollbar-width: thin; scrollbar-color: var(--scrollbar-thumb) transparent; }

/* ============================================================
   BRAND
   ============================================================ */
.brand { display: flex; min-width: 0; align-items: center; gap: 11px; }
.brand-mark {
  position: relative;
  display: inline-flex;
  width: 34px;
  height: 34px;
  flex: 0 0 34px;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  border: 1px solid var(--accent-border);
  border-radius: 10px;
  background: linear-gradient(145deg, rgba(103, 226, 178, .17), rgba(103, 226, 178, .045));
  color: var(--accent);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: -.07em;
  box-shadow: inset 0 1px rgba(255, 255, 255, .04);
}
.brand-mark::after {
  position: absolute;
  right: 4px;
  bottom: 4px;
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: var(--accent);
  content: "";
  box-shadow: 0 0 8px var(--accent);
}
.brand-wordmark { color: var(--text); font-size: 17px; font-weight: 720; letter-spacing: -.045em; }
.brand-wordmark span { color: var(--accent); }

/* ============================================================
   LOGIN
   ============================================================ */
.login-screen {
  display: grid;
  min-height: 100vh;
  min-height: 100dvh;
  place-items: center;
  overflow: hidden;
  padding: clamp(20px, 4vw, 56px);
  background:
    radial-gradient(circle at 18% 20%, rgba(103, 226, 178, .07), transparent 27%),
    radial-gradient(circle at 85% 78%, rgba(120, 174, 248, .035), transparent 24%),
    var(--bg);
}
.login-shell {
  display: grid;
  width: min(1060px, 100%);
  min-height: 650px;
  grid-template-columns: minmax(0, 1.08fr) minmax(400px, .92fr);
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 24px;
  background: var(--bg-elevated);
  box-shadow: var(--shadow-lg);
}
.login-intro {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  overflow: hidden;
  padding: 48px;
  border-right: 1px solid var(--border);
  background: var(--login-intro-bg);
}
.login-intro::before {
  position: absolute;
  right: -145px;
  bottom: -185px;
  width: 430px;
  height: 430px;
  border: 1px solid rgba(103, 226, 178, .09);
  border-radius: 50%;
  box-shadow: 0 0 0 70px rgba(103, 226, 178, .025), 0 0 0 140px rgba(103, 226, 178, .012);
  content: "";
}
.brand-login { position: relative; z-index: 1; }
.login-message { position: relative; z-index: 1; max-width: 470px; margin-top: auto; margin-bottom: auto; }
.login-message h1 { margin: 16px 0 20px; color: var(--text); font-size: clamp(40px, 4vw, 58px); font-weight: 640; letter-spacing: -.055em; }
.login-message h1 em { color: var(--accent); font-style: normal; }
.login-message p { max-width: 430px; color: var(--text-muted); font-size: var(--text-md); line-height: 1.75; }
.login-trust { position: relative; z-index: 1; display: flex; align-items: center; gap: 12px; color: var(--text-soft); }
.login-trust > span:last-child { display: flex; flex-direction: column; }
.login-trust strong { font-size: 12px; }
.login-trust small { color: var(--text-dim); font-size: 11px; }
.login-panel { display: grid; place-items: center; padding: 48px clamp(32px, 5vw, 64px); }
.login-card { width: 100%; max-width: 380px; }
.login-logo { margin-bottom: 34px; }
.login-logo h2 { margin-top: 12px; font-size: 28px; font-weight: 650; }
.login-subtitle { margin-top: 9px; color: var(--text-muted); font-size: 13px; }
.login-brand-mobile { display: none; }
.login-footnote { display: flex; align-items: center; justify-content: center; gap: 7px; margin-top: 20px; color: var(--text-dim); font-size: 11px; }
.login-footnote .icon { width: 13px; height: 13px; }
.login-error { min-height: 20px; margin-top: 13px; color: var(--red); font-size: 12px; text-align: center; }

/* ============================================================
   FORM CONTROLS
   ============================================================ */
.form-group { min-width: 0; margin-bottom: 18px; }
.form-group label {
  display: block;
  margin-bottom: 8px;
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 650;
  letter-spacing: .02em;
}
.form-group input,
.form-group select,
.form-group textarea,
.search-box input {
  width: 100%;
  min-height: 43px;
  border: 1px solid var(--border-strong);
  border-radius: var(--r-sm);
  outline: 0;
  background: var(--surface-2);
  color: var(--text);
  font-size: 13px;
  transition: border-color var(--dur-fast), background var(--dur-fast), box-shadow var(--dur-fast);
}
.form-group input,
.form-group select,
.search-box input { padding: 0 13px; }
.form-group textarea { min-height: 92px; padding: 12px 13px; resize: vertical; }
.form-group input:hover,
.form-group select:hover,
.form-group textarea:hover,
.search-box input:hover { border-color: rgba(235, 245, 241, .18); }
.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus,
.search-box input:focus {
  border-color: var(--border-focus);
  background: var(--surface-3);
  box-shadow: 0 0 0 3px rgba(103, 226, 178, .085);
}
.form-group input::placeholder,
.form-group textarea::placeholder,
.search-box input::placeholder { color: var(--text-dim); }
.form-group input[readonly] { color: var(--text-muted); cursor: default; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 4px 18px; }
.helper-text { margin-bottom: 16px; color: var(--text-muted); font-size: 11px; line-height: 1.7; }
.form-hint { margin-top: 10px; color: var(--text-muted); font-size: 11px; line-height: 1.5; }
.sni-add-form { display: flex; align-items: flex-end; gap: 9px; }
.sni-add-form .form-field-grow { min-width: 0; flex: 1; }
.sni-add-form .form-field-grow label { display: block; margin-bottom: 8px; color: var(--text-muted); font-size: 11px; font-weight: 650; }
.sni-add-form .form-field-grow input { width: 100%; min-height: 43px; padding: 0 13px; border: 1px solid var(--border-strong); border-radius: var(--r-sm); outline: 0; background: var(--surface-2); color: var(--text); }
.sni-pool-list { margin-top: 12px; }
.content-action { margin-top: 12px; }
.info-grid-spaced { margin-top: 16px; }
.text-success { color: var(--green); }
.search-box { position: relative; }
.search-box input { width: 270px; padding-left: 14px; }

/* ============================================================
   BUTTONS
   ============================================================ */
.btn {
  display: inline-flex;
  min-height: 40px;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 16px;
  border: 1px solid transparent;
  border-radius: var(--r-sm);
  background: transparent;
  color: var(--text-soft);
  cursor: pointer;
  font-size: 12px;
  font-weight: 650;
  letter-spacing: -.005em;
  line-height: 1;
  white-space: nowrap;
  transition: color var(--dur-fast), background var(--dur-fast), border-color var(--dur-fast), transform var(--dur-fast), box-shadow var(--dur-fast);
}
.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn-primary { background: var(--accent); color: var(--accent-ink); box-shadow: var(--shadow-accent); }
.btn-primary:hover { background: var(--accent-hover); }
.btn-ghost { border-color: var(--border-strong); background: var(--subtle-surface); color: var(--text-soft); }
.btn-ghost:hover { border-color: var(--accent-border); background: var(--surface-hover); color: var(--text); }
.btn.is-copied { border-color: var(--accent-border) !important; background: var(--accent-soft) !important; color: var(--accent) !important; }
.btn-warning { border-color: rgba(242, 198, 109, .28); background: var(--yellow-soft); color: var(--yellow); }
.btn-warning:hover { border-color: rgba(242, 198, 109, .45); background: rgba(242, 198, 109, .18); }
.btn-danger { border-color: rgba(241, 138, 138, .28); background: var(--red-soft); color: var(--red); }
.btn-danger:hover { border-color: rgba(241, 138, 138, .45); background: rgba(241, 138, 138, .18); }
.btn-sm { min-height: 32px; padding: 0 11px; border-radius: 8px; font-size: 11px; }
.btn-block { width: 100%; }
.btn-sidebar-toggle { display: none; width: 38px; height: 38px; place-items: center; border: 0; border-radius: 9px; background: transparent; color: var(--text-muted); cursor: pointer; }
.btn-sidebar-toggle:hover { background: var(--surface-2); color: var(--text); }

/* ============================================================
   APPLICATION SHELL
   ============================================================ */
.app { display: flex; height: 100vh; height: 100dvh; overflow: hidden; background: var(--bg); }
.sidebar {
  position: fixed;
  z-index: 200;
  inset: 0 auto 0 0;
  display: flex;
  width: var(--sidebar-w);
  flex-direction: column;
  border-right: 1px solid var(--border);
  background: var(--sidebar-bg);
  transition: width var(--dur) var(--ease), transform var(--dur) var(--ease), background var(--dur);
}
.sidebar-header { display: flex; min-height: var(--topbar-h); align-items: center; padding: 0 18px; border-bottom: 1px solid var(--border); }
.sidebar-header .brand { width: 100%; }
.logo-text { display: flex; min-width: 0; flex-direction: column; line-height: 1.15; }
.logo-text strong { color: var(--text); font-size: 15px; font-weight: 720; letter-spacing: -.04em; }
.logo-text strong span { color: var(--accent); }
.logo-text small { margin-top: 2px; color: var(--text-dim); font-size: 9px; font-weight: 650; letter-spacing: .08em; text-transform: uppercase; }
.sidebar-nav { flex: 1; overflow-y: auto; padding: 14px 10px; }
.nav-section { display: block; margin: 14px 10px 6px; }
.nav-section:first-child { margin-top: 1px; }
.nav-item {
  position: relative;
  display: flex;
  min-height: 38px;
  align-items: center;
  gap: 11px;
  margin-bottom: 2px;
  padding: 0 11px;
  border: 1px solid transparent;
  border-radius: 8px;
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 520;
  transition: color var(--dur-fast), background var(--dur-fast), border-color var(--dur-fast);
}
.nav-item:hover { background: var(--subtle-surface); color: var(--text); }
.nav-item.active { border-color: var(--accent-border); background: var(--accent-soft); color: var(--text); }
.nav-item.active::after { position: absolute; right: 10px; width: 4px; height: 4px; border-radius: 50%; background: var(--accent); content: ""; box-shadow: 0 0 8px var(--accent); }
.nav-icon { width: 18px; height: 18px; flex: 0 0 18px; fill: none; stroke: currentColor; stroke-width: 1.65; stroke-linecap: round; stroke-linejoin: round; }
.nav-item.active .nav-icon { color: var(--accent); }
.nav-label { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sidebar-footer { display: flex; min-height: 68px; align-items: center; gap: 10px; padding: 12px 14px; border-top: 1px solid var(--border); }
.user-badge { display: grid; min-width: 0; flex: 1; grid-template-columns: 34px minmax(0, 1fr) auto; align-items: center; column-gap: 10px; }
.user-avatar { display: grid; width: 34px; height: 34px; grid-row: 1 / span 2; place-items: center; border: 1px solid var(--accent-border); border-radius: 10px; background: var(--accent-soft); color: var(--accent); font-size: 12px; font-weight: 750; }
.user-name { min-width: 0; overflow: hidden; color: var(--text-soft); font-size: 12px; font-weight: 620; text-overflow: ellipsis; white-space: nowrap; }
.user-role { color: var(--text-dim); font-size: 9px; letter-spacing: .06em; text-transform: uppercase; }
.btn-logout { display: grid; width: 34px; height: 34px; flex: 0 0 34px; place-items: center; border: 0; border-radius: 9px; background: transparent; color: var(--text-dim); cursor: pointer; transition: color var(--dur-fast), background var(--dur-fast); }
.btn-logout:hover { background: var(--red-soft); color: var(--red); }
.sidebar-overlay { position: fixed; z-index: 199; inset: 0; display: none; background: rgba(4, 6, 8, .7); backdrop-filter: blur(5px); }

.main-content { display: flex; min-width: 0; flex: 1; flex-direction: column; margin-left: var(--sidebar-w); overflow: hidden; transition: margin-left var(--dur) var(--ease); }
.topbar {
  position: relative;
  z-index: 50;
  display: flex;
  height: var(--topbar-h);
  flex: 0 0 var(--topbar-h);
  align-items: center;
  gap: 14px;
  padding: 0 28px;
  border-bottom: 1px solid var(--border);
  background: var(--topbar-bg);
  backdrop-filter: blur(18px);
}
.topbar-heading { display: flex; min-width: 0; flex: 1; flex-direction: column; }
.topbar-kicker { margin-bottom: 1px; font-size: 8px; }
.topbar-title { overflow: hidden; color: var(--text); font-size: 15px; font-weight: 650; text-overflow: ellipsis; white-space: nowrap; }
.topbar-actions { display: flex; flex: 0 0 auto; align-items: center; gap: 9px; }
.theme-toggle {
  display: inline-grid;
  width: 32px;
  height: 32px;
  place-items: center;
  border: 1px solid var(--border);
  border-radius: var(--r-full);
  background: var(--subtle-surface);
  color: var(--text-muted);
  cursor: pointer;
  transition: color var(--dur-fast), border-color var(--dur-fast), background var(--dur-fast), transform var(--dur-fast);
}
.theme-toggle:hover { border-color: var(--accent-border); background: var(--accent-soft); color: var(--accent); transform: translateY(-1px); }
.theme-toggle .icon { width: 15px; height: 15px; }
.language-switcher { display: inline-flex; min-height: 32px; align-items: center; padding: 3px; border: 1px solid var(--border); border-radius: var(--r-full); background: var(--subtle-surface); }
.language-switcher button { min-width: 34px; height: 26px; border: 0; border-radius: var(--r-full); background: transparent; color: var(--text-muted); cursor: pointer; font: inherit; font-size: 10px; font-weight: 720; letter-spacing: .05em; transition: color var(--dur-fast) var(--ease), background var(--dur-fast) var(--ease); }
.language-switcher button:hover { color: var(--text); }
.language-switcher button.active { background: var(--accent); color: var(--accent-ink); }
.language-switcher button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.status-indicator { display: inline-flex; min-height: 32px; align-items: center; gap: 8px; padding: 0 12px; border: 1px solid var(--border); border-radius: var(--r-full); background: var(--subtle-surface); color: var(--text-muted); font-size: 11px; font-weight: 580; }
.status-dot { width: 7px; height: 7px; flex: 0 0 7px; border-radius: 50%; }
.status-dot.green { background: var(--green); box-shadow: 0 0 0 4px var(--green-soft); }
.status-dot.red { background: var(--red); box-shadow: 0 0 0 4px var(--red-soft); }
.license-banner { display: flex; min-height: 32px; align-items: center; gap: 8px; padding: 0 11px; border: 1px solid rgba(242, 198, 109, .24); border-radius: var(--r-full); background: var(--yellow-soft); color: var(--yellow); font-size: 11px; }
.banner-icon { display: inline-flex; }

.page-container { width: 100%; max-width: var(--content-max); flex: 1; margin: 0 auto; overflow-y: auto; padding: 20px 28px 36px; }
.page { display: none; }
.page.active { display: block; animation: page-in .26s var(--ease); }
@keyframes page-in { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
.page-actions { display: flex; min-height: 40px; align-items: center; justify-content: space-between; gap: 14px; margin-bottom: 16px; }
.page-actions h2 { color: var(--text); font-size: 22px; font-weight: 640; }

/* ============================================================
   DASHBOARD
   ============================================================ */
.dashboard-intro { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; margin: 0 0 14px; }
.dashboard-intro h1 { margin: 4px 0 4px; font-size: clamp(22px, 2.2vw, 27px); font-weight: 650; letter-spacing: -.035em; text-wrap: balance; }
.dashboard-intro p { color: var(--text-muted); font-size: 12px; }
.dashboard-updated { display: flex; flex: 0 0 auto; align-items: center; gap: 10px; padding-bottom: 2px; }
.dashboard-updated > span:last-child { display: flex; flex-direction: column; }
.dashboard-updated strong { color: var(--text-soft); font-size: 11px; }
.dashboard-updated small { color: var(--text-dim); font-size: 10px; }
.stats-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-bottom: 14px; }
.stat-card {
  position: relative;
  display: flex;
  min-width: 0;
  min-height: 92px;
  align-items: center;
  gap: 13px;
  overflow: hidden;
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  transition: border-color var(--dur) var(--ease), background var(--dur) var(--ease), transform var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
}
.stat-card:hover {
  border-color: var(--accent-border);
  background: var(--surface-hover);
  transform: translateY(-2px) scale(1.008);
  box-shadow: var(--card-hover-shadow);
}
.stat-icon { display: grid; width: 36px; height: 36px; flex: 0 0 36px; place-items: center; border: 1px solid currentColor; border-radius: 9px; }
.stat-icon .icon { width: 17px; height: 17px; }
.users-icon { border-color: rgba(120, 174, 248, .22); background: var(--blue-soft); color: var(--blue); }
.active-icon { border-color: var(--accent-border); background: var(--accent-soft); color: var(--accent); }
.traffic-icon { border-color: rgba(171, 157, 242, .22); background: var(--violet-soft); color: var(--violet); }
.uptime-icon { border-color: var(--border-strong); background: var(--subtle-surface); color: var(--text-soft); }
.stat-info { display: flex; min-width: 0; flex: 1; flex-direction: column; }
.stat-value { color: var(--text); font-size: 22px; font-weight: 660; letter-spacing: -.035em; line-height: 1.1; font-variant-numeric: tabular-nums; }
.stat-label { order: -1; margin-bottom: 4px; color: var(--text-muted); font-size: 11px; font-weight: 560; }
.stat-meta { margin-top: 4px; color: var(--text-dim); font-size: 10px; line-height: 1.2; }
.stat-meta:empty { display: none; }
.stat-meta.positive { color: var(--accent); }

.dashboard-grid { display: grid; grid-template-columns: minmax(0, 1.08fr) minmax(0, .92fr); gap: 14px; margin-bottom: 14px; }
.dashboard-grid.align-start { align-items: start; }
.card {
  min-width: 0;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  transition: border-color var(--dur) var(--ease);
}
.card-header { display: flex; min-height: 48px; align-items: center; justify-content: space-between; gap: 14px; padding: 10px 16px; border-bottom: 1px solid var(--border); }
.card-heading { display: flex; min-width: 0; flex-direction: column; gap: 2px; }
.card-header h3 { color: var(--text); font-size: 13px; font-weight: 630; letter-spacing: -.01em; }
.card-header > h3 { color: var(--text); }
.card-kicker { font-size: 8px; }
.card-meta { color: var(--text-dim); font-size: 10px; }
.period-pill { display: inline-flex; min-height: 24px; align-items: center; padding: 0 9px; border: 1px solid var(--border); border-radius: var(--r-full); color: var(--text-muted); font-size: 10px; }
.card-body { min-width: 0; padding: 14px 16px; }
.card-body:has(> .data-table) { overflow-x: auto; }
.section-card { margin-top: 14px; }

.health-item { display: flex; align-items: center; gap: 9px; min-height: 30px; border-bottom: 1px solid var(--divider); color: var(--text-soft); font-size: 12px; }
.health-item:last-child { border-bottom: 0; }
.health-item > span:first-child { color: var(--green); font-size: 11px; }
.health-item.warning > span:first-child { color: var(--yellow); }
.health-item.error > span:first-child { color: var(--red); }

.health-resources {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}
.health-resources:empty { display: none; }
.health-res-item { display: flex; min-width: 0; flex-direction: column; gap: 5px; }
.health-res-head { display: flex; align-items: baseline; justify-content: space-between; gap: 6px; font-size: 10px; }
.health-res-label { color: var(--text-dim); font-weight: 650; letter-spacing: .04em; text-transform: uppercase; }
.health-res-val { color: var(--text-soft); font-family: var(--font-mono); font-size: 10px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.health-res-track { height: 5px; overflow: hidden; border-radius: 99px; background: var(--surface-3); }
.health-res-fill { display: block; height: 100%; border-radius: 99px; background: var(--accent); transition: width .35s var(--ease); }
.health-res-fill.warn { background: var(--yellow); }
.health-res-fill.danger { background: var(--red); }

.activity-item { display: grid; min-height: 36px; grid-template-columns: 76px minmax(0, 1fr); align-items: center; gap: 10px; padding: 4px 0; border-bottom: 1px solid var(--divider); }
.activity-item:last-child { border-bottom: 0; }
.activity-time { color: var(--text-dim); font-size: 10px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.activity-text { overflow: hidden; color: var(--text-muted); font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.activity-text strong { color: var(--text-soft); }
.chart-container { position: relative; width: 100%; min-height: 176px; }
.chart-container canvas { display: block; width: 100%; max-width: 100%; cursor: crosshair; }
.chart-tooltip {
  position: absolute;
  z-index: 15;
  top: 0;
  left: 0;
  min-width: 132px;
  padding: 8px 11px;
  border: 1px solid var(--border-strong);
  border-radius: 9px;
  background: var(--surface-3);
  color: var(--text);
  box-shadow: var(--shadow-md);
  font-size: 11px;
  line-height: 1.4;
  pointer-events: none;
  transform: translate(-50%, calc(-100% - 10px));
  transition: opacity var(--dur-fast) var(--ease);
}
.chart-tooltip strong { display: block; color: var(--text); font-size: 12px; font-weight: 650; }
.chart-tooltip span { display: block; color: var(--accent); font-family: var(--font-mono); font-size: 11px; font-variant-numeric: tabular-nums; }
.chart-tooltip small { display: block; color: var(--text-muted); font-size: 10px; }

/* ============================================================
   TABLES & USER CARDS
   ============================================================ */
.table-wrap { width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }
.data-table { width: 100%; min-width: 650px; border-collapse: collapse; }
.data-table.compact-table { min-width: 500px; }
.data-table.compact-table td small { display: block; margin-top: 2px; color: var(--text-dim); font-size: 11px; }
.data-table.backup-table { display: block; min-width: 0; }
.backup-table thead,
.backup-table tbody { display: block; }
.backup-table tr { display: grid; grid-template-columns: 86px minmax(0, 1fr) 78px 94px 84px; align-items: center; }
.backup-table thead tr { border-bottom: 1px solid var(--border); }
.backup-table tbody tr { border-bottom: 1px solid var(--divider); }
.backup-table tbody tr:last-child { border-bottom: 0; }
.backup-table th,
.backup-table td { min-width: 0; border-bottom: 0; }
.data-table.backup-table td { display: flex; height: 56px; padding: 0 13px; align-items: center; white-space: nowrap; }
.backup-table .backup-date { align-items: flex-start; flex-direction: column; justify-content: center; color: var(--text-soft); white-space: nowrap; }
.backup-table .backup-date small { margin-top: 2px; color: var(--text-dim); font-size: 9px; }
.data-table.backup-table .backup-file { display: block; overflow: hidden; height: 56px; padding: 0 13px; line-height: 56px; text-overflow: ellipsis; white-space: nowrap; }
.backup-table .backup-encryption { gap: 5px; white-space: nowrap; }
.backup-table .backup-encryption .ui-icon { width: 15px; height: 15px; }
.backup-table td:last-child { gap: 4px; }
.data-table th { padding: 0 13px 11px; border-bottom: 1px solid var(--border); color: var(--text-dim); font-size: 9px; font-weight: 700; letter-spacing: .08em; text-align: left; text-transform: uppercase; white-space: nowrap; }
.data-table td { height: 46px; padding: 8px 13px; border-bottom: 1px solid var(--divider); color: var(--text-muted); font-size: 12px; vertical-align: middle; }
.data-table tbody tr:last-child td { border-bottom: 0; }
.data-table tbody tr { transition: background var(--dur-fast); }
.data-table tbody tr:hover { background: var(--subtle-surface); }
.data-table td:first-child { color: var(--text-soft); }
.data-table .ok { color: var(--green); }
.data-table .err { color: var(--red); }
.data-table .warn { color: var(--yellow); }
.data-table .mono { font-size: 11px; }
.data-table td .btn + .btn { margin-left: 4px; }
.data-table .btn-sm { width: 32px; padding: 0; }

.user-card { margin-bottom: 10px; overflow: hidden; border: 1px solid var(--border); border-radius: var(--r-md); background: var(--surface); }
.user-card-header { display: flex; width: 100%; min-height: 54px; align-items: center; gap: 12px; padding: 8px 16px; border: 0; background: transparent; color: inherit; cursor: pointer; text-align: left; user-select: none; transition: background var(--dur-fast); }
.user-card-header:hover { background: var(--subtle-surface); }
.user-card-header > strong { min-width: 90px; color: var(--text); font-size: 13px; }
.user-card-protocols { display: flex; min-width: 0; flex: 1; flex-wrap: wrap; gap: 5px; }
.user-card-header .chevron { color: var(--text-dim); transition: transform var(--dur) var(--ease); }
.user-card-header.open .chevron { transform: rotate(180deg); }
.user-card-body { padding: 0 16px 16px; border-top: 1px solid var(--border); }
.user-card-body .table-wrap { padding-top: 14px; }

/* ============================================================
   STATUS, DATA & FEATURE COMPONENTS
   ============================================================ */
.badge { display: inline-flex; min-height: 23px; align-items: center; padding: 0 8px; border: 1px solid transparent; border-radius: var(--r-full); font-size: 9px; font-weight: 700; letter-spacing: .035em; white-space: nowrap; }
.badge-active { border-color: rgba(103, 226, 178, .17); background: var(--green-soft); color: var(--green); }
.badge-disabled { border-color: rgba(241, 138, 138, .17); background: var(--red-soft); color: var(--red); }
.badge-expired, .badge-grace { border-color: rgba(242, 198, 109, .17); background: var(--yellow-soft); color: var(--yellow); }

.inbound-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.inbound-card {
  position: relative;
  min-width: 0;
  overflow: hidden;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  transition: border-color var(--dur) var(--ease), background var(--dur) var(--ease), transform var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
}
.inbound-card:hover {
  border-color: var(--accent-border);
  background: var(--surface-hover);
  transform: translateY(-2px);
  box-shadow: var(--card-hover-shadow);
}
.inbound-card::before { position: absolute; inset: 0 auto 0 0; width: 2px; background: var(--accent); content: ""; opacity: .65; }
.inbound-card.reality::before { background: var(--violet); }
.inbound-card.ws::before { background: var(--blue); }
.inbound-card.panel::before { background: var(--yellow); }
.inbound-title { display: flex; align-items: center; gap: 9px; margin-bottom: 14px; color: var(--text); font-size: 13px; font-weight: 650; }
.inbound-title .icon,
.inbound-title .ui-icon { color: var(--text-muted); }
.inbound-meta { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px 16px; }
.inbound-meta span { min-width: 0; color: var(--text-dim); font-size: 10px; }
.inbound-meta strong { display: block; overflow: hidden; margin-top: 2px; color: var(--text-soft); font-size: 11px; font-weight: 560; text-overflow: ellipsis; white-space: nowrap; }

.info-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 8px; }
.info-item { display: flex; min-width: 0; min-height: 58px; flex-direction: column; justify-content: center; gap: 4px; padding: 10px 12px; border: 1px solid var(--divider); border-radius: 9px; background: var(--subtle-surface); }
.info-label { color: var(--text-dim); font-size: 9px; font-weight: 700; letter-spacing: .075em; text-transform: uppercase; }
.info-value { display: flex; min-width: 0; align-items: center; gap: 7px; overflow-wrap: anywhere; color: var(--text-soft); font-size: 11px; }

.license-status { display: flex; align-items: center; gap: 14px; padding: 17px; border: 1px solid; border-radius: var(--r-md); }
.license-status.loading { border-color: var(--border-strong); background: var(--subtle-surface); }
.license-status.active { border-color: var(--accent-border); background: var(--green-soft); }
.license-status.grace { border-color: rgba(217, 119, 6, .25); background: var(--yellow-soft); }
.license-status.locked { border-color: rgba(220, 38, 38, .25); background: var(--red-soft); }
.license-status.error { border-color: rgba(220, 38, 38, .25); background: var(--red-soft); }
.license-status-icon { display: grid; width: 38px; height: 38px; place-items: center; border: 1px solid currentColor; border-radius: 10px; color: var(--green); }
.license-status.loading .license-status-icon { color: var(--text-muted); }
.license-status.grace .license-status-icon { color: var(--yellow); }
.license-status.locked .license-status-icon,
.license-status.error .license-status-icon { color: var(--red); }
.license-status-text h4 { color: var(--text); font-size: 14px; font-weight: 650; }
.license-status-text p { margin-top: 3px; color: var(--text-muted); font-size: 11px; }

.service-item { display: grid; min-height: 44px; grid-template-columns: minmax(0, 1fr) auto 70px; align-items: center; gap: 14px; border-bottom: 1px solid var(--divider); }
.service-item:last-child { border-bottom: 0; }
.svc-name { color: var(--text-soft); font-size: 12px; font-weight: 580; }
.svc-status { font-size: 10px; }
.svc-status.running { color: var(--green); }
.svc-status.stopped { color: var(--red); }
.svc-uptime { color: var(--text-dim); font-size: 10px; text-align: right; }

.compat-item { display: flex; min-height: 36px; align-items: center; gap: 10px; border-bottom: 1px solid var(--divider); color: var(--text-muted); font-size: 11px; }
.compat-item:last-child { border-bottom: 0; }
.compat-item > span { color: var(--green); }
.compat-item.warning > span { color: var(--yellow); }
.compat-item.error > span { color: var(--red); }

.link-item { display: flex; min-width: 0; align-items: center; gap: 12px; margin-bottom: 8px; padding: 10px 12px; border: 1px solid var(--border); border-radius: 9px; background: var(--subtle-surface); }
.link-item:last-child { margin-bottom: 0; }
.link-type { min-width: 94px; color: var(--text-soft); font-size: 10px; font-weight: 650; }
.link-url { min-width: 0; flex: 1; overflow: hidden; color: var(--text-dim); font-family: var(--font-mono); font-size: 10px; text-overflow: ellipsis; white-space: nowrap; }

.cert-item { display: flex; align-items: center; gap: 14px; margin-bottom: 9px; padding: 13px; border: 1px solid var(--border); border-radius: 10px; background: var(--subtle-surface); }
.cert-item:last-child { margin-bottom: 0; }
.cert-icon { display: grid; width: 36px; height: 36px; flex: 0 0 36px; place-items: center; border: 1px solid var(--accent-border); border-radius: 9px; background: var(--accent-soft); color: var(--accent); }
.cert-info { min-width: 0; flex: 1; }
.cert-info h4 { overflow: hidden; color: var(--text-soft); font-size: 12px; font-weight: 620; text-overflow: ellipsis; white-space: nowrap; }
.cert-info p { margin-top: 4px; color: var(--text-dim); font-size: 10px; }
.cert-days { flex: 0 0 auto; text-align: right; }
.cert-days .days { font-size: 19px; font-weight: 650; letter-spacing: -.04em; }
.cert-days .days-label { color: var(--text-dim); font-size: 9px; }

.sni-pool-item { display: flex; align-items: center; gap: 9px; min-height: 44px; border-bottom: 1px solid var(--divider); }
.sni-pool-item .btn { flex-shrink: 0; }
.sni-pool-item:last-child { border-bottom: 0; }
.sni-name { min-width: 0; flex: 1; overflow: hidden; color: var(--text-soft); font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.sni-status { padding: 3px 7px; border-radius: var(--r-full); font-size: 9px; }
.sni-status.pending { background: var(--yellow-soft); color: var(--yellow); }
.sni-status.ok { background: var(--green-soft); color: var(--green); }
.sni-status.fail { background: var(--red-soft); color: var(--red); }

/* ============================================================
   MODALS & TOASTS
   ============================================================ */
.modal-overlay { position: fixed; z-index: 1000; inset: 0; display: flex; align-items: center; justify-content: center; padding: 24px; background: var(--overlay); backdrop-filter: blur(10px); }
.modal { width: min(520px, 100%); max-height: min(86vh, 760px); overflow-y: auto; border: 1px solid var(--border-strong); border-radius: var(--r-lg); background: var(--surface); box-shadow: var(--shadow-lg); animation: modal-in .25s var(--ease); }
@keyframes modal-in { from { opacity: 0; transform: translateY(10px) scale(.985); } to { opacity: 1; transform: none; } }
.modal-header { position: sticky; z-index: 2; top: 0; display: flex; min-height: 58px; align-items: center; justify-content: space-between; padding: 0 20px; border-bottom: 1px solid var(--border); background: var(--modal-header-bg); backdrop-filter: blur(12px); }
.modal-header h3 { color: var(--text); font-size: 15px; font-weight: 650; }
.modal-close { display: grid; width: 34px; height: 34px; place-items: center; border: 0; border-radius: 9px; background: transparent; color: var(--text-muted); cursor: pointer; }
.modal-close:hover { background: var(--subtle-surface); color: var(--text); }
.modal-body { padding: 18px 20px; }

.toast-container { position: fixed; z-index: 2000; top: auto; bottom: 20px; right: 20px; display: flex; width: min(360px, calc(100vw - 36px)); flex-direction: column; gap: 8px; pointer-events: none; }
.toast { padding: 11px 14px; border: 1px solid var(--border-strong); border-radius: 10px; background: var(--surface-3); color: var(--text); box-shadow: var(--shadow-md); font-size: 12px; pointer-events: auto; animation: toast-in .24s var(--ease); }
.toast.success { border-color: var(--accent-border); }
.toast.error { border-color: rgba(220, 38, 38, .35); color: var(--red); }
.toast.info { border-color: rgba(120, 174, 248, .3); }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 1180px) and (min-width: 769px) {
  .sidebar { width: var(--sidebar-w-compact); }
  .main-content { margin-left: var(--sidebar-w-compact); }
  .sidebar-header { justify-content: center; padding: 0; }
  .sidebar-header .brand { width: auto; }
  .sidebar-header .logo-text,
  .nav-section,
  .sidebar-footer .user-name,
  .sidebar-footer .user-role { display: none; }
  .sidebar-nav { padding: 16px 10px; overflow: visible; }
  .nav-item { justify-content: center; padding: 0; }
  .nav-label {
    position: absolute;
    z-index: 350;
    left: calc(100% + 12px);
    top: 50%;
    padding: 7px 10px;
    border: 1px solid var(--border-strong);
    border-radius: 8px;
    background: var(--surface-3);
    color: var(--text-soft);
    box-shadow: var(--shadow-md);
    font-size: 11px;
    opacity: 0;
    pointer-events: none;
    transform: translate(-4px, -50%);
    transition: opacity var(--dur-fast), transform var(--dur-fast);
  }
  .nav-item:hover .nav-label { opacity: 1; transform: translate(0, -50%); }
  .nav-item.active::after { right: 6px; }
  .sidebar-footer { min-height: 92px; flex-direction: column; justify-content: center; gap: 7px; padding: 9px 0; }
  .user-badge { display: block; flex: 0 0 34px; }
  .sidebar-footer .btn-logout { display: grid; }
}

@media (max-width: 1024px) {
  .stats-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .dashboard-grid { grid-template-columns: 1fr; }
  .inbound-grid { grid-template-columns: 1fr; }
}

@media (max-width: 768px) {
  :root { --topbar-h: 64px; }
  .sidebar { width: min(290px, 86vw); transform: translateX(-102%); box-shadow: var(--shadow-lg); }
  .sidebar.open { transform: translateX(0); }
  .sidebar-overlay.open { display: block; }
  .main-content { margin-left: 0; }
  .btn-sidebar-toggle { display: grid; }
  .topbar { padding: 0 15px; }
  .topbar-kicker { display: none; }
  .topbar-title { font-size: 14px; }
  .page-container { padding: 25px 17px 40px; }
  .dashboard-intro { align-items: flex-start; }
  .dashboard-updated { display: none; }
  .page-actions { align-items: stretch; flex-direction: column; }
  .page-actions h2 { font-size: 23px; }
  .page-actions .btn { align-self: flex-start; }
  .search-box input { width: 100%; }
  .form-grid { grid-template-columns: 1fr; }
  .info-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .license-banner .banner-text { display: none; }
  .toast-container { top: auto; right: 12px; bottom: 12px; width: calc(100vw - 24px); }
  .modal-overlay { align-items: flex-end; padding: 10px; }
  .modal { max-height: 92vh; border-radius: 16px; }
  .sni-pool-item { flex-wrap: wrap; padding: 10px 0; }
  .sni-name { flex-basis: calc(100% - 120px); }
}

@media (max-width: 520px) {
  .login-screen { padding: 0; }
  .login-shell { min-height: 100vh; min-height: 100dvh; grid-template-columns: 1fr; border: 0; border-radius: 0; }
  .login-intro { display: none; }
  .login-panel { padding: 36px 24px; }
  .login-brand-mobile { display: flex; margin-bottom: 44px; }
  .login-logo { margin-bottom: 30px; }
  .login-logo h2 { font-size: 26px; }
  .stats-grid { grid-template-columns: 1fr; }
  .stat-card { min-height: 128px; }
  .dashboard-intro h1 { font-size: 28px; }
  .dashboard-intro p { line-height: 1.6; }
  .card-header { min-height: 60px; padding: 12px 15px; }
  .card-body { padding: 16px; }
  .info-grid { grid-template-columns: 1fr; }
  .inbound-meta { grid-template-columns: 1fr; }
  .activity-item { grid-template-columns: 62px minmax(0, 1fr); }
  .service-item { grid-template-columns: minmax(0, 1fr) auto; }
  .svc-uptime { display: none; }
  .link-item { align-items: flex-start; flex-wrap: wrap; }
  .link-type { min-width: 0; }
  .link-url { flex-basis: calc(100% - 44px); order: 3; }
  .cert-item { align-items: flex-start; }
  .cert-info p { white-space: normal; }
  .status-indicator { padding: 0 9px; }
  .status-indicator > span:last-child { display: none; }
}

@media (hover: none) and (pointer: coarse) {
  .btn { min-height: 44px; }
  .nav-item { min-height: 46px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}

/* ============================================================
   USER DIRECTORY & ACCOUNT DETAIL
   ============================================================ */
.sr-only {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

#page-users { --user-control-h: 40px; }
.user-directory-view,
.user-detail-view { min-width: 0; }

.user-directory-heading {
  align-items: flex-end;
  margin: 0 0 16px;
}
.user-directory-heading-copy { max-width: 650px; }
.user-directory-heading-copy .eyebrow { display: block; margin-bottom: 5px; }
.user-directory-heading-copy h1 {
  color: var(--text);
  font-size: clamp(22px, 2.2vw, 27px);
  font-weight: 650;
  letter-spacing: -.035em;
}
.user-directory-heading-copy p {
  max-width: 620px;
  margin-top: 4px;
  color: var(--text-muted);
  font-size: 12px;
  line-height: 1.55;
}
.user-directory-actions { display: flex; flex: 0 0 auto; flex-wrap: wrap; justify-content: flex-end; gap: 8px; }

.user-directory-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 14px;
}
.directory-summary-item {
  position: relative;
  display: flex;
  min-width: 0;
  min-height: 82px;
  flex-direction: column;
  justify-content: center;
  overflow: hidden;
  padding: 13px 16px;
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  transition: border-color var(--dur) var(--ease), background var(--dur) var(--ease), transform var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
}
.directory-summary-item:hover {
  border-color: var(--accent-border);
  background: var(--surface-hover);
  transform: translateY(-2px) scale(1.008);
  box-shadow: var(--card-hover-shadow);
}
.directory-summary-item::after {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--text-dim);
  content: "";
}
.directory-summary-item[data-summary="active"]::after { background: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
.directory-summary-item[data-summary="attention"]::after { background: var(--yellow); }
.directory-summary-label { color: var(--text-muted); font-size: 10px; font-weight: 620; }
.directory-summary-value {
  margin-top: 5px;
  overflow: hidden;
  color: var(--text);
  font-size: 22px;
  font-weight: 660;
  font-variant-numeric: tabular-nums;
  letter-spacing: -.035em;
  line-height: 1.08;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.directory-summary-item[data-summary="active"] .directory-summary-value { color: var(--accent); }
.directory-summary-meta { margin-top: 5px; overflow: hidden; color: var(--text-dim); font-size: 10px; text-overflow: ellipsis; white-space: nowrap; }

.user-directory-toolbar {
  display: grid;
  grid-template-columns: minmax(240px, 1fr) auto auto;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
  padding: 9px;
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}
.directory-search { min-width: 0; }
.directory-search > .icon {
  position: absolute;
  z-index: 1;
  top: 50%;
  left: 13px;
  width: 16px;
  height: 16px;
  color: var(--text-dim);
  pointer-events: none;
  transform: translateY(-50%);
}
.directory-search.search-box input {
  width: 100%;
  min-height: var(--user-control-h);
  padding-right: 13px;
  padding-left: 39px;
  border-color: transparent;
  background: var(--surface-2);
}
.directory-filters { display: flex; min-width: 0; align-items: center; gap: 7px; }
.filter-control { position: relative; display: block; min-width: 0; }
.filter-control::after {
  position: absolute;
  top: 50%;
  right: 13px;
  width: 5px;
  height: 5px;
  border-right: 1px solid var(--text-dim);
  border-bottom: 1px solid var(--text-dim);
  content: "";
  pointer-events: none;
  transform: translateY(-70%) rotate(45deg);
}
.filter-control select {
  min-width: 132px;
  min-height: var(--user-control-h);
  padding: 0 32px 0 11px;
  appearance: none;
  border: 1px solid transparent;
  border-radius: var(--r-sm);
  outline: 0;
  background: var(--surface-2);
  color: var(--text-muted);
  cursor: pointer;
  font-size: 11px;
  transition: border-color var(--dur-fast), background var(--dur-fast), color var(--dur-fast), box-shadow var(--dur-fast);
}
.filter-control select:hover { border-color: var(--border-strong); color: var(--text-soft); }
.filter-control select:focus-visible { border-color: var(--border-focus); box-shadow: 0 0 0 3px rgba(103, 226, 178, .085); }

.user-view-switcher {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 3px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg-elevated);
}
.view-switch {
  display: grid;
  width: 32px;
  height: 32px;
  flex: 0 0 32px;
  place-items: center;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--text-dim);
  cursor: pointer;
  transition: color var(--dur-fast), background var(--dur-fast), box-shadow var(--dur-fast);
}
.view-switch .icon { width: 15px; height: 15px; }
.view-switch:hover { background: rgba(255, 255, 255, .04); color: var(--text-soft); }
.view-switch.active,
.view-switch[aria-pressed="true"] { background: var(--accent-soft); color: var(--accent); box-shadow: inset 0 0 0 1px rgba(103, 226, 178, .11); }

.user-bulk-bar {
  display: flex;
  min-height: 52px;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin: 0 0 12px;
  padding: 8px 10px 8px 16px;
  border: 1px solid var(--accent-border);
  border-radius: var(--r-md);
  background: linear-gradient(90deg, rgba(103, 226, 178, .10), rgba(103, 226, 178, .035));
  box-shadow: var(--shadow-sm);
}
.bulk-selection-summary { color: var(--text-muted); font-size: 11px; white-space: nowrap; }
.bulk-selection-summary strong { margin-right: 4px; color: var(--accent); font-size: 13px; font-variant-numeric: tabular-nums; }
.bulk-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 6px; }

.user-results { min-width: 0; }
.user-results[data-view="list"] { display: grid; gap: 8px; }
.user-directory-card {
  min-width: 0;
  margin: 0;
  overflow: hidden;
  border-color: var(--border);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  transition: border-color var(--dur) var(--ease), background var(--dur) var(--ease), transform var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
}
.user-directory-card:hover {
  border-color: var(--accent-border);
  background: var(--surface-hover);
  transform: translateY(-1px);
  box-shadow: var(--card-hover-shadow);
}
.user-directory-row {
  display: grid;
  min-width: 0;
  grid-template-columns: 24px minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  padding: 4px 10px 4px 12px;
}
.user-select { display: grid; width: 24px; height: 34px; place-items: center; cursor: pointer; }
.user-select input,
.user-directory-table input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: var(--accent);
  cursor: pointer;
}
.user-directory-card .user-open-trigger {
  display: grid;
  min-width: 0;
  min-height: 52px;
  grid-template-columns: 36px minmax(150px, .75fr) minmax(170px, 1fr) auto;
  align-items: center;
  gap: 11px;
  padding: 5px 8px;
  border-radius: 8px;
}
.user-directory-card .user-open-trigger:hover { background: var(--subtle-surface); }
.user-detail-avatar {
  display: grid;
  width: 54px;
  height: 54px;
  flex: 0 0 54px;
  place-items: center;
  border: 1px solid var(--accent-border);
  border-radius: 15px;
  background: linear-gradient(145deg, rgba(103, 226, 178, .14), rgba(103, 226, 178, .045));
  color: var(--accent);
  font-size: 17px;
  font-weight: 720;
  letter-spacing: -.035em;
  box-shadow: inset 0 1px rgba(255, 255, 255, .035);
}
.user-list-avatar { width: 34px; height: 34px; border-radius: 10px; font-size: 12px; }
.user-list-identity { display: flex; min-width: 0; flex-direction: column; gap: 2px; }
.user-list-identity strong { overflow: hidden; color: var(--text); font-size: 13px; text-overflow: ellipsis; white-space: nowrap; }
.user-list-identity small { overflow: hidden; color: var(--text-dim); font-size: 10px; text-overflow: ellipsis; white-space: nowrap; }
.user-directory-row-actions { display: flex; align-items: center; gap: 4px; }
.user-directory-row-actions .btn { width: 32px; padding: 0; }
.user-quota-footer {
  display: flex;
  min-height: 32px;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 6px 14px 7px 52px;
  border-top: 1px solid var(--divider);
  background: var(--subtle-row);
}
.user-quota-progress {
  display: flex;
  min-width: 0;
  flex: 1;
  max-width: 340px;
  align-items: center;
  gap: 10px;
}
.quota-bar {
  position: relative;
  height: 5px;
  min-width: 72px;
  flex: 1;
  overflow: hidden;
  border-radius: 99px;
  background: var(--surface-3);
}
.quota-bar-fill {
  display: block;
  height: 100%;
  border-radius: 99px;
  background: var(--accent);
  transition: width .3s var(--ease);
}
.quota-bar-fill.warn { background: var(--yellow); }
.quota-bar-fill.danger { background: var(--red); }
.quota-bar-fill.muted { background: var(--text-dim); opacity: .55; }
.user-quota-label {
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 10px;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.user-quota-meta {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 6px;
  color: var(--text-dim);
  font-size: 10px;
  white-space: nowrap;
}

.user-results[data-view="grid"] {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}
.user-results[data-view="grid"] .user-directory-card { display: flex; min-height: 146px; flex-direction: column; }
.user-results[data-view="grid"] .user-directory-card:hover { transform: translateY(-2px) scale(1.006); }
.user-results[data-view="grid"] .user-directory-row {
  grid-template-columns: 22px minmax(0, 1fr);
  align-items: start;
  padding: 13px 14px 10px;
}
.user-results[data-view="grid"] .user-select { height: 34px; }
.user-results[data-view="grid"] .user-open-trigger {
  position: relative;
  min-height: 0;
  grid-template-columns: 36px minmax(0, 1fr);
  align-items: start;
  padding: 0 68px 0 0;
}
.user-results[data-view="grid"] .user-list-avatar { grid-row: 1; }
.user-results[data-view="grid"] .user-list-identity { align-self: center; }
.user-results[data-view="grid"] .user-card-protocols { grid-column: 1 / -1; padding-top: 9px; }
.user-results[data-view="grid"] .user-open-trigger > .badge { position: absolute; top: 1px; right: 0; }
.user-results[data-view="grid"] .user-directory-row-actions { grid-column: 2; margin-top: 8px; }
.user-results[data-view="grid"] .user-quota-footer {
  flex-direction: column;
  align-items: stretch;
  gap: 6px;
  margin-top: auto;
  padding: 8px 14px 10px;
}
.user-results[data-view="grid"] .user-quota-progress { max-width: none; }
.user-results[data-view="grid"] .user-quota-meta { justify-content: space-between; }
.user-results[data-view="grid"] .user-quota-meta > span[aria-hidden="true"] { display: none; }

.user-directory-table-wrap {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}
.user-directory-table { min-width: 790px; }
.user-directory-table th { padding-top: 14px; background: var(--subtle-row); }
.user-directory-table th:first-child,
.user-directory-table td:first-child { width: 42px; text-align: center; }
.user-directory-table th:last-child,
.user-directory-table td:last-child { width: 58px; text-align: right; }
.user-directory-table .user-card-protocols { display: inline-flex; }
.table-user-link {
  display: flex;
  max-width: 220px;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
  cursor: pointer;
  text-align: left;
}
.table-user-link strong { overflow: hidden; max-width: 100%; color: var(--text-soft); font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.table-user-link small { color: var(--text-dim); font-family: var(--font-mono); font-size: 9px; }
.table-user-link:hover strong { color: var(--accent); }

.user-empty-state {
  display: grid;
  min-height: 280px;
  margin-top: 12px;
  place-items: center;
  align-content: center;
  padding: 36px 20px;
  border: 1px dashed var(--border-strong);
  border-radius: var(--r-md);
  background: rgba(255, 255, 255, .012);
  text-align: center;
}
.empty-state-icon { width: 34px; height: 34px; margin-bottom: 14px; fill: none; stroke: var(--text-dim); stroke-width: 1.5; }
.user-empty-state h3 { color: var(--text-soft); font-size: 14px; font-weight: 630; }
.user-empty-state p { margin: 7px 0 18px; color: var(--text-dim); font-size: 11px; }

.user-detail-toolbar { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.user-detail-toolbar .btn { padding-left: 11px; }
.user-detail-header {
  display: grid;
  min-width: 0;
  grid-template-columns: 54px minmax(0, 1fr) auto;
  align-items: center;
  gap: 16px;
  padding: 20px;
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  background: linear-gradient(135deg, rgba(103, 226, 178, .055), transparent 42%), var(--surface);
  box-shadow: var(--shadow-sm);
}
.user-detail-heading { min-width: 0; }
.user-detail-heading .eyebrow { display: block; margin-bottom: 6px; font-size: 8px; }
.user-detail-heading h2 { overflow: hidden; color: var(--text); font-size: 24px; font-weight: 650; text-overflow: ellipsis; white-space: nowrap; }
.user-detail-heading p { margin-top: 5px; overflow: hidden; color: var(--text-muted); font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.user-detail-menu { width: 38px; padding: 0; }

.user-detail-tabs {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 3px;
  margin: 14px 0 18px;
  padding: 5px;
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: 11px;
  background: var(--surface);
  scrollbar-width: none;
}
.user-detail-tabs::-webkit-scrollbar { display: none; }
.user-detail-tab {
  display: inline-flex;
  min-height: 38px;
  flex: 0 0 auto;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 0 13px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 11px;
  font-weight: 590;
  white-space: nowrap;
  transition: color var(--dur-fast), background var(--dur-fast), box-shadow var(--dur-fast);
}
.user-detail-tab .icon { width: 15px; height: 15px; }
.user-detail-tab:hover { background: rgba(255, 255, 255, .035); color: var(--text-soft); }
.user-detail-tab.active,
.user-detail-tab[aria-selected="true"] { background: var(--accent-soft); color: var(--accent); box-shadow: inset 0 0 0 1px rgba(103, 226, 178, .11); }

.user-detail-content { min-width: 0; min-height: 300px; }
.user-detail-placeholder {
  display: flex;
  min-height: 260px;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 12px;
  border: 1px dashed var(--border);
  border-radius: var(--r-md);
  color: var(--text-dim);
  font-size: 11px;
}
.user-detail-section {
  min-width: 0;
  padding: 20px;
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}
.section-heading { display: flex; min-width: 0; align-items: center; justify-content: space-between; gap: 14px; margin-bottom: 17px; }
.section-heading > div { min-width: 0; }
.section-heading .eyebrow { display: block; margin-bottom: 6px; font-size: 8px; }
.section-heading h3 { color: var(--text-soft); font-size: 15px; font-weight: 630; }
.user-detail-metrics { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 9px; margin-bottom: 14px; }
.user-detail-metrics .info-value { color: var(--text); font-size: 16px; font-weight: 640; letter-spacing: -.025em; }
.user-overview-profiles { display: grid; gap: 7px; }
.user-overview-profile {
  display: flex;
  min-width: 0;
  min-height: 54px;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 10px 12px;
  border: 1px solid var(--divider);
  border-radius: 9px;
  background: var(--subtle-surface);
}
.user-overview-profile > div { display: flex; min-width: 0; flex-direction: column; gap: 3px; }
.user-overview-profile strong { overflow: hidden; color: var(--text-soft); font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.user-overview-profile small { overflow: hidden; color: var(--text-dim); font-size: 9px; text-overflow: ellipsis; white-space: nowrap; }

.user-profile-list { display: grid; gap: 11px; }
.user-profile-card {
  min-width: 0;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: 11px;
  background: var(--bg-elevated);
}
.user-profile-card-head { display: flex; min-width: 0; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.user-profile-card-head > div { min-width: 0; }
.user-profile-card-head .card-kicker { display: block; margin-bottom: 6px; }
.user-profile-card-head h3 { overflow: hidden; color: var(--text); font-size: 14px; font-weight: 630; text-overflow: ellipsis; white-space: nowrap; }
.user-profile-card .info-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.user-profile-card .info-item { min-height: 58px; background: var(--surface); }
.user-profile-card .info-value { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.profile-actions { display: flex; min-width: 0; flex-wrap: wrap; align-items: center; gap: 7px; margin-top: 14px; }
.profile-actions .btn-danger:last-child { width: 32px; margin-left: auto; padding: 0; }

.subscription-token-card {
  position: relative;
  display: grid;
  min-width: 0;
  gap: 10px;
  margin-bottom: 12px;
  overflow: hidden;
  padding: 18px;
  border: 1px solid var(--accent-border);
  border-radius: 11px;
  background: var(--accent-soft);
}
.subscription-token-card code {
  position: relative;
  z-index: 1;
  display: block;
  min-width: 0;
  overflow: hidden;
  padding: 11px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--code-bg);
  color: var(--text-soft);
  font-size: 10px;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.subscription-token-card .profile-actions { position: relative; z-index: 1; }
.subscription-profile-list { display: grid; gap: 6px; margin-bottom: 12px; }
.subscription-profile-row { display: grid; min-width: 0; grid-template-columns: 8px minmax(0, 1fr) auto; align-items: center; gap: 9px; padding: 8px 10px; border: 1px solid var(--divider); border-radius: 8px; background: var(--subtle-surface); }
.subscription-profile-row > span:nth-child(2) { display: flex; min-width: 0; flex-direction: column; gap: 2px; }
.subscription-profile-row strong { overflow: hidden; color: var(--text-soft); font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.subscription-profile-row small { color: var(--text-dim); font-size: 9px; }
.subscription-profile-state { width: 7px; height: 7px; border-radius: 50%; background: var(--text-dim); }
.subscription-profile-state.is-active { background: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }

.user-device-list { display: grid; gap: 7px; }
.user-device-item {
  display: grid;
  min-width: 0;
  min-height: 62px;
  grid-template-columns: 38px minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border: 1px solid var(--divider);
  border-radius: 9px;
  background: var(--subtle-surface);
}
.device-icon { display: grid; width: 36px; height: 36px; place-items: center; border: 1px solid var(--border-strong); border-radius: 9px; background: var(--surface-2); color: var(--text-muted); }
.device-icon .ui-icon { width: 16px; height: 16px; }
.user-device-item > div { display: flex; min-width: 0; flex-direction: column; gap: 3px; }
.user-device-item strong { overflow: hidden; color: var(--text-soft); font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.user-device-item small { overflow: hidden; color: var(--text-dim); font-size: 9px; text-overflow: ellipsis; white-space: nowrap; }

.user-activity-list { position: relative; display: grid; }
.user-activity-item {
  position: relative;
  display: grid;
  min-height: 52px;
  grid-template-columns: 18px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  padding: 7px 0;
  border-bottom: 1px solid var(--divider);
}
.user-activity-item:last-child { border-bottom: 0; }
.user-activity-item::before {
  position: absolute;
  top: 50%;
  bottom: -50%;
  left: 4px;
  width: 1px;
  background: var(--border);
  content: "";
}
.user-activity-item:last-child::before { display: none; }
.activity-dot { position: relative; z-index: 1; width: 9px; height: 9px; border: 2px solid var(--surface); border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 3px rgba(103, 226, 178, .075); }
.user-activity-item > div { display: flex; min-width: 0; flex-direction: column; gap: 4px; }
.user-activity-item strong { color: var(--text-soft); font-size: 11px; font-weight: 570; }
.user-activity-item small { color: var(--text-dim); font-size: 9px; }
.user-empty-inline { display: grid; min-height: 150px; place-items: center; border: 1px dashed var(--border); border-radius: 9px; color: var(--text-dim); font-size: 11px; text-align: center; }

.modal-actions { display: flex; align-items: center; justify-content: flex-end; flex-wrap: wrap; gap: 8px; margin-top: 20px; }
.action-list { display: grid; gap: 7px; }
.action-list-item {
  display: flex;
  width: 100%;
  min-height: 58px;
  align-items: center;
  justify-content: flex-start;
  gap: 12px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  text-align: left;
}
.action-list-item:hover { border-color: var(--accent-border); background: var(--accent-soft); }
.action-list-item > span { display: flex; min-width: 0; flex-direction: column; gap: 2px; }
.action-list-item strong { color: var(--text-soft); font-size: 12px; }
.action-list-item small { color: var(--text-dim); font-size: 10px; }
.action-list-item.btn-danger:hover { border-color: rgba(241, 138, 138, .32); background: var(--red-soft); }
.subscription-format-control { min-width: 0; width: 100%; margin-top: 5px; }
.modal:has(#user-import-text) { width: min(680px, 100%); }
#user-import-text {
  min-height: 250px;
  font-family: var(--font-mono);
  font-size: 11px;
  line-height: 1.65;
  tab-size: 2;
  white-space: pre;
}

@media (min-width: 1440px) {
  .user-results[data-view="grid"] { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .user-profile-list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .user-profile-card .info-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 1024px) {
  .user-directory-summary { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .user-directory-toolbar { grid-template-columns: minmax(0, 1fr) auto; }
  .directory-search { grid-column: 1 / -1; }
  .directory-filters { min-width: 0; }
  .filter-control { flex: 1; }
  .filter-control select { width: 100%; min-width: 0; }
  .user-directory-card .user-open-trigger { grid-template-columns: 40px minmax(130px, 1fr) auto; }
  .user-results[data-view="list"] .user-card-protocols { display: none; }
  .user-results[data-view="grid"] { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .user-detail-metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .user-profile-card .info-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .user-device-item { grid-template-columns: 38px minmax(0, 1fr) auto; }
  .user-device-item > .btn { grid-column: 2 / -1; justify-self: start; }
}

@media (max-width: 768px) {
  .user-directory-heading { align-items: flex-start; margin-bottom: 22px; }
  .user-directory-heading h1 { font-size: 28px; }
  .user-directory-actions { width: 100%; justify-content: flex-start; }
  .user-directory-heading.page-actions .btn { align-self: auto; }
  .user-directory-toolbar { grid-template-columns: 1fr; }
  .directory-search { grid-column: auto; }
  .directory-filters { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .user-view-switcher { width: max-content; }
  .user-bulk-bar { align-items: flex-start; flex-direction: column; padding: 12px; }
  .bulk-actions { justify-content: flex-start; }
  .user-results[data-view="grid"] { grid-template-columns: 1fr; }
  .user-detail-tab { flex: 1 0 auto; }
  .section-heading { align-items: flex-start; }
  .user-device-item { grid-template-columns: 38px minmax(0, 1fr); }
  .user-device-item > .badge { justify-self: start; }
  .user-device-item > .btn { grid-column: 2; }
}

@media (max-width: 500px) {
  .user-directory-heading-copy p { font-size: 11px; }
  .user-directory-actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .user-directory-actions .btn { width: 100%; padding: 0 10px; }
  .user-directory-actions .btn-primary { grid-column: 1 / -1; grid-row: 1; }
  .user-directory-summary { gap: 8px; }
  .directory-summary-item { min-height: 96px; padding: 14px; }
  .directory-summary-value { font-size: 21px; }
  .directory-summary-meta { white-space: normal; }
  .directory-filters { grid-template-columns: 1fr; }
  .user-view-switcher { width: 100%; }
  .view-switch { width: auto; flex: 1; }
  .bulk-actions { display: grid; width: 100%; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .bulk-actions .btn { width: 100%; padding: 0 8px; }
  .user-directory-row { grid-template-columns: 22px minmax(0, 1fr); align-items: start; padding: 12px; }
  .user-directory-card .user-open-trigger {
    grid-template-columns: 36px minmax(0, 1fr) auto;
    min-height: 0;
    padding: 0;
  }
  .user-list-avatar { width: 34px; height: 34px; border-radius: 10px; }
  .user-results[data-view="list"] .user-open-trigger > .badge { grid-column: 2; justify-self: start; }
  .user-directory-row-actions { grid-column: 2; margin-top: 9px; }
  .user-directory-profile-summary { padding: 9px 12px; overflow-x: auto; flex-wrap: nowrap; }
  .user-results[data-view="grid"] .user-directory-row { padding: 14px; }
  .user-results[data-view="grid"] .user-open-trigger { padding-right: 0; }
  .user-results[data-view="grid"] .user-open-trigger > .badge { position: static; grid-column: 2; justify-self: start; }
  .user-detail-header { grid-template-columns: 46px minmax(0, 1fr) auto; gap: 12px; padding: 15px; }
  .user-detail-header .user-detail-avatar { width: 46px; height: 46px; border-radius: 13px; font-size: 15px; }
  .user-detail-heading h2 { font-size: 20px; }
  .user-detail-heading p { white-space: normal; }
  .user-detail-tabs { margin-bottom: 14px; }
  .user-detail-tab { padding: 0 11px; }
  .user-detail-section { padding: 15px; }
  .section-heading { flex-direction: column; }
  .section-heading > .btn { width: 100%; }
  .user-detail-metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 7px; }
  .user-detail-metrics .info-value { font-size: 14px; }
  .user-profile-card { padding: 14px; }
  .user-profile-card .info-grid { grid-template-columns: 1fr; }
  .profile-actions { align-items: stretch; flex-direction: column; }
  .profile-actions .btn { width: 100%; }
  .profile-actions .btn-danger:last-child { width: 100%; margin-left: 0; }
  .subscription-token-card { padding: 14px; }
  .subscription-token-card code { white-space: normal; overflow-wrap: anywhere; }
  .user-device-item { gap: 9px; padding: 10px; }
  .user-device-item > .badge,
  .user-device-item > .btn { grid-column: 2; }
  .modal-actions { align-items: stretch; flex-direction: column; }
  .modal-actions .btn { width: 100%; }
  #user-import-text { min-height: 210px; }
}

@media (hover: none) and (pointer: coarse) {
  .view-switch { min-height: 44px; }
  .user-detail-tab { min-height: 44px; }
  .user-select { min-height: 44px; }
}
