:root {
    --gold: #8B6914;
    --gold-light: #D4A853;
    --dark: #1a1a1a;
    --light: #f8f5f0;
    --text: #333;
    --muted: #777;
    --border: #e0d8c5;
    --success-bg: #e8f5e8;
    --success-fg: #2d6a2d;
    --error-bg: #fce4e4;
    --error-fg: #8b1a1a;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: 'Inter', -apple-system, system-ui, sans-serif;
    background: var(--light);
    color: var(--text);
}

.topbar {
    background: var(--dark);
    padding: 1rem 2rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.brand {
    color: var(--gold-light);
    font-weight: 600;
    text-decoration: none;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}
.topbar-right { display: flex; align-items: center; gap: 1rem; }
.topbar-link { color: #cfc6b4; font-size: 0.85rem; text-decoration: none; }
.topbar-link:hover { color: #fff; }
.topbar-user { color: #cfc6b4; font-size: 0.85rem; }
.topbar-logout { color: #cfc6b4; font-size: 0.85rem; text-decoration: none; }
.topbar-logout:hover { color: #fff; }

.login-card {
    max-width: 360px;
    margin: 4rem auto;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 2rem;
}
.login-card h1 { font-size: 1.4rem; }
.login-card .muted { margin-top: 0.25rem; }
.login-form { display: flex; flex-direction: column; gap: 1rem; margin-top: 1.5rem; }
.login-form label {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    font-weight: 500;
    font-size: 0.85rem;
}
.login-form input {
    padding: 0.7rem;
    font-size: 1rem;
    border: 1px solid var(--border);
    border-radius: 4px;
}
.login-form button { width: 100%; }
.login-note { font-size: 0.85rem; margin-top: 1rem; line-height: 1.5; }

/* Merge duplicate */
.merge-cta { font-size: 0.85rem; margin: -1rem 0 1.5rem; }
.merge-cta a { color: var(--muted); }
.merge-source { background: #fff7f0; border-color: #e6c9a8; }
.badge-pending {
    font-size: 0.7rem; background: #fbecd2; color: #8a5a00;
    padding: 0.1rem 0.4rem; border-radius: 3px; margin-left: 0.4rem;
}
.merge-btn { font-size: 0.8rem; padding: 0.4rem 0.8rem; white-space: nowrap; }
.dismiss-btn { font-size: 0.8rem; padding: 0.4rem 0.8rem; background: #fff; color: var(--muted); border: 1px solid var(--border); margin-left: 0.3rem; }
.dismiss-btn:hover { background: var(--light); color: var(--text); }

.catalog-alert {
    background: #fbecd2; color: #8a5a00; border: 1px solid #e6c9a8;
    border-left: 4px solid #b3791a; padding: 0.75rem 1rem; border-radius: 4px;
    margin-bottom: 1.5rem; font-weight: 500;
}
.catalog-alert a { color: #8a5a00; font-weight: 700; }

.container {
    max-width: 900px;
    margin: 0 auto;
    padding: 2rem;
}

h1 { margin-top: 0; }
h2 { margin-top: 0; }
.muted { color: var(--muted); }

.flash {
    padding: 1rem;
    border-radius: 4px;
    margin-bottom: 1.5rem;
    word-break: break-all;
}
.flash-success { background: var(--success-bg); color: var(--success-fg); }
.flash-error { background: var(--error-bg); color: var(--error-fg); }

.search-form {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 2rem;
}
.search-form input {
    flex: 1;
    padding: 0.75rem;
    font-size: 1rem;
    border: 1px solid var(--border);
    border-radius: 4px;
}
button {
    padding: 0.75rem 1.5rem;
    background: var(--gold);
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 1rem;
}
button:hover { background: var(--dark); }

.results {
    width: 100%;
    border-collapse: collapse;
    background: white;
    border-radius: 4px;
    overflow: hidden;
}
.results th, .results td {
    text-align: left;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--border);
}
.results th {
    background: var(--light);
    font-weight: 600;
    font-size: 0.875rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}
.results a {
    color: var(--gold);
    font-weight: 500;
}

.client-meta {
    display: grid;
    grid-template-columns: max-content 1fr;
    gap: 0.5rem 1.5rem;
    margin-bottom: 2rem;
}
.client-meta dt { font-weight: 600; color: var(--muted); }
.client-meta dd { margin: 0; }
code {
    background: #f0e8d5;
    padding: 0.125rem 0.375rem;
    border-radius: 3px;
    font-size: 0.875em;
}

.card {
    background: white;
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}

.memberships {
    list-style: none;
    padding: 0;
    margin: 0;
}
.memberships li {
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--border);
}
.memberships li:last-child { border-bottom: none; }

.charge-form {
    display: grid;
    gap: 1rem;
    max-width: 480px;
}
.charge-form label {
    display: flex;
    flex-direction: column;
    gap: 0.375rem;
    font-weight: 500;
    font-size: 0.875rem;
}
.charge-form input, .charge-form select {
    padding: 0.75rem;
    font-size: 1rem;
    font-family: inherit;
    border: 1px solid var(--border);
    border-radius: 4px;
    background: #fff;
}
.hint {
    color: var(--muted);
    font-size: 0.875rem;
    margin-top: 1rem;
}

.stripe-link {
    margin-left: 0.5rem;
    font-size: 0.8rem;
    color: var(--gold);
    text-decoration: none;
    font-weight: 500;
}
.stripe-link:hover { text-decoration: underline; }

.cal-wrap {
    display: flex;
    gap: 1.5rem;
    align-items: flex-start;
    flex-wrap: wrap;
}

.mini-cal {
    border-collapse: collapse;
    font-size: 0.8rem;
    flex-shrink: 0;
}
.mini-cal th {
    color: var(--muted);
    font-weight: 600;
    padding: 0.25rem 0.4rem;
    text-align: center;
}
.mini-cal td {
    padding: 0.25rem 0.4rem;
    text-align: center;
    border-radius: 50%;
    width: 1.8rem;
    height: 1.8rem;
    line-height: 1.3rem;
}
.mini-cal td.empty { color: transparent; }
.mini-cal td.today {
    background: var(--border);
    font-weight: 700;
}
.mini-cal td.booked {
    background: var(--gold);
    color: white;
    font-weight: 600;
}
.mini-cal td.today.booked {
    background: var(--dark);
    color: var(--gold-light);
}

.booking-lists { flex: 1; min-width: 180px; }
.booking-group + .booking-group { margin-top: 1rem; }
.booking-group h3 {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--muted);
    margin: 0 0 0.4rem;
}

.booking-list {
    list-style: none;
    padding: 0;
    margin: 0;
}
.booking-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.3rem 0;
    border-bottom: 1px solid var(--border);
    font-size: 0.875rem;
}
.booking-item:last-child { border-bottom: none; }
.bk-date { color: var(--muted); min-width: 3.5rem; }
.bk-service { flex: 1; }
.bk-badge {
    font-size: 0.7rem;
    padding: 0.15rem 0.4rem;
    border-radius: 3px;
    background: var(--border);
    color: var(--muted);
    text-transform: capitalize;
}
.bk-confirmed { background: #e8f5e8; color: #2d6a2d; }
.bk-cancelled { background: var(--error-bg); color: var(--error-fg); }

/* Allergy alert banner */
.allergy-alert {
    background: var(--error-bg);
    color: var(--error-fg);
    border: 1px solid #e6b3b3;
    border-left: 4px solid var(--error-fg);
    padding: 0.75rem 1rem;
    border-radius: 4px;
    font-weight: 600;
    margin-bottom: 1.5rem;
}

/* Internal notes / profile editor */
.internal-tag {
    font-size: 0.65rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--muted);
    background: var(--light);
    border: 1px solid var(--border);
    padding: 0.1rem 0.4rem;
    border-radius: 3px;
    vertical-align: middle;
    margin-left: 0.5rem;
}
.profile-form { display: grid; gap: 1rem; }
.profile-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 1rem;
}
.profile-form label {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
    font-weight: 500;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--muted);
}
.profile-form input, .profile-form textarea {
    padding: 0.6rem;
    font-size: 0.95rem;
    font-family: inherit;
    border: 1px solid var(--border);
    border-radius: 4px;
    color: var(--text);
    text-transform: none;
    letter-spacing: normal;
}
.profile-form textarea { resize: vertical; }
.profile-actions { display: flex; align-items: center; gap: 1rem; }
.profile-meta { font-size: 0.8rem; }

/* Rebook actions */
.rebook-btn {
    float: right;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--gold);
    text-decoration: none;
    border: 1px solid var(--gold);
    padding: 0.25rem 0.7rem;
    border-radius: 4px;
}
.rebook-btn:hover { background: var(--gold); color: #fff; }
.rebook-link {
    font-size: 0.72rem;
    color: var(--gold);
    text-decoration: none;
    white-space: nowrap;
}
.rebook-link:hover { text-decoration: underline; }

/* Homepage weekly calendar */
.week-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.5rem;
}
.week-nav { display: flex; align-items: center; gap: 0.9rem; font-size: 0.85rem; }
.week-nav a { color: var(--gold); text-decoration: none; font-weight: 600; }
.week-nav a:hover { text-decoration: underline; }
.week-label { color: var(--muted); }
.week-count { margin: 0.25rem 0 0; }

.week-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 0.5rem;
    margin-top: 1rem;
}
.day-col {
    background: var(--light);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 0.4rem;
    min-height: 90px;
}
.day-today { border-color: var(--gold); box-shadow: inset 0 0 0 1px var(--gold); }
.day-head {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-bottom: 0.4rem;
}
.day-name {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--muted);
    font-weight: 600;
}
.day-num { font-weight: 700; }
.day-today .day-num { color: var(--gold); }

