:root {
  --forest-950: #071f18;
  --forest-900: #0b2a20;
  --forest-800: #12392c;
  --forest-700: #1b4b3b;
  --gold-500: #d8b867;
  --gold-400: #e4ca86;
  --cream: #f4f0e6;
  --paper: #fbfaf6;
  --ink: #17231f;
  --muted: #68756f;
  --line: #dce4df;
  --success: #25765a;
  --warning: #9b741e;
  --danger: #a43f3f;
  --shadow: 0 20px 55px rgba(11, 42, 32, .10);
  --radius: 18px;
}

* { box-sizing: border-box; }

html { min-height: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background: #eef2ef;
}

a { color: inherit; text-decoration: none; }
button, input, select { font: inherit; }
button { cursor: pointer; }
h1, h2, h3, p { margin-top: 0; }
h2, h3 { letter-spacing: -.025em; }
h2 { font-size: clamp(1.8rem, 3vw, 2.8rem); margin-bottom: .7rem; }
h3 { font-size: 1.25rem; margin-bottom: .45rem; }
.muted { color: var(--muted); }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .9rem; overflow-wrap: anywhere; }

.eyebrow {
  margin-bottom: .55rem;
  color: #a8842f;
  font-size: .76rem;
  font-weight: 800;
  letter-spacing: .14em;
  text-transform: uppercase;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 64px;
  height: 64px;
  border: 1px solid rgba(216,184,103,.7);
  border-radius: 18px;
  color: var(--gold-400);
  font-family: Georgia, serif;
  font-size: 2rem;
  background: rgba(216,184,103,.08);
}
.brand-mark--small { width: 42px; height: 42px; border-radius: 13px; font-size: 1.35rem; }

.app-shell { display: grid; grid-template-columns: 260px minmax(0, 1fr); min-height: 100vh; }

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  padding: 26px 18px 18px;
  color: #eef5f1;
  background:
    radial-gradient(circle at top left, rgba(216,184,103,.10), transparent 30%),
    var(--forest-950);
  border-right: 1px solid rgba(255,255,255,.06);
  z-index: 30;
}
.sidebar__brand { display: flex; align-items: center; gap: 12px; padding: 0 8px 26px; }
.sidebar__brand strong { display: block; font-family: Georgia, serif; font-size: 1.3rem; letter-spacing: .01em; }
.sidebar__brand small { display: block; margin-top: 2px; color: rgba(238,245,241,.56); font-size: .68rem; }

.nav { display: grid; gap: 6px; }
.nav a {
  padding: 13px 14px;
  border-radius: 12px;
  color: rgba(238,245,241,.72);
  font-weight: 650;
  transition: .18s ease;
}
.nav a:hover { color: white; background: rgba(255,255,255,.06); }
.nav a.is-active {
  color: var(--gold-400);
  background: rgba(216,184,103,.11);
  box-shadow: inset 3px 0 0 var(--gold-500);
}

.sidebar__user {
  margin-top: auto;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 10px;
  padding: 15px 10px 4px;
  border-top: 1px solid rgba(255,255,255,.08);
}
.sidebar__user strong { display: block; max-width: 125px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: .9rem; }
.sidebar__user small { display: block; color: rgba(238,245,241,.55); font-size: .7rem; }
.avatar {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  color: var(--forest-950);
  background: var(--gold-500);
  font-weight: 800;
}
.avatar--large { width: 76px; height: 76px; font-size: 1.6rem; margin: 0 auto 16px; }
.icon-button { border: 0; color: rgba(238,245,241,.7); background: transparent; font-size: 1.2rem; }

.main { min-width: 0; display: flex; flex-direction: column; }
.topbar {
  min-height: 92px;
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 20px clamp(20px, 4vw, 52px);
  background: rgba(251,250,246,.92);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}
