:root {
    color-scheme: light;
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    color: #18231f;
    background: #f3f6f4;
    font-synthesis: none;
    --ink: #18231f;
    --muted: #66736d;
    --line: #dce4df;
    --surface: #ffffff;
    --brand: #166b57;
    --brand-dark: #105343;
    --available: #18855f;
    --available-bg: #e6f5ee;
    --waiting: #a65f0b;
    --waiting-bg: #fff3d9;
    --active: #1769aa;
    --active-bg: #e7f2fc;
    --danger: #b43c3c;
    --danger-bg: #fff0ef;
    --shadow: 0 16px 50px rgb(20 53 43 / 12%);
}

* { box-sizing: border-box; }
html { min-width: 320px; }
body { margin: 0; min-height: 100vh; background: #f3f6f4; }
button, input { font: inherit; }
button { color: inherit; }
button, [role="button"] { -webkit-tap-highlight-color: transparent; }
button:focus-visible, input:focus-visible { outline: 3px solid #e1a62e; outline-offset: 2px; }

.app-shell { min-height: 100vh; padding-bottom: 2rem; }
.topbar { min-height: 76px; display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: .8rem clamp(1rem, 3vw, 2.5rem); background: var(--surface); border-bottom: 1px solid var(--line); }
.brand-block { display: flex; align-items: center; gap: .75rem; }
.brand-mark { display: grid; place-items: center; width: 42px; height: 42px; border-radius: 12px; color: white; background: var(--brand); font-size: 1.3rem; font-weight: 850; }
.brand { display: block; font-size: 1.18rem; line-height: 1.1; }
.location { display: block; margin-top: .2rem; color: var(--muted); font-size: .82rem; }
.prototype-badge { padding: .45rem .7rem; border-radius: 999px; color: #6c5730; background: #fff7dd; font-size: .78rem; font-weight: 700; }

.workspace { width: min(1180px, 100%); margin: 0 auto; padding: 1.25rem clamp(1rem, 3vw, 2.5rem) 7.5rem; }
.operational-nav { display: grid; grid-template-columns: 1fr 1fr; width: min(430px, 100%); margin-bottom: 1.5rem; padding: 4px; border-radius: 15px; background: #dfe6e2; }
.nav-button { min-height: 48px; border: 0; border-radius: 11px; background: transparent; font-weight: 750; cursor: pointer; }
.nav-button[aria-selected="true"] { color: var(--brand-dark); background: white; box-shadow: 0 2px 10px rgb(30 54 44 / 10%); }
.page-heading { display: flex; justify-content: space-between; align-items: end; gap: 1rem; margin-bottom: 1.15rem; }
h1, h2, h3, p { margin-top: 0; }
h1 { margin-bottom: .25rem; font-size: clamp(1.65rem, 3vw, 2.25rem); letter-spacing: -.025em; }
.page-subtitle { margin-bottom: 0; color: var(--muted); }
.clock { white-space: nowrap; color: var(--muted); font-size: .92rem; font-variant-numeric: tabular-nums; }

.filter-bar { display: flex; gap: .6rem; overflow-x: auto; padding: .15rem .15rem .8rem; scrollbar-width: none; }
.filter-button { flex: 0 0 auto; min-height: 46px; padding: 0 1.2rem; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); font-weight: 700; cursor: pointer; }
.filter-button[aria-pressed="true"] { border-color: var(--brand); color: white; background: var(--brand); }
.equipment-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .9rem; }
.equipment-card { position: relative; min-height: 174px; display: flex; flex-direction: column; align-items: stretch; padding: 1rem; border: 2px solid transparent; border-radius: 18px; text-align: left; background: var(--surface); box-shadow: 0 4px 16px rgb(29 54 43 / 6%); }
button.equipment-card { cursor: pointer; }
.equipment-card.available { border-color: #a9d7c3; background: linear-gradient(145deg, #fff 45%, var(--available-bg)); }
.equipment-card.selected { border-color: var(--brand); box-shadow: 0 0 0 3px rgb(22 107 87 / 15%); transform: translateY(-2px); }
.equipment-card.waiting { background: var(--waiting-bg); border-color: #edcf91; }
.equipment-card.active { background: var(--active-bg); border-color: #b5d5ef; }
.equipment-number { font-size: 1.65rem; font-weight: 850; letter-spacing: -.02em; }
.equipment-type { margin-left: auto; color: var(--muted); font-size: .78rem; font-weight: 750; }
.equipment-top { display: flex; align-items: baseline; gap: .5rem; }
.status-label { margin-top: .65rem; font-size: .75rem; font-weight: 850; letter-spacing: .055em; text-transform: uppercase; }
.available .status-label { color: var(--available); }
.waiting .status-label { color: var(--waiting); }
.active .status-label { color: var(--active); }
.equipment-details { margin-top: auto; padding-top: .8rem; }
.customer-name { margin: 0 0 .35rem; overflow: hidden; font-weight: 700; text-overflow: ellipsis; white-space: nowrap; }
.duration-note { color: var(--muted); font-size: .86rem; }
.timer { font-size: 1.42rem; font-weight: 850; font-variant-numeric: tabular-nums; }
.timer.overtime { color: var(--danger); }
.selected-check { position: absolute; right: .75rem; bottom: .75rem; display: grid; place-items: center; width: 30px; height: 30px; border-radius: 50%; color: white; background: var(--brand); font-weight: 900; }

.selection-tray { position: fixed; z-index: 20; left: 50%; bottom: max(1rem, env(safe-area-inset-bottom)); width: min(760px, calc(100% - 2rem)); display: flex; align-items: center; gap: 1rem; padding: .8rem; border: 1px solid #ccd8d2; border-radius: 20px; background: rgb(255 255 255 / 96%); box-shadow: var(--shadow); transform: translateX(-50%); backdrop-filter: blur(12px); }
.tray-copy { min-width: 0; flex: 1; }
.tray-title { margin-bottom: .35rem; font-weight: 800; }
.selected-chips { display: flex; gap: .35rem; overflow-x: auto; }
.selected-chip { flex: 0 0 auto; padding: .3rem .55rem; border: 0; border-radius: 8px; color: var(--brand-dark); background: var(--available-bg); font-size: .8rem; font-weight: 800; cursor: pointer; }
.primary-button, .secondary-button, .action-button { min-height: 52px; padding: .75rem 1.25rem; border: 0; border-radius: 13px; font-weight: 800; cursor: pointer; }
.primary-button { color: white; background: var(--brand); }
.primary-button:hover { background: var(--brand-dark); }
.secondary-button { border: 1px solid var(--line); background: white; }
.selection-tray .primary-button { flex: 0 0 auto; }

.sheet-backdrop { position: fixed; z-index: 30; inset: 0; display: grid; place-items: center; padding: 1rem; background: rgb(13 29 23 / 48%); }
.checkout-sheet { width: min(920px, 100%); max-height: calc(100vh - 2rem); overflow: auto; border-radius: 24px; background: var(--surface); box-shadow: 0 20px 70px rgb(10 31 23 / 22%); }
.sheet-header { position: sticky; z-index: 2; top: 0; display: flex; align-items: center; gap: 1rem; padding: 1rem 1.25rem; border-bottom: 1px solid var(--line); background: rgb(255 255 255 / 96%); backdrop-filter: blur(12px); }
.sheet-header h2 { margin: 0; font-size: 1.3rem; }
.back-button { min-width: 46px; min-height: 46px; border: 1px solid var(--line); border-radius: 12px; background: white; font-size: 1.3rem; cursor: pointer; }
.checkout-body { display: grid; grid-template-columns: minmax(0, 1.45fr) minmax(270px, .8fr); gap: 1.5rem; padding: 1.35rem; }
.section-label { margin-bottom: .65rem; font-size: .82rem; font-weight: 850; letter-spacing: .04em; text-transform: uppercase; }
.duration-presets { display: grid; grid-template-columns: repeat(4, 1fr); gap: .55rem; }
.duration-button { min-height: 55px; border: 1px solid var(--line); border-radius: 12px; background: white; font-weight: 800; cursor: pointer; }
.duration-button[aria-pressed="true"] { border-color: var(--brand); color: white; background: var(--brand); }
.custom-duration { display: flex; align-items: center; gap: .65rem; margin-top: .65rem; }
.custom-duration input { width: 120px; min-height: 48px; padding: 0 .75rem; border: 1px solid #abb9b2; border-radius: 10px; }
.applied-note { margin: .65rem 0 1.2rem; color: var(--muted); font-size: .85rem; }
.customer-fields { display: grid; gap: .65rem; }
.rental-input-card { padding: .85rem; border: 1px solid var(--line); border-radius: 14px; background: #fafcfb; }
.rental-input-card.invalid { border-color: var(--danger); background: var(--danger-bg); }
.input-row { display: flex; align-items: center; gap: .8rem; }
.unit-badge { flex: 0 0 66px; font-size: 1.05rem; font-weight: 850; }
.name-input { width: 100%; min-height: 50px; padding: .7rem .85rem; border: 1px solid #aebbb5; border-radius: 10px; background: white; }
.name-input[aria-invalid="true"] { border-color: var(--danger); }
.field-error { margin: .4rem 0 0 74px; color: var(--danger); font-size: .8rem; font-weight: 700; }
.individual-toggle { min-height: 42px; margin: .8rem 0 0 74px; padding: 0; border: 0; color: var(--brand); background: transparent; font-size: .85rem; font-weight: 750; cursor: pointer; }
.individual-duration { display: flex; flex-wrap: wrap; gap: .4rem; margin: .3rem 0 0 74px; }
.small-duration { min-height: 40px; padding: 0 .75rem; border: 1px solid var(--line); border-radius: 9px; background: white; font-size: .83rem; font-weight: 750; cursor: pointer; }
.small-duration.active { border-color: var(--brand); color: var(--brand); background: var(--available-bg); }
.small-duration-input { width: 88px; min-height: 40px; padding: 0 .55rem; border: 1px solid var(--line); border-radius: 9px; }
.checkout-summary { align-self: start; position: sticky; top: 88px; padding: 1rem; border-radius: 16px; background: #f2f6f4; }
.summary-line { display: grid; grid-template-columns: 1fr auto; gap: .5rem; padding: .55rem 0; border-bottom: 1px solid var(--line); }
.summary-meta { color: var(--muted); font-size: .8rem; }
.summary-price { font-weight: 800; white-space: nowrap; }
.total-row { display: flex; justify-content: space-between; align-items: baseline; padding: 1rem 0; }
.total-price { font-size: 1.45rem; font-weight: 900; }
.payment-note { color: var(--muted); font-size: .78rem; line-height: 1.45; }
.checkout-submit { width: 100%; min-height: 62px; margin-top: .5rem; font-size: .95rem; }

.shore-sections { display: grid; gap: 1.6rem; }
.section-heading { display: flex; align-items: center; gap: .55rem; margin-bottom: .75rem; }
.section-heading h2 { margin: 0; font-size: 1.08rem; }
.count-badge { min-width: 25px; padding: .2rem .45rem; border-radius: 999px; text-align: center; color: var(--muted); background: #e2e8e5; font-size: .76rem; font-weight: 800; }
.rental-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .8rem; }
.rental-card { display: grid; grid-template-columns: 1fr auto; gap: .9rem; align-items: center; min-height: 150px; padding: 1rem; border: 1px solid var(--line); border-left: 6px solid var(--waiting); border-radius: 16px; background: white; }
.rental-card.active-rental { border-left-color: var(--active); }
.rental-card.overdue { border-color: #e6aaa7; border-left-color: var(--danger); background: var(--danger-bg); }
.rental-number { margin-bottom: .35rem; font-size: 1.45rem; font-weight: 900; }
.rental-customer { margin-bottom: .4rem; font-weight: 700; }
.rental-meta { color: var(--muted); font-size: .86rem; }
.rental-actions { display: grid; gap: .5rem; }
.action-button { min-width: 130px; color: white; background: var(--brand); }
.return-button { background: var(--active); }
.extend-button { min-width: 130px; }
.extension-panel { grid-column: 1 / -1; display: grid; gap: .65rem; padding: .85rem; border-radius: 12px; background: #f1f5f3; }
.extension-panel > span { color: var(--muted); font-size: .78rem; }
.extension-options { display: grid; grid-template-columns: repeat(3, 1fr); gap: .45rem; }
.extension-options button { min-height: 46px; border: 1px solid #a8c9bb; border-radius: 10px; color: var(--brand-dark); background: white; font-weight: 800; cursor: pointer; }
.extension-due { display: block; margin-top: .4rem; color: var(--danger); font-size: .76rem; font-weight: 800; line-height: 1.3; }
.additional-payments { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin: 0 0 1rem; padding: .85rem 1rem; border: 1px solid #e8b3ae; border-radius: 14px; color: #7f2828; background: var(--danger-bg); }
.additional-payments span { display: block; margin-top: .2rem; font-size: .8rem; }
.additional-total { flex: 0 0 auto; font-size: 1.2rem; }
.empty-state { padding: 1.25rem; border: 1px dashed #bdc9c3; border-radius: 14px; color: var(--muted); text-align: center; background: rgb(255 255 255 / 50%); }
.loading-state { padding: 4rem 1rem; text-align: center; color: var(--muted); }
.toast { position: fixed; z-index: 50; left: 50%; bottom: 1.2rem; max-width: calc(100% - 2rem); padding: .8rem 1rem; border-radius: 12px; color: white; background: #20342c; box-shadow: var(--shadow); transform: translateX(-50%); font-weight: 700; }

/* Existing catalog page remains readable while the prototype replaces only the default workspace. */
body > header { display: flex; align-items: center; gap: 1.5rem; padding: 1.25rem 5%; background: white; border-bottom: 1px solid var(--line); }
body > header .brand { color: var(--brand); font-size: 1.5rem; font-weight: 800; text-decoration: none; }
#catalog { width: min(1024px, 100%); margin: 2rem auto; padding: 0 5%; }
.table-scroll { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; background: white; }
th, td { padding: 1rem; text-align: left; border-bottom: 1px solid var(--line); }
.button { display: inline-block; margin-top: 1rem; padding: .75rem 1.25rem; border-radius: .5rem; color: white; background: var(--brand); text-decoration: none; }

@media (max-width: 800px) {
    .equipment-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .checkout-body { grid-template-columns: 1fr; }
    .checkout-summary { position: static; }
    .rental-list { grid-template-columns: 1fr; }
}

@media (max-width: 520px) {
    .prototype-badge { display: none; }
    .workspace { padding-bottom: 9rem; }
    .page-heading { align-items: start; }
    .clock { display: none; }
    .equipment-grid { gap: .65rem; }
    .equipment-card { min-height: 158px; padding: .8rem; }
    .equipment-number { font-size: 1.4rem; }
    .selection-tray { align-items: stretch; flex-direction: column; gap: .65rem; }
    .selection-tray .primary-button { width: 100%; }
    .sheet-backdrop { padding: .5rem; }
    .checkout-sheet { max-height: calc(100vh - 1rem); }
    .checkout-body { padding: 1rem; }
    .duration-presets { grid-template-columns: repeat(2, 1fr); }
    .input-row { align-items: stretch; flex-direction: column; gap: .4rem; }
    .unit-badge { flex-basis: auto; }
    .field-error, .individual-toggle, .individual-duration { margin-left: 0; }
    .rental-card { grid-template-columns: 1fr; }
    .rental-actions { grid-template-columns: 1fr 1fr; }
    .action-button { width: 100%; }
    .extension-panel { grid-column: 1; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; }
}
