:root {
  --bg: #f5f7fb;
  --panel: #ffffff;
  --ink: #172033;
  --muted: #667085;
  --line: #d9e0ea;
  --brand: #0f766e;
  --brand-2: #2563eb;
  --danger: #b42318;
  --warn: #b54708;
}

@font-face {
  font-family: 'Montserrat';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('/fonts/montserrat/montserrat-latin-400-normal.woff2') format('woff2');
}

@font-face {
  font-family: 'Montserrat';
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url('/fonts/montserrat/montserrat-latin-600-normal.woff2') format('woff2');
}

@font-face {
  font-family: 'Montserrat';
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url('/fonts/montserrat/montserrat-latin-700-normal.woff2') format('woff2');
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: 'Montserrat', Arial, Helvetica, sans-serif;
  color: var(--ink);
  background: var(--bg);
}

.shell { display: grid; grid-template-columns: 260px 1fr; min-height: 100vh; }
.sidebar { background: #111827; color: #fff; padding: 22px 18px; }
.brand { font-size: 18px; font-weight: 700; line-height: 1.25; margin-bottom: 24px; }
.nav { display: grid; gap: 6px; }
.nav a { color: #d1d5db; text-decoration: none; padding: 10px 12px; border-radius: 6px; }
.nav a:hover { background: #1f2937; color: #fff; }
.content { padding: 24px; overflow-x: auto; }
.top { display: flex; align-items: center; justify-content: space-between; gap: 18px; margin-bottom: 20px; }
h1 { font-size: 26px; margin: 0; }
h2 { font-size: 18px; margin: 0 0 12px; }
.grid { display: grid; gap: 16px; }
.cards { grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); margin-bottom: 18px; }
.card, .panel { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 16px; }
.metric { font-size: 26px; font-weight: 700; margin-top: 8px; }
.muted { color: var(--muted); font-size: 13px; }
.split { display: grid; grid-template-columns: 360px 1fr; gap: 16px; align-items: start; }
.split > .panel { min-width: 0; }
.documents-split { grid-template-columns: minmax(420px, 0.95fr) minmax(560px, 2fr); }
.documents-split > .panel { overflow-x: auto; }
.documents-split table { min-width: 0; table-layout: fixed; }
.documents-split th,
.documents-split td { overflow-wrap: anywhere; word-break: normal; }
form.stack { display: grid; gap: 10px; }
label { display: grid; gap: 5px; font-size: 13px; color: var(--muted); }
label:has(input[type="checkbox"]) {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--ink);
}
label:has(input[type="checkbox"]) > span {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  line-height: 1.35;
}
input, select, textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 9px 10px;
  font: inherit;
  color: var(--ink);
  background: #fff;
}
input[type="checkbox"] {
  width: 16px;
  height: 16px;
  margin: 0;
  padding: 0;
  flex: 0 0 auto;
}
textarea { min-height: 76px; resize: vertical; }
button, .button {
  border: 0;
  border-radius: 6px;
  padding: 9px 12px;
  background: var(--brand);
  color: #fff;
  cursor: pointer;
  text-decoration: none;
  font: inherit;
}
.button.secondary, button.secondary { background: var(--brand-2); }
button.danger { background: var(--danger); }
table { width: 100%; border-collapse: collapse; background: #fff; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
th, td { padding: 10px 12px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; font-size: 14px; }
th { color: var(--muted); font-weight: 700; background: #f8fafc; }
.row-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.badge { display: inline-block; padding: 4px 7px; border-radius: 999px; background: #e0f2fe; color: #075985; font-size: 12px; }
.badge.bad { background: #fee2e2; color: var(--danger); }
.badge.warn { background: #ffedd5; color: var(--warn); }
.section-heading { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 4px 0 10px; }
.section-heading h2 { margin: 0; }
.form-hint { margin: -4px 0 4px; }
.empty-state { display: grid; gap: 4px; padding: 14px; border: 1px dashed var(--line); border-radius: 8px; background: #f8fafc; color: var(--muted); font-size: 13px; }
.empty-state strong { color: var(--ink); font-size: 14px; }
.location-sync {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  background: #f8fafc;
}
.location-sync p { margin: 0; }
.tabs { display: grid; gap: 16px; }
.tab-list { display: flex; flex-wrap: wrap; gap: 6px; overflow-x: auto; border-bottom: 1px solid var(--line); }
.tab-button {
  background: transparent;
  color: var(--muted);
  border-radius: 6px 6px 0 0;
  padding: 10px 14px;
  border-bottom: 3px solid transparent;
  flex: 0 0 auto;
}
.tab-button:hover { background: #eef2f7; color: var(--ink); }
.tab-button.active,
.tab-button.is-active {
  color: var(--ink);
  background: #fff;
  border-bottom-color: var(--brand);
  font-weight: 700;
}
.tab-panel { display: none; }
.tab-panel.active,
.tab-panel.is-active { display: block; }
.tab-panel[hidden] { display: none; }
.settings-log-grid { gap: 16px; }
.field-label { display: inline-flex; align-items: center; gap: 6px; }
.info-popover { position: relative; display: inline-flex; align-items: center; }
.info-help {
  position: relative;
  display: inline-grid;
  place-items: center;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #e0f2fe;
  color: #075985;
  font-size: 12px;
  font-weight: 700;
  cursor: help;
}
.info-button {
  width: 18px;
  height: 18px;
  border-radius: 999px;
  padding: 0;
  display: inline-grid;
  place-items: center;
  background: #e0f2fe;
  color: #075985;
  font-size: 12px;
  font-weight: 700;
  line-height: 1;
}
.info-help .info-popover,
.info-bubble {
  position: absolute;
  z-index: 20;
  bottom: calc(100% + 8px);
  width: min(260px, calc(100vw - 48px));
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  box-shadow: 0 12px 30px rgba(15, 23, 42, 0.18);
  font-size: 12px;
  line-height: 1.4;
  opacity: 0;
  pointer-events: none;
  visibility: hidden;
}
.info-help .info-popover {
  left: 14px;
}
.info-bubble {
  left: 50%;
  transform: translateX(-50%);
}
.info-help:hover .info-popover,
.info-help:focus .info-popover,
.info-popover:hover .info-bubble,
.info-button:focus + .info-bubble {
  opacity: 1;
  visibility: visible;
}
.notice-list { display: grid; gap: 10px; }
.notice { border-left: 4px solid var(--warn); padding: 10px; background: #fff7ed; border-radius: 6px; }
pre { white-space: pre-wrap; margin: 0; font-family: Consolas, monospace; font-size: 12px; }
.login-page { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.login-panel { width: min(420px, 100%); background: #fff; border: 1px solid var(--line); border-radius: 8px; padding: 24px; }
.login-panel h1 { margin-bottom: 18px; }

@media (max-width: 900px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { position: static; }
  .nav { grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); }
  .split { grid-template-columns: 1fr; }
  .documents-split { grid-template-columns: 1fr; }
  .tab-list { padding-bottom: 1px; }
  .tab-button { padding: 9px 11px; }
}
