:root {
  --bg: #f7f8fa; --surface: #ffffff; --border: #d9dee5;
  --primary: #1a3e72; --accent: #b08d3f; --text: #1c2430;
  --muted: #6b7684; --danger: #a02020;
}
* { box-sizing: border-box; }
body {
  margin: 0; font-family: Inter, system-ui, sans-serif;
  background: var(--bg); color: var(--text); font-size: 14px;
}
h1, h2, h3 { font-family: Georgia, serif; color: var(--primary); margin: 0 0 8px; }
a { color: var(--primary); }

.layout { display: flex; min-height: 100vh; }
.sidebar {
  width: 220px; background: var(--primary); color: white;
  padding: 20px 0; flex-shrink: 0;
}
.sidebar h2 { color: white; font-size: 14px; padding: 0 20px; margin-bottom: 20px; }
.sidebar a {
  display: block; color: #cfd8e6; text-decoration: none;
  padding: 10px 20px; border-left: 3px solid transparent; cursor: pointer;
}
.sidebar a:hover, .sidebar a.active {
  background: rgba(255,255,255,0.08); color: white; border-left-color: var(--accent);
}
.main { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.header {
  background: var(--surface); border-bottom: 1px solid var(--border);
  padding: 14px 24px; display: flex; justify-content: space-between; align-items: center;
}
.header .office { font-size: 11px; color: var(--muted); text-transform: uppercase; }
.header .system { font-family: Georgia, serif; font-size: 16px; color: var(--primary); }
.content { padding: 24px; }

.cards {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px; margin-bottom: 24px;
}
.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 4px; padding: 18px;
}
.card .label { font-size: 11px; color: var(--muted); text-transform: uppercase; }
.card .value {
  font-family: Georgia, serif; font-size: 28px; color: var(--primary); margin-top: 8px;
}

input, select, button { font-family: inherit; font-size: 14px; }
input, select {
  width: 100%; padding: 8px 10px; border: 1px solid var(--border);
  border-radius: 4px; background: white;
}
button {
  padding: 8px 16px; border: 1px solid var(--primary);
  background: var(--primary); color: white; border-radius: 4px; cursor: pointer;
}
button:hover { background: #14315c; }
button.secondary { background: white; color: var(--primary); }
button:disabled { opacity: 0.5; cursor: not-allowed; }

.table-wrap {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 4px; overflow: hidden;
}
table { width: 100%; border-collapse: collapse; }
th, td {
  text-align: left; padding: 10px 14px;
  border-bottom: 1px solid var(--border); font-size: 13px;
}
th {
  background: #eef2f7; color: var(--primary); font-weight: 600;
  font-size: 12px; text-transform: uppercase;
}
tbody tr:hover { background: #f5f8fc; }

.toolbar { display: flex; gap: 10px; margin-bottom: 16px; flex-wrap: wrap; }
.toolbar input[type="text"] { flex: 1; min-width: 180px; }
.toolbar select { width: auto; min-width: 180px; }

.login-wrap {
  min-height: 100vh; display: flex; align-items: center;
  justify-content: center; background: var(--bg);
}
.login-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 4px; padding: 32px; width: 360px;
}
.login-card .field { margin-bottom: 16px; }
.login-card label { display: block; font-size: 12px; color: var(--muted); margin-bottom: 4px; }
.login-card button { width: 100%; }
.error { color: var(--danger); font-size: 12px; margin-top: 8px; }

.pagination {
  display: flex; justify-content: space-between; align-items: center;
  padding: 12px 14px; background: #fafbfd;
  border-top: 1px solid var(--border); font-size: 12px; color: var(--muted);
}
.hidden { display: none; }
.spinner {
  display: inline-block; width: 14px; height: 14px;
  border: 2px solid rgba(255,255,255,0.4); border-top-color: white;
  border-radius: 50%; animation: spin 0.8s linear infinite;
  vertical-align: middle; margin-right: 6px;
}
@keyframes spin { to { transform: rotate(360deg); } }

.badge {
  background: var(--accent); color: white; border-radius: 10px;
  padding: 1px 8px; font-size: 11px;
}

@media print {
  body.print-report * { visibility: hidden; }
  body.print-report #report-output,
  body.print-report #report-output * { visibility: visible; }
  body.print-report #report-output { position: absolute; left: 0; top: 0; width: 100%; }
}.hidden { display: none !important; }

.dash-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.chart-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); gap: 16px; }
.chart-box { background: var(--surface); border: 1px solid var(--border); border-radius: 4px; padding: 18px; }
.chart-box.wide { grid-column: 1 / -1; }
.chart-box h3 { font-size: 14px; margin-bottom: 14px; }
.bar-row { display: grid; grid-template-columns: 170px 1fr 60px; gap: 10px; align-items: center; margin-bottom: 8px; font-size: 12px; }
.bar-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar-track { background: #eef2f7; height: 16px; border-radius: 3px; overflow: hidden; }
.bar-fill { background: var(--primary); height: 100%; border-radius: 3px; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
.bar-val { text-align: right; font-weight: 600; color: var(--primary); }
@media print {
  body.print-dash .sidebar, body.print-dash .header, body.print-dash .no-print { display: none !important; }
  body.print-dash .content { padding: 0; }
  body.print-dash .chart-box, body.print-dash .card { break-inside: avoid; }
  body.print-dash .bar-track { background: #e6e9ee; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}

.rpt-head { padding: 18px 14px 12px; border-bottom: 1px solid var(--border); }
.rpt-office { font-size: 11px; color: var(--muted); text-transform: uppercase; }
.rpt-head h2 { font-size: 18px; margin: 4px 0; }
.rpt-meta { font-size: 12px; color: var(--muted); }
tfoot th { background: #eef2f7; border-top: 2px solid var(--primary); }
.table-wrap { overflow-x: auto; }
@media print {
  body.print-report #report-output { border: 0; overflow: visible; }
  body.print-report table { font-size: 10px; }
  body.print-report th, body.print-report td { padding: 4px 6px; }
  body.print-report thead { display: table-header-group; }
  body.print-report tr { break-inside: avoid; }
  body.print-report th { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}
