:root {
  --bg: #f3f6fb;
  --surface: #ffffff;
  --surface-soft: #fafcff;
  --ink: #12233d;
  --muted: #4a5b75;
  --muted-2: #5a6a82;
  --line: #dce4f0;
  --line-strong: #c5d2e6;
  --blue: #2b5797;
  --blue-dark: #1c3f73;
  --blue-soft: #e1eaf7;
  --focus: #9dbbe6;
}

* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--ink); font-family: Manrope, system-ui, sans-serif; line-height: 1.5; }
h1, h2, h3 { margin: 0; letter-spacing: -0.02em; }
p { margin: 0; }
a { color: var(--blue); }
a:hover { color: var(--blue-dark); }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.muted { color: var(--muted); }
.ink { color: var(--ink); }
.small { font-size: 13px; }
.right { text-align: right; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.stack-6 { display: flex; flex-direction: column; gap: 6px; }
.stack-14 { display: flex; flex-direction: column; gap: 14px; }

label { font-size: 14px; font-weight: 600; }
input, select {
  height: 48px; border: 1px solid var(--line-strong); border-radius: 12px; padding: 0 14px;
  font: inherit; font-size: 16px; color: var(--ink); background: var(--surface-soft); width: 100%;
}
input:focus, select:focus { outline: 3px solid var(--focus); outline-offset: 1px; border-color: var(--blue); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 46px; padding: 0 20px;
  border-radius: 12px; border: 0; font: inherit; font-weight: 700; font-size: 15px; cursor: pointer; text-decoration: none;
}
.btn-primary { background: var(--blue); color: #fff; }
.btn-primary:hover { background: var(--blue-dark); color: #fff; }
.btn-secondary { background: var(--surface); color: var(--ink); border: 1px solid var(--line-strong); }
.btn-secondary:hover { background: var(--bg); }
.btn-link { background: none; color: var(--blue); padding: 0 8px; }
.btn-lg { height: 50px; font-size: 16px; width: 100%; }
.btn-sm { height: 36px; padding: 0 14px; font-size: 14px; font-weight: 600; }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: 18px; }

.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--ink); text-decoration: none; }
.brand:hover { color: var(--ink); }
.brand-mark {
  width: 34px; height: 34px; border-radius: 10px; background: var(--blue); color: #fff;
  display: inline-flex; align-items: center; justify-content: center; font-weight: 800; font-size: 17px;
}
.brand-name { font-weight: 800; font-size: 20px; letter-spacing: -0.02em; }

/* Public pages */
.public { min-height: 100vh; display: flex; flex-direction: column; }
.public-header, .public-footer, .hero { width: 100%; max-width: 1120px; margin: 0 auto; padding-inline: 24px; }
.public-header { padding-block: 28px; display: flex; align-items: center; justify-content: space-between; gap: 16px; font-size: 14px; }
.public-footer { padding-block: 24px; font-size: 13px; color: var(--muted-2); border-top: 1px solid var(--line); }
.hero { flex: 1; padding-block: 48px 64px; display: flex; flex-wrap: wrap; gap: 56px; align-items: center; }
.hero-copy { flex: 1 1 420px; min-width: 0; display: flex; flex-direction: column; gap: 22px; }
.hero h1 { font-size: clamp(36px, 5vw, 52px); line-height: 1.08; letter-spacing: -0.03em; font-weight: 800; }
.lead { font-size: 18px; line-height: 1.6; color: var(--muted); max-width: 500px; }
.pill { align-self: flex-start; font-size: 13px; font-weight: 600; color: var(--blue); background: var(--blue-soft); padding: 6px 12px; border-radius: 999px; }
.chips { list-style: none; margin: 8px 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: 12px; }
.chip {
  display: flex; align-items: center; gap: 10px; background: var(--surface); border: 1px solid var(--line);
  border-radius: 12px; padding: 12px 16px; font-size: 15px; font-weight: 600;
}
.chip svg { color: var(--blue); }
.chip-plain { background: none; border-color: transparent; color: var(--muted); padding-inline: 6px; }
.login-card {
  flex: 0 1 420px; min-width: 0; padding: 36px; border-radius: 20px; display: flex; flex-direction: column; gap: 20px;
  box-shadow: 0 18px 40px -24px rgba(18, 35, 61, 0.35);
}
.login-card h2 { font-size: 24px; font-weight: 800; }

