/* ==========================================================================
   appointments_lite — design tokens and shared primitives.

   The palette, type scale and the flat, borderless-card look are taken from the
   reference build. That build shipped them as Tailwind utility classes compiled
   into a 46 KB stylesheet; here they are plain CSS custom properties and a
   handful of component classes, which is both smaller and legible in the markup
   without a Tailwind cheat sheet in the other hand.

   Fonts: Prata for display, Montserrat for the uppercase micro-labels, Ubuntu
   Light for body text — self-hosted from fonts/ (see css/fonts.css), with real
   fallback stacks so the page is still correctly proportioned before they land.
   ========================================================================== */

:root {
    /* --- Palette ------------------------------------------------------- */
    --ink:              #141414;
    --ink-soft:         #212121;
    --muted:            #999999;
    --muted-dark:       #8a8a8a;

    --white:            #ffffff;
    --cream:            #fdfbfa;
    --blush-pale:       #fdf5f2;
    --blush:            #f9f1ec;
    --beige:            #ecddd4;

    --gold:             #dfba9f;
    --gold-deep:        #c89b79;

    --line:             #e7e0da;
    --line-soft:        #f0ebe7;

    --error:            #b4472f;
    --error-surface:    #fdf4f1;
    --error-border:     #d9a08f;

    --status-new:       #c08a5e;
    --status-contacted: #6b7f8f;
    --status-completed: #4f6b4b;
    --status-cancelled: #a89f99;

    /* --- Type ---------------------------------------------------------- */
    --font-display: "Prata", Georgia, "Times New Roman", serif;
    --font-label:   "Montserrat", "Segoe UI", system-ui, sans-serif;
    --font-sans:    "Ubuntu", "Segoe UI", system-ui, -apple-system, sans-serif;

    /* --- Layout -------------------------------------------------------- */
    --shell-narrow: 820px;
    --shell-form:   880px;
    --shell-wide:   1420px;
}

*,
*::before,
*::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
    margin: 0;
    font-family: var(--font-sans);
    /* Ubuntu Light, not Regular: the reference build sets body copy in the 300
       weight and the whole page reads a shade heavier without it. The places
       that want more presence — the KPI numbers, a client's name — ask for 400
       or 500 explicitly. */
    font-weight: 300;
    font-size: 14px;
    line-height: 1.55;
    color: var(--ink);
    background: var(--blush-pale);
    -webkit-font-smoothing: antialiased;
}

img { max-width: 100%; height: auto; }

a { color: inherit; }

button,
input,
select,
textarea {
    font: inherit;
    font-weight: 300;
    color: inherit;
}

h1, h2, h3, h4 {
    margin: 0;
    font-weight: 400;
}

p { margin: 0; }

/* The reference build leans hard on a visible focus ring that only appears for
   keyboard users. Centralised here so every control inherits it. */
:focus-visible {
    outline: 2px solid var(--gold-deep);
    outline-offset: 2px;
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
    border: 0;
}

/* ==========================================================================
   Primitives
   ========================================================================== */

.shell {
    width: 100%;
    margin-inline: auto;
    padding-inline: 20px;
}

@media (min-width: 640px) { .shell { padding-inline: 32px; } }

.shell--narrow { max-width: var(--shell-narrow); }
.shell--form   { max-width: var(--shell-form); }
.shell--wide   { max-width: var(--shell-wide); }

/* The tiny uppercase tracked label that appears above every field, on every
   card heading and inside every button. It is the single most characteristic
   element of this design. */
.label {
    font-family: var(--font-label);
    font-size: 10.5px;
    font-weight: 600;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    line-height: 1.4;
}

.display {
    font-family: var(--font-display);
    font-weight: 400;
}

.rule {
    display: block;
    height: 1px;
    width: 28px;
    background: var(--gold);
    border: 0;
}

.card {
    border: 1px solid var(--line);
    background: var(--white);
}

/* --- Buttons ---------------------------------------------------------- */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    min-height: 44px;
    padding: 10px 18px;
    border: 1px solid var(--line);
    background: var(--white);
    color: var(--ink);
    font-family: var(--font-label);
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    text-decoration: none;
    cursor: pointer;
    transition: border-color .2s, color .2s, background-color .2s;
}

.btn:hover:not(:disabled) {
    border-color: var(--gold-deep);
    color: var(--gold-deep);
}

.btn:disabled {
    cursor: not-allowed;
    opacity: .45;
}

.btn--solid {
    border-color: var(--ink);
    background: var(--ink);
    color: var(--white);
}

.btn--solid:hover:not(:disabled) {
    border-color: var(--ink-soft);
    background: var(--ink-soft);
    color: var(--white);
}

.btn--gold {
    border-color: var(--gold-deep);
    background: var(--gold-deep);
    color: var(--white);
}

.btn--gold:hover:not(:disabled) {
    border-color: #b8865f;
    background: #b8865f;
    color: var(--white);
}

.btn--block { width: 100%; }

/* Square icon-only button — the row actions and the pager. */
.icon-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    flex: 0 0 auto;
    border: 1px solid var(--line);
    background: var(--white);
    color: var(--muted-dark);
    cursor: pointer;
    transition: border-color .15s, color .15s;
}

.icon-btn:hover:not(:disabled) {
    border-color: var(--gold-deep);
    color: var(--gold-deep);
}

