/* ================================================================
   Heyshu 授权中心 — Apple-inspired Design System
   ================================================================ */

:root {
  /* Colors — porcelain white, graphite, Leica red */
  --bg: #f3f4f6;
  --surface: #ffffff;
  --surface-2: #f4f6f8;
  --surface-3: #eef1f4;
  --border: rgba(20, 22, 26, 0.12);
  --separator: rgba(20, 22, 26, 0.08);
  --text: #14161a;
  --text-2: #5f6670;
  --text-3: #9aa1aa;

  --accent: #007aff;
  --accent-hover: #0a84ff;
  --accent-pressed: #0066d6;
  --accent-soft: rgba(0, 122, 255, 0.10);
  --on-accent: #ffffff;
  --btn-primary-bg: linear-gradient(180deg, #2b2f36 0%, #14161a 100%);
  --btn-primary-fg: #ffffff;
  --btn-primary-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.16), 0 6px 18px rgba(20, 22, 26, 0.18);
  --pending: #5f6670;
  --pending-soft: rgba(95, 102, 112, 0.10);
  --green: #067a34;
  --green-soft: rgba(0, 200, 83, 0.14);
  --green-bright: #00c853;
  --orange: #9a6400;
  --orange-soft: rgba(255, 179, 0, 0.20);
  --orange-bright: #ffb300;
  --red: #c1121f;
  --red-soft: rgba(255, 59, 48, 0.13);
  --red-bright: #ff3b30;
  --purple: #5b5bd6;
  --purple-soft: rgba(91, 91, 214, 0.10);
  --blue-soft: var(--accent-soft);
  --gray-soft: rgba(120, 128, 140, 0.12);
  --btn-success-bg: #067a34;
  --btn-success-fg: #ffffff;
  --btn-warn-bg: #ffb300;
  --btn-warn-fg: #3d2a00;
  --btn-danger-bg: #c1121f;
  --btn-danger-fg: #ffffff;
  --bg-mesh:
    radial-gradient(80% 55% at 50% -10%, #ffffff 0%, rgba(255, 255, 255, 0) 60%),
    radial-gradient(55% 45% at 92% 0%, rgba(190, 214, 255, 0.32), transparent 70%),
    radial-gradient(60% 45% at 0% 100%, rgba(212, 223, 240, 0.55), transparent 72%),
    #f2f4f7;
  --topbar-bg: rgba(255, 255, 255, 0.42);
  --tabbar-bg: linear-gradient(180deg, rgba(255, 255, 255, 0.66) 0%, rgba(242, 244, 247, 0.92) 78%);
  --glass-border: rgba(255, 255, 255, 0.65);
  --glass-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.85), 0 0 0 0.5px rgba(20, 22, 26, 0.05), 0 18px 40px rgba(20, 22, 26, 0.08);
  --card-bg:
    radial-gradient(120% 90% at 10% 0%, rgba(255, 255, 255, 0.68), transparent 55%),
    linear-gradient(135deg, rgba(255, 255, 255, 0.50), rgba(255, 255, 255, 0.28));
  --card-highlight: inset 0 1px 0 rgba(255, 255, 255, 0.85);
  --modal-bg: rgba(255, 255, 255, 0.62);
  --issued-bg: linear-gradient(135deg, rgba(255, 255, 255, 0.72), rgba(235, 240, 246, 0.45));
  --issued-border: var(--glass-border);
  --issued-shadow: var(--glass-shadow);
  --issued-glow: rgba(0, 122, 255, 0.10);
  --login-bg: linear-gradient(180deg, #f8f9fa 0%, #e9edf2 100%);
  --login-card-bg: rgba(255, 255, 255, 0.80);
  --login-input-bg: rgba(255, 255, 255, 0.92);
  --login-btn-bg: linear-gradient(180deg, #2b2f36 0%, #14161a 100%);
  --login-btn-fg: #ffffff;

  /* Radii */
  --radius-xs: 8px;
  --radius-sm: 12px;
  --radius: 16px;
  --radius-lg: 22px;
  --radius-full: 9999px;

  /* Shadows — cool and restrained */
  --shadow-xs: 0 1px 2px rgba(20, 22, 26, 0.04);
  --shadow-sm: 0 1px 3px rgba(20, 22, 26, 0.06), 0 1px 2px rgba(20, 22, 26, 0.03);
  --shadow: 0 4px 16px rgba(20, 22, 26, 0.06), 0 2px 4px rgba(20, 22, 26, 0.03);
  --shadow-lg: 0 12px 40px rgba(20, 22, 26, 0.10);
  --shadow-glow: 0 0 0 4px rgba(0, 122, 255, 0.14);

  /* Typography */
  --font-sans: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text",
    "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
  --font-mono: "SF Mono", "JetBrains Mono", Menlo, Monaco, "Courier New", monospace;

  /* Motion */
  --ease-out: cubic-bezier(0.32, 0.72, 0, 1);
  --dur-fast: 150ms;
  --dur-base: 250ms;
  --dur-slow: 350ms;

  /* Layout */
  --max-w: 720px;
  --safe-top: env(safe-area-inset-top, 0);
  --safe-bottom: env(safe-area-inset-bottom, 0);
}

html[data-theme="dark"] {
  --bg: #0a0b0c;
  --bg-mesh:
    radial-gradient(70% 50% at 50% -10%, rgba(36, 44, 60, 0.55), transparent 65%),
    radial-gradient(55% 45% at 92% 0%, rgba(18, 36, 70, 0.45), transparent 70%),
    radial-gradient(60% 45% at 0% 100%, rgba(20, 22, 28, 0.55), transparent 72%),
    #08090b;
  --surface: #141518;
  --surface-2: #1b1d21;
  --surface-3: #22252a;
  --border: rgba(255, 255, 255, 0.12);
  --separator: rgba(255, 255, 255, 0.08);
  --text: #f5f6f7;
  --text-2: #a3a8b0;
  --text-3: #6d737c;
  --accent: #0a84ff;
  --accent-hover: #409cff;
  --accent-pressed: #0066d6;
  --accent-soft: rgba(10, 132, 255, 0.18);
  --on-accent: #14080a;
  --btn-warn-bg: #ffcc4d;
  --btn-warn-fg: #2b1e00;
  --btn-success-bg: #0f8a43;
  --btn-success-fg: #ffffff;
  --btn-danger-bg: #d21f2b;
  --btn-danger-fg: #ffffff;
  --btn-primary-bg: linear-gradient(180deg, #ffffff 0%, #e6e8ec 100%);
  --btn-primary-fg: #111214;
  --btn-primary-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.9), 0 8px 22px rgba(0, 0, 0, 0.35);
  --pending: #a3a8b0;
  --pending-soft: rgba(163, 168, 176, 0.12);
  --blue-soft: var(--accent-soft);
  --green: #34d27b;
  --green-soft: rgba(74, 222, 128, 0.18);
  --green-bright: #4ade80;
  --orange: #ffcc4d;
  --orange-soft: rgba(255, 209, 102, 0.20);
  --orange-bright: #ffd166;
  --red: #ff6b6b;
  --red-soft: rgba(255, 107, 107, 0.18);
  --red-bright: #ff6b6b;
  --purple: #8f8ff0;
  --purple-soft: rgba(143, 143, 240, 0.14);
  --gray-soft: rgba(160, 168, 180, 0.14);
  --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.35);
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.45);
  --shadow: 0 8px 30px rgba(0, 0, 0, 0.45);
  --shadow-lg: 0 16px 50px rgba(0, 0, 0, 0.55);
  --shadow-glow: 0 0 0 4px rgba(10, 132, 255, 0.22);
  --topbar-bg: rgba(10, 11, 12, 0.48);
  --tabbar-bg: linear-gradient(180deg, rgba(26, 28, 33, 0.80) 0%, rgba(10, 11, 12, 0.94) 78%);
  --card-bg:
    radial-gradient(120% 90% at 10% 0%, rgba(255, 255, 255, 0.09), transparent 55%),
    linear-gradient(135deg, rgba(40, 43, 50, 0.55), rgba(20, 22, 26, 0.38));
  --card-highlight: inset 0 1px 0 rgba(255, 255, 255, 0.08);
  --glass-border: rgba(255, 255, 255, 0.14);
  --glass-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08), 0 0 0 0.5px rgba(0, 0, 0, 0.4), 0 20px 50px rgba(0, 0, 0, 0.45);
  --modal-bg: rgba(22, 24, 28, 0.66);
  --issued-bg: linear-gradient(135deg, rgba(40, 43, 50, 0.70), rgba(16, 18, 22, 0.55));
  --issued-border: var(--glass-border);
  --issued-shadow: var(--glass-shadow);
  --issued-glow: rgba(10, 132, 255, 0.14);
  --login-bg: linear-gradient(180deg, #101114 0%, #050506 100%);
  --login-card-bg: rgba(20, 21, 24, 0.78);
  --login-input-bg: rgba(0, 0, 0, 0.30);
  --login-btn-bg: linear-gradient(180deg, #ffffff 0%, #e6e8ec 100%);
  --login-btn-fg: #111214;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0a0b0c;
  --bg-mesh:
    radial-gradient(70% 50% at 50% -10%, rgba(36, 44, 60, 0.55), transparent 65%),
    radial-gradient(55% 45% at 92% 0%, rgba(18, 36, 70, 0.45), transparent 70%),
    radial-gradient(60% 45% at 0% 100%, rgba(20, 22, 28, 0.55), transparent 72%),
    #08090b;
    --surface: #141518;
    --surface-2: #1b1d21;
    --surface-3: #22252a;
    --border: rgba(255, 255, 255, 0.12);
    --separator: rgba(255, 255, 255, 0.08);
    --text: #f5f6f7;
    --text-2: #a3a8b0;
    --text-3: #6d737c;
    --accent: #0a84ff;
    --accent-hover: #409cff;
    --accent-pressed: #0066d6;
    --accent-soft: rgba(10, 132, 255, 0.18);
    --on-accent: #14080a;
    --btn-warn-bg: #ffcc4d;
    --btn-warn-fg: #2b1e00;
    --btn-success-bg: #0f8a43;
    --btn-success-fg: #ffffff;
    --btn-danger-bg: #d21f2b;
    --btn-danger-fg: #ffffff;
    --btn-primary-bg: linear-gradient(180deg, #ffffff 0%, #e6e8ec 100%);
    --btn-primary-fg: #111214;
    --btn-primary-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.9), 0 8px 22px rgba(0, 0, 0, 0.35);
    --pending: #a3a8b0;
    --pending-soft: rgba(163, 168, 176, 0.12);
    --blue-soft: var(--accent-soft);
    --green: #34d27b;
    --green-soft: rgba(74, 222, 128, 0.18);
    --green-bright: #4ade80;
    --orange: #ffcc4d;
    --orange-soft: rgba(255, 209, 102, 0.20);
    --orange-bright: #ffd166;
    --red: #ff6b6b;
    --red-soft: rgba(255, 107, 107, 0.18);
    --red-bright: #ff6b6b;
    --purple: #8f8ff0;
    --purple-soft: rgba(143, 143, 240, 0.14);
    --gray-soft: rgba(160, 168, 180, 0.14);
    --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.35);
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.45);
    --shadow: 0 8px 30px rgba(0, 0, 0, 0.45);
    --shadow-lg: 0 16px 50px rgba(0, 0, 0, 0.55);
    --shadow-glow: 0 0 0 4px rgba(10, 132, 255, 0.22);
    --topbar-bg: rgba(10, 11, 12, 0.48);
    --tabbar-bg: linear-gradient(180deg, rgba(26, 28, 33, 0.80) 0%, rgba(10, 11, 12, 0.94) 78%);
    --card-bg:
    radial-gradient(120% 90% at 10% 0%, rgba(255, 255, 255, 0.09), transparent 55%),
    linear-gradient(135deg, rgba(40, 43, 50, 0.55), rgba(20, 22, 26, 0.38));
    --card-highlight: inset 0 1px 0 rgba(255, 255, 255, 0.08);
  --glass-border: rgba(255, 255, 255, 0.14);
  --glass-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08), 0 0 0 0.5px rgba(0, 0, 0, 0.4), 0 20px 50px rgba(0, 0, 0, 0.45);
    --modal-bg: rgba(22, 24, 28, 0.66);
    --issued-bg: linear-gradient(135deg, rgba(40, 43, 50, 0.70), rgba(16, 18, 22, 0.55));
    --issued-border: var(--glass-border);
    --issued-shadow: var(--glass-shadow);
    --issued-glow: rgba(10, 132, 255, 0.14);
    --login-bg: linear-gradient(180deg, #101114 0%, #050506 100%);
    --login-card-bg: rgba(20, 21, 24, 0.78);
    --login-input-bg: rgba(0, 0, 0, 0.30);
    --login-btn-bg: linear-gradient(180deg, #ffffff 0%, #e6e8ec 100%);
    --login-btn-fg: #111214;
  }
}

