:root {
  color-scheme: light;
  --ink: #202522;
  --muted: #68716b;
  --line: #d8ded9;
  --surface: #ffffff;
  --canvas: #f4f6f3;
  --teal: #086b65;
  --teal-dark: #06534f;
  --amber: #a85f00;
  --amber-bg: #fff4df;
  --red: #a5271c;
  --red-bg: #fff0ee;
  --green-bg: #e7f5ef;
  --green: #176344;
}

* { box-sizing: border-box; }
html { font-family: Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif; color: var(--ink); background: var(--canvas); }
body { margin: 0; min-height: 100vh; display: flex; flex-direction: column; }
a { color: var(--teal-dark); }
button, input, textarea { font: inherit; letter-spacing: 0; }

.topbar {
  height: 64px;
  padding: 0 max(20px, calc((100vw - 1180px) / 2));
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 10px; color: var(--ink); text-decoration: none; font-weight: 750; }
.brand img { width: 36px; height: 36px; object-fit: cover; border-radius: 4px; }
nav { display: flex; align-items: center; gap: 18px; }
nav a { color: var(--ink); text-decoration: none; font-size: 14px; }
nav a:hover { color: var(--teal); }
nav form { margin: 0; }
.account-name { color: var(--muted); font-size: 14px; padding-left: 18px; border-left: 1px solid var(--line); }

.page { width: min(1180px, calc(100% - 40px)); margin: 0 auto; padding: 36px 0 64px; flex: 1; }
footer { border-top: 1px solid var(--line); padding: 20px; color: var(--muted); text-align: center; font-size: 13px; }
h1, h2, p { margin-top: 0; }
h1 { font-size: 30px; line-height: 1.2; margin-bottom: 8px; letter-spacing: 0; }
h2 { font-size: 18px; line-height: 1.3; margin-bottom: 16px; letter-spacing: 0; }
.eyebrow { color: var(--teal); text-transform: uppercase; font-size: 12px; font-weight: 750; margin-bottom: 8px; }
.mono { font-family: "SFMono-Regular", Consolas, monospace; font-size: 13px; }
.lead { font-size: 17px; line-height: 1.55; }

.page-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 24px; margin-bottom: 32px; }
.band { padding: 24px 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); margin-bottom: 36px; }
.license-band { display: grid; grid-template-columns: minmax(240px, .8fr) minmax(320px, 1.2fr); gap: 40px; align-items: end; }
.license-value input, .license-value textarea { font-family: "SFMono-Regular", Consolas, monospace; font-size: 12px; }
.section-grid, .detail-grid { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(280px, .6fr); gap: 56px; margin-bottom: 48px; }
.note-panel, .result-panel, .action-panel {
  border-left: 4px solid var(--amber);
  padding: 4px 0 4px 22px;
  align-self: start;
}
.action-panel { border-left-color: var(--teal); }
.action-panel form { margin-bottom: 18px; }
.reject-form { padding-top: 20px; border-top: 1px solid var(--line); }

label { display: block; font-size: 13px; font-weight: 700; margin-bottom: 7px; }
input, textarea {
  width: 100%;
  border: 1px solid #b8c1ba;
  background: var(--surface);
  color: var(--ink);
  border-radius: 5px;
  padding: 10px 12px;
  min-height: 42px;
}
textarea { resize: vertical; line-height: 1.45; }
input:focus, textarea:focus { outline: 3px solid rgba(8, 107, 101, .18); border-color: var(--teal); }
.form-stack { display: grid; gap: 10px; max-width: 660px; }
.form-stack .button { margin-top: 10px; justify-self: start; }
.form-grid { display: grid; grid-template-columns: repeat(3, 1fr) auto; gap: 16px; align-items: end; }
.form-section, .verification-section { padding-top: 28px; border-top: 1px solid var(--line); }
.form-action { padding-bottom: 1px; }

