:root {
  --bg: #07111f;
  --panel: rgba(10, 18, 31, 0.74);
  --panel-strong: rgba(12, 21, 35, 0.88);
  --text: #f7f9fc;
  --muted: #95a4bd;
  --line: rgba(255,255,255,0.08);
  --line-strong: rgba(255,255,255,0.14);
  --accent: #7dd3fc;
  --accent-2: #a78bfa;
  --success: #6ee7b7;
  --danger: #fda4af;
  --shadow: 0 24px 80px rgba(0, 0, 0, 0.32);
  --radius-xl: 24px;
  --radius-lg: 18px;
}

* { box-sizing: border-box; }
html, body { min-height: 100%; }
body {
  margin: 0;
  font-family: Inter, -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'PingFang SC', sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at 12% 18%, rgba(56, 189, 248, 0.16), transparent 24%),
    radial-gradient(circle at 86% 14%, rgba(167, 139, 250, 0.16), transparent 22%),
    linear-gradient(180deg, #07111f 0%, #091321 48%, #060d16 100%);
}

a { color: #d8f5ff; text-decoration: none; }
a:hover { text-decoration: underline; }
button, input, textarea, select { font: inherit; }
.hidden { display: none !important; }

.bg-orb {
  position: fixed;
  width: 28vw;
  height: 28vw;
  border-radius: 50%;
  filter: blur(90px);
  opacity: 0.16;
  pointer-events: none;
}
.orb-a { left: -10vw; top: -8vw; background: #38bdf8; }
.orb-b { right: -10vw; top: 10vh; background: #8b5cf6; }

.glass {
  background: var(--panel);
  border: 1px solid var(--line);
  backdrop-filter: blur(22px);
  box-shadow: var(--shadow);
}

.auth-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px 24px 12px;
}

.auth-alert {
  width: min(920px, calc(100vw - 48px));
  margin: 0 auto 20px;
  padding: 13px 15px;
  border-radius: 16px;
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--line);
}
.auth-alert.success { color: var(--success); }
.auth-alert.error { color: var(--danger); }

.auth-card {
  width: min(920px, 100%);
  display: grid;
  grid-template-columns: 1fr 0.92fr;
  overflow: hidden;
  border-radius: var(--radius-xl);
  background: rgba(8, 15, 26, 0.9);
  border: 1px solid var(--line-strong);
  box-shadow: var(--shadow);
}

.auth-panel { padding: 36px; }
.auth-panel.hero-side {
  background: linear-gradient(180deg, rgba(125,211,252,0.08), rgba(255,255,255,0.02));
  border-right: 1px solid var(--line);
}
.auth-panel.form-side { background: rgba(8, 14, 24, 0.84); }
.auth-panel h2,
.auth-panel h3,
.hero-main h2,
.panel h3,
.report-card h3,
.history-list h3 { margin: 0 0 12px; }
.auth-panel h2 { font-size: 2rem; line-height: 1.18; }
.auth-panel p,
.meta { color: var(--muted); line-height: 1.75; font-size: 0.94rem; }

.eyebrow,
.section-title,
.small-label {
  color: #97b6ff;
  font-size: 0.76rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
}

.auth-feature-list,
.form-grid,
.quota-grid {
  display: grid;
  gap: 14px;
}

.auth-feature,
.result-frame,
.report-section,
.stat-box,
.status-card {
  padding: 14px 16px;
  border-radius: 16px;
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--line);
}

