:root {
    --ink: #1d2b24;
    --muted: #66736c;
    --paper: #fffdf8;
    --surface: #ffffff;
    --line: #dfe6df;
    --green: #285b42;
    --green-dark: #173c2a;
    --green-pale: #eaf3ed;
    --gold: #d29a3a;
    --locked: #f0f1ef;
    --error: #9f2f2f;
    --success: #22613d;
    --shadow: 0 14px 35px rgba(30, 50, 38, 0.08);
}

* {
    box-sizing: border-box;
}

html {
    color: var(--ink);
    background: var(--paper);
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont,
        "Segoe UI", sans-serif;
    line-height: 1.5;
}

body {
    margin: 0;
    min-width: 320px;
}

a {
    color: var(--green);
}

button,
input,
select {
    font: inherit;
}

.site-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1.5rem;
    min-height: 76px;
    padding: 0.85rem clamp(1rem, 4vw, 4rem);
    color: white;
    background: var(--green-dark);
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 0.8rem;
    color: white;
    text-decoration: none;
}

.brand-mark {
    display: grid;
    width: 42px;
    height: 42px;
    place-items: center;
    border: 1px solid rgba(255, 255, 255, 0.4);
    border-radius: 50%;
    color: #f2cc86;
    font-family: Georgia, serif;
    font-weight: 700;
}

.brand strong,
.brand small {
    display: block;
}

.brand small {
    color: #c6d7cc;
    font-size: 0.72rem;
}

.main-nav {
    display: flex;
    align-items: center;
    gap: 1.1rem;
}

.main-nav a,
.link-button {
    color: #f5faf6;
    font-size: 0.9rem;
    text-decoration: none;
}

.main-nav a:hover,
.link-button:hover {
    text-decoration: underline;
}

.username {
    color: #b9c9bf;
    font-size: 0.82rem;
}

.logout-form {
    margin: 0;
}

.link-button {
    padding: 0;
    border: 0;
    background: transparent;
    cursor: pointer;
}

.page-shell {
    width: min(1480px, 100%);
    min-height: calc(100vh - 145px);
    margin: 0 auto;
    padding: clamp(1.5rem, 4vw, 3.5rem) clamp(1rem, 4vw, 4rem);
}

.site-footer {
    padding: 1.2rem;
    color: var(--muted);
    border-top: 1px solid var(--line);
    text-align: center;
    font-size: 0.82rem;
}

h1,
h2,
h3,
p {
    margin-top: 0;
}

h1,
h2,
h3 {
    line-height: 1.14;
}

h1 {
    margin-bottom: 0.75rem;
    font-family: Georgia, "Times New Roman", serif;
    font-size: clamp(2rem, 4vw, 3.45rem);
    font-weight: 500;
}

h2 {
    margin-bottom: 0.45rem;
    font-size: clamp(1.3rem, 2vw, 1.75rem);
}

.eyebrow {
    margin-bottom: 0.55rem;
    color: var(--green);
    font-size: 0.76rem;
    font-weight: 800;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

.muted,
.section-heading p {
    color: var(--muted);
}

.lead {
    font-size: 1.08rem;
}

.panel {
    border: 1px solid var(--line);
    border-radius: 18px;
    background: var(--surface);
    box-shadow: var(--shadow);
}

.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    padding: 0.7rem 1.1rem;
    border: 1px solid transparent;
    border-radius: 9px;
    font-weight: 750;
    text-decoration: none;
    cursor: pointer;
}

.button-primary {
    color: white;
    background: var(--green);
}

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

.button-secondary {
    color: var(--green);
    border-color: #b9cbbf;
    background: white;
}

.button-full {
    width: 100%;
}

.field-group {
    margin-bottom: 1.2rem;
}

.field-group label {
    display: block;
    margin-bottom: 0.4rem;
    font-size: 0.88rem;
    font-weight: 750;
}

.field-group input,
.field-group select {
    width: 100%;
    min-height: 46px;
    padding: 0.65rem 0.75rem;
    color: var(--ink);
    border: 1px solid #bfc9c1;
    border-radius: 8px;
    background: white;
}

.field-group input:focus,
.field-group select:focus,
.quantity-input:focus {
    border-color: var(--green);
    outline: 3px solid rgba(40, 91, 66, 0.14);
}

.help-text {
    margin: 0.45rem 0 0;
    color: var(--muted);
    font-size: 0.82rem;
}

.errorlist,
.form-errors {
    color: var(--error);
}

.errorlist {
    margin: 0.4rem 0 0;
    padding-left: 1.2rem;
    font-size: 0.84rem;
}

.auth-layout {
    display: grid;
    grid-template-columns: minmax(0, 1.2fr) minmax(320px, 0.8fr);
    align-items: center;
    gap: clamp(2rem, 6vw, 7rem);
    min-height: 62vh;
}

