:root {
    --bg: #f5f6f8;
    --card: #ffffff;
    --ink: #1f2430;
    --muted: #6b7280;
    --accent: #bccb69;
    --border: #e3e6ea;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: "Rubik", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    background: var(--bg);
    color: var(--ink);
}

.site-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.9rem 1.25rem;
    background: var(--card);
    border-bottom: 1px solid var(--border);
}

.site-header__brand {
    display: inline-flex;
    align-items: center;
    text-decoration: none;
}
.site-header__logo {
    height: 15px;
    width: auto;
    max-width: 160px;
    display: block;
}

.content {
    max-width: 820px;
    margin: 1.5rem auto;
    padding: 0 1.25rem;
}
.content--wide { max-width: 1200px; }

a { color: var(--accent); }

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

.muted { color: var(--muted); }

.site-header__user {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.logout-form { margin: 0; }

.btn {
    display: inline-block;
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 0.4rem 0.8rem;
    font-size: 0.9rem;
    cursor: pointer;
    background: var(--card);
    color: var(--ink);
    text-decoration: none;
}

.btn--primary {
    background: var(--accent);
    border-color: var(--accent);
    color: #fff;
    width: 100%;
    padding: 0.6rem;
    font-size: 1rem;
}

.btn--ghost { background: transparent; }

.page-title { font-size: 1.4rem; margin: 0 0 1rem; }

/* Auth */
.auth-card { max-width: 360px; margin: 3rem auto; }
.auth-card__title { font-size: 1.3rem; margin: 0 0 1rem; }

.field { display: block; margin-bottom: 0.9rem; }
.field__label {
    display: block;
    font-size: 0.85rem;
    color: var(--muted);
    margin-bottom: 0.3rem;
}
.field input {
    width: 100%;
    padding: 0.55rem 0.65rem;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 1rem;
}

/* Alerts */
.alert {
    border-radius: 8px;
    padding: 0.7rem 0.9rem;
    margin-bottom: 1rem;
    font-size: 0.95rem;
}
.alert--error { background: #fdecea; color: #a12b21; }
.alert--warning { background: #fdf6e3; color: #8a6d1b; }
.alert--info { background: #eef4fb; color: #2c5d8a; }

/* Date navigation */
.date-nav {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}
.date-nav__form { margin: 0; }
.date-nav__form input {
    padding: 0.4rem 0.6rem;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 0.95rem;
}
.date-nav__prev { margin-left: auto; }

/* Appointments list */
.appt-list { list-style: none; margin: 0; padding: 0; }
.appt {
    display: flex;
    align-items: baseline;
    gap: 0.75rem;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 0.7rem 0.9rem;
    margin-bottom: 0.5rem;
}
.appt__num {
    flex: 0 0 auto;
    min-width: 1.6rem;
    height: 1.6rem;
    line-height: 1.6rem;
    text-align: center;
    border-radius: 50%;
    background: var(--bg);
    color: var(--muted);
    font-size: 0.85rem;
}
.appt__time {
    flex: 0 0 auto;
    color: var(--muted);
    font-size: 0.9rem;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}
.appt__service { flex: 1 1 auto; }
.appt__client { flex: 0 0 auto; font-weight: 600; }

/* Break rows */
.appt--break { background: transparent; border-style: dashed; }
.appt--break .appt__num { background: transparent; }
.appt__break-name { color: var(--accent); font-style: italic; } /* #bccb69 */
.empty-state { padding: 1.5rem 0; }

/* Client page */
.section-title { font-size: 1rem; margin: 0 0 0.6rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.03em; }
.client-comment { margin: 0; white-space: normal; line-height: 1.5; }

.history { width: 100%; border-collapse: collapse; font-size: 0.95rem; }
.history th, .history td {
    text-align: left;
    padding: 0.55rem 0.6rem;
    border-bottom: 1px solid var(--border);
    vertical-align: top;
}
.history th { color: var(--muted); font-weight: 600; font-size: 0.85rem; }
.history__date { white-space: nowrap; }
.history__comment { color: var(--ink); }

/* --- Calendar ---------------------------------------------------------- */
.cal-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
}
.cal-tabs { display: inline-flex; border: 1px solid var(--border); border-radius: 8px; overflow: hidden; }
.cal-tab {
    padding: 0.4rem 0.9rem;
    font-size: 0.9rem;
    text-decoration: none;
    color: var(--ink);
    background: var(--card);
    border-right: 1px solid var(--border);
}
.cal-tab:last-child { border-right: 0; }
.cal-tab--active { background: var(--accent); color: #fff; }

/* Day view — a time grid: stylist columns (X) over an hour axis (Y) */
.cal-col__you {
    font-size: 0.7rem;
    font-weight: 600;
    color: #fff;
    background: var(--accent);
    border-radius: 999px;
    padding: 0.05rem 0.45rem;
    text-transform: uppercase;
}
.cal-col__empty { padding: 0.5rem 0.3rem; }

/* Colleagues' events are visible but plainly un-clickable (week/month) */
.appt--other { opacity: 0.9; }
.appt__client--muted { color: var(--muted); font-weight: 600; cursor: default; }

/* Persistent horizontal scrollbar so overflowing stylist columns are discoverable
   even where the OS uses hidden/overlay scrollbars (macOS, iOS). */
.cal-tablewrap {
    overflow: auto;
    /* Cap to the viewport so the grid scrolls inside its own box — this keeps the
       horizontal scrollbar on-screen instead of stranded below a tall grid. */
    max-height: 78vh;
    scrollbar-width: thin;                       /* Firefox */
    scrollbar-color: #9aa2ad var(--border);
}
.cal-tablewrap::-webkit-scrollbar {
    height: 10px;
    width: 10px;
    -webkit-appearance: none;                    /* force a non-overlay bar */
}
.cal-tablewrap::-webkit-scrollbar-track {
    background: var(--border);
    border-radius: 5px;
}
.cal-tablewrap::-webkit-scrollbar-thumb {
    background: #9aa2ad;
    border-radius: 5px;
}
.cal-tablewrap::-webkit-scrollbar-thumb:hover { background: #7f8792; }
.cal-table { border-collapse: collapse; width: 100%; table-layout: fixed; }
.cal-table__timecol { width: 3.5rem; }

/* Column headers = stylist names (sticky so they stay while scrolling) */
.cal-table__corner { border: 1px solid var(--border); background: var(--card); }
.cal-table__stylist {
    border: 1px solid var(--border);
    background: var(--card);
    padding: 0.5rem 0.3rem;
    text-align: center;
    font-size: 0.9rem;
    font-weight: 600;
    position: sticky;
    top: 0;
    z-index: 2;
}
.cal-table__stylist--mine { color: var(--ink); background: #f4f8fc; }

/* Row headers = the hour (1 hour per row) */
.cal-table__time {
    height: var(--hour-px);
    border: 1px solid var(--border);
    vertical-align: top;
    text-align: right;
    padding: 0.1rem 0.4rem 0;
    font-size: 0.72rem;
    font-weight: 400;
    color: var(--muted);
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

/* Each stylist column spans every hour row; events are placed inside it */
.cal-tcol {
    border: 1px solid var(--border);
    vertical-align: top;
    padding: 0;
    background-image: repeating-linear-gradient(
        to bottom,
        var(--border) 0,
        var(--border) 1px,
        transparent 1px,
        transparent var(--hour-px)
    );
}
.cal-tcol--mine { background-color: #f4f8fc; }
.cal-tcol__inner { position: relative; }

/* An event block, absolutely positioned by start time + duration */
.cal-ev {
    position: absolute;
    left: 3px;
    right: 3px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    gap: 0.05rem;
    padding: 0.2rem 0.35rem;
    border-radius: 6px;
    border-left: 3px solid var(--accent);
    font-size: 0.78rem;
    line-height: 1.15;
}
.cal-ev--mine {
    background: #e9efce;
    color: var(--ink);
    text-decoration: none;
    cursor: pointer;
}
.cal-ev--mine:hover { background: #dde6b0; }
.cal-ev--other {
    background: #eef0f3;
    border-left-color: var(--muted);
    color: var(--muted);
    cursor: default;
}
/* No-show / cancelled visit: orange, struck through, never clickable */
.cal-ev--cancelled {
    background: #fbe6cf;
    border-left-color: #e08e0b;
    color: #9a5b02;
    cursor: default;
}
.cal-ev--cancelled .cal-ev__title { text-decoration: line-through; }
.cal-ev__time { font-variant-numeric: tabular-nums; font-size: 0.72rem; opacity: 0.85; }
.cal-ev__title { display: block; overflow: hidden; font-weight: 400; }

/* Week view — 7 day columns */
.cal-week {
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    gap: 0.4rem;
}
.cal-wday {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 0.4rem;
    min-height: 6rem;
}
.cal-wday--today { border-color: var(--accent); }
.cal-wday__head {
    display: block;
    text-align: center;
    text-decoration: none;
    color: var(--ink);
    text-transform: capitalize;
    font-size: 0.85rem;
    padding-bottom: 0.4rem;
    border-bottom: 1px solid var(--border);
    margin-bottom: 0.4rem;
}
.appt-list--compact .appt { margin-bottom: 0.3rem; }
.appt--chip {
    display: flex;
    align-items: baseline;
    flex-wrap: wrap;
    gap: 0.25rem 0.4rem;
    padding: 0.35rem 0.45rem;
    font-size: 0.85rem;
}
.appt__by { flex: 1 1 100%; font-size: 0.72rem; color: var(--muted); }
.appt__link { color: var(--accent); text-decoration: none; font-weight: 400; }
.appt__link:hover { text-decoration: underline; }
.appt__text { color: var(--muted); }
/* No-show / cancelled visit in the week view */
.appt--cancelled { background: #fbe6cf; border-color: #f0c48a; }
.appt--cancelled .appt__text { color: #9a5b02; text-decoration: line-through; }

@media (max-width: 720px) {
    .cal-week { grid-template-columns: repeat(7, minmax(4.5rem, 1fr)); overflow-x: auto; }
}
