:root {
    --bg: #f4f6f8;
    --surface: #ffffff;
    --surface-soft: #eef2f5;
    --text: #17202a;
    --muted: #697586;
    --border: #d9e1e8;
    --primary: #0f766e;
    --primary-strong: #115e59;
    --primary-soft: #d8f3ef;
    --accent: #b7791f;
    --danger: #b42318;
    --danger-soft: #fee4e2;
    --success: #027a48;
    --success-soft: #dcfae6;
    --warning: #b54708;
    --warning-soft: #fff0c8;
    --shadow: 0 10px 30px rgba(15, 23, 42, 0.08);
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
    font-size: 15px;
    line-height: 1.45;
}

a {
    color: var(--primary);
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

button,
input,
select,
textarea {
    font: inherit;
}

input,
select,
textarea {
    width: 100%;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--surface);
    color: var(--text);
    padding: 10px 12px;
    outline: none;
}

textarea {
    resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.12);
}

label span {
    display: block;
    color: var(--muted);
    font-size: 12px;
    font-weight: 600;
    margin-bottom: 6px;
}

table {
    width: 100%;
    border-collapse: collapse;
}

th,
td {
    border-bottom: 1px solid var(--border);
    padding: 12px 10px;
    text-align: left;
    vertical-align: top;
}

th {
    color: var(--muted);
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
}

td small {
    display: block;
    color: var(--muted);
    margin-top: 2px;
}

.app-shell {
    display: grid;
    grid-template-columns: 260px minmax(0, 1fr);
    min-height: 100vh;
}

.sidebar {
    align-self: start;
    background: #17202a;
    color: #e9eef3;
    display: flex;
    flex-direction: column;
    max-height: 100vh;
    overflow-y: auto;
    overscroll-behavior: contain;
    padding: 20px;
    position: sticky;
    top: 0;
    height: 100vh;
}

.sidebar::-webkit-scrollbar {
    width: 7px;
}

.sidebar::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 999px;
}

.brand {
    align-items: center;
    color: #fff;
    display: flex;
    gap: 12px;
    margin-bottom: 26px;
}

.brand:hover {
    text-decoration: none;
}

.brand-mark {
    align-items: center;
    background: var(--primary);
    border-radius: 8px;
    color: #fff;
    display: inline-flex;
    font-weight: 800;
    height: 42px;
    justify-content: center;
    width: 42px;
}

.brand small {
    color: #aebaca;
    display: block;
    font-size: 12px;
    margin-top: 2px;
}

.nav-list {
    display: grid;
    gap: 5px;
}

.nav-list a {
    align-items: center;
    border-radius: 8px;
    color: #d5dde7;
    display: flex;
    gap: 10px;
    padding: 11px 12px;
}

.nav-list a:hover,
.nav-list a.active {
    background: rgba(255, 255, 255, 0.09);
    color: #fff;
    text-decoration: none;
}

.nav-icon {
    align-items: center;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 6px;
    display: inline-flex;
    font-size: 11px;
    font-weight: 800;
    height: 24px;
    justify-content: center;
    width: 24px;
}

.sidebar-footer {
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    margin-top: auto;
    padding-top: 16px;
}

.sidebar-footer a {
    color: #fca5a5;
}

.main-content {
    min-width: 0;
    padding: 28px;
}

.topbar {
    align-items: center;
    display: flex;
    gap: 16px;
    justify-content: space-between;
    margin-bottom: 24px;
}

.eyebrow {
    color: var(--primary);
    font-size: 12px;
    font-weight: 800;
    letter-spacing: 0;
    margin: 0 0 4px;
    text-transform: uppercase;
}

.topbar h1 {
    font-size: 28px;
    line-height: 1.15;
    margin: 0;
}

.user-chip {
    align-items: flex-end;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    min-width: 140px;
    padding: 10px 12px;
}

.user-chip span {
    font-weight: 700;
}

.user-chip small {
    color: var(--muted);
}

.panel,
.stat-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    box-shadow: var(--shadow);
}

.panel {
    margin-bottom: 20px;
    padding: 18px;
}

.panel-header {
    align-items: center;
    display: flex;
    gap: 16px;
    justify-content: space-between;
    margin-bottom: 16px;
}

.panel-header h2 {
    font-size: 18px;
    margin: 0;
}