/* ===== Reset ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html {
  -webkit-text-size-adjust: 100%;
  background: var(--bg-mesh);
  background-attachment: fixed;
  /* 保留滚动能力，但滚动条宽度恒为 0：无白条、无左右位移 */
  overflow-y: scroll;
  overscroll-behavior-y: none;
  scrollbar-width: none;
}
html::-webkit-scrollbar { width: 0; height: 0; display: none; }
body {
  background: transparent;
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 1.47;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  min-height: 100vh;
  min-height: 100dvh;
  padding-bottom: calc(100px + var(--safe-bottom));
}
button { font-family: inherit; cursor: pointer; border: none; background: none; color: inherit; }
input, select, textarea { font-family: inherit; color: inherit; }
a { color: inherit; text-decoration: none; }

/* ===== Top Bar ===== */
.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--topbar-bg);
  -webkit-backdrop-filter: saturate(180%) blur(30px);
  backdrop-filter: saturate(180%) blur(30px);
  border-bottom: 0.5px solid var(--separator);
  padding-top: var(--safe-top);
}
.topbar > div {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 18px 24px 14px;
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
}
.topbar > div > div:not(.topbar-actions) {
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.topbar-actions {
  display: flex;
  align-items: center;
  gap: 2px;
}
.eyebrow {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-3);
}
.topbar h1 {
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text);
  line-height: 1.1;
}

.icon-button {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-full);
  background: var(--surface);
  border: 0.5px solid var(--separator);
  color: var(--text-2);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all var(--dur-fast) var(--ease-out);
  box-shadow: var(--shadow-xs);
}
.icon-button:hover {
  color: var(--accent);
  transform: scale(1.05);
  border-color: rgba(0, 122, 255, 0.22);
}
.icon-button:active { transform: scale(0.96); }

.text-button {
  padding: 8px 12px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-2);
  transition: all var(--dur-fast) var(--ease-out);
}
.text-button:hover {
  color: var(--text);
  background: var(--surface-2);
  transform: translateY(-1px);
}
.text-button:active { transform: scale(0.96); }

