:root {
  --teal: #00ac99;
  --teal-dark: #00897a;
  --teal-soft: #e7f7f4;
  --ink: #1d2423;
  --muted: #5c6b68;
  --line: #e4ecea;
  --bg: #f3f6f5;
  --surface: #ffffff;
  --danger: #b42318;
  --warn: #8a5a00;
  --warn-bg: #fff6e5;
  --ok: #067647;
  --shadow: 0 1px 2px rgba(16, 24, 22, 0.06), 0 8px 24px rgba(16, 24, 22, 0.04);
  --side: 268px;
  --bar: 64px;
  font-family: "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color: var(--ink);
  background: var(--bg);
}

* { box-sizing: border-box; }
body { margin: 0; }
button, input, select { font: inherit; color: inherit; }
a { color: var(--teal-dark); }
h1, h2, h3, p { margin: 0; }
img { max-width: 100%; }

.icon {
  width: 20px;
  height: 20px;
  flex: 0 0 auto;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.75;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.login-screen {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(280px, 440px) 1fr;
}
.login-aside {
  background: var(--teal);
  color: #fff;
  padding: 48px 40px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 32px;
}
.login-aside img { width: 210px; height: auto; }
.login-aside h2 { font-size: 28px; font-weight: 650; letter-spacing: -0.03em; line-height: 1.2; }
.login-aside p { color: rgba(255, 255, 255, 0.88); line-height: 1.5; max-width: 28ch; }
.login-panel {
  display: grid;
  place-items: center;
  padding: 32px 20px;
  background: var(--bg);
}
.login-card {
  width: min(420px, 100%);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: var(--shadow);
  padding: 32px;
  display: grid;
  gap: 16px;
}
.login-card h1 { font-size: 24px; letter-spacing: -0.02em; }
.lead { color: var(--muted); line-height: 1.5; }

.app { min-height: 100vh; }
.topbar {
  height: var(--bar);
  background: var(--teal);
  color: #fff;
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 0 20px;
  position: sticky;
  top: 0;
  z-index: 40;
}
.brand-logo { height: 28px; width: auto; display: block; }
.top-title { font-weight: 650; letter-spacing: -0.01em; }
.top-spacer { flex: 1; }
.top-user { display: grid; justify-items: end; line-height: 1.2; }
.top-user span { font-size: 12px; color: rgba(255, 255, 255, 0.82); }
.top-logout {
  background: transparent;
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.45);
  border-radius: 8px;
  padding: 8px 12px;
  cursor: pointer;
}
.top-logout:hover { background: rgba(255, 255, 255, 0.12); }
.menu-btn {
  display: none;
  width: 40px;
  height: 40px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: #fff;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}
.menu-btn:hover { background: rgba(255, 255, 255, 0.12); }

.frame { display: grid; grid-template-columns: var(--side) 1fr; min-height: calc(100vh - var(--bar)); }
.side {
  background: var(--surface);
  border-right: 1px solid var(--line);
  padding: 16px 12px 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.side-context {
  padding: 8px 12px 4px;
}
.side-context p { font-weight: 650; }
.side-context small { color: var(--muted); }
.side-nav { display: grid; gap: 4px; }
.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 42px;
  padding: 8px 12px;
  border-radius: 10px;
  color: var(--ink);
  text-decoration: none;
  font-weight: 550;
}
.nav-item:hover { background: #f3f7f6; }
.nav-item.active { background: var(--teal-soft); color: var(--teal-dark); }
.nav-label { margin: 18px 12px 6px; font-size: 11px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); font-weight: 700; }
.scrim { display: none; }

.content { padding: 28px 32px 48px; }
.page { display: grid; gap: 18px; align-content: start; }
.page-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  flex-wrap: wrap;
}
.eyebrow { color: var(--muted); font-size: 13px; font-weight: 650; letter-spacing: 0.02em; }
.page-head h1, .login-card h1 { font-weight: 680; }
.page-head h1 { font-size: 28px; letter-spacing: -0.03em; }
.page-head p, .muted { color: var(--muted); line-height: 1.45; }

.grid { display: grid; gap: 16px; }
.cards { grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: var(--shadow);
  padding: 18px;
  display: grid;
  gap: 12px;
  align-content: start;
}
.row, .actions { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.row { justify-content: space-between; }
.actions { justify-content: flex-end; }
form.row, .inline { justify-content: flex-start; align-items: flex-end; }
.inline { display: flex; gap: 8px; align-items: center; }
.inline input { width: 76px; }
form.row .field { flex: 0 1 260px; min-width: 180px; }
.split { display: grid; grid-template-columns: minmax(240px, 320px) 1fr; gap: 16px; align-items: start; }
.stats { grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); }
.stat strong { display: block; font-size: 32px; letter-spacing: -0.04em; color: var(--teal-dark); }
.stat span { color: var(--muted); font-size: 13px; }

