:root {
  --bg: #f4f6f8;
  --panel-bg: #ffffff;
  --border: #dde3e8;
  --text: #1f2933;
  --muted: #667380;
  --brand: #1f4e5f;
  --brand-light: #e6eef0;
  --ok: #1a7f4b;
  --ok-bg: #e5f6ec;
  --off-bg: #eceff1;
  --off: #5b6673;
  --error: #b3261e;
  --error-bg: #fbe7e5;

  /* Semantic accents — related to but distinct from the public site's warm
     green (hugo-site) and the guest portal's warm palette. Used by meaning,
     not decoration: gold for money, green for people, teal stays technical. */
  --money: #a8721c;
  --money-bg: #fbf1de;
  --people: #2f6f4f;
  --people-bg: #e7f2ec;
}

* { box-sizing: border-box; }

body {
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
  margin: 0;
  color: var(--text);
  background: var(--bg);
}

h1 { font-size: 1.6rem; margin: 0 0 0.25rem; }
h2 { font-size: 1.15rem; margin: 0 0 0.75rem; color: var(--brand); }

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

.muted { color: var(--muted); }

/* Layout */
.app-shell {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: 220px;
  flex: 0 0 220px;
  background: var(--brand);
  color: #fff;
  padding: 1.5rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.sidebar .brand {
  font-weight: 700;
  font-size: 1.1rem;
  letter-spacing: 0.02em;
}

.sidebar nav {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.sidebar nav a {
  color: #dde9ec;
  padding: 0.5rem 0.6rem;
  border-radius: 6px;
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.sidebar nav a i {
  width: 1.1em;
  text-align: center;
  opacity: 0.9;
}

.sidebar nav a:hover {
  background: rgba(255, 255, 255, 0.12);
  text-decoration: none;
}

.content {
  flex: 1;
  padding: 2rem 2.5rem;
  max-width: 1100px;
  min-width: 0;
}

/* Mobile off-canvas nav toggle — CSS-only checkbox pattern, no framework */
.nav-toggle { display: none; }
.nav-toggle-label {
  display: none;
  align-items: center;
  gap: 0.5rem;
  background: var(--brand);
  color: #fff;
  padding: 0.9rem 1rem;
  font-weight: 700;
  cursor: pointer;
}
.nav-toggle-label i { font-size: 1.1rem; }

@media (max-width: 768px) {
  .app-shell { flex-direction: column; }
  .nav-toggle-label { display: flex; }
  .sidebar {
    position: fixed;
    top: 0; left: 0; bottom: 0;
    width: 240px;
    flex: 0 0 auto;
    transform: translateX(-100%);
    transition: transform .2s ease;
    z-index: 100;
    overflow-y: auto;
    padding-top: 3.6rem;
  }
  .nav-toggle:checked ~ .sidebar {
    transform: translateX(0);
  }
  .nav-toggle:checked ~ .nav-backdrop {
    display: block;
  }
  .nav-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.35);
    z-index: 99;
  }
  .content { padding: 1rem; max-width: 100%; }

  .cards { grid-template-columns: 1fr; }

  .field-grid { grid-template-columns: 1fr; }
  form input, form select, form textarea { min-width: 0; width: 100%; }
  .field input, .field select, .field textarea { max-width: 100%; }
}

@media (min-width: 481px) and (max-width: 768px) {
  .cards { grid-template-columns: repeat(2, 1fr); }
}

/* Cards row */
.cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 1rem;
  margin: 1.5rem 0;
}

.card {
  background: var(--panel-bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1rem 1.2rem;
}

.card-value {
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--brand);
}

.card-label {
  color: var(--muted);
  font-size: 0.85rem;
  margin-top: 0.2rem;
}

.card-link {
  display: block;
  transition: border-color .15s ease, transform .15s ease;
}
.card-link:hover {
  text-decoration: none;
  border-color: var(--brand);
  transform: translateY(-1px);
}
.card-alert {
  border-color: var(--error);
  background: var(--error-bg);
}
.card-alert .card-value {
  color: var(--error);
}

/* Semantic card variants — meaning, not decoration */
.card-money {
  border-color: #eaceA0;
  background: var(--money-bg);
}
.card-money .card-value { color: var(--money); }

.card-people {
  border-color: #bfdccb;
  background: var(--people-bg);
}
.card-people .card-value { color: var(--people); }

.over-budget { color: var(--error); }

.inline-form {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  gap: 0.8rem;
  margin: 0;
}
.inline-form label {
  display: flex;
  flex-direction: column;
  font-size: 0.85rem;
  gap: 0.25rem;
  margin: 0;
}
.inline-form input, .inline-form select { min-width: 140px; }
.inline-form button { margin-top: 0; }

details {
  margin-top: 1rem;
  border-top: 1px solid var(--border);
  padding-top: 0.8rem;
}
details summary {
  cursor: pointer;
  color: var(--brand);
  font-weight: 600;
  margin-bottom: 0.6rem;
}

