:root {
  color-scheme: dark;
  --bg: #080b16;
  --panel: #11162a;
  --panel-soft: #171d34;
  --line: #29314f;
  --text: #f7f3ff;
  --muted: #aaa8c3;
  --purple: #a971ff;
  --pink: #ef76d7;
  --green: #65df8f;
  --amber: #f4a340;
  font-family: Inter, "Microsoft YaHei", system-ui, sans-serif;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  background: radial-gradient(circle at 50% -10%, #1b1b3f 0, #080b16 42rem);
  color: var(--text);
}
button, input { font: inherit; }
button {
  border: 1px solid var(--line);
  background: linear-gradient(135deg, #7d55ff, #e166d0);
  color: white;
  border-radius: 8px;
  padding: 0.75rem 1rem;
  cursor: pointer;
}
button.secondary, button.ghost {
  background: #202640;
}
button.muted, .soon {
  opacity: 0.45;
  filter: grayscale(0.4);
}
#app {
  display: grid;
  grid-template-columns: 260px 1fr;
  min-height: 100vh;
  gap: 1.25rem;
  padding: 1.5rem;
}
.sidebar, .panel, .upload-zone {
  border: 1px solid var(--line);
  background: rgba(17, 22, 42, 0.88);
  border-radius: 8px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.35);
}
.sidebar {
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}
.brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 1.35rem;
  padding: 0.5rem;
}
.brand b, .spark { color: var(--purple); }
nav { display: grid; gap: 0.5rem; }
nav button {
  background: transparent;
  text-align: left;
  border: 0;
}
nav button.active { background: #2b2454; }
.storage-card {
  margin-top: auto;
  padding: 1rem;
  border-radius: 8px;
  background: var(--panel-soft);
  display: grid;
  gap: 0.75rem;
}
.bar { height: 8px; background: #313650; border-radius: 99px; overflow: hidden; }
.bar i { display: block; height: 100%; width: 12%; background: linear-gradient(90deg, var(--purple), var(--pink)); }
.main { display: grid; gap: 1.25rem; align-content: start; }
.topbar {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: center;
}
h1, h2, p { margin-top: 0; }
p, small, td, th { color: var(--muted); }
.hidden { display: none !important; }
.login {
  max-width: 540px;
  padding: 1.25rem;
}
.login form {
  display: flex;
  gap: 0.75rem;
}

.trust-option {
  display: flex;
  gap: 8px;
  align-items: center;
  color: #c8c9d8;
  font-size: 13px;
}

.trust-option input {
  accent-color: #b96cff;
}

.device-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.09);
}

.device-row small {
  display: block;
  color: #a977ee;
  margin-top: 4px;
}
input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #0d1224;
  color: var(--text);
  padding: 0.75rem 1rem;
}
.upload-zone {
  text-align: center;
  padding: 2.25rem;
  border-style: dashed;
}
.upload-zone.dragover { border-color: var(--pink); background: #181330; }
.cloud { font-size: 4rem; color: var(--pink); }
.actions { display: flex; justify-content: center; gap: 0.75rem; margin: 1rem 0; flex-wrap: wrap; }
.formats {
  display: grid;
  grid-template-columns: repeat(7, minmax(100px, 1fr));
  gap: 0.75rem;
}
.formats article {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  padding: 0.9rem;
  display: grid;
  gap: 0.35rem;
}
.formats span { color: var(--muted); font-size: 0.85rem; }
.ready span { color: var(--green); }
.panel { padding: 1.25rem; }
.table-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td {
  padding: 0.8rem;
  border-bottom: 1px solid var(--line);
  text-align: left;
  white-space: nowrap;
}
.file-name { white-space: normal; min-width: 220px; }
.file-cell {
  display: grid;
  gap: 0.25rem;
}
.file-cell small {
  color: var(--amber);
  max-width: 42rem;
}
.status {
  border-radius: 999px;
  padding: 0.25rem 0.55rem;
  background: #202640;
  color: var(--text);
}
.status.success { color: var(--green); }
.status.processing, .status.needs_ocr { color: #8ab4ff; }
.status.low_confidence { color: var(--amber); }
.status.error, .status.unsupported { color: var(--amber); }
.row-actions { display: flex; gap: 0.45rem; }
.row-actions button { padding: 0.45rem 0.6rem; background: #202640; }
.view-stack {
  display: grid;
  gap: 1.25rem;
}
.progress-line {
  border: 1px solid rgba(244, 163, 64, 0.42);
  background: rgba(244, 163, 64, 0.12);
  color: #ffd39a;
  border-radius: 8px;
  padding: 0.85rem 1rem;
  margin: 0.75rem 0 1rem;
}
.history-list {
  display: grid;
  gap: 1rem;
}
.history-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(23, 29, 52, 0.72);
  padding: 1rem;
}
.history-card h3 {
  margin: 0 0 0.25rem;
}
.settings-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(220px, 1fr));
  gap: 1rem;
}
.settings-grid article {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(23, 29, 52, 0.72);
  padding: 1rem;
}
@media (max-width: 900px) {
  #app { grid-template-columns: 1fr; padding: 1rem; }
  .formats { grid-template-columns: repeat(2, 1fr); }
  .topbar { align-items: flex-start; flex-direction: column; }
  .settings-grid { grid-template-columns: 1fr; }
}
