/* ===== DESIGN TOKENS ===== */
:root {
  --bg: #f0f2f5;
  --bg-white: #ffffff;
  --text: #1a1a2e;
  --text-muted: #64748b;
  --primary: #112d4e;
  --primary-hover: #0a192f;
  --primary-soft: #e8edf4;
  --border: #dfe3e8;
  --border-light: #eef0f4;
  --stripe: #f8f9fb;
  --shadow: 0 1px 3px rgba(0,0,0,0.06);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.08);
  --shadow-lg: 0 8px 24px rgba(0,0,0,0.1);
  --radius: 8px;
  --radius-lg: 12px;
  --danger: #dc3545;
  --danger-light: #f8d7da;
  --warning: #f59e0b;
  --warning-light: #fff3cd;
  --success: #16a34a;
  --font: 'Nunito', system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  /* Backward-compat aliases for EJS inline styles */
  --muted: #64748b;
  --accent: #112d4e;
  --accent-light: #1a3a5c;
  --white: #ffffff;
  --pause: #f59e0b;
}

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

/* ===== BASE ===== */
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--primary-hover); }

/* ===== HEADER ===== */
header {
  position: sticky;
  top: 0;
  z-index: 10;
  background: var(--bg-white);
  border-bottom: 1px solid var(--border);
  box-shadow: var(--shadow);
}
.wrap {
  max-width: 1200px;
  margin: 0 auto;
  padding: 10px 16px;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.brand {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text);
  margin: 0;
  line-height: 1.2;
}
.brand a { color: inherit; text-decoration: none; }
.brand h1 { font-size: inherit; font-weight: inherit; margin: 0; }
.actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

/* ===== CONTAINER ===== */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 20px 16px;
  width: 100%;
}

/* ===== BUTTONS ===== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 7px 16px;
  font-size: 0.875rem;
  font-weight: 700;
  font-family: inherit;
  color: var(--primary);
  background: var(--bg-white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  text-decoration: none;
  transition: all 0.15s ease;
  line-height: 1.4;
}
.btn:hover {
  background: var(--primary);
  border-color: var(--primary);
  text-decoration: none;
  box-shadow: var(--shadow);
}
.home-btn { color: var(--text); text-decoration: none; }
.favorite-btn { color: #b45309; border-color: #fbbf24; background: #fffbeb; text-decoration: none; }
.favorite-btn:hover { background: #fef3c7; border-color: #f59e0b; text-decoration: none; }
.notification-btn { color: var(--text); text-decoration: none; }

/* ===== CARDS ===== */
.card {
  background: var(--bg-white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px;
  overflow: hidden;
  transition: box-shadow 0.2s ease, transform 0.2s ease;
}
.card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}

/* ===== TABLES ===== */
table { width: 100%; border-collapse: separate; border-spacing: 2px; }
th, td {
  padding: 6px 8px;
  text-align: center;
  vertical-align: middle;
  font-size: 0.85rem;
  border-radius: 3px;
}
thead th {
  background: var(--primary);
  font-weight: 700;
  font-size: 0.8rem;
  color: white;
}
tbody td {
  background: var(--bg-white);
  border: 1px solid var(--border-light);
}
tbody tr:nth-child(even) td { background: var(--stripe); }

/* ===== DAY SWITCH ===== */
.day-switch {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  gap: 8px;
}
.title-day {
  font-weight: 700;
  color: var(--text);
  font-size: 0.95rem;
  text-align: center;
  flex: 1;
}

/* ===== VIEW TOGGLE ===== */
.view-desktop { display: none; }
.view-mobile { display: block; margin-top: 12px; }
@media (min-width: 900px) {
  .view-desktop { display: block; }
  .view-mobile { display: none; }
}
@media (orientation: landscape) and (max-width: 900px) {
  .view-desktop { display: block; }
  .view-mobile { display: none; }
}

/* ===== NAVBAR ===== */
.navbar { display: flex; gap: 12px; }
.nav-link {
  color: var(--text-muted);
  font-weight: 600;
  font-size: 0.875rem;
  text-decoration: none;
  padding: 4px 8px;
  border-radius: var(--radius);
  transition: background 0.15s, color 0.15s;
}
.nav-link:hover { background: var(--primary-soft); color: var(--primary); text-decoration: none; }

/* ===== SEARCH INPUTS ===== */
.search-box input,
.search-section input {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 0.9rem;
  font-family: inherit;
  color: var(--text);
  background: var(--bg-white);
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.search-box input:focus,
.search-section input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(17, 45, 78, 0.12);
}

/* ===== LAST UPDATED ===== */
.last-updated {
  margin-top: 12px;
  font-size: 0.75rem;
  color: var(--text-muted);
  text-align: center;
}

/* ===== HEADER INLINE SEARCH ===== */
.header-search-wrap {
  position: relative;
  flex: 0 1 220px;
  min-width: 0;
}
.header-search {
  width: 100%;
  padding: 5px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 0.8rem;
  font-family: inherit;
  color: var(--text);
  background: var(--bg);
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.header-search:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(17, 45, 78, 0.12);
  background: var(--bg-white);
}
.header-search-results {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  margin-top: 4px;
  background: var(--bg-white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  max-height: 260px;
  overflow-y: auto;
  z-index: 100;
}
.header-search-results a {
  display: block;
  padding: 6px 10px;
  font-size: 0.8rem;
  color: var(--text);
  text-decoration: none;
  border-bottom: 1px solid var(--border-light);
}
.header-search-results a:last-child { border-bottom: none; }
.header-search-results a:hover,
.header-search-results a.hs-active {
  background: var(--primary-soft);
  color: var(--primary);
}
.header-search-results .hs-cat {
  padding: 4px 10px 2px;
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
@media (max-width: 640px) {
  .header-search-wrap { flex: 0 1 140px; }
  .header-search { font-size: 0.75rem; padding: 4px 8px; }
}

/* ===== MOBILE ===== */
@media (max-width: 640px) {
  .wrap { padding: 8px 12px; }
  .brand { font-size: 1rem; }
  .btn { padding: 6px 10px; font-size: 0.8rem; }
  .container { padding: 12px; }
  .actions { width: 100%; justify-content: flex-end; }
}
