@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700&family=IBM+Plex+Sans:wght@400;500;600&display=swap');

:root {
  --bg-0: #070809;
  --bg-1: #0e1012;
  --bg-2: #16191d;
  --bg-3: #1e2329;
  --line: #2a3038;
  --line-soft: #22262c;
  --text: #e8eaed;
  --muted: #8b939e;
  --faint: #5c6570;
  --silver: #c5ccd6;
  --silver-dim: #9aa3af;
  --accent: #a8b4c4;
  --ok: #4caf7a;
  --ok-bg: rgba(76, 175, 122, 0.12);
  --warn: #d4a017;
  --warn-bg: rgba(212, 160, 23, 0.12);
  --danger: #d4534c;
  --danger-bg: rgba(212, 83, 76, 0.12);
  --radius: 12px;
  --font-display: 'Outfit', sans-serif;
  --font-body: 'IBM Plex Sans', sans-serif;
  --shadow: 0 18px 50px rgba(0, 0, 0, 0.45);
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
  min-height: 100vh;
  background:
    radial-gradient(1200px 600px at 10% -10%, rgba(165, 175, 190, 0.08), transparent 55%),
    radial-gradient(900px 500px at 100% 0%, rgba(120, 130, 145, 0.06), transparent 50%),
    linear-gradient(180deg, var(--bg-0), var(--bg-1) 40%, #0a0c0e);
  color: var(--text);
  font-family: var(--font-body);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--silver); text-decoration: none; }
a:hover { color: #fff; }

img { max-width: 100%; display: block; }

.shell {
  width: min(1180px, calc(100% - 2rem));
  margin: 0 auto;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.25rem 0;
  border-bottom: 1px solid var(--line-soft);
  margin-bottom: 2rem;
  animation: rise 0.6s var(--ease) both;
}

.brand {
  font-family: var(--font-display);
  font-weight: 600;
  letter-spacing: 0.02em;
  font-size: 1.05rem;
  color: var(--silver);
}

.brand span { color: var(--muted); font-weight: 400; margin-left: 0.4rem; }

.nav-links { display: flex; gap: 1rem; align-items: center; font-size: 0.9rem; }

.hero {
  padding: 4.5rem 0 3rem;
  display: grid;
  gap: 2.5rem;
  animation: rise 0.7s var(--ease) both;
}

.hero-copy h1 {
  font-family: var(--font-display);
  font-size: clamp(2.4rem, 5vw, 3.6rem);
  font-weight: 600;
  letter-spacing: -0.03em;
  line-height: 1.1;
  max-width: 14ch;
  color: #f3f5f7;
}

.hero-copy p {
  margin-top: 1rem;
  max-width: 38ch;
  color: var(--muted);
  font-size: 1.05rem;
}

.hero-panel {
  background: linear-gradient(160deg, rgba(255,255,255,0.04), rgba(255,255,255,0.01));
  border: 1px solid var(--line);
  border-radius: calc(var(--radius) + 4px);
  padding: 1.5rem;
  box-shadow: var(--shadow);
  backdrop-filter: blur(8px);
  animation: rise 0.8s var(--ease) 0.1s both;
}

.panel-title {
  font-family: var(--font-display);
  font-size: 1.1rem;
  margin-bottom: 1rem;
  color: var(--silver);
}

.grid-2 {
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: 1.5rem;
  align-items: start;
}

@media (max-width: 860px) {
  .grid-2 { grid-template-columns: 1fr; }
}

label {
  display: block;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--faint);
  margin-bottom: 0.4rem;
}

.field { margin-bottom: 1rem; }

input, select, textarea {
  width: 100%;
  background: var(--bg-2);
  border: 1px solid var(--line);
  color: var(--text);
  border-radius: 8px;
  padding: 0.75rem 0.9rem;
  font: inherit;
  outline: none;
  transition: border-color 0.2s var(--ease), box-shadow 0.2s var(--ease);
}

input:focus, select:focus, textarea:focus {
  border-color: var(--silver-dim);
  box-shadow: 0 0 0 3px rgba(165, 175, 190, 0.12);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 0.75rem 1.1rem;
  font: inherit;
  font-weight: 500;
  cursor: pointer;
  transition: transform 0.2s var(--ease), background 0.2s, border-color 0.2s, color 0.2s;
}

.btn:hover { transform: translateY(-1px); }
.btn:disabled { opacity: 0.55; cursor: not-allowed; transform: none; }