/* ===== Messages ===== */
.messages {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 12px 24px 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.message {
  padding: 12px 18px;
  background: var(--green-soft);
  color: var(--green);
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 500;
  border: 0.5px solid rgba(0, 200, 83, 0.22);
  animation: slideDown 0.3s var(--ease-out);
}
@keyframes slideDown {
  from { opacity: 0; transform: translateY(-8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ===== Main ===== */
main {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 20px 24px 0;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

/* ===== Search Bar ===== */
.search-bar {
  display: flex;
  gap: 10px;
  align-items: center;
  height: 44px;
  padding: 0 14px;
  background: var(--surface);
  border: 0.5px solid var(--separator);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-xs);
  transition: all var(--dur-fast) var(--ease-out);
}
.search-bar:focus-within {
  border-color: var(--accent);
  box-shadow: var(--shadow-glow);
}
.search-bar svg { width: 18px; height: 18px; color: var(--text-3); flex-shrink: 0; }
.search-bar input {
  flex: 1;
  border: none;
  outline: none;
  background: transparent;
  font-size: 15px;
  color: var(--text);
  min-width: 0;
}
.search-bar input::placeholder { color: var(--text-3); }

/* ===== Filter Tabs ===== */
.filter-tabs, .chip-group {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding-bottom: 2px;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.filter-tabs::-webkit-scrollbar, .chip-group::-webkit-scrollbar { display: none; }
.chip, .filter-tab {
  flex-shrink: 0;
  padding: 8px 16px;
  border-radius: var(--radius-full);
  background: color-mix(in srgb, var(--surface) 45%, transparent);
  -webkit-backdrop-filter: blur(14px) saturate(160%);
  backdrop-filter: blur(14px) saturate(160%);
  border: 1px solid var(--glass-border);
  color: var(--text-2);
  font-size: 13px;
  font-weight: 500;
  transition: all var(--dur-fast) var(--ease-out);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
}
.chip:hover, .filter-tab:hover { color: var(--text); transform: translateY(-1px); }
.chip.active, .filter-tab.active {
  background: var(--blue-soft);
  color: var(--accent);
  border-color: transparent;
  font-weight: 600;
}
.chip .count, .filter-tab .count {
  font-size: 11px;
  padding: 1px 6px;
  border-radius: 10px;
  background: var(--gray-soft);
  color: var(--text-2);
  font-weight: 500;
}
.chip.active .count, .filter-tab.active .count {
  background: rgba(0, 122, 255, 0.12);
  color: var(--accent);
}

/* ===== Section Card ===== */
.section-card {
  background: var(--card-bg);
  -webkit-backdrop-filter: saturate(180%) blur(30px);
  backdrop-filter: saturate(180%) blur(30px);
  border: 1px solid var(--glass-border);
  border-radius: 24px;
  box-shadow: var(--glass-shadow);
  overflow: hidden;
}
/* 发卡页取消 overflow:hidden，避免原生 select 下拉框被裁剪 */
.section-card.issue-card {
  overflow: visible;
}
/* 最近授权：列表贴边铺满卡片，避免白色行背景内缩错位 */
.section-card.recent-card {
  padding: 0;
}
.recent-card .section-heading {
  padding: 20px 20px 14px;
}
.recent-card .list-row {
  text-decoration: none;
  color: var(--text);
  -webkit-tap-highlight-color: transparent;
}
.recent-card .list-row:hover {
  background: var(--surface-2);
}
.recent-card .list-row:active {
  background: var(--surface-3);
}
.issue-card .form-stack {
  padding-bottom: 8px;
}
.section-heading {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 20px 14px;
}
.section-heading h2 {
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -0.01em;
}
.section-heading a {
  font-size: 13px;
  color: var(--accent);
  font-weight: 500;
}

/* ===== Stats Grid ===== */
.stats {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}
.stat-card {
  background: var(--card-bg);
  -webkit-backdrop-filter: saturate(180%) blur(30px);
  backdrop-filter: saturate(180%) blur(30px);
  border: 1px solid var(--glass-border);
  border-radius: 24px;
  padding: 22px;
  box-shadow: var(--glass-shadow);
  transition: transform var(--dur-base) var(--ease-out), box-shadow var(--dur-base) var(--ease-out),
    background-color var(--dur-base) ease, color var(--dur-base) ease, border-color var(--dur-base) ease;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.stat-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--glass-shadow), var(--shadow-lg);
}
.stat-icon {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  font-weight: 600;
  margin-bottom: 6px;
}
.stat-card span {
  font-size: 13px;
  color: var(--text-2);
  font-weight: 500;
}
.stat-card strong {
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text);
  font-variant-numeric: tabular-nums;
  line-height: 1.1;
}
.stat-card small {
  font-size: 12px;
  color: var(--text-3);
}

/* ===== 发卡页双插件说明 ===== */
.scope-banner {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  background: color-mix(in srgb, var(--surface) 42%, transparent);
  -webkit-backdrop-filter: blur(16px) saturate(160%);
  backdrop-filter: blur(16px) saturate(160%);
  border: 1px solid var(--glass-border);
  border-radius: 16px;
  padding: 16px 16px 14px;
  margin: 0 0 16px;
  position: relative;
  overflow: hidden;
}
.scope-banner::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, rgba(0, 122, 255, 0) 0%, rgba(0, 122, 255, 0.35) 12%, #0a84ff 48%, #64d2ff 100%);
  box-shadow: 0 0 12px rgba(10, 132, 255, 0.35);
}
.scope-banner svg {
  width: 22px;
  height: 22px;
  color: var(--accent);
  flex-shrink: 0;
  margin-top: 1px;
}
.scope-banner-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 2px;
}
.scope-banner-desc {
  font-size: 12px;
  line-height: 1.6;
  color: var(--text-2);
}
/* ===== Issued Card (发卡结果) ===== */
.issued-card {
  background: var(--issued-bg);
  -webkit-backdrop-filter: saturate(180%) blur(30px);
  backdrop-filter: saturate(180%) blur(30px);
  border: 1px solid var(--issued-border);
  border-radius: 28px;
  padding: 34px 28px;
  color: var(--text);
  text-align: center;
  box-shadow: var(--issued-shadow);
  position: relative;
  overflow: hidden;
}
.issued-card::before {
  content: "";
  position: absolute;
  top: -55%;
  right: -25%;
  width: 320px;
  height: 320px;
  background: radial-gradient(circle, var(--issued-glow), transparent 66%);
  pointer-events: none;
  animation: issuedGlow 14s ease-in-out infinite alternate;
}
@keyframes issuedGlow {
  from { transform: translate3d(0, 0, 0) scale(1); opacity: 0.75; }
  to { transform: translate3d(-24px, 18px, 0) scale(1.15); opacity: 1; }
}
.issued-card .eyebrow {
  color: var(--accent);
  letter-spacing: 0.16em;
  margin-bottom: 12px;
}
.issued-code {
  font-family: var(--font-mono);
  font-size: 44px;
  font-weight: 600;
  letter-spacing: 0.14em;
  color: var(--text);
  margin: 8px 0 16px;
  font-variant-numeric: tabular-nums;
  user-select: all;
}
.issued-card .countdown {
  font-size: 13px;
  color: var(--text-2);
  margin-bottom: 20px;
  line-height: 1.6;
}
.issued-card .countdown strong {
  font-family: var(--font-mono);
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
}
.issued-card .primary-button {
  background: var(--btn-primary-bg);
  color: var(--btn-primary-fg);
  border: none;
  box-shadow: var(--btn-primary-shadow);
}
.issued-card .primary-button:hover {
  opacity: 0.9;
  box-shadow: var(--btn-primary-shadow);
}
.primary-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 13px 28px;
  background: var(--surface);
  color: var(--text);
  border-radius: var(--radius-full);
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0.02em;
  border: 1px solid var(--separator);
  cursor: pointer;
  transition: all var(--dur-fast) var(--ease-out);
  box-shadow: var(--shadow-xs);
}
.primary-button:hover {
  transform: translateY(-1px) scale(1.01);
  box-shadow: var(--shadow-sm);
}
.primary-button:active { transform: scale(0.98); }

.primary-button.blue {
  background: var(--btn-primary-bg);
  color: var(--btn-primary-fg);
  border-color: transparent;
  box-shadow: var(--btn-primary-shadow);
}
.primary-button.blue:hover { opacity: 0.94; box-shadow: var(--btn-primary-shadow); }

/* ===== Form ===== */
.form-stack {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 24px;
}
.field {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.field-label {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
}
.field-label .help {
  margin-left: auto;
  font-size: 12px;
  font-weight: 400;
  color: var(--text-3);
}
.field input,
.field select,
.field textarea {
  width: 100%;
  padding: 14px 16px;
  border: 1px solid var(--glass-border);
  border-radius: 14px;
  background: color-mix(in srgb, var(--surface) 55%, transparent);
  -webkit-backdrop-filter: blur(14px) saturate(160%);
  backdrop-filter: blur(14px) saturate(160%);
  font-size: 15px;
  color: var(--text);
  transition: all var(--dur-fast) var(--ease-out);
  outline: none;
}
.field input:focus,
.field select:focus,
.field textarea:focus {
  border-color: var(--accent);
  box-shadow: var(--shadow-glow);
  background: var(--surface);
}
.field select {
  appearance: none;
  -webkit-appearance: none;
  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='%23a1a1a6' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 16px center;
  padding-right: 40px;
  cursor: pointer;
  line-height: 1.5;
  min-height: 48px;
  box-sizing: border-box;
}
.errorlist {
  list-style: none;
  color: var(--red);
  font-size: 12px;
  margin-top: -4px;
}

/* ===== License / User List ===== */
.license-list, .user-list, .stack-list {
  display: flex;
  flex-direction: column;
}
.license-item, .user-item, .list-row {
  background: var(--surface);
  border-bottom: 0.5px solid var(--separator);
  padding: 16px 20px;
  display: flex;
  align-items: center;
  gap: 14px;
  transition: background var(--dur-fast) var(--ease-out);
  cursor: pointer;
}
.user-item, .user-item * {
  -webkit-user-select: none;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}
.user-item * { cursor: pointer; }
.license-item:last-child, .user-item:last-child, .list-row:last-child {
  border-bottom: none;
}
.license-item:hover, .user-item:hover {
  background: var(--surface-2);
}

.license-icon, .user-avatar {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.user-avatar {
  border-radius: var(--radius-full);
  font-weight: 600;
  font-size: 17px;
  color: #fff;
}
.license-icon svg { width: 22px; height: 22px; }
.license-icon.pending { background: var(--pending-soft); color: var(--pending); }
.license-icon.redeemed { background: var(--green-soft); color: var(--green); }
.license-icon.expired { background: var(--gray-soft); color: var(--text-3); }
.license-icon.revoked { background: var(--red-soft); color: var(--red); }

.license-info, .user-info {
  flex: 1;
  min-width: 0;
}
.license-code {
  font-family: var(--font-mono);
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
  letter-spacing: 0.03em;
  margin-bottom: 3px;
  font-variant-numeric: tabular-nums;
}
.user-name {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 3px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.user-badge {
  font-size: 10px;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: var(--radius-full);
  letter-spacing: 0.02em;
}
.user-badge.vip { background: var(--orange-soft); color: var(--orange); }
.user-badge.new { background: var(--green-soft); color: var(--green); }
.user-badge.normal { background: var(--gray-soft); color: var(--text-2); }

.user-email {
  font-size: 13px;
  color: var(--text-2);
  font-family: var(--font-mono);
}
.license-meta, .user-meta {
  font-size: 13px;
  color: var(--text-2);
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.license-meta .dot {
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: var(--text-3);
}

.license-right, .user-right {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
  flex-shrink: 0;
}
.user-license {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
}
.user-license-code {
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  letter-spacing: 0.03em;
}
.user-license-status {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 9px;
  border-radius: var(--radius-full);
  font-size: 11px;
  font-weight: 600;
  background: var(--pending-soft);
  color: var(--pending);
  --status-dot: var(--pending);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
}
.user-license-status::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--status-dot);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--status-dot) 16%, transparent);
}
.user-license-top {
  display: flex;
  align-items: center;
  gap: 6px;
  justify-content: flex-end;
}
.user-duration-chip {
  font-size: 11px;
  font-weight: 500;
  color: var(--text-2);
  background: var(--surface-2);
  padding: 1px 6px;
  border-radius: 6px;
}
.user-license-status.active { background: var(--green-soft); color: var(--text); --status-dot: var(--green-bright); }
.user-license-status.suspended { background: var(--orange-soft); color: var(--text); --status-dot: var(--orange-bright); }
.user-license-status.revoked { background: var(--red-soft); color: var(--text); --status-dot: var(--red-bright); }
.user-license-status.none, .user-license-status.expired { background: var(--gray-soft); color: var(--text-2); --status-dot: var(--text-3); }

