:root {
  --bg: #f4f7fb;
  --panel: #ffffff;
  --ink: #0e1b2a;
  --muted: #6b7a90;
  --accent: #1f6feb;
  --accent-2: #0f172a;
  --line: #e2e8f0;
  --shadow: 0 12px 30px rgba(15, 23, 42, 0.08);
  --radius: 14px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: "Manrope", sans-serif;
  background: radial-gradient(1200px 400px at 20% -10%, #e9f1ff, transparent),
              radial-gradient(900px 300px at 90% 0%, #eaf7ff, transparent),
              var(--bg);
  color: var(--ink);
}

.site-header {
  display: none;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  background: #0b1324;
  color: white;
  position: sticky;
  top: 0;
  z-index: 5;
  box-shadow: 0 12px 24px rgba(2, 6, 23, 0.2);
}

.brand {
  font-weight: 700;
  letter-spacing: 0.16em;
}

.site-header .brand {
  display: none;
}

/* Layout shell */
.app-shell {
  display: flex;
  min-height: 100vh;
}

.app-main {
  flex: 1;
  min-width: 0;
}

.sidebar {
  width: 220px;
  background: #0b1324;
  color: white;
  padding: 22px 16px;
  position: sticky;
  top: 0;
  height: 100vh;
}

.sidebar-brand {
  font-weight: 700;
  letter-spacing: 0.2em;
  margin-bottom: 18px;
}

.side-user {
  background: rgba(255,255,255,0.08);
  padding: 12px;
  border-radius: 12px;
  margin-bottom: 14px;
}

.side-user-name {
  font-weight: 600;
  color: #dce6f7;
  margin-bottom: 8px;
  font-size: 0.9rem;
}

.side-logout {
  width: 100%;
  border: none;
  padding: 8px 10px;
  border-radius: 10px;
  background: rgba(255,255,255,0.16);
  color: white;
  font-weight: 600;
  cursor: pointer;
}

.side-logout:hover {
  background: rgba(255,255,255,0.24);
}

.side-nav {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.side-link {
  color: #dce6f7;
  text-decoration: none;
  padding: 10px 12px;
  border-radius: 10px;
  display: block;
  font-weight: 600;
}

.side-link:hover {
  background: rgba(255,255,255,0.1);
  color: white;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 10px;
}

.hamburger {
  display: none;
  width: 36px;
  height: 28px;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 6px;
  cursor: pointer;
}

.hamburger span {
  display: block;
  width: 22px;
  height: 2px;
  background: white;
  border-radius: 2px;
}

.nav-toggle {
  display: none;
}

.sidebar-backdrop {
  display: none;
}

nav .user {
  margin-right: 10px;
  color: #dce6f7;
}

nav .link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: 10px;
  color: white;
  text-decoration: none;
  margin-left: 8px;
  background: rgba(255,255,255,0.12);
  font-weight: 600;
}

nav .link:hover { background: rgba(255,255,255,0.2); }

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 28px;
}

h1, h2 { margin: 0 0 12px; }

.card {
  background: var(--panel);
  padding: 18px;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  border: 1px solid var(--line);
  margin-bottom: 16px;
}

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

label {
  display: block;
  margin: 12px 0 6px;
  color: var(--muted);
  font-size: 0.9rem;
}

input, select {
  width: 100%;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--line);
  font-size: 0.95rem;
  max-width: 100%;
}

input[type="date"] { padding-right: 36px; }

button {
  margin-top: 14px;
  padding: 8px 14px;
  border: none;
  border-radius: 10px;
  background: var(--accent);
  color: white;
  font-weight: 600;
  cursor: pointer;
}

button.link {
  background: none;
  color: var(--accent);
  padding: 0;
  font-weight: 600;
}

.btn-secondary {
  display: inline-block;
  padding: 8px 12px;
  border-radius: 10px;
  background: #111827;
  color: white;
  text-decoration: none;
  font-weight: 600;
}

.btn-edit {
  display: inline-block;
  padding: 6px 10px;
  border-radius: 10px;
  background: #ffe08a;
  color: #6b4d00;
  font-weight: 600;
  text-decoration: none;
  border: 1px solid #f3c35d;
}

.btn-edit:hover { background: #ffeab0; }

.inline { display: inline; }

.inline-form {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
}

.inline-form label { margin: 0; }

.inline-form button { margin-top: 0; }

.inline-form input[type="text"] { padding: 6px 10px; }

.table-form {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.table-form input[type="text"],
.table-form select { padding: 6px 10px; }

select { padding: 8px 12px; }

label.checkbox {
  display: flex;
  align-items: center;
  gap: 8px;
}

label.checkbox input { width: auto; margin: 0; }

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

thead th {
  text-align: left;
  font-weight: 600;
  padding: 10px 8px;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
}

tbody td {
  padding: 10px 8px;
  border-bottom: 1px solid var(--line);
}

.flash, .error, .notice {
  padding: 12px 14px;
  border-radius: 10px;
  margin-bottom: 16px;
}

.flash {
  background: #e9f7ef;
  color: #1f7a46;
}

.error {
  background: #fde2e2;
  color: #b91c1c;
}

.notice {
  background: #fff7ed;
  color: #b45309;
}

.stat {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 0;
}

.muted { color: var(--muted); }

.badge-full {
  display: inline-block;
  margin-left: 6px;
  padding: 2px 8px;
  border-radius: 999px;
  background: #e9f7ef;
  color: #1f7a46;
  font-size: 0.75rem;
  font-weight: 700;
}

.fillup-card {
  margin-top: 12px;
  box-shadow: none;
  border: 1px dashed var(--line);
}

.fillup-row {
  display: flex;
  justify-content: space-between;
  padding: 6px 0;
  border-bottom: 1px solid var(--line);
}

.fillup-row:last-child { border-bottom: none; }

.fillup-actions {
  display: flex;
  justify-content: flex-end;
  padding-top: 8px;
}

.tool-row {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.profile-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(220px, 1fr));
  gap: 16px;
  margin-bottom: 16px;
}

.admin-grid {
  display: grid;
  grid-template-columns: 1.2fr 0.8fr;
  gap: 16px;
  margin-bottom: 16px;
}

.stats-card .stat { padding: 8px 0; }

.mobile-only { display: none; }
.desktop-only { display: block; }

@media (max-width: 900px) {
  .profile-grid { grid-template-columns: 1fr; }
  .admin-grid { grid-template-columns: 1fr; }
  .site-header { display: flex; }
  .site-header .brand { display: block; }
  .app-shell { flex-direction: column; }
  .sidebar {
    position: fixed;
    left: 0;
    top: 0;
    height: 100%;
    width: 100%;
    transform: translateX(-100%);
    transition: transform 0.25s ease;
    z-index: 10;
  }
  .sidebar-backdrop {
    display: block;
    position: fixed;
    inset: 0;
    background: rgba(2, 6, 23, 0.5);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
    z-index: 9;
  }
  .nav-toggle:checked ~ .app-shell .sidebar {
    transform: translateX(0);
  }
  .nav-toggle:checked ~ .app-shell .sidebar-backdrop {
    opacity: 1;
    pointer-events: auto;
  }
  .hamburger {
    display: flex;
  }
}

@media (max-width: 640px) {
  .site-header { flex-direction: column; gap: 8px; }
  .container { padding: 16px; }
  .mobile-only { display: block; }
  .desktop-only { display: none; }
  .app-main { padding-top: 8px; }
}