.icon-btn:disabled {
    cursor: not-allowed;
    opacity: .35;
}

.icon-btn svg { width: 15px; height: 15px; }

/* Desktop pointers do not need the 44px touch target. */
@media (min-width: 1024px) {
    .icon-btn { width: 36px; height: 36px; }
    .btn { min-height: 0; }
}

/* --- Form controls ---------------------------------------------------- */

.field { display: flex; flex-direction: column; }

.field__label {
    display: flex;
    align-items: baseline;
    gap: 8px;
    margin-bottom: 10px;
    font-family: var(--font-label);
    font-size: 10.5px;
    font-weight: 600;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: var(--ink);
}

.field__optional {
    font-family: var(--font-sans);
    font-size: 10px;
    font-weight: 300;
    letter-spacing: normal;
    text-transform: none;
    color: var(--muted);
}

.input,
.select,
.textarea {
    width: 100%;
    min-height: 46px;
    padding: 12px 16px;
    border: 1px solid var(--line);
    border-radius: 0;
    background: var(--white);
    font-size: 14px;
    color: var(--ink);
    transition: border-color .15s;
}

.input::placeholder,
.textarea::placeholder { color: rgba(153, 153, 153, .8); }

.input:focus,
.select:focus,
.textarea:focus {
    outline: none;
    border-color: var(--gold-deep);
}

.textarea { resize: vertical; min-height: 130px; }

/* Native select arrows differ wildly between platforms and none of them match
   this type. Suppress the default and draw one. */
.select {
    appearance: none;
    -webkit-appearance: none;
    cursor: pointer;
    padding-right: 42px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%23c89b79' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 14px center;
}

.input--error,
.select--error,
.textarea--error { border-color: var(--error-border); }

.field__error {
    margin-top: 7px;
    font-size: 11.5px;
    color: var(--error);
    min-height: 0;
}

.field__error:empty { display: none; }

.field__counter {
    align-self: flex-end;
    margin-top: 8px;
    font-size: 11px;
    color: var(--muted);
    font-variant-numeric: tabular-nums;
}

/* Honeypot. Kept out of the layout and out of the accessibility tree, but not
   display:none — some bots skip hidden inputs, and the whole point is that they
   fill it in. */
.hp {
    position: absolute;
    left: -9999px;
    width: 1px;
    height: 1px;
    opacity: 0;
    pointer-events: none;
}

/* --- Alerts ----------------------------------------------------------- */

.alert {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 14px 16px;
    border: 1px solid var(--error-border);
    background: var(--error-surface);
    font-size: 13px;
    color: var(--error);
}

.alert svg { flex: 0 0 auto; margin-top: 2px; }

.alert--notice {
    border-color: var(--gold);
    background: var(--blush);
    color: #8a5a32;
}

/* --- Status badges ---------------------------------------------------- */

.badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    border: 1px solid;
    font-family: var(--font-label);
    font-size: 9.5px;
    font-weight: 600;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    white-space: nowrap;
}

/* The status mark. It inherits the badge's colour, so each status keeps
   reading as one object rather than a glyph sitting next to a label. */
.badge svg {
    flex: 0 0 auto;
    margin-block: -1px;
}

.badge--new       { border-color: rgba(200, 155, 121, .45); background: var(--blush);  color: #956135; }
.badge--contacted { border-color: #b9c6d0; background: #f2f6f9; color: #4e6474; }
.badge--completed { border-color: #b3c4b0; background: #f2f6f1; color: #435c40; }
.badge--cancelled { border-color: #d5cfca; background: #f6f4f2; color: #7d746e; }

/* --- Language switcher ------------------------------------------------ */

.lang {
    display: inline-flex;
    border: 1px solid var(--line);
    background: var(--white);
}

.lang__opt {
    padding: 7px 11px;
    border: 0;
    background: transparent;
    font-family: var(--font-label);
    font-size: 9.5px;
    font-weight: 600;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--muted-dark);
    text-decoration: none;
    cursor: pointer;
    transition: color .15s, background-color .15s;
}

.lang__opt + .lang__opt { border-left: 1px solid var(--line-soft); }

.lang__opt:hover { color: var(--ink); background: var(--blush-pale); }

.lang__opt[aria-current="true"] {
    background: var(--ink);
    color: var(--white);
}

/* --- Toast ------------------------------------------------------------ */

.toast-stack {
    position: fixed;
    left: 50%;
    bottom: 24px;
    z-index: 60;
    display: flex;
    flex-direction: column;
    gap: 8px;
    transform: translateX(-50%);
    width: calc(100% - 32px);
    max-width: 420px;
    pointer-events: none;
}

.toast {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 12px 16px;
    border: 1px solid var(--ink);
    background: var(--ink);
    color: var(--white);
    font-size: 12.5px;
    pointer-events: auto;
    animation: toast-in .18s ease-out;
}

.toast--error { border-color: var(--error); background: var(--error); }

.toast__action {
    border: 0;
    background: none;
    color: var(--gold);
    font-family: var(--font-label);
    font-size: 9.5px;
    font-weight: 600;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    cursor: pointer;
}

@keyframes toast-in {
    from { opacity: 0; transform: translateY(8px); }
    to   { opacity: 1; transform: none; }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: .01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: .01ms !important;
    }
}