.auth-intro {
    max-width: 670px;
}

.auth-intro p:not(.eyebrow) {
    max-width: 560px;
    color: var(--muted);
    font-size: 1.08rem;
}

.login-panel {
    width: 100%;
    max-width: 460px;
    margin-left: auto;
    padding: clamp(1.5rem, 4vw, 2.5rem);
}

.narrow-layout {
    width: min(720px, 100%);
    margin: 2rem auto;
}

.welcome-panel {
    padding: clamp(1.5rem, 5vw, 3.5rem);
}

.first-access-form {
    margin: 2rem 0;
    padding: 1.4rem;
    border-radius: 12px;
    background: var(--green-pale);
}

.first-access-form .field-group input {
    max-width: 150px;
}

.example-box {
    padding: 1rem 1.1rem;
    border-left: 4px solid var(--gold);
    background: #fff8e9;
}

.page-heading,
.section-heading {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 1.25rem;
}

.page-heading {
    margin-bottom: 2rem;
}

.section-heading {
    margin-bottom: 1.3rem;
}

.section-heading p {
    margin-bottom: 0;
}

.deadline-note {
    display: flex;
    flex-direction: column;
    min-width: 280px;
    padding: 0.9rem 1rem;
    border-left: 4px solid var(--gold);
    background: #fff8e9;
}

.deadline-note span {
    color: var(--muted);
    font-size: 0.82rem;
}

.order-panel,
.matrix-panel {
    padding: clamp(1rem, 3vw, 2rem);
}

.spend-summary {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 0.15rem 1rem;
    margin: -0.5rem 0 1.25rem;
    padding: 1rem 1.2rem;
    border: 1px solid #c9ddcf;
    border-radius: 14px;
    background: var(--green-pale);
}

.spend-summary > span {
    font-weight: 750;
}

.spend-summary > strong {
    grid-row: span 2;
    align-self: center;
    color: var(--green-dark);
    font-family: Georgia, serif;
    font-size: 1.75rem;
}

.spend-summary > small {
    color: var(--muted);
}

.legend {
    display: flex;
    gap: 1rem;
    color: var(--muted);
    font-size: 0.82rem;
}

.legend-dot {
    display: inline-block;
    width: 9px;
    height: 9px;
    margin-right: 0.3rem;
    border-radius: 50%;
}

.editable-dot {
    background: #65a17c;
}

.locked-dot {
    background: #a9afaa;
}

.table-scroll {
    max-width: 100%;
    overflow-x: auto;
    border: 1px solid var(--line);
    border-radius: 12px;
}

.order-table,
.admin-table {
    width: 100%;
    min-width: 760px;
    border-collapse: separate;
    border-spacing: 0;
    background: white;
}

.order-table th,
.order-table td,
.admin-table th,
.admin-table td {
    padding: 0.75rem;
    border-right: 1px solid var(--line);
    border-bottom: 1px solid var(--line);
    text-align: center;
}

.order-table thead th,
.admin-table thead th {
    color: var(--ink);
    background: #f6f8f6;
    font-size: 0.82rem;
}

.order-table tr:last-child > *,
.admin-table tr:last-child > * {
    border-bottom: 0;
}

.order-table tr > *:last-child,
.admin-table tr > *:last-child {
    border-right: 0;
}

.order-table th span,
.order-table th small,
.order-table th em,
.admin-table th small {
    display: block;
}

.order-table th small,
.admin-table th small {
    color: var(--muted);
    font-weight: 500;
}

.order-table th em {
    margin-top: 0.25rem;
    color: #727a75;
    font-size: 0.65rem;
    font-style: normal;
    text-transform: uppercase;
}

.sticky-column {
    position: sticky;
    left: 0;
    z-index: 2;
    min-width: 155px;
    text-align: left !important;
    background: white;
}

.matrix-product {
    display: flex !important;
    align-items: center;
    gap: 0.65rem;
}

.matrix-product > img {
    width: 48px;
    height: 48px;
    flex: 0 0 48px;
    border-radius: 8px;
    object-fit: cover;
}

.matrix-product > span {
    display: block;
}

.delivery-fee-note {
    color: var(--muted);
    font-size: 0.72rem;
}

thead .sticky-column {
    z-index: 3;
    background: #f6f8f6;
}

.locked-column,
.locked-cell {
    background: var(--locked) !important;
}

.quantity-input {
    width: 64px;
    min-height: 40px;
    padding: 0.4rem;
    border: 1px solid #b8c5bc;
    border-radius: 7px;
    text-align: center;
}

.locked-value {
    color: #6d756f;
    font-weight: 650;
}

