﻿:root {
  --brand: #6d16b8;
  --brand-dark: #4e0f86;
  --ink: #1f2430;
  --muted: #697080;
  --line: #e7e9ef;
  --soft: #f6f3fb;
  --danger: #c83349;
  --success: #187f5d;
  --white: #ffffff;
  --shadow: 0 14px 34px rgba(31, 36, 48, .08);
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: Arial, Helvetica, sans-serif;
  color: var(--ink);
  background: #fbfbfd;
  line-height: 1.45;
}
a { color: inherit; text-decoration: none; }

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 16px;
  background: rgba(255,255,255,.96);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 1.15rem; }
.brand img { width: 46px; height: 34px; object-fit: contain; }
.menu-toggle {
  border: 0;
  border-radius: 8px;
  padding: 10px 12px;
  color: var(--white);
  background: var(--brand);
  font-weight: 700;
}
.main-nav {
  display: none;
  grid-template-columns: 1fr;
  gap: 8px;
  padding: 12px 16px;
  background: var(--white);
  border-bottom: 1px solid var(--line);
}
.main-nav.is-open { display: grid; }
.main-nav a {
  padding: 12px;
  border-radius: 8px;
  background: var(--soft);
  font-weight: 700;
}
.container { width: min(100%, 1120px); margin: 0 auto; padding: 18px 14px 40px; }
.page-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}
h1, h2 { margin: 0; letter-spacing: 0; }
h1 { font-size: 1.65rem; }
h2 { font-size: 1.1rem; margin-bottom: 14px; }
.eyebrow { margin: 0 0 4px; color: var(--brand); font-size: .78rem; font-weight: 800; text-transform: uppercase; }
.muted, .hint { color: var(--muted); }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 10px 14px;
  border: 0;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 800;
  font-size: .95rem;
}
.btn-primary { color: var(--white); background: var(--brand); }
.btn-primary:hover { background: var(--brand-dark); }
.btn-secondary { color: var(--ink); background: #eef0f5; }
.btn-danger { color: var(--white); background: var(--danger); }

.panel, .metric-card, .record-card, .summary-grid div {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}
.panel { padding: 16px; margin-bottom: 16px; }

.cards-grid, .summary-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
  margin-bottom: 16px;
}
.metric-card { padding: 16px; }
.metric-card span, .summary-grid span { display: block; color: var(--muted); font-size: .9rem; }
.metric-card strong, .summary-grid strong { display: block; margin-top: 6px; font-size: 1.45rem; }
.metric-card.featured { border-color: rgba(109,22,184,.35); background: var(--soft); }
.summary-grid div { padding: 14px; box-shadow: none; }
.summary-grid strong { font-size: 1.1rem; }
.summary-list { display: grid; gap: 10px; }
.summary-list div { display: flex; justify-content: space-between; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.summary-list div:last-child { border-bottom: 0; }

.form { display: grid; gap: 14px; }
label { display: grid; gap: 7px; color: var(--ink); font-weight: 700; }
input, textarea, select {
  width: 100%;
  min-height: 48px;
  padding: 12px;
  border: 1px solid #cfd3dc;
  border-radius: 8px;
  background: var(--white);
  color: var(--ink);
  font: inherit;
}
textarea { resize: vertical; }
input:focus, textarea:focus, select:focus {
  outline: 3px solid rgba(109,22,184,.18);
  border-color: var(--brand);
}
.form-actions { display: grid; grid-template-columns: 1fr; gap: 10px; }
.filters { display: grid; gap: 12px; }

.record-list { display: grid; gap: 12px; }
.record-card { padding: 14px; }
.record-top { display: flex; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.record-top span { color: var(--brand); font-weight: 900; }
dl { display: grid; gap: 8px; margin: 0; }
dl div { display: flex; justify-content: space-between; gap: 12px; padding-bottom: 8px; border-bottom: 1px solid var(--line); }
dt { color: var(--muted); }
dd { margin: 0; font-weight: 700; text-align: right; }
.card-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 14px; }

.pagination { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin-top: 18px; }
.pagination a { min-width: 42px; padding: 10px; border-radius: 8px; background: #eef0f5; text-align: center; font-weight: 700; }
.pagination a.active { color: var(--white); background: var(--brand); }
.flash { padding: 12px 14px; border-radius: 8px; margin-bottom: 14px; font-weight: 700; }
.flash-success { color: #0b513b; background: #dff7ec; }
.flash-error { color: #7a1425; background: #ffe4e9; }
.chart-panel { overflow: hidden; }
.chart-box {
  position: relative;
  width: 100%;
  height: 300px;
  max-height: 300px;
}
.chart-box canvas {
  display: block;
  width: 100% !important;
  height: 300px !important;
  max-height: 300px !important;
}

.login-body { min-height: 100vh; background: linear-gradient(180deg, #ffffff 0%, #f7f2fc 100%); }
.login-screen { min-height: 100vh; display: grid; place-items: center; padding: 18px; }
.login-card { width: min(100%, 420px); padding: 22px; background: var(--white); border: 1px solid var(--line); border-radius: 8px; box-shadow: var(--shadow); }
.login-logo { display: block; width: min(100%, 230px); margin: 0 auto 10px; }
.login-card h1 { text-align: center; color: var(--brand); }
.login-card p { text-align: center; }

@media (min-width: 700px) {
  .menu-toggle { display: none; }
  .main-nav {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
  }
  .main-nav a { background: transparent; }
  .cards-grid { grid-template-columns: repeat(4, 1fr); }
  .summary-grid { grid-template-columns: repeat(5, 1fr); }
  .filters { grid-template-columns: repeat(4, 1fr); align-items: end; }
  .record-form { grid-template-columns: repeat(2, 1fr); }
  .record-form label:nth-last-child(2) { grid-column: 1 / -1; }
  .form-actions { grid-template-columns: repeat(2, max-content); }
  .record-list { grid-template-columns: repeat(2, 1fr); }
}
