/* =============================================================================
   Base theme
   ============================================================================= */
:root {
    --background: #f4f6f9;
    --surface: #ffffff;
    --surface-soft: #f8fafc;
    --text: #172033;
    --muted: #637083;
    --border: #dce2ea;
    --primary: #214d9a;
    --primary-dark: #183c79;
    --danger: #a62c36;
    --danger-dark: #81212a;
    --success: #147a54;
    --warning: #805c09;
    --shadow: 0 12px 32px rgba(25, 42, 70, 0.08);
    --radius: 14px;
}

* { box-sizing: border-box; }

html { min-height: 100%; }

body {
    margin: 0;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    background: var(--background);
    color: var(--text);
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    line-height: 1.55;
}

a { color: var(--primary); }
a:hover { color: var(--primary-dark); }

h1, h2, h3 { line-height: 1.2; margin-top: 0; }
h1 { font-size: clamp(1.8rem, 4vw, 2.65rem); margin-bottom: .55rem; }
h2 { font-size: 1.35rem; margin-bottom: .55rem; }
p { margin-top: 0; }
code { overflow-wrap: anywhere; }

.container {
    width: min(1180px, calc(100% - 2rem));
    margin-inline: auto;
}

/* =============================================================================
   Header and navigation
   ============================================================================= */
.site-header {
    background: #12284c;
    color: #fff;
    box-shadow: 0 4px 16px rgba(0, 0, 0, .12);
}

.header-inner {
    min-height: 68px;
    display: flex;
    align-items: center;
    gap: 1.25rem;
}

.brand {
    color: #fff;
    font-weight: 800;
    text-decoration: none;
    letter-spacing: -.02em;
    margin-right: auto;
}

.main-nav { display: flex; gap: .95rem; align-items: center; flex-wrap: wrap; }
.main-nav a { color: #dce7fb; text-decoration: none; font-size: .94rem; }
.main-nav a:hover { color: #fff; }
.logout-form { margin: 0; }

.page-content { flex: 1; padding-block: 2rem 3rem; }
.site-footer { color: var(--muted); padding: 1.25rem 0 2rem; font-size: .9rem; }

/* =============================================================================
   Cards, headings and metrics
   ============================================================================= */
.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: clamp(1.15rem, 3vw, 1.75rem);
    margin-bottom: 1.35rem;
}

.narrow { max-width: 650px; margin-inline: auto; }
.hero { min-height: 390px; display: grid; align-items: center; }
.hero > div { max-width: 720px; }
.hero p { color: var(--muted); font-size: 1.08rem; }
.auth-card { margin-top: 2rem; }

.eyebrow {
    display: inline-block;
    margin-bottom: .45rem;
    color: var(--primary);
    text-transform: uppercase;
    font-size: .76rem;
    font-weight: 800;
    letter-spacing: .1em;
}

.page-heading, .section-heading, .booking-summary {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    align-items: center;
}
.page-heading { margin-bottom: 1.5rem; }
.page-heading p, .section-heading p { color: var(--muted); margin-bottom: 0; }

.stat-grid {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 1rem;
    margin-bottom: 1.35rem;
}
.stat-grid.four-columns { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.stat-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 1.2rem;
}
.stat-card span { display: block; color: var(--muted); font-size: .88rem; }
.stat-card strong { display: block; font-size: 2rem; margin-top: .3rem; }

.action-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1rem;
}
.action-card {
    display: grid;
    gap: .35rem;
    padding: 1rem;
    border: 1px solid var(--border);
    border-radius: 10px;
    text-decoration: none;
    background: var(--surface-soft);
}
.action-card span { color: var(--muted); }

/* =============================================================================
   Forms and buttons
   ============================================================================= */
label { display: block; font-weight: 700; margin-bottom: .4rem; }
input, select {
    width: 100%;
    min-height: 44px;
    border: 1px solid #b8c3d1;
    border-radius: 9px;
    background: #fff;
    color: var(--text);
    padding: .65rem .75rem;
    font: inherit;
}
input:focus, select:focus {
    outline: 3px solid rgba(33, 77, 154, .15);
    border-color: var(--primary);
}

