@import url('https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@500;600;700&family=Inter:wght@400;500;600;700&family=IBM+Plex+Mono:wght@500&display=swap');

:root {
  --ink: #16211f;
  --paper: #f5f3ee;
  --panel: #ffffff;
  --line: #e1ddd2;
  --accent: #21665b;
  --accent-dark: #1a534a;
  --accent-soft: #dfeae7;
  --gold: #c98a2c;
  --danger: #b5432f;
  --danger-soft: #f6e0da;
  --muted: #6f7772;
  --held: #9c7a2c;
  --held-soft: #fbf3e2;
  --radius: 10px;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: 'Inter', system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3, .display { font-family: 'Space Grotesk', 'Inter', sans-serif; letter-spacing: -0.01em; margin: 0; }
h1.display { font-size: 26px; }
h2 { font-size: 19px; }
h3 { font-size: 16px; }
.mono { font-family: 'IBM Plex Mono', monospace; }
.muted { color: var(--muted); font-size: 13px; }
.small-text { font-size: 12px; }

button, .btn-link {
  font-family: inherit; cursor: pointer; border: none; border-radius: 8px;
  padding: 10px 16px; font-weight: 600; font-size: 14px; text-decoration: none;
  display: inline-block; transition: transform .08s ease, opacity .15s ease;
}
button:active { transform: scale(.97); }
button:disabled { opacity: .5; cursor: not-allowed; }
.small { padding: 5px 11px; font-size: 12px; }
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover:not(:disabled) { background: var(--accent-dark); }
.btn-secondary { background: var(--panel); color: var(--ink); border: 1px solid var(--line); }
.btn-secondary:hover:not(:disabled) { background: var(--accent-soft); }
.btn-danger { background: var(--danger-soft); color: var(--danger); }

input, select {
  font-family: inherit; font-size: 14px; padding: 10px 12px; border-radius: 8px;
  border: 1px solid var(--line); background: #fff; color: var(--ink); width: 100%;
}
input:focus, select:focus, button:focus-visible, a:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
label { font-size: 12px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; display: block; margin-bottom: 6px; }
.field { margin-bottom: 14px; }

/* Layout */
.app-shell { min-height: 100vh; display: flex; }
.sidebar { width: 220px; flex-shrink: 0; background: var(--ink); color: #f5f3ee; padding: 24px 16px; display: flex; flex-direction: column; gap: 4px; }
.sidebar .brand { font-size: 21px; font-weight: 700; margin-bottom: 26px; font-family: 'Space Grotesk', sans-serif; padding-left: 10px; }
.sidebar .brand span { color: var(--gold); }
.sidebar nav { display: flex; flex-direction: column; gap: 2px; }
.sidebar nav a { color: #cdd4d1; text-decoration: none; padding: 10px 12px; border-radius: 8px; font-weight: 500; font-size: 14px; }
.sidebar nav a:hover { background: rgba(255,255,255,.06); }
.sidebar nav a.active { background: rgba(255,255,255,.12); color: #fff; }
.sidebar .who { margin-top: auto; font-size: 12px; color: #8f9793; border-top: 1px solid #2a332f; padding-top: 14px; }
.sidebar .who strong { color: #fff; }
.sidebar .logout { background: transparent; color: #e2b0a4; padding: 8px 0; margin-top: 6px; }
.main { flex: 1; min-width: 0; padding: 32px 40px; max-width: 1180px; }

.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; }
.grid { display: grid; gap: 16px; }
.grid-3 { grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); }
.grid-2 { grid-template-columns: 1fr 1fr; }
.section-title { font-size: 12px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); margin: 0 0 12px; }
.room-group { margin-bottom: 26px; }
h3.section-title:not(:first-child) { margin-top: 32px; }

/* Room tiles */
.room-tile { border-radius: var(--radius); padding: 16px; border: 1px solid var(--line); background: var(--panel); text-align: left; display: flex; flex-direction: column; gap: 5px; color: inherit; }
.room-tile strong { font-size: 16px; }
.room-tile .price { font-size: 15px; font-weight: 600; }
.room-tile:hover:not(:disabled) { box-shadow: 0 2px 10px rgba(22,33,31,.1); }
.room-tile.available { border-color: var(--accent); }
.room-tile.held { border-color: var(--held); background: var(--held-soft); opacity: 1; }
.room-tile.booked { background: #f1efe9; }
.room-tile.overstay { border-color: var(--danger); background: var(--danger-soft); }
.room-tile.maintenance { border-color: var(--line); background: #ece9e1; opacity: .7; }
.tile-note { font-size: 12px; color: var(--muted); }
.tile-note.danger { color: var(--danger); font-weight: 700; }
.tile-note.link { color: var(--accent); font-weight: 600; }

.pill { display: inline-flex; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; padding: 3px 9px; border-radius: 999px; width: fit-content; }
.pill.available, .pill.paid { background: var(--accent-soft); color: var(--accent); }
.pill.held, .pill.pending { background: var(--held-soft); color: var(--held); }
.pill.booked, .pill.cancelled { background: #e5e2d9; color: var(--muted); }
.pill.maintenance { background: #e5e2d9; color: var(--muted); }
.pill.failed { background: var(--danger-soft); color: var(--danger); }

/* Modal */
.modal-backdrop { position: fixed; inset: 0; background: rgba(22,33,31,.5); display: flex; align-items: center; justify-content: center; z-index: 50; padding: 16px; }
.modal { background: #fff; border-radius: 14px; padding: 26px; width: 100%; max-width: 400px; box-shadow: 0 20px 60px rgba(0,0,0,.25); }
.modal .row { display: flex; gap: 10px; margin-top: 18px; }
.modal .row button { flex: 1; }
.status-line { display: flex; align-items: center; gap: 10px; padding: 14px 0 4px; font-size: 14px; }
.spinner { width: 18px; height: 18px; border-radius: 50%; border: 2px solid var(--accent-soft); border-top-color: var(--accent); animation: spin .8s linear infinite; flex-shrink: 0; }
@keyframes spin { to { transform: rotate(360deg); } }
.warn-box { background: var(--danger-soft); color: var(--danger); border-radius: 8px; padding: 12px 14px; margin-bottom: 14px; font-size: 14px; }

/* Tables & stats */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th { text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); padding: 8px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
td { padding: 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
td.actions { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.stat-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 16px; margin-bottom: 24px; }
.stat-box { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 22px; }
.stat-box .num { font-size: 26px; font-weight: 700; font-family: 'Space Grotesk', sans-serif; }
.stat-box .label { font-size: 12px; color: var(--muted); margin-top: 4px; }

/* Forms */
.inline-form { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.inline-form input, .inline-form select { width: auto; min-width: 120px; flex: 1; }
.room-form { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; align-items: end; }
.form-actions { display: flex; gap: 8px; }
.plain-list { list-style: none; margin: 0; padding: 0; font-size: 14px; }
.plain-list li { display: flex; justify-content: space-between; align-items: center; padding: 7px 0; border-bottom: 1px solid var(--line); }

/* Banners */
.error-banner { background: var(--danger-soft); color: var(--danger); padding: 10px 14px; border-radius: 8px; font-size: 13px; margin-bottom: 16px; }
.ok-banner { background: var(--accent-soft); color: var(--accent); padding: 10px 14px; border-radius: 8px; font-size: 13px; margin-bottom: 16px; }
.empty-state { color: var(--muted); font-size: 14px; padding: 20px; text-align: center; }

/* Trend bars */
.bars { display: flex; align-items: flex-end; gap: 4px; height: 110px; }
.bar-col { flex: 1; height: 100%; display: flex; align-items: flex-end; }
.bar { width: 100%; background: #b9cfca; border-radius: 3px 3px 0 0; }
.bar.on { background: var(--accent); }
.bar-axis { display: flex; justify-content: space-between; font-size: 11px; color: var(--muted); margin-top: 6px; }

/* Login */
.login-body { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: var(--ink); padding: 16px; }
.login-card { width: 100%; max-width: 360px; padding: 28px; }

@media (max-width: 820px) {
  .app-shell { flex-direction: column; }
  .sidebar { width: auto; flex-direction: row; align-items: center; flex-wrap: wrap; padding: 12px 14px; gap: 8px; }
  .sidebar .brand { margin: 0 10px 0 0; padding: 0; }
  .sidebar nav { flex-direction: row; flex-wrap: wrap; }
  .sidebar .who { margin: 0 0 0 auto; border: 0; padding: 0; }
  .main { padding: 20px 16px; }
  .grid-2 { grid-template-columns: 1fr; }
}
