:root {
  --ink: #10202c;
  --muted: #5b6b74;
  --line: #dde4e7;
  --bg: #f7f9fa;
  --card: #ffffff;
  --brand: #0f6e8c;
  --brand-dark: #0a5069;
  /* Overridden per deployment by Settings > Branding (see lib/layout.js);
     these defaults reproduce the original blue look exactly. */
  --brand-ink: #fff;
  --brand-text: var(--brand);
  --brand-strong: var(--brand-dark);
  --brand-tint: #eef7fa;
  --header-bg: var(--brand);
  --header-ink: #fff;
  --header-nav-ink: #eaf6fb;
  --sidebar-bg: #0d2733;
  --ok-bg: #e5f5ec; --ok-fg: #166a3e;
  --warn-bg: #fdf1e0; --warn-fg: #8a5a10;
  --err-bg: #fdeaea; --err-fg: #9c2b2b;
  --info-bg: #e8f1fb; --info-fg: #1f5a96;
  --radius: 10px;
  font-size: 16px;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color: var(--ink);
  background: var(--bg);
  line-height: 1.5;
}
a { color: var(--brand-text); }
.wrap { max-width: 960px; margin: 0 auto; padding: 0 20px; }
h1 { font-size: 1.7rem; margin: 0.4em 0 0.3em; }
h2 { font-size: 1.25rem; margin: 1.4em 0 0.5em; }
h3 { font-size: 1.05rem; margin: 1em 0 0.4em; }
.muted { color: var(--muted); }
.small { font-size: 0.87rem; }
code { background: #eef2f3; padding: 0.1em 0.4em; border-radius: 4px; font-size: 0.9em; }

/* ---- Public header/footer ---- */
.site-header { background: var(--header-bg); color: var(--header-ink); }
.header-inner { display: flex; align-items: center; justify-content: space-between; padding: 14px 20px; }
.brand { color: var(--header-ink); font-weight: 700; font-size: 1.15rem; text-decoration: none; }
.main-nav a { color: var(--header-nav-ink); text-decoration: none; margin-left: 18px; font-size: 0.95rem; }
.main-nav a:hover { text-decoration: underline; }
.main { padding: 28px 20px 60px; }
.site-footer { border-top: 1px solid var(--line); padding: 18px 20px; margin-top: 40px; color: var(--muted); font-size: 0.88rem; }
.powered-by { margin-top: 4px; font-size: 0.78rem; opacity: 0.7; }

.hero { padding: 10px 0 8px; }
.hero h1 { font-size: 1.9rem; }

/* ---- Cards / grid ---- */
.tour-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px; margin-top: 14px; }
.card, .tour-card {
  display: block; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  text-decoration: none; color: inherit; overflow: hidden; transition: box-shadow 0.15s, transform 0.15s;
}
.tour-card:hover { box-shadow: 0 4px 16px rgba(16,32,44,0.08); transform: translateY(-1px); }
.tour-card-photo { width: 100%; aspect-ratio: 16/10; object-fit: cover; display: block; }
.tour-card-body { padding: 18px; }
.tour-detail-photo { width: 100%; max-height: 360px; object-fit: cover; border-radius: var(--radius); margin: 10px 0; }
.photo-preview { max-width: 260px; max-height: 160px; object-fit: cover; border-radius: 8px; border: 1px solid var(--line); }
.tour-card h3 { margin: 0 0 6px; color: var(--ink); }
.tour-meta { color: var(--brand-strong); font-weight: 600; font-size: 0.92rem; margin: 8px 0; }
.tour-next { font-size: 0.88rem; margin-top: 8px; }

.card-pad { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; margin: 16px 0; }

/* ---- Departure list ---- */
.departure-list { display: flex; flex-direction: column; gap: 10px; margin-top: 10px; }
.departure-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; }

