/* ==========================================================================
   Sublime Masterclass — admin panel
   Hand-written CSS. No framework. Brand colours taken from the landing page,
   but this stylesheet never touches the public site.
   ========================================================================== */

:root {
    --brand:        #6B0003;
    --brand-light:  #8A2126;
    --brand-hover:  #9E2A31;
    --rose:         #E9B9BC;
    --cream:        #F4E9EC;

    --ink:          #241a1b;
    --ink-soft:     #6b5a5c;
    --ink-faint:    #9a8b8d;

    --surface:      #ffffff;
    --canvas:       #f7f3f4;
    --line:         #e6dcde;

    --ok:           #1c7c4a;
    --ok-bg:        #e7f5ed;
    --warn:         #8a5a00;
    --warn-bg:      #fdf3e2;
    --danger:       #a01523;
    --danger-bg:    #fdeaec;
    --info-bg:      #eef1f8;
    --info:         #2c4a8a;

    --radius:       8px;
    --radius-sm:    5px;
    --shadow:       0 1px 2px rgba(36, 26, 27, .06), 0 8px 24px -12px rgba(36, 26, 27, .18);
    --shadow-lg:    0 24px 60px -20px rgba(36, 26, 27, .32);

    --sans:  system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    --serif: "Playfair Display", Georgia, "Times New Roman", serif;
}

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

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

body {
    margin: 0;
    background: var(--canvas);
    color: var(--ink);
    font-family: var(--sans);
    font-size: 15px;
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
}

a { color: var(--brand-light); }

h1, h2, h3 { margin: 0 0 .5rem; line-height: 1.25; font-weight: 600; }
h1 { font-size: 1.5rem; }
h2 { font-size: 1.15rem; }
h3 { font-size: 1rem; }

:focus-visible {
    outline: 2px solid var(--brand-light);
    outline-offset: 2px;
    border-radius: 3px;
}

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

/* ==========================================================================
   Auth screens — login, forgot, reset
   ========================================================================== */

