/* ============================================
   声音复刻 - Design System v3
   Modern, clean, animated UI for AI voice platform
   ============================================ */

/* ---------- Design Tokens ---------- */
:root {
  /* Brand */
  --brand-500: #6366f1;
  --brand-600: #4f46e5;
  --brand-400: #818cf8;
  --brand-300: #a5b4fc;
  --brand-100: #e0e7ff;
  --brand-50:  #eef2ff;

  /* Violet accent */
  --violet-500: #8b5cf6;
  --violet-600: #7c3aed;

  /* Surface */
  --bg-base:   #f8fafc;
  --bg-elevated: #ffffff;
  --bg-sidebar:#0f172a;
  --bg-sidebar-hover: rgba(255,255,255,.06);
  --bg-sidebar-active: linear-gradient(135deg, var(--brand-500), var(--violet-500));

  /* Text */
  --ink-900:   #0f172a;
  --ink-800:   #1e293b;
  --ink-700:   #334155;
  --ink-600:   #475569;
  --ink-500:   #64748b;
  --ink-400:   #94a3b8;
  --ink-300:   #cbd5e1;

  /* Border & Divider */
  --line:      #e2e8f0;
  --line-light:#f1f5f9;

  /* Semantic */
  --ok:        #16a34a;
  --ok-50:     #dcfce7;
  --ok-100:    #bbf7d0;
  --danger:    #dc2626;
  --danger-50: #fee2e2;
  --danger-100:#fecaca;
  --warn:      #d97706;
  --warn-50:   #fef3c7;
  --warn-100:  #fde68a;
  --info:      var(--brand-500);
  --info-50:   #e0e7ff;
  --info-100:  #c7d2fe;

  /* Shadow scale */
  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.04);
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.06), 0 2px 4px -2px rgb(0 0 0 / 0.04);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.07), 0 4px 6px -4px rgb(0 0 0 / 0.04);
  --shadow-xl: 0 20px 25px -5px rgb(0 0 0 / 0.08), 0 8px 10px -6px rgb(0 0 0 / 0.04);
  --shadow-glow: 0 0 20px rgba(99,102,241,.15);

  /* Radius */
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 20px;
  --radius-full: 9999px;

  /* Motion */
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
  --duration-fast: 150ms;
  --duration-normal: 250ms;
  --duration-slow: 350ms;
}

/* ---------- Reset & Base ---------- */
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
               "Microsoft YaHei", "Noto Sans SC", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg-base);
  color: var(--ink-700);
  font-size: 14px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a { color: var(--brand-500); text-decoration: none; transition: color var(--duration-fast) var(--ease-out); }
a:hover { color: var(--brand-600); }
a:focus-visible { outline: 2px solid var(--brand-400); outline-offset: 2px; border-radius: 2px; }

button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: 2px solid var(--brand-400); outline-offset: 2px;
}
.nav a:focus-visible { outline-offset: -2px; border-radius: var(--radius-sm); }
.layout { display: flex; min-height: 100vh; }

/* Sidebar */
.sidebar {
  width: 240px;
  background: var(--bg-sidebar);
  color: var(--ink-300);
  display: flex; flex-direction: column;
  padding: 20px 0 16px;
  position: sticky; top: 0; height: 100vh;
  overflow-y: auto;
  z-index: 40;
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,.08) transparent;
  transition: transform var(--duration-normal) var(--ease-out);
}
.sidebar::-webkit-scrollbar { width: 4px; }
.sidebar::-webkit-scrollbar-track { background: transparent; }
.sidebar::-webkit-scrollbar-thumb { background: rgba(255,255,255,.08); border-radius: var(--radius-full); }

.sidebar .logo {
  font-size: 18px; font-weight: 700; color: #fff;
  padding: 8px 24px 20px;
  display: flex; align-items: center; gap: 10px;
}
.sidebar .logo .dot {
  width: 10px; height: 10px; border-radius: 50%;
  background: linear-gradient(135deg, var(--brand-500), var(--violet-500));
  box-shadow: 0 0 8px rgba(99,102,241,.4);
}