.appt {
    display: block;
    background: #fff;
    border: 1px solid var(--border);
    border-left: 3px solid var(--gold);
    border-radius: 4px;
    padding: 0.35rem 0.4rem;
    margin-bottom: 0.35rem;
    text-decoration: none;
    color: var(--text);
}
.appt:hover { border-color: var(--gold); }
.appt-time { display: block; font-size: 0.7rem; font-weight: 700; color: var(--gold); }
.appt-client { display: block; font-size: 0.78rem; font-weight: 600; line-height: 1.2; }
.appt-service { display: block; font-size: 0.68rem; color: var(--muted); }
.appt-cancelled { opacity: 0.5; border-left-color: var(--error-fg); }
.appt-cancelled .appt-client { text-decoration: line-through; }
.appt-empty { color: var(--border); text-align: center; font-size: 0.85rem; padding: 0.5rem 0; }

@media (max-width: 720px) {
    .week-grid { grid-template-columns: repeat(2, 1fr); }
}

/* Data health */
.dh-dot {
    width: 0.6rem;
    height: 0.6rem;
    border-radius: 50%;
    display: inline-block;
    flex: 0 0 auto;
}
.dh-error { background: var(--error-fg); }
.dh-warn { background: var(--gold-light); }
.dh-info { background: var(--muted); }