/* Status Badge */
.status-badge, .status {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  border-radius: var(--radius-full);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.01em;
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
}
.status-badge::before, .status::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--status-dot, currentColor);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--status-dot, currentColor) 16%, transparent);
}
.status-badge.pending, .status-pending, .status.pending { --status-dot: var(--pending); background: var(--pending-soft); color: var(--text); }
.status-badge.redeemed, .status-redeemed, .status.redeemed,
.status-badge.active, .status-active, .status.active { --status-dot: var(--green-bright); background: var(--green-soft); color: var(--text); }
.status-badge.expired, .status-expired, .status.expired { --status-dot: var(--text-3); background: var(--gray-soft); color: var(--text-2); }
.status-badge.revoked, .status-revoked, .status.revoked { --status-dot: var(--red-bright); background: var(--red-soft); color: var(--text); }
.status-badge.suspended, .status-suspended, .status.suspended { --status-dot: var(--orange-bright); background: var(--orange-soft); color: var(--text); }

/* Action Buttons (用户列表操作) */
.action-btns {
  display: flex;
  gap: 6px;
}
.action-btn {
  width: 34px;
  height: 34px;
  border-radius: var(--radius-full);
  background: var(--surface-2);
  border: 0.5px solid var(--separator);
  color: var(--text-2);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all var(--dur-fast) var(--ease-out);
  flex-shrink: 0;
}
.action-btn:hover { transform: scale(1.08); }
.action-btn:active { transform: scale(0.94); }
.action-btn svg { width: 16px; height: 16px; }

.action-btn.pause:hover {
  color: var(--orange);
  border-color: rgba(255, 179, 0, 0.32);
  background: var(--orange-soft);
}
.action-btn.play:hover {
  color: var(--green);
  border-color: rgba(0, 200, 83, 0.32);
  background: var(--green-soft);
}
.action-btn.revoke:hover {
  color: var(--red);
  border-color: rgba(255, 59, 48, 0.32);
  background: var(--red-soft);
}
.action-btn:disabled {
  opacity: 0.3;
  cursor: not-allowed;
  transform: none;
}

.action-group {
  display: flex;
  gap: 8px;
}
.action-link {
  font-size: 13px;
  color: var(--accent);
  font-weight: 500;
}
.action-link.success { color: var(--green); }
.action-link.danger { color: var(--red); }

/* ===== Pagination ===== */
.pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 6px;
  padding: 10px 0 4px;
}
.page-btn {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-xs);
  background: var(--surface);
  border: 0.5px solid var(--separator);
  color: var(--text-2);
  font-size: 13px;
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all var(--dur-fast) var(--ease-out);
}
.page-btn:hover { color: var(--accent); border-color: rgba(0, 122, 255, 0.22); }
.page-btn.active {
  background: var(--accent);
  color: var(--on-accent);
  border-color: transparent;
  font-weight: 600;
}
.page-btn svg { width: 16px; height: 16px; }
.page-dots { color: var(--text-3); font-size: 13px; padding: 0 4px; }

/* ===== Section Header ===== */
.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 2px 2px;
  margin-top: 4px;
}
.section-header h2 {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
}
.section-header .count {
  font-size: 13px;
  color: var(--text-3);
  font-weight: 400;
}

/* ===== Quick Actions ===== */
.quick-actions {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}
.quick-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 20px 12px;
  background: var(--surface);
  border: 0.5px solid var(--separator);
  border-radius: var(--radius);
  transition: all var(--dur-fast) var(--ease-out);
  box-shadow: var(--shadow-xs);
  cursor: pointer;
}
.quick-btn:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
  border-color: rgba(0, 122, 255, 0.18);
}
.quick-btn:active { transform: scale(0.97); }
.quick-btn .q-icon {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
}
.quick-btn .q-icon svg { width: 22px; height: 22px; }
.quick-btn .q-icon.blue { background: var(--blue-soft); color: var(--accent); }
.quick-btn .q-icon.green { background: var(--green-soft); color: var(--green); }
.quick-btn .q-icon.orange { background: var(--orange-soft); color: var(--orange); }
.quick-btn span {
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
}

/* ===== Chart Card ===== */
.chart-card {
  background: var(--surface);
  border: 0.5px solid var(--separator);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: var(--shadow-sm);
}
.card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 20px;
}
.card-title h3 {
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -0.01em;
  margin-bottom: 3px;
}
.card-title p {
  font-size: 13px;
  color: var(--text-2);
}
.segmented {
  display: inline-flex;
  padding: 3px;
  background: var(--gray-soft);
  border-radius: var(--radius-full);
}
.segmented button {
  padding: 6px 14px;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-2);
  border-radius: var(--radius-full);
  transition: all var(--dur-fast) var(--ease-out);
}
.segmented button.active {
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow-xs);
  font-weight: 600;
}

.chart-container { height: 160px; position: relative; }
.chart-svg { width: 100%; height: 100%; }

.chart-legend {
  display: flex;
  gap: 20px;
  margin-top: 16px;
  padding-top: 16px;
  border-top: 0.5px solid var(--separator);
}
.legend-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--text-2);
}
.legend-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
}
.legend-dot.blue { background: var(--accent); }
.legend-dot.green { background: var(--green); }
.legend-item strong {
  color: var(--text);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

/* ===== Activity / Timeline ===== */
.activity-card {
  background: var(--surface);
  border: 0.5px solid var(--separator);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: var(--shadow-sm);
}
.activity-list {
  display: flex;
  flex-direction: column;
}
.activity-item {
  display: flex;
  gap: 14px;
  padding: 14px 0;
  border-bottom: 0.5px solid var(--separator);
  cursor: pointer;
  transition: background var(--dur-fast) var(--ease-out);
}
.activity-item:last-child { border-bottom: none; }
.activity-item:hover {
  margin: 0 -12px;
  padding-left: 12px;
  padding-right: 12px;
  border-radius: var(--radius-sm);
  background: var(--surface-2);
}
.activity-icon {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-xs);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  flex-grow: 0;
  overflow: hidden;
}
.activity-icon svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}
.activity-icon.issue { background: var(--blue-soft); color: var(--accent); }
.activity-icon.redeem { background: var(--green-soft); color: var(--green); }
.activity-icon.expire { background: var(--orange-soft); color: var(--orange); }
.activity-icon.revoke { background: var(--red-soft); color: var(--red); }
.activity-icon.login { background: var(--purple-soft); color: var(--purple); }

.activity-content { flex: 1; min-width: 0; }
.activity-title {
  font-size: 14px;
  font-weight: 500;
  color: var(--text);
  margin-bottom: 3px;
}
.activity-desc {
  font-size: 13px;
  color: var(--text-2);
  font-family: var(--font-mono);
}
.activity-time {
  font-size: 12px;
  color: var(--text-3);
  flex-shrink: 0;
  font-variant-numeric: tabular-nums;
  padding-top: 2px;
}

/* ===== Greeting ===== */
.greeting {
  display: flex;
  align-items: center;
  gap: 14px;
}
.greeting .avatar {
  width: 52px;
  height: 52px;
  border-radius: var(--radius-full);
  background: linear-gradient(135deg, #3a3f47 0%, #16181c 100%);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 18px;
  flex-shrink: 0;
  box-shadow: 0 6px 18px rgba(20, 22, 26, 0.18);
}
.greeting-text h2 {
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.01em;
  margin-bottom: 2px;
}
.greeting-text p {
  font-size: 13px;
  color: var(--text-2);
}

/* ===== Online Panel ===== */
.online-panel {
  display: flex;
  flex-direction: column;
  padding: 0 20px 16px;
}
.online-panel .empty {
  padding: 24px 20px;
}
.online-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 0.5px solid var(--separator);
}
.online-item:last-child { border-bottom: none; }
.online-item .avatar {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-full);
  background: linear-gradient(135deg, #3a3f47 0%, #16181c 100%);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 15px;
  flex-shrink: 0;
}
.online-item .info { flex: 1; min-width: 0; }
.online-item .info strong {
  font-size: 14px;
  color: var(--text);
  display: block;
  margin-bottom: 2px;
}
.online-item .info small {
  font-size: 12px;
  color: var(--text-2);
}
.online-item .expiry {
  font-size: 12px;
  color: var(--text-3);
  font-variant-numeric: tabular-nums;
}

