:root {
  --surface: #FCFBF6;
  --surface-2: #EFF3E9;
  --ink: #21302A;
  --ink-soft: #4B5C54;
  --ink-faint: #8A9A91;
  --brand-950: #0E2622;
  --brand-900: #163A33;
  --brand-800: #1F4E45;
  --marigold-500: #F4A825;
  --marigold-100: #FCEFD6;
  --line: #E1E7DA;
  --danger: #C1502E;
  --shadow-sm: 0 1px 2px rgba(14, 38, 34, 0.06);
  --shadow-md: 0 8px 24px -12px rgba(14, 38, 34, 0.18);
  --shadow-lg: 0 20px 48px -20px rgba(14, 38, 34, 0.28);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--surface-2);
  color: var(--ink);
}

a { color: inherit; }

/* ---------- App shell / sidebar ---------- */

.app { display: flex; min-height: 100vh; }

.nav-toggle-input { display: none; }
.nav-backdrop { display: none; }

.sidebar {
  width: 264px;
  flex-shrink: 0;
  background: linear-gradient(180deg, var(--brand-950), var(--brand-900));
  color: var(--surface);
  display: flex;
  flex-direction: column;
  padding: 22px 14px;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}

.sidebar-brand { padding: 4px 6px 22px; }
.sidebar-logo-plate {
  background: var(--surface);
  border-radius: 14px;
  padding: 10px 14px;
  display: inline-flex;
}
.sidebar-logo { display: block; width: 140px; height: auto; }
.sidebar-subtitle { font-size: 12px; opacity: 0.6; margin-top: 8px; padding: 0 4px; }

.sidebar-nav { display: flex; flex-direction: column; gap: 3px; flex: 1; }
.sidebar-nav a {
  display: flex; align-items: center; gap: 12px;
  padding: 11px 12px;
  border-radius: 12px;
  color: var(--surface);
  opacity: 0.72;
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  transition: background 0.15s, opacity 0.15s;
}
.sidebar-nav a:hover { opacity: 1; background: rgba(255, 255, 255, 0.08); }
.sidebar-nav a.active { opacity: 1; background: var(--marigold-500); color: var(--brand-950); font-weight: 700; }
.nav-icon { font-size: 16px; width: 20px; text-align: center; flex-shrink: 0; }

.sidebar-logout {
  display: flex; align-items: center; gap: 12px;
  margin-top: 14px; padding: 12px;
  border-top: 1px solid rgba(255, 255, 255, 0.12);
  padding-top: 18px;
  color: var(--surface);
  opacity: 0.62;
  text-decoration: none;
  font-size: 14px;
}
.sidebar-logout:hover { opacity: 1; }

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

.mobile-topbar {
  display: none;
  align-items: center;
  gap: 14px;
  padding: 14px 20px;
  background: var(--brand-950);
  color: var(--surface);
  position: sticky;
  top: 0;
  z-index: 30;
}
.hamburger { font-size: 20px; line-height: 1; cursor: pointer; }
.mobile-brand { font-weight: 700; font-size: 15px; }

@media (max-width: 900px) {
  .sidebar {
    position: fixed;
    left: 0; top: 0;
    transform: translateX(-100%);
    transition: transform 0.25s ease;
    z-index: 50;
    box-shadow: var(--shadow-lg);
  }
  .nav-toggle-input:checked ~ .sidebar { transform: translateX(0); }
  .nav-backdrop {
    display: block;
    position: fixed; inset: 0;
    background: rgba(14, 38, 34, 0.45);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s;
    z-index: 40;
  }
  .nav-toggle-input:checked ~ .nav-backdrop { opacity: 1; pointer-events: auto; }
  .mobile-topbar { display: flex; }
}

/* ---------- Layout / typography ---------- */

.wrap { max-width: 1080px; margin: 0 auto; padding: 32px 28px 80px; }

h1 { font-size: 24px; margin: 0 0 6px; letter-spacing: -0.01em; }
h2 { font-size: 18px; }
.subtitle { color: var(--ink-soft); margin: 0 0 24px; font-size: 14px; }

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 26px;
  box-shadow: var(--shadow-sm);
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--brand-800);
  color: var(--surface);
  border: none;
  border-radius: 999px;
  padding: 10px 22px;
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  transition: background 0.15s, transform 0.1s, box-shadow 0.15s;
}
.btn:hover { background: var(--brand-950); box-shadow: var(--shadow-md); }
.btn:active { transform: translateY(1px); }
.btn.secondary { background: transparent; color: var(--brand-800); border: 1px solid var(--line); }
.btn.secondary:hover { background: var(--surface-2); box-shadow: none; }
.btn.danger { background: var(--danger); }
.btn.danger:hover { background: #a03f22; }
.btn.small { padding: 7px 16px; font-size: 13px; }

.page-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; margin-bottom: 22px; flex-wrap: wrap; }

