:root {
  color-scheme: light;
  --ink: #18212f;
  --muted: #687586;
  --line: #dce3ea;
  --panel: #ffffff;
  --soft: #f4f7f9;
  --brand: #0f766e;
  --brand-2: #2563eb;
  --warn: #b45309;
  --danger: #b42318;
  --ok: #087443;
  --shadow: 0 18px 45px rgba(24, 33, 47, .12);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background:
    linear-gradient(140deg, rgba(15, 118, 110, .12), transparent 34%),
    linear-gradient(45deg, rgba(37, 99, 235, .10), transparent 32%),
    #eef3f6;
}

button, input, textarea, select {
  font: inherit;
}

button {
  border: 0;
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
  opacity: .55;
}

.shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 288px 1fr;
}

.sidebar {
  background: #111827;
  color: #f8fafc;
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.brand {
  display: grid;
  gap: 8px;
  padding-bottom: 18px;
  border-bottom: 1px solid rgba(255,255,255,.12);
}

.brand strong {
  font-size: 24px;
  letter-spacing: 0;
}

.brand span, .userbox span {
  color: #b8c2cc;
}

.nav {
  display: grid;
  gap: 8px;
}

.nav button {
  min-height: 48px;
  padding: 0 14px;
  border-radius: 8px;
  background: transparent;
  color: #d8dee7;
  text-align: left;
  display: flex;
  align-items: center;
  gap: 10px;
}

.nav button.active, .nav button:hover {
  background: rgba(255,255,255,.10);
  color: white;
}

.main {
  padding: 26px;
  overflow: auto;
}

.topbar {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
  margin-bottom: 22px;
}

h1, h2, h3, p {
  margin-top: 0;
}

h1 {
  font-size: 30px;
  margin-bottom: 6px;
}

.muted { color: var(--muted); }

.grid {
  display: grid;
  gap: 16px;
}

.cols-2 {
  grid-template-columns: minmax(0, 1fr) minmax(320px, .62fr);
}

.cols-3 {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.panel, .login-panel, .card {
  background: var(--panel);
  border: 1px solid rgba(24,33,47,.08);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.panel {
  padding: 18px;
}

.metric {
  padding: 18px;
  min-height: 112px;
}

.metric b {
  font-size: 34px;
  display: block;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.field {
  display: grid;
  gap: 7px;
}

.field.full { grid-column: 1 / -1; }

label {
  color: #334155;
  font-size: 13px;
  font-weight: 700;
}

input, textarea, select {
  min-height: 48px;
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 11px 12px;
  background: #fff;
  color: var(--ink);
  outline: none;
}

textarea {
  min-height: 92px;
  resize: vertical;
}

input:focus, textarea:focus, select:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 4px rgba(15,118,110,.12);
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.actions.compact {
  gap: 8px;
}

.btn {
  min-height: 46px;
  padding: 0 16px;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  font-weight: 800;
}

.actions.compact .btn {
  min-height: 36px;
  padding: 0 10px;
  font-size: 13px;
}

.primary { background: var(--brand); color: white; }
.secondary { background: #e8eef3; color: #1f2937; }
.blue { background: var(--brand-2); color: white; }
.danger { background: var(--danger); color: white; }
.ghost { background: transparent; color: inherit; border: 1px solid var(--line); }

.status {
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 10px;
  font-size: 12px;
  font-weight: 800;
  background: #e8eef3;
}

.status.pending { color: var(--warn); background: #fff4df; }
.status.approved, .status.not_required { color: var(--ok); background: #e7f8ee; }
.status.denied { color: var(--danger); background: #fde8e7; }

.table {
  width: 100%;
  border-collapse: collapse;
}

.table th, .table td {
  text-align: left;
  padding: 12px 10px;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}

.table th {
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
}

.thumb {
  width: 54px;
  height: 54px;
  object-fit: cover;
  border-radius: 8px;
  background: #d9e1e8;
}

.camera {
  display: grid;
  gap: 10px;
  background: var(--soft);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
}

video, canvas.preview {
  width: 100%;
  aspect-ratio: 4 / 3;
  background: #101827;
  border-radius: 8px;
  object-fit: cover;
}

.signature {
  width: 100%;
  height: 190px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  touch-action: none;
}

.login-wrap {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.login-panel {
  width: min(460px, 100%);
  padding: 28px;
}

.login-panel h1 {
  font-size: 34px;
}

.notice {
  padding: 12px 14px;
  border-radius: 8px;
  background: #fff7ed;
  color: #8a3b12;
  border: 1px solid #fed7aa;
}

.success {
  background: #ecfdf3;
  color: #075e3e;
  border-color: #abefc6;
}

.userbox {
  margin-top: auto;
  display: grid;
  gap: 12px;
  padding-top: 18px;
  border-top: 1px solid rgba(255,255,255,.12);
}

.toggle-row {
  display: flex;
  gap: 10px;
  align-items: center;
}

.toggle-row input {
  width: 22px;
  min-height: 22px;
}

.empty {
  padding: 28px;
  text-align: center;
  color: var(--muted);
}

@media (max-width: 980px) {
  .shell {
    grid-template-columns: 1fr;
  }
  .sidebar {
    position: sticky;
    top: 0;
    z-index: 4;
    padding: 14px;
  }
  .nav {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .userbox {
    margin-top: 0;
  }
  .main {
    padding: 16px;
  }
  .cols-2, .cols-3, .form-grid {
    grid-template-columns: 1fr;
  }
}