.center { flex: 1; display: flex; align-items: center; justify-content: center; padding: 48px 24px 80px; }
.center-card {
  width: 100%; max-width: 480px; padding: 44px 36px; border-radius: 20px; text-align: center;
  display: flex; flex-direction: column; align-items: center; gap: 18px; box-shadow: 0 18px 40px -24px rgba(18, 35, 61, 0.35);
}
.center-card h1 { font-size: 28px; font-weight: 800; }
.center-card form { width: 100%; }
.icon-circle { width: 64px; height: 64px; border-radius: 50%; background: var(--blue-soft); color: var(--blue); display: flex; align-items: center; justify-content: center; }
.row-center { display: flex; flex-wrap: wrap; justify-content: center; gap: 12px; margin-top: 6px; }
.row-center form { width: auto; }

/* App */
.app { min-height: 100vh; display: flex; flex-wrap: wrap; }
.sidebar {
  flex: 1 1 240px; max-width: 100%; background: var(--surface); border-right: 1px solid var(--line);
  padding: 24px 16px; display: flex; flex-direction: column; gap: 6px;
}
.sidebar-brand { padding: 0 10px 20px; }
.nav-item {
  display: flex; align-items: center; gap: 10px; padding: 11px 12px; border-radius: 10px;
  color: var(--muted); text-decoration: none; font-weight: 600; font-size: 15px;
}
.nav-item:hover { background: var(--bg); color: var(--ink); }
.nav-item.is-active { background: var(--blue-soft); color: var(--blue-dark); font-weight: 700; }
.sidebar-user { margin-top: auto; display: flex; align-items: center; gap: 10px; padding: 16px 10px 0; border-top: 1px solid var(--line); }
.user-meta { display: flex; flex-direction: column; flex: 1; min-width: 0; font-size: 14px; }
.avatar {
  width: 34px; height: 34px; flex: none; border-radius: 50%; background: #dce7f5; color: var(--blue-dark);
  display: inline-flex; align-items: center; justify-content: center; font-weight: 700; font-size: 14px;
}
.avatar-lg { width: 52px; height: 52px; font-size: 20px; }
.content { flex: 999 1 560px; min-width: 0; padding: 36px 40px; display: flex; flex-direction: column; gap: 24px; max-width: 1120px; }
.page-head { display: flex; flex-direction: column; gap: 6px; }
.page-head h1 { font-size: 32px; font-weight: 800; }

.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 16px; }
.tile { padding: 22px; display: flex; flex-direction: column; gap: 8px; color: var(--ink); text-decoration: none; }
.tile svg { color: var(--blue); }
.tile:hover { border-color: var(--blue); color: var(--ink); }
.empty { padding: 32px; color: var(--muted); }

.member-grid { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 16px; }
.member-card { padding: 24px; display: flex; flex-direction: column; align-items: center; gap: 10px; text-align: center; }

.badge { display: inline-block; font-size: 13px; font-weight: 700; padding: 5px 10px; border-radius: 999px; }
.badge-blue { color: var(--blue-dark); background: var(--blue-soft); }
.badge-green { color: #1e5a3a; background: #ddf1e5; }
.badge-amber { color: #6b4a0e; background: #f7ebd3; }

.alert { padding: 12px 16px; border-radius: 12px; background: #fbe3e3; color: #7a1f1f; font-weight: 600; }
.add-form { padding: 24px; display: flex; flex-wrap: wrap; gap: 16px; align-items: flex-end; }
.field { flex: 1 1 200px; min-width: 0; display: flex; flex-direction: column; gap: 8px; }
.field-wide { flex: 2 1 260px; }
.field-narrow { flex: 0 1 140px; }
.table-wrap { overflow-x: auto; }
table { width: 100%; min-width: 620px; border-collapse: collapse; font-size: 15px; }
th { text-align: left; color: var(--muted); font-size: 13px; text-transform: uppercase; letter-spacing: 0.06em; font-weight: 700; padding: 16px 20px; border-bottom: 1px solid var(--line); }
td { padding: 14px 20px; border-bottom: 1px solid #eef2f8; }
tbody tr:last-child td { border-bottom: 0; }

@media (max-width: 720px) {
  .content { padding: 24px 16px; }
  .sidebar { border-right: 0; border-bottom: 1px solid var(--line); }
  .login-card, .center-card { padding: 28px 20px; }
}
