:root {
  --bg: #f3f6f4;
  --bg-2: #e8efea;
  --ink: #14201a;
  --muted: #5d6f64;
  --line: #c9d5cd;
  --card: rgba(255, 255, 255, 0.82);
  --forest: #1a4d3e;
  --forest-2: #0f3329;
  --gold: #c4922a;
  --danger: #b54a3c;
  --ok: #2f8f63;
  --shadow: 0 20px 50px rgba(20, 32, 26, 0.12);
  --radius: 18px;
  --font: "DM Sans", system-ui, sans-serif;
  --display: "DM Sans", system-ui, sans-serif;
}

* { box-sizing: border-box; }
html, body { min-height: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  color: var(--ink);
  background:
    radial-gradient(900px 480px at 8% -10%, rgba(26, 77, 62, 0.16), transparent 55%),
    radial-gradient(700px 420px at 100% 0%, rgba(196, 146, 42, 0.14), transparent 50%),
    linear-gradient(165deg, #f7faf8 0%, #eef3f0 45%, #e7eee9 100%);
  background-attachment: fixed;
}

a { color: var(--forest); }
.muted { color: var(--muted); }
.small { font-size: 0.875rem; }
.hidden { display: none !important; }
.mono { font-family: ui-monospace, monospace; font-size: 0.8rem; }

.auth-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
}
@media (max-width: 900px) {
  .auth-shell { grid-template-columns: 1fr; }
  .auth-hero { min-height: 220px; }
}

.auth-hero {
  padding: 48px;
  background:
    linear-gradient(145deg, rgba(15, 51, 41, 0.92), rgba(26, 77, 62, 0.78)),
    url("data:image/svg+xml,%3Csvg width='60' height='60' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M0 30h60M30 0v60' stroke='%23ffffff12' stroke-width='1'/%3E%3C/svg%3E");
  color: #f4f8f5;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  gap: 16px;
}
.auth-hero .brand {
  font-family: var(--display);
  font-size: clamp(2.8rem, 6vw, 4.5rem);
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 0.95;
}
.auth-hero p { max-width: 28rem; font-size: 1.05rem; opacity: 0.9; }