.tag {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 4px 10px;
  background: var(--teal-soft);
  color: var(--teal-dark);
  font-size: 12px;
  font-weight: 700;
}
.tag.off { background: #f3f4f4; color: var(--muted); }
.tag.warn { background: var(--warn-bg); color: var(--warn); }

.field { display: grid; gap: 6px; font-size: 13px; font-weight: 650; color: var(--muted); }
input, select {
  width: 100%;
  border: 1px solid #d5dfdc;
  background: #fff;
  border-radius: 8px;
  padding: 10px 12px;
  color: var(--ink);
  font-weight: 450;
}
input:focus, select:focus { outline: 2px solid rgba(0, 172, 153, 0.35); border-color: var(--teal); }
.check { display: flex; gap: 8px; align-items: center; font-weight: 550; color: var(--ink); }
.check input { width: auto; }

.primary, .ghost, .danger, .link-btn {
  border: 0;
  border-radius: 8px;
  padding: 10px 14px;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 650;
}
.primary, .link-btn { background: var(--teal); color: #fff; }
.primary:hover, .link-btn:hover { background: var(--teal-dark); }
.ghost { background: #fff; color: var(--ink); border: 1px solid var(--line); }
.ghost:hover { background: #f7faf9; }
.danger { background: #fff; color: var(--danger); border: 1px solid #f3c7c3; }
.switch { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.switch button[aria-pressed="true"] { background: var(--teal); color: #fff; border-color: var(--teal); }

.modal-scrim {
  position: fixed;
  inset: 0;
  z-index: 60;
  background: rgba(16, 24, 22, 0.48);
  display: grid;
  place-items: center;
  padding: 24px;
}
.modal {
  width: min(920px, 100%);
  height: min(860px, calc(100vh - 48px));
  background: #fff;
  border-radius: 16px;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.modal-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
}
.pdf-pages {
  flex: 1;
  overflow: auto;
  background: #3d4442;
  padding: 16px;
  display: grid;
  justify-items: center;
  align-content: start;
  gap: 12px;
}
.pdf-pages canvas { width: min(100%, 680px); height: auto; background: #fff; }
.pdf-pages .muted, .pdf-pages .banner { justify-self: stretch; }
.review-table { min-width: 860px; }
.review-table input { width: 128px; }
.row-error { background: #fdeceb; }
.error-text { color: var(--danger); font-size: 12px; margin: 6px 0 0; }
.file-btn {
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 10px 14px;
  background: #fff;
  cursor: pointer;
}
.side-nav a { display: block; padding: 10px 12px; border-radius: 10px; color: inherit; text-decoration: none; }
.side-nav a.active { background: #e7f7f4; color: var(--teal); font-weight: 700; }
.banner { border-radius: 10px; padding: 12px 14px; }
.banner.error { background: #fdeceb; color: var(--danger); }
.banner.notice { background: #e8f7f1; color: var(--ok); }
.banner.warn { background: var(--warn-bg); color: var(--warn); }

table { width: 100%; border-collapse: collapse; background: #fff; }
th, td { text-align: left; padding: 12px 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { font-size: 12px; letter-spacing: 0.04em; text-transform: uppercase; color: var(--muted); background: #f7faf9; }
.table-wrap { overflow: auto; border: 1px solid var(--line); border-radius: 14px; background: #fff; }

.qr-panel { display: grid; justify-items: start; gap: 10px; }
.qr-panel img { width: 220px; height: 220px; background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 8px; }

.manual { max-width: 760px; display: grid; gap: 18px; }
.manual section { display: grid; gap: 8px; }
.manual h2 { font-size: 18px; }
.manual p, .manual li { line-height: 1.55; }
.manual ol, .manual ul { margin: 0; padding-left: 20px; display: grid; gap: 6px; }

@media (max-width: 960px) {
  .menu-btn { display: inline-flex; }
  .top-user { display: none; }
  .frame { grid-template-columns: 1fr; }
  .side {
    position: fixed;
    top: var(--bar);
    bottom: 0;
    left: 0;
    width: min(var(--side), 86vw);
    z-index: 30;
    transform: translateX(-105%);
    transition: transform 0.18s ease;
    box-shadow: var(--shadow);
  }
  .nav-open .side { transform: none; }
  .nav-open .scrim { display: block; position: fixed; inset: var(--bar) 0 0 0; background: rgba(16, 24, 22, 0.35); z-index: 20; }
  .split, .login-screen { grid-template-columns: 1fr; }
  .login-aside { min-height: 220px; }
  .content { padding: 20px 16px 40px; }
}

@media print {
  .topbar, .side, .scrim, .menu-btn, .no-print { display: none !important; }
  .frame { display: block; }
  .content { padding: 0; }
  body { background: #fff; }
}
