:root {
  --bg: #f4f2ed;
  --paper: #fffefa;
  --ink: #22211f;
  --muted: #77736d;
  --line: #ddd8cf;
  --accent: #4c5146;
  --danger: #9a3f35;
  --shadow: 0 18px 50px rgba(50, 45, 38, .07);
}

* { box-sizing: border-box; }
html { color-scheme: light; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.5;
}
a { color: inherit; text-decoration: none; }
button, input, select { font: inherit; }
button, .button-link { cursor: pointer; }

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 70px;
  padding: 0 5vw;
  background: rgba(244, 242, 237, .92);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid rgba(221, 216, 207, .7);
}
.brand { font-weight: 800; letter-spacing: .16em; font-size: .92rem; }
.top-actions { display: flex; align-items: center; gap: 20px; }
.text-button, .danger-link {
  border: 0;
  background: none;
  padding: 0;
  color: var(--muted);
}
.danger-link { color: var(--danger); }

.container { width: min(1160px, 90vw); margin: 0 auto; padding: 74px 0 54px; }
.hero-grid { display: grid; grid-template-columns: 1.25fr .75fr; gap: 48px; align-items: end; margin-bottom: 48px; }
.eyebrow { margin: 0 0 12px; font-size: .72rem; letter-spacing: .18em; color: var(--muted); font-weight: 700; }
h1 { margin: 0; font-size: clamp(2.7rem, 6vw, 5.8rem); line-height: .96; letter-spacing: -.055em; font-weight: 560; }
.lead { max-width: 610px; margin: 24px 0 0; color: var(--muted); font-size: 1.02rem; }
h2 { margin: 0; font-size: clamp(1.7rem, 3vw, 2.45rem); font-weight: 560; letter-spacing: -.035em; }

.stats-card {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1px;
  background: var(--line);
  border: 1px solid var(--line);
}
.stats-card > div { padding: 22px 18px; background: var(--paper); }
.stats-card strong, .stats-card span { display: block; }
.stats-card strong { font-size: 1.18rem; }
.stats-card span { margin-top: 4px; color: var(--muted); font-size: .78rem; }

.panel { background: var(--paper); border: 1px solid var(--line); box-shadow: var(--shadow); }
.upload-panel { padding: clamp(20px, 4vw, 42px); margin-bottom: 74px; }
.dropzone {
  min-height: 235px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
  border: 1px dashed #aaa59c;
  background: #faf9f5;
  transition: .2s ease;
  cursor: pointer;
}
.dropzone:hover, .dropzone.dragging { border-color: var(--accent); background: #f1f0ea; transform: translateY(-1px); }
.dropzone input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.drop-title { font-size: clamp(1.35rem, 2.5vw, 2rem); margin-bottom: 8px; }
.option-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; margin: 22px 0; }
label { display: grid; gap: 8px; font-size: .8rem; color: var(--muted); }
input, select {
  width: 100%;
  min-height: 46px;
  border: 1px solid var(--line);
  border-radius: 0;
  background: #fff;
  color: var(--ink);
  padding: 10px 12px;
  outline: none;
}
input:focus, select:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(76, 81, 70, .1); }
.primary, .secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 10px 17px;
  border: 1px solid var(--accent);
  border-radius: 0;
  transition: .16s ease;
}
.primary { background: var(--accent); color: #fff; }
.primary:hover { filter: brightness(.92); }
.primary:disabled { opacity: .6; cursor: progress; }
.secondary { background: transparent; color: var(--ink); border-color: var(--line); }
.secondary:hover { background: #f1efe9; border-color: #bcb6ac; }
.wide { width: 100%; }
.button-link { margin-top: 24px; }

.section-heading { display: flex; justify-content: space-between; align-items: end; gap: 20px; margin-bottom: 20px; }
.status-pill { display: inline-flex; align-items: center; padding: 5px 9px; border: 1px solid var(--line); color: var(--muted); font-size: .72rem; }
.status-pill.on { color: var(--accent); border-color: #9ba192; background: #eff1eb; }
.file-list { display: grid; gap: 10px; }
.file-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 19px 20px;
  background: var(--paper);
  border: 1px solid var(--line);
}
.file-card.inactive { opacity: .62; }
.file-main { display: flex; align-items: center; gap: 14px; min-width: 0; }
.file-icon { flex: 0 0 42px; height: 42px; display: grid; place-items: center; border: 1px solid var(--line); font-size: 1.15rem; }
.file-meta { min-width: 0; }
.file-meta h3 { margin: 0 0 4px; font-size: .98rem; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 520px; }
.file-meta p { margin: 2px 0; color: var(--muted); font-size: .76rem; }
.file-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; justify-content: flex-end; }
.file-actions .secondary { min-height: 36px; padding: 7px 11px; font-size: .78rem; }
.empty-state { padding: 55px 20px; text-align: center; border: 1px dashed var(--line); color: var(--muted); }

.account-panel { margin-top: 74px; padding: 28px; display: grid; grid-template-columns: .7fr 1.3fr; gap: 30px; align-items: end; }
.account-form { display: grid; grid-template-columns: 1fr 1fr auto; gap: 10px; }
.muted { color: var(--muted); }
.notice { margin: 0 0 22px; padding: 13px 15px; border: 1px solid var(--line); background: var(--paper); transition: opacity .5s ease; overflow-wrap: anywhere; }
.notice.success { border-color: #aab4a2; background: #f1f4ed; }
.notice.error { border-color: #c9a29e; background: #f7efee; }
.notice.fade { opacity: .25; }
footer { padding: 30px 5vw 42px; color: var(--muted); font-size: .75rem; text-align: center; }

.centered-page { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.auth-card { width: min(440px, 100%); background: var(--paper); border: 1px solid var(--line); box-shadow: var(--shadow); padding: clamp(28px, 6vw, 50px); }
.auth-card > .muted { margin: 14px 0 28px; }
.stack { display: grid; gap: 16px; }
.download-title { margin-top: 32px; font-size: clamp(1.65rem, 6vw, 2.7rem); line-height: 1.08; overflow-wrap: anywhere; }

@media (max-width: 850px) {
  .hero-grid, .account-panel { grid-template-columns: 1fr; }
  .option-grid { grid-template-columns: 1fr; }
  .account-form { grid-template-columns: 1fr; }
  .file-card { align-items: flex-start; flex-direction: column; }
  .file-actions { width: 100%; justify-content: flex-start; }
  .file-meta h3 { max-width: 62vw; }
}

@media (max-width: 560px) {
  .container { width: min(92vw, 1160px); padding-top: 42px; }
  .topbar { padding-inline: 4vw; }
  .desktop-only { display: none; }
  .stats-card { grid-template-columns: 1fr; }
  .dropzone { min-height: 190px; }
  .upload-panel { padding: 14px; }
  .section-heading { align-items: flex-start; flex-direction: column; }
  .file-actions > * { flex: 1 1 auto; }
  .file-actions form button { width: 100%; min-height: 36px; }
}
