:root {
  color-scheme: light;
  --ink: #333f49;
  --muted: #687077;
  --panel: #ffffff;
  --panel-2: #f2f2f2;
  --line: #e1e2e4;
  --line-strong: #bac2c4;
  --accent: #699140;
  --accent-dark: #4f6f30;
  --accent-soft: #b9d982;
  --amber: #8a6218;
  --danger: #b53b33;
  --shadow: 0 18px 50px rgba(51, 63, 73, .1);
  font-family: "Outfit", "Avenir Next", Avenir, "Segoe UI", ui-sans-serif, system-ui, sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background:
    radial-gradient(circle at 8% 0%, rgba(185, 217, 130, .26), transparent 34rem),
    #f7f8f5;
}

button, input, select { font: inherit; }
button:disabled { cursor: wait; opacity: .58; }

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 68px;
  padding: 0 5vw;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, .92);
  backdrop-filter: blur(18px);
}

.operator { color: var(--muted); }
.brand { display: flex; align-items: center; gap: 15px; color: var(--ink); text-decoration: none; white-space: nowrap; }
.brand-logo {
  display: flex;
  align-items: center;
}
.brand-logo img { display: block; width: 154px; height: auto; }
.product-context { display: grid; gap: 1px; padding-left: 15px; border-left: 1px solid var(--line-strong); line-height: 1; }
.product-context strong { color: var(--accent-dark); font-size: .9rem; letter-spacing: .12em; }
.product-context small { color: var(--muted); font-size: .68rem; font-weight: 700; letter-spacing: .035em; }
.brand-fallback { display: none; font-weight: 900; letter-spacing: .14em; }
.portal-nav { display: flex; align-self: stretch; gap: 6px; }
.portal-nav a {
  display: flex;
  align-items: center;
  padding: 0 16px;
  color: var(--muted);
  border-bottom: 2px solid transparent;
  font-size: .82rem;
  font-weight: 800;
  text-decoration: none;
}
.portal-nav a:hover { color: var(--ink); }
.portal-nav a.active { color: var(--accent-dark); border-bottom-color: var(--accent); }
.operator { display: flex; align-items: center; gap: 18px; }
.operator form { margin: 0; }

.page {
  width: min(1380px, 92vw);
  margin: 0 auto;
  padding: 56px 0 90px;
}

.hero {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: end;
  gap: 40px;
  margin-bottom: 38px;
}

h1, h2, p { margin-top: 0; }
h1, h2 { font-family: "Zilla Slab", Rockwell, "Roboto Slab", Georgia, serif; font-weight: 600; }
h1 { max-width: 760px; margin-bottom: 14px; font-size: clamp(2.5rem, 6vw, 5.7rem); line-height: .96; letter-spacing: -.035em; }
h2 { margin-bottom: 0; font-size: 1.55rem; letter-spacing: -.01em; }
.hero p:not(.eyebrow) { max-width: 650px; color: var(--muted); font-size: 1.1rem; line-height: 1.65; }
.view-heading { margin-bottom: 38px; }
.view-heading h1 { font-size: clamp(2.4rem, 5vw, 4.8rem); }
.view-heading p:not(.eyebrow) { max-width: 760px; margin-bottom: 0; color: var(--muted); font-size: 1.05rem; line-height: 1.65; }

.eyebrow {
  margin-bottom: 10px;
  color: var(--accent-dark);
  font-size: .72rem;
  font-weight: 800;
  letter-spacing: .14em;
  text-transform: uppercase;
}

.policy-card {
  display: grid;
  min-width: 190px;
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--panel);
}
.policy-card span { color: var(--muted); font-size: .78rem; text-transform: uppercase; letter-spacing: .08em; }
.policy-card strong { margin-top: 7px; font-size: 1.25rem; }

.content-grid {
  display: grid;
  grid-template-columns: minmax(330px, .8fr) minmax(460px, 1.2fr);
  gap: 24px;
}

