@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap');

:root {
  --teal: #1f6e69;
  --teal-dark: #164f4b;
  --teal-light: #e6f2f1;
  --red: #e2222d;
  --red-light: #fdeceb;
  --ink: #1a2233;
  --muted: #6b7280;
  --muted-light: #9aa1af;
  --border: #e5e8ef;
  --bg: #f4f6f9;
  --card: #ffffff;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow-sm: 0 1px 2px rgba(16, 24, 40, .04);
  --shadow: 0 1px 3px rgba(16, 24, 40, .06), 0 1px 2px rgba(16, 24, 40, .04);
  --shadow-md: 0 4px 12px rgba(16, 24, 40, .08);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  font-size: 14px;
  line-height: 1.5;
}

.container { max-width: 1180px; margin: 0 auto; padding: 28px 24px 60px; }

/* ---------- Branded header ---------- */
.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 24px;
  height: 68px;
  background: #fff;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 20;
  box-shadow: var(--shadow-sm);
}
.topbar .brand {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--ink);
}
.topbar .brand img { height: 34px; display: block; }
.topbar .brand .brand-text {
  display: flex;
  flex-direction: column;
  line-height: 1.15;
}
.topbar .brand .brand-text strong { font-size: 15px; font-weight: 700; color: var(--ink); }
.topbar .brand .brand-text span { font-size: 11px; color: var(--muted); letter-spacing: .04em; text-transform: uppercase; }

.topbar nav { display: flex; align-items: center; gap: 4px; }
.topbar nav a {
  color: var(--muted);
  font-weight: 600;
  font-size: 13.5px;
  text-decoration: none;
  padding: 8px 14px;
  border-radius: 999px;
  transition: background .15s ease, color .15s ease;
}
.topbar nav a:hover { color: var(--teal-dark); background: var(--teal-light); }
.topbar nav a.active { color: var(--teal-dark); background: var(--teal-light); }
.topbar nav a.logout-link {
  color: var(--red);
  margin-left: 8px;
  border: 1px solid var(--border);
}
.topbar nav a.logout-link:hover { background: var(--red-light); border-color: var(--red-light); }

/* ---------- Typography ---------- */
h1, h2, h3 { margin-top: 0; font-weight: 700; letter-spacing: -.01em; color: var(--ink); }
h2 { font-size: 19px; }
h3 { font-size: 16px; }
p { color: var(--ink); }
.muted { color: var(--muted); font-size: 13px; }
a.link { color: var(--teal); font-weight: 600; text-decoration: none; }
a.link:hover { text-decoration: underline; }

/* ---------- Cards ---------- */
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px 26px;
  margin-bottom: 20px;
  box-shadow: var(--shadow);
}

/* ---------- Grid ---------- */
.grid { display: grid; gap: 18px; }
.grid.cols-4 { grid-template-columns: repeat(4, 1fr); }
.grid.cols-3 { grid-template-columns: repeat(3, 1fr); }
.grid.cols-2 { grid-template-columns: repeat(2, 1fr); }
@media (max-width: 900px) { .grid.cols-4, .grid.cols-3, .grid.cols-2 { grid-template-columns: 1fr; } }

/* ---------- Tables ---------- */
table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
thead tr { background: #fafbfc; }
th, td { text-align: left; padding: 12px 10px; border-bottom: 1px solid var(--border); }
th {
  color: var(--muted);
  font-weight: 700;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .06em;
  border-bottom: 1px solid var(--border);
}
tbody tr:hover { background: #fafbfd; }
tbody tr:last-child td { border-bottom: none; }
code {
  background: #f1f3f6;
  border: 1px solid var(--border);
  padding: 2px 6px;
  border-radius: 6px;
  font-size: 12px;
}

/* ---------- Badges ---------- */
.badge {
  display: inline-block;
  padding: 3px 11px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: .02em;
  background: var(--teal-light);
  color: var(--teal-dark);
}
.badge.ok { background: #e4f7ec; color: #1a9d5c; }
.badge.warn { background: #fff4e0; color: #a0680a; }
.badge.danger { background: var(--red-light); color: var(--red); }

/* ---------- Forms ---------- */
label { display: block; font-size: 12.5px; font-weight: 700; color: var(--muted); margin-bottom: 6px; text-transform: uppercase; letter-spacing: .03em; }
input, select, textarea {
  width: 100%;
  padding: 11px 13px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-family: inherit;
  margin-bottom: 16px;
  background: #fff;
  color: var(--ink);
  transition: border-color .15s ease, box-shadow .15s ease;
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--teal);
  box-shadow: 0 0 0 3px rgba(31, 110, 105, .12);
}
input:disabled, select:disabled { background: #f6f7f9; color: var(--muted); }
input[type="checkbox"] { width: auto; }

/* ---------- Buttons ---------- */
button, .btn {
  display: inline-block;
  background: var(--teal);
  color: #fff;
  border: none;
  padding: 10px 20px;
  border-radius: var(--radius-sm);
  font-weight: 700;
  font-size: 13.5px;
  cursor: pointer;
  text-decoration: none;
  transition: background .15s ease, box-shadow .15s ease, transform .05s ease;
  box-shadow: var(--shadow-sm);
}
button:hover, .btn:hover { background: var(--teal-dark); }
button:active, .btn:active { transform: translateY(1px); }
button.secondary, .btn.secondary { background: #fff; color: var(--ink); border: 1px solid var(--border); box-shadow: none; }
button.secondary:hover, .btn.secondary:hover { background: #f6f7f9; }
button.danger, .btn.danger { background: var(--red); }
button.danger:hover, .btn.danger:hover { background: #b81b24; }

/* ---------- Flash messages ---------- */
.flash { padding: 12px 16px; border-radius: var(--radius-sm); margin-bottom: 16px; font-size: 13.5px; font-weight: 600; border: 1px solid transparent; }
.flash.success { background: #e4f7ec; color: #1a9d5c; border-color: #c9ecd8; }
.flash.error { background: var(--red-light); color: var(--red); border-color: #f8d2d0; }

/* ---------- Stat cards ---------- */
.stat-value { font-size: 30px; font-weight: 800; letter-spacing: -.02em; color: var(--ink); margin-top: 4px; }
.center { text-align: center; }

/* ---------- Login screens ---------- */
.login-shell {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(160deg, #f4f6f9 0%, var(--teal-light) 100%);
  padding: 24px;
}
.login-wrap { width: 100%; max-width: 400px; }
.login-wrap .login-logo { display: flex; justify-content: center; margin-bottom: 22px; }
.login-wrap .login-logo img { height: 56px; }
.login-wrap .card { box-shadow: var(--shadow-md); }
.login-wrap h2 { text-align: center; margin-bottom: 4px; }
.login-wrap .login-sub { text-align: center; color: var(--muted); font-size: 13px; margin-bottom: 22px; }

/* ---------- Footer note ---------- */
.app-footer { text-align: center; color: var(--muted-light); font-size: 12px; padding: 18px 0 6px; }
