:root {
  --navy: #0b1f3a;
  --navy-deep: #071528;
  --navy-mid: #16355c;
  --ivory: #f7f4ee;
  --ivory-card: #fffcf7;
  --gold: #b8964a;
  --gold-soft: #d4b978;
  --text: #1a2332;
  --muted: #5c6b7a;
  --border: #e4ddd0;
  --success: #1f6b4a;
  --danger: #9b2c2c;
  --warning: #9a6b16;
  --sidebar-w: 260px;
  --radius: 12px;
  --shadow: 0 8px 28px rgba(11, 31, 58, 0.08);
  --font-display: "Libre Baskerville", Georgia, serif;
  --font-body: "Source Sans 3", "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font-body);
  color: var(--text);
  background:
    radial-gradient(1200px 500px at 10% -10%, rgba(184, 150, 74, 0.12), transparent 60%),
    linear-gradient(180deg, #eef2f7 0%, var(--ivory) 45%, #ebe6dc 100%);
  min-height: 100vh;
}

a { color: var(--navy-mid); text-decoration: none; }
a:hover { color: var(--gold); }

.app-shell { display: flex; min-height: 100vh; }
.sidebar {
  width: var(--sidebar-w);
  background: linear-gradient(180deg, var(--navy) 0%, var(--navy-deep) 100%);
  color: #f3efe6;
  position: fixed;
  inset: 0 auto 0 0;
  padding: 1.25rem 1rem 5rem;
  overflow-y: auto;
  z-index: 40;
}
.brand {
  font-family: var(--font-display);
  font-size: 1.35rem;
  letter-spacing: 0.02em;
  padding: 0.5rem 0.75rem 1.25rem;
  border-bottom: 1px solid rgba(212, 185, 120, 0.25);
  margin-bottom: 1rem;
}
.brand small { display: block; font-family: var(--font-body); font-size: 0.72rem; color: var(--gold-soft); margin-top: 0.25rem; letter-spacing: 0.08em; text-transform: uppercase; }
.nav-section { font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.08em; color: rgba(243,239,230,0.45); padding: 0.85rem 0.75rem 0.35rem; }
.nav-link {
  display: block;
  color: rgba(243,239,230,0.85);
  padding: 0.55rem 0.75rem;
  border-radius: 8px;
  margin-bottom: 0.15rem;
  font-size: 0.95rem;
}
.nav-link:hover, .nav-link.active { background: rgba(184,150,74,0.18); color: #fff; }

.main {
  margin-left: var(--sidebar-w);
  flex: 1;
  min-width: 0;
  padding: 1.25rem 1.5rem 6rem;
}
.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1.25rem;
}
.topbar h1 {
  font-family: var(--font-display);
  font-size: 1.55rem;
  margin: 0;
  color: var(--navy);
}
.card {
  background: var(--ivory-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.15rem 1.25rem;
  margin-bottom: 1rem;
}
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 0.85rem;
}
.stat {
  background: linear-gradient(160deg, #fff 0%, #f8f3e8 100%);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem;
}
.stat .label { color: var(--muted); font-size: 0.8rem; }
.stat .value { font-family: var(--font-display); font-size: 1.6rem; color: var(--navy); margin-top: 0.25rem; }
.stat a { color: inherit; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.35rem;
  border: none; border-radius: 8px; padding: 0.55rem 1rem;
  font-weight: 600; cursor: pointer; font-size: 0.92rem;
}
.btn-primary { background: var(--navy); color: #fff; }
.btn-primary:hover { background: var(--navy-mid); color: #fff; }
.btn-gold { background: var(--gold); color: #fff; }
.btn-outline { background: transparent; border: 1px solid var(--navy); color: var(--navy); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-sm { padding: 0.35rem 0.7rem; font-size: 0.82rem; }

.table-wrap { overflow-x: auto; }
table.data { width: 100%; border-collapse: collapse; }
table.data th, table.data td { padding: 0.7rem 0.6rem; border-bottom: 1px solid var(--border); text-align: left; font-size: 0.92rem; }
table.data th { color: var(--muted); font-weight: 600; font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.04em; }

.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.85rem; }
.form-grid .full { grid-column: 1 / -1; }
label { display: block; font-size: 0.85rem; color: var(--muted); margin-bottom: 0.3rem; }
input, select, textarea {
  width: 100%; padding: 0.6rem 0.75rem; border: 1px solid var(--border);
  border-radius: 8px; background: #fff; font: inherit; color: var(--text);
}
textarea { min-height: 100px; }
.alert { padding: 0.75rem 1rem; border-radius: 8px; margin-bottom: 1rem; }
.alert-success { background: #e7f5ee; color: var(--success); border: 1px solid #b7dfc8; }
.alert-error { background: #fdecec; color: var(--danger); border: 1px solid #f0b4b4; }
.badge { display: inline-block; padding: 0.15rem 0.5rem; border-radius: 999px; font-size: 0.75rem; font-weight: 600; }
.badge-ok { background: #e7f5ee; color: var(--success); }
.badge-warn { background: #fff4db; color: var(--warning); }
.badge-danger { background: #fdecec; color: var(--danger); }
.badge-info { background: #e8eef7; color: var(--navy-mid); }

.guest-wrap {
  min-height: 100vh; display: grid; place-items: center; padding: 1.5rem;
  background:
    linear-gradient(135deg, rgba(11,31,58,0.92), rgba(11,31,58,0.75)),
    url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" width="80" height="80"><path d="M0 40h80M40 0v80" stroke="%23b8964a22" stroke-width="1"/></svg>');
}
.guest-card {
  width: min(440px, 100%);
  background: var(--ivory-card);
  border-radius: 16px;
  padding: 2rem;
  box-shadow: 0 20px 60px rgba(0,0,0,0.25);
}
.guest-card h1 { font-family: var(--font-display); color: var(--navy); margin: 0 0 0.25rem; }
.guest-card .sub { color: var(--muted); margin-bottom: 1.5rem; }

.mobile-bar {
  display: none;
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 50;
  background: var(--navy-deep);
  border-top: 1px solid rgba(184,150,74,0.35);
  padding: 0.4rem 0.35rem calc(0.4rem + env(safe-area-inset-bottom));
  justify-content: space-around;
}
.mobile-bar a {
  color: rgba(255,255,255,0.85); font-size: 0.68rem; text-align: center;
  display: flex; flex-direction: column; align-items: center; gap: 0.15rem; padding: 0.25rem;
}
.mobile-bar .ico { font-size: 1.05rem; color: var(--gold-soft); }

.menu-toggle {
  display: none; background: var(--navy); color: #fff; border: none;
  border-radius: 8px; padding: 0.45rem 0.7rem; cursor: pointer;
}

@media (max-width: 992px) {
  .sidebar { transform: translateX(-105%); transition: transform .2s ease; }
  .sidebar.open { transform: translateX(0); }
  .main { margin-left: 0; padding-bottom: 5.5rem; }
  .mobile-bar, .menu-toggle { display: flex; }
  .form-grid { grid-template-columns: 1fr; }
  .desktop-only { display: none !important; }
  .mobile-card-list .card-row {
    border: 1px solid var(--border); border-radius: 10px; padding: 0.85rem; margin-bottom: 0.65rem; background: #fff;
  }
}

.punch-actions { display: flex; gap: 0.75rem; flex-wrap: wrap; }
.quick-actions { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.muted { color: var(--muted); }
.sidebar-backdrop {
  display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.4); z-index: 35;
}
.sidebar-backdrop.show { display: block; }

/* Calendar / holiday markers */
.cal-legend { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-top: 0.75rem; }
.cal-pill {
  display: inline-block; font-size: 0.72rem; font-weight: 600;
  padding: 0.2rem 0.55rem; border-radius: 999px; margin-left: 0.35rem;
}
.cal-holiday { background: #fde8e4; color: #8a2f1f; border: 1px solid #f0b8a8; }
.cal-special { background: #e7f3ea; color: #1f6b4a; border: 1px solid #b7dfc8; }
.cal-sunday { background: #eef0f4; color: #4a5564; border: 1px solid #c8d0da; }
.cal-visit { background: #e8eef7; color: var(--navy-mid); border: 1px solid #c5d4ea; }
.holiday-chip-row { display: flex; flex-wrap: wrap; gap: 0.55rem; }
.cal-day-chip {
  min-width: 110px; border-radius: 10px; padding: 0.55rem 0.7rem;
  display: flex; flex-direction: column; gap: 0.15rem; font-size: 0.85rem;
}
.cal-day-chip.cal-holiday { background: #fde8e4; border: 1px solid #f0b8a8; color: #8a2f1f; }
.cal-day-chip.cal-special { background: #e7f3ea; border: 1px solid #b7dfc8; color: #1f6b4a; }
.cal-day-chip.cal-sunday { background: #eef0f4; border: 1px solid #c8d0da; color: #4a5564; }
tr.row-holiday { background: #fff5f2; }
tr.row-sunday { background: #f5f6f8; }
