:root {
  color-scheme: light;
  --forest-950: #071a12;
  --forest-900: #0c2419;
  --forest-800: #143b29;
  --forest-700: #1d5239;
  --forest-100: #eaf2ed;
  --gold-600: #a67c27;
  --gold-500: #c69b43;
  --ink-900: #18231d;
  --ink-700: #415047;
  --ink-500: #69786f;
  --surface: #ffffff;
  --canvas: #f2f5f3;
  --line: #dce4df;
  --line-soft: #e9eeeb;
  --success: #24744b;
  --warning: #9d6112;
  --danger: #a13931;
  --blue: #235f80;
  --shadow-sm: 0 3px 12px rgba(7, 26, 18, .06);
  --shadow-lg: 0 28px 80px rgba(7, 26, 18, .22);
}

* { box-sizing: border-box; }
html { min-width: 320px; background: var(--canvas); font-family: Inter, "Segoe UI", Arial, sans-serif; color: var(--ink-900); }
body { min-height: 100vh; margin: 0; background: var(--canvas); }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
.skip-link { position: fixed; z-index: 2000; left: 16px; top: -60px; padding: 11px 15px; color: #fff; background: var(--forest-900); border-radius: 6px; }
.skip-link:focus { top: 12px; }

.admin-app { min-height: 100vh; }
.admin-topbar { position: sticky; z-index: 100; top: 0; height: 76px; display: flex; align-items: center; justify-content: space-between; gap: 24px; padding: 0 28px; color: #fff; background: rgba(7, 26, 18, .97); border-bottom: 1px solid rgba(255,255,255,.08); box-shadow: 0 6px 24px rgba(0,0,0,.16); backdrop-filter: blur(14px); }
.admin-brand { display: flex; align-items: center; gap: 13px; min-width: 0; color: #fff; text-decoration: none; }
.admin-logo { width: 49px; height: 49px; flex: 0 0 49px; display: grid; place-items: center; overflow: hidden; background: #fff; border: 1px solid rgba(198,155,67,.7); border-radius: 50%; }
.admin-logo img { width: 45px; height: 45px; object-fit: contain; }
.admin-brand strong, .admin-brand small { display: block; }
.admin-brand strong { font-family: Georgia, serif; font-size: 17px; letter-spacing: .01em; }
.admin-brand small { margin-top: 2px; color: #a9b9af; font-size: 9px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; }
.admin-top-actions { display: flex; align-items: center; gap: 16px; }
.public-link { color: #d6e1da; font-size: 10px; font-weight: 700; text-decoration: none; }
.public-link:hover { color: #fff; }
.admin-identity { display: flex; align-items: center; gap: 13px; padding-left: 16px; border-left: 1px solid rgba(255,255,255,.12); }
.admin-identity span strong, .admin-identity span small { display: block; text-align: right; }
.admin-identity span strong { font-size: 11px; }
.admin-identity span small { margin-top: 2px; color: #96aa9e; font-size: 8px; text-transform: uppercase; }
.admin-identity button { padding: 7px 10px; color: #fff; background: transparent; border: 1px solid rgba(255,255,255,.2); border-radius: 6px; font-size: 9px; font-weight: 750; }

.auth-view { position: relative; min-height: calc(100vh - 76px); display: grid; place-items: center; overflow: hidden; padding: 50px 20px; background: linear-gradient(125deg, var(--forest-950), #123b28); }
.auth-backdrop { position: absolute; inset: 0; opacity: .24; background: radial-gradient(circle at 18% 18%, rgba(198,155,67,.6), transparent 26%), radial-gradient(circle at 85% 75%, rgba(45,102,72,.8), transparent 28%), linear-gradient(135deg, transparent 48%, rgba(255,255,255,.04) 49%, transparent 50%); background-size: auto, auto, 50px 50px; }
.auth-card { position: relative; width: min(470px, 100%); padding: 38px 42px 34px; background: rgba(255,255,255,.98); border: 1px solid rgba(255,255,255,.6); border-top: 4px solid var(--gold-500); border-radius: 14px; box-shadow: var(--shadow-lg); }
.secure-mark { width: 48px; height: 48px; display: grid; place-items: center; margin-bottom: 24px; color: var(--gold-600); background: #faf6eb; border: 1px solid #e7d9b8; border-radius: 50%; font-size: 18px; }
.admin-eyebrow { color: var(--forest-700); font-size: 8px; font-weight: 850; letter-spacing: .13em; text-transform: uppercase; }
.admin-eyebrow.light { color: #d0b976; }
.auth-card h1 { margin: 8px 0 10px; color: var(--forest-900); font-family: Georgia, serif; font-size: 36px; font-weight: 600; }
.auth-card > p { margin: 0 0 24px; color: var(--ink-700); font-size: 12px; line-height: 1.7; }
.setup-notice { display: grid; gap: 5px; margin: 0 0 20px; padding: 13px 15px; color: #69430f; background: #fff8e8; border: 1px solid #ecd8aa; border-left: 4px solid var(--gold-500); border-radius: 7px; }
.setup-notice strong { font-size: 10px; }
.setup-notice span { font-size: 9px; line-height: 1.55; }
#login-form { display: grid; gap: 14px; }
#login-form label:not(.remember-field), .dialog-fields label { display: grid; gap: 6px; }
#login-form label > span, .dialog-fields label > span { color: var(--ink-700); font-size: 9px; font-weight: 750; text-transform: uppercase; letter-spacing: .05em; }
#login-form input, .dialog-fields input, .dialog-fields select, .dialog-fields textarea, .source-tools input, .source-tools select { width: 100%; color: var(--ink-900); background: #fbfcfb; border: 1px solid #cbd6cf; border-radius: 7px; outline: none; transition: border-color .15s, box-shadow .15s; }
#login-form input { height: 45px; padding: 0 13px; }
#login-form input:focus, .dialog-fields input:focus, .dialog-fields select:focus, .dialog-fields textarea:focus, .source-tools input:focus, .source-tools select:focus { border-color: var(--forest-700); box-shadow: 0 0 0 3px rgba(29,82,57,.12); }
.remember-field { display: flex; align-items: center; gap: 8px; color: var(--ink-500); font-size: 9px; }
.remember-field input { width: 15px !important; height: 15px !important; accent-color: var(--forest-700); }
.admin-button { min-height: 41px; padding: 10px 16px; border-radius: 7px; font-size: 10px; font-weight: 800; }
.admin-button.primary { color: #fff; background: var(--forest-700); border: 1px solid var(--forest-700); box-shadow: 0 4px 12px rgba(16,60,40,.16); }
.admin-button.primary:hover { background: var(--forest-800); }
.admin-button.secondary { color: var(--forest-800); background: #fff; border: 1px solid #bccbc2; }
.admin-button:disabled { cursor: wait; opacity: .6; }
.form-message { min-height: 16px; margin: -2px 0 0; color: var(--danger); font-size: 9px; }
.auth-boundary { margin-top: 22px; padding-top: 15px; color: var(--ink-500); border-top: 1px solid var(--line-soft); font-size: 8px; line-height: 1.6; }

.operations-view { min-height: calc(100vh - 76px); }
.operations-hero { min-height: 230px; display: flex; align-items: flex-end; justify-content: space-between; gap: 30px; padding: 48px max(28px, calc((100vw - 1440px) / 2)) 38px; color: #fff; background: linear-gradient(115deg, var(--forest-950), #16462f); }
.operations-hero h1 { margin: 8px 0 7px; font-family: Georgia, serif; font-size: clamp(38px, 5vw, 57px); font-weight: 600; }
.operations-hero p { margin: 0; color: #b7c6bd; font-size: 13px; }
.revision-panel { min-width: 230px; padding: 18px 20px; background: rgba(255,255,255,.08); border: 1px solid rgba(255,255,255,.13); border-radius: 9px; }
.revision-panel span, .revision-panel strong, .revision-panel small { display: block; }
.revision-panel span { color: #a9b9af; font-size: 8px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }
.revision-panel strong { margin: 6px 0 4px; color: #fff; font-family: Georgia, serif; font-size: 22px; }
.revision-panel small { color: #a9b9af; font-size: 8px; }
.operations-content { width: min(1440px, calc(100% - 56px)); margin: 0 auto; padding: 28px 0 70px; }
.admin-metric-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 11px; margin-top: -58px; margin-bottom: 17px; }
.admin-metric-grid article { min-height: 145px; padding: 20px; background: var(--surface); border: 1px solid var(--line); border-top: 3px solid var(--gold-500); border-radius: 9px; box-shadow: var(--shadow-sm); }
.admin-metric-grid span, .admin-metric-grid small { display: block; }
.admin-metric-grid span { color: var(--ink-500); font-size: 8px; font-weight: 850; letter-spacing: .06em; text-transform: uppercase; }
.admin-metric-grid strong { display: block; margin: 14px 0 7px; color: var(--forest-900); font-family: Georgia, serif; font-size: 32px; }
.admin-metric-grid small { color: var(--ink-500); font-size: 8px; }
.operations-grid { display: grid; grid-template-columns: minmax(0, 1.45fr) minmax(300px, .55fr); gap: 16px; margin-bottom: 16px; }
.admin-panel { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; box-shadow: var(--shadow-sm); }
.coverage-panel, .activity-panel, .source-governance { padding: 23px; }
.panel-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; }
.panel-heading h2 { margin: 6px 0 0; color: var(--forest-900); font-family: Georgia, serif; font-size: 22px; }
.panel-heading p { margin: 5px 0 0; color: var(--ink-500); font-size: 10px; }
.health-chip { padding: 5px 8px; color: var(--success); background: #eef7f1; border: 1px solid #d4e6da; border-radius: 5px; font-size: 8px; font-weight: 800; text-transform: uppercase; }
.health-chip.warning { color: var(--warning); background: #fff7e8; border-color: #ead7ad; }
.coverage-list { display: grid; gap: 10px; margin-top: 20px; }
.coverage-row { display: grid; grid-template-columns: minmax(160px, .55fr) minmax(180px, 1fr) 80px; gap: 14px; align-items: center; }
.coverage-row h3 { margin: 0 0 3px; color: var(--ink-900); font-size: 10px; }
.coverage-row p { margin: 0; color: var(--ink-500); font-size: 8px; }
.coverage-bar { height: 7px; overflow: hidden; background: #e8eeea; border-radius: 999px; }
.coverage-bar span { display: block; height: 100%; background: linear-gradient(90deg, var(--forest-700), #3b8a61); border-radius: inherit; }
.coverage-value { color: var(--ink-700); font-size: 9px; font-weight: 750; text-align: right; }
.activity-list { display: grid; gap: 0; margin-top: 17px; }
.activity-item { display: grid; grid-template-columns: 30px 1fr; gap: 9px; padding: 10px 0; border-bottom: 1px solid var(--line-soft); }
.activity-icon { width: 28px; height: 28px; display: grid; place-items: center; color: var(--forest-700); background: var(--forest-100); border-radius: 50%; font-size: 9px; font-weight: 850; }
.activity-item strong { display: block; color: var(--ink-700); font-size: 9px; }
.activity-item small { display: block; margin-top: 3px; color: var(--ink-500); font-size: 8px; line-height: 1.4; }
.activity-empty { padding: 30px 10px; color: var(--ink-500); font-size: 9px; text-align: center; }
.source-governance { padding-bottom: 12px; }
.source-heading { align-items: flex-end; }
.source-tools { display: grid; grid-template-columns: minmax(220px, 310px) 150px; gap: 8px; }
.source-tools input, .source-tools select { height: 39px; padding: 0 11px; font-size: 9px; }
.source-summary { margin: 18px 0 8px; color: var(--ink-500); font-size: 9px; }
.admin-table-scroll { overflow-x: auto; }
.admin-table { width: 100%; border-collapse: collapse; font-size: 9px; }
.admin-table th { padding: 10px 9px; color: var(--ink-500); border-bottom: 1px solid var(--line); font-size: 8px; letter-spacing: .06em; text-align: left; text-transform: uppercase; }
.admin-table td { padding: 12px 9px; color: var(--ink-700); border-bottom: 1px solid var(--line-soft); vertical-align: middle; }
.admin-table td strong { display: block; color: var(--ink-900); font-size: 10px; }
.admin-table td small { display: block; margin-top: 3px; color: var(--ink-500); font-size: 8px; }
.source-status { display: inline-block; padding: 4px 6px; color: var(--success); background: #edf6f0; border-radius: 4px; font-size: 8px; font-weight: 800; }
.source-status.due { color: var(--warning); background: #fff5df; }
.review-source-button { padding: 6px 9px; color: var(--blue); background: #f5f8fa; border: 1px solid #d3dfe5; border-radius: 5px; font-size: 8px; font-weight: 800; }

.review-dialog { width: min(670px, calc(100% - 30px)); padding: 0; color: var(--ink-900); background: var(--surface); border: 0; border-radius: 12px; box-shadow: var(--shadow-lg); }
.review-dialog::backdrop { background: rgba(4,18,11,.72); backdrop-filter: blur(2px); }
.dialog-heading { display: flex; justify-content: space-between; gap: 20px; padding: 24px 26px 18px; border-bottom: 1px solid var(--line); }
.dialog-heading h2 { margin: 6px 0 4px; color: var(--forest-900); font-family: Georgia, serif; font-size: 26px; }
.dialog-heading p { margin: 0; color: var(--ink-500); font-size: 9px; }
.dialog-close { width: 34px; height: 34px; flex: 0 0 34px; color: var(--ink-500); background: #f4f7f5; border: 1px solid var(--line); border-radius: 50%; font-size: 22px; line-height: 1; }
.dialog-fields { display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px; padding: 22px 26px 24px; }
.dialog-fields .wide { grid-column: 1 / -1; }
.dialog-fields input, .dialog-fields select { height: 41px; padding: 0 11px; }
.dialog-fields textarea { padding: 11px; resize: vertical; line-height: 1.55; }
.dialog-fields small { color: var(--ink-500); font-size: 8px; text-align: right; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 9px; padding: 14px 26px; background: #f6f8f6; border-top: 1px solid var(--line); }
.admin-toast { position: fixed; z-index: 1200; right: 22px; bottom: 22px; max-width: 350px; padding: 13px 16px; color: #fff; background: var(--forest-900); border-left: 4px solid var(--gold-500); border-radius: 7px; box-shadow: 0 12px 34px rgba(0,0,0,.22); font-size: 10px; font-weight: 700; }

@media (max-width: 1000px) {
  .admin-metric-grid { grid-template-columns: repeat(2, 1fr); }
  .operations-grid { grid-template-columns: 1fr; }
}

@media (max-width: 720px) {
  .admin-topbar { height: 66px; padding: 0 12px; }
  .admin-logo { width: 42px; height: 42px; flex-basis: 42px; }
  .admin-logo img { width: 38px; height: 38px; }
  .admin-brand strong { font-size: 14px; }
  .public-link { display: none; }
  .admin-identity span { display: none; }
  .auth-view { min-height: calc(100vh - 66px); padding: 25px 12px; }
  .auth-card { padding: 28px 22px 25px; }
  .auth-card h1 { font-size: 31px; }
  .operations-hero { min-height: 250px; display: block; padding: 38px 18px 78px; }
  .operations-hero h1 { font-size: 39px; }
  .revision-panel { margin-top: 22px; }
  .operations-content { width: calc(100% - 24px); }
  .admin-metric-grid { grid-template-columns: 1fr; margin-top: -45px; }
  .admin-metric-grid article { min-height: 120px; }
  .coverage-panel, .activity-panel, .source-governance { padding: 18px; }
  .coverage-row { grid-template-columns: 1fr 60px; gap: 6px; }
  .coverage-bar { grid-row: 2; grid-column: 1 / -1; }
  .source-heading { display: block; }
  .source-tools { grid-template-columns: 1fr; margin-top: 15px; }
  .admin-table th:nth-child(2), .admin-table td:nth-child(2) { display: none; }
  .dialog-fields { grid-template-columns: 1fr; padding: 18px; }
  .dialog-fields .wide { grid-column: auto; }
  .dialog-heading, .dialog-actions { padding-left: 18px; padding-right: 18px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; }
}
