:root {
    --ink: #f6f3ea;
    --muted: #a9aaa2;
    --canvas: #0b0d0f;
    --surface: #15191b;
    --line: #303536;
    --navy: #080a0b;
    --accent: #e4b936;
    --accent-dark: #f0c84d;
    --success: #217a56;
    --danger: #b84a4a;
    --shadow: 0 14px 34px rgba(0, 0, 0, 0.28);
}

* { box-sizing: border-box; }
html { min-height: 100%; }
body {
    min-height: 100vh;
    margin: 0;
    color: var(--ink);
    background-color: var(--canvas);
    background-image: linear-gradient(135deg, rgba(228, 185, 54, .11), transparent 38%), repeating-linear-gradient(135deg, rgba(255, 255, 255, .025) 0, rgba(255, 255, 255, .025) 1px, transparent 1px, transparent 5px);
    background-attachment: fixed;
    font-family: "Trebuchet MS", "Segoe UI", sans-serif;
    line-height: 1.45;
}
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; }
button, .button { cursor: pointer; }
h1, h2, h3, p { margin-top: 0; }
h1 { margin-bottom: 8px; font-size: clamp(1.7rem, 3vw, 2.45rem); letter-spacing: 0; }
h2 { margin-bottom: 6px; font-size: 1.15rem; letter-spacing: 0; }

