:root {
  --ink: #171717;
  --ink-soft: #363636;
  --muted: #74706d;
  --line: #ebe7e4;
  --canvas: #fbfaf9;
  --panel: #fff;
  --brand: #f1592c;
  --brand-dark: #d7461d;
  --brand-soft: #fff0ea;
  --sun: #ffc94e;
  --mint: #e9f8ef;
  --amber: #93660d;
  --amber-bg: #fff5d9;
  --danger: #bd3d34;
  --danger-bg: #fff0ef;
  --radius: 16px;
  --shadow: 0 20px 55px rgba(40, 25, 18, .09);
}

* { box-sizing: border-box; }
body { margin: 0; background: var(--canvas); color: var(--ink); font: 14px/1.55 Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
h1, h2, h3, p { margin-top: 0; }
h1, h2, h3 { font-family: Poppins, Inter, sans-serif; color: var(--ink); }
h1 { margin-bottom: 13px; font-size: 34px; line-height: 1.13; letter-spacing: -.055em; }
h2 { margin-bottom: 3px; font-size: 20px; letter-spacing: -.04em; }
h3 { margin-bottom: 5px; font-size: 15px; letter-spacing: -.02em; }

.public-shell { position: relative; display: grid; min-height: 100vh; place-items: center; overflow: hidden; padding: 104px 36px 36px; background: radial-gradient(circle at 6% 5%, #ffd4c5 0, transparent 27rem), radial-gradient(circle at 97% 95%, #ffe09a 0, transparent 31rem), linear-gradient(130deg, #fff 0%, #fffaf7 52%, #fff6ef 100%); }
.public-shell::before, .public-shell::after { position: absolute; z-index: 0; width: 28rem; height: 28rem; content: ""; border: 2px solid rgba(241, 89, 44, .13); border-radius: 50%; pointer-events: none; }
.public-shell::before { top: -21rem; right: -9rem; }
.public-shell::after { bottom: -22rem; left: -11rem; }
.public-brand { position: absolute; z-index: 1; top: 30px; left: 38px; display: inline-flex; align-items: center; gap: 10px; }
.public-brand img { display: block; width: 184px; height: auto; }
.public-brand span { margin-top: 2px; color: var(--ink); font: 700 12px/1 Inter, sans-serif; letter-spacing: .1em; text-transform: uppercase; }
.upload-card { position: relative; z-index: 1; width: min(100%, 550px); padding: 48px; border: 1px solid rgba(30, 20, 16, .08); border-radius: 24px; background: rgba(255, 255, 255, .94); box-shadow: var(--shadow); }
.upload-card::before { position: absolute; top: 0; right: 44px; left: 44px; height: 4px; content: ""; border-radius: 0 0 6px 6px; background: var(--brand); }
.eyebrow { margin: 0 0 10px; color: var(--brand); font-size: 10px; font-weight: 800; letter-spacing: .14em; }
.lead-copy, .muted { color: var(--muted); }
.lead-copy { margin-bottom: 31px; font-size: 16px; }
.upload-form { display: grid; gap: 17px; }
.upload-form label, .form-grid label, .filters label, .status-form label { display: grid; gap: 7px; color: var(--ink-soft); font-size: 12px; font-weight: 700; }
.upload-form label span { color: var(--muted); font-weight: 500; }
input, select, textarea { width: 100%; padding: 12px 13px; border: 1px solid #ddd6d1; border-radius: 10px; outline: none; background: #fff; color: var(--ink); transition: border .2s, box-shadow .2s, background .2s; }
input:focus, select:focus, textarea:focus { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(241, 89, 44, .14); }
textarea { resize: vertical; }
.drop-zone { min-height: 171px; padding: 19px; border: 1.5px dashed #eea58d !important; border-radius: 14px; align-content: center; justify-items: center; background: #fffaf7; text-align: center; cursor: pointer; transition: border .2s, background .2s, transform .2s; }
.drop-zone:hover { border-color: var(--brand) !important; background: var(--brand-soft); }
.drop-zone.dragover, .drop-zone.has-file { border-color: var(--brand) !important; background: var(--brand-soft); transform: scale(1.01); }
.drop-zone input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.drop-zone strong { font-size: 14px; }
.drop-zone small { color: var(--muted); font-weight: 400; }
.drop-zone em { margin-top: 7px; color: #92766a; font-size: 11px; font-style: normal; }
.upload-glyph { display: grid; width: 37px; height: 37px; margin-bottom: 7px; border-radius: 12px; place-items: center; background: var(--brand); color: white; font: 800 24px/1 Poppins, sans-serif; }
.primary-button, .outline-button { display: inline-flex; align-items: center; justify-content: center; min-height: 43px; padding: 10px 17px; border: 1px solid var(--brand); border-radius: 10px; font-weight: 750; transition: transform .16s, background .16s, box-shadow .16s; }
.primary-button { background: var(--brand); color: white; box-shadow: 0 9px 18px rgba(241, 89, 44, .18); }
.primary-button:hover { transform: translateY(-2px); background: var(--brand-dark); box-shadow: 0 13px 22px rgba(241, 89, 44, .25); }
.outline-button { background: #fff; color: var(--brand); }
.outline-button:hover { background: var(--brand-soft); }
.small { min-height: 35px; padding: 7px 11px; font-size: 12px; }
.success-state { padding: 25px 3px; text-align: center; }
.success-state h1 { margin-top: 19px; }
.success-icon { display: inline-grid; width: 60px; height: 60px; border-radius: 50%; place-items: center; background: var(--brand-soft); color: var(--brand); font-size: 30px; font-weight: 800; }
.flash { margin: 0 0 17px; padding: 10px 12px; border-radius: 10px; font-weight: 600; }
.flash-success { background: var(--mint); color: #276544; }
.flash-error { background: var(--danger-bg); color: #963b35; }
.login-heading { margin-bottom: 28px; }

.admin-shell { display: grid; min-height: 100vh; grid-template-columns: 252px minmax(0, 1fr); }
.sidebar { position: sticky; top: 0; display: flex; height: 100vh; padding: 28px 16px 20px; flex-direction: column; overflow: hidden; background: #191716; color: #f9f2ed; }
.sidebar::before { position: absolute; top: -100px; right: -115px; width: 250px; height: 250px; content: ""; border: 1px solid rgba(241, 89, 44, .45); border-radius: 50%; }
.sidebar::after { position: absolute; top: 0; right: 0; bottom: 0; width: 4px; content: ""; background: var(--brand); }
.brand { position: relative; z-index: 1; display: grid; gap: 10px; padding: 0 11px 34px; color: white; font: 800 10px/1.35 Inter, sans-serif; letter-spacing: .14em; }
.brand img { display: block; width: 159px; height: auto; }
.brand span { color: #c9c2bd; }
.brand em { color: var(--brand); font-style: normal; }
.sidebar nav { position: relative; z-index: 1; display: grid; gap: 5px; }
.nav-link { padding: 11px 12px; border-radius: 10px; color: #c9c2bd; font-weight: 650; transition: color .15s, background .15s; }
.nav-link:hover, .nav-link.active { background: rgba(241, 89, 44, .17); color: white; }
.nav-link.active { box-shadow: inset 3px 0 var(--brand); }
.sidebar-bottom { position: relative; z-index: 1; display: grid; gap: 5px; margin-top: auto; }
.logout { width: 100%; padding: 10px 12px; border: 0; border-radius: 10px; background: none; color: #c9c2bd; text-align: left; font-weight: 650; }
.logout:hover { background: rgba(255, 255, 255, .07); color: white; }
.admin-main { width: min(1450px, 100%); padding: 39px 44px 64px; margin: 0 auto; }
.admin-header { display: flex; align-items: center; justify-content: space-between; gap: 20px; margin-bottom: 30px; }
.admin-header h1 { margin: 0; font-size: 31px; }
.metric-grid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 14px; margin-bottom: 23px; }
.metric { position: relative; padding: 19px; overflow: hidden; border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); box-shadow: 0 5px 16px rgba(36, 23, 16, .025); }
.metric::after { position: absolute; right: -21px; bottom: -31px; width: 72px; height: 72px; content: ""; border-radius: 50%; background: var(--brand-soft); }
.metric span, .metric small { display: block; color: var(--muted); font-size: 12px; }
.metric strong { position: relative; z-index: 1; display: block; margin: 9px 0; font-family: Poppins, sans-serif; font-size: 30px; letter-spacing: -.06em; }
.panel { margin-bottom: 21px; padding: 23px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); box-shadow: 0 5px 16px rgba(36, 23, 16, .025); }
.section-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 15px; margin-bottom: 18px; }
.section-header p { margin: 2px 0 0; color: var(--muted); }
.text-link, .table-action { color: var(--brand); font-weight: 750; }
.table-wrap { overflow: auto; }
table { width: 100%; border-collapse: collapse; white-space: nowrap; }
th { padding: 0 10px 10px; color: #938c87; text-align: left; font-size: 10px; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; }
td { padding: 14px 10px; border-top: 1px solid #f0edeb; color: #47413e; vertical-align: middle; }
td strong, td small { display: block; }
td small { margin-top: 2px; color: var(--muted); }
.badge { display: inline-flex; align-items: center; gap: 5px; padding: 4px 8px; border-radius: 20px; font-size: 11px; font-weight: 750; }
.badge.success { background: var(--mint); color: #236449; }
.badge.warning { background: var(--amber-bg); color: var(--amber); }
.badge.danger { background: var(--danger-bg); color: var(--danger); }
.source { padding: 3px 7px; border-radius: 5px; background: #f2eeeb; color: #675f5a; font-size: 11px; }
.count { color: var(--muted); font-weight: 500; }
.filter-grid, .form-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.filter-actions, .form-actions, .button-row { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 17px; }
.pagination { display: flex; align-items: center; justify-content: space-between; margin-top: 16px; color: var(--muted); font-size: 12px; }
.pagination a { color: var(--brand); font-weight: 750; }
.form-panel { max-width: 850px; }
.detail-grid { display: grid; grid-template-columns: minmax(0, 1.7fr) minmax(280px, .8fr); gap: 20px; }
.detail-list { display: grid; grid-template-columns: 145px 1fr; gap: 10px 18px; margin: 0; }
.detail-list dt { color: var(--muted); }
.detail-list dd { margin: 0; font-weight: 650; }
.status-form { display: flex; align-items: end; gap: 10px; padding-top: 18px; margin-top: 25px; border-top: 1px solid var(--line); }
.status-form label { flex: 1; }
.metadata-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.metadata-grid span { display: grid; gap: 3px; color: var(--muted); font-size: 12px; }
.metadata-grid b { overflow-wrap: anywhere; color: var(--ink); font-size: 13px; font-weight: 650; }
.answers { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 13px 25px; margin: 0; }
.answers dt { color: var(--muted); font-size: 12px; }
.answers dd { margin: 3px 0 0; overflow-wrap: anywhere; font-weight: 650; }
.notes { display: grid; gap: 10px; margin-top: 20px; }
.notes article { padding: 14px; border-radius: 10px; background: #faf7f5; }
.notes article p { margin-bottom: 5px; }
.notes small { color: var(--muted); }
.integration-card { display: flex; align-items: flex-start; gap: 14px; padding: 24px; margin-bottom: 21px; border-radius: var(--radius); background: #201a17; color: white; }
.integration-card .eyebrow { color: #ff9d7d; }
.integration-card h2 { color: white; }
.integration-card p:last-child { margin-bottom: 0; color: #dacfc9; }
.status-dot { display: block; width: 12px; height: 12px; margin-top: 5px; flex: 0 0 auto; border-radius: 50%; }
.status-dot.online { background: #79d39d; box-shadow: 0 0 0 5px rgba(121, 211, 157, .15); }
.status-dot.offline { background: var(--sun); box-shadow: 0 0 0 5px rgba(255, 201, 78, .15); }
.subtle { background: #fffaf7; }
.subtle code { display: block; width: max-content; max-width: 100%; padding: 8px 10px; overflow: auto; border-radius: 7px; background: var(--brand-soft); }
.subtle p { margin: 13px 0 0; color: var(--muted); }
.review-card { display: flex; align-items: center; justify-content: space-between; gap: 25px; padding: 16px 0; border-top: 1px solid var(--line); }
.review-card:first-of-type { border-top: 0; }
.review-card p { margin: 0; }
.review-card form { display: flex; min-width: min(100%, 430px); gap: 8px; }
.empty { padding: 28px 0; color: var(--muted); text-align: center; }
.primary-button[disabled] { cursor: not-allowed; opacity: .45; }

@media (max-width: 1050px) { .metric-grid { grid-template-columns: repeat(3, 1fr); } .filter-grid, .form-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 760px) {
  .public-shell { display: block; padding: 98px 20px 26px; }
  .public-brand { top: 28px; left: 22px; }
  .public-brand img { width: 151px; }
  .public-brand span { font-size: 10px; }
  .upload-card { padding: 36px 23px; }
  .upload-card::before { right: 23px; left: 23px; }
  .admin-shell { display: block; }
  .sidebar { position: static; display: block; height: auto; padding: 20px 16px 16px; }
  .sidebar::after { top: auto; width: 100%; height: 4px; }
  .brand { padding: 0 7px 17px; }
  .brand img { width: 140px; }
  .sidebar nav { display: flex; overflow: auto; }
  .nav-link { white-space: nowrap; }
  .nav-link.active { box-shadow: inset 0 -3px var(--brand); }
  .sidebar-bottom { display: flex; align-items: center; margin: 13px 0 0; }
  .logout { width: auto; }
  .admin-main { padding: 27px 16px 45px; }
  .admin-header { align-items: flex-start; }
  .admin-header .outline-button { display: none; }
  .metric-grid { grid-template-columns: repeat(2, 1fr); }
  .metric:last-child { grid-column: span 2; }
  .filter-grid, .form-grid, .metadata-grid, .answers { grid-template-columns: 1fr; }
  .detail-grid { grid-template-columns: 1fr; }
  .status-form, .review-card, .review-card form { display: grid; min-width: 0; }
  .detail-list { grid-template-columns: 120px 1fr; }
  h1 { font-size: 28px; }
}