.stats-grid {
    display: grid;
    gap: 16px;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    margin-bottom: 20px;
}

.stat-card {
    min-height: 112px;
    padding: 18px;
}

.stat-card span {
    color: var(--muted);
    display: block;
    font-weight: 600;
    margin-bottom: 10px;
}

.stat-card strong {
    display: block;
    font-size: 27px;
    line-height: 1.1;
}

.stat-card.attention {
    border-color: #f7c76b;
}

.two-column {
    display: grid;
    gap: 20px;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
}

.two-column.wide-left {
    grid-template-columns: minmax(0, 1.05fr) minmax(320px, 0.95fr);
}

.three-column {
    display: grid;
    gap: 20px;
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.form-grid {
    display: grid;
    gap: 14px;
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.span-2 {
    grid-column: 1 / -1;
}

.form-actions {
    align-items: center;
    display: flex;
    gap: 10px;
    grid-column: 1 / -1;
    justify-content: flex-start;
}

.form-actions.align-end {
    align-self: end;
    grid-column: auto;
}

.button {
    align-items: center;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text);
    cursor: pointer;
    display: inline-flex;
    font-weight: 700;
    justify-content: center;
    min-height: 40px;
    padding: 9px 14px;
    text-decoration: none;
}

.button:hover {
    border-color: var(--primary);
    text-decoration: none;
}

.button.primary {
    background: var(--primary);
    border-color: var(--primary);
    color: #fff;
}

.button.primary:hover {
    background: var(--primary-strong);
}

.button.ghost {
    background: transparent;
}

.button.small {
    min-height: 34px;
    padding: 6px 10px;
}

.button.full {
    width: 100%;
}

.button:disabled {
    cursor: not-allowed;
    opacity: 0.65;
}

.alert {
    border-radius: 8px;
    font-weight: 700;
    margin-bottom: 18px;
    padding: 12px 14px;
}

.alert.success {
    background: var(--success-soft);
    color: var(--success);
}

.alert.danger {
    background: var(--danger-soft);
    color: var(--danger);
}

.badge {
    border-radius: 999px;
    display: inline-flex;
    font-size: 12px;
    font-weight: 800;
    padding: 4px 9px;
}

.badge.success {
    background: var(--success-soft);
    color: var(--success);
}

.badge.danger {
    background: var(--danger-soft);
    color: var(--danger);
}

.badge.warning {
    background: var(--warning-soft);
    color: var(--warning);
}

.badge.neutral {
    background: var(--surface-soft);
    color: var(--muted);
}

.table-wrap {
    overflow-x: auto;
}

.empty,
.form-note {
    color: var(--muted);
}

.inline-search,
.filter-bar,
.mini-form,
.row-actions {
    align-items: end;
    display: flex;
    gap: 10px;
}

.filter-bar {
    flex-wrap: wrap;
}

.filter-bar label {
    min-width: 180px;
}

.timeline-list,
.list-stack {
    display: grid;
    gap: 12px;
}

.timeline-item,
.list-item,
.booking-card {
    border-bottom: 1px solid var(--border);
    display: flex;
    gap: 12px;
    justify-content: space-between;
    padding: 10px 0;
}

.timeline-item time {
    color: var(--primary);
    font-weight: 800;
    min-width: 86px;
}

.timeline-item span,
.list-item span,
.booking-card span,
.booking-card small {
    color: var(--muted);
    display: block;
}

.booking-card {
    align-items: center;
}

.calendar-week {
    display: grid;
    gap: 12px;
    grid-template-columns: repeat(7, minmax(190px, 1fr));
    overflow-x: auto;
    padding-bottom: 8px;
}

.calendar-day {
    background: var(--surface-soft);
    border: 1px solid var(--border);
    border-radius: 8px;
    min-height: 180px;
    padding: 10px;
}

.calendar-day > header {
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    margin-bottom: 10px;
    padding-bottom: 8px;
}

.calendar-booking {
    background: var(--surface);
    border-left: 3px solid var(--primary);
    border-radius: 6px;
    box-shadow: 0 3px 10px rgba(15, 23, 42, 0.06);
    margin-bottom: 9px;
    padding: 9px;
}

.calendar-booking span,
.calendar-booking small {
    display: block;
    margin-top: 3px;
}

.calendar-booking small {
    color: var(--muted);
}

.calendar-booking .mini-form {
    align-items: stretch;
    flex-direction: column;
    margin-top: 8px;
}

.detail-grid {
    display: grid;
    gap: 14px;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    margin-bottom: 20px;
}

.detail-grid div {
    background: var(--surface-soft);
    border-radius: 8px;
    padding: 12px;
}

.detail-grid span {
    color: var(--muted);
    display: block;
    font-size: 12px;
    font-weight: 700;
    margin-bottom: 4px;
}

.bill-items {
    display: grid;
    gap: 10px;
}

.bill-row {
    align-items: end;
    display: grid;
    gap: 10px;
    grid-template-columns: minmax(240px, 1fr) 96px 110px auto;
}

.bill-row output {
    color: var(--primary);
    font-weight: 800;
    padding-bottom: 11px;
}

.bill-bottom {
    align-items: start;
}

.totals-panel {
    position: sticky;
    top: 20px;
}

.totals-list,
.receipt-total {
    display: grid;
    gap: 10px;
    margin: 0 0 16px;
}

.totals-list div,
.receipt-total div {
    align-items: center;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    padding-bottom: 9px;
}

.totals-list dt,
.receipt-total dt {
    color: var(--muted);
    font-weight: 700;
}

.totals-list dd,
.receipt-total dd {
    font-weight: 800;
    margin: 0;
}

.totals-list .total,
.receipt-total .total {
    border-bottom: 0;
    font-size: 20px;
}

.bill-summary {
    display: flex;
    justify-content: flex-end;
    margin-top: 18px;
}

.bill-summary .totals-list {
    min-width: 320px;
}

.login-page {
    background: linear-gradient(135deg, #edf7f5 0%, #f8f1e6 100%);
}

.login-wrap {
    align-items: center;
    display: flex;
    justify-content: center;
    min-height: 100vh;
    padding: 24px;
}

.login-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    box-shadow: var(--shadow);
    max-width: 430px;
    padding: 28px;
    width: 100%;
}

.login-brand {
    align-items: center;
    display: flex;
    gap: 14px;
    margin-bottom: 26px;
}

.login-brand h1,
.login-brand p {
    margin: 0;
}

.login-brand p {
    color: var(--muted);
}

.stack {
    display: grid;
    gap: 16px;
}

.page-footer {
    color: var(--muted);
    display: flex;
    font-size: 12px;
    justify-content: space-between;
    padding: 20px 0 0;
}

.print-page {
    background: #fff;
}

.receipt {
    background: #fff;
    color: #111;
    margin: 24px auto;
    max-width: 390px;
    padding: 18px;
}

.receipt header {
    border-bottom: 1px dashed #999;
    margin-bottom: 14px;
    padding-bottom: 12px;
    text-align: center;
}

.receipt h1,
.receipt p {
    margin: 0;
}

.receipt-meta {
    display: grid;
    gap: 8px;
    grid-template-columns: 1fr 1fr;
    margin-bottom: 14px;
}

.receipt-meta span {
    color: #555;
    display: block;
    font-size: 12px;
}

.receipt-table th,
.receipt-table td {
    padding: 8px 4px;
}

.receipt-table small {
    color: #555;
}

.thanks {
    text-align: center;
}

@media (max-width: 1050px) {
    .app-shell {
        grid-template-columns: 1fr;
    }

    .sidebar {
        height: auto;
        max-height: none;
        overflow-y: visible;
        position: static;
    }

    .nav-list {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .stats-grid,
    .two-column,
    .two-column.wide-left,
    .three-column,
    .detail-grid {
        grid-template-columns: 1fr;
    }

    .totals-panel {
        position: static;
    }
}

@media (max-width: 720px) {
    .main-content {
        padding: 18px;
    }

    .topbar,
    .panel-header,
    .inline-search,
    .booking-card {
        align-items: stretch;
        flex-direction: column;
    }

    .form-grid,
    .bill-row {
        grid-template-columns: 1fr;
    }

    .form-actions.align-end {
        grid-column: 1 / -1;
    }

    .bill-row output {
        padding-bottom: 0;
    }

    .nav-list {
        grid-template-columns: 1fr;
    }
}

@media print {
    .no-print {
        display: none;
    }

    body {
        background: #fff;
    }

    .receipt {
        margin: 0;
        max-width: none;
    }
}
