:root {
  --bg: #f6f5f2;
  --surface: #ffffff;
  --border: #e4e1d8;
  --border-strong: #cdc9bb;
  --text: #232220;
  --text-secondary: #6e6c63;
  --text-tertiary: #9c9a8f;
  --accent: #185fa5;
  --accent-bg: #e6f1fb;
  --danger: #a32d2d;
  --radius-md: 8px;
  --radius-lg: 12px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}
* { box-sizing: border-box; }
body { margin: 0; font-family: var(--font); color: var(--text); background: var(--bg); font-size: 15px; line-height: 1.6; }
a { color: var(--accent); text-decoration: none; }
h1, h2, h3 { font-weight: 500; margin: 0 0 0.5rem; }
h1 { font-size: 22px; }
h2 { font-size: 18px; }
h3 { font-size: 16px; }

.topbar { display: flex; align-items: center; justify-content: space-between; padding: 14px 32px; background: var(--surface); border-bottom: 1px solid var(--border); position: relative; gap: 16px; }
.brand { font-weight: 500; font-size: 16px; white-space: nowrap; }
.menu-toggle { display: none; background: none; border: 1px solid var(--border-strong); border-radius: var(--radius-md); padding: 7px 9px; cursor: pointer; color: var(--text); align-items: center; }
.topbar nav { display: flex; gap: 18px; flex-wrap: wrap; flex: 1; }
.topbar-right { display: flex; align-items: center; gap: 10px; white-space: nowrap; margin-right: 14px; padding-right: 14px; border-right: 1px solid var(--border); }

.app-shell { display: flex; align-items: flex-start; }
.sidebar { width: 200px; flex-shrink: 0; display: flex; flex-direction: column; gap: 2px; padding: 24px 12px; position: sticky; top: 0; }
.sidebar a, .sidebar .disabled { padding: 9px 14px; border-radius: var(--radius-md); font-size: 14px; color: var(--text); text-decoration: none; }
.sidebar a.active { background: var(--accent-bg); color: var(--accent); font-weight: 500; }
.sidebar a:not(.active):hover { background: var(--bg); }
.sidebar .disabled { color: var(--text-tertiary); cursor: not-allowed; }
.sidebar-divider { height: 1px; background: var(--border); margin: 10px 14px; }
.app-shell .page { flex: 1; min-width: 0; }

.site-footer { border-top: 1px solid var(--border); background: var(--surface); padding: 20px 32px; margin-top: 40px; }
.site-footer-inner { font-size: 13px; color: var(--text-secondary); line-height: 1.7; max-width: 920px; }
.site-footer-inner strong { color: var(--text); font-size: 14px; }
.site-footer-contact { display: inline-block; margin-top: 4px; }
.user-name { font-size: 13px; color: var(--text-secondary); }
.topbar nav a { color: var(--text); font-size: 14px; padding: 6px 0; border-bottom: 2px solid transparent; }
.topbar nav a.active { border-bottom-color: var(--accent); color: var(--accent); }
.topbar nav .disabled { color: var(--text-tertiary); font-size: 14px; cursor: default; }

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

.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 18px 20px; }
.section-label { font-size: 13px; color: var(--text-secondary); margin-bottom: 8px; font-weight: 500; }
.mini-label { font-size: 12px; color: var(--text-secondary); display: block; margin-bottom: 3px; }
.text-secondary { color: var(--text-secondary); font-size: 13px; }

.field-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; }
.dyn-row { display: flex; align-items: center; gap: 6px; margin-bottom: 6px; flex-wrap: wrap; }

/* Compact single-row editable tables (transfers, meals, extras, room rates, child bands).
   Each item stays on ONE horizontal line - on narrow screens the table scrolls
   sideways inside .table-scroll instead of each field wrapping onto its own line. */
.edit-table { width: 100%; border-collapse: collapse; min-width: 640px; }
.edit-table th { text-align: left; font-size: 11px; color: var(--text-secondary); font-weight: 500; padding: 0 6px 6px; white-space: nowrap; }
.edit-table td { padding: 3px 6px; vertical-align: middle; white-space: nowrap; }
.edit-table tr.edit-row { border-bottom: 1px solid var(--border); }
.edit-table tr.edit-row:hover { background: var(--bg); }
.edit-table input[type=text], .edit-table input[type=number], .edit-table input[type=date], .edit-table select {
  height: 32px; padding: 0 8px; font-size: 12.5px; min-width: 0;
}
.edit-table .c-name   { width: 160px; }
.edit-table .c-date   { width: 128px; }
.edit-table .c-num-sm { width: 58px; }
.edit-table .c-num-md { width: 80px; }
.edit-table .c-select { width: 112px; }
.edit-table .c-remove { width: 32px; text-align: center; position: sticky; right: 0; background: var(--surface); box-shadow: -6px 0 6px -6px rgba(0,0,0,0.12); }
.edit-table tr.edit-row:hover td.c-remove { background: var(--bg); }
.edit-table th.c-remove { background: var(--surface); }
.edit-table .col-hint { font-size: 10.5px; color: var(--text-tertiary); font-weight: 400; }

