:root {
  --navy-950: #07101f;
  --navy-900: #0b1220;
  --navy-800: #121a2b;
  --navy-700: #1a2740;
  --brand: #01326e;
  --brand-deep: #00428a;
  --accent: #009bdb;
  --accent-soft: rgba(0, 155, 219, 0.14);
  --text: #e8eef8;
  --muted: #9aabbc;
  --line: rgba(255, 255, 255, 0.08);
  --danger: #ff6b6b;
  --ok: #3ddc97;
  --radius: 18px;
  --shadow: 0 24px 60px rgba(0, 0, 0, 0.35);
  --font: "Segoe UI", "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }
html, body {
  margin: 0;
  min-height: 100%;
  background:
    radial-gradient(1200px 600px at 10% -10%, rgba(0, 155, 219, 0.18), transparent 55%),
    radial-gradient(900px 500px at 90% 0%, rgba(1, 50, 110, 0.55), transparent 50%),
    linear-gradient(180deg, #0a1424 0%, var(--navy-950) 45%, #070d18 100%);
  color: var(--text);
  font-family: var(--font);
}

body { position: relative; min-height: 100vh; }
a { color: inherit; text-decoration: none; }
button, input { font: inherit; }
.hidden { display: none !important; }

.bg-glow {
  pointer-events: none;
  position: fixed;
  inset: 0;
  background-image:
    linear-gradient(rgba(255,255,255,0.02) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,0.02) 1px, transparent 1px);
  background-size: 48px 48px;
  mask-image: radial-gradient(circle at center, black, transparent 75%);
  opacity: 0.35;
}

.auth-layout {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 2rem 1rem;
}

.auth-card, .hero-panel, .admin-panel, .month-card, .empty-state {
  background: linear-gradient(180deg, rgba(18, 26, 43, 0.92), rgba(12, 18, 32, 0.92));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  backdrop-filter: blur(10px);
}

.auth-card {
  width: min(440px, 100%);
  padding: 2rem;
}

.auth-header { margin-bottom: 1.5rem; }
.brand-logo, .brand img { height: 28px; width: auto; display: block; }
.eyebrow {
  margin: 1.1rem 0 0.45rem;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 0.75rem;
  font-weight: 700;
}
h1 {
  margin: 0;
  font-size: clamp(1.7rem, 3vw, 2.3rem);
  line-height: 1.15;
  letter-spacing: -0.02em;
}
.lede, .hint, .auth-footer, .muted {
  color: var(--muted);
  line-height: 1.55;
}
.lede { margin: 0.75rem 0 0; }
.auth-footer { margin-top: 1.5rem; font-size: 0.85rem; }

.auth-form label, .inline-form label {
  display: block;
  margin-bottom: 0.45rem;
  font-size: 0.9rem;
  color: #c9d5e8;
}
.auth-form input, .inline-form input {
  width: 100%;
  border: 1px solid var(--line);
  background: rgba(7, 16, 31, 0.85);
  color: var(--text);
  border-radius: 12px;
  padding: 0.9rem 1rem;
  outline: none;
  margin-bottom: 0.9rem;
}
.auth-form input:focus, .inline-form input:focus {
  border-color: rgba(0, 155, 219, 0.7);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
#code {
  letter-spacing: 0.4em;
  font-size: 1.35rem;
  text-align: center;
}

.btn {
  appearance: none;
  border: 1px solid transparent;
  border-radius: 999px;
  padding: 0.85rem 1.2rem;
  cursor: pointer;
  transition: transform 0.15s ease, background 0.15s ease, border-color 0.15s ease;
}
.btn:hover { transform: translateY(-1px); }
.btn:disabled { opacity: 0.6; cursor: wait; transform: none; }
.btn-primary {
  width: 100%;
  background: linear-gradient(135deg, var(--accent), var(--brand-deep));
  color: white;
  font-weight: 700;
}
.btn-ghost {
  background: transparent;
  border-color: var(--line);
  color: var(--text);
}
.btn-danger {
  background: rgba(255, 107, 107, 0.12);
  border-color: rgba(255, 107, 107, 0.35);
  color: #ffb4b4;
}
.btn-sm { padding: 0.45rem 0.85rem; font-size: 0.85rem; width: auto; }
.auth-form .btn-ghost { width: 100%; margin-top: 0.65rem; }

.form-message {
  min-height: 1.25rem;
  margin: 0.85rem 0 0;
  font-size: 0.92rem;
}
.form-message.error { color: var(--danger); }
.form-message.ok { color: var(--ok); }

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  backdrop-filter: blur(14px);
  background: rgba(7, 16, 31, 0.72);
  border-bottom: 1px solid var(--line);
}
.topbar-inner {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0.9rem 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.75rem;
  font-weight: 700;
}
.topbar-actions {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  flex-wrap: wrap;
  justify-content: flex-end;
}
.user-chip {
  font-size: 0.85rem;
  color: var(--muted);
  padding: 0.4rem 0.75rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255,255,255,0.03);
}

.page {
  max-width: 1100px;
  margin: 0 auto;
  padding: 2rem 1.25rem 4rem;
}
.page.narrow { max-width: 860px; }

.hero-panel {
  padding: 1.75rem 1.5rem;
  margin-bottom: 1.5rem;
}

.year-tabs {
  display: flex;
  gap: 0.55rem;
  flex-wrap: wrap;
  margin-bottom: 1.1rem;
}
.year-tab {
  padding: 0.55rem 0.95rem;
  border-radius: 999px;
  border: 1px solid var(--line);
  color: var(--muted);
  background: rgba(255,255,255,0.03);
}
.year-tab.is-active {
  color: white;
  border-color: rgba(0, 155, 219, 0.55);
  background: linear-gradient(135deg, rgba(0,155,219,0.28), rgba(1,50,110,0.55));
}

.month-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 1rem;
}
.month-card {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  padding: 1.25rem;
  min-height: 180px;
  transition: transform 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease;
}
.month-card:hover {
  transform: translateY(-3px);
  border-color: rgba(0, 155, 219, 0.45);
  box-shadow: 0 18px 40px rgba(0, 155, 219, 0.12);
}
.month-name {
  color: var(--accent);
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.month-meta { color: var(--muted); font-size: 0.85rem; }
.month-card strong {
  margin-top: auto;
  font-size: 1.05rem;
  line-height: 1.35;
}
.month-cta {
  margin-top: 0.75rem;
  color: #b9dcf0;
  font-size: 0.9rem;
}

.empty-state { padding: 2rem 1.5rem; }
.empty-state.compact { padding: 1.25rem; grid-column: 1 / -1; }

.admin-panel { padding: 1.35rem; }
.inline-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.65rem;
}
.table-wrap { overflow-x: auto; margin-top: 1.25rem; }
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.95rem;
}
.data-table th, .data-table td {
  text-align: left;
  padding: 0.85rem 0.55rem;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}
.data-table th { color: var(--muted); font-weight: 600; }
.actions { text-align: right; }

@media (max-width: 640px) {
  .inline-row { grid-template-columns: 1fr; }
  .topbar-inner { align-items: flex-start; flex-direction: column; }
  .user-chip { max-width: 100%; overflow: hidden; text-overflow: ellipsis; }
}