.online-dot {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 500;
  color: var(--green);
}
.online-dot::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: currentColor;
  animation: pulse 2s ease-in-out infinite;
}
.online-dot.offline {
  color: var(--text-3);
  background: var(--text-3);
  box-shadow: none;
  animation: none;
}
.online-dot.offline::before { animation: none; }
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

.empty {
  text-align: center;
  padding: 48px 20px;
  color: var(--text-3);
  font-size: 14px;
}

/* ===== Log Timeline ===== */
.log-timeline {
  position: relative;
  padding-left: 28px;
}
.log-timeline::before {
  content: "";
  position: absolute;
  left: 9px;
  top: 6px;
  bottom: 6px;
  width: 2px;
  background: var(--separator);
  border-radius: 1px;
}
.log-date-group { margin-bottom: 24px; }
.log-date-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 12px;
  margin-left: -28px;
  padding-left: 28px;
}
.log-item {
  position: relative;
  background: var(--surface);
  border: 0.5px solid var(--separator);
  border-radius: var(--radius);
  padding: 16px 18px;
  margin-bottom: 10px;
  box-shadow: var(--shadow-xs);
  cursor: pointer;
  transition: all var(--dur-fast) var(--ease-out);
}
.log-item:hover {
  box-shadow: var(--shadow-sm);
  border-color: rgba(0, 122, 255, 0.16);
}
.log-item::before {
  content: "";
  position: absolute;
  left: -23px;
  top: 22px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--surface);
  border: 2px solid var(--accent);
  box-shadow: 0 0 0 3px var(--bg);
}
.log-item.issue::before { border-color: var(--accent); }
.log-item.redeem::before { border-color: var(--green); }
.log-item.expire::before { border-color: var(--orange); }
.log-item.revoke::before { border-color: var(--red); }
.log-item.login::before { border-color: var(--purple); }

.log-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 6px;
}
.log-type-badge {
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: var(--radius-full);
  letter-spacing: 0.02em;
}
.log-type-badge.issue { background: var(--blue-soft); color: var(--accent); }
.log-type-badge.redeem { background: var(--green-soft); color: var(--green); }
.log-type-badge.expire { background: var(--orange-soft); color: var(--orange); }
.log-type-badge.revoke { background: var(--red-soft); color: var(--red); }
.log-type-badge.login { background: var(--purple-soft); color: var(--purple); }
.log-time {
  font-size: 12px;
  color: var(--text-3);
  font-variant-numeric: tabular-nums;
  margin-left: auto;
}
.log-title {
  font-size: 14px;
  font-weight: 500;
  color: var(--text);
  margin-bottom: 4px;
}
.log-detail {
  font-size: 13px;
  color: var(--text-2);
  font-family: var(--font-mono);
}
.log-meta {
  display: flex;
  gap: 12px;
  margin-top: 8px;
  font-size: 12px;
  color: var(--text-3);
}

/* ===== Tab Bar ===== */
.tabbar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  display: flex;
  gap: 0;
  padding: 6px 8px calc(6px + var(--safe-bottom));
  background-color: var(--bg);
  background-image: var(--tabbar-bg);
  -webkit-backdrop-filter: saturate(180%) blur(24px);
  backdrop-filter: saturate(180%) blur(24px);
  border-radius: 0;
  border: none;
  border-top: 1px solid var(--glass-border);
  box-shadow: 0 -6px 24px rgba(0, 0, 0, 0.06);
  z-index: 100;
  width: 100%;
  max-width: none;
}
.tabbar a {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 6px 4px;
  border-radius: 12px;
  color: var(--text-2);
  transition: all var(--dur-fast) var(--ease-out);
  gap: 3px;
  outline: none;
  -webkit-tap-highlight-color: transparent;
}
.tabbar a svg { width: 22px; height: 22px; }
.tabbar a b, .tabbar a span {
  font-size: 11px;
  font-weight: 500;
  font-style: normal;
}
.tabbar a:hover { color: var(--text); }
.tabbar a.active {
  background: var(--blue-soft);
  color: var(--accent);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.45);
}
.tabbar a.active b, .tabbar a.active span { font-weight: 600; }

/* ===== Toast ===== */
.toast {
  position: fixed;
  top: calc(72px + var(--safe-top));
  left: 50%;
  transform: translateX(-50%) translateY(-12px);
  z-index: 200;
  padding: 10px 20px;
  border-radius: var(--radius-full);
  background: var(--surface);
  color: var(--text);
  font-size: 14px;
  font-weight: 500;
  box-shadow: var(--shadow-lg);
  border: 0.5px solid var(--separator);
  opacity: 0;
  pointer-events: none;
  transition: all var(--dur-base) var(--ease-out);
  display: flex;
  align-items: center;
  gap: 8px;
}
.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}
.toast svg { width: 16px; height: 16px; color: var(--green); }