input[type=text], input[type=number], input[type=date], input[type=email], select {
  height: 36px; padding: 0 10px; border: 1px solid var(--border-strong); border-radius: var(--radius-md);
  font-size: 13px; font-family: inherit; background: var(--surface); color: var(--text); width: 100%;
}
textarea {
  padding: 8px 10px; border: 1px solid var(--border-strong); border-radius: var(--radius-md);
  font-size: 13px; font-family: inherit; background: var(--surface); color: var(--text); width: 100%; resize: vertical;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-bg); }

.btn { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--radius-md); padding: 7px 14px; cursor: pointer; color: var(--text); }
.btn:hover { background: var(--bg); }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-primary:hover { background: #0c447c; }
.btn-danger { color: var(--danger); }
.btn-voucher { color: #c0392b; border-color: #c0392b; font-weight: 700; }
.btn-voucher:hover { background: #fdf0ef; }
.add-btn { font-size: 13px; background: none; border: 1px solid var(--border-strong); border-radius: var(--radius-md); padding: 5px 10px; cursor: pointer; color: var(--text); display: inline-flex; align-items: center; gap: 5px; }
.add-btn:hover { background: var(--bg); }
.remove-btn { background: none; border: none; color: var(--text-tertiary); cursor: pointer; padding: 4px; display: inline-flex; align-items: center; }
.remove-btn:hover { color: var(--danger); }

.cat-header { display: flex; align-items: center; gap: 10px; cursor: pointer; }
.thumb { width: 40px; height: 40px; border-radius: var(--radius-md); background: var(--bg); display: flex; align-items: center; justify-content: center; color: var(--text-tertiary); flex-shrink: 0; }
.badge { font-size: 11px; padding: 2px 8px; border-radius: var(--radius-md); background: var(--bg); color: var(--text-secondary); border: 1px solid var(--border); white-space: nowrap; display: inline-block; }
.status-approved { background: #e7f5ea; color: #1f7a3d; border-color: #cbe9d2; }
.status-not_approved { background: #fbe9e9; color: #a32d2d; border-color: #f3cfcf; }
.status-awaiting { background: #fdf2e0; color: #9a6a17; border-color: #f6e1b8; }
.status-archive { background: #ececec; color: #6e6c63; border-color: #dcdcdc; }
.status-quick-select { padding: 5px 10px; border-radius: var(--radius-md); font-size: 12px; font-weight: 500; border: 1px solid; cursor: pointer; }
.status-quick-select:disabled { cursor: not-allowed; opacity: 0.7; }
.table-scroll { overflow-x: auto; }
.amenity-tag { font-size: 12px; padding: 3px 8px; border-radius: var(--radius-md); background: var(--bg); color: var(--text-secondary); display: inline-flex; align-items: center; margin: 0 4px 4px 0; }

.data-table { width: 100%; border-collapse: collapse; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); overflow: hidden; }
.data-table th, .data-table td { text-align: left; padding: 14px 18px; border-bottom: 1px solid var(--border); font-size: 14px; white-space: nowrap; }
.data-table th { font-size: 12px; color: var(--text-secondary); font-weight: 500; }
.data-table tr:last-child td { border-bottom: none; }
.data-table td::before { content: none; }
.data-table th:last-child, .data-table td:last-child { position: sticky; right: 0; background: var(--surface); box-shadow: -6px 0 6px -6px rgba(0,0,0,0.12); }
.data-table tr:hover td:last-child { background: var(--bg); }

.alert { background: var(--accent-bg); color: #0c447c; padding: 10px 14px; border-radius: var(--radius-md); margin-bottom: 16px; font-size: 13px; }
.alert-danger { background: #fbe9e9; color: #a32d2d; }
.alert-success { background: #e7f5ea; color: #1f7a3d; }
.empty-state { color: var(--text-secondary); }
.back-link { font-size: 13px; color: var(--text-secondary); }

/* Login page */
.login-wrap { min-height: 100vh; display: flex; }
.login-hero {
  flex: 1.1; background: linear-gradient(160deg, #0c3a63 0%, #185fa5 45%, #2f9bb0 100%);
  position: relative; overflow: hidden; display: flex; align-items: flex-end; padding: 48px;
}
.login-hero svg { position: absolute; top: 0; left: 0; width: 100%; height: 100%; opacity: 0.5; }
.login-hero-text { position: relative; color: #fff; max-width: 360px; }
.login-hero-text h2 { color: #fff; font-size: 24px; }
.login-hero-text p { color: rgba(255,255,255,0.85); font-size: 14px; margin: 0; }
.login-panel { flex: 1; display: flex; align-items: center; justify-content: center; padding: 32px; background: var(--bg); }
.login-card { width: 100%; max-width: 380px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 32px 28px; }
.login-card .logo { font-weight: 600; font-size: 18px; margin-bottom: 4px; }
.login-card .tagline { color: var(--text-secondary); font-size: 13px; margin-bottom: 24px; }
.login-card label { font-size: 13px; color: var(--text-secondary); display: block; margin: 14px 0 4px; }
.login-card .btn-primary { width: 100%; justify-content: center; padding: 10px; margin-top: 18px; }
.login-links { margin-top: 18px; text-align: center; font-size: 13px; color: var(--text-secondary); }
.login-links a { display: block; margin-top: 8px; }

/* Permissions matrix */
.perm-table { width: 100%; border-collapse: collapse; background: var(--surface); }
.perm-table th, .perm-table td { padding: 10px 12px; text-align: center; border-bottom: 1px solid var(--border); font-size: 13px; white-space: nowrap; }
.perm-table th { font-size: 12px; color: var(--text-secondary); font-weight: 500; }
.perm-table td:first-child, .perm-table th:first-child { text-align: left; white-space: normal; min-width: 200px; }
.perm-toggle { border: none; border-radius: 999px; padding: 5px 12px; font-size: 12px; cursor: pointer; min-width: 92px; }
.perm-toggle.state-allowed { background: #e7f5ea; color: #1f7a3d; }
.perm-toggle.state-not_allowed { background: #fdf2e0; color: #9a6a17; }
.perm-toggle.state-forbidden { background: #fbe9e9; color: #a32d2d; }
.perm-toggle.locked { cursor: default; opacity: 0.85; }
.perm-legend { display: flex; gap: 16px; flex-wrap: wrap; margin-bottom: 14px; font-size: 12px; color: var(--text-secondary); align-items: center; }
.perm-legend span { display: inline-flex; align-items: center; gap: 6px; }
.perm-legend .dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }

/* Fixed-column info grids on the booking view page - explicit column counts
   instead of auto-fit, so an item count that doesn't fill the last row never
   leaves a half-empty trailing row of white space. */
.view-grid-4 { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 10px; margin-bottom: 16px; }
.view-grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 10px; }

@media (max-width: 720px) {
  .view-grid-4, .view-grid-3 { grid-template-columns: repeat(2, minmax(0,1fr)); }
}
@media (max-width: 480px) {
  .view-grid-4, .view-grid-3 { grid-template-columns: 1fr; }
}

@media (max-width: 720px) {
  .menu-toggle { display: inline-flex; }
  .topbar-right { margin-right: 0; padding-right: 0; border-right: none; }
  .app-shell { flex-direction: column; }
  .sidebar {
    width: 100%; flex-direction: row; overflow-x: auto; position: static;
    padding: 10px 12px; border-bottom: 1px solid var(--border); gap: 6px;
  }
  .sidebar a, .sidebar .disabled { white-space: nowrap; flex-shrink: 0; }
  .sidebar-divider { width: 1px; height: 22px; margin: 0 4px; flex-shrink: 0; }
  .topbar nav {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    flex-direction: column;
    gap: 0;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.06);
    z-index: 20;
  }
  .topbar nav.open { display: flex; }
  .topbar nav a, .topbar nav .disabled { padding: 12px 20px; border-bottom: 1px solid var(--border); }
  .topbar nav a:last-child, .topbar nav .disabled:last-child { border-bottom: none; }
  .user-name { display: none; }

  .page { padding: 18px 16px 60px; }
  .card { padding: 14px 16px; }

  .btn, .add-btn { padding: 9px 14px; }
  .remove-btn { padding: 8px; }

  .data-table thead { display: none; }
  .data-table, .data-table tbody, .data-table tr, .data-table td { display: block; width: 100%; }
  .data-table { border: none; }
  .data-table tr { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 12px 16px; margin-bottom: 10px; }
  .data-table td { border-bottom: none; padding: 6px 0; white-space: normal; position: static; box-shadow: none; }
  .data-table td::before { content: attr(data-label); display: block; font-size: 11px; color: var(--text-secondary); font-weight: 500; margin-bottom: 2px; }
  .data-table td[data-label="Actions"] { white-space: normal !important; margin-top: 8px; }

  .login-wrap { flex-direction: column; min-height: auto; }
  .login-hero { flex: none; padding: 28px; min-height: 160px; align-items: center; justify-content: center; text-align: center; }
  .login-hero-text { max-width: none; }
  .login-panel { padding: 24px 16px 48px; }
}


