:root {
  --navy: #0f2744;
  --navy-2: #173b63;
  --blue: #2563eb;
  --blue-hover: #1d4ed8;
  --background: #f4f7fb;
  --surface: #ffffff;
  --text: #172033;
  --muted: #667085;
  --border: #dce3ec;
  --success: #16794b;
  --success-bg: #eaf8f1;
  --danger: #b42318;
  --danger-bg: #fff0ee;
  --shadow: 0 8px 24px rgba(15, 39, 68, 0.08);
}

* { box-sizing: border-box; }

html { color-scheme: light; }

body {
  margin: 0;
  min-height: 100vh;
  background: var(--background);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.5;
}

a { color: inherit; }

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 76px;
  padding: 16px clamp(20px, 5vw, 64px);
  background: linear-gradient(135deg, var(--navy), var(--navy-2));
  color: #fff;
  box-shadow: 0 4px 16px rgba(15, 39, 68, 0.2);
}

.brand {
  display: flex;
  flex-direction: column;
  font-size: 1.12rem;
  font-weight: 750;
  letter-spacing: 0.01em;
}

.brand small {
  margin-top: 2px;
  color: #c9d8e9;
  font-size: 0.78rem;
  font-weight: 500;
}

.topbar nav a {
  color: #fff;
  font-size: 0.92rem;
  font-weight: 650;
  text-decoration: none;
}

main {
  width: min(1120px, calc(100% - 32px));
  margin: 0 auto;
  padding: 38px 0 52px;
}

h1, h2 { color: var(--navy); line-height: 1.2; }
h1 { margin: 0 0 8px; font-size: clamp(1.65rem, 3vw, 2.25rem); }
h2 { margin: 34px 0 14px; font-size: 1.08rem; }

.subtitle, .muted { color: var(--muted); }
.subtitle { margin: 0 0 22px; }

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

.card {
  display: flex;
  min-height: 158px;
  flex-direction: column;
  gap: 8px;
  padding: 22px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--surface);
  box-shadow: var(--shadow);
  text-decoration: none;
  transition: transform 160ms ease, border-color 160ms ease, box-shadow 160ms ease;
}

.card:hover,
.card:focus-visible {
  transform: translateY(-2px);
  border-color: #9eb8d5;
  box-shadow: 0 12px 30px rgba(15, 39, 68, 0.13);
  outline: none;
}

.card .icon { font-size: 1.7rem; }
.card .title { color: var(--navy); font-weight: 750; }
.card .desc { color: var(--muted); font-size: 0.9rem; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  padding: 9px 15px;
  border: 0;
  border-radius: 9px;
  background: var(--blue);
  color: #fff;
  cursor: pointer;
  font: inherit;
  font-size: 0.88rem;
  font-weight: 700;
  text-decoration: none;
}

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

.alert {
  padding: 14px 16px;
  border: 1px solid #f2b8b3;
  border-radius: 10px;
  background: var(--danger-bg);
  color: var(--danger);
}

table {
  width: 100%;
  overflow: hidden;
  border-collapse: separate;
  border-spacing: 0;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

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

th {
  background: #eaf0f7;
  color: var(--navy);
  font-size: 0.79rem;
  letter-spacing: 0.025em;
  text-transform: uppercase;
}

tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: #f8fafc; }
tr.low-stock { background: var(--danger-bg); }

.badge {
  display: inline-block;
  padding: 4px 9px;
  border-radius: 999px;
  font-size: 0.76rem;
  font-weight: 750;
}

.badge.ok { background: var(--success-bg); color: var(--success); }
.badge.low { background: var(--danger-bg); color: var(--danger); }

.pagefooter {
  padding: 20px 16px 28px;
  color: var(--muted);
  font-size: 0.78rem;
  text-align: center;
}

@media (max-width: 760px) {
  .topbar { padding: 14px 18px; }
  main { width: min(100% - 22px, 1120px); padding-top: 26px; }
  .subtitle .btn { margin: 10px 0 0 !important; }
  table { display: block; overflow-x: auto; white-space: nowrap; }
}

@media print {
  .topbar, .pagefooter { display: none !important; }
  body { background: #fff; }
}
