:root {
  color-scheme: light;
  --brand-navy: #002d71;        /* Sokn Camping brand blue */
  --brand-navy-hover: #001f4d;
  --surface-1: #ffffff;
  --page-plane: #f4f5f7;        /* light grey */
  --text-primary: #12181f;
  --text-secondary: #57626e;
  --text-muted: #8b93a0;
  --gridline: #e2e5ea;
  --baseline: #c7ccd3;
  --border: rgba(0, 45, 113, 0.12);
  --series-gomarina: #002d71;   /* brand blue */
  --series-reception: #eb6834;  /* warm accent, kept for at-a-glance contrast with GoMarina */
  --status-good: #0ca30c;
  --status-warning: #fab219;
  --status-critical: #d03b3b;
  --success-text: #006300;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
  background: var(--page-plane);
  color: var(--text-primary);
  font-size: 15px;
}

a { color: var(--brand-navy); text-decoration: none; }
a:hover { text-decoration: underline; }

header.topbar {
  background: var(--surface-1);
  border-bottom: 1px solid var(--gridline);
  padding: 12px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px 16px;
}

header.topbar .brand {
  display: flex;
  align-items: center;
  gap: 10px;
}

header.topbar .brand img {
  height: 34px;
  width: auto;
  display: block;
}

header.topbar h1 {
  font-size: 16px;
  font-weight: 600;
  margin: 0;
  color: var(--brand-navy);
}

header.topbar nav {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px 16px;
}

header.topbar nav a {
  color: var(--text-secondary);
  font-weight: 500;
  font-size: 14px;
  white-space: nowrap;
}
header.topbar nav a.primary {
  color: #fff;
  background: var(--brand-navy);
  padding: 8px 14px;
  border-radius: 6px;
}
header.topbar nav a.primary:hover { text-decoration: none; background: var(--brand-navy-hover); }

main {
  max-width: 1180px;
  margin: 0 auto;
  padding: 24px;
}

.stat-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
  margin-bottom: 24px;
}

.stat-tile {
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px 16px;
}

.stat-tile .label {
  color: var(--text-secondary);
  font-size: 12.5px;
  margin-bottom: 6px;
}

.stat-tile .value {
  font-size: 26px;
  font-weight: 600;
  font-variant-numeric: proportional-nums;
}

.stat-tile .sub {
  color: var(--text-muted);
  font-size: 12px;
  margin-top: 4px;
}

.filters {
  display: flex;
  gap: 10px;
  align-items: center;
  margin-bottom: 14px;
  flex-wrap: wrap;
}

.filters select, .filters input[type="text"] {
  padding: 7px 10px;
  border: 1px solid var(--gridline);
  border-radius: 6px;
  background: var(--surface-1);
  font-size: 14px;
  color: var(--text-primary);
}

.filters input[type="text"] { min-width: 220px; }

table {
  width: 100%;
  border-collapse: collapse;
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
}

thead th {
  text-align: left;
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  padding: 10px 12px;
  border-bottom: 1px solid var(--gridline);
}

tbody td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--gridline);
  font-size: 14px;
  vertical-align: middle;
}

tbody tr:last-child td { border-bottom: none; }
tbody tr:hover { background: rgba(11,11,11,0.02); }

td.amount, th.amount { text-align: right; font-variant-numeric: tabular-nums; }

.dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex: none;
}
.dot.gomarina { background: var(--series-gomarina); }
.dot.reception { background: var(--series-reception); }

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12.5px;
  color: var(--text-secondary);
  white-space: nowrap;
}