.button {
  display: inline-flex;
  min-height: 40px;
  align-items: center;
  justify-content: center;
  border: 1px solid transparent;
  border-radius: 5px;
  padding: 8px 16px;
  text-decoration: none;
  cursor: pointer;
  font-weight: 700;
  white-space: nowrap;
}
.button-primary { background: var(--teal); color: #fff; }
.button-primary:hover { background: var(--teal-dark); }
.button-quiet { background: var(--surface); color: var(--ink); border-color: var(--line); min-height: 34px; padding: 6px 12px; }
.button-danger { background: var(--red); color: #fff; }
.full { width: 100%; }
.text-link, .back-link { font-weight: 700; text-underline-offset: 3px; }
.back-link { display: inline-block; margin-bottom: 20px; font-size: 14px; }

.status {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 4px 9px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 750;
  white-space: nowrap;
  background: #ecefec;
  color: #48514b;
}
.status-complete, .status-active { background: var(--green-bg); color: var(--green); }
.status-failed, .status-rejected, .status-disabled, .status-expired { background: var(--red-bg); color: var(--red); }
.status-awaiting_verification, .status-ready_to_generate, .status-needs_drive_setup, .status-missing { background: var(--amber-bg); color: var(--amber); }

.metrics { display: grid; grid-template-columns: repeat(3, 1fr); border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); margin-bottom: 38px; }
.metrics div { padding: 22px 24px; border-right: 1px solid var(--line); }
.metrics div:last-child { border-right: 0; }
.metrics span { display: block; color: var(--muted); font-size: 13px; margin-bottom: 8px; }
.metrics strong { font-size: 28px; }

.table-section { margin-top: 36px; }
.section-heading { display: flex; justify-content: space-between; align-items: baseline; gap: 20px; }
.section-heading span { color: var(--muted); font-size: 13px; }
.table-wrap { overflow-x: auto; border-top: 1px solid var(--line); }
table { width: 100%; border-collapse: collapse; background: var(--surface); }
th, td { padding: 13px 14px; text-align: left; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { font-size: 12px; color: var(--muted); text-transform: uppercase; background: #f8faf8; }
td { font-size: 14px; }
.empty-state { padding: 36px; border: 1px dashed #b9c2bb; text-align: center; color: var(--muted); background: rgba(255,255,255,.45); }

.meta-list { margin: 24px 0; }
.meta-list div { display: grid; grid-template-columns: 120px 1fr; padding: 11px 0; border-bottom: 1px solid var(--line); }
.meta-list dt { color: var(--muted); }
.meta-list dd { margin: 0; }
.data-section { border-top: 1px solid var(--line); padding: 20px 0; margin-bottom: 28px; }
.data-section summary { font-weight: 750; cursor: pointer; }
pre, .error-detail { white-space: pre-wrap; overflow-wrap: anywhere; background: #202522; color: #edf2ee; padding: 16px; border-radius: 5px; max-height: 420px; overflow: auto; font-size: 12px; }
.editor-grid { display: grid; grid-template-columns: 2fr 1fr; gap: 20px; margin-bottom: 16px; }
.editor-grid textarea { font-family: "SFMono-Regular", Consolas, monospace; font-size: 12px; }

.alert { padding: 12px 15px; margin-bottom: 24px; border-left: 4px solid var(--teal); background: var(--surface); }
.alert-error { border-color: var(--red); background: var(--red-bg); }
.alert-success { border-color: var(--green); background: var(--green-bg); }

.login-shell { min-height: calc(100vh - 230px); display: grid; grid-template-columns: 1fr 400px; align-items: center; gap: 80px; }
.login-copy { max-width: 560px; }
.login-copy h1 { font-size: 40px; }
.login-copy p { color: var(--muted); font-size: 18px; line-height: 1.6; }
.login-mark { width: 76px; height: 76px; object-fit: cover; border-radius: 6px; margin-bottom: 24px; }
.auth-panel { background: var(--surface); border: 1px solid var(--line); border-radius: 6px; padding: 30px; display: grid; gap: 10px; box-shadow: 0 12px 30px rgba(32, 37, 34, .08); }
.auth-panel .button { margin-top: 12px; }

.error-page { min-height: 55vh; display: flex; flex-direction: column; justify-content: center; align-items: flex-start; max-width: 640px; }
.error-code { color: var(--amber); font-size: 64px; font-weight: 800; margin-bottom: 4px; }

@media (max-width: 800px) {
  .topbar { height: auto; min-height: 64px; padding: 12px 20px; align-items: flex-start; }
  nav { flex-wrap: wrap; justify-content: flex-end; gap: 10px 14px; }
  .account-name { display: none; }
  .page { width: min(100% - 28px, 1180px); padding-top: 26px; }
  .page-header { align-items: flex-start; }
  .license-band, .section-grid, .detail-grid, .login-shell, .editor-grid { grid-template-columns: 1fr; gap: 28px; }
  .login-shell { min-height: auto; padding: 28px 0; }
  .login-copy h1 { font-size: 32px; }
  .form-grid { grid-template-columns: 1fr; }
  .metrics { grid-template-columns: 1fr; }
  .metrics div { border-right: 0; border-bottom: 1px solid var(--line); }
  .metrics div:last-child { border-bottom: 0; }
  .license-value { min-width: 0; }
  h1 { font-size: 26px; }
}