.auth-tabs {
  display: inline-flex;
  gap: 6px;
  padding: 6px;
  border-radius: 999px;
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--line);
  margin-bottom: 18px;
}
.auth-tabs button {
  padding: 9px 14px;
  border-radius: 999px;
  color: var(--muted);
  background: transparent;
  border: none;
  cursor: pointer;
}
.auth-tabs button.active {
  background: linear-gradient(135deg, #7dd3fc, #a78bfa);
  color: #03111f;
}

label {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-size: 0.92rem;
}

input,
textarea,
select {
  width: 100%;
  padding: 13px 14px;
  border-radius: 14px;
  border: 1px solid rgba(255,255,255,0.1);
  background: rgba(255,255,255,0.04);
  color: var(--text);
}
input::placeholder,
textarea::placeholder { color: #6f819f; }
textarea { min-height: 120px; resize: vertical; }
.auth-footer { margin-top: 16px; color: var(--muted); }

.secondary-btn,
.primary-btn,
.danger-btn,
.text-btn {
  border: none;
  cursor: pointer;
}
.secondary-btn,
.primary-btn,
.danger-btn {
  padding: 11px 16px;
  border-radius: 999px;
}
.secondary-btn {
  color: var(--text);
  background: rgba(255,255,255,0.05);
  border: 1px solid var(--line);
}
.primary-btn {
  color: #03111f;
  background: linear-gradient(135deg, #7dd3fc, #67e8f9 45%, #a78bfa);
}
.danger-btn {
  color: #ffd8df;
  background: rgba(251,113,133,0.12);
  border: 1px solid rgba(251,113,133,0.18);
}
.text-btn {
  background: transparent;
  color: #d9e7ff;
  padding: 0;
}

.app-shell {
  display: grid;
  grid-template-columns: 260px 1fr;
  gap: 20px;
  min-height: 100vh;
  padding: 20px;
}

.sidebar,
.topbar,
.hero,
.panel,
.report-card,
.history-list {
  border-radius: var(--radius-xl);
}
.sidebar {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 20px;
}
.brand-block {
  display: grid;
  grid-template-columns: 56px 1fr;
  gap: 14px;
}
.brand-logo {
  width: 56px;
  height: 56px;
  border-radius: 18px;
  display: grid;
  place-items: center;
  font-weight: 700;
  color: #03111f;
  background: linear-gradient(135deg, #7dd3fc, #67e8f9 55%, #a78bfa);
}
.brand-block h1 { margin: 4px 0 8px; font-size: 1.24rem; }
.brand-block p { margin: 0; color: var(--muted); line-height: 1.7; font-size: 0.92rem; }
.sidebar-section { margin-top: 28px; }
.nav-list { display: grid; gap: 10px; margin-top: 12px; }
.nav-list button {
  width: 100%;
  padding: 13px 14px;
  text-align: left;
  color: var(--text);
  background: rgba(255,255,255,0.03);
  border: 1px solid var(--line);
  border-radius: 16px;
  cursor: pointer;
}
.nav-list button.active {
  background: linear-gradient(135deg, rgba(125,211,252,0.16), rgba(167,139,250,0.16));
  border-color: rgba(125,211,252,0.28);
}
.main-shell { min-width: 0; }
.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px;
  margin-bottom: 18px;
}
.topbar-title { margin-top: 6px; font-size: 1rem; }
.topbar-actions { display: flex; gap: 10px; }
.quota-inline {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}
.quota-mini {
  padding: 8px 10px;
  border-radius: 999px;
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.82rem;
  white-space: nowrap;
}
.quota-mini strong {
  margin-left: 4px;
  color: var(--text);
}
.alert {
  padding: 13px 15px;
  border-radius: 16px;
  margin-bottom: 16px;
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--line);
}
.alert.success { color: var(--success); }
.alert.error { color: var(--danger); }
.dashboard { display: grid; gap: 18px; }
.hero {
  padding: 22px;
}
.quota-card {
  padding: 16px;
  border-radius: 18px;
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--line);
}
.quota-card strong { display: block; margin-top: 8px; font-size: 1.5rem; }
.view-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(320px, 0.95fr);
  gap: 18px;
}
.view-layout-vision {
  grid-template-columns: minmax(320px, 0.84fr) minmax(540px, 1.16fr);
}
.view-layout-vision .panel {
  padding-right: 18px;
}
.view-layout-vision .report-card {
  padding: 22px 24px;
}
.view-layout-vision textarea {
  min-height: 168px;
}
.panel,
.report-card,
.history-list {
  padding: 22px;
  background: var(--panel-strong);
  border: 1px solid var(--line);
}
.kv-grid,
.stat-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}
.stat-row.triple { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.report-section { margin-top: 14px; }
.report-section h4 { margin: 0 0 10px; }
.report-list { margin: 0; padding-left: 18px; }
.report-list li { margin-bottom: 8px; line-height: 1.65; }
.result-image,
.audio-player { width: 100%; margin-top: 14px; border-radius: 16px; }
.preview-card {
  display: none;
  gap: 14px;
  align-items: center;
  padding: 14px 16px;
  border-radius: 16px;
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--line);
}
.preview-card.visible { display: flex; }
.preview-thumb {
  width: 78px;
  height: 78px;
  object-fit: cover;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: rgba(255,255,255,0.04);
}
.preview-meta strong {
  display: block;
  margin-bottom: 4px;
}
.loading-card {
  padding: 18px;
  border-radius: 18px;
  border: 1px solid rgba(125,211,252,0.18);
  background: linear-gradient(135deg, rgba(125,211,252,0.08), rgba(167,139,250,0.08));
}
.loading-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 10px;
}
.spinner {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 2px solid rgba(255,255,255,0.18);
  border-top-color: var(--accent);
  animation: spin 0.9s linear infinite;
}
.loading-bar {
  height: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(255,255,255,0.06);
}
.loading-bar::after {
  content: "";
  display: block;
  width: 36%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #7dd3fc, #a78bfa);
  animation: glide 1.2s ease-in-out infinite;
}
.primary-btn:disabled,
.secondary-btn:disabled,
.danger-btn:disabled {
  cursor: not-allowed;
  opacity: 0.72;
}
@keyframes spin {
  to { transform: rotate(360deg); }
}
@keyframes glide {
  0% { transform: translateX(-110%); }
  100% { transform: translateX(260%); }
}
.pill {
  display: inline-flex;
  padding: 7px 11px;
  border-radius: 999px;
  background: rgba(255,255,255,0.05);
  border: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.84rem;
  margin-right: 8px;
  margin-top: 8px;
}
pre {
  margin: 0;
  white-space: pre-wrap;
  word-break: break-word;
  line-height: 1.65;
  color: #dbe7fb;
}
.history-item,
.admin-user { padding: 14px 0; border-bottom: 1px solid var(--line); }
.history-item:last-child,
.admin-user:last-child { border-bottom: none; }