.status {
  font-size: 12.5px;
  font-weight: 600;
}
.status.paid { color: var(--status-good); }
.status.unpaid { color: var(--status-critical); }
.status.partial { color: #a86a00; }

.legend {
  display: flex;
  gap: 18px;
  margin-bottom: 12px;
  font-size: 13px;
  color: var(--text-secondary);
}
.legend .item { display: flex; align-items: center; gap: 6px; }

form.card, .card {
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 20px;
  max-width: 640px;
}

.field { margin-bottom: 14px; }
.field label { display: block; font-size: 13px; color: var(--text-secondary); margin-bottom: 5px; font-weight: 500; }
.field input, .field select, .field textarea {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid var(--gridline);
  border-radius: 6px;
  font-size: 14px;
  font-family: inherit;
  color: var(--text-primary);
  background: #fff;
}
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

.field input:focus, .field select:focus, .field textarea:focus,
.filters select:focus, .filters input:focus {
  outline: 2px solid var(--brand-navy);
  outline-offset: 1px;
  border-color: var(--brand-navy);
}

button, .btn {
  background: var(--brand-navy);
  color: #fff;
  border: none;
  padding: 9px 16px;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}
button:hover, .btn:hover { background: var(--brand-navy-hover); }
button.secondary, .btn.secondary {
  background: transparent;
  color: var(--text-secondary);
  border: 1px solid var(--gridline);
}
button.secondary:hover, .btn.secondary:hover { background: var(--page-plane); }
button.danger { background: var(--status-critical); }

.actions-row { display: flex; gap: 8px; margin-top: 16px; }

.hint {
  color: var(--text-muted);
  font-size: 13px;
  line-height: 1.5;
  margin: 6px 0 18px;
}

.empty-state {
  padding: 40px 20px;
  text-align: center;
  color: var(--text-muted);
}

table.mapping-table { margin-bottom: 20px; }
table.mapping-table th, table.mapping-table td { font-size: 13px; }
.mapping-table select { font-size: 13px; padding: 5px 6px; }

.actions a, .actions form { display: inline; }
.actions button.link {
  background: none;
  border: none;
  color: var(--text-secondary);
  padding: 0;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
}
.actions button.link:hover { color: var(--brand-navy); text-decoration: underline; }
.actions span.sep { color: var(--gridline); margin: 0 6px; }

/* ----------------------------- Responsive ----------------------------- */

@media (max-width: 720px) {
  main { padding: 16px; }

  /* Header: brand on its own row, nav links wrap below it instead of
     squeezing onto one line or overlapping the "add guest" button. */
  header.topbar {
    padding: 12px 16px;
    justify-content: center;
  }
  header.topbar .brand { width: 100%; justify-content: center; }
  header.topbar nav {
    width: 100%;
    justify-content: center;
  }
  header.topbar nav a.primary {
    order: -1;
    flex: 1 1 100%;
    text-align: center;
    padding: 10px 14px;
  }

  /* Forms: two-column rows become one column so fields have room. */
  .field-row { grid-template-columns: 1fr; gap: 0; }

  /* Stat tiles: two per row instead of a tight auto-fit squeeze. */
  .stat-row { grid-template-columns: repeat(2, 1fr); }

  .filters { justify-content: stretch; }
  .filters select, .filters input[type="text"] { flex: 1 1 auto; }
}

@media (max-width: 480px) {
  .stat-row { grid-template-columns: 1fr; }
}

/* Guest table -> stacked cards on narrow screens. Each row becomes a small
   card; each cell's field name (from data-label) is printed to its left. */
@media (max-width: 720px) {
  table.guest-table, table.guest-table thead, table.guest-table tbody,
  table.guest-table th, table.guest-table td, table.guest-table tr {
    display: block;
  }
  table.guest-table { border: none; background: transparent; }
  table.guest-table thead {
    position: absolute;
    width: 1px; height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
  }
  table.guest-table tbody tr {
    background: var(--surface-1);
    border: 1px solid var(--border);
    border-radius: 10px;
    margin-bottom: 10px;
    padding: 4px 14px;
  }
  table.guest-table tbody tr:hover { background: var(--surface-1); }
  table.guest-table tbody td {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    border-bottom: 1px solid var(--gridline);
    padding: 9px 0;
    text-align: right;
  }
  table.guest-table tbody td:last-child { border-bottom: none; }
  table.guest-table tbody td::before {
    content: attr(data-label);
    font-size: 11.5px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.02em;
    text-align: left;
    flex: none;
  }
  table.guest-table tbody td.actions {
    justify-content: center;
    padding-top: 12px;
  }
  table.guest-table tbody td.actions::before { content: none; }
}