/* ---- Buttons ---- */
.btn { display: inline-block; padding: 10px 18px; border-radius: 8px; text-decoration: none; font-weight: 600; font-size: 0.94rem; border: 1px solid transparent; cursor: pointer; }
.btn-primary { background: var(--brand); color: var(--brand-ink); }
.btn-primary:hover { background: var(--brand-dark); }
.btn-outline { background: transparent; border-color: var(--brand); color: var(--brand-text); }
.btn-outline:hover { background: var(--brand-tint); }
.btn-danger { background: #fff; border-color: #d5504f; color: #d5504f; }
.btn-danger:hover { background: #fdeaea; }
.btn-sm { padding: 6px 12px; font-size: 0.85rem; }
.link-btn { background: none; border: none; color: var(--brand-text); text-decoration: underline; cursor: pointer; padding: 0; font-size: 0.9rem; }

/* ---- Forms ---- */
.stacked-form { display: flex; flex-direction: column; gap: 14px; max-width: 480px; }
.stacked-form label { display: flex; flex-direction: column; gap: 5px; font-size: 0.92rem; font-weight: 600; color: var(--ink); }
.stacked-form input, .stacked-form select, .stacked-form textarea {
  font: inherit; padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px; font-weight: 400; background: #fff; color: var(--ink);
}
.stacked-form textarea { min-height: 70px; resize: vertical; }
.checkbox-label { flex-direction: row !important; align-items: center; gap: 8px !important; font-weight: 400 !important; }
.checkbox-label input { width: auto; }
.addon-opt { flex-direction: row !important; align-items: center; justify-content: space-between; gap: 8px !important; font-weight: 400 !important; }
.qty-input { width: 60px !important; flex: none; }
fieldset { border: 1px solid var(--line); border-radius: 8px; padding: 12px; }
legend { font-weight: 600; font-size: 0.9rem; padding: 0 6px; }
.inline-form { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.inline-form input, .inline-form select { font: inherit; padding: 7px 10px; border: 1px solid var(--line); border-radius: 6px; }
.filter-bar { display: flex; gap: 14px; align-items: end; flex-wrap: wrap; margin: 12px 0 18px; }
.filter-bar label { display: flex; flex-direction: column; gap: 4px; font-size: 0.85rem; font-weight: 600; }
.filter-bar input, .filter-bar select { font: inherit; padding: 7px 10px; border: 1px solid var(--line); border-radius: 6px; }

/* ---- Policy / waiver text ---- */
.policy-box {
  max-height: 140px; overflow-y: auto; font-size: 0.85rem; color: var(--muted);
  background: #f9fafb; border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; margin-bottom: 8px; line-height: 1.5;
}

/* ---- Notices / flash / badges ---- */
.notice { padding: 12px 14px; border-radius: 8px; margin: 14px 0; background: var(--info-bg); color: var(--info-fg); }
.notice-ok { background: var(--ok-bg); color: var(--ok-fg); }
.notice-warn { background: var(--warn-bg); color: var(--warn-fg); }
.flash { padding: 12px 14px; border-radius: 8px; margin: 14px 0; }
.flash-info { background: var(--info-bg); color: var(--info-fg); }
.flash-ok { background: var(--ok-bg); color: var(--ok-fg); }
.flash-error { background: var(--err-bg); color: var(--err-fg); }
.badge { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 0.78rem; font-weight: 600; }
.badge-ok { background: var(--ok-bg); color: var(--ok-fg); }
.badge-warn { background: var(--warn-bg); color: var(--warn-fg); }
.badge-info { background: var(--info-bg); color: var(--info-fg); }
.badge-muted { background: #eceff0; color: var(--muted); }
.row-attention { background: #fff7ea; }

/* ---- Tables ---- */
.admin-table, .details-table { width: 100%; border-collapse: collapse; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; margin: 10px 0 20px; }
.admin-table th, .admin-table td, .details-table th, .details-table td { padding: 10px 12px; border-bottom: 1px solid var(--line); text-align: left; font-size: 0.92rem; }
.admin-table th { background: #f3f6f7; font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.03em; color: var(--muted); }
.details-table th { width: 180px; color: var(--muted); font-weight: 600; background: #f9fafb; }
.admin-table tr:last-child td, .details-table tr:last-child td { border-bottom: none; }

/* ---- Confirmation / lookup ---- */
.confirm-box { max-width: 560px; }
.confirm-code { font-size: 1.1rem; }
.details-table td { font-weight: 500; }
.back-link { display: inline-block; margin-bottom: 6px; font-size: 0.9rem; text-decoration: none; }

/* ---- Price breakdown (booking review) ---- */
.price-breakdown { max-width: 480px; }
.price-breakdown th { width: auto; }
.price-breakdown tr.breakdown-item th, .price-breakdown tr.breakdown-item td,
.price-breakdown tr.breakdown-item { background: transparent; }
.breakdown-item td:first-child { padding-left: 26px; color: var(--muted); font-weight: 400; font-size: 0.85rem; border-bottom: none; }
.breakdown-item td:last-child { color: var(--muted); font-weight: 400; font-size: 0.85rem; border-bottom: none; }
.breakdown-total th, .breakdown-total td { font-size: 1.05rem; font-weight: 700; color: var(--ink); border-top: 2px solid var(--line); }

/* ---- Admin shell ---- */
body.admin { background: var(--bg); }
.admin-shell { display: flex; min-height: 100vh; }
.admin-sidebar { width: 220px; flex: 0 0 220px; background: var(--sidebar-bg); color: #dceef4; display: flex; flex-direction: column; padding: 18px 16px; }
.admin-brand { color: #fff; font-size: 1.05rem; margin-bottom: 22px; display: flex; flex-direction: column; gap: 2px; }
.admin-tag { font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.08em; color: #9fc7d6; font-weight: 400; }
.admin-nav { display: flex; flex-direction: column; gap: 2px; flex: 1; }
.admin-nav a { color: #cfe4ec; text-decoration: none; padding: 9px 10px; border-radius: 7px; font-size: 0.92rem; }
.admin-nav a:hover { background: rgba(255,255,255,0.06); }
.admin-nav a.active { background: rgba(255,255,255,0.14); color: #fff; font-weight: 600; }
.admin-nav a.nav-cta { background: var(--brand); color: var(--brand-ink); font-weight: 700; margin-bottom: 6px; }
.admin-nav a.nav-cta:hover { background: var(--brand-dark); }
.admin-nav a.nav-cta.active { background: var(--brand-dark); }
.admin-sidebar-footer { display: flex; flex-direction: column; gap: 8px; font-size: 0.85rem; padding-top: 14px; border-top: 1px solid rgba(255,255,255,0.12); }
.admin-sidebar-footer a { color: #cfe4ec; }
.admin-whoami { color: #9fc7d6; }
.admin-sidebar-footer form { margin: 0; }
.admin-sidebar-footer .link-btn { color: #cfe4ec; }
.admin-powered-by { font-size: 0.75rem; opacity: 0.55; }
.admin-main { flex: 1; min-width: 0; }
.admin-content { padding: 26px 30px 60px; max-width: 1080px; }
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.page-head h1 { margin: 0; }

.stat-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 14px; margin: 16px 0 24px; }
.stat-card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; }
.stat-num { font-size: 1.6rem; font-weight: 700; color: var(--brand-strong); }
.stat-label { color: var(--muted); font-size: 0.85rem; margin-top: 4px; }

.attention-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.attention-row:last-child { border-bottom: none; }
.attention-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.attention-actions form { margin: 0; }

.history-list { list-style: none; padding: 0; margin: 8px 0; display: flex; flex-direction: column; gap: 6px; font-size: 0.9rem; }

/* ---- Calendar (week view) ---- */
.cal-nav { display: flex; gap: 8px; flex-wrap: wrap; }
.cal-week { display: grid; grid-template-columns: repeat(7, minmax(140px, 1fr)); gap: 10px; margin-top: 14px; overflow-x: auto; padding-bottom: 8px; }
.cal-day { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px; min-width: 140px; }
.cal-day-today { border-color: var(--brand); box-shadow: 0 0 0 1px var(--brand); }
.cal-day-head { font-weight: 700; font-size: 0.9rem; text-align: center; padding-bottom: 8px; margin-bottom: 8px; border-bottom: 1px solid var(--line); }
.cal-day-body { display: flex; flex-direction: column; gap: 12px; }
.cal-empty { text-align: center; padding: 10px 0; }
.cal-dep-block { width: 100%; }
.cal-dep {
  display: block; width: 100%; text-decoration: none; color: inherit;
  border-left: 5px solid var(--brand); border-radius: 6px; padding: 8px 10px;
  box-shadow: 0 1px 3px rgba(16,32,44,0.1);
}
.cal-dep-label { font-size: 0.82rem; font-weight: 700; line-height: 1.3; }
.cal-dep-numbers { font-size: 0.8rem; margin-top: 4px; line-height: 1.4; }
.cal-dep-inactive { opacity: 0.6; }

/* ---- Calendar (public, per-tour booking view) ---- */
.pub-cal-dep {
  display: block; width: 100%; text-decoration: none; color: inherit;
  background: var(--ok-bg); border-left: 5px solid var(--brand); border-radius: 6px; padding: 8px 10px;
  box-shadow: 0 1px 3px rgba(16,32,44,0.1); margin-bottom: 8px;
}
.pub-cal-dep-time { font-size: 0.85rem; font-weight: 700; }
.pub-cal-dep-status { font-size: 0.78rem; margin-top: 2px; color: var(--muted); }
.pub-cal-dep-low { background: var(--warn-bg); border-left-color: var(--warn-fg); }
.pub-cal-dep-low .pub-cal-dep-status { color: var(--warn-fg); font-weight: 700; }
.pub-cal-dep-full { background: var(--err-bg); border-left-color: var(--err-fg); }
.pub-cal-dep-full .pub-cal-dep-status { color: var(--err-fg); }
.cal-cap-form { margin-top: 4px; display: flex; gap: 3px; justify-content: center; }
.cal-cap-form input {
  width: 56px; text-align: center; font: inherit; font-weight: 700; padding: 3px 4px;
  border: 1px solid var(--line); border-radius: 6px; background: #fff; color: var(--brand-strong);
}
.cal-cap-save {
  width: 24px; padding: 0; border-radius: 6px; border: 1px solid var(--line); background: #fff;
  color: var(--brand-text); font-weight: 700; cursor: pointer; line-height: 1;
}
.cal-cap-save:hover { background: var(--brand-tint); }
.color-swatch { display: inline-block; width: 16px; height: 16px; border-radius: 4px; vertical-align: middle; border: 1px solid rgba(16,32,44,0.15); }

/* ---- Check-in ---- */
.checkin-table td { vertical-align: middle; }
.checkin-toggle-form { margin: 0; }
.checkin-toggle-form .checkbox-label { font-weight: 400 !important; white-space: nowrap; font-size: 1.25rem; gap: 12px !important; padding: 6px 0; }
.checkin-toggle-form input[type="checkbox"] { width: 28px; height: 28px; accent-color: var(--brand); cursor: pointer; }
tr.checkin-row-done { background: #e9edee; }
tr.checkin-row-done td { color: var(--muted); }

/* ---- Login ---- */
.login-main { max-width: 420px; padding-top: 60px; }
.login-box { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 26px; }

@media (max-width: 760px) {
  .admin-shell { flex-direction: column; }
  .admin-sidebar { width: auto; flex: none; flex-direction: row; align-items: center; flex-wrap: wrap; }
  .admin-nav { flex-direction: row; flex-wrap: wrap; }
  .admin-sidebar-footer { flex-direction: row; margin-left: auto; }
  .admin-content { padding: 18px; }
  .departure-row { flex-direction: column; align-items: flex-start; }
  .admin-table, .details-table { display: block; overflow-x: auto; -webkit-overflow-scrolling: touch; }
}