.unavailable-label {
    display: block;
    color: var(--error);
    font-size: 0.65rem;
}

.form-actions {
    display: flex;
    justify-content: flex-end;
    margin-top: 1.2rem;
}

.catalogue-section {
    margin-top: 3.5rem;
}

.stay-totals-panel {
    margin-top: 1.5rem;
    padding: clamp(1rem, 3vw, 2rem);
}

.stay-total-list {
    border-top: 1px solid var(--line);
}

.stay-total-row {
    display: grid;
    grid-template-columns: minmax(180px, 1fr) minmax(220px, 1fr) auto;
    align-items: center;
    gap: 1rem;
    padding: 0.9rem 0.25rem;
    border-bottom: 1px solid var(--line);
}

.stay-total-row span {
    display: block;
    color: var(--muted);
    font-size: 0.78rem;
}

.stay-dates {
    color: var(--muted);
    font-size: 0.9rem;
}

.money-total {
    color: var(--green-dark);
    font-size: 1.1rem;
}

.stay-money {
    text-align: right;
}

.stay-money > * {
    display: block;
}

@media (max-width: 700px) {
    .site-header {
        align-items: flex-start;
        min-height: auto;
        padding: 0.8rem 1rem;
    }

    .brand small,
    .username {
        display: none;
    }

    .main-nav {
        flex-wrap: wrap;
        justify-content: flex-end;
        gap: 0.45rem 0.8rem;
    }

    .page-shell {
        padding: 1.25rem 0.75rem 2rem;
    }

    h1 {
        font-size: 2rem;
    }

    .auth-layout,
    .page-heading,
    .section-heading {
        display: block;
    }

    .auth-layout {
        min-height: 0;
    }

    .auth-intro {
        margin-bottom: 1.5rem;
    }

    .login-panel {
        margin: 0;
    }

    .page-heading > .button,
    .deadline-note {
        width: 100%;
        margin-top: 1rem;
    }

    .legend {
        margin-top: 0.75rem;
    }

    .table-scroll {
        overflow: visible;
        border: 0;
    }

    .order-table,
    .admin-table {
        min-width: 0;
        background: transparent;
    }

    .order-table thead,
    .admin-table thead {
        position: absolute;
        width: 1px;
        height: 1px;
        overflow: hidden;
        clip: rect(0 0 0 0);
    }

    .order-table tbody,
    .order-table tr,
    .order-table th,
    .order-table td,
    .admin-table tbody,
    .admin-table tr,
    .admin-table th,
    .admin-table td {
        display: block;
        width: 100%;
    }

    .order-table tr,
    .admin-table tr {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        overflow: hidden;
        margin-bottom: 0.85rem;
        border: 1px solid var(--line);
        border-radius: 12px;
        background: white;
    }

    .order-table .sticky-column,
    .admin-table .sticky-column {
        position: static;
        grid-column: 1 / -1;
        min-width: 0;
        padding: 0.65rem 0.75rem;
        border-right: 0;
        background: #f6f8f6;
        font-size: 0.9rem;
        line-height: 1.2;
    }

    .order-table td,
    .admin-table td {
        display: grid;
        grid-template-columns: minmax(0, 1fr) auto;
        align-items: center;
        gap: 0.4rem;
        min-height: 54px;
        padding: 0.45rem 0.6rem;
        text-align: right;
    }

    .order-table td:nth-child(odd),
    .admin-table td:nth-child(odd) {
        border-right: 0;
    }

    .order-table td::before,
    .admin-table td::before {
        content: attr(data-label);
        color: var(--muted);
        font-size: 0.82rem;
        font-weight: 700;
        line-height: 1.15;
        text-align: left;
    }

    .admin-table .total-column {
        grid-column: 1 / -1;
        border-right: 0;
        background: var(--green-pale);
    }

    .admin-table .total-column::before {
        content: "Total required";
    }

    .quantity-input {
        width: 60px;
        min-height: 42px;
    }

    .matrix-product > img {
        width: 38px;
        height: 38px;
        flex-basis: 38px;
    }

    .form-actions .button {
        width: 100%;
    }

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

    .filter-form,
    .date-navigation {
        flex-direction: column;
        align-items: stretch;
    }

    .date-navigation {
        gap: 0.75rem;
        text-align: center;
    }

    .stay-total-row {
        grid-template-columns: 1fr auto;
        gap: 0.25rem 0.75rem;
    }

    .stay-dates {
        grid-column: 1;
    }

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

.product-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 1.1rem;
}

.product-card {
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: white;
}

.product-image,
.product-placeholder {
    width: 100%;
    height: 165px;
}

.product-image {
    display: block;
    object-fit: cover;
}