.auth {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 2rem 1rem;
    background:
        radial-gradient(1100px 620px at 50% -10%, #7d0206 0%, var(--brand) 45%, #4d0002 100%);
}

.auth__card {
    width: 100%;
    max-width: 26rem;
    background: var(--surface);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    padding: 2.25rem 2rem 2rem;
}

.auth__brand {
    text-align: center;
    margin-bottom: 1.75rem;
    user-select: none;
}

.auth__brand-name {
    font-family: var(--serif);
    font-size: 2rem;
    line-height: 1;
    color: var(--brand);
}

.auth__brand-sub {
    margin-top: .35rem;
    font-size: .68rem;
    letter-spacing: .2em;
    text-transform: uppercase;
    color: var(--ink-faint);
}

.auth__title {
    text-align: center;
    font-size: 1.05rem;
    font-weight: 600;
    margin-bottom: .25rem;
}

.auth__lead {
    text-align: center;
    font-size: .875rem;
    color: var(--ink-soft);
    margin: 0 0 1.5rem;
}

.auth__footer {
    margin-top: 1.5rem;
    padding-top: 1.15rem;
    border-top: 1px solid var(--line);
    text-align: center;
    font-size: .82rem;
}

.auth__footer a { color: var(--brand-light); text-decoration: none; }
.auth__footer a:hover { text-decoration: underline; }

/* ==========================================================================
   Forms
   ========================================================================== */

.field { margin-bottom: 1.05rem; }

.field__label {
    display: block;
    margin-bottom: .35rem;
    font-size: .82rem;
    font-weight: 600;
    color: var(--ink);
}

.field__hint {
    display: block;
    margin-top: .3rem;
    font-size: .76rem;
    color: var(--ink-soft);
}

.field__error {
    display: block;
    margin-top: .3rem;
    font-size: .78rem;
    color: var(--danger);
}

.input {
    width: 100%;
    padding: .65rem .8rem;
    font: inherit;
    font-size: .92rem;
    color: var(--ink);
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    transition: border-color .18s ease, box-shadow .18s ease;
}

.input:hover  { border-color: #d3c4c7; }
.input:focus  {
    outline: none;
    border-color: var(--brand-light);
    box-shadow: 0 0 0 3px rgba(138, 33, 38, .12);
}

.input[aria-invalid="true"] {
    border-color: var(--danger);
    background: #fffafa;
}

.input::placeholder { color: var(--ink-faint); }

/* Password field with a reveal button */
.password { position: relative; }
.password .input { padding-right: 3rem; }

.password__toggle {
    position: absolute;
    top: 50%;
    right: .35rem;
    transform: translateY(-50%);
    display: grid;
    place-items: center;
    width: 2.25rem;
    height: 2.25rem;
    padding: 0;
    border: 0;
    border-radius: var(--radius-sm);
    background: transparent;
    color: var(--ink-soft);
    cursor: pointer;
}

.password__toggle:hover { background: var(--canvas); color: var(--ink); }
.password__toggle svg   { width: 18px; height: 18px; }

/* Password strength meter */
.strength { margin-top: .5rem; }

.strength__track {
    height: 4px;
    border-radius: 99px;
    background: var(--line);
    overflow: hidden;
}

.strength__bar {
    height: 100%;
    width: 0;
    border-radius: 99px;
    background: var(--danger);
    transition: width .25s ease, background-color .25s ease;
}

.strength__bar[data-level="2"] { background: #c97b1a; }
.strength__bar[data-level="3"] { background: #b8a213; }
.strength__bar[data-level="4"] { background: var(--ok); }

.strength__label {
    margin-top: .3rem;
    font-size: .74rem;
    color: var(--ink-soft);
}

.checkbox {
    display: flex;
    align-items: flex-start;
    gap: .55rem;
    font-size: .85rem;
    color: var(--ink-soft);
    cursor: pointer;
}

.checkbox input { margin-top: .2rem; accent-color: var(--brand-light); }

/* ==========================================================================
   Buttons
   ========================================================================== */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .5rem;
    padding: .68rem 1.25rem;
    font: inherit;
    font-size: .9rem;
    font-weight: 600;
    color: #fff;
    background: var(--brand);
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    cursor: pointer;
    text-decoration: none;
    transition: background-color .2s ease, transform .15s ease, opacity .2s ease;
}

.btn:hover     { background: var(--brand-hover); }
.btn:active    { transform: translateY(1px); }
.btn:disabled  { opacity: .6; cursor: not-allowed; transform: none; }
.btn--block    { width: 100%; }

.btn--ghost {
    background: transparent;
    color: var(--brand-light);
    border-color: var(--line);
}

.btn--ghost:hover { background: var(--cream); }

.btn--sm { padding: .42rem .8rem; font-size: .82rem; }

.btn__spinner {
    width: 15px;
    height: 15px;
    border: 2px solid rgba(255, 255, 255, .45);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin .6s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* ==========================================================================
   Alerts
   ========================================================================== */

.alert {
    display: flex;
    align-items: flex-start;
    gap: .6rem;
    padding: .75rem .9rem;
    margin-bottom: 1rem;
    border-radius: var(--radius-sm);
    border-left: 3px solid;
    font-size: .86rem;
}

.alert--success { background: var(--ok-bg);     border-color: var(--ok);     color: #146138; }
.alert--error   { background: var(--danger-bg); border-color: var(--danger); color: #7d101c; }
.alert--warning { background: var(--warn-bg);   border-color: var(--warn);   color: #6f4900; }
.alert--info    { background: var(--info-bg);   border-color: var(--info);   color: #24406f; }

.alert__close {
    margin-left: auto;
    padding: 0 .15rem;
    border: 0;
    background: none;
    color: inherit;
    opacity: .55;
    font-size: 1.1rem;
    line-height: 1;
    cursor: pointer;
}

.alert__close:hover { opacity: 1; }

/* ==========================================================================
   Application shell
   ========================================================================== */

.shell {
    display: grid;
    grid-template-columns: 240px 1fr;
    min-height: 100vh;
}

.sidebar {
    background: var(--brand);
    color: #f3e4e6;
    display: flex;
    flex-direction: column;
    position: sticky;
    top: 0;
    height: 100vh;
}

.sidebar__brand {
    padding: 1.35rem 1.25rem 1.1rem;
    border-bottom: 1px solid rgba(255, 255, 255, .12);
    user-select: none;
}

.sidebar__brand-name {
    font-family: var(--serif);
    font-size: 1.35rem;
    line-height: 1;
    color: #FBEFE6;
}

.sidebar__brand-sub {
    margin-top: .25rem;
    font-size: .6rem;
    letter-spacing: .2em;
    text-transform: uppercase;
    color: var(--rose);
}

.sidebar__nav {
    flex: 1;
    padding: .85rem .6rem;
    overflow-y: auto;
}

.sidebar__link {
    display: flex;
    align-items: center;
    gap: .7rem;
    padding: .58rem .7rem;
    margin-bottom: .12rem;
    border-radius: var(--radius-sm);
    color: rgba(255, 255, 255, .82);
    font-size: .875rem;
    text-decoration: none;
    transition: background-color .18s ease, color .18s ease;
}

.sidebar__link:hover {
    background: rgba(255, 255, 255, .1);
    color: #fff;
}

.sidebar__link[aria-current="page"] {
    background: rgba(255, 255, 255, .16);
    color: #fff;
    font-weight: 600;
}

.sidebar__link svg { width: 18px; height: 18px; flex: none; opacity: .9; }

.sidebar__foot {
    padding: .9rem 1.1rem;
    border-top: 1px solid rgba(255, 255, 255, .12);
    font-size: .7rem;
    color: rgba(255, 255, 255, .5);
}

.main { display: flex; flex-direction: column; min-width: 0; }

.topbar {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: .9rem 1.5rem;
    background: var(--surface);
    border-bottom: 1px solid var(--line);
    position: sticky;
    top: 0;
    z-index: 20;
}

.topbar__title { font-size: 1.05rem; font-weight: 600; margin: 0; }
.topbar__spacer { margin-left: auto; }

.topbar__user {
    display: flex;
    align-items: center;
    gap: .6rem;
    font-size: .82rem;
    color: var(--ink-soft);
}

.topbar__avatar {
    display: grid;
    place-items: center;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--brand);
    color: #fff;
    font-size: .78rem;
    font-weight: 600;
}

.topbar__name { font-weight: 600; color: var(--ink); }
.topbar__role { font-size: .72rem; color: var(--ink-faint); }

.content { padding: 1.5rem; flex: 1; }

.page-head {
    display: flex;
    align-items: flex-end;
    gap: 1rem;
    margin-bottom: 1.35rem;
    flex-wrap: wrap;
}

.page-head__lead { color: var(--ink-soft); font-size: .88rem; margin: .1rem 0 0; }

/* ==========================================================================
   Cards, stats, tables
   ========================================================================== */

.card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 1.15rem 1.25rem;
}

.card__title {
    font-size: .78rem;
    font-weight: 600;
    letter-spacing: .06em;
    text-transform: uppercase;
    color: var(--ink-faint);
    margin-bottom: .75rem;
}

.grid { display: grid; gap: 1rem; }
.grid--stats { grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); }
.grid--two   { grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); }

.stat__value {
    font-family: var(--serif);
    font-size: 1.9rem;
    line-height: 1.1;
    color: var(--brand);
}

.stat__label { font-size: .82rem; color: var(--ink-soft); margin-top: .15rem; }

.table-wrap { overflow-x: auto; }

.table {
    width: 100%;
    border-collapse: collapse;
    font-size: .86rem;
}

.table th {
    text-align: left;
    padding: .6rem .7rem;
    font-size: .72rem;
    font-weight: 600;
    letter-spacing: .05em;
    text-transform: uppercase;
    color: var(--ink-faint);
    border-bottom: 1px solid var(--line);
    white-space: nowrap;
}

.table td {
    padding: .68rem .7rem;
    border-bottom: 1px solid var(--line);
    vertical-align: middle;
}

.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr:hover { background: #faf7f8; }

.badge {
    display: inline-block;
    padding: .16rem .5rem;
    border-radius: 99px;
    font-size: .72rem;
    font-weight: 600;
    white-space: nowrap;
}

.badge--ok     { background: var(--ok-bg);     color: var(--ok); }
.badge--warn   { background: var(--warn-bg);   color: var(--warn); }
.badge--danger { background: var(--danger-bg); color: var(--danger); }
.badge--muted  { background: var(--canvas);    color: var(--ink-soft); }

.empty {
    padding: 2rem 1rem;
    text-align: center;
    color: var(--ink-soft);
    font-size: .88rem;
}

.muted { color: var(--ink-soft); }
.small { font-size: .8rem; }
.mt-1 { margin-top: .5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }

.badge--info { background: var(--info-bg); color: var(--info); }

/* ==========================================================================
   Filters, pagination, detail views
   ========================================================================== */

.filters {
    display: flex;
    gap: .6rem;
    flex-wrap: wrap;
    align-items: flex-end;
    margin-bottom: 1.15rem;
    padding: .9rem 1rem;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
}

.filters .field { margin-bottom: 0; }
.filters .input, .filters select { min-width: 9rem; }
.filters__grow { flex: 1 1 14rem; }

.select {
    width: 100%;
    padding: .62rem .8rem;
    font: inherit;
    font-size: .88rem;
    color: var(--ink);
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
}

.select:focus { outline: none; border-color: var(--brand-light); box-shadow: 0 0 0 3px rgba(138,33,38,.12); }

.chips { display: flex; gap: .4rem; flex-wrap: wrap; margin-bottom: 1rem; }

.chip {
    display: inline-flex;
    align-items: center;
    gap: .35rem;
    padding: .25rem .6rem;
    border-radius: 99px;
    background: var(--cream);
    color: var(--brand-light);
    font-size: .76rem;
    text-decoration: none;
}

.chip:hover { background: #ecdcdf; }
.chip__x { font-weight: 700; opacity: .6; }

.pager {
    display: flex;
    align-items: center;
    gap: .3rem;
    margin-top: 1rem;
    flex-wrap: wrap;
}

.pager__item {
    display: grid;
    place-items: center;
    min-width: 2rem;
    height: 2rem;
    padding: 0 .5rem;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    background: var(--surface);
    color: var(--ink);
    font-size: .82rem;
    text-decoration: none;
}

.pager__item:hover:not(.is-disabled) { border-color: var(--brand-light); color: var(--brand-light); }
.pager__item.is-current { background: var(--brand); border-color: var(--brand); color: #fff; font-weight: 600; }
.pager__item.is-disabled { opacity: .4; }
.pager__count { margin-left: auto; font-size: .78rem; color: var(--ink-faint); }

.detail-grid { display: grid; gap: 1rem; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); }
@media (max-width: 900px) { .detail-grid { grid-template-columns: 1fr; } }

.dl { display: grid; gap: .55rem; margin: 0; }

.dl > div {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    padding-bottom: .5rem;
    border-bottom: 1px solid var(--line);
    font-size: .86rem;
}

.dl > div:last-child { border-bottom: 0; padding-bottom: 0; }
.dl dt { color: var(--ink-soft); margin: 0; }
.dl dd { margin: 0; text-align: right; font-weight: 500; }

.timeline { list-style: none; margin: 0; padding: 0; }

.timeline li {
    position: relative;
    padding: 0 0 .85rem 1.1rem;
    border-left: 2px solid var(--line);
    font-size: .82rem;
}

.timeline li:last-child { border-left-color: transparent; padding-bottom: 0; }

.timeline li::before {
    content: '';
    position: absolute;
    left: -5px;
    top: .35rem;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--brand-light);
}

.timeline time { display: block; color: var(--ink-faint); font-size: .74rem; }

.alert--danger-strong {
    background: var(--danger-bg);
    border-color: var(--danger);
    color: #7d101c;
    font-weight: 600;
}

.actions { display: flex; gap: .5rem; flex-wrap: wrap; }

.btn--danger { background: var(--danger); }
.btn--danger:hover { background: #8a1420; }

.tabs { display: flex; gap: .3rem; margin-bottom: 1rem; border-bottom: 1px solid var(--line); }

.tabs a {
    padding: .55rem .9rem;
    border-bottom: 2px solid transparent;
    color: var(--ink-soft);
    font-size: .86rem;
    text-decoration: none;
}

.tabs a:hover { color: var(--ink); }
.tabs a.is-active { border-bottom-color: var(--brand); color: var(--brand); font-weight: 600; }

/* Occupancy bar */
.meter { height: 6px; border-radius: 99px; background: var(--line); overflow: hidden; min-width: 5rem; }
.meter__fill { height: 100%; background: var(--ok); border-radius: 99px; }
.meter__fill.is-high { background: #c97b1a; }
.meter__fill.is-full { background: var(--danger); }

/* Admin calendar */
.cal { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }

.cal__dow {
    padding: .35rem 0;
    text-align: center;
    font-size: .68rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .05em;
    color: var(--ink-faint);
}

.cal__day {
    min-height: 5.5rem;
    padding: .35rem;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    background: var(--surface);
    font-size: .74rem;
}

.cal__day.is-outside { background: #fbf9f9; opacity: .55; }
.cal__day.is-today { border-color: var(--brand); box-shadow: 0 0 0 1px var(--brand); }
.cal__num { font-weight: 600; color: var(--ink-faint); }

.cal__event {
    display: block;
    margin-top: .25rem;
    padding: .22rem .35rem;
    border-radius: 4px;
    background: var(--ok-bg);
    color: var(--ok);
    text-decoration: none;
    line-height: 1.25;
}

.cal__event.is-low  { background: var(--warn-bg);   color: var(--warn); }
.cal__event.is-full { background: var(--danger-bg); color: var(--danger); }
.cal__event:hover { filter: brightness(.96); }

.textarea { min-height: 8rem; resize: vertical; font-family: ui-monospace, "Cascadia Code", Consolas, monospace; font-size: .82rem; }

.settings-group { margin-bottom: 1.5rem; }
.settings-group__title {
    font-size: .78rem;
    font-weight: 600;
    letter-spacing: .06em;
    text-transform: uppercase;
    color: var(--ink-faint);
    margin-bottom: .75rem;
}

/* ==========================================================================
   Responsive
   ========================================================================== */

@media (max-width: 900px) {
    .shell { grid-template-columns: 1fr; }

    .sidebar {
        position: static;
        height: auto;
        flex-direction: row;
        align-items: center;
        overflow-x: auto;
    }

    .sidebar__brand  { border-bottom: 0; border-right: 1px solid rgba(255,255,255,.12); white-space: nowrap; }
    .sidebar__nav    { display: flex; gap: .25rem; padding: .5rem; }
    .sidebar__link   { white-space: nowrap; margin-bottom: 0; }
    .sidebar__link span { display: none; }
    .sidebar__foot   { display: none; }

    .content { padding: 1rem; }
    .topbar  { padding: .75rem 1rem; }
}

@media (max-width: 520px) {
    .auth__card    { padding: 1.75rem 1.25rem 1.5rem; }
    .topbar__user  { display: none; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: .01ms !important;
        transition-duration: .01ms !important;
    }
}