.app-body { background: var(--canvas); }
.topbar {
    min-height: 70px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    padding: 0 36px;
    color: #fff;
    background: #070809;
    border-bottom: 3px solid var(--accent);
}
.brand { display: inline-flex; align-items: center; gap: 11px; font-size: 1rem; font-weight: 700; }
.brand small { display: block; color: #b9c6ce; font-size: .68rem; font-weight: 400; }
.nav-logo { width: 38px; height: 38px; padding: 4px; object-fit: contain; background: #fff; border-radius: 3px; }
.brand-mark { display: grid; width: 34px; height: 34px; place-items: center; color: var(--navy); background: var(--accent); font-weight: 800; }
.topbar-actions { display: flex; align-items: center; gap: 18px; }
.session-label { color: #cbd4da; font-size: .82rem; }
.app-layout { display: flex; min-height: calc(100vh - 70px); }
.sidebar { width: 235px; flex: 0 0 235px; padding: 32px 18px; background: #111516; border-right: 1px solid var(--line); }
.nav-label { margin: 0 12px 9px; color: var(--muted); font-size: .7rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; }
.nav-label:not(:first-child) { margin-top: 28px; }
.nav-link { display: block; margin: 3px 0; padding: 11px 12px; color: #afb4ad; border-left: 3px solid transparent; font-size: .92rem; }
.nav-link:hover, .nav-link.active { color: #fff; background: #1b2021; border-left-color: var(--accent); font-weight: 700; }
.main-content { width: min(1180px, 100%); margin: 0 auto; padding: 42px 42px 64px; }
.page-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; margin-bottom: 32px; }
.page-heading-actions { display: flex; align-items: center; gap: 10px; }
.context-help { position: relative; }
.context-help summary { display: grid; width: 36px; height: 36px; place-items: center; color: var(--accent); background: transparent; border: 1px solid #665b32; border-radius: 4px; font-weight: 800; list-style: none; cursor: pointer; }
.context-help summary::-webkit-details-marker { display: none; }
.context-help summary:hover, .context-help[open] summary { color: #111; background: var(--accent); }
.help-popover { position: absolute; z-index: 80; top: calc(100% + 8px); right: 0; width: min(330px, calc(100vw - 36px)); padding: 16px; color: var(--ink); background: #171b1c; border: 1px solid var(--line); box-shadow: var(--shadow); font-size: .8rem; }
.help-popover strong { color: var(--accent); }
.help-popover p { margin: 8px 0 0; color: var(--muted); }
.eyebrow { margin-bottom: 8px; color: var(--accent-dark); font-size: .72rem; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; }
.muted, .metric-note { color: var(--muted); }
.button { display: inline-flex; align-items: center; justify-content: center; min-height: 42px; padding: 0 17px; border: 1px solid transparent; border-radius: 4px; font-weight: 700; }
.button-primary { color: #fff; background: var(--navy); }
.button-primary:hover { background: #142633; }
.button-quiet { min-height: 34px; padding: 0 12px; color: #fff; background: transparent; border-color: #60717d; font-size: .82rem; }
.button-quiet:hover { border-color: #fff; }
.button-danger { color: #ffd9d9; background: transparent; border-color: var(--danger); }
.button-danger:hover { color: #fff; background: var(--danger); }
.metric-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; margin-bottom: 24px; }
.metric-card, .content-panel, .action-panel { background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow); }
.metric-card { min-height: 138px; display: flex; flex-direction: column; justify-content: center; padding: 22px 24px; border-top: 3px solid var(--accent); }
.metric-label { color: var(--muted); font-size: .8rem; font-weight: 700; }
.metric-card strong { margin: 5px 0; color: var(--accent); font-size: 2.1rem; font-weight: 700; }
.metric-note { font-size: .75rem; }
.content-panel { padding: 24px; }
.panel-heading { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 18px; }
.text-link { color: var(--accent-dark); font-size: .84rem; font-weight: 700; }
.table-wrap { overflow-x: auto; }
.data-table { width: 100%; border-collapse: collapse; font-size: .86rem; }
.data-table th { padding: 11px 12px; color: var(--muted); border-bottom: 2px solid var(--line); font-size: .7rem; letter-spacing: .06em; text-align: left; text-transform: uppercase; white-space: nowrap; }
.data-table td { padding: 15px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
.data-table tbody tr:hover { background: #1c2223; }
.empty-state { padding: 28px !important; color: var(--muted); text-align: center; }
.toolbar { display: flex; align-items: end; justify-content: flex-end; gap: 12px; margin-bottom: 20px; }
.toolbar label { margin: 0; color: var(--muted); font-size: .75rem; }
.toolbar select { width: 190px; padding: 9px 10px; }
.booking-toolbar { justify-content: space-between; }
.booking-toolbar > div { display: flex; align-items: center; gap: 12px; }
.booking-toolbar label { display: grid; gap: 6px; }
.booking-toolbar .button:disabled { cursor: not-allowed; opacity: .45; }
.visually-hidden { position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.contact-message { min-width: 280px; max-width: 460px; white-space: pre-wrap !important; overflow-wrap: anywhere; }
.contact-new { box-shadow: inset 3px 0 var(--accent); }
.contact-status { min-width: 105px; padding: 7px 8px; }
.service-create { margin-bottom: 20px; }
.archived-row { opacity: .68; }
.restore-action { color: var(--success) !important; border-color: var(--success) !important; }
.table-muted { color: var(--muted); font-size: .76rem; }
.status-badge { display: inline-block; padding: 5px 8px; color: var(--navy); background: #edf0ef; border-radius: 3px; font-size: .7rem; font-weight: 800; white-space: nowrap; }
.status-submitted, .status-under-review { color: #8b5d16; background: #f8ecd7; }
.status-approved, .status-scheduled { color: #176444; background: #e0f1e8; }
.status-completed { color: #285d82; background: #e4f0f8; }
.status-cancelled { color: #963f3f; background: #f8e2e2; }
.status-select { min-width: 125px; padding: 7px 8px; font-size: .75rem; }
.table-action { min-height: 30px !important; width: auto !important; margin: 0 !important; padding: 5px 9px !important; color: var(--danger) !important; background: transparent !important; border: 1px solid #e3b8b8 !important; font-size: .72rem; }
.table-action:hover { color: #fff !important; background: var(--danger) !important; }
.table-actions { display: flex; align-items: center; gap: 6px; }
.table-link { display: inline-flex; min-height: 30px; align-items: center; padding: 5px 9px; color: var(--accent); border: 1px solid #665b32; font-size: .72rem; font-weight: 700; }
.quote-action { color: var(--accent) !important; border-color: #665b32 !important; }
.quote-action:hover { color: #111 !important; background: var(--accent) !important; }
.customer-home { max-width: 960px; }
.quick-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 18px; }
.action-panel { display: flex; align-items: center; gap: 16px; min-height: 130px; padding: 24px; }
.action-panel:hover { border-color: var(--accent); transform: translateY(-1px); }
.action-panel strong, .action-panel small { display: block; }
.action-panel strong { margin-bottom: 6px; color: #fff; }
.action-panel small { color: var(--muted); font-size: .8rem; }
.action-icon { display: grid; width: 42px; height: 42px; place-items: center; color: #fff; background: var(--navy); font-size: 1.5rem; }

.login-body { display: grid; place-items: center; min-height: 100vh; padding: 24px; overflow: hidden; background-image: none; }
.login-shell { width: min(1040px, 100%); height: min(650px, calc(100vh - 48px)); min-height: 0; display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(380px, .95fr); overflow: hidden; background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow); }
.login-intro { position: relative; display: flex; flex-direction: column; justify-content: space-between; padding: 42px; background-color: #0a0c0d; background-image: linear-gradient(135deg, rgba(228, 185, 54, .14), transparent 42%), repeating-linear-gradient(135deg, rgba(255, 255, 255, .024) 0, rgba(255, 255, 255, .024) 1px, transparent 1px, transparent 5px); border-right: 1px solid var(--line); }
.login-visual-mark { display: flex; align-items: center; gap: 18px; margin: 26px 0 10px; color: var(--accent); font-size: .68rem; font-weight: 800; letter-spacing: .12em; }
.login-visual-mark img { width: 112px; height: 112px; padding: 10px; object-fit: contain; background: #fff; border: 1px solid rgba(228, 185, 54, .7); box-shadow: 12px 12px 0 rgba(228, 185, 54, .12); }
.login-message { max-width: 470px; }
.login-message h1 { max-width: 440px; margin-bottom: 18px; color: #fff; font-size: 3rem; line-height: 1.08; }
.login-message > p:last-child { max-width: 430px; color: var(--muted); font-size: 1rem; }
.login-back { color: var(--accent); font-size: .82rem; font-weight: 700; }
.login-form-panel { display: grid; place-items: center; padding: 48px; background: #171b1c; }
.login-form-wrap { width: min(100%, 380px); }
.login-form-wrap h2 { margin-bottom: 7px; color: #fff; font-size: 1.65rem; }
.login-form-wrap form { margin-top: 30px; }
.login-submit { margin-top: 24px !important; background: var(--accent) !important; color: #111 !important; }
.login-submit:hover { background: var(--accent-dark) !important; }
.login-alternatives { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 10px; }
.login-alternatives button { min-height: 48px; margin: 0; padding: 8px; color: var(--muted); background: transparent; border: 1px solid var(--line); font-size: .76rem; }
.login-alternatives button:hover { color: #fff; background: #202526; border-color: #697170; }

.container, .booking-container, .admin-container { width: min(100% - 32px, 560px); margin: 42px auto; padding: 30px; color: var(--ink); background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow); }
.container { text-align: center; }
.container h1, .container h2, .booking-container h2, .admin-container h2 { color: var(--accent); }
label { display: block; margin: 17px 0 6px; color: var(--ink); font-size: .82rem; font-weight: 700; text-align: left; }
input[type="text"], input[type="password"], input[type="email"], input[type="tel"], input[type="date"], input[type="time"], input[type="number"], textarea, select { width: 100%; padding: 11px 12px; color: #fff; background: #202526; border: 1px solid #555d5c; border-radius: 4px; }
input:focus, textarea:focus, select:focus { outline: 3px solid rgba(201, 139, 46, .2); border-color: var(--accent); }
button:not(.button) { width: 100%; min-height: 42px; margin-top: 16px; padding: 10px 14px; color: #fff; background: var(--navy); border: 0; border-radius: 4px; font-weight: 700; }
button:not(.button):hover { background: #142633; }
.booking-container { width: min(100% - 32px, 760px); }
.booking-container .dropdown-container { display: flex; align-items: end; gap: 10px; margin: 24px 0; }
.dropdown-container label { flex: 1; margin: 0; }
.dropdown-container button { width: auto; margin: 0; }
.booking-frame { margin: 14px 0; padding: 16px; background: #191e20; border: 1px solid var(--line); border-left: 3px solid var(--accent); }
.booking-frame table { width: 100%; color: var(--ink); text-align: left; }
.booking-frame th { width: 35%; padding: 6px 0; color: var(--muted); font-size: .78rem; text-transform: uppercase; }
.booking-frame td { padding: 6px 0; }
.booking-frame-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--line); }
.booking-frame-actions .button { color: var(--ink); }
.management-panel { width: min(100%, 720px); margin: 0; text-align: left; }
.directory-page { max-width: 1280px; }
.directory-toolbar { display: flex; align-items: end; justify-content: space-between; gap: 18px; margin-bottom: 20px; }
.search-field { width: min(100%, 470px); }
.search-field label { margin-top: 0; }
input[type="search"] { width: 100%; padding: 11px 12px; color: #fff; background: #202526; border: 1px solid #555d5c; border-radius: 4px; }
input[type="search"]:focus { outline: 3px solid rgba(201, 139, 46, .2); border-color: var(--accent); }
.selectable-table tbody tr { cursor: pointer; transition: background-color .15s ease; }
.booking-row { cursor: pointer; }
.booking-row:focus { outline: 2px solid var(--accent); outline-offset: -2px; }
.selectable-table tbody tr:focus { outline: 2px solid var(--accent); outline-offset: -2px; }
.selectable-table tbody tr.selected { background: #252b2b; box-shadow: inset 3px 0 var(--accent); }
.selectable-table td { white-space: nowrap; }
.multiline-cell { white-space: pre-line !important; }
.directory-status { display: inline-block; padding: 5px 8px; border-radius: 3px; font-size: .7rem; font-weight: 800; text-transform: capitalize; }
.status-active { color: #8fe0bc; background: rgba(33, 122, 86, .24); }
.status-inactive { color: #efaaaa; background: rgba(184, 74, 74, .2); }
.record-editor { max-width: 820px; margin-top: 24px; scroll-margin-top: 24px; }
.record-editor .button-quiet { color: var(--ink); border-color: var(--line); }
.label-note { color: var(--muted); font-size: .72rem; font-weight: 400; }
.profile-page { max-width: 1040px; }
.profile-panel { max-width: 820px; }
.profile-back, .profile-actions .button-quiet { color: var(--ink); border-color: var(--line); }
.profile-actions { display: flex; justify-content: flex-end; gap: 10px; padding-top: 28px; }
.profile-action-spacer { flex: 1; }
.form-status { margin: 18px 0 0; color: #efaaaa; font-size: .85rem; }
.detail-section { margin-top: 20px; }
.booking-facts { display: grid; grid-template-columns: repeat(4, 1fr); gap: 18px; }
.booking-facts span, .booking-facts strong { display: block; }
.booking-facts span { margin-bottom: 5px; color: var(--muted); font-size: .72rem; text-transform: uppercase; }
.booking-facts strong { font-size: .9rem; overflow-wrap: anywhere; }
.required-count { width: 150px; margin: 0; }
.required-count input { margin-top: 5px; }
.staffing-note { font-size: .82rem; }
.employee-picker { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.employee-option { display: flex; align-items: center; gap: 10px; margin: 0; padding: 12px; background: #1b2021; border: 1px solid var(--line); cursor: pointer; }
.employee-option:has(input:checked) { border-color: var(--accent); background: #24251d; }
.employee-option input { width: auto; }
.employee-option strong, .employee-option small { display: block; }
.employee-option small { color: var(--muted); font-size: .72rem; }
.data-table input[type="text"], .data-table input[type="number"] { min-width: 170px; }
.data-table input[type="checkbox"] { width: 18px; height: 18px; }
.data-table .button-quiet { color: var(--ink); border-color: var(--line); }
.rate-line { display: block; margin-bottom: 3px; white-space: nowrap; }
.rate-line b, .override-note { color: var(--accent); font-size: .68rem; text-transform: uppercase; }
.quote-preview-table .quote-override { min-width: 125px; }
.quote-heading-actions { display: flex; align-items: flex-end; gap: 10px; }
.quote-heading-actions label { margin: 0; color: var(--muted); font-size: .72rem; }
.quote-heading-actions select { width: 175px; margin-top: 5px; padding: 8px 10px; }
.override-note { display: block; margin-top: 4px; }
.booking-create { max-width: 980px; }
.booking-form-panel { max-width: 780px; }
.form-section-heading { display: flex; align-items: center; gap: 14px; padding-bottom: 13px; margin: 2px 0 4px; border-bottom: 1px solid var(--line); }
.form-section-heading:not(:first-child) { margin-top: 34px; }
.form-section-heading > span { display: grid; width: 34px; height: 34px; flex: 0 0 34px; place-items: center; color: #111; background: var(--accent); font-size: .75rem; font-weight: 800; }
.form-section-heading h2, .form-section-heading p { margin: 0; }
.form-section-heading p { color: var(--muted); font-size: .78rem; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 18px; }
.form-actions { display: flex; justify-content: flex-end; padding-top: 26px; }
.form-actions .button { min-width: 180px; background: var(--accent); color: #111; }
.location-autocomplete { position: relative; }
.location-suggestions { position: absolute; z-index: 50; top: calc(100% + 4px); right: 0; left: 0; max-height: 280px; overflow-y: auto; background: #171b1c; border: 1px solid #555d5c; box-shadow: var(--shadow); }
.location-suggestion { width: 100% !important; min-height: 0 !important; margin: 0 !important; padding: 11px 12px !important; color: var(--ink) !important; background: transparent !important; border: 0 !important; border-bottom: 1px solid var(--line) !important; border-radius: 0 !important; text-align: left; font-weight: 400 !important; }
.location-suggestion:last-child { border-bottom: 0 !important; }
.location-suggestion:hover, .location-suggestion.active { color: #111 !important; background: var(--accent) !important; }
.field-note { margin: 7px 0 0; color: var(--muted); font-size: .74rem; }
.field-note a { color: var(--accent); }
.booking-history { max-width: 780px; margin-top: 34px; padding-top: 28px; border-top: 1px solid var(--line); }
.booking-filter { display: flex; align-items: end; gap: 10px; }
.booking-filter label { margin: 0; }
.booking-filter select { width: 180px; padding: 8px 10px; }
.booking-filter .button { color: var(--ink); }
[hidden] { display: none !important; }
.loading-container { position: fixed; inset: 0; z-index: 1000; display: flex; align-items: center; justify-content: center; background: rgba(23, 33, 43, .72); }
.spinner { width: 42px; height: 42px; border: 4px solid rgba(255,255,255,.35); border-top-color: var(--accent); border-radius: 50%; animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

@media (max-width: 760px) {
    .login-body { display: block; min-height: 100vh; padding: 0; overflow: auto; }
    .login-shell { width: 100%; height: auto; min-height: 100vh; grid-template-columns: 1fr; }
    .login-intro { min-height: 250px; padding: 26px 24px; border-right: 0; border-bottom: 3px solid var(--accent); }
    .login-visual-mark { margin: 18px 0 6px; }
    .login-visual-mark img { width: 74px; height: 74px; padding: 7px; }
    .login-message h1 { font-size: 2rem; }
    .login-message > p:last-child { display: none; }
    .login-form-panel { padding: 34px 24px; }
    .topbar { padding: 0 18px; }
    .session-label { display: none; }
    .app-layout { display: block; }
    .sidebar { width: 100%; padding: 10px 12px; border-right: 0; border-bottom: 1px solid var(--line); }
    .nav-label { display: none; }
    .nav-link { display: inline-block; margin: 0 2px; padding: 8px 9px; border-left: 0; border-bottom: 3px solid transparent; font-size: .78rem; }
    .nav-link:hover, .nav-link.active { border-left: 0; border-bottom-color: var(--accent); }
    .main-content { padding: 28px 18px 48px; }
    .page-heading { display: block; }
    .page-heading-actions { margin-top: 18px; justify-content: space-between; }
    .page-heading-actions .button { margin-top: 0; }
    .metric-grid, .quick-grid { grid-template-columns: 1fr; }
    .container, .booking-container, .admin-container { width: min(100% - 24px, 560px); margin: 24px auto; padding: 22px 18px; }
    .booking-container .dropdown-container { display: block; }
    .dropdown-container button { width: 100%; margin-top: 10px; }
    .toolbar { display: block; }
    .toolbar select { width: 100%; margin-top: 6px; }
    .form-grid { grid-template-columns: 1fr; }
    .form-actions .button { width: 100%; }
    .booking-filter { width: 100%; margin-top: 14px; }
    .booking-filter select { min-width: 0; flex: 1; }
    .directory-toolbar { display: block; }
    .record-editor { padding: 18px; }
    .profile-actions { align-items: stretch; flex-direction: column-reverse; }
    .profile-actions .button { width: 100%; }
    .profile-action-spacer { display: none; }
    .booking-facts, .employee-picker { grid-template-columns: 1fr; }
    .table-actions { min-width: max-content; }
}
