:root {
  --bg: #f4f6fb;
  --surface: #ffffff;
  --surface-2: #f8fafc;
  --line: #e2e8f0;
  --text: #1f2937;
  --muted: #667085;
  --primary: #2f6fed;
  --primary-dark: #1d4ed8;
  --danger: #dc2626;
  --success: #16a34a;
  --shadow: 0 10px 30px rgba(15, 23, 42, 0.08);
  --radius: 18px;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
  color: var(--text);
  background: var(--bg);
}
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
code, pre {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}
.layout {
  display: grid;
  grid-template-columns: 250px 1fr;
  min-height: 100vh;
}
.sidebar {
  background: #111827;
  color: #fff;
  padding: 28px 20px;
}
.brand { font-size: 24px; font-weight: 700; margin-bottom: 26px; }
.menu { display: grid; gap: 8px; }
.menu a {
  color: #dbeafe;
  padding: 12px 14px;
  border-radius: 12px;
  display: block;
}
.menu a.active, .menu a:hover {
  background: rgba(255,255,255,0.08);
  text-decoration: none;
}
.content { padding: 28px; }
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 22px;
}
.page-header h1 { margin: 0 0 6px; font-size: 30px; }
.muted { color: var(--muted); margin: 0; }
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 22px;
}
.center-card { display: grid; place-items: center; min-height: 80vh; }
.narrow { width: min(520px, 100%); }
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 18px;
}
.stat-label { color: var(--muted); font-size: 13px; margin-bottom: 10px; }
.stat-value { font-size: 28px; font-weight: 700; }
.stat-value.small { font-size: 15px; line-height: 1.4; word-break: break-word; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; margin-bottom: 18px; }
.section-head { margin-bottom: 12px; }
h2 { margin: 0 0 10px; font-size: 20px; }
.table-wrap { overflow: auto; }
table { width: 100%; border-collapse: collapse; }
th, td {
  text-align: left;
  padding: 12px 10px;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}
th { font-size: 13px; color: var(--muted); }
input, select, button {
  width: 100%;
  border-radius: 12px;
  border: 1px solid #cbd5e1;
  padding: 12px 14px;
  font-size: 15px;
  background: #fff;
}
button, .button-link, .link-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: var(--primary);
  color: #fff;
  border: none;
  cursor: pointer;
  padding: 11px 16px;
  border-radius: 12px;
  font-weight: 600;
}
button:hover, .button-link:hover, .link-btn:hover {
  background: var(--primary-dark);
  text-decoration: none;
}
.button-link.secondary { background: #e5e7eb; color: #111827; }
.button-link.secondary:hover { background: #d1d5db; }
.danger { background: var(--danger); }
.danger:hover { background: #b91c1c; }
.form-grid { display: grid; gap: 16px; }
label { display: grid; gap: 8px; font-size: 14px; color: var(--text); }
.form-actions, .button-row, .row-actions, .button-column {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}
.button-column form { width: 100%; }
.alert { padding: 14px 16px; border-radius: 14px; margin-bottom: 16px; }
.alert-success { background: #ecfdf3; border: 1px solid #bbf7d0; color: #166534; }
.alert-error { background: #fef2f2; border: 1px solid #fecaca; color: #991b1b; }
.tip-box {
  background: var(--surface-2);
  border: 1px dashed #cbd5e1;
  border-radius: 14px;
  padding: 16px;
  margin-top: 16px;
  line-height: 1.6;
}
.checkbox-line { grid-auto-flow: column; justify-content: start; align-items: center; gap: 10px; }
.checkbox-line input { width: auto; }
.report-box {
  background: #0f172a;
  color: #f8fafc;
  border-radius: 16px;
  padding: 18px;
  overflow: auto;
  white-space: pre-wrap;
}
.details-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px 18px;
}
@media (max-width: 1100px) {
  .layout { grid-template-columns: 1fr; }
  .stats-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-2, .details-grid { grid-template-columns: 1fr; }
}
@media (max-width: 700px) {
  .content { padding: 18px; }
  .page-header { flex-direction: column; align-items: stretch; }
  .stats-grid { grid-template-columns: 1fr; }
}
