:root {
  --primary: #1d4ed8;
  --bg: #f4f5f7;
  --surface: #ffffff;
  --text: #111827;
  --muted: #6b7280;
  --border: #e5e7eb;
  --danger: #b91c1c;
  --ok: #047857;
  --radius: 10px;
  --font: "Segoe UI", system-ui, sans-serif;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: var(--font);
  color: var(--text);
  background: var(--bg);
  line-height: 1.5;
}
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

.app { display: flex; min-height: 100vh; }
.sidebar {
  width: 240px;
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
}
.sidebar-brand {
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--border);
  font-weight: 700;
  letter-spacing: 0.02em;
}
.sidebar-brand span { color: var(--muted); font-weight: 500; font-size: 0.75rem; margin-left: 0.5rem; }
.sidebar nav { padding: 1rem 0.75rem; flex: 1; }
.sidebar a.nav {
  display: block;
  padding: 0.55rem 0.75rem;
  border-radius: 8px;
  color: var(--text);
  margin-bottom: 0.25rem;
  text-decoration: none;
}
.sidebar a.nav:hover { background: #f3f4f6; }
.sidebar a.nav.active { background: var(--primary); color: #fff; }
.sidebar-section {
  margin: 1rem 0.75rem 0.35rem;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  font-weight: 600;
}
.sidebar-user {
  border-top: 1px solid var(--border);
  padding: 1rem 1.25rem;
  font-size: 0.875rem;
}
.main { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.topbar {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 0.85rem 1.5rem;
  font-weight: 600;
}
.content { padding: 1.5rem; }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
}
.stack > * + * { margin-top: 1rem; }
.h1 { font-size: 1.35rem; margin: 0 0 0.25rem; }
.muted { color: var(--muted); font-size: 0.9rem; }

.btn {
  display: inline-block;
  border: 0;
  border-radius: 8px;
  padding: 0.55rem 1rem;
  background: var(--primary);
  color: #fff;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
}
.btn:hover { filter: brightness(0.95); text-decoration: none; }
.btn-secondary { background: #e5e7eb; color: var(--text); }
.btn-sm { padding: 0.35rem 0.7rem; font-size: 0.85rem; }

label { display: block; font-size: 0.875rem; font-weight: 600; margin-bottom: 0.35rem; }
input[type=text], input[type=email], input[type=password], input[type=color], select, textarea {
  width: 100%;
  max-width: 28rem;
  padding: 0.55rem 0.7rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  font: inherit;
  background: #fff;
}
.field { margin-bottom: 1rem; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
@media (max-width: 800px) {
  .app { flex-direction: column; }
  .sidebar { width: 100%; }
  .grid-2 { grid-template-columns: 1fr; }
}

table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
th, td { text-align: left; padding: 0.65rem 0.5rem; border-bottom: 1px solid var(--border); }
th { color: var(--muted); font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.04em; }

.alert {
  padding: 0.75rem 1rem;
  border-radius: 8px;
  margin-bottom: 1rem;
  font-size: 0.9rem;
}
.alert-error { background: #fef2f2; color: var(--danger); border: 1px solid #fecaca; }
.alert-ok { background: #ecfdf5; color: var(--ok); border: 1px solid #a7f3d0; }

.auth-wrap {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 1.5rem;
  background:
    radial-gradient(circle at 20% 20%, #dbeafe 0, transparent 40%),
    radial-gradient(circle at 80% 0%, #e0e7ff 0, transparent 35%),
    var(--bg);
}
.auth-card { width: 100%; max-width: 24rem; }
.auth-brand { font-size: 1.75rem; font-weight: 800; margin-bottom: 0.25rem; letter-spacing: -0.02em; }
.check-list label { font-weight: 500; display: flex; gap: 0.5rem; align-items: center; margin-bottom: 0.35rem; }
.check-list input { width: auto; }
.check-row { display: flex; flex-wrap: wrap; gap: 1rem; margin-bottom: 1rem; }
.check-row label { font-weight: 500; display: flex; gap: 0.4rem; align-items: center; }
.check-row input { width: auto; }

.toolbar { display: flex; justify-content: space-between; align-items: center; gap: 1rem; flex-wrap: wrap; }
.toolbar-actions { display: flex; gap: 0.5rem; flex-wrap: wrap; align-items: center; }
.inline-form { display: flex; gap: 0.4rem; align-items: center; }
.inline-form input { max-width: 14rem; margin: 0; }

.table-wrap { overflow: auto; }
.table-wrap table input,
.table-wrap table select { max-width: none; width: 100%; min-width: 4.5rem; }
.table-wrap td { vertical-align: middle; }

textarea {
  width: 100%;
  max-width: 100%;
  padding: 0.55rem 0.7rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  font: inherit;
  background: #fff;
}

.totals-row {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.25rem 0;
}
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 0.75rem;
}
.kpi {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem;
}
.kpi .label { color: var(--muted); font-size: 0.8rem; }
.kpi .value { font-size: 1.75rem; font-weight: 700; margin-top: 0.25rem; }

form { margin: 0; }