/* ===== Avatar colors ===== */
.avatar.c1, .user-avatar.c1 { background: linear-gradient(135deg, #4a5568 0%, #2d3748 100%); }
.avatar.c2, .user-avatar.c2 { background: linear-gradient(135deg, #64d2ff 0%, #0a84ff 100%); }
.avatar.c3, .user-avatar.c3 { background: linear-gradient(135deg, #6b705c 0%, #414a3b 100%); }
.avatar.c4, .user-avatar.c4 { background: linear-gradient(135deg, #7a3f4a 0%, #4e2a32 100%); }
.avatar.c5, .user-avatar.c5 { background: linear-gradient(135deg, #a08b6a 0%, #6e5c43 100%); }
.avatar, .user-avatar, .detail-avatar { color: #f5f6f7; }

/* ===== Stats Row (3-column) ===== */
.stats-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}
.stat-pill {
  background: var(--surface);
  border: 0.5px solid var(--separator);
  border-radius: var(--radius-sm);
  padding: 16px 12px;
  text-align: center;
  transition: transform var(--dur-fast) var(--ease-out);
}
.stat-pill:hover { transform: translateY(-1px); }
.stat-pill .stat-num {
  font-size: 24px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text);
  font-variant-numeric: tabular-nums;
  line-height: 1;
  margin-bottom: 4px;
}
.stat-pill .stat-label {
  font-size: 12px;
  color: var(--text-2);
  font-weight: 500;
}
.stat-pill.active .stat-num { color: var(--green); }
.stat-pill.new .stat-num { color: var(--accent); }
.stat-pill.total .stat-num { color: var(--purple); }

/* ===== Cards List (compact) ===== */
.cards-list {
  display: flex;
  flex-direction: column;
}
.card-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 20px;
  border-bottom: 0.5px solid var(--separator);
  transition: background var(--dur-fast) var(--ease-out);
}
.card-item:last-child { border-bottom: none; }
.card-item:hover { background: var(--surface-2); }
.card-left { display: flex; align-items: center; gap: 12px; min-width: 0; }
.card-icon {
  width: 36px;
  height: 36px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
}
.card-icon svg { width: 20px; height: 20px; }
.card-icon.pending { color: var(--accent); background: var(--blue-soft); }
.card-icon.active { color: var(--green); background: var(--green-soft); }
.card-icon.expire { color: var(--orange); background: var(--orange-soft); }
.card-icon.revoke { color: var(--red); background: var(--red-soft); }
.card-suffix {
  font-family: var(--font-mono);
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  letter-spacing: 0.03em;
  padding: 6px 10px;
  background: var(--surface-2);
  border-radius: var(--radius-xs);
  border: 0.5px solid var(--separator);
}
.card-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  font-size: 13px;
  color: var(--text-2);
}
.card-meta .card-note { color: var(--text-2); }
.card-right {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}
.card-hint {
  font-size: 12px;
  color: var(--text-3);
}

.cards-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}
.cards-toolbar .search-bar {
  flex: 0 0 240px;
  height: 40px;
}

/* ===== Table (fallback, kept for compatibility) ===== */
.licenses-table {
  width: 100%;
  border-collapse: collapse;
}
.licenses-table th,
.licenses-table td {
  padding: 14px 20px;
  text-align: left;
  border-bottom: 0.5px solid var(--separator);
}
.licenses-table th {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  background: var(--surface-2);
}
.licenses-table tbody tr:hover { background: var(--surface-2); }
.licenses-table tbody tr:last-child td { border-bottom: none; }

.user-cell {
  display: flex;
  align-items: center;
  gap: 12px;
}
.user-cell .avatar {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-full);
  background: linear-gradient(135deg, #3a3f47 0%, #16181c 100%);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 15px;
  flex-shrink: 0;
}
.user-cell .user-info strong {
  display: block;
  font-size: 14px;
  margin-bottom: 2px;
}
.user-cell .user-info small {
  font-size: 12px;
  color: var(--text-2);
  display: block;
}
.user-cell .machine-tag {
  color: var(--text-3);
  margin-top: 2px;
}

/* ===== Responsive (Mobile-first, optimize for phone) ===== */

:root {
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

/* —— Mobile & Tablet (≤ 767px) —— */
@media (max-width: 767px) {
  .topbar {
    position: sticky;
    top: 0;
    z-index: 50;
  }
  .topbar > div { padding: 14px 20px 10px; }
  .topbar h1 { font-size: 24px; }
  .topbar .eyebrow { font-size: 11px; }

  main {
    padding: 14px 16px 100px;
  }

  /* Stats: 2 columns, more compact */
  .stats {
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    margin-bottom: 16px;
  }
  .stat-card {
    padding: 14px;
    border-radius: 16px;
  }
  .stat-icon {
    width: 36px;
    height: 36px;
    margin-bottom: 8px;
  }
  .stat-icon svg { width: 18px; height: 18px; }
  .stat-card span { font-size: 12px; }
  .stat-card strong { font-size: 22px; }
  .stat-card small { font-size: 11px; }

  /* Section cards */
  .section-card {
    padding: 14px;
    border-radius: 18px;
    margin-bottom: 14px;
  }
  .section-heading {
    margin-bottom: 12px;
    padding-bottom: 10px;
  }
  .section-heading h2 { font-size: 15px; }
  .section-heading a { font-size: 12px; }

  /* List items — compact, smaller icons */
  .license-item, .user-item, .list-row, .card-item {
    padding: 12px 16px;
  }
  .license-icon, .user-avatar, .activity-icon {
    width: 40px !important;
    height: 40px !important;
    border-radius: 12px;
    flex-shrink: 0;
  }
  .license-icon svg, .activity-icon svg,
  .card-left svg, .user-item svg {
    width: 18px !important;
    height: 18px !important;
  }
  .user-avatar { font-size: 14px; }

  .card-left { gap: 10px; }
  .card-meta span { font-size: 12px; }
  .card-meta .status { font-size: 11px; padding: 2px 8px; }
  .card-right { gap: 2px; }
  .card-hint { font-size: 11px; }

  /* User list — make action buttons smaller on mobile */
  .user-info { min-width: 0; }
  .user-name { font-size: 14px; }
  .user-meta { font-size: 12px; }
  .action-btns { gap: 6px; }
  .action-btn {
    width: 34px;
    height: 34px;
  }
  .action-btn svg { width: 16px; height: 16px; }
  .user-license-status {
    font-size: 11px;
    padding: 2px 8px;
  }

  /* Search bar */
  .search-bar {
    height: 40px;
    margin-bottom: 14px;
  }
  .search-bar svg { width: 16px; height: 16px; }
  .search-bar input { font-size: 14px; }

  /* Chips toolbar */
  .cards-toolbar {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
    margin-bottom: 14px;
  }
  .chip-group {
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 2px;
    scrollbar-width: none;
  }
  .chip-group::-webkit-scrollbar { display: none; }
  .chip {
    flex-shrink: 0;
    font-size: 12px;
    padding: 6px 12px;
  }

  /* Issued card */
  .issued-card {
    padding: 24px 20px;
    border-radius: 20px;
  }
  .issued-code {
    font-size: 30px;
    letter-spacing: 2px;
    padding: 14px 0;
  }
  .countdown { font-size: 13px; }

  /* Form */
  .form-stack { padding: 18px; }
  .form-stack label { font-size: 13px; }
  .form-stack input, .form-stack select, .form-stack textarea {
    height: 42px;
    font-size: 15px;
    border-radius: 10px;
  }
  .primary-button {
    height: 46px;
    font-size: 15px;
    border-radius: 12px;
  }

  /* Online panel */
  .online-item {
    padding: 10px 0;
    gap: 10px;
  }
  .online-item .avatar {
    width: 38px;
    height: 38px;
    font-size: 14px;
  }
  .online-item .info strong { font-size: 13px; }
  .online-item .info small { font-size: 11px; }
  .online-item .expiry { font-size: 11px; }

  /* Tabbar — docked to the bottom edge */
  .tabbar {
    bottom: 0;
    width: 100%;
    padding: 6px 8px calc(6px + var(--safe-bottom));
    border-radius: 0;
    gap: 0;
  }
  .tabbar a {
    padding: 6px 4px;
    gap: 2px;
  }
  .tabbar a svg { width: 20px; height: 20px; }
  .tabbar a b { font-size: 10px; }

  /* List rows */
  .list-row {
    padding: 12px 20px;
    gap: 10px;
  }

  /* Search bar inside toolbar */
  .cards-toolbar .search-bar {
    margin-bottom: 0;
  }

  /* Messages / toast */
  .messages {
    top: calc(60px + var(--safe-top));
  }
}

/* —— Desktop (≥ 768px) —— */
@media (min-width: 768px) {
  :root { --max-w: 820px; }
  main {
    padding-top: 28px;
    padding-bottom: 40px;
  }
  .stats { grid-template-columns: repeat(4, 1fr); }
  .tabbar {
    bottom: 0;
  }
}

/* ================================================================
   Login Page — Apple-inspired glass card
   ================================================================ */

.login-body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg);
  font-family: var(--font-sans);
  color: var(--text);
  overflow: hidden;
  position: relative;
}

.login-bg {
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  background: var(--login-bg);
}

.login-blob {
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
  opacity: 0.5;
  animation: float 20s ease-in-out infinite;
}

.blob-1 {
  width: 500px;
  height: 500px;
  background: linear-gradient(135deg, #0a84ff 0%, #004a9e 100%);
  top: -150px;
  left: -100px;
  animation-delay: 0s;
  opacity: 0.18;
}

.blob-2 {
  width: 400px;
  height: 400px;
  background: linear-gradient(135deg, #64d2ff 0%, #0a84ff 100%);
  bottom: -100px;
  right: -80px;
  animation-delay: -7s;
  opacity: 0.28;
}

.blob-3 {
  width: 350px;
  height: 350px;
  background: linear-gradient(135deg, #8b95a3 0%, #4a525c 100%);
  top: 40%;
  left: 50%;
  transform: translateX(-50%);
  animation-delay: -14s;
  opacity: 0.22;
}

@keyframes float {
  0%, 100% { transform: translate(0, 0) scale(1); }
  33% { transform: translate(30px, -40px) scale(1.08); }
  66% { transform: translate(-20px, 30px) scale(0.95); }
}

.login-wrap {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 420px;
  padding: 24px;
}

.login-card {
  background: var(--login-card-bg);
  backdrop-filter: saturate(160%) blur(24px);
  -webkit-backdrop-filter: saturate(160%) blur(24px);
  border: 1px solid var(--separator);
  border-radius: 20px;
  padding: 40px 32px 32px;
  box-shadow:
    0 18px 50px rgba(48, 36, 18, 0.12),
    0 2px 8px rgba(48, 36, 18, 0.05);
}

.login-brand {
  text-align: center;
  margin-bottom: 32px;
}

.login-logo {
  width: 56px;
  height: 56px;
  border-radius: 16px;
  background: linear-gradient(135deg, #0a84ff 0%, #0066d6 100%);
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  font-weight: 600;
  letter-spacing: 0.04em;
  margin: 0 auto 16px;
  box-shadow: 0 8px 24px rgba(0, 122, 255, 0.22);
}

.login-brand h1 {
  margin: 0 0 6px;
  font-size: 22px;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--text);
}

.login-brand p {
  margin: 0;
  font-size: 14px;
  color: var(--text-2);
}

.login-error {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(193, 18, 31, 0.08);
  color: var(--red);
  padding: 12px 14px;
  border-radius: 12px;
  font-size: 13px;
  font-weight: 500;
  margin-bottom: 20px;
  border: 1px solid rgba(193, 18, 31, 0.16);
}

.login-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.login-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.login-field label {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-2);
  margin-left: 2px;
}

.login-input-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 14px;
  height: 44px;
  background: var(--login-input-bg);
  border: 1px solid var(--separator);
  border-radius: 12px;
  transition: all 0.2s ease;
  color: var(--text-3);
}

.login-input-wrap:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(0, 122, 255, 0.12);
  color: var(--accent);
}

.login-input-wrap input {
  flex: 1;
  border: none;
  outline: none;
  background: transparent;
  font-size: 15px;
  color: var(--text);
  font-family: inherit;
}

.login-input-wrap input::placeholder {
  color: var(--text-3);
}

.login-submit {
  margin-top: 8px;
  height: 46px;
  border: none;
  border-radius: 12px;
  background: var(--login-btn-bg);
  color: var(--login-btn-fg);
  font-size: 15px;
  font-weight: 600;
  font-family: inherit;
  letter-spacing: 0.04em;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: all 0.15s ease;
  box-shadow: var(--btn-primary-shadow);
}

.login-submit:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 18px rgba(20, 22, 26, 0.22);
}

.login-submit:active {
  transform: translateY(0);
  box-shadow: 0 2px 6px rgba(20, 22, 26, 0.14);
}

.login-footer {
  margin-top: 28px;
  text-align: center;
  font-size: 12px;
  color: var(--text-3);
}

/* Dark mode for login */

/* ================================================================
   Modal / Bottom Sheet
   ================================================================ */

.modal-backdrop,
.confirm-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  z-index: 200;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.25s ease, visibility 0.25s ease;
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
}
.modal-backdrop.show,
.confirm-backdrop.show {
  opacity: 1;
  visibility: visible;
}

.modal-sheet {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 201;
  background: var(--modal-bg);
  -webkit-backdrop-filter: saturate(180%) blur(40px);
  backdrop-filter: saturate(180%) blur(40px);
  border-top: 1px solid var(--glass-border);
  border-top-left-radius: 28px;
  border-top-right-radius: 28px;
  box-shadow: 0 -8px 40px rgba(0, 0, 0, 0.14);
  transform: translateY(100%);
  transition: transform 0.35s cubic-bezier(0.32, 0.72, 0, 1);
  max-height: calc(100dvh - 8px);
  height: auto;
  border-radius: 22px 22px 0 0;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  padding-bottom: 0;
}
.modal-sheet.show {
  transform: translateY(0);
}
.modal-sheet {
  scrollbar-width: none;
  -ms-overflow-style: none;
}
.modal-sheet::-webkit-scrollbar {
  width: 0;
  height: 0;
  display: none;
}
.modal-handle {
  width: 36px;
  height: 5px;
  background: var(--separator);
  border-radius: 3px;
  margin: 10px auto 0;
}
.modal-content {
  padding: 16px 20px 8px;
}

/* Desktop modal — centered card */
@media (min-width: 768px) {
  .modal-sheet {
    top: 50%;
    left: 50%;
    right: auto;
    bottom: auto;
    width: min(960px, calc(100vw - 24px));
    height: auto;
    max-height: calc(100vh - 24px);
    border: 1px solid var(--glass-border);
    border-radius: 24px;
    transform: translate(-50%, -45%) scale(0.96);
    opacity: 0;
    transition: transform 0.3s cubic-bezier(0.32, 0.72, 0, 1), opacity 0.25s ease;
    padding-bottom: 0;
  }
  .modal-content {
    padding: 20px 30px 0;
  }
  .detail-header { margin-bottom: 14px; }
  .detail-section { margin-bottom: 14px; }
  .detail-row { padding: 10px 14px; }
  .detail-actions .primary-button { height: 40px; }
  .renew-options {
    grid-template-columns: repeat(6, 1fr);
    margin-top: 8px;
  }
  .renew-option { padding: 10px 6px; }
  .renew-option .days { font-size: 16px; margin-bottom: 0; }
  .renew-option .label { font-size: 11px; }
  .modal-sheet.show {
    transform: translate(-50%, -50%) scale(1);
    opacity: 1;
  }
  .modal-handle { display: none; }
  .modal-content { padding: 24px 28px 8px; }
}

/* ================================================================
   Confirm Dialog
   ================================================================ */

.confirm-dialog {
  position: fixed;
  left: 50%;
  top: 50%;
  z-index: 300;
  width: calc(100% - 48px);
  max-width: 320px;
  background: var(--modal-bg);
  -webkit-backdrop-filter: saturate(180%) blur(40px);
  backdrop-filter: saturate(180%) blur(40px);
  border: 1px solid var(--glass-border);
  border-radius: 24px;
  padding: 28px 24px 20px;
  transform: translate(-50%, -50%) scale(0.9);
  opacity: 0;
  visibility: hidden;
  transition: all 0.25s cubic-bezier(0.32, 0.72, 0, 1);
  box-shadow: var(--shadow-lg);
  text-align: center;
}
.confirm-dialog.show {
  transform: translate(-50%, -50%) scale(1);
  opacity: 1;
  visibility: visible;
}
.confirm-icon {
  width: 56px;
  height: 56px;
  margin: 0 auto 16px;
  border-radius: 50%;
  background: var(--orange-soft);
  color: var(--orange);
  display: flex;
  align-items: center;
  justify-content: center;
}
.confirm-icon svg { width: 28px; height: 28px; }
.confirm-title {
  margin: 0 0 8px;
  font-size: 17px;
  font-weight: 600;
  color: var(--text);
}
.confirm-desc {
  margin: 0 0 16px;
  font-size: 14px;
  color: var(--text-2);
  line-height: 1.5;
}
.confirm-extra {
  margin-bottom: 16px;
}
.confirm-input {
  width: 100%;
  height: 40px;
  padding: 0 14px;
  border: 1px solid var(--separator);
  border-radius: 10px;
  font-size: 14px;
  font-family: inherit;
  background: var(--surface-2);
  color: var(--text);
  text-align: center;
  outline: none;
  transition: all 0.15s ease;
  box-sizing: border-box;
}
.confirm-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(0, 122, 255, 0.12);
}
.confirm-actions {
  display: flex;
  gap: 10px;
}
.confirm-btn {
  flex: 1;
  height: 42px;
  border: none;
  border-radius: 12px;
  font-size: 14px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.15s ease;
}
.confirm-btn.cancel {
  background: var(--surface-2);
  color: var(--text);
}
.confirm-btn.cancel:active {
  background: var(--separator);
}
.confirm-btn.danger {
  background: var(--btn-danger-bg);
  color: var(--btn-danger-fg);
  box-shadow: 0 2px 8px rgba(193, 18, 31, 0.3);
}
.confirm-btn.danger:active {
  transform: scale(0.97);
}
.confirm-btn.danger:disabled {
  background: var(--gray-soft);
  color: var(--text-3);
  box-shadow: none;
  cursor: not-allowed;
}
.confirm-btn.primary {
  background: var(--btn-primary-bg);
  color: var(--btn-primary-fg);
  box-shadow: 0 2px 8px rgba(20, 22, 26, 0.18);
}
.confirm-btn.primary:active {
  transform: scale(0.97);
}

/* ================================================================
   Animations & Micro-interactions
   ================================================================ */

/* Button press effect */
.primary-button,
.action-btn,
.icon-button,
.chip,
.quick-btn,
.stat-card,
.card-item,
.user-item,
.license-item {
  transition: transform 0.15s ease, background 0.2s ease, box-shadow 0.2s ease;
}
.primary-button:active {
  transform: scale(0.97);
}
.action-btn:active {
  transform: scale(0.9);
}
.icon-button:active {
  transform: scale(0.9);
}
.chip:active {
  transform: scale(0.95);
}
.quick-btn:active {
  transform: scale(0.96);
}

/* Card press */
.card-item:active,
.user-item:active,
.license-item:active {
  background: var(--surface-2);
}

/* Stat card press */
.stat-card:active {
  transform: scale(0.98);
}

/* Tab bar icon bounce */
.tabbar a {
  transition: all 0.2s cubic-bezier(0.32, 0.72, 0, 1);
}
.tabbar a:active {
  transform: scale(0.9);
}

/* Fade-in for page content */
main > * {
  animation: fadeSlideUp 0.4s cubic-bezier(0.32, 0.72, 0, 1) both;
}
main > *:nth-child(1) { animation-delay: 0.02s; }
main > *:nth-child(2) { animation-delay: 0.06s; }
main > *:nth-child(3) { animation-delay: 0.1s; }

@keyframes fadeSlideUp {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Status dot pulse for online */
@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.7; transform: scale(1.15); }
}
.online-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--green-bright);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--green-bright) 22%, transparent);
  animation: pulse 2s ease-in-out infinite;
}

