/* Purple Matrix – Helpdesk callback portal
   Brand palette taken from purplematrix.co.uk */
:root {
    --pm-purple: #3a1a57;
    --pm-deep: #1a0e34;
    --pm-mint: #7aedc9;
    --pm-mint-dark: #2fbf93;
    --pm-text: #212121;
    --pm-muted: #5c5566;
    --pm-bg: #f4f4f4;
    --pm-surface: #ffffff;
    --pm-tint: #f6f3f9;
    --pm-tint-2: #ebe4f2;
    --pm-border: #ddd6e5;
    --pm-error: #c62848;
    --pm-error-bg: #fdecef;
    --pm-warn-bg: #fff6df;
    --pm-warn: #7a5a00;

    --font-heading: "Nunito", "Segoe UI", Arial, sans-serif;
    --font-body: "Open Sans", "Segoe UI", Arial, sans-serif;

    --radius: 14px;
    --radius-sm: 9px;
    --shadow: 0 10px 30px rgba(26, 14, 52, .10), 0 2px 6px rgba(26, 14, 52, .06);
    --focus: 0 0 0 3px rgba(122, 237, 201, .9);
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
    margin: 0;
    font-family: var(--font-body);
    font-size: 15px;
    line-height: 1.5;
    color: var(--pm-text);
    background: var(--pm-bg);
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

main { flex: 1; }

h1, h2, h3 { font-family: var(--font-heading); line-height: 1.2; margin: 0; }

a { color: var(--pm-purple); }

[hidden] { display: none !important; }

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

.container { width: 100%; max-width: 1080px; margin: 0 auto; padding: 0 16px; }

.skip-link {
    position: absolute; left: -9999px; top: 8px; z-index: 10;
    background: var(--pm-mint); color: var(--pm-deep); padding: 8px 14px; border-radius: 8px; font-weight: 700;
}
.skip-link:focus { left: 8px; }

.muted { color: var(--pm-muted); }
.small { font-size: 13px; }

/* ---------- Header ---------- */
.site-header { background: var(--pm-purple); }
.header-inner { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 60px; }
.brand img { display: block; height: 36px; width: auto; }

/* ---------- Hero ---------- */
.hero {
    background:
        radial-gradient(1200px 400px at 85% -10%, rgba(122, 237, 201, .18), transparent 60%),
        linear-gradient(180deg, var(--pm-purple) 0%, var(--pm-deep) 100%);
    color: #fff;
    padding: 14px 0 50px;
}
.hero-inner { display: flex; align-items: center; justify-content: space-between; gap: 16px 32px; }
.hero-text { flex: 1 1 auto; min-width: 0; }
.hero h1 { font-size: clamp(24px, 3.2vw, 32px); font-weight: 800; }
.lede { margin: 4px 0 0; font-size: 15px; color: rgba(255, 255, 255, .85); }
.eyebrow {
    margin: 0 0 4px; font-family: var(--font-heading); font-weight: 700; font-size: 13px;
    text-transform: uppercase; letter-spacing: .12em; color: var(--pm-mint);
}
.hero-compact { padding: 18px 0 52px; }

.urgent {
    display: flex; gap: 12px; align-items: center; flex: 0 0 auto;
    padding: 10px 16px;
    background: rgba(255, 255, 255, .08);
    border: 2px solid var(--pm-mint);
    border-radius: var(--radius-sm);
    font-size: 14px; line-height: 1.4;
}
.urgent p { margin: 0; }
.urgent a { color: var(--pm-mint); font-weight: 800; white-space: nowrap; font-size: 1.1em; }
.urgent-icon { flex: none; width: 24px; height: 24px; fill: var(--pm-mint); }
.urgent-light { background: var(--pm-tint); border-color: var(--pm-mint-dark); margin-top: 16px; }
.urgent-light a { color: var(--pm-purple); }

/* ---------- Content / cards ---------- */
.content { margin-top: -36px; padding-bottom: 32px; }

.card {
    background: var(--pm-surface);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 20px 24px;
}
.card h2 { font-size: 20px; font-weight: 800; color: var(--pm-purple); margin-bottom: 12px; }
.card h2:focus { outline: none; }

/* ---------- Stepper (inside the booking card) ---------- */
.stepper {
    list-style: none; margin: -4px 0 14px; padding: 0 0 12px;
    display: flex; gap: 8px;
    border-bottom: 1px solid var(--pm-border);
}
.stepper li { flex: 1; display: flex; align-items: center; gap: 8px; color: var(--pm-muted); font-weight: 600; font-size: 14px; }
.stepper li + li::before { content: ""; flex: 0 0 20px; height: 2px; background: var(--pm-border); margin-right: 2px; }
.step-num {
    flex: none; width: 26px; height: 26px; border-radius: 50%;
    display: grid; place-items: center; font-size: 13px;
    background: var(--pm-tint-2); color: var(--pm-purple);
    font-family: var(--font-heading); font-weight: 800;
}
.stepper li.active { color: var(--pm-purple); font-weight: 700; }
.stepper li.active .step-num { background: var(--pm-purple); color: #fff; }
.stepper li.done .step-num { background: var(--pm-mint); color: var(--pm-deep); }

/* ---------- Forms ---------- */
.grid-4 { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 0 16px; }

.field { margin: 0 0 14px; border: 0; padding: 0; min-width: 0; }
.field label, .field legend { display: block; font-weight: 700; font-size: 14px; margin-bottom: 4px; color: var(--pm-deep); padding: 0; }
.optional { font-weight: 400; color: var(--pm-muted); font-size: 13px; }
.label-row { display: flex !important; justify-content: space-between; align-items: baseline; }
.counter { font-weight: 400; font-size: 12px; color: var(--pm-muted); }

input[type="text"], input[type="email"], input[type="tel"], select, textarea {
    width: 100%; font: inherit; color: var(--pm-text);
    height: 40px; padding: 8px 12px;
    border: 1.5px solid var(--pm-border); border-radius: var(--radius-sm);
    background: #fff;
    transition: border-color .15s, box-shadow .15s;
}
textarea { height: auto; resize: vertical; min-height: 76px; }
select {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='%233a1a57' d='M7 10l5 5 5-5z'/%3E%3C/svg%3E");
    background-repeat: no-repeat; background-position: right 8px center; background-size: 20px;
    padding-right: 34px;
}
input:hover, select:hover, textarea:hover { border-color: #b9a9cb; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--pm-purple); box-shadow: var(--focus); }

.field-note { margin: 6px 0 0; padding: 6px 10px; font-size: 12px; line-height: 1.35; background: var(--pm-warn-bg); color: var(--pm-warn); border-radius: 7px; }
.field-error { margin: 4px 0 0; font-size: 13px; font-weight: 600; color: var(--pm-error); line-height: 1.3; }
.field-error:empty { display: none; }
.has-error input, .has-error select, .has-error textarea, .has-error .segmented { border-color: var(--pm-error); }

/* Two-option toggle (new / recurring) */
.segmented {
    display: grid; grid-template-columns: 1fr 1fr; height: 40px;
    border: 1.5px solid var(--pm-border); border-radius: var(--radius-sm); overflow: hidden;
}
.segmented label { margin: 0 !important; position: relative; cursor: pointer; font-weight: 600 !important; font-size: 14px !important; }
.segmented label + label { border-left: 1.5px solid var(--pm-border); }
.segmented input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.segmented span {
    display: flex; align-items: center; justify-content: center; height: 100%; padding: 0 6px;
    text-align: center; color: var(--pm-purple); transition: background .15s, color .15s; white-space: nowrap;
}
.segmented label:hover span { background: var(--pm-tint); }
.segmented input:checked + span { background: var(--pm-purple); color: #fff; }
.segmented input:focus-visible + span { box-shadow: inset 0 0 0 3px var(--pm-mint); }

.check { display: flex !important; gap: 10px; align-items: flex-start; font-weight: 400 !important; cursor: pointer; }
.check input { margin-top: 3px; width: 18px; height: 18px; flex: none; accent-color: var(--pm-purple); }

.hp { position: absolute !important; left: -10000px; width: 1px; height: 1px; overflow: hidden; }

/* ---------- Buttons ---------- */
.actions { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-top: 6px; flex-wrap: wrap; }

.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    font-family: var(--font-heading); font-weight: 800; font-size: 15px;
    padding: 10px 22px; border-radius: 999px; border: 2px solid transparent;
    cursor: pointer; text-decoration: none; transition: transform .1s, box-shadow .2s, background .2s;
}
.btn:focus-visible { outline: none; box-shadow: var(--focus); }
.btn-primary { background: var(--pm-mint); color: var(--pm-deep); box-shadow: 0 2px 14px rgba(0, 0, 0, .16); }
.btn-primary:hover:not(:disabled) { box-shadow: 0 2px 18px var(--pm-mint); transform: translateY(-1px); }
.btn-ghost { background: transparent; color: var(--pm-purple); border-color: var(--pm-border); }
.btn-ghost:hover { border-color: var(--pm-purple); background: var(--pm-tint); }
.btn:disabled { opacity: .5; cursor: not-allowed; box-shadow: none; }

.icon-btn {
    width: 34px; height: 34px; border-radius: 50%; border: 1.5px solid var(--pm-border);
    background: #fff; cursor: pointer; display: grid; place-items: center;
}
.icon-btn svg { width: 20px; height: 20px; fill: var(--pm-purple); }
.icon-btn:hover:not(:disabled) { background: var(--pm-tint); border-color: var(--pm-purple); }
.icon-btn:focus-visible { outline: none; box-shadow: var(--focus); }
.icon-btn:disabled { opacity: .35; cursor: not-allowed; }

/* ---------- Alerts ---------- */
.alert { padding: 10px 14px; border-radius: var(--radius-sm); margin-bottom: 14px; font-weight: 600; font-size: 14px; }
.alert-error { background: var(--pm-error-bg); color: var(--pm-error); border: 1px solid #f5c2cc; }

/* ---------- Scheduler ---------- */
.scheduler { display: grid; grid-template-columns: minmax(0, 340px) minmax(0, 1fr); gap: 32px; margin-bottom: 8px; }

.calendar-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 2px; }
.calendar-head h3 { font-size: 17px; font-weight: 800; color: var(--pm-deep); }

.calendar-weekdays, .calendar-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.calendar-weekdays span { text-align: center; font-size: 11px; font-weight: 700; color: var(--pm-muted); text-transform: uppercase; padding: 2px 0; }

.day {
    height: 34px; width: 100%;
    font: inherit; font-weight: 700; font-size: 14px;
    border-radius: 8px; border: 1.5px solid transparent;
    background: var(--pm-tint); color: var(--pm-purple); cursor: pointer;
    transition: background .15s, border-color .15s;
}
.day:hover:not(:disabled) { background: var(--pm-tint-2); border-color: var(--pm-purple); }
.day:focus-visible { outline: none; box-shadow: var(--focus); }
.day:disabled { background: transparent; color: #b8b2c0; font-weight: 400; cursor: default; }
.day.today { border-color: var(--pm-mint-dark); }
.day.selected, .day.selected:hover { background: var(--pm-purple); color: #fff; border-color: var(--pm-purple); }
.day-empty { visibility: hidden; }
.calendar .small { margin: 8px 0 0; }

.slots h3 { font-size: 17px; font-weight: 800; color: var(--pm-deep); margin: 6px 0 2px; }
.slots .muted { margin: 0 0 4px; }
.slot-group-title { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; color: var(--pm-muted); margin: 8px 0 5px; }
.slot-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(66px, 1fr)); gap: 6px; }
.slot {
    font: inherit; font-weight: 700; font-size: 14px;
    height: 34px; border-radius: 8px;
    border: 1.5px solid var(--pm-border); background: #fff; color: var(--pm-purple);
    cursor: pointer; transition: background .15s, border-color .15s;
}
.slot:hover:not(:disabled) { border-color: var(--pm-purple); background: var(--pm-tint); }
.slot:focus-visible { outline: none; box-shadow: var(--focus); }
.slot:disabled { color: #c3bdcb; background: #faf9fb; text-decoration: line-through; cursor: not-allowed; }
.slot.selected, .slot.selected:hover { background: var(--pm-mint); border-color: var(--pm-mint-dark); color: var(--pm-deep); }

.loading { color: var(--pm-muted); font-size: 14px; }

/* ---------- Summary / confirmation ---------- */
.confirm-layout { display: grid; grid-template-columns: minmax(0, 300px) minmax(0, 1fr); gap: 24px; align-items: start; margin-bottom: 14px; }

.when-box {
    display: flex; flex-direction: column; gap: 2px;
    padding: 14px 18px;
    background: var(--pm-tint); border-left: 5px solid var(--pm-mint); border-radius: var(--radius-sm);
}
.when-label { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; color: var(--pm-muted); }
.when-box > strong { font-family: var(--font-heading); font-size: 19px; font-weight: 800; color: var(--pm-deep); }

.summary { margin: 0; display: grid; font-size: 14px; }
.summary > div { display: grid; grid-template-columns: 140px 1fr; gap: 12px; padding: 5px 0; border-bottom: 1px solid var(--pm-border); }
.summary > div:first-child { padding-top: 0; }
.summary dt { color: var(--pm-muted); font-weight: 600; }
.summary dd { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; max-height: 7.5em; overflow: auto; }
.summary .ref { font-family: var(--font-heading); font-weight: 800; color: var(--pm-purple); letter-spacing: .03em; }

.consent { font-size: 14px; }

/* ---------- Attachments ---------- */
.dropzone {
    display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
    padding: 10px 14px; min-height: 46px;
    border: 1.5px dashed #b9a9cb; border-radius: var(--radius-sm);
    background: var(--pm-tint); color: var(--pm-text); font-size: 14px;
    cursor: pointer; transition: border-color .15s, background .15s;
}
.dropzone svg { width: 20px; height: 20px; fill: var(--pm-purple); flex: none; }
.dropzone .link-like { color: var(--pm-purple); font-weight: 700; text-decoration: underline; }
.dropzone-hint { margin-left: auto; font-size: 12px; color: var(--pm-muted); }
.dropzone:hover, .dropzone:focus-visible { border-color: var(--pm-purple); outline: none; }
.dropzone:focus-visible { box-shadow: var(--focus); }
.dropzone.dragover { border-color: var(--pm-mint-dark); border-style: solid; background: #e6fbf4; }
.has-error .dropzone { border-color: var(--pm-error); }

.file-list { list-style: none; margin: 8px 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.file-list:empty { display: none; }
.file-chip {
    display: flex; align-items: center; gap: 8px; max-width: 100%;
    padding: 4px 6px 4px 4px; border: 1.5px solid var(--pm-border); border-radius: 8px; background: #fff; font-size: 13px;
}
.file-chip img, .file-chip .file-icon {
    width: 36px; height: 36px; border-radius: 5px; object-fit: cover; flex: none;
    background: var(--pm-tint-2); display: grid; place-items: center;
    font-size: 10px; font-weight: 800; color: var(--pm-purple); text-transform: uppercase;
}
.file-chip .file-meta { display: flex; flex-direction: column; min-width: 0; line-height: 1.25; }
.file-chip .file-name { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 180px; }
.file-chip .file-size { color: var(--pm-muted); font-size: 12px; }
.file-chip button {
    border: 0; background: none; cursor: pointer; width: 26px; height: 26px; border-radius: 50%;
    color: var(--pm-muted); font-size: 18px; line-height: 1; flex: none;
}
.file-chip button:hover { background: var(--pm-tint); color: var(--pm-error); }
.file-chip button:focus-visible { outline: none; box-shadow: var(--focus); }

/* ---------- Client PIN ---------- */
.pin-gate { display: flex; gap: 20px; align-items: flex-start; padding: 8px 4px 4px; max-width: 640px; }
.pin-icon { flex: none; width: 52px; height: 52px; border-radius: 50%; background: var(--pm-tint-2); display: grid; place-items: center; }
.pin-icon svg { width: 26px; height: 26px; fill: var(--pm-purple); }
.pin-body h2 { font-size: 20px; font-weight: 800; color: var(--pm-purple); margin: 0 0 4px; }
.pin-body h2:focus { outline: none; }
.pin-body > p { margin: 0 0 12px; }
.pin-form { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.pin-input[type="text"] {
    width: 200px; height: 48px; text-align: center;
    font-family: var(--font-heading); font-size: 24px; font-weight: 800; letter-spacing: .35em; padding-left: .35em;
    color: var(--pm-deep);
}
.pin-gate .field-error { margin: 8px 0 0; }
.pin-gate .small { margin-top: 12px; }

.recognised {
    display: inline-flex; align-items: center; gap: 8px; margin: 0 0 12px;
    padding: 5px 12px 5px 8px; border-radius: 999px;
    background: #e6fbf4; color: #155f49; font-size: 14px;
}
.recognised svg { width: 18px; height: 18px; fill: var(--pm-mint-dark); }
input[readonly] { background: var(--pm-tint); color: var(--pm-muted); cursor: default; }

.pending-dots { font-family: var(--font-body); font-weight: 400; color: var(--pm-muted); letter-spacing: 0; }
.pending-dots::after { content: "…"; display: inline-block; width: 1em; animation: pm-pulse 1.2s ease-in-out infinite; }
@keyframes pm-pulse { 50% { opacity: .2; } }

.confirm-card .when-box { margin-bottom: 16px; }
.confirm-card .summary { margin-bottom: 16px; }
.tick {
    width: 48px; height: 48px; border-radius: 50%; background: var(--pm-mint);
    display: grid; place-items: center; margin-bottom: 12px;
}
.tick svg { width: 28px; height: 28px; fill: var(--pm-deep); }
.lede-dark { margin-top: -6px; color: var(--pm-muted); }
.confirm-card .actions { margin-top: 16px; }

/* ---------- Admin ---------- */
.alert-success { background: #e6fbf4; color: #155f49; border: 1px solid #b4ecd9; }
.admin-user { font-size: 13px; color: rgba(255, 255, 255, .8); }
.hero-link { color: var(--pm-mint); text-decoration: none; font-weight: 600; }
.hero-link:hover { text-decoration: underline; }

.admin-toolbar { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.admin-search { display: flex; gap: 8px; align-items: center; }
.admin-search input { width: 260px; }

.table-wrap { overflow-x: auto; }
.admin-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.admin-table th { text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--pm-muted); padding: 8px 10px; border-bottom: 2px solid var(--pm-border); white-space: nowrap; }
.admin-table td { padding: 10px; border-bottom: 1px solid var(--pm-border); vertical-align: middle; }
.admin-table tr:hover td { background: var(--pm-tint); }
.admin-table tr.inactive td { color: var(--pm-muted); }
.pin-cell { font-family: var(--font-heading); font-weight: 800; letter-spacing: .15em; color: var(--pm-purple); }
.actions-cell { text-align: right; }
.actions-cell a { font-weight: 700; }

.badge { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: 12px; font-weight: 700; }
.badge-on { background: #e6fbf4; color: #155f49; }
.badge-off { background: #f1eef4; color: var(--pm-muted); }

.span-2 { grid-column: span 2; }
.grid-2-admin { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 16px; }
.grid-2-admin textarea { min-height: 120px; font-family: Consolas, "Courier New", monospace; font-size: 14px; }
.input-with-button { display: flex; gap: 8px; }
.input-with-button input { flex: 1; min-width: 0; }
.pin-admin { font-family: var(--font-heading) !important; font-weight: 800; letter-spacing: .3em; }
.btn-small { padding: 6px 14px; font-size: 14px; }
.link-button { background: none; border: 0; padding: 0; font: inherit; font-weight: 700; color: var(--pm-purple); text-decoration: underline; cursor: pointer; }
.divider { border: 0; border-top: 1px solid var(--pm-border); margin: 24px 0 16px; }
.danger-zone { display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap; }
.danger-zone p { margin: 2px 0 0; }

/* ---------- Footer ---------- */
.site-footer { background: var(--pm-deep); color: rgba(255, 255, 255, .75); font-size: 13px; }
.footer-inner { display: flex; justify-content: space-between; align-items: center; gap: 8px 24px; flex-wrap: wrap; padding-top: 14px; padding-bottom: 14px; }
.site-footer nav { display: flex; gap: 20px; flex-wrap: wrap; }
.site-footer a { color: #fff; text-decoration: none; }
.site-footer a:hover { color: var(--pm-mint); text-decoration: underline; }

/* ---------- Responsive ---------- */
@media (max-width: 960px) {
    .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .hero-inner { flex-direction: column; align-items: flex-start; }
}

@media (max-width: 760px) {
    .card { padding: 16px; }
    .scheduler, .confirm-layout { grid-template-columns: 1fr; gap: 16px; }
    .summary > div { grid-template-columns: 1fr; gap: 0; }
    .stepper li { flex-direction: column; gap: 2px; font-size: 12px; text-align: center; }
    .stepper li + li::before { display: none; }
    .actions .btn { flex: 1 1 auto; }
}

@media (max-width: 520px) {
    .grid-4, .grid-2-admin { grid-template-columns: 1fr; }
    .span-2 { grid-column: auto; }
    .pin-gate { flex-direction: column; gap: 12px; }
    .admin-search input { width: 100%; }
    .brand img { height: 30px; }
}

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