/* ---------- Tables ---------- */

table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: left; padding: 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { color: var(--ink-faint); font-weight: 600; font-size: 11.5px; text-transform: uppercase; letter-spacing: 0.04em; }
tbody tr { transition: background 0.12s; }
tbody tr:hover { background: var(--surface-2); }
tbody tr:last-child td { border-bottom: none; }
td.actions { white-space: nowrap; text-align: right; }
td.actions a, td.actions button { margin-left: 8px; }
img.thumb { width: 48px; height: 48px; object-fit: cover; border-radius: 10px; border: 1px solid var(--line); display: block; }
td[colspan] { text-align: center; padding: 40px 12px; color: var(--ink-faint); }

/* ---------- Dashboard ---------- */

.dash-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 16px; }
.dash-card {
  display: block;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 22px;
  text-decoration: none;
  color: var(--ink);
  box-shadow: var(--shadow-sm);
  transition: transform 0.15s, box-shadow 0.15s, border-color 0.15s;
}
.dash-card:hover { border-color: var(--brand-800); box-shadow: var(--shadow-md); transform: translateY(-2px); }
.dash-card .count { font-size: 30px; font-weight: 800; color: var(--brand-800); letter-spacing: -0.02em; }
.dash-card .label { font-size: 14px; color: var(--ink-soft); margin-top: 4px; font-weight: 500; }

/* ---------- Forms ---------- */

form.edit-form { display: flex; flex-direction: column; gap: 20px; }
.field label { display: block; font-size: 13px; font-weight: 700; margin-bottom: 7px; color: var(--brand-900); }
.field .hint { font-size: 12.5px; color: var(--ink-faint); margin-top: 5px; }
input[type=text], input[type=number], input[type=email], input[type=password], textarea, select {
  width: 100%;
  padding: 11px 13px;
  border: 1px solid var(--line);
  border-radius: 11px;
  font-size: 14px;
  font-family: inherit;
  background: var(--surface);
  color: var(--ink);
  transition: border-color 0.15s, box-shadow 0.15s;
}
textarea { resize: vertical; min-height: 90px; }
textarea.tall { min-height: 160px; }
input:focus, textarea:focus, select:focus {
  outline: none;
  border-color: var(--marigold-500);
  box-shadow: 0 0 0 3px rgba(244, 168, 37, 0.25);
}
select { cursor: pointer; }

.file-input {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 11px 18px;
  border: 1.5px dashed var(--line);
  border-radius: 11px;
  background: var(--surface-2);
  color: var(--brand-800);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}
.file-input:hover { border-color: var(--marigold-500); background: var(--marigold-100); }
.file-input input[type=file] {
  position: absolute;
  width: 1px; height: 1px;
  opacity: 0; overflow: hidden;
  clip: rect(0, 0, 0, 0);
}

.form-actions { display: flex; justify-content: space-between; align-items: center; padding-top: 8px; border-top: 1px solid var(--line); }
.form-actions .right { display: flex; gap: 10px; }

.flash { background: var(--marigold-100); border: 1px solid var(--marigold-500); color: var(--brand-950); padding: 12px 18px; border-radius: 12px; margin-bottom: 20px; font-size: 14px; font-weight: 500; }
.error { background: #FBE4DB; border: 1px solid var(--danger); color: var(--danger); padding: 12px 18px; border-radius: 12px; margin-bottom: 20px; font-size: 14px; font-weight: 500; }

/* ---------- Login ---------- */

.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: var(--surface-2); padding: 20px; }
.login-card { width: 100%; max-width: 380px; box-shadow: var(--shadow-lg); text-align: center; }
.login-logo-plate { display: inline-flex; margin: 0 auto 18px; }
.login-logo { display: block; width: 220px; height: auto; max-width: 100%; }
.login-card h1 { text-align: center; }
.login-card .subtitle { text-align: center; }
.login-card .edit-form { text-align: left; margin-top: 12px; }

.image-preview { width: 100%; max-width: 280px; border-radius: 14px; border: 1px solid var(--line); display: block; margin-bottom: 10px; box-shadow: var(--shadow-sm); }
.badge { display: inline-block; padding: 3px 11px; border-radius: 999px; font-size: 12px; font-weight: 700; }
.badge.open { background: #E4F1E6; color: #1F6D34; }
.badge.closed { background: #F1E4E4; color: #8A2C2C; }
