:root {
  --teal: #0d9488; --teal-dark: #0f766e; --teal-light: #ccfbf1;
  --blue: #0369a1; --blue-light: #e0f2fe;
  --slate: #0f172a; --muted: #64748b; --border: #e2e8f0;
  --bg: #f1f5f9; --white: #fff; --sidebar: #0f172a; --sidebar-hover: #1e293b;
  --warn: #b45309; --warn-bg: #fffbeb;
  --danger: #dc2626; --danger-bg: #fef2f2;
  --ok: #15803d; --ok-bg: #f0fdf4;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: Inter, system-ui, sans-serif; background: var(--bg); color: var(--slate); min-height: 100vh; }
a { color: var(--teal-dark); text-decoration: none; }
a:hover { text-decoration: underline; }
code { font-size: 12px; background: #f1f5f9; padding: 1px 5px; border-radius: 4px; }
.test-banner {
  background: #92400e; color: #fffbeb; text-align: center;
  font-size: 12px; font-weight: 600; letter-spacing: 0.02em;
  padding: 8px 16px; position: sticky; top: 0; z-index: 100;
}
.shell { display: flex; min-height: calc(100vh - 32px); }
.sidebar {
  width: 240px; flex-shrink: 0; background: var(--sidebar); color: #e2e8f0;
  display: flex; flex-direction: column; padding: 20px 0;
}
.brand {
  display: flex; align-items: center; gap: 10px;
  padding: 0 20px 20px; border-bottom: 1px solid #1e293b; margin-bottom: 12px;
}
.brand img { height: 40px; width: auto; background: #fff; border-radius: 8px; padding: 4px; object-fit: contain; }
.brand-text { line-height: 1.25; }
.brand-text strong { display: block; font-size: 14px; color: #fff; }
.brand-text span { font-size: 11px; color: #94a3b8; }
.nav a {
  display: flex; align-items: center; gap: 10px;
  padding: 11px 20px; color: #cbd5e1; font-size: 14px; font-weight: 500;
  text-decoration: none; border-left: 3px solid transparent;
}
.nav a:hover { background: var(--sidebar-hover); color: #fff; text-decoration: none; }
.nav a.active {
  background: rgba(13, 148, 136, 0.18); color: #5eead4; border-left-color: var(--teal);
}
.nav .ico { width: 18px; text-align: center; opacity: 0.85; font-size: 14px; }
.sidebar-foot {
  margin-top: auto; padding: 16px 20px; border-top: 1px solid #1e293b;
  font-size: 12px; color: #94a3b8; line-height: 1.6;
}
.sidebar-foot a { color: #5eead4; }
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  background: var(--white); border-bottom: 1px solid var(--border);
  padding: 14px 28px; display: flex; align-items: center; justify-content: space-between; gap: 16px;
}
.topbar h1 { font-size: 18px; font-weight: 700; }
.topbar .meta { font-size: 12px; color: var(--muted); }
.content { padding: 24px 28px 40px; max-width: 1280px; width: 100%; }

.page-title { font-size: 22px; font-weight: 700; margin-bottom: 6px; }
.page-sub { font-size: 13px; color: var(--muted); margin-bottom: 24px; }
.muted { color: var(--muted); font-size: 12px; }
.pad { padding: 18px; }

.kpi-grid, .kpis {
  display: grid; grid-template-columns: repeat(5, 1fr); gap: 14px; margin-bottom: 24px;
}
@media (max-width: 1100px) { .kpi-grid, .kpis { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 700px) {
  .kpi-grid, .kpis { grid-template-columns: repeat(2, 1fr); }
  .sidebar { display: none; }
}
.kpi {
  background: var(--white); border: 1px solid var(--border); border-radius: 12px;
  padding: 16px 18px; box-shadow: 0 1px 2px rgba(15,23,42,0.04);
}
.kpi .label { font-size: 12px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: 0.04em; }
.kpi .value { font-size: 28px; font-weight: 700; margin-top: 6px; color: var(--slate); }
.kpi .sub { font-size: 12px; color: var(--muted); margin-top: 4px; }
.kpi.teal .value { color: var(--teal-dark); }
.kpi.blue .value { color: var(--blue); }
.kpi.warn .value { color: var(--warn); }
.kpi.danger .value { color: var(--danger); }

.panel, .card {
  background: var(--white); border: 1px solid var(--border); border-radius: 12px;
  box-shadow: 0 1px 2px rgba(15,23,42,0.04); margin-bottom: 20px; overflow: hidden;
}
.card { padding: 18px; }
.panel-head {
  padding: 14px 18px; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
}
.panel-head h2, .section-title { font-size: 15px; font-weight: 700; }
.section-sub { font-size: 12px; color: var(--muted); margin-bottom: 14px; margin-top: 4px; }
.panel-body { padding: 0; }
.panel-body.pad, .panel-body .pad { padding: 18px; }
.panel-head-inline { display: flex; justify-content: flex-end; margin-bottom: 12px; }

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
@media (max-width: 900px) { .grid-2 { grid-template-columns: 1fr; } }

table { width: 100%; border-collapse: collapse; font-size: 13px; }
th {
  text-align: left; padding: 10px 14px; font-size: 11px; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted);
  background: #f8fafc; border-bottom: 1px solid var(--border);
}
td { padding: 12px 14px; border-bottom: 1px solid var(--border); vertical-align: middle; }
tr:last-child td { border-bottom: none; }
tr:hover td { background: #f8fafc; }
.table-wrap { overflow-x: auto; }

.badge {
  display: inline-block; font-size: 11px; font-weight: 600;
  padding: 3px 8px; border-radius: 999px;
}
.badge-ok { background: var(--ok-bg); color: var(--ok); }
.badge-warn { background: var(--warn-bg); color: var(--warn); }
.badge-danger { background: var(--danger-bg); color: var(--danger); }
.badge-teal { background: var(--teal-light); color: var(--teal-dark); }
.badge-blue { background: var(--blue-light); color: var(--blue); }
.badge-slate { background: #f1f5f9; color: #475569; }

.btn {
  display: inline-block; padding: 8px 14px; border-radius: 8px; font-size: 13px; font-weight: 600;
  border: 1px solid var(--border); background: var(--white); color: var(--slate);
  cursor: pointer; text-decoration: none; font-family: inherit;
}
.btn:hover { background: #f8fafc; text-decoration: none; }
.btn-primary { background: var(--teal); color: #fff !important; border-color: var(--teal); }
.btn-primary:hover { background: var(--teal-dark); color: #fff !important; }
.btn-sm { padding: 5px 10px; font-size: 12px; }
.btn-block { display: block; width: 100%; text-align: center; }

.filters { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.filters input, .filters select, select {
  padding: 8px 12px; border: 1px solid var(--border); border-radius: 8px;
  font-size: 13px; font-family: inherit; background: var(--white);
}

.alert {
  padding: 12px 14px; border-radius: 10px; font-size: 13px; line-height: 1.5;
  margin-bottom: 18px; border: 1px solid;
}
.alert-warn { background: var(--warn-bg); border-color: #fcd34d; color: #92400e; }
.alert-info { background: #eff6ff; border-color: #bfdbfe; color: #1e40af; }
.alert-danger, .err { background: var(--danger-bg); border: 1px solid #fecaca; color: var(--danger); border-radius: 10px; padding: 12px 14px; font-size: 13px; margin-bottom: 14px; }
.alert-ok, .ok { background: var(--ok-bg); border: 1px solid #86efac; color: var(--ok); border-radius: 10px; padding: 12px 14px; font-size: 13px; line-height: 1.5; margin-bottom: 14px; }
.note { margin-top: 16px; padding: 11px 12px; background: var(--warn-bg); border: 1px solid #fcd34d; border-radius: 8px; font-size: 12px; color: var(--warn); line-height: 1.5; }

.info-list { list-style: none; }
.info-list li {
  display: flex; justify-content: space-between; gap: 12px;
  padding: 10px 0; border-bottom: 1px solid var(--border); font-size: 13px;
}
.info-list li:last-child { border-bottom: none; }
.info-list .k { color: var(--muted); font-weight: 500; }
.info-list .v { font-weight: 600; text-align: right; }

.stat-mini { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.stat-mini .box {
  background: #f8fafc; border: 1px solid var(--border); border-radius: 10px;
  padding: 12px; text-align: center;
}
.stat-mini .n { font-size: 22px; font-weight: 700; color: var(--teal-dark); }
.stat-mini .l { font-size: 11px; color: var(--muted); margin-top: 4px; }

.crumbs { font-size: 13px; color: var(--muted); margin-bottom: 4px; }
.crumbs a { font-weight: 600; }

.office-pick { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.office-chip {
  display: inline-block; padding: 7px 12px; border-radius: 999px; border: 1px solid var(--border);
  background: #fff; font-size: 13px; font-weight: 600; color: #334155; text-decoration: none;
}
.office-chip:hover { border-color: var(--teal); color: var(--teal-dark); text-decoration: none; }
.office-chip.active { background: var(--teal); border-color: var(--teal); color: #fff; }
.person-row td .who { font-weight: 600; }
.person-row td .role { font-size: 12px; color: var(--muted); }
.muted-note { font-size: 12px; color: var(--muted); margin-top: 8px; }
.step { display: flex; gap: 10px; align-items: flex-start; font-size: 13px; color: #334155; margin: 8px 0; line-height: 1.45; }
.step-num {
  width: 22px; height: 22px; border-radius: 999px; background: var(--teal-light); color: var(--teal-dark);
  font-size: 12px; font-weight: 700; display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0;
}

label { display: block; font-size: 13px; font-weight: 600; color: #334155; margin-bottom: 6px; }
input[type=text], input[type=email], input[type=password], input[type=search], textarea {
  width: 100%; padding: 11px 14px; border: 1px solid var(--border); border-radius: 8px;
  font-size: 14px; font-family: inherit; margin-bottom: 16px;
}
input:focus, textarea:focus, select:focus {
  outline: none; border-color: var(--teal); box-shadow: 0 0 0 3px rgba(13,148,136,.15);
}
.field-validation-error, .validation-summary-errors { color: var(--danger); font-size: 13px; margin-bottom: 10px; }
.required { color: var(--danger); }
.opt { font-weight: 400; color: var(--muted); }
.form-section { padding: 20px 24px; border-bottom: 1px solid var(--border); }
.form-section h2 { font-size: 15px; font-weight: 700; margin-bottom: 4px; }
.hint-left { font-size: 12px; color: var(--muted); margin-bottom: 14px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }
.form-grid .field.full { grid-column: 1 / -1; }
.form-actions {
  padding: 16px 24px; display: flex; gap: 10px; justify-content: flex-end; flex-wrap: wrap;
}
@media (max-width: 800px) {
  .shell { flex-direction: column; }
  .sidebar { width: 100%; display: flex; }
  .form-grid { grid-template-columns: 1fr; }
  .grid-2 { grid-template-columns: 1fr; }
}

/* Auth */
.auth-body { background: linear-gradient(145deg, #0f766e 0%, #0369a1 55%, #0f172a 100%); }
.auth-wrap { min-height: calc(100vh - 32px); display: flex; align-items: center; justify-content: center; padding: 32px 16px; }
.auth-card {
  width: 100%; max-width: 440px; background: #fff; border-radius: 16px;
  box-shadow: 0 25px 50px -12px rgba(15,23,42,.45); overflow: hidden;
}
.auth-head {
  padding: 28px 32px 20px; text-align: center; border-bottom: 1px solid var(--border);
  background: linear-gradient(180deg, #f0fdfa 0%, #fff 100%);
}
.auth-head img { height: 72px; width: auto; margin-bottom: 12px; }
.auth-head h1 { font-size: 20px; font-weight: 700; }
.auth-head p { margin-top: 6px; font-size: 13px; color: var(--muted); }
.auth-head .badge {
  display: inline-block; margin-top: 10px; font-size: 11px; font-weight: 600;
  color: var(--teal-dark); background: var(--teal-light); padding: 4px 10px; border-radius: 999px;
}
.auth-body-inner { padding: 28px 32px 32px; }
.hint { margin-top: 16px; font-size: 12px; color: var(--muted); text-align: center; line-height: 1.5; }
.auth-link { display: block; margin-top: 12px; font-size: 12px; color: var(--teal-dark); text-align: center; font-weight: 600; }

/* Errors — mockup-aligned table, thumbs, expand popover */
.error-table { table-layout: fixed; }
.error-table th:nth-child(1), .error-table td:nth-child(1) { width: 142px; }
.error-table th:nth-child(2), .error-table td:nth-child(2) { width: 154px; }
.error-table th:nth-child(4), .error-table td:nth-child(4) { width: 118px; }
.error-table th:nth-child(5), .error-table td:nth-child(5) { width: 118px; }
.error-table td { vertical-align: top; }
.error-table .message { line-height: 1.45; }
.error-table .message .badge { margin-top: 6px; }
.error-table .time { font-weight: 600; white-space: nowrap; }
.error-table .time span { display: block; color: var(--muted); font-size: 12px; font-weight: 400; margin-top: 3px; }
.shot-thumb-link { display: inline-block; text-decoration: none; }
.shot-thumb-link:hover { text-decoration: none; }
.shot-thumb {
  display: block; width: 84px; height: 54px; object-fit: cover; border-radius: 7px;
  border: 1px solid #cbd5e1; box-shadow: 0 1px 2px rgba(15,23,42,.08);
}
.no-shot { color: var(--muted); font-size: 12px; white-space: nowrap; }
.detail { font-size: 12px; position: relative; }
.detail summary {
  cursor: pointer; color: var(--teal-dark); font-weight: 600;
  list-style-position: inside;
}
.detail summary:hover { color: var(--teal); }
.detail-note {
  position: absolute; right: 0; top: 22px; width: 300px; z-index: 5;
  padding: 9px 10px; border: 1px solid var(--border); border-radius: 7px;
  background: #fff; color: #475569; line-height: 1.5;
  box-shadow: 0 8px 18px rgba(15,23,42,.12);
}
.detail-note strong { color: #334155; }
.detail-stack { margin-top: 8px; }
.detail-stack pre {
  margin: 4px 0 0; padding: 8px; background: #f8fafc; border: 1px solid var(--border);
  border-radius: 6px; font-size: 11px; white-space: pre-wrap; word-break: break-word;
  max-height: 140px; overflow: auto; color: #334155;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}
.filter-note { font-size: 12px; color: var(--muted); margin-top: 4px; }
.error-count { color: var(--muted); font-size: 12px; font-weight: 500; }
.panel-head .meta { font-size: 12px; color: var(--muted); font-weight: 600; }
.panel.table-panel { overflow: visible; }
@media (max-width: 900px) {
  .error-table { min-width: 920px; }
  .panel.table-panel { overflow-x: auto; }
}
