:root {
  --background: #f4f6f9;
  --foreground: #111827;
  --primary: #1e3a5f;
  --primary-foreground: #ffffff;
  --secondary: #334e6e;
  --accent: #f59e0b;
  --accent-foreground: #1e3a5f;
  --muted: #e5e9ef;
  --muted-foreground: #6b7280;
  --card: #ffffff;
  --border: #d1d9e0;
  --danger: #b42318;
  --success: #15803d;
  --radius: 8px;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--background);
  color: var(--foreground);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
}

a {
  color: inherit;
}

.container {
  width: min(1536px, calc(100% - 32px));
  margin-inline: auto;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  background: var(--primary);
  color: var(--primary-foreground);
  box-shadow: 0 8px 24px rgba(16, 24, 40, 0.16);
}

.header-inner {
  min-height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  color: var(--primary-foreground);
  text-decoration: none;
  font-size: 18px;
  font-weight: 700;
}

.brand img {
  border-radius: 6px;
  flex: 0 0 auto;
}

.nav {
  display: flex;
  align-items: center;
  gap: 6px;
}

.nav a {
  padding: 10px 14px;
  border-radius: 6px;
  color: rgba(255, 255, 255, 0.82);
  text-decoration: none;
  font-size: 14px;
  font-weight: 600;
}

.nav a:hover,
.nav a:focus-visible {
  background: rgba(255, 255, 255, 0.12);
  color: #ffffff;
  outline: none;
}

.nav .admin-link {
  margin-left: 6px;
  background: var(--accent);
  color: var(--accent-foreground);
}

.menu-button {
  display: none;
}

.main {
  flex: 1;
  padding-block: 36px 48px;
}

.hero {
  margin-bottom: 32px;
}

.hero h1 {
  margin: 0 0 8px;
  font-size: clamp(28px, 4vw, 36px);
  line-height: 1.15;
}

.hero p,
.muted {
  color: var(--muted-foreground);
}

.address-banner,
.card,
.panel,
.kpi-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 1px 2px rgba(16, 24, 40, 0.04);
}

.address-banner {
  width: min(100%, 680px);
  display: flex;
  gap: 12px;
  align-items: center;
  padding: 14px 18px;
}

.eyebrow {
  display: block;
  margin-bottom: 4px;
  color: var(--muted-foreground);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.section-heading {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 40px 0 20px;
}

.section-heading h2 {
  margin: 0;
  font-size: 19px;
}

.section-heading::after {
  content: "";
  height: 1px;
  flex: 1;
  background: var(--border);
}

.pill {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  background: var(--muted);
  color: var(--muted-foreground);
  padding: 5px 10px;
  font-size: 12px;
  font-weight: 700;
}

.tool-grid,
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 16px;
}

.tool-card {
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.tool-card::before {
  content: "";
  display: block;
  height: 6px;
  background: var(--primary);
}

.tool-card-body {
  padding: 22px;
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 18px;
}

.tool-card h3,
.panel h2,
.panel h3,
.kpi-card h3 {
  margin: 0;
}

.button,
button.button {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 0;
  border-radius: 6px;
  background: var(--primary);
  color: var(--primary-foreground);
  padding: 0 18px;
  font: inherit;
  font-size: 14px;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
}

.button:hover,
.button:focus-visible {
  background: var(--secondary);
  outline: none;
}

.button.secondary {
  background: #ffffff;
  color: var(--foreground);
  border: 1px solid var(--border);
}

.button.secondary:hover {
  background: var(--muted);
}

.site-footer {
  margin-top: auto;
  border-top: 1px solid var(--border);
  background: rgba(30, 58, 95, 0.05);
}

.footer-inner {
  min-height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: var(--muted-foreground);
  font-size: 12px;
}

.footer-inner p {
  margin: 0;
}

.stack {
  display: grid;
  gap: 20px;
}

.panel {
  width: min(100%, 760px);
  overflow: hidden;
}

.panel.narrow {
  width: min(100%, 460px);
  margin-inline: auto;
}

.panel-header {
  padding: 18px 22px;
  border-bottom: 1px solid var(--border);
  background: rgba(229, 233, 239, 0.55);
}

.panel-body {
  padding: 22px;
}

.form-grid {
  display: grid;
  gap: 18px;
}

label {
  display: block;
  margin-bottom: 6px;
  font-size: 14px;
  font-weight: 700;
}

input,
textarea,
select {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: #ffffff;
  color: var(--foreground);
  padding: 12px 14px;
  font: inherit;
  font-size: 14px;
}

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

input:focus,
textarea:focus,
select:focus {
  border-color: var(--primary);
  outline: 3px solid rgba(30, 58, 95, 0.14);
}

.help {
  margin: 0 0 8px;
  color: var(--muted-foreground);
  font-size: 12px;
}

.notice {
  border-radius: var(--radius);
  padding: 14px 16px;
  font-size: 14px;
}

.notice.success {
  border: 1px solid #bbf7d0;
  background: #f0fdf4;
  color: #166534;
}

.notice.error {
  border: 1px solid #fecaca;
  background: #fef2f2;
  color: var(--danger);
}

.actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  margin-top: 22px;
}

.analytics-toolbar {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
}

.kpi-card {
  padding: 20px;
}

.kpi-label {
  margin: 0 0 12px;
  color: var(--muted-foreground);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.kpi-value {
  margin: 0 0 6px;
  font-size: 34px;
  line-height: 1;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

.chart {
  display: grid;
  gap: 10px;
}

.bar-row {
  display: grid;
  grid-template-columns: minmax(110px, 220px) 1fr 42px;
  gap: 10px;
  align-items: center;
  font-size: 13px;
}

.bar-track {
  height: 14px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--muted);
}

.bar-fill {
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--primary), var(--secondary));
}

.table-wrap {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  background: var(--card);
}

th,
td {
  padding: 13px 16px;
  border-bottom: 1px solid var(--border);
  text-align: left;
  vertical-align: middle;
  font-size: 14px;
}

th {
  background: rgba(229, 233, 239, 0.55);
  color: var(--muted-foreground);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.truncate {
  max-width: 360px;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

@media (max-width: 760px) {
  .container {
    width: min(100% - 24px, 1536px);
  }

  .brand span {
    display: none;
  }

  .menu-button {
    display: inline-flex;
    border: 0;
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.12);
    color: #ffffff;
    padding: 10px 12px;
    font: inherit;
    font-size: 14px;
    font-weight: 700;
  }

  .nav {
    display: none;
    position: absolute;
    left: 12px;
    right: 12px;
    top: 70px;
    flex-direction: column;
    align-items: stretch;
    padding: 10px;
    border-radius: 8px;
    background: var(--primary);
    box-shadow: 0 18px 42px rgba(16, 24, 40, 0.28);
  }

  .nav.open {
    display: flex;
  }

  .nav .admin-link {
    margin-left: 0;
    text-align: center;
  }

  .footer-inner {
    padding-block: 16px;
    flex-direction: column;
    align-items: flex-start;
  }

  .bar-row {
    grid-template-columns: 1fr 42px;
  }

  .bar-row strong {
    grid-column: 1 / -1;
  }
}