@media (max-width: 1180px) {
  .auth-card,
  .app-shell,
  .hero,
  .view-layout { grid-template-columns: 1fr; }
}
@media (max-width: 760px) {
  .auth-page,
  .app-shell { padding: 14px; gap: 14px; }
  .auth-panel,
  .sidebar,
  .hero,
  .panel,
  .report-card,
  .history-list { padding: 18px; }
  .topbar,
  .topbar-actions { flex-direction: column; align-items: flex-start; gap: 12px; }
  .kv-grid,
  .stat-row,
  .stat-row.triple { grid-template-columns: 1fr; }
  .auth-alert { width: calc(100vw - 28px); }
  .preview-card.visible { align-items: flex-start; }
}


.result-hero-card {
  padding: 18px;
}
.result-card-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
}
.result-head-copy {
  min-width: 0;
}
.result-title {
  margin: 8px 0 0;
  font-size: 1.22rem;
  line-height: 1.25;
}
.result-subtitle {
  margin: 10px 0 0;
  color: var(--muted);
  line-height: 1.7;
  font-size: 0.92rem;
}
.result-badge-row {
  margin-top: 14px;
}
.result-badge {
  background: linear-gradient(135deg, rgba(125,211,252,0.16), rgba(167,139,250,0.16));
  color: #dce9ff;
  border-color: rgba(125,211,252,0.22);
}
.result-image-wrap {
  position: relative;
  margin-top: 16px;
  padding: 14px;
  border-radius: 18px;
  background: rgba(255,255,255,0.03);
  border: 1px solid var(--line);
}
.result-download-btn {
  white-space: nowrap;
  flex-shrink: 0;
}
@media (max-width: 760px) {
  .result-card-head {
    flex-direction: column;
    align-items: stretch;
  }
  .result-download-btn {
    width: 100%;
  }
}

.tts-usage-note {
  display: grid;
  gap: 8px;
  padding: 14px 16px;
  border-radius: 18px;
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--line);
  margin-bottom: 16px;
}
.tts-note-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  color: var(--muted);
  font-size: 0.88rem;
}
.field-tip {
  margin-top: 6px;
  color: var(--muted);
  font-size: 0.84rem;
}
.voice-hint-card {
  display: grid;
  gap: 6px;
  padding: 14px 16px;
  border-radius: 18px;
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--line);
}
.voice-hint-card strong {
  font-size: 1rem;
}
.voice-hint-card span {
  color: var(--muted);
  font-size: 0.86rem;
}
.voice-hint-card.compact {
  margin-top: 14px;
}