.dh-list { list-style: none; margin: 0.5rem 0 0; padding: 0; }
.dh-list li {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 0.5rem;
    padding: 0.45rem 0;
    border-top: 1px solid var(--border);
}
.dh-summary { font-weight: 600; }
.dh-detail { color: var(--muted); font-size: 0.85rem; }
.dh-action { margin-left: auto; font-size: 0.85rem; }

/* Membership points */
.points {
    display: flex;
    align-items: baseline;
    gap: 0.5rem;
    margin-top: 0.75rem;
    padding: 0.5rem 0.75rem;
    background: var(--light);
    border: 1px solid var(--border);
    border-radius: 6px;
}
.points-num { font-size: 1.6rem; font-weight: 700; color: var(--gold); line-height: 1; }
.points-label { font-size: 0.85rem; color: var(--muted); }

/* Checkout */
.co-receipt { max-width: 560px; }
.co-lines { width: 100%; border-collapse: collapse; }
.co-lines td { padding: 0.5rem 0; border-bottom: 1px solid var(--border); vertical-align: top; }
.co-desc { font-weight: 500; }
.co-amt { text-align: right; white-space: nowrap; }
.co-act { text-align: right; white-space: nowrap; padding-left: 0.75rem; }
.co-act form { display: inline; }
.co-tag {
    font-size: 0.68rem; background: #f0e8d5; color: var(--gold);
    padding: 0.1rem 0.4rem; border-radius: 3px; margin-left: 0.4rem;
    text-transform: uppercase; letter-spacing: 0.04em;
}
.co-link {
    background: none; border: none; color: var(--muted); cursor: pointer;
    font-size: 0.78rem; padding: 0 0.3rem; text-decoration: underline;
}
.co-link:hover { background: none; color: var(--gold); }
.co-remove:hover { color: var(--error-fg); }