/* ================================================================
   User Detail Modal
   ================================================================ */

.detail-header {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 20px;
  padding-right: 58px;
}
.detail-avatar {
  width: 56px;
  height: 56px;
  border-radius: 16px;
  background: linear-gradient(135deg, #3a3f47 0%, #16181c 100%);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  font-weight: 600;
  flex-shrink: 0;
}
.detail-info { flex: 1; min-width: 0; }
.detail-name {
  font-size: 18px;
  font-weight: 600;
  color: var(--text);
  margin: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
  max-width: 100%;
}
.detail-status-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--text-2);
}

.detail-section {
  margin-bottom: 18px;
}
.detail-section-title {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin: 0 0 10px;
}
.detail-list {
  background: var(--surface-2);
  border-radius: 14px;
  overflow: hidden;
}
.detail-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 14px;
  border-bottom: 0.5px solid var(--separator);
  font-size: 14px;
}
.detail-row:last-child { border-bottom: none; }
.detail-row .label { color: var(--text-2); }
.detail-row .value {
  color: var(--text);
  font-weight: 500;
  text-align: right;
  max-width: 60%;
  word-break: break-all;
}
.detail-row .value.mono {
  font-family: var(--font-mono);
  font-size: 13px;
}

/* Renew options */
.renew-options {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}
.renew-option {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 14px 8px;
  background: var(--surface-2);
  border: 1.5px solid transparent;
  border-radius: 14px;
  cursor: pointer;
  transition: all 0.15s ease;
  text-align: center;
}
.renew-option:active {
  transform: scale(0.97);
}
.renew-option.selected {
  border-color: var(--accent);
  background: var(--blue-soft);
}
.renew-option .days {
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 2px;
}
.renew-option .label {
  font-size: 12px;
  color: var(--text-2);
}

.detail-actions {
  display: flex;
  gap: 10px;
  margin-top: 8px;
}
.detail-actions .primary-button {
  flex: 1;
  height: 44px;
  font-size: 14px;
}

