:root {
  --cream: #f5efe4;
  --paper: #fffaf2;
  --olive: #2f3b2f;
  --olive-soft: #59634d;
  --gold: #c49850;
  --gold-dark: #9c753b;
  --ink: #292820;
  --muted: #746f64;
  --line: #ddd1bd;
  --success: #527451;
  --danger: #9a4439;
  --shadow: 0 20px 55px rgba(54, 45, 31, 0.12);
}
* { box-sizing: border-box; }
html { color-scheme: light; }
body { margin: 0; color: var(--ink); background: var(--cream); font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; }
a { color: inherit; }
h1, h2, h3 { font-family: Georgia, "Times New Roman", serif; font-weight: 500; line-height: 1.08; margin: 0 0 0.7rem; }
h1 { font-size: clamp(2rem, 5vw, 4.7rem); }
h2 { font-size: clamp(1.5rem, 3vw, 2.2rem); }
p { line-height: 1.7; }
.brand { text-decoration: none; display: inline-flex; flex-direction: column; line-height: 0.9; width: max-content; }
.brand-script { font-family: Georgia, "Times New Roman", serif; font-style: italic; font-size: 1.65rem; }
.brand-second { margin-left: 2rem; }
.brand-small { margin-top: 0.55rem; font-size: 0.64rem; letter-spacing: 0.2em; text-transform: uppercase; }
.brand-light { color: #fff8e9; }
.eyebrow { margin: 0 0 0.65rem; color: var(--gold-dark); font-size: 0.72rem; letter-spacing: 0.18em; text-transform: uppercase; font-weight: 800; }
.button { appearance: none; display: inline-flex; align-items: center; justify-content: center; min-height: 46px; padding: 0.75rem 1.15rem; border: 1px solid transparent; border-radius: 5px; text-decoration: none; font: inherit; font-weight: 800; cursor: pointer; }
.button:disabled { opacity: 0.65; cursor: wait; }
.button-primary { color: white; background: var(--gold-dark); }
.button-primary:hover { background: #7f5e30; }
.button-secondary { border-color: var(--olive); background: transparent; color: var(--olive); }
.button-block { width: 100%; }
.alert { border-radius: 7px; padding: 0.95rem 1.1rem; margin-bottom: 1rem; line-height: 1.5; }
.alert ul { margin: 0.5rem 0 0; }
.alert-error { color: #6e261f; background: #f7dfdb; border: 1px solid #e5b5ad; }
.alert-success { color: #304f31; background: #e2eedf; border: 1px solid #b8d0b3; }
label { display: grid; gap: 0.45rem; font-size: 0.78rem; font-weight: 800; color: var(--olive); }
input, select, textarea { width: 100%; min-height: 46px; border: 1px solid var(--line); border-radius: 5px; padding: 0.75rem 0.8rem; color: var(--ink); background: white; font: inherit; }
input:focus, select:focus, textarea:focus { outline: 3px solid rgba(196, 152, 80, 0.22); border-color: var(--gold); }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1.1rem; }
.form-grid .full { grid-column: 1 / -1; }
.form-actions { display: flex; justify-content: flex-end; gap: 0.75rem; padding-top: 0.4rem; }
.stack-form { display: grid; gap: 1rem; }
.form-section-title { padding-top: 0.6rem; margin: 0; font-size: 1.2rem; border-bottom: 1px solid var(--line); padding-bottom: 0.55rem; }
.help-text { color: var(--muted); font-size: 0.86rem; }

/* Installer */
.installer-body { min-height: 100vh; padding: 2rem; background: radial-gradient(circle at top right, #e9dbc1, transparent 35%), var(--cream); }
.installer-shell { width: min(900px, 100%); margin: 0 auto; }
.installer-brand { display: flex; flex-direction: column; width: max-content; margin: 0 auto 1.6rem; color: var(--olive); }
.installer-progress { display: flex; justify-content: center; gap: 0.6rem; margin-bottom: 1.4rem; }
.installer-progress span { width: 31px; height: 31px; border-radius: 50%; display: grid; place-items: center; background: #d9cfbd; color: #786f60; font-weight: 800; }
.installer-progress .active { color: white; background: var(--gold-dark); }
.installer-card { width: min(690px, 100%); margin: 0 auto; background: var(--paper); padding: clamp(1.5rem, 4vw, 3.2rem); border: 1px solid rgba(156, 117, 59, 0.18); box-shadow: var(--shadow); }
.installer-wide { width: min(850px, 100%); }
.installer-card h1 { font-size: clamp(2.3rem, 7vw, 4.4rem); }
.check-list { display: grid; margin: 1.5rem 0; border-top: 1px solid var(--line); }
.check-list > div { display: grid; grid-template-columns: 18px 1fr auto; align-items: center; gap: 0.65rem; padding: 0.75rem 0; border-bottom: 1px solid var(--line); }
.check-list strong { font-size: 0.75rem; }
.status-dot { width: 10px; height: 10px; border-radius: 50%; background: #aaa; }
.status-dot.pass { background: var(--success); }
.status-dot.fail { background: var(--danger); }
.status-dot.warn { background: var(--gold); }
.success-card { text-align: center; }
.success-mark { width: 68px; height: 68px; display: grid; place-items: center; margin: 0 auto 1rem; border-radius: 50%; color: white; background: var(--success); font-size: 2rem; }

/* Public foundation */
.foundation-public { min-height: 100vh; display: grid; grid-template-rows: auto 1fr auto; background: linear-gradient(125deg, rgba(34, 46, 35, 0.94), rgba(49, 59, 44, 0.87)), radial-gradient(circle at 75% 25%, #b99458, transparent 35%); color: #fff9ed; }
.public-header { display: flex; justify-content: space-between; align-items: center; padding: 1.35rem clamp(1.2rem, 4vw, 4.5rem); border-bottom: 1px solid rgba(255,255,255,0.14); }
.public-header .button-secondary { border-color: rgba(255,255,255,0.7); color: white; }
.foundation-hero { display: grid; grid-template-columns: 1.2fr 0.8fr; align-items: center; gap: 4rem; padding: clamp(3rem, 8vw, 8rem) clamp(1.2rem, 7vw, 8rem); }
.foundation-copy { max-width: 760px; }
.foundation-copy .eyebrow { color: #dfbc7d; }
.foundation-copy p { max-width: 680px; color: rgba(255,249,237,0.82); font-size: 1.05rem; }
.foundation-badges { display: flex; flex-wrap: wrap; gap: 0.65rem; margin-top: 1.6rem; }
.foundation-badges span { border: 1px solid rgba(255,255,255,0.25); padding: 0.55rem 0.75rem; border-radius: 999px; font-size: 0.78rem; }
.foundation-art { min-height: 360px; display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 1rem; padding: 2rem; background: rgba(255,255,255,0.07); border: 1px solid rgba(255,255,255,0.15); border-radius: 50% 42% 46% 48%; }
.foundation-art i { height: 2px; background: repeating-linear-gradient(90deg, #dfbc7d 0 9px, transparent 9px 15px); transform: rotate(-12deg); }
.foundation-art span { font-family: Georgia, serif; font-size: 1.3rem; }
.public-footer { padding: 1rem 2rem; text-align: center; color: rgba(255,255,255,0.55); font-size: 0.75rem; letter-spacing: 0.16em; text-transform: uppercase; }

/* Login */
.login-body { min-height: 100vh; display: grid; place-items: center; padding: 1.5rem; background: linear-gradient(145deg, #f2eadb, #d8c6a7); }
.login-card { width: min(440px, 100%); background: var(--paper); padding: clamp(1.7rem, 5vw, 3.2rem); box-shadow: var(--shadow); }
.login-card .brand { margin-bottom: 2.8rem; }
.login-card h1 { font-size: 2.6rem; }
.back-link { display: block; margin-top: 1.4rem; text-align: center; color: var(--muted); font-size: 0.8rem; }

/* Admin */
.admin-body { min-height: 100vh; background: #f2eee7; }
.admin-shell { min-height: 100vh; display: grid; grid-template-columns: 255px 1fr; }
.sidebar { position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; padding: 2rem 1.4rem; color: white; background: var(--olive); }
.sidebar .brand { margin-bottom: 2.6rem; }
.sidebar-nav { display: grid; gap: 0.35rem; }
.sidebar-nav a, .nav-coming { padding: 0.78rem 0.85rem; border-radius: 5px; text-decoration: none; color: rgba(255,255,255,0.84); }
.sidebar-nav a:hover { background: rgba(255,255,255,0.09); }
.nav-coming { display: flex; justify-content: space-between; opacity: 0.55; }
.nav-coming small { font-size: 0.6rem; text-transform: uppercase; letter-spacing: 0.08em; }
.sidebar-logout { margin-top: auto; padding: 0.8rem; text-decoration: none; color: rgba(255,255,255,0.72); }
.admin-main { min-width: 0; padding: 2rem clamp(1.2rem, 4vw, 4rem); }
.admin-topbar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 2rem; }
.admin-topbar h1 { font-size: clamp(2rem, 4vw, 3.2rem); }
.admin-user { padding: 0.65rem 0.9rem; background: white; border: 1px solid var(--line); border-radius: 999px; font-size: 0.78rem; font-weight: 800; }
.metric-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 1rem; margin-bottom: 1rem; }
.metric-card, .panel { background: white; border: 1px solid #e2d8c8; box-shadow: 0 8px 28px rgba(55,45,31,0.06); }
.metric-card { display: grid; gap: 0.25rem; padding: 1.25rem; }
.metric-card span { color: var(--gold-dark); font: 500 2rem Georgia, serif; }
.metric-card small { color: var(--muted); }
.dashboard-grid { display: grid; grid-template-columns: 1.2fr 0.8fr; gap: 1rem; }
.panel { padding: clamp(1.25rem, 3vw, 2rem); margin-bottom: 1rem; }
.compact { margin-bottom: 0; }
.next-package { background: linear-gradient(145deg, #fffaf1, #eee2cd); }
.form-panel { max-width: 880px; }
.package-list, .system-list { display: grid; }
.package-row, .system-list > div { display: flex; justify-content: space-between; gap: 1rem; padding: 0.9rem 0; border-bottom: 1px solid var(--line); }
.package-row div { display: grid; gap: 0.2rem; }
.package-row small { color: var(--muted); }
.package-row > span { color: var(--gold-dark); font-weight: 800; }
.system-list strong { text-align: right; }
.text-pass { color: var(--success); }
.text-fail { color: var(--danger); }
.admin-footer { padding: 2rem 0 0.5rem; color: var(--muted); font-size: 0.72rem; text-align: center; }

@media (max-width: 900px) {
  .admin-shell { grid-template-columns: 1fr; }
  .sidebar { position: static; height: auto; }
  .sidebar-nav { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .sidebar-logout { margin-top: 1rem; }
  .metric-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .dashboard-grid, .foundation-hero { grid-template-columns: 1fr; }
  .foundation-art { min-height: 220px; }
}
@media (max-width: 620px) {
  .installer-body { padding: 0.8rem; }
  .form-grid, .metric-grid { grid-template-columns: 1fr; }
  .form-grid .full { grid-column: auto; }
  .form-actions { flex-direction: column-reverse; }
  .sidebar-nav { grid-template-columns: 1fr 1fr; }
  .admin-topbar { align-items: flex-start; gap: 1rem; }
  .admin-user { display: none; }
  .public-header { gap: 1rem; }
  .public-header .button { padding-inline: 0.7rem; }
}

/* Foundation v1.1 package and system consolidation */
.package-system-grid { margin-top: 1rem; }
.package-system-grid .panel { min-width: 0; }
@media (max-width: 900px) { .package-system-grid { grid-template-columns: 1fr; } }