.stacked-form { display: grid; gap: .8rem; }
.form-grid { display: grid; grid-template-columns: 1fr 1.5fr auto; gap: 1rem; align-items: end; }
.form-action { padding-bottom: 1px; }
.upload-form { display: flex; gap: .75rem; align-items: center; flex-wrap: wrap; }
.upload-form input { max-width: 520px; }
.button-row { display: flex; gap: .75rem; flex-wrap: wrap; }

.button {
    appearance: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 42px;
    padding: .66rem 1rem;
    border: 1px solid var(--primary);
    border-radius: 9px;
    background: var(--primary);
    color: #fff;
    font: inherit;
    font-weight: 750;
    text-decoration: none;
    cursor: pointer;
}
.button:hover { background: var(--primary-dark); border-color: var(--primary-dark); color: #fff; }
.button-secondary { background: #fff; color: var(--primary); }
.button-secondary:hover { background: #eaf0fa; color: var(--primary-dark); }
.button-danger { background: var(--danger); border-color: var(--danger); }
.button-danger:hover { background: var(--danger-dark); border-color: var(--danger-dark); }
.button-small { min-height: 34px; padding: .4rem .7rem; font-size: .86rem; }
.button:disabled { opacity: .55; cursor: not-allowed; }

/* =============================================================================
   Alerts, badges and statuses
   ============================================================================= */
.alert { border-radius: 10px; padding: .85rem 1rem; margin-bottom: 1rem; border: 1px solid; }
.alert-success { background: #e9f8f1; border-color: #9dd8c2; color: #0c6242; }
.alert-error { background: #fff0f1; border-color: #e3a4aa; color: #84222b; }
.alert-info { background: #edf4ff; border-color: #adc6ec; color: #244b83; }

.status-pill, .badge {
    display: inline-flex;
    align-items: center;
    width: fit-content;
    border-radius: 999px;
    font-weight: 750;
    white-space: nowrap;
}
.status-pill { padding: .55rem .85rem; }
.status-open { background: #dcf4e9; color: #106844; }
.status-closed { background: #f1e6e8; color: #822b34; }
.badge { padding: .28rem .55rem; font-size: .78rem; margin: .1rem .2rem .1rem 0; }
.badge-booked { background: #f2e7e9; color: #8b2f39; }
.badge-available { background: #def3e8; color: #116b47; }
.badge-own { background: #e4edfc; color: #214d9a; }
.badge-neutral { background: #edf0f4; color: #536072; }

/* =============================================================================
   Tables and lists
   ============================================================================= */
.table-wrap { width: 100%; overflow-x: auto; }
table { width: 100%; border-collapse: collapse; min-width: 740px; }
th, td { text-align: left; padding: .8rem .7rem; border-bottom: 1px solid var(--border); vertical-align: top; }
th { color: #465267; font-size: .79rem; text-transform: uppercase; letter-spacing: .055em; background: var(--surface-soft); }
tbody tr:last-child td { border-bottom: 0; }
.row-highlight { background: #f1f6ff; }
.empty-state { color: var(--muted); text-align: center; padding: 2rem; }
.compact-list { list-style: none; padding: 0; margin: 0; display: grid; gap: .35rem; }
.muted { color: var(--muted); font-size: .9rem; }

/* =============================================================================
   Responsive layout
   ============================================================================= */
@media (max-width: 900px) {
    .stat-grid, .stat-grid.four-columns { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .form-grid { grid-template-columns: 1fr; }
    .action-grid { grid-template-columns: 1fr; }
    .header-inner { padding-block: .8rem; flex-wrap: wrap; }
    .main-nav { order: 3; width: 100%; }
}

@media (max-width: 620px) {
    .page-heading, .section-heading, .booking-summary { align-items: flex-start; flex-direction: column; }
    .stat-grid, .stat-grid.four-columns { grid-template-columns: 1fr; }
    .container { width: min(100% - 1rem, 1180px); }
    .card { border-radius: 10px; }
}