.product-placeholder {
    display: grid;
    place-items: center;
    color: var(--green);
    background: linear-gradient(145deg, #edf3ec, #dce9df);
    font-family: Georgia, serif;
    font-size: 3rem;
}

.product-card-body {
    padding: 1rem;
}

.product-card-title {
    display: flex;
    justify-content: space-between;
    gap: 0.8rem;
}

.product-card-title h3 {
    margin-bottom: 0.5rem;
}

.product-card-title strong {
    color: var(--green);
    white-space: nowrap;
}

.product-card-body p {
    margin-bottom: 0;
    color: var(--muted);
    font-size: 0.86rem;
}

.filters-panel {
    margin-bottom: 1.3rem;
    padding: 1.25rem;
}

.filter-form {
    display: flex;
    align-items: flex-end;
    gap: 1rem;
}

.compact-field {
    min-width: 210px;
    margin-bottom: 0;
}

.date-navigation {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    gap: 1rem;
    margin-top: 1.2rem;
    padding-top: 1rem;
    border-top: 1px solid var(--line);
    text-align: center;
}

.date-navigation a:first-child {
    text-align: left;
}

.date-navigation a:last-child {
    text-align: right;
}

.result-count {
    color: var(--muted);
    font-size: 0.84rem;
}

.villa-order-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 1rem;
}

.villa-order-card {
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: white;
}

.villa-order-card header,
.villa-order-card footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.85rem 1rem;
}

.villa-order-card header {
    color: white;
    background: var(--green-dark);
}

.villa-order-card h3 {
    margin: 0;
    font-family: Georgia, "Times New Roman", serif;
    font-size: 1.35rem;
}

.villa-order-card header span {
    color: #c6d7cc;
    font-size: 0.76rem;
}

.villa-order-card ul {
    margin: 0;
    padding: 0;
    list-style: none;
}

.villa-order-card li {
    display: grid;
    grid-template-columns: 2.25rem minmax(0, 1fr);
    align-items: center;
    gap: 0.65rem;
    min-height: 48px;
    padding: 0.55rem 1rem;
    border-bottom: 1px solid var(--line);
}

.villa-order-card li > strong {
    display: grid;
    width: 2.25rem;
    height: 2.25rem;
    place-items: center;
    border-radius: 50%;
    color: var(--green-dark);
    background: var(--green-pale);
    font-variant-numeric: tabular-nums;
}

.villa-order-card footer {
    color: var(--green-dark);
    background: #eef5f0;
    font-size: 0.86rem;
}

.villa-order-card footer strong {
    font-size: 1.05rem;
}

.admin-table {
    min-width: max(900px, 100%);
}

.admin-table th:not(.sticky-column) {
    min-width: 115px;
}

.number-cell {
    color: #778079;
    font-variant-numeric: tabular-nums;
}

.number-cell.has-order {
    color: var(--ink);
    background: var(--green-pale);
    font-weight: 750;
}

.total-column {
    color: var(--green) !important;
    background: #eef5f0 !important;
}

.empty-state {
    margin: 1rem 0 0;
    color: var(--muted);
}

.message-stack {
    display: grid;
    gap: 0.6rem;
    margin-bottom: 1.25rem;
}

.message {
    padding: 0.85rem 1rem;
    border: 1px solid;
    border-radius: 9px;
}

.message-success {
    color: var(--success);
    border-color: #a9cbb8;
    background: #edf7f0;
}

.message-error {
    color: var(--error);
    border-color: #e0b6b6;
    background: #fff0f0;
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

@media (max-width: 800px) {
    .site-header,
    .page-heading,
    .section-heading {
        align-items: flex-start;
    }

    .site-header,
    .page-heading,
    .section-heading,
    .filter-form {
        flex-direction: column;
    }

    .main-nav {
        flex-wrap: wrap;
        gap: 0.65rem 1rem;
    }

    .auth-layout {
        grid-template-columns: 1fr;
        min-height: auto;
    }

    .login-panel {
        max-width: none;
    }

    .deadline-note,
    .compact-field,
    .filter-form .button {
        width: 100%;
        min-width: 0;
    }

    .date-navigation {
        grid-template-columns: 1fr 1fr;
    }

    .date-navigation strong {
        grid-column: 1 / -1;
        grid-row: 1;
    }
}

@media (max-width: 520px) {
    .site-header {
        padding: 0.9rem 1rem;
    }

    .username {
        display: none;
    }

    h1 {
        font-size: 2rem;
    }

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

/* Keep the compact staff controls stacked after the base dashboard rules. */
@media (max-width: 700px) {
    .filter-form,
    .date-navigation {
        display: flex;
        flex-direction: column;
        align-items: stretch;
    }

    .date-navigation a:first-child,
    .date-navigation a:last-child {
        text-align: center;
    }
}
