:root {
  --bg: #f5f7f8;
  --panel: #ffffff;
  --text: #172021;
  --muted: #667477;
  --line: #dfe6e8;
  --accent: #0f766e;
  --accent-dark: #0b5f59;
  --gold: #c88719;
  --danger: #b42318;
  --ok: #16803f;
  --warn: #b76e00;
  --ink-soft: #eef4f3;
  --shadow: 0 10px 28px rgba(17, 32, 34, 0.08);
}

* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: Arial, Helvetica, sans-serif;
  line-height: 1.45;
}
button, input, select { font: inherit; }
button { cursor: pointer; }
.app-shell { display: flex; min-height: 100vh; }
.sidebar {
  width: 260px;
  background: #0e2426;
  color: #fff;
  padding: 20px;
  position: sticky;
  top: 0;
  height: 100vh;
}
.brand { display: flex; align-items: center; gap: 12px; margin-bottom: 28px; }
.brand-mark {
  width: 42px; height: 42px; display: grid; place-items: center;
  background: var(--accent); border-radius: 8px; font-weight: 800;
}
.brand strong, .brand span { display: block; }
.brand span { color: #abc1c4; font-size: 13px; }
nav { display: grid; gap: 6px; }
.nav-item {
  border: 0; background: transparent; color: #dce8e9; text-align: left;
  padding: 11px 12px; border-radius: 6px;
}
.nav-item:hover, .nav-item.active { background: rgba(255,255,255,0.11); color: #fff; }
.role-panel {
  margin-top: 26px;
  padding-top: 20px;
  border-top: 1px solid rgba(255,255,255,0.16);
}
.role-panel label { color: #abc1c4; font-size: 13px; display: block; margin-bottom: 8px; }
.role-panel select { width: 100%; }
.main { flex: 1; padding: 24px; min-width: 0; }
.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  margin-bottom: 24px;
}
.eyebrow { margin: 0 0 4px; color: var(--accent-dark); font-size: 13px; font-weight: 700; text-transform: uppercase; letter-spacing: 0; }
h1, h2, h3, p { margin-top: 0; }
h1 { margin-bottom: 0; font-size: 30px; }
h2 { margin-bottom: 0; font-size: 18px; }
.top-actions, .report-actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.view { display: none; }
.view.active { display: block; }
.metrics-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(160px, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}
.metric, .panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}
.metric { padding: 16px; }
.metric span { color: var(--muted); font-size: 13px; }
.metric strong { display: block; margin-top: 8px; font-size: 28px; }
.dashboard-grid, .split-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(320px, 1fr);
  gap: 18px;
}
.split-layout { align-items: start; }
.panel { padding: 18px; overflow: hidden; }
.panel-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; margin-bottom: 14px;
}
.panel-head span { color: var(--muted); font-size: 13px; }
.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}
.form-grid label { color: var(--muted); font-size: 13px; display: grid; gap: 6px; }
.form-grid button { grid-column: 1 / -1; }
input, select {
  border: 1px solid #cfdadd;
  border-radius: 6px;
  min-height: 40px;
  padding: 8px 10px;
  background: #fff;
  color: var(--text);
  min-width: 0;
}
.search { max-width: 260px; width: 100%; }
.upload-box {
  border: 1px dashed #9fb2b5;
  background: var(--ink-soft);
  border-radius: 8px;
  min-height: 100px;
  display: grid;
  place-items: center;
  text-align: center;
  padding: 16px;
  margin-bottom: 14px;
}
.upload-box input { display: none; }
.upload-box span { font-weight: 700; color: var(--accent-dark); }
.upload-box small { color: var(--muted); max-width: 380px; }
.primary, .secondary, .danger {
  border: 0;
  min-height: 40px;
  border-radius: 6px;
  padding: 9px 13px;
  font-weight: 700;
}
.primary { background: var(--accent); color: #fff; }
.primary:hover { background: var(--accent-dark); }
.secondary { background: #e7eeee; color: #173436; }
.danger { background: #fee4e2; color: var(--danger); }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; min-width: 720px; }
th, td { padding: 11px 10px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
th { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: 0; background: #f7fafb; }
td { font-size: 14px; }
.badge {
  display: inline-flex; align-items: center; min-height: 24px;
  border-radius: 999px; padding: 3px 9px; font-size: 12px; font-weight: 700;
  background: #eef2f3; color: #344548;
}
.badge.ok { background: #dcf7e6; color: var(--ok); }
.badge.warn { background: #fff3d7; color: var(--warn); }
.badge.bad { background: #fee4e2; color: var(--danger); }
.queue { display: grid; gap: 10px; }
.queue-item {
  border: 1px solid var(--line); border-radius: 8px; padding: 12px;
  display: grid; gap: 4px;
}
.queue-item strong { display: flex; justify-content: space-between; gap: 10px; }
.queue-item span, .queue-item small { color: var(--muted); }
.compliance-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(260px, 1fr));
  gap: 14px;
}
.check-card { border: 1px solid var(--line); border-radius: 8px; padding: 14px; background: #fff; }
.check-card h3 { margin-bottom: 8px; font-size: 16px; }
.check-card p { margin-bottom: 0; color: var(--muted); }
.report-preview {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 18px;
  background: #fbfdfd;
}
.report-preview h3 { margin-bottom: 4px; }
.report-section { margin-top: 18px; }
.restricted.locked {
  opacity: 0.58;
  pointer-events: none;
}
.toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  background: #102629;
  color: #fff;
  border-radius: 8px;
  padding: 12px 14px;
  box-shadow: var(--shadow);
  opacity: 0;
  transform: translateY(8px);
  transition: 180ms ease;
  max-width: min(420px, calc(100vw - 36px));
}
.toast.show { opacity: 1; transform: translateY(0); }
.actions { display: flex; gap: 8px; flex-wrap: wrap; }
.actions button { min-height: 32px; padding: 5px 9px; }

@media (max-width: 980px) {
  .app-shell { display: block; }
  .sidebar { position: static; width: 100%; height: auto; }
  nav { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .metrics-grid, .dashboard-grid, .split-layout, .compliance-grid { grid-template-columns: 1fr; }
}
@media (max-width: 620px) {
  .main { padding: 16px; }
  .topbar, .panel-head { align-items: stretch; flex-direction: column; }
  .form-grid { grid-template-columns: 1fr; }
  nav { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  h1 { font-size: 24px; }
  .metrics-grid { gap: 10px; }
  .metric strong { font-size: 24px; }
}

@media print {
  .sidebar, .topbar, .report-actions, .toast { display: none !important; }
  .main { padding: 0; }
  .panel { border: 0; box-shadow: none; }
  body { background: #fff; }
}