.btn-primary {
  background: linear-gradient(180deg, #d7dde6, #b7c0cc);
  color: #111418;
}

.btn-primary:hover { background: linear-gradient(180deg, #e4e9f0, #c5ccd6); }

.btn-ghost {
  background: transparent;
  border-color: var(--line);
  color: var(--silver);
}

.btn-ghost:hover { border-color: var(--silver-dim); color: #fff; }

.btn-danger {
  background: var(--danger-bg);
  border-color: rgba(212, 83, 76, 0.35);
  color: #f0a29d;
}

.btn-block { width: 100%; }

.muted { color: var(--muted); }
.faint { color: var(--faint); }
.error {
  color: #f0a29d;
  background: var(--danger-bg);
  border: 1px solid rgba(212, 83, 76, 0.25);
  padding: 0.7rem 0.85rem;
  border-radius: 8px;
  font-size: 0.9rem;
  margin: 0.75rem 0;
}

.success-banner {
  color: #9fd9b5;
  background: var(--ok-bg);
  border: 1px solid rgba(76, 175, 122, 0.25);
  padding: 0.7rem 0.85rem;
  border-radius: 8px;
  font-size: 0.9rem;
}

.page-header {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 1rem;
  align-items: end;
  margin-bottom: 1.75rem;
  animation: rise 0.55s var(--ease) both;
}

.page-header h1 {
  font-family: var(--font-display);
  font-size: clamp(1.6rem, 3vw, 2rem);
  letter-spacing: -0.02em;
}

.filters { display: flex; flex-wrap: wrap; gap: 0.6rem; }
.filters select, .filters input { width: auto; min-width: 140px; }

.stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.85rem;
  margin-bottom: 1.5rem;
}

@media (max-width: 900px) {
  .stats { grid-template-columns: repeat(2, 1fr); }
}

.stat {
  background: var(--bg-2);
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  padding: 1rem 1.1rem;
  animation: rise 0.6s var(--ease) both;
}

.stat:nth-child(2) { animation-delay: 0.05s; }
.stat:nth-child(3) { animation-delay: 0.1s; }
.stat:nth-child(4) { animation-delay: 0.15s; }

.stat .label { margin-bottom: 0.35rem; }
.stat .value {
  font-family: var(--font-display);
  font-size: 1.7rem;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.panel {
  background: rgba(14, 16, 18, 0.85);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.25rem;
  margin-bottom: 1.25rem;
  animation: rise 0.65s var(--ease) both;
}

.panel h2 {
  font-family: var(--font-display);
  font-size: 1.05rem;
  margin-bottom: 0.85rem;
  color: var(--silver);
}

.table-wrap { overflow-x: auto; }

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.92rem;
}

th, td {
  text-align: left;
  padding: 0.7rem 0.6rem;
  border-bottom: 1px solid var(--line-soft);
  white-space: nowrap;
}

th {
  color: var(--faint);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  font-weight: 500;
}

tr:hover td { background: rgba(255,255,255,0.015); }

.badge {
  display: inline-flex;
  align-items: center;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  font-size: 0.75rem;
  border: 1px solid transparent;
}

.badge-danger { background: var(--danger-bg); color: #f0a29d; border-color: rgba(212,83,76,0.3); }
.badge-ok { background: var(--ok-bg); color: #9fd9b5; border-color: rgba(76,175,122,0.3); }
.badge-warn { background: var(--warn-bg); color: #e6c56a; border-color: rgba(212,160,23,0.3); }
.badge-muted { background: rgba(255,255,255,0.04); color: var(--muted); border-color: var(--line); }

.list {
  display: grid;
  gap: 0.55rem;
}

.list-item {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.75rem 0.85rem;
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  background: var(--bg-2);
}

.insight {
  color: var(--muted);
  line-height: 1.65;
}

.recs { padding-left: 1.1rem; color: var(--muted); }
.recs li { margin-bottom: 0.4rem; }

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

.login-card {
  width: min(420px, 100%);
  background: linear-gradient(165deg, rgba(255,255,255,0.05), rgba(255,255,255,0.015));
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 2rem 1.6rem;
  box-shadow: var(--shadow);
  animation: rise 0.6s var(--ease) both;
}

.login-card h1 {
  font-family: var(--font-display);
  font-size: 1.6rem;
  margin-bottom: 0.35rem;
}

.day-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 0.35rem;
  margin-top: 0.75rem;
}

.day-cell {
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  border-radius: 6px;
  font-size: 0.72rem;
  background: var(--bg-2);
  border: 1px solid var(--line-soft);
  color: var(--faint);
}

.day-cell.has-H { background: var(--ok-bg); color: #9fd9b5; border-color: rgba(76,175,122,0.3); }
.day-cell.has-A { background: var(--danger-bg); color: #f0a29d; border-color: rgba(212,83,76,0.3); }
.day-cell.has-I { background: var(--warn-bg); color: #e6c56a; border-color: rgba(212,160,23,0.3); }
.day-cell.has-S { background: rgba(120,140,180,0.15); color: #b7c4d8; border-color: rgba(120,140,180,0.3); }
.day-cell.has-T { background: rgba(180,140,80,0.15); color: #d8c4a0; border-color: rgba(180,140,80,0.3); }

.loading {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  color: var(--muted);
  padding: 2rem 0;
}

.loading[hidden],
#error[hidden],
#main[hidden],
#admin-link[hidden],
#lookup-error[hidden],
#login-error[hidden],
#create-error[hidden],
#create-ok[hidden] {
  display: none !important;
}

.spinner {
  width: 18px;
  height: 18px;
  border: 2px solid var(--line);
  border-top-color: var(--silver);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

.empty {
  padding: 2rem;
  text-align: center;
  color: var(--muted);
  border: 1px dashed var(--line);
  border-radius: var(--radius);
}

.footer {
  margin: 3rem 0 2rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--line-soft);
  color: var(--faint);
  font-size: 0.85rem;
  text-align: center;
}

.split-panels {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

@media (max-width: 800px) {
  .split-panels { grid-template-columns: 1fr; }
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
}

@media (max-width: 600px) {
  .form-row { grid-template-columns: 1fr; }
}

@keyframes rise {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes spin {
  to { transform: rotate(360deg); }
}