.co-totals { width: 100%; margin-top: 0.75rem; border-collapse: collapse; }
.co-totals td { padding: 0.2rem 0; }
.co-totals td:last-child { text-align: right; white-space: nowrap; }
.co-total td {
    border-top: 2px solid var(--dark); padding-top: 0.5rem; margin-top: 0.5rem;
    font-size: 1.35rem; font-weight: 700;
}
.co-paid {
    font-size: 0.7rem; background: var(--success-bg); color: var(--success-fg);
    padding: 0.2rem 0.5rem; border-radius: 3px; letter-spacing: 0.05em;
}
.co-tip, .co-add { display: flex; gap: 0.5rem; align-items: flex-end; flex-wrap: wrap; }
.co-tip label { display: flex; flex-direction: column; gap: 0.3rem; font-size: 0.85rem; }
.co-tip input, .co-add input, .co-add select {
    padding: 0.6rem; font-size: 1rem; font-family: inherit;
    border: 1px solid var(--border); border-radius: 4px; background: #fff;
}
.co-add select { flex: 1; min-width: 220px; }
.btn-secondary { background: #fff; color: var(--text); border: 1px solid var(--border); }
.btn-secondary:hover { background: var(--light); color: var(--text); }
.checkout-link {
    font-size: 0.75rem; color: var(--gold); text-decoration: none;
    border: 1px solid var(--border); border-radius: 3px; padding: 0.1rem 0.35rem;
    white-space: nowrap;
}
.checkout-link:hover { background: var(--gold); color: #fff; }
.checkout-done { color: var(--success-fg); border-color: var(--success-fg); }
.checkout-done:hover { background: var(--success-fg); }
.deposit-toggle {
    font-size: 0.75rem; color: var(--muted); font-weight: normal;
    display: inline-flex; align-items: center; gap: 0.3rem; margin-left: 0.5rem;
    white-space: nowrap; cursor: pointer;
}
.rebook-note { font-size: 0.7rem; color: var(--muted); font-weight: normal; margin-left: 0.5rem; }
.badge-cancelling {
    font-size: 0.7rem; background: #fbecd2; color: #8a5a00;
    padding: 0.1rem 0.4rem; border-radius: 3px;
}

/* Client-written notes — visually distinct from staff notes so nobody confuses
   what the client said with what the studio wrote about them. */
.client-tag {
    font-size: 0.65rem; background: #e8eef5; color: #2c5282;
    padding: 0.15rem 0.45rem; border-radius: 3px; text-transform: uppercase;
    letter-spacing: 0.05em; vertical-align: middle; font-weight: 600;
}
.client-notes {
    white-space: pre-wrap;
    background: #f5f8fc;
    border-left: 3px solid #2c5282;
    padding: 0.75rem 1rem;
    border-radius: 4px;
    margin: 0.5rem 0 0.25rem;
}

/* Outstanding balance */
.billing-owes { border-left: 4px solid var(--gold-light); }
.billing-blocked { border-left: 4px solid var(--error-fg); background: #fffafa; }

/* Points on the checkout screen — the operator reads this back to the client
   before they leave, so it stays legible from arm's length. */
.co-points {
    display: flex;
    align-items: baseline;
    gap: 0.5rem;
    margin-top: 0.5rem;
    padding: 0.5rem 0.75rem;
    background: var(--light);
    border: 1px solid var(--border);
    border-radius: 6px;
}
.co-points-num { font-size: 1.5rem; font-weight: 700; color: var(--gold); line-height: 1; }
.co-points-label { font-size: 0.85rem; color: var(--muted); }