.panel {
  border: 1px solid var(--line);
  border-radius: 22px;
  background: var(--panel);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.panel-heading { padding: 26px 28px 20px; border-bottom: 1px solid var(--line); }
.panel-heading-action { display: flex; align-items: center; justify-content: space-between; gap: 24px; }
.stack { display: grid; gap: 18px; padding: 26px 28px 30px; }
.stack.compact { padding: 0; }

label, legend { color: var(--muted); font-size: .78rem; font-weight: 750; letter-spacing: .045em; text-transform: uppercase; }
input, select {
  width: 100%;
  margin-top: 8px;
  padding: 12px 13px;
  color: var(--ink);
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  outline: none;
  background: #ffffff;
}
input:focus, select:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(105, 145, 64, .16); }
input::placeholder {
  color: #9da4a8;
  font-style: italic;
  font-weight: 400;
  opacity: 1;
}
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }

fieldset { display: grid; gap: 10px; padding: 0; border: 0; }
legend { margin-bottom: 8px; }
.package-choice {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 13px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fafbf8;
  text-transform: none;
}
.package-choice input, .toggle input { width: auto; margin: 0; accent-color: var(--accent); }
.package-choice span { display: grid; gap: 3px; }
.package-choice strong { color: var(--ink); font-size: .94rem; }
.package-choice small { color: var(--muted); }

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 46px;
  padding: 0 18px;
  color: #ffffff;
  border: 0;
  border-radius: 30px;
  background: var(--accent-dark);
  font-weight: 850;
  text-decoration: none;
  cursor: pointer;
}
.button:hover { background: #3f5926; }
.button.secondary { color: var(--accent-dark); border: 1px solid var(--accent); background: #ffffff; }
.button.secondary:hover { color: #ffffff; background: var(--accent-dark); }
.button.light { color: var(--accent-dark); background: #ffffff; }
.button.light:hover { color: #ffffff; background: var(--accent-dark); }
.button.wide { width: 100%; }
.text-button { padding: 0; color: var(--accent-dark); border: 0; background: transparent; cursor: pointer; }
.text-button.danger { color: var(--danger); }

.authorization-list { display: grid; max-height: 690px; overflow: auto; }
.authorization-empty { padding: 22px 26px; }
.authorization { padding: 21px 26px; border-bottom: 1px solid var(--line); }
.authorization:last-child { border-bottom: 0; }
.authorization.closed { opacity: .64; }
.authorization-top { display: flex; justify-content: space-between; gap: 20px; }
.authorization-top > div { display: flex; align-items: center; gap: 10px; }
.status {
  display: inline-flex;
  padding: 4px 8px;
  color: var(--muted);
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: .66rem;
  font-weight: 800;
  letter-spacing: .06em;
  text-transform: uppercase;
}
.authorization.active .status, .status.enabled { color: var(--accent-dark); border-color: rgba(105, 145, 64, .42); background: rgba(185, 217, 130, .25); }
.code-hint { color: var(--amber); font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
dl { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px 24px; margin: 18px 0; }
dl div { min-width: 0; }
dt { color: var(--muted); font-size: .7rem; text-transform: uppercase; }
dd { margin: 4px 0 0; overflow-wrap: anywhere; }

.code-reveal {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 30px;
  margin-bottom: 32px;
  padding: 24px 28px;
  color: var(--ink);
  border: 1px solid rgba(105, 145, 64, .26);
  border-radius: 18px;
  background: var(--accent-soft);
  box-shadow: 0 18px 45px rgba(105, 145, 64, .16);
}
.code-reveal .eyebrow { color: var(--accent-dark); }
.code-reveal h2 { margin-bottom: 6px; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: clamp(1.7rem, 4vw, 2.8rem); letter-spacing: .08em; }
.code-reveal p { margin-bottom: 0; }
.notice { margin-bottom: 22px; padding: 12px 16px; color: var(--accent-dark); border: 1px solid rgba(105, 145, 64, .35); border-radius: 10px; background: rgba(185, 217, 130, .22); }

.package-admin { margin-top: 24px; }
.package-layout { display: grid; grid-template-columns: .8fr 1.2fr; gap: 32px; padding: 28px; }
.package-table { border-right: 1px solid var(--line); padding-right: 30px; }
.package-row { display: flex; justify-content: space-between; gap: 16px; padding: 14px 0; border-bottom: 1px solid var(--line); }
.package-row div { display: grid; gap: 4px; }
.package-row small { color: var(--muted); }
.toggle { display: flex; align-items: center; gap: 9px; }
.empty, .fine-print { color: var(--muted); }
.package-forms { display: grid; gap: 26px; }
.form-section { padding-top: 26px !important; border-top: 1px solid var(--line); }
.form-title { margin: 0; color: var(--ink); font-weight: 850; }
.form-help { margin: 0; color: var(--muted); font-size: .82rem; line-height: 1.55; }
.upload-status { min-height: 1.2em; margin: 0; color: var(--amber); overflow-wrap: anywhere; }
.manual-metadata { padding-top: 22px; border-top: 1px solid var(--line); }
.manual-metadata summary { color: var(--accent-dark); cursor: pointer; font-weight: 750; }
.manual-metadata[open] summary { margin-bottom: 22px; }

.audit-panel { margin-top: 24px; }
.audit-filters {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  padding: 22px 28px;
  border-bottom: 1px solid var(--line);
}
.audit-filter-actions { display: flex; align-items: center; gap: 18px; }
.audit-filter-note { grid-column: 1 / -1; }
.audit-table { display: grid; max-height: 520px; overflow: auto; }
.audit-row {
  display: grid;
  grid-template-columns: minmax(190px, .8fr) minmax(190px, 1fr) minmax(220px, 1.2fr);
  gap: 22px;
  padding: 15px 28px;
  border-bottom: 1px solid var(--line);
}
.audit-row:last-child { border-bottom: 0; }
.audit-row > div { display: flex; min-width: 0; flex-direction: column; gap: 4px; }
.audit-row span, .audit-row small { color: var(--muted); overflow-wrap: anywhere; }
.audit-row strong { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .86rem; }
.audit-row small { font-size: .72rem; }
.audit-empty { padding: 20px 28px; }

.login-page { display: grid; place-items: center; }
.login-shell { width: min(680px, 92vw); }
.login-card {
  padding: clamp(30px, 7vw, 58px);
  border: 1px solid var(--line);
  border-radius: 28px;
  background: #ffffff;
  box-shadow: var(--shadow);
}
.login-logo {
  display: inline-flex;
  margin-bottom: 42px;
}
.login-logo img { display: block; width: min(310px, 65vw); height: auto; }
.login-card h1 { font-size: clamp(2.8rem, 10vw, 4.8rem); }
.lede { margin-bottom: 32px; color: var(--muted); line-height: 1.7; }
.fine-print { margin: 22px 0 0; font-size: .76rem; text-align: center; }

@media (max-width: 900px) {
  .topbar { padding: 0 3vw; }
  .brand-logo img { width: 132px; }
  .product-context small { display: none; }
  .hero, .content-grid, .package-layout { grid-template-columns: 1fr; }
  .audit-filters { grid-template-columns: 1fr 1fr; }
  .audit-row { grid-template-columns: 1fr 1fr; }
  .audit-row > div:last-child { grid-column: 1 / -1; }
  .policy-card { width: 100%; }
  .package-table { border-right: 0; border-bottom: 1px solid var(--line); padding: 0 0 24px; }
}

@media (max-width: 580px) {
  .topbar { min-height: 62px; padding: 0 3vw; }
  .brand-logo { display: none; }
  .product-context { display: none; }
  .brand-fallback { display: inline; }
  .operator > span { display: none; }
  .operator { gap: 0; }
  .portal-nav { gap: 0; }
  .portal-nav a { padding: 0 9px; font-size: .76rem; }
  .page { width: 94vw; padding-top: 34px; }
  .field-row, dl { grid-template-columns: 1fr; }
  .audit-filters { grid-template-columns: 1fr; }
  .code-reveal { align-items: stretch; flex-direction: column; }
  .panel-heading-action { align-items: flex-start; flex-direction: column; }
}