.nav { display: flex; flex-direction: column; gap: 2px; padding: 0 12px; }
.nav a {
  color: var(--ink-400); padding: 10px 14px; border-radius: var(--radius-sm);
  display: flex; align-items: center; gap: 10px; font-size: 14px;
  font-weight: 500;
  transition: all var(--duration-fast) var(--ease-out);
  position: relative;
}
.nav a::before {
  content: '';
  position: absolute; left: 0; top: 50%; transform: translateY(-50%);
  width: 3px; height: 0; border-radius: 0 3px 3px 0;
  background: linear-gradient(180deg, var(--brand-500), var(--violet-500));
  transition: height var(--duration-normal) var(--ease-spring);
}
.nav a:hover { background: var(--bg-sidebar-hover); color: var(--ink-300); text-decoration: none; }
.nav a:hover::before { height: 20px; }
.nav a.active {
  background: var(--bg-sidebar-active); color: #fff;
  box-shadow: 0 4px 12px rgba(99,102,241,.25);
}
.nav a.active::before { height: 24px; }
.nav .ic { width: 20px; height: 20px; opacity: .85; display: flex; align-items: center; justify-content: center; }
.nav .ic svg { width: 18px; height: 18px; }

.sidebar .foot {
  margin-top: auto; padding: 14px 20px; font-size: 12px;
  color: var(--ink-500); border-top: 1px solid rgba(255,255,255,.06);
  margin-top: 20px;
}
.sidebar .foot > div:first-child {
  color: var(--ink-300); font-weight: 500; margin-bottom: 4px;
  word-break: break-all;
}
.sidebar .foot a { color: var(--ink-500); transition: color var(--duration-fast); }
.sidebar .foot a:hover { color: var(--ink-300); }

/* Main area */
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }

/* Topbar */
.topbar {
  background: var(--bg-elevated); border-bottom: 1px solid var(--line);
  padding: 12px 28px;
  display: flex; align-items: center; justify-content: space-between;
  position: sticky; top: 0; z-index: 30;
  backdrop-filter: blur(12px);
  background: rgba(255,255,255,.92);
}
.topbar .crumb { font-weight: 700; font-size: 16px; color: var(--ink-900); }
.topbar .right { display: flex; align-items: center; gap: 16px; color: var(--ink-500); font-size: 14px; }
.topbar .balance {
  background: var(--brand-50); padding: 6px 14px; border-radius: var(--radius-full);
  color: var(--brand-600); font-weight: 700; font-size: 13px;
  border: 1px solid var(--brand-100);
  transition: all var(--duration-fast);
}
.topbar .balance:hover { background: var(--brand-100); }
.topbar .right a.btn-like {
  background: var(--brand-500); color: #fff; padding: 6px 14px; border-radius: var(--radius-full);
  font-weight: 600; font-size: 13px; transition: all var(--duration-fast);
}
.topbar .right a.btn-like:hover { background: var(--brand-600); color: #fff; }

/* Content */
.content { padding: 24px 28px; max-width: 1200px; }

/* ---------- Mobile Header ---------- */
.mobile-header {
  display: none;
  background: var(--bg-sidebar);
  color: #fff;
  padding: 12px 16px;
  align-items: center;
  justify-content: space-between;
  position: sticky; top: 0; z-index: 50;
}
.mobile-header .logo {
  font-weight: 700; font-size: 16px;
  display: flex; align-items: center; gap: 8px;
}
.mobile-header .logo .dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: linear-gradient(135deg, var(--brand-500), var(--violet-500));
}
.mobile-header .menu-btn {
  background: rgba(255,255,255,.08);
  border: none; color: #fff;
  width: 36px; height: 36px; border-radius: var(--radius-sm);
  cursor: pointer; display: flex; align-items: center; justify-content: center;
  font-size: 18px;
  transition: background var(--duration-fast);
}
.mobile-header .menu-btn:hover { background: rgba(255,255,255,.14); }

/* Mobile bottom nav */
.mobile-nav {
  display: none;
  position: fixed; bottom: 0; left: 0; right: 0;
  background: var(--bg-elevated); border-top: 1px solid var(--line);
  z-index: 50; padding: 6px 0 8px;
  justify-content: space-around;
  backdrop-filter: blur(12px);
  background: rgba(255,255,255,.95);
}
.mobile-nav a {
  display: flex; flex-direction: column; align-items: center;
  gap: 2px; font-size: 11px; color: var(--ink-400);
  padding: 4px 8px; border-radius: var(--radius-sm);
  transition: all var(--duration-fast);
  flex: 1; text-align: center;
}
.mobile-nav a .ic { width: 20px; height: 20px; display: flex; align-items: center; justify-content: center; }
.mobile-nav a .ic svg { width: 20px; height: 20px; }
.mobile-nav a.active { color: var(--brand-500); }
.mobile-nav a:hover { color: var(--brand-500); text-decoration: none; }