.topbar h1 { margin: 0; font-size: 1.55rem; }
.topbar__kicker { margin-bottom: .2rem; color: var(--muted); font-size: .75rem; }
.topbar__status { margin-left: auto; display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: .8rem; }
.topbar__status span { width: 9px; height: 9px; border-radius: 50%; background: #49a37e; box-shadow: 0 0 0 5px rgba(73,163,126,.12); }
.menu-button { display: none; border: 0; background: transparent; font-size: 1.35rem; }

.content { width: min(1500px, 100%); margin: 0 auto; flex: 1; padding: clamp(22px, 4vw, 48px); }
.footer { display: flex; justify-content: space-between; gap: 16px; padding: 18px clamp(22px, 4vw, 52px); color: var(--muted); border-top: 1px solid var(--line); font-size: .75rem; background: rgba(255,255,255,.35); }

.hero {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 30px;
  margin-bottom: 24px;
  padding: clamp(28px, 5vw, 52px);
  border-radius: 24px;
  color: white;
  background:
    radial-gradient(circle at 85% 10%, rgba(216,184,103,.20), transparent 30%),
    linear-gradient(135deg, var(--forest-900), var(--forest-700));
  box-shadow: var(--shadow);
}
.hero h2 { margin-bottom: .6rem; font-family: Georgia, serif; font-weight: 600; }
.hero p:not(.eyebrow) { margin-bottom: 0; max-width: 720px; color: rgba(255,255,255,.72); line-height: 1.65; }
.hero--compact { padding: 30px 34px; }
.hero .eyebrow { color: var(--gold-400); }

.stats-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; margin-bottom: 16px; }
.stat-card, .panel {
  border: 1px solid rgba(216,225,220,.9);
  border-radius: var(--radius);
  background: var(--paper);
  box-shadow: var(--shadow);
}
.stat-card { padding: 22px; }
.stat-card span { display: block; color: var(--muted); font-size: .82rem; }
.stat-card strong { display: block; margin: 9px 0 5px; font-family: Georgia, serif; font-size: 2.25rem; color: var(--forest-900); }
.stat-card small { color: #87938e; }

.panel { padding: 24px; margin-bottom: 16px; }
.panel--soft { background: #edf3ef; }
.panel__header { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 20px; }
.panel__header h3, .panel__header p { margin-bottom: 0; }
.panel__header a, .table-link, .back-link { color: #927022; font-weight: 750; font-size: .82rem; }
.dashboard-grid { display: grid; grid-template-columns: 1.25fr .95fr; gap: 16px; }
.import-grid, .user-grid, .account-grid, .detail-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.detail-grid .panel { margin-bottom: 0; }

.bar-list { display: grid; gap: 16px; }
.bar-row > div:first-child { display: flex; justify-content: space-between; gap: 15px; margin-bottom: 7px; }
.bar-row span { font-weight: 650; }
.bar-track { height: 9px; overflow: hidden; border-radius: 999px; background: #e6ece8; }
.bar-track span { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, #a98530, var(--gold-400)); }

.activity-list { display: grid; gap: 13px; }
.activity-item { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 12px; padding-bottom: 13px; border-bottom: 1px solid var(--line); }
.activity-item:last-child { padding-bottom: 0; border-bottom: 0; }
.activity-item strong, .activity-item small { display: block; }
.activity-item small { margin-top: 3px; color: var(--muted); font-size: .75rem; }
.activity-icon { display: grid; place-items: center; width: 42px; height: 42px; border-radius: 12px; color: var(--forest-900); background: #e6eee9; font-size: .7rem; font-weight: 900; }

.badge { display: inline-flex; align-items: center; width: fit-content; padding: 6px 10px; border-radius: 999px; color: #4e5a55; background: #e7ece9; font-size: .72rem; font-weight: 800; white-space: nowrap; }
.badge--success { color: #1c644b; background: #dff0e9; }
.badge--warning { color: #86631a; background: #f3ead2; }
.badge--danger { color: #8c3636; background: #f4dddd; }
.badge--large { padding: 10px 14px; font-size: .8rem; }

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; min-width: 780px; }
th { padding: 12px 14px; color: var(--muted); text-align: left; text-transform: uppercase; letter-spacing: .08em; font-size: .67rem; border-bottom: 1px solid var(--line); }
td { padding: 15px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; font-size: .88rem; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: rgba(232,239,235,.45); }
.table-subline { display: block; margin-top: 4px; color: var(--muted); font-size: .72rem; }
.table-subline--danger { color: var(--danger); max-width: 420px; }
.table-link--button { padding: 0; border: 0; background: transparent; }
.pagination { display: flex; align-items: center; justify-content: center; gap: 18px; padding-top: 20px; color: var(--muted); font-size: .82rem; }
.pagination a { color: #927022; font-weight: 800; }

.stack { display: grid; gap: 16px; }
.form-grid, .filter-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.filter-grid { grid-template-columns: 2fr repeat(5, minmax(120px, 1fr)); align-items: end; }
.filter-actions { display: flex; gap: 8px; grid-column: 1 / -1; }
.field { display: grid; gap: 7px; }
.field--wide { grid-column: 1 / -1; }
.field span { color: #56635d; font-size: .78rem; font-weight: 750; }
.field input, .field select {
  width: 100%;
  min-height: 46px;
  padding: 11px 13px;
  border: 1px solid #cad5cf;
  border-radius: 11px;
  outline: none;
  color: var(--ink);
  background: white;
  transition: .15s ease;
}
.field input:focus, .field select:focus { border-color: #ad8b3d; box-shadow: 0 0 0 4px rgba(216,184,103,.15); }

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 10px 17px;
  border: 1px solid transparent;
  border-radius: 11px;
  font-weight: 800;
  transition: .16s ease;
}
.button:hover { transform: translateY(-1px); }
.button--primary { color: var(--forest-950); background: var(--gold-500); }
.button--primary:hover { background: var(--gold-400); }
.button--ghost { border-color: #bdc9c3; color: var(--forest-800); background: transparent; }
.button--wide { width: 100%; }

.alert { margin-bottom: 16px; padding: 13px 15px; border-radius: 11px; border: 1px solid transparent; line-height: 1.45; }
.alert--success { color: #1d6049; border-color: #b9ddcf; background: #e3f1eb; }
.alert--warning { color: #795a18; border-color: #e2cf98; background: #f7efd8; }
.alert--danger { color: #853737; border-color: #e4bbbb; background: #f8e8e8; }
.alert--info { color: #325c70; border-color: #bfd5df; background: #eaf3f7; }

.upload-zone {
  display: grid;
  place-items: center;
  min-height: 260px;
  padding: 30px;
  border: 1.5px dashed #aebdb5;
  border-radius: 16px;
  text-align: center;
  background: #f4f7f5;
  transition: .15s ease;
}
.upload-zone:hover { border-color: #a8842f; background: #f8f6ee; }
.upload-zone input { position: absolute; opacity: 0; pointer-events: none; }
.upload-zone strong { margin: 12px 0 6px; }
.upload-zone small { color: var(--muted); }
.upload-zone__icon { display: grid; place-items: center; width: 62px; height: 62px; border-radius: 16px; color: var(--forest-900); background: #dfe9e3; font-weight: 900; }

.check-list { display: grid; gap: 11px; padding: 0; list-style: none; }
.check-list li { position: relative; padding-left: 26px; line-height: 1.45; }
.check-list li::before { content: "✓"; position: absolute; left: 0; color: #2a795c; font-weight: 900; }
.schema-grid { display: flex; flex-wrap: wrap; gap: 9px; margin-bottom: 14px; }
.schema-grid span { padding: 8px 10px; border-radius: 9px; color: #526059; background: #edf2ef; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .72rem; }

.empty-state { display: grid; place-items: center; padding: 55px 20px; text-align: center; color: var(--muted); }
.empty-state strong { color: var(--forest-900); font-size: 1.05rem; }
.empty-state p { margin: 8px 0 18px; max-width: 480px; }
.empty-state--small { padding: 30px 10px; }

.detail-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; margin-bottom: 22px; }
.detail-heading h2 { margin-bottom: .45rem; font-family: Georgia, serif; }
.detail-heading p:last-child { color: var(--muted); }
.back-link { display: inline-block; margin-bottom: 25px; }
.detail-list { margin: 0; display: grid; }
.detail-list > div { display: grid; grid-template-columns: 1fr 1.3fr; gap: 20px; padding: 13px 0; border-bottom: 1px solid var(--line); }
.detail-list > div:last-child { border-bottom: 0; }
.detail-list dt { color: var(--muted); font-size: .78rem; }
.detail-list dd { margin: 0; text-align: right; font-weight: 650; }
.coordinate-card { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 18px; margin-bottom: 18px; padding: 18px; border-radius: 14px; background: #edf3ef; }
.coordinate-card span { color: var(--muted); font-size: .75rem; }
.coordinate-card strong { text-align: right; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
.profile-card { text-align: center; }
.profile-card .detail-list { margin-top: 22px; text-align: left; }

.auth-body {
  color: white;
  background:
    radial-gradient(circle at 20% 8%, rgba(216,184,103,.14), transparent 32%),
    linear-gradient(145deg, var(--forest-800), var(--forest-950));
}
.auth-shell { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(420px, .9fr); }
.auth-brand { display: flex; flex-direction: column; justify-content: center; padding: clamp(40px, 8vw, 110px); }
.auth-brand h1 { margin: 16px 0 20px; font-family: Georgia, serif; font-size: clamp(4rem, 9vw, 8rem); font-weight: 600; line-height: .9; }
.auth-brand > p:not(.eyebrow) { max-width: 640px; color: rgba(255,255,255,.7); font-size: 1.2rem; line-height: 1.7; }
.auth-brand__footer { margin-top: auto; padding-top: 50px; color: rgba(255,255,255,.42); font-size: .8rem; }
.auth-panel { display: flex; flex-direction: column; justify-content: center; padding: clamp(28px, 6vw, 80px); color: var(--ink); background: var(--paper); }
.login-card { width: min(480px, 100%); margin: auto; }
.login-card h2 { font-family: Georgia, serif; font-size: 2.5rem; }
.privacy-note { margin-top: 24px; padding: 15px; border-radius: 12px; color: #5d6963; background: #eaf0ec; font-size: .78rem; line-height: 1.55; }
.auth-footer { margin-top: 32px; color: #88938e; text-align: center; font-size: .72rem; }

.setup-body { padding: 32px; background: #eaf0ec; }
.setup-shell { width: min(960px, 100%); margin: 0 auto; }
.setup-brand { margin-bottom: 24px; padding: 34px; border-radius: 20px; color: white; background: var(--forest-900); }
.setup-brand h1 { margin-bottom: .6rem; font-family: Georgia, serif; font-size: 3rem; }
.setup-brand p:last-child { margin-bottom: 0; color: rgba(255,255,255,.7); }
.section-heading { grid-column: 1 / -1; display: flex; gap: 13px; align-items: center; margin: 12px 0 2px; padding-top: 16px; border-top: 1px solid var(--line); }
.section-heading:first-of-type { border-top: 0; padding-top: 0; }
.section-heading > span { display: grid; place-items: center; width: 35px; height: 35px; border-radius: 50%; color: var(--forest-950); background: var(--gold-500); font-weight: 900; }
.section-heading h2 { margin: 0; font-size: 1.15rem; }
.section-heading p { margin: 3px 0 0; color: var(--muted); font-size: .78rem; }
.form-actions { margin-top: 8px; }
.success-icon { display: grid; place-items: center; width: 72px; height: 72px; margin-bottom: 18px; border-radius: 50%; color: white; background: var(--success); font-size: 2rem; }

@media (max-width: 1180px) {
  .stats-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .filter-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .field--search { grid-column: 1 / -1; }
}

@media (max-width: 900px) {
  .app-shell { grid-template-columns: 1fr; }
  .sidebar { position: fixed; left: 0; transform: translateX(-105%); width: min(310px, 86vw); transition: transform .2s ease; box-shadow: 20px 0 60px rgba(0,0,0,.25); }
  .sidebar.is-open { transform: translateX(0); }
  .menu-button { display: block; }
  .topbar__status { display: none; }
  .dashboard-grid, .import-grid, .user-grid, .account-grid, .detail-grid { grid-template-columns: 1fr; }
  .auth-shell { grid-template-columns: 1fr; }
  .auth-brand { min-height: 42vh; padding: 40px 28px; }
  .auth-brand h1 { font-size: 4.5rem; }
  .auth-brand__footer { margin-top: 30px; }
  .auth-panel { min-height: 58vh; padding: 40px 28px; }
}

@media (max-width: 650px) {
  .content { padding: 18px; }
  .topbar { padding: 16px 18px; }
  .hero { align-items: stretch; flex-direction: column; padding: 26px; }
  .stats-grid, .form-grid, .filter-grid { grid-template-columns: 1fr; }
  .field--wide, .field--search { grid-column: auto; }
  .detail-heading { align-items: flex-start; flex-direction: column; }
  .detail-list > div { grid-template-columns: 1fr; gap: 4px; }
  .detail-list dd { text-align: left; }
  .footer { flex-direction: column; }
  .setup-body { padding: 15px; }
}