/* Device info expand */
.device-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 6px;
}
.device-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: var(--surface-2);
  border-radius: 10px;
  padding: 8px 12px;
}
.device-item .d-label {
  font-size: 11px;
  color: var(--text-3);
  margin-bottom: 0;
  flex-shrink: 0;
}
.device-item .d-value {
  font-size: 13px;
  color: var(--text);
  font-weight: 500;
  text-align: right;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Session history in detail panel */
.session-list {
  display: flex;
  flex-direction: column;
}
.session-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 0;
  border-bottom: 0.5px solid var(--separator);
}
.session-item:last-child { border-bottom: none; }
.session-main {
  flex: 1;
  min-width: 0;
}
.session-host {
  font-size: 14px;
  font-weight: 500;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.session-time {
  font-size: 12px;
  color: var(--text-3);
  margin-top: 2px;
}
.session-right {
  display: flex;
  align-items: center;
  flex-shrink: 0;
}

/* Online list in modal */
.online-modal-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 0.5px solid var(--separator);
}
.online-modal-item:last-child { border-bottom: none; }
.online-modal-item .avatar {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  background: linear-gradient(135deg, #3a3f47 0%, #16181c 100%);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 600;
  flex-shrink: 0;
}
.online-modal-item .info { flex: 1; min-width: 0; }
.online-modal-item .name {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 2px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.online-modal-item .meta {
  font-size: 12px;
  color: var(--text-2);
}
.online-modal-item .expiry {
  font-size: 11px;
  color: var(--text-3);
  font-family: var(--font-mono);
}

/* Empty state in modal */
.modal-empty {
  text-align: center;
  padding: 40px 20px;
  color: var(--text-3);
  font-size: 14px;
}

/* Close button for modal */
.modal-close {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--surface-2);
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-2);
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
  transition: all 0.15s ease;
}
.modal-close:active { transform: scale(0.9); }
.modal-close svg { width: 16px; height: 16px; }
.modal-close { padding-bottom: 2px; }
.modal-close.modal-back {
  width: auto;
  height: 30px;
  padding: 0 12px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0;
}

/* Detail name row with edit button */
.detail-name-row {
  display: flex;
  align-items: center;
  gap: 6px;
}
.detail-name-row .detail-name { flex: 0 1 auto; }
.edit-note-btn {
  height: 24px;
  padding: 0 8px;
  border-radius: 6px;
  border: none;
  background: transparent;
  color: var(--text-3);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  white-space: nowrap;
  flex-shrink: 0;
  opacity: 1;
  transition: all 0.15s ease;
}
.edit-note-btn:hover {
  background: var(--surface-2);
  color: var(--accent);
}
.edit-note-btn:active { transform: scale(0.9); }

/* Note edit form */
.note-edit-form {
  margin: 12px 0 16px;
  padding: 14px;
  background: var(--surface-2);
  border-radius: 14px;
}
.note-edit-form input {
  width: 100%;
  padding: 10px 14px;
  border: 1.5px solid var(--border);
  border-radius: 10px;
  font-size: 15px;
  background: var(--surface);
  color: var(--text);
  outline: none;
  box-sizing: border-box;
  transition: border-color 0.15s ease;
}
.note-edit-form input:focus {
  border-color: var(--accent);
}
.note-edit-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 10px;
}
.chip-btn {
  padding: 8px 16px;
  border: none;
  border-radius: 10px;
  background: var(--surface-3);
  color: var(--text-2);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s ease;
}
.chip-btn:active { transform: scale(0.96); }
.primary-button.small {
  padding: 8px 18px;
  font-size: 14px;
}

/* Full code display */
.full-code {
  font-size: 15px !important;
  letter-spacing: 1px;
  color: var(--text) !important;
  font-weight: 600;
}

/* Renew options - 3 columns for 6 options */
@media (max-width: 767px) {
  .renew-options {
    grid-template-columns: repeat(3, 1fr);
    margin-top: 12px;
  }
}

/* Audit target text */
.audit-target {
  color: var(--text-3) !important;
  font-size: 12px !important;
  font-weight: 400 !important;
}

/* User list code display */
.user-code {
  font-weight: 600;
  letter-spacing: 0.5px;
}

/* Card delete button */
.card-delete-btn {
  height: 26px;
  padding: 0 8px;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: var(--text-3);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  white-space: nowrap;
  flex-shrink: 0;
  transition: all 0.15s ease;
  margin-left: 0;
}
.card-delete-btn svg { width: 16px; height: 16px; }
.card-delete-btn:hover {
  background: rgba(193, 18, 31, 0.10);
  color: var(--red);
}
.card-delete-btn:active { transform: scale(0.9); }

/* Required field marker */
.required {
  color: var(--red);
  font-weight: 600;
  margin-left: 2px;
}

/* Primary button variants */
.primary-button.warn {
  background: var(--btn-warn-bg);
  color: var(--btn-warn-fg);
  border-color: transparent;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.22), 0 2px 10px rgba(255, 179, 0, 0.22);
}
.primary-button.success {
  background: var(--btn-success-bg);
  color: var(--btn-success-fg);
  border-color: transparent;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.14), 0 2px 10px rgba(6, 122, 52, 0.22);
}
.primary-button.danger {
  background: var(--btn-danger-bg);
  color: var(--btn-danger-fg);
  border-color: transparent;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.14), 0 2px 10px rgba(193, 18, 31, 0.22);
}

/* Renew button - clean flat style */
.renew-btn {
  width: 100%;
  justify-content: center;
  margin-bottom: 14px;
  background: var(--btn-primary-bg);
  color: var(--btn-primary-fg);
  border-color: transparent;
  box-shadow: var(--btn-primary-shadow);
  transition: all 0.15s ease;
}
.renew-btn:active {
  transform: scale(0.98);
  opacity: 0.9;
  box-shadow: var(--btn-primary-shadow);
}
.renew-btn:disabled {
  opacity: 0.42;
  cursor: not-allowed;
  box-shadow: none;
}
.renew-btn:disabled:hover {
  transform: none;
  box-shadow: none;
}

/* Renew section - clean separation */
.renew-section {
  position: static;
  margin: 0;
  padding: 12px 0 calc(10px + var(--safe-bottom));
  border-radius: 0;
  border-top: 1px solid var(--separator);
}

/* Card code full display */
.card-code {
  color: var(--text-2);
  font-family: var(--font-mono);
}

/* Confirm dialog - single button mode */
.confirm-actions.single .confirm-btn {
  flex: none;
  width: 100%;
}

/* Compact full-screen detail sheet on phones */
@media (max-width: 767px) {
  .modal-content { padding: 8px 16px calc(10px + var(--safe-bottom)); }
  .modal-handle { margin: 6px auto 0; height: 4px; }
  .modal-close { top: 8px; right: 10px; width: 28px; height: 28px; font-size: 18px; }

  .detail-header { gap: 10px; margin-bottom: 10px; }
  .detail-avatar { width: 44px; height: 44px; border-radius: 13px; font-size: 17px; }
  .detail-name { font-size: 20px; }
  .detail-status-row { gap: 6px; font-size: 12px; margin-top: 4px; }

  .detail-section { margin-bottom: 10px; }
  .detail-section-title { font-size: 11px; margin-bottom: 6px; }

  .detail-row { padding: 7px 12px; font-size: 13px; }
  .detail-row .value.mono { font-size: 12px; }

  .device-grid { grid-template-columns: 1fr; gap: 6px; }
  .device-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 7px 11px;
    border-radius: 9px;
  }
  .device-item .d-label { font-size: 11px; margin-bottom: 0; flex-shrink: 0; }
  .device-item .d-value {
    font-size: 12px;
    text-align: right;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .detail-actions { gap: 8px; margin-top: 4px; }
  .detail-actions .primary-button { height: 38px; font-size: 13px; }

  .renew-section { padding: 8px 0 0; border-top: none; }
  .renew-btn { height: 40px; font-size: 14px; margin-bottom: 8px; }
  .renew-options { gap: 6px; margin-top: 6px; }
  .renew-option { padding: 7px 4px; border-radius: 11px; }
  .renew-option .days { font-size: 15px; margin-bottom: 0; }
  .renew-option .label { font-size: 10px; }
}

@media (min-width: 768px) {
  .renew-options {
    grid-template-columns: repeat(6, 1fr);
    margin-top: 8px;
  }
  .renew-option { padding: 10px 6px; }
  .renew-option .days { font-size: 16px; margin-bottom: 0; }
}

/* Mobile performance: avoid expensive live blur while scrolling */
@media (max-width: 767px) {
  html { background-attachment: scroll; }

  .topbar {
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
    background: color-mix(in srgb, var(--bg) 90%, transparent);
  }
  .stat-card, .section-card {
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
    background-color: color-mix(in srgb, var(--surface) 66%, transparent);
  }
  .tabbar {
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
  }
  .modal-sheet, .confirm-dialog {
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
    background: color-mix(in srgb, var(--bg) 96%, transparent);
  }
  .modal-backdrop, .confirm-backdrop {
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
    background: rgba(0, 0, 0, 0.46);
  }
  .online-dot::before,
  .issued-card::before,
  .login-blob { animation: none; }
  .login-blob { filter: blur(40px); }
}

/* Motion respects system accessibility settings */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
}