/* Mobile overlay */
.mobile-overlay {
  display: none;
  position: fixed; inset: 0; background: rgba(0,0,0,.4);
  z-index: 35; backdrop-filter: blur(2px);
  opacity: 0; transition: opacity var(--duration-normal) var(--ease-out);
}
.mobile-overlay.active { display: block; opacity: 1; }

/* ---------- Section Header ---------- */
.section-header {
  margin-bottom: 20px;
}
.section-header h2 {
  margin: 0 0 6px; font-size: 20px; font-weight: 700; color: var(--ink-900);
}
.section-header .muted {
  font-size: 14px; color: var(--ink-500);
}

/* ---------- Cards ---------- */
.card {
  background: var(--bg-elevated);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 22px 24px;
  margin-bottom: 20px;
  box-shadow: var(--shadow-sm);
  transition: box-shadow var(--duration-normal) var(--ease-out), transform var(--duration-normal) var(--ease-out);
}
.card:hover { box-shadow: var(--shadow-md); }
.card > h2:first-child,
.card > h3:first-child { margin-top: 0; }
.card h2 { margin: 0 0 14px; font-size: 18px; font-weight: 700; color: var(--ink-900); }
.card h3 { margin: 0 0 12px; font-size: 15px; font-weight: 700; color: var(--ink-900); }

/* Subtle gradient top accent on some cards */
.card.accent-top { position: relative; }
.card.accent-top::before {
  content: '';
  position: absolute; top: 0; left: 24px; right: 24px;
  height: 2px; border-radius: 0 0 2px 2px;
  background: linear-gradient(90deg, var(--brand-500), var(--violet-500));
  opacity: .5;
}

.muted { color: var(--ink-500); }

/* ---------- Grid ---------- */
.row { display: flex; gap: 16px; flex-wrap: wrap; }
.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }

/* ---------- Forms ---------- */
label.fld { display: block; margin-bottom: 14px; }
label.fld > span { display: block; margin-bottom: 6px; font-weight: 600; color: var(--ink-700); font-size: 13.5px; }
label.fld.inline { display: flex; align-items: center; gap: 8px; }
label.fld.inline > span { margin-bottom: 0; }

input[type=text], input[type=email], input[type=password], input[type=number],
input[type=file], select, textarea {
  width: 100%; padding: 10px 14px;
  border: 1.5px solid var(--line); border-radius: var(--radius-md);
  font-size: 14px; background: var(--bg-elevated); color: var(--ink-700);
  font-family: inherit;
  transition: all var(--duration-fast) var(--ease-out);
  box-shadow: var(--shadow-sm) inset;
}
input[type=text]:hover, input[type=email]:hover, input[type=password]:hover,
input[type=number]:hover, input[type=file]:hover, select:hover, textarea:hover {
  border-color: var(--ink-400);
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--brand-500);
  box-shadow: 0 0 0 3px rgba(99,102,241,.12), var(--shadow-sm) inset;
}
textarea { min-height: 100px; resize: vertical; }

input[type=file] { padding: 8px 12px; cursor: pointer; }
input[type=file]::file-selector-button {
  border: 1px solid var(--line); background: var(--line-light);
  border-radius: var(--radius-sm); padding: 5px 12px; margin-right: 10px;
  font-family: inherit; font-size: 13px; color: var(--ink-700); cursor: pointer;
  transition: all var(--duration-fast);
}
input[type=file]::file-selector-button:hover { background: var(--line); }

.file-field .file-name {
  margin-top: 6px; font-size: 12px; color: var(--ink-600);
  display: flex; align-items: center; gap: 6px;
}
.file-field .file-name::before {
  content: '';
  display: inline-block; width: 14px; height: 14px;
  background: currentColor;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M13 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V9z'/%3E%3Cpolyline points='13 2 13 9 20 9'/%3E%3C/svg%3E") no-repeat center / contain;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M13 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V9z'/%3E%3Cpolyline points='13 2 13 9 20 9'/%3E%3C/svg%3E") no-repeat center / contain;
}

/* Form layout utilities */
.form-row { display: flex; gap: 16px; flex-wrap: wrap; }
.form-row > .form-col { flex: 1; min-width: 260px; }
.form-row > .form-col.shrink { flex: 0 0 auto; }
.form-row > .form-col.fluid { flex: 1 1 100%; }
.form-row > .form-col .fld:last-child { margin-bottom: 0; }
.form-actions { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-top: 6px; }