.auth-panel {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px 24px;
}
.auth-card {
  width: min(420px, 100%);
  background: var(--card);
  backdrop-filter: blur(12px);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 32px 28px;
}
.auth-card h1 {
  font-family: var(--display);
  font-size: 1.75rem;
  margin: 0 0 8px;
  letter-spacing: -0.02em;
}
.field { display: flex; flex-direction: column; gap: 6px; margin: 14px 0; }
.field span { font-size: 0.85rem; font-weight: 600; color: var(--muted); }
.field input, .field select, .field textarea {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px 14px;
  font: inherit;
  background: var(--surface);
  color: var(--ink);
}
.field textarea { min-height: 96px; resize: vertical; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 0;
  border-radius: 12px;
  padding: 12px 18px;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
}
.btn-primary { background: var(--forest); color: #fff; width: 100%; }
.btn-primary:hover { background: var(--forest-2); }
.btn-ghost {
  background: transparent;
  border: 1px solid var(--line);
  color: var(--ink);
}
.btn-gold { background: var(--gold); color: #1a1408; }
.btn-row { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 12px; }
.btn-row .btn { width: auto; flex: 1; }
.alert {
  border-radius: 12px;
  padding: 12px 14px;
  margin: 12px 0;
  font-size: 0.9rem;
}
.alert-error { background: #fbeceb; color: var(--danger); border: 1px solid #f0c7c2; }
.alert-ok { background: #e8f6ef; color: var(--ok); border: 1px solid #bfe5d1; }
.alert-info { background: #eef4f1; color: var(--forest); border: 1px solid var(--line); }
.code-preview {
  font-family: ui-monospace, monospace;
  font-size: 1.4rem;
  letter-spacing: 0.35em;
  text-align: center;
  padding: 14px;
  background: #0f3329;
  color: #e8f6ef;
  border-radius: 12px;
  margin: 12px 0;
}

/* App shell */
.app-shell {
  display: grid;
  grid-template-columns: 240px 1fr;
  min-height: 100vh;
}
@media (max-width: 860px) {
  .app-shell { grid-template-columns: 1fr; }
  .sidebar { position: sticky; top: 0; z-index: 5; }
}
.sidebar {
  background: rgba(15, 51, 41, 0.96);
  color: #e8f0eb;
  padding: 22px 16px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}
.sidebar .brand-mark {
  font-family: var(--display);
  font-weight: 700;
  font-size: 1.6rem;
}
.sidebar .brand-sub { color: #a8bfb4; font-size: 0.8rem; }
.nav { display: flex; flex-direction: column; gap: 6px; }
.nav-btn {
  border: 0;
  background: transparent;
  color: inherit;
  text-align: left;
  padding: 10px 12px;
  border-radius: 10px;
  font: inherit;
  cursor: pointer;
  text-decoration: none;
}
.nav-btn.active, .nav-btn:hover { background: rgba(255,255,255,0.1); }
.main { padding: 28px 28px 48px; }
.page-header { display: flex; justify-content: space-between; gap: 16px; align-items: flex-start; margin-bottom: 22px; flex-wrap: wrap; }
.page-header h1 {
  font-family: var(--display);
  margin: 0;
  font-size: 1.9rem;
  letter-spacing: -0.02em;
}
.metric-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 12px;
  margin-bottom: 20px;
}
.metric {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 16px;
  box-shadow: var(--shadow);
}
.metric-label { color: var(--muted); font-size: 0.8rem; font-weight: 600; }
.metric-value { font-family: var(--display); font-size: 1.8rem; margin-top: 4px; }
.panel {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 18px;
  box-shadow: var(--shadow);
  margin-bottom: 16px;
}
.panel h2 { margin: 0 0 12px; font-size: 1.1rem; font-family: var(--display); }
.table-wrap { overflow: auto; }
table { width: 100%; border-collapse: collapse; font-size: 0.92rem; }
th, td { text-align: left; padding: 10px 8px; border-bottom: 1px solid var(--line); }
th { color: var(--muted); font-weight: 600; font-size: 0.8rem; }
.badge {
  display: inline-block;
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 700;
}
.badge-ready { background: rgba(60,179,113,.15); color: var(--ok); }
.badge-locked { background: #f7ead2; color: #8a6418; }
.badge-pending { background: #e4ebe7; color: var(--muted); }

/* Onboarding */
.wizard {
  max-width: 720px;
  margin: 0 auto;
}
.steps {
  display: flex;
  gap: 8px;
  margin-bottom: 20px;
}
.step-pill {
  flex: 1;
  text-align: center;
  padding: 10px 8px;
  border-radius: 999px;
  background: var(--surface);
  border: 1px solid var(--line);
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--muted);
}
.step-pill.active { background: var(--forest); color: #fff; border-color: var(--forest); }
.step-pill.done { background: rgba(60,179,113,.15); color: var(--ok); }
.source-tabs { display: flex; gap: 8px; margin: 12px 0; flex-wrap: wrap; }
.source-tabs .btn { flex: 1; min-width: 120px; }
.source-tabs .btn.active { background: var(--forest); color: #fff; border-color: var(--forest); }
#source-upload,
#source-google,
#source-dropbox {
  display: block;
  width: 100%;
  margin: 4px 0 8px;
  clear: both;
}
.dropzone {
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  width: 100%;
  min-height: 140px;
  margin: 0;
  border: 2px dashed var(--line);
  border-radius: 14px;
  padding: 28px 20px;
  text-align: center;
  background: var(--surface);
  cursor: pointer;
  box-sizing: border-box;
  color: var(--muted);
  font-weight: 600;
}
.dropzone:hover,
.dropzone.dragover { border-color: var(--forest); color: var(--forest); background: rgba(47,158,119,.08); }
.dropzone input[type="file"] {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
  margin: 0;
  padding: 0;
  border: 0;
}

/* Modal */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 32, 26, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 50;
  padding: 20px;
}
.modal {
  width: min(460px, 100%);
  background: var(--surface);
  border-radius: 18px;
  padding: 28px;
  box-shadow: var(--shadow);
}
.modal h2 { font-family: var(--display); margin: 0 0 8px; }
.progress-bar {
  height: 8px;
  background: var(--bg-2);
  border-radius: 999px;
  overflow: hidden;
  margin: 16px 0;
}
.progress-bar > span {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, var(--forest), var(--gold));
  width: 0%;
  transition: width 0.3s ease;
}

.view { display: none; }
.view.active { display: block; }
.image-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 10px;
}
.image-grid figure {
  margin: 0;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
}
.image-grid img { width: 100%; height: 140px; object-fit: cover; display: block; background: var(--surface-2); }
.image-grid figcaption { padding: 6px 8px; font-size: 0.72rem; color: var(--muted); }

.notice-desktop {
  border-left: 4px solid var(--gold);
  background: rgba(212,160,23,.10);
  padding: 14px 16px;
  border-radius: 12px;
  margin-bottom: 16px;
}
