* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; min-height: 100vh; padding: 24px; font-family: system-ui, "Microsoft YaHei", sans-serif; color: #222; background: #f3f4f7; }
.card { width: min(720px, 100%); margin: 4vh auto; padding: 30px; border-radius: 18px; background: white; box-shadow: 0 18px 55px #28304a24; }
.customer-card { width: min(760px, 100%); }
.welcome { display: flex; align-items: center; gap: 15px; }
.welcome h1 { margin-bottom: 5px; }
.welcome p { margin: 0; color: #6d7280; }
.welcome-icon { display: grid; place-items: center; width: 52px; height: 52px; flex: 0 0 auto; border-radius: 15px; font-size: 28px; background: #eef0ff; }
.steps { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 24px 0 4px; padding: 0; list-style: none; color: #8a8f9c; font-size: 14px; }
.steps li { display: flex; align-items: center; gap: 7px; padding: 9px; border-radius: 10px; background: #f4f5f7; }
.steps li span { display: grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; background: #dddfe5; }
.steps li.active { color: #3444b7; background: #eef0ff; font-weight: 600; }
.steps li.active span { color: white; background: #5969dc; }
h1 { margin: 0 0 10px; font-size: 26px; }
.muted { color: #6d7280; }
.drop-zone { display: grid; gap: 8px; margin: 22px 0 14px; padding: 34px; text-align: center; border: 2px dashed #b7bdd0; border-radius: 14px; background: #fafbff; cursor: pointer; }
.drop-zone.drag { border-color: #5b6ee1; background: #f0f2ff; }
.drop-icon { font-size: 42px; }
.primary-actions { display: flex; gap: 9px; align-items: center; }
.file-list { max-height: 300px; overflow: auto; }
.file-row { display: flex; gap: 12px; align-items: center; padding: 10px 4px; border-bottom: 1px solid #eee; }
.file-information { flex: 1; display: grid; min-width: 0; gap: 5px; }
.file-information audio { width: min(420px, 100%); height: 34px; }
.file-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.status { margin: 12px 0; color: #646b7d; }
.error { color: #b42318; }
button { padding: 10px 16px; border: 0; border-radius: 9px; color: white; background: #5969dc; cursor: pointer; }
button:disabled { opacity: .5; cursor: not-allowed; }
button.secondary { background: #72798a; margin-left: 8px; }
button.danger { background: #b42318; }
progress { width: 100%; margin-top: 14px; }
.engine-status { display: grid; gap: 7px; margin-top: 14px; padding: 14px; border-radius: 12px; background: #f4f6ff; }
.engine-status progress { margin-top: 2px; }
.engine-status button { justify-self: start; }
.result { margin-top: 18px; padding: 16px; border-radius: 12px; background: #eaf8ee; }
.code { font: 700 26px ui-monospace, monospace; color: #16733a; }
:root {
  --bg: #f5f7fa;
  --surface: #fff;
  --surface-muted: #f8fafc;
  --border: #dfe4ea;
  --text: #17202a;
  --text-muted: #667085;
  --primary: #3157d5;
  --primary-soft: #edf2ff;
  --danger: #b42318;
  --danger-soft: #fff1f0;
  --success: #167348;
  --success-soft: #eaf8f0;
  --warning: #9a6700;
  --warning-soft: #fff8db;
  --radius: 12px;
  --shadow: 0 8px 24px rgba(27, 39, 51, .08);
}
.admin-body { padding: 0; background: var(--bg); color: var(--text); }
.admin-body button, .admin-body input { font: inherit; }
.admin-app { min-height: 100vh; }
.admin-sidebar { position: fixed; inset: 0 auto 0 0; z-index: 20; display: flex; width: 232px; flex-direction: column; color: #dbe4f3; background: #172235; border-right: 1px solid #24344e; }
.brand { display: flex; gap: 11px; align-items: center; height: 76px; padding: 0 20px; border-bottom: 1px solid #2a3850; }
.brand-mark { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 10px; color: white; background: var(--primary); font-weight: 800; }
.brand div, .sidebar-footer div { display: grid; gap: 2px; }
.brand small, .sidebar-footer small { color: #91a0b7; font-size: 12px; }
.admin-nav { display: grid; gap: 5px; padding: 18px 12px; }
.nav-link { display: flex; gap: 11px; align-items: center; padding: 10px 12px; border-radius: 9px; color: #bcc8da; text-decoration: none; font-size: 14px; font-weight: 600; }
.nav-link span { display: grid; place-items: center; width: 25px; height: 25px; border: 1px solid #46566f; border-radius: 7px; font-size: 12px; }
.nav-link:hover, .nav-link.active { color: white; background: #263750; }
.nav-link.active span { border-color: #6d8bf0; background: var(--primary); }
.sidebar-footer { display: flex; gap: 10px; align-items: center; margin-top: auto; padding: 16px 18px; border-top: 1px solid #2a3850; }
.avatar { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; color: #172235; background: #dbe4f3; font-weight: 700; }
.admin-main { min-height: 100vh; margin-left: 232px; }
.admin-header { position: sticky; top: 0; z-index: 10; display: flex; gap: 14px; align-items: center; min-height: 76px; padding: 12px 28px; border-bottom: 1px solid var(--border); background: rgba(255, 255, 255, .96); backdrop-filter: blur(8px); }
.admin-header h1 { margin: 2px 0 0; font-size: 21px; }
.breadcrumb { margin: 0; color: var(--text-muted); font-size: 12px; }
.admin-header > .badge { margin-left: auto; }
.admin-body .sidebar-toggle { display: none; }
.admin-content { width: min(100%, 1500px); margin: 0 auto; padding: 28px; }
.admin-page { display: grid; gap: 18px; }
.section-heading, .panel-heading, .filter-row, .action-row, .dialog-head, .dialog-actions { display: flex; gap: 12px; align-items: center; justify-content: space-between; }
.section-heading h2, .panel-heading h3 { margin: 0; }
.section-heading p, .panel-heading p, .dialog-head p { margin: 5px 0 0; color: var(--text-muted); }
.button, .admin-body button { display: inline-flex; align-items: center; justify-content: center; min-height: 38px; padding: 8px 13px; border: 1px solid transparent; border-radius: 9px; color: white; background: var(--primary); text-decoration: none; white-space: nowrap; cursor: pointer; }
.button.secondary { color: #344054; border-color: var(--border); background: white; }
.button.danger { color: white; background: var(--danger); }
.button.danger-ghost, .button.danger-outline { color: var(--danger); border-color: #efc2be; background: white; }
.button:disabled, .admin-body button:disabled { opacity: .48; cursor: not-allowed; }
.icon-button { width: 38px; min-width: 38px; padding: 0; color: #344054; border-color: var(--border); background: white; font-size: 19px; }
.metric-grid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 16px; }
.metric-card, .panel { border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow); }
.metric-card { display: grid; gap: 6px; padding: 18px; }
.metric-card span, .metric-card small { color: var(--text-muted); }
.metric-card strong { font-size: 24px; }
.panel { padding: 20px; }
.panel-heading { margin-bottom: 16px; }
.status-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.status-card { display: grid; gap: 6px; }
.status-card > span { color: var(--text-muted); font-family: ui-monospace, monospace; }
.status-card > strong { font-size: 24px; }
.status-card p { margin: 0; color: var(--text-muted); }
.status-good { color: var(--success); }
.status-bad { color: var(--danger); }
.filter-row { margin-bottom: 14px; }
.search-field { display: grid; width: min(440px, 100%); gap: 5px; color: var(--text-muted); font-size: 13px; }
.search-field input, .field input { width: 100%; padding: 10px 11px; color: var(--text); border: 1px solid #cbd3dd; border-radius: 9px; background: white; }
.search-field input:focus, .field input:focus { outline: 3px solid #dce5ff; border-color: var(--primary); }
.storage-status { margin: 0 0 14px; color: var(--text-muted); font-size: 13px; }
.table-wrap { width: 100%; overflow-x: auto; }
.data-table { width: 100%; min-width: 760px; border-collapse: collapse; }
.data-table th, .data-table td { padding: 12px 10px; text-align: left; vertical-align: top; border-bottom: 1px solid var(--border); font-size: 13px; }
.data-table th { color: var(--text-muted); background: var(--surface-muted); font-weight: 600; }
.data-table tbody tr:hover { background: #fafbfc; }
.data-table code { overflow-wrap: anywhere; }
.data-table td > strong, .cell-note { display: block; }
.cell-note { margin-top: 4px; color: var(--text-muted); font-size: 12px; }
.file-details { margin-top: 5px; }
.file-details summary { color: var(--primary); cursor: pointer; }
.file-details ul { min-width: 240px; padding-left: 18px; }
.table-actions { display: flex; gap: 7px; flex-wrap: wrap; }
.table-actions .button { min-height: 32px; padding: 5px 9px; font-size: 12px; }
.pagination { display: flex; justify-content: center; align-items: center; gap: 12px; margin-top: 18px; color: var(--text-muted); font-size: 13px; }
.text-link { color: var(--primary); text-decoration: none; font-weight: 600; }
.badge { display: inline-flex; width: fit-content; align-items: center; padding: 4px 8px; border-radius: 999px; font-size: 12px; font-weight: 700; }
.badge.success { color: var(--success); background: var(--success-soft); }
.badge.danger { color: var(--danger); background: var(--danger-soft); }
.badge.warning { color: var(--warning); background: var(--warning-soft); }
.badge.neutral { color: #556070; background: #eef1f4; }
.state-view { display: grid; justify-items: center; gap: 8px; min-height: 150px; align-content: center; padding: 24px; color: var(--text-muted); text-align: center; }
.state-view p { margin: 0; }
.state-view strong { color: var(--text); }
.spinner { width: 24px; height: 24px; border: 3px solid #dfe5ee; border-top-color: var(--primary); border-radius: 50%; animation: admin-spin .8s linear infinite; }
@keyframes admin-spin { to { transform: rotate(360deg); } }
.audit-list { display: grid; gap: 0; }
.audit-item { display: grid; grid-template-columns: minmax(180px, 1.5fr) minmax(100px, 1fr) minmax(160px, 1fr) auto; gap: 12px; padding: 11px 0; border-bottom: 1px solid var(--border); font-size: 13px; }
.audit-item span, .audit-item time { color: var(--text-muted); }
.admin-dialog { width: min(560px, calc(100vw - 28px)); max-height: calc(100vh - 32px); padding: 0; overflow: auto; color: var(--text); border: 0; border-radius: 14px; box-shadow: 0 22px 70px rgba(15, 23, 42, .3); }
.admin-dialog::backdrop { background: rgba(15, 23, 42, .55); }
.admin-dialog > form, .admin-dialog > div { display: grid; gap: 20px; padding: 24px; }
.dialog-head { align-items: flex-start; }
.dialog-head h2 { margin: 0; font-size: 20px; }
.dialog-actions { justify-content: flex-end; }
.field { display: grid; gap: 7px; color: #344054; font-size: 13px; font-weight: 600; }
.token-reveal { display: grid; gap: 10px; padding: 15px; color: #6c4b00; border: 1px solid #efd77d; border-radius: 10px; background: var(--warning-soft); }
.token-reveal code { padding: 11px; overflow-wrap: anywhere; color: var(--text); border: 1px solid #eadb9f; border-radius: 8px; background: white; }
.inline-error { margin: 0; color: var(--danger); }
.toast-region { position: fixed; z-index: 50; top: 18px; right: 18px; display: grid; gap: 9px; width: min(360px, calc(100vw - 36px)); }
.toast { padding: 12px 14px; color: var(--text); border: 1px solid var(--border); border-left: 4px solid var(--success); border-radius: 9px; background: white; box-shadow: var(--shadow); }
.toast.error { border-left-color: var(--danger); }
.admin-body .sidebar-backdrop { display: none; }
@media (max-width: 1100px) {
  .metric-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 960px) {
  .admin-sidebar { transform: translateX(-100%); transition: transform .18s ease; }
  .admin-sidebar.open { transform: translateX(0); }
  .admin-main { margin-left: 0; }
  .admin-body .sidebar-toggle { display: inline-flex; }
  .admin-body .sidebar-backdrop { position: fixed; inset: 0 0 0 232px; z-index: 15; display: block; width: calc(100% - 232px); height: 100%; min-height: 100%; padding: 0; border: 0; border-radius: 0; background: rgba(15, 23, 42, .48); }
}
@media (max-width: 700px) {
  body { padding: 10px; }
  .card { padding: 20px; }
  .steps li { display: grid; justify-items: center; padding: 8px 3px; font-size: 12px; }
  .welcome { align-items: flex-start; }
  .file-row { align-items: flex-start; }
  .file-row > button { flex: 0 0 auto; }
  .file-name { overflow: visible; text-overflow: clip; white-space: normal; overflow-wrap: anywhere; line-height: 1.45; }
  .admin-body { padding: 0; }
  .admin-header { padding: 10px 14px; }
  .admin-header > .badge { display: none; }
  .admin-content { padding: 16px 12px; }
  .section-heading, .panel-heading, .filter-row { align-items: stretch; flex-direction: column; }
  .section-heading > .button, .panel-heading > .button { align-self: flex-start; }
  .action-row { justify-content: flex-start; flex-wrap: wrap; }
  .metric-grid, .status-grid { grid-template-columns: 1fr; }
  .panel { padding: 14px; }
  .metric-card { padding: 15px; }
  .audit-item { grid-template-columns: 1fr; gap: 4px; }
  .dialog-actions { flex-wrap: wrap; }
  .dialog-actions .button { flex: 1; }
}
@media (prefers-reduced-motion: reduce) {
  .admin-sidebar { transition: none; }
  .spinner { animation-duration: 1.5s; }
}