/* Panels */
.panel {
  background: var(--panel-bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1.25rem 1.5rem;
  margin-bottom: 1.5rem;
}

.empty-state {
  color: var(--muted);
  font-style: italic;
}

/* Tables */
.row-thumb {
  display: block;
  width: 44px;
  height: 44px;
  border-radius: 6px;
  background-size: cover;
  background-position: center;
  background-color: var(--off-bg);
}

.table-wrap { overflow-x: auto; margin: 0.5rem 0; }
.table-wrap table { margin: 0; }
table { border-collapse: collapse; width: 100%; margin: 0.5rem 0; }
th, td { border: 1px solid var(--border); padding: 0.5rem 0.7rem; text-align: left; font-size: 0.92rem; }
th { background: var(--brand-light); color: var(--brand); font-weight: 600; }
tr:nth-child(even) td { background: #fafcfd; }

/* Badges */
.badge {
  display: inline-block;
  padding: 0.15rem 0.55rem;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 600;
}
.badge-ok { background: var(--ok-bg); color: var(--ok); }
.badge-off { background: var(--off-bg); color: var(--off); }
.badge-error { background: var(--error-bg); color: var(--error); }

/* Forms */
fieldset { border: 1px solid var(--border); border-radius: 10px; margin-bottom: 1.25rem; padding: 1.1rem 1.3rem 1.3rem; background: #fbfcfd; }
fieldset:last-of-type { margin-bottom: 0; }
legend { padding: 0 0.5rem; color: var(--brand); font-weight: 700; font-size: 0.95rem; }
form label { display: block; margin: 0.5rem 0; font-size: 0.92rem; }
form input, form select, form textarea {
  padding: 0.45rem 0.6rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  min-width: 200px;
  font: inherit;
  background: #fff;
  transition: border-color .15s ease, box-shadow .15s ease;
}
form input:focus, form select:focus, form textarea:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px var(--brand-light);
}
form textarea { min-width: 100%; max-width: 100%; }

/* Field groups: a labelled control plus optional helper/hint text underneath */
.field { margin: 0.9rem 0; }
.field:first-child { margin-top: 0; }
.field label,
.field > .field-label {
  display: block;
  font-weight: 600;
  font-size: 0.88rem;
  margin-bottom: 0.3rem;
  color: var(--text);
}
.field input, .field select, .field textarea { width: 100%; max-width: 340px; }
.field input[type="checkbox"] { width: auto; max-width: none; }
.field-wide input, .field-wide select, .field-wide textarea { max-width: 100%; }
.field-hint { display: block; color: var(--muted); font-size: 0.8rem; margin-top: 0.3rem; }

.field-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 0.4rem 1.2rem;
}
.field-grid .field { margin: 0.5rem 0; }
.field-grid .field input, .field-grid .field select { max-width: none; }

.checkbox-field { display: flex; align-items: flex-start; gap: 0.5rem; font-weight: 500; }
.checkbox-field input { margin-top: 0.2rem; }

/* Checkbox/tag grids (amenities, tags) */
.check-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 0.5rem 1rem;
}
.check-item {
  display: block;
  padding: 0.5rem 0.6rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
  font-size: 0.9rem;
  cursor: pointer;
}
.check-item input[type="checkbox"] { vertical-align: top; margin: 0.15rem 0.5rem 0 0; }
.check-label { display: inline; }
.check-item:has(input:checked) { border-color: var(--brand); background: var(--brand-light); }

button, .btn {
  margin-top: 0.9rem;
  padding: 0.6rem 1.3rem;
  background: var(--brand);
  color: #fff;
  border: none;
  border-radius: 7px;
  cursor: pointer;
  font-size: 0.92rem;
  font-weight: 600;
  transition: background .15s ease, transform .1s ease;
}
button:hover, .btn:hover { background: #163b48; }
button:active, .btn:active { transform: translateY(1px); }

.btn-secondary {
  background: #fff;
  color: var(--brand);
  border: 1px solid var(--border);
}
.btn-secondary:hover { background: var(--brand-light); }

.btn-danger {
  background: var(--error-bg);
  color: var(--error);
  border: 1px solid #f3c8c4;
}
.btn-danger:hover { background: #f7d6d3; }

.btn-small { margin-top: 0; padding: 0.35rem 0.75rem; font-size: 0.82rem; }

.form-actions { margin-top: 1.3rem; display: flex; gap: 0.7rem; align-items: center; }

section.panel ul, section.panel ol { padding-left: 1.3rem; }
section.panel li { margin-bottom: 0.4rem; }

/* Customer communication thread (mirrors the guest portal message list) */
.messages { display: flex; flex-direction: column; gap: 0.6rem; margin: 0.75rem 0; }
.message { border-radius: 8px; padding: 0.6rem 0.9rem; max-width: 70%; }
.message-guest { background: var(--off-bg); align-self: flex-start; }
.message-concierge { background: var(--brand-light); align-self: flex-end; }
.message-meta { display: flex; justify-content: space-between; gap: 1rem; font-size: 0.78rem; color: var(--muted); margin-bottom: 0.2rem; }
.message-body { white-space: pre-wrap; }