.field-sm { width: 120px !important; }
.field-xs { width: 80px !important; }
.field-inline { display: inline-block; width: auto; }

/* Checkbox / radio inside forms */
input[type=checkbox], input[type=radio] {
  width: 18px; height: 18px; accent-color: var(--brand-500); cursor: pointer; flex: none;
}

.hint { font-size: 12px; color: var(--ink-500); margin-top: 5px; line-height: 1.5; }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  cursor: pointer; border: none;
  border-radius: var(--radius-md); padding: 10px 18px;
  font-size: 14px; font-weight: 600;
  background: var(--brand-500); color: #fff; font-family: inherit;
  transition: all var(--duration-fast) var(--ease-out);
  box-shadow: 0 1px 2px rgba(99,102,241,.2);
  position: relative; overflow: hidden;
}
.btn::after {
  content: '';
  position: absolute; inset: 0;
  background: linear-gradient(180deg, rgba(255,255,255,.12), transparent);
  pointer-events: none;
}
.btn:hover {
  background: var(--brand-600);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(99,102,241,.3);
}
.btn:active { transform: translateY(0); }
.btn.secondary {
  background: var(--line-light); color: var(--ink-700);
  box-shadow: var(--shadow-sm);
}
.btn.secondary:hover { background: var(--line); color: var(--ink-900); box-shadow: var(--shadow-md); }
.btn.danger { background: var(--danger); box-shadow: 0 1px 2px rgba(220,38,38,.2); }
.btn.danger:hover { background: #b91c1c; box-shadow: 0 4px 12px rgba(220,38,38,.25); }
.btn.ghost {
  background: transparent; color: var(--brand-500);
  border: 1.5px solid var(--brand-500);
  box-shadow: none;
}
.btn.ghost:hover { background: var(--brand-50); }
.btn.sm { padding: 6px 12px; font-size: 13px; }
.btn.lg { padding: 12px 24px; font-size: 15px; }
.btn:disabled,
.btn.is-loading {
  opacity: .65; cursor: not-allowed;
  transform: none !important; box-shadow: none !important;
}

.btn.is-loading .btn-text { opacity: .9; }

.btn-group { display: inline-flex; gap: 6px; flex-wrap: wrap; align-items: center; }

/* Loading spinner */
.spinner {
  width: 16px; height: 16px; border: 2px solid rgba(255,255,255,.35);
  border-top-color: #fff; border-radius: 50%;
  animation: spin 1s linear infinite;
  display: inline-block;
  flex: none;
}
.spinner.dark {
  border-color: rgba(15,23,42,.15);
  border-top-color: var(--brand-500);
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Form submit loading guard to prevent layout shift */
form.js-form-loading button[type="submit"].is-loading,
form .btn.is-loading {
  min-width: calc(1em + 24px);
}

/* ---------- Flash Messages ---------- */
.flash-container {
  max-width: 1100px;
  margin: 14px auto 0;
  padding: 0 26px;
}
.flash {
  border-radius: var(--radius-md); padding: 12px 16px; margin-bottom: 14px;
  font-size: 14px; font-weight: 500;
  animation: slideDown var(--duration-slow) var(--ease-out) both;
  display: flex; align-items: center; gap: 8px;
}
.flash::before { font-size: 16px; }
.flash.success { background: var(--ok-50); color: #166534; border: 1px solid var(--ok-100); }
.flash.success::before { content: '\2713'; }
.flash.danger  { background: var(--danger-50); color: #991b1b; border: 1px solid var(--danger-100); }
.flash.danger::before { content: '\26A0'; }
.flash.info    { background: var(--info-50); color: #3730a3; border: 1px solid var(--info-100); }
.flash.info::before { content: '\24D8'; }
.flash.warning { background: var(--warn-50); color: #92400e; border: 1px solid var(--warn-100); }
.flash.warning::before { content: '\26A0'; }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; border-radius: var(--radius-md); border: 1px solid var(--line); }
.table-wrap table { border-radius: 0; border: none; }
table { width: 100%; border-collapse: collapse; background: var(--bg-elevated); border-radius: var(--radius-md); overflow: hidden; }
th, td { text-align: left; padding: 12px 14px; border-bottom: 1px solid var(--line); font-size: 13.5px; }
th { color: var(--ink-500); font-weight: 600; background: var(--line-light); font-size: 12.5px; text-transform: uppercase; letter-spacing: .02em; }
tr { transition: background var(--duration-fast); }
tr:last-child td { border-bottom: none; }
tr:hover td { background: #f8faff; }
td code { font-size: 12px; }

/* Tags */
.tag {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 10px; border-radius: var(--radius-full);
  font-size: 12px; font-weight: 600;
}
.tag.ok { background: var(--ok-50); color: #166534; }
.tag.warn { background: var(--warn-50); color: #92400e; }
.tag.gray { background: var(--line-light); color: var(--ink-500); }
.tag.danger { background: var(--danger-50); color: #991b1b; }

/* ---------- Auth Pages ---------- */
.auth-wrap {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, #4f46e5 0%, #7c3aed 40%, #db2777 100%);
  padding: 24px;
  position: relative;
  overflow: hidden;
}
.auth-wrap::before {
  content: '';
  position: absolute; inset: 0;
  background: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23ffffff' fill-opacity='0.04'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
}
.auth-card {
  width: 100%; max-width: 440px;
  background: rgba(255,255,255,.96);
  border-radius: var(--radius-xl);
  padding: 36px 32px;
  box-shadow: var(--shadow-xl);
  position: relative;
  backdrop-filter: blur(20px);
  border: 1px solid rgba(255,255,255,.4);
  animation: fadeUp 600ms var(--ease-out) both;
}
.auth-card h1 { margin: 0 0 8px; font-size: 24px; font-weight: 800; color: var(--ink-900); }
.auth-card .sub { color: var(--ink-500); margin-bottom: 28px; font-size: 15px; }
.auth-card .brand { font-weight: 800; color: var(--brand-600); }
.auth-card .center { text-align: center; }
.auth-card .flash { animation: slideDown 400ms var(--ease-out) both; }

/* ---------- Model Cards ---------- */
.model-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.model-card {
  display: flex; gap: 14px; align-items: flex-start;
  background: var(--bg-elevated); border: 1px solid var(--line); border-radius: var(--radius-lg);
  padding: 18px; box-shadow: var(--shadow-sm);
  transition: box-shadow var(--duration-normal), transform var(--duration-normal);
}
.model-card:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); }
.model-card img, .model-card .ph {
  width: 56px; height: 56px; border-radius: var(--radius-md); object-fit: cover;
  background: linear-gradient(135deg, var(--brand-500), var(--violet-500));
  flex: none; box-shadow: var(--shadow-sm);
  display: flex; align-items: center; justify-content: center; color: #fff; font-size: 20px; font-weight: 700;
}
.model-card .name { font-weight: 700; font-size: 15px; color: var(--ink-900); }
.model-card .desc { color: var(--ink-500); font-size: 13px; margin: 4px 0 10px; line-height: 1.5; }
.price-row { display: flex; gap: 8px; flex-wrap: wrap; }
.pill {
  background: var(--line-light); padding: 4px 12px; border-radius: var(--radius-full);
  font-size: 12px; color: var(--ink-700); font-weight: 500;
  border: 1px solid var(--line);
}
.pill b { color: var(--brand-600); }

/* ---------- Stats ---------- */
.stat {
  background: var(--bg-elevated);
  border: 1px solid var(--line); border-radius: var(--radius-lg);
  padding: 20px;
  box-shadow: var(--shadow-sm);
  transition: box-shadow var(--duration-normal), transform var(--duration-normal);
}
.stat:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); }
.stat .k { color: var(--ink-500); font-size: 13px; font-weight: 500; }
.stat .v { font-size: 28px; font-weight: 800; margin-top: 6px; color: var(--ink-900); line-height: 1.2; }
.stat .v small { font-size: 13px; color: var(--ink-500); font-weight: 500; margin-left: 6px; }
.stat .v.positive { color: var(--ok); }
.stat .v.negative { color: var(--danger); }

/* ---------- Empty States ---------- */
.empty-state {
  text-align: center; padding: 48px 24px;
  color: var(--ink-500);
}
.empty-state .icon {
  width: 48px; height: 48px; margin: 0 auto 16px;
  color: var(--ink-300);
  display: flex; align-items: center; justify-content: center;
}
.empty-state .icon svg { width: 48px; height: 48px; }
.empty-state .title { font-weight: 600; color: var(--ink-700); margin-bottom: 6px; }
.empty-state .desc { font-size: 13px; max-width: 320px; margin: 0 auto; line-height: 1.6; }
.empty-state .btn { margin-top: 16px; }

/* ---------- Audio Player ---------- */
audio { border-radius: var(--radius-md); width: 100%; }
.audio-player-wrap {
  background: var(--line-light); border: 1px solid var(--line);
  border-radius: var(--radius-md); padding: 16px;
}
.audio-player-wrap audio { display: block; }

/* ---------- Code ---------- */
code {
  background: var(--line-light); padding: 2px 7px; border-radius: 6px;
  font-size: 12.5px; font-family: ui-monospace, "Cascadia Code", "SF Mono", Consolas, monospace;
  color: var(--ink-700); border: 1px solid var(--line);
}
hr.sep { border: none; border-top: 1px dashed var(--line); margin: 20px 0; }

/* ---------- Animations ---------- */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes slideDown {
  from { opacity: 0; transform: translateY(-8px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}
@keyframes pulse-ring {
  0% { transform: scale(.8); opacity: .6; }
  100% { transform: scale(1.4); opacity: 0; }
}

/* ---------- Pagination ---------- */
.pagination {
  display: flex; gap: 4px; align-items: center; justify-content: center;
  margin-top: 16px;
}
.pagination a, .pagination span {
  padding: 6px 12px; border-radius: var(--radius-sm);
  font-size: 13px; font-weight: 500;
  transition: all var(--duration-fast);
}
.pagination a { background: var(--bg-elevated); border: 1px solid var(--line); color: var(--ink-700); }
.pagination a:hover { background: var(--line-light); border-color: var(--ink-400); text-decoration: none; }
.pagination span { background: var(--brand-50); color: var(--brand-600); border: 1px solid var(--brand-100); }

/* ---------- Responsive ---------- */
@media (max-width: 1024px) {
  .grid-4 { grid-template-columns: repeat(2, 1fr); }
  .model-grid { grid-template-columns: repeat(2, 1fr); }
  .content { padding: 20px 22px; }
}

@media (max-width: 768px) {
  .sidebar {
    position: fixed; top: 0; left: 0; bottom: 0;
    transform: translateX(-100%);
    width: 260px; z-index: 60;
  }
  .sidebar.mobile-open { transform: translateX(0); }
  .mobile-header { display: flex; }
  .mobile-nav { display: flex; }
  .main { padding-bottom: 64px; }
  .content { padding: 16px; max-width: 100%; }
  .topbar { padding: 10px 16px; }
  .topbar .crumb { font-size: 15px; }
  .topbar .right { gap: 10px; }
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
  .model-grid { grid-template-columns: 1fr; }
  .row { flex-direction: column; gap: 0; }
  .form-row { flex-direction: column; gap: 0; }
  .form-row > .form-col { min-width: auto; }
  .card { padding: 18px; margin-bottom: 16px; }
  .stat .v { font-size: 24px; }
  .auth-card { padding: 28px 22px; border-radius: var(--radius-lg); }
  .auth-card h1 { font-size: 20px; }
  .flash-container { padding: 0 16px; margin-top: 12px; }

  /* Tables: card-like rows on very small screens */
  .table-wrap table,
  .table-wrap thead,
  .table-wrap tbody,
  .table-wrap th,
  .table-wrap td,
  .table-wrap tr { display: block; }
  .table-wrap thead { display: none; }
  .table-wrap tbody tr {
    margin-bottom: 12px;
    border: 1px solid var(--line);
    border-radius: var(--radius-md);
    overflow: hidden;
  }
  .table-wrap td {
    border: none;
    border-bottom: 1px solid var(--line-light);
    padding: 10px 14px;
    display: flex; justify-content: space-between; align-items: center;
  }
  .table-wrap td::before {
    content: attr(data-label);
    font-weight: 600;
    color: var(--ink-500);
    font-size: 12px;
    margin-right: 12px;
    flex: none;
  }
  .table-wrap td:last-child { border-bottom: none; }
  .table-wrap td .btn-group { justify-content: flex-end; }

  /* Keep full-width inputs on mobile */
  .field-sm, .field-xs { width: 100% !important; }
  .form-row > .form-col .fld:last-child { margin-bottom: 14px; }

  /* Model grid full width */
  .model-grid { grid-template-columns: 1fr; }
}

/* Print styles */
@media print {
  .sidebar, .topbar, .mobile-header, .mobile-nav, .mobile-overlay { display: none !important; }
  .main { margin: 0; }
}
