/* Design tokens sourced from kayshotel.com's own stylesheet:
   ink/gold/champagne palette, Cormorant Garamond + Jost typefaces. */
:root {
    --ink: #0C0A05;
    --gold: #B08A2E;
    --gold-deep: #7A5A15;
    --champagne: #FAF5E9;
    --line: #E9E2D2;
    --muted: #3F3930;
    --white: #FFFFFF;
    --shadow-soft: 0 18px 40px -28px #17130c59;
    --shadow-lift: 0 22px 48px -30px #17130c66;
}

* { box-sizing: border-box; }

html, body {
    height: 100%;
    margin: 0;
}

body {
    font-family: 'Jost', sans-serif;
    color: var(--ink);
    background: var(--champagne);
    -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 {
    font-family: 'Cormorant Garamond', serif;
    font-weight: 600;
    color: var(--ink);
    margin: 0 0 .5rem;
}

a { color: var(--gold-deep); }

p { line-height: 1.6; }

.eyebrow {
    font-size: .72rem;
    letter-spacing: .18em;
    text-transform: uppercase;
    color: var(--gold-deep);
    font-weight: 500;
}

/* ---------- Buttons ---------- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .5rem;
    padding: .75rem 1.5rem;
    border-radius: 999px;
    font-family: 'Jost', sans-serif;
    font-size: .9rem;
    font-weight: 500;
    letter-spacing: .02em;
    text-decoration: none;
    border: 1px solid transparent;
    cursor: pointer;
    transition: transform .15s ease, box-shadow .15s ease, background .15s ease;
}
.btn:active { transform: scale(.98); }

.btn-primary {
    background: var(--gold);
    color: var(--white);
    box-shadow: var(--shadow-soft);
}
.btn-primary:hover { background: var(--gold-deep); }

.btn-ghost {
    background: transparent;
    color: var(--ink);
    border-color: var(--line);
}
.btn-ghost:hover { border-color: var(--gold); color: var(--gold-deep); }

.btn-block { width: 100%; }

.btn-danger {
    background: #a33a2e;
    color: var(--white);
    box-shadow: var(--shadow-soft);
}
.btn-danger:hover { background: #832c22; }

/* ---------- Cards ---------- */
.card {
    background: var(--white);
    border: 1px solid var(--line);
    border-radius: 20px;
    box-shadow: var(--shadow-soft);
    overflow-x: auto;
}
.card-pad { padding: 1.75rem; }

/* ---------- Forms ---------- */
label {
    display: block;
    font-size: .78rem;
    text-transform: uppercase;
    letter-spacing: .08em;
    color: var(--muted);
    margin-bottom: .4rem;
    font-weight: 500;
}
.field { margin-bottom: 1.4rem; }
input[type=text], input[type=email], input[type=password], input[type=number], select {
    width: 100%;
    padding: .75rem .9rem;
    border-radius: 12px;
    border: 1px solid var(--line);
    background: var(--champagne);
    color: var(--ink);
    font-family: 'Jost', sans-serif;
    font-size: .95rem;
    box-sizing: border-box;
}
input:focus, select:focus {
    outline: none;
    border-color: var(--gold);
    box-shadow: 0 0 0 3px #b08a2e2b;
}
.hint { font-size: .8rem; color: var(--muted); opacity: .75; margin-top: .35rem; }
.error-text { color: #b3261e; font-size: .85rem; margin-top: .35rem; }

/* ---------- Status badges ---------- */
.badge {
    display: inline-block;
    padding: .3rem .75rem;
    border-radius: 999px;
    font-size: .74rem;
    font-weight: 600;
    letter-spacing: .03em;
    text-transform: uppercase;
}
.badge-unused  { background: #eef0e9; color: #4b5540; }
.badge-active  { background: #eaf3e6; color: #2f6b31; }
.badge-expired { background: #f2ece0; color: var(--muted); }
.badge-revoked { background: #fbe9e7; color: #a33a2e; }

/* ---------- Tables ---------- */
table { width: 100%; min-width: 560px; border-collapse: collapse; }
th {
    text-align: left;
    font-size: .72rem;
    text-transform: uppercase;
    letter-spacing: .08em;
    color: var(--muted);
    opacity: .7;
    padding: .9rem 1rem;
    border-bottom: 1px solid var(--line);
    font-weight: 500;
}
td {
    padding: .9rem 1rem;
    border-bottom: 1px solid var(--line);
    font-size: .92rem;
}
tr:last-child td { border-bottom: none; }
code {
    font-family: 'JetBrains Mono', 'Courier New', monospace;
    background: var(--champagne);
    border: 1px solid var(--line);
    padding: .2rem .5rem;
    border-radius: 6px;
    letter-spacing: .05em;
}

/* ---------- Admin app shell ---------- */
.app-shell { display: flex; min-height: 100vh; width: 100%; }

.sidebar {
    width: 260px;
    flex-shrink: 0;
    background: var(--ink);
    color: var(--champagne);
    padding: 2rem 1.4rem;
    display: flex;
    flex-direction: column;
}
.brand {
    font-family: 'Cormorant Garamond', serif;
    font-size: 1.5rem;
    color: var(--gold);
    letter-spacing: .02em;
    text-decoration: none;
    display: block;
    margin-bottom: .1rem;
}
.brand-sub {
    display: block;
    font-family: 'Jost', sans-serif;
    font-size: .62rem;
    letter-spacing: .2em;
    text-transform: uppercase;
    color: var(--champagne);
    opacity: .45;
    margin-bottom: 2.5rem;
}
.nav-section-label {
    font-size: .68rem;
    text-transform: uppercase;
    letter-spacing: .14em;
    color: var(--champagne);
    opacity: .35;
    margin: 1.4rem .75rem .5rem;
}
.nav-link {
    display: flex;
    align-items: center;
    gap: .75rem;
    padding: .7rem .9rem;
    border-radius: 12px;
    color: var(--champagne);
    opacity: .72;
    text-decoration: none;
    font-size: .9rem;
    margin-bottom: .2rem;
    transition: background .15s ease, opacity .15s ease;
}
.nav-link svg { flex-shrink: 0; opacity: .85; }
.nav-link:hover { opacity: 1; background: rgba(255,255,255,.06); }
.nav-link.active {
    opacity: 1;
    background: rgba(176,138,46,.18);
    color: var(--gold);
    font-weight: 500;
}
.nav-link.active svg { opacity: 1; }
.sidebar-spacer { flex: 1; }
.sidebar-foot {
    border-top: 1px solid rgba(255,255,255,.08);
    padding-top: 1rem;
    margin-top: 1rem;
}
.sidebar-user {
    font-size: .82rem;
    color: var(--champagne);
    opacity: .6;
    margin-bottom: .75rem;
    padding: 0 .25rem;
}

.main { flex: 1; min-width: 0; width: 100%; }
.topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem 2.5rem;
    background: var(--white);
    border-bottom: 1px solid var(--line);
    width: 100%;
}
.topbar h1 { font-size: 1.6rem; margin: 0; }
.content { padding: 2.25rem 2.5rem 3rem; width: 100%; }

.status-banner {
    background: #eaf3e6;
    color: #2f6b31;
    border: 1px solid #cfe6c8;
    border-radius: 14px;
    padding: .8rem 1.2rem;
    font-size: .9rem;
    margin-bottom: 1.5rem;
}

/* ---------- Form + side panel layout ---------- */
.form-layout {
    display: grid;
    grid-template-columns: minmax(320px, 480px) 1fr;
    gap: 1.5rem;
    align-items: start;
}
.tips-list {
    margin: .75rem 0 0;
    padding-left: 1.1rem;
    color: var(--muted);
    font-size: .9rem;
    line-height: 1.7;
}
.tips-list li { margin-bottom: .4rem; }
.preset-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
    gap: .75rem;
    margin-top: .9rem;
}
.preset {
    background: var(--champagne);
    border: 1px solid var(--line);
    border-radius: 14px;
    padding: .75rem .9rem;
    display: flex;
    flex-direction: column;
    gap: .15rem;
}
.preset b { font-family: 'Cormorant Garamond', serif; font-size: 1.15rem; }
.preset span { font-size: .78rem; color: var(--muted); opacity: .8; }

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

/* ---------- Stat cards ---------- */
.stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
    gap: 1.25rem;
    margin-bottom: 2rem;
}
.stat-card {
    background: var(--white);
    border: 1px solid var(--line);
    border-radius: 20px;
    padding: 1.5rem 1.6rem;
    box-shadow: var(--shadow-soft);
}
.stat-card .value {
    font-family: 'Cormorant Garamond', serif;
    font-size: 2.4rem;
    line-height: 1;
    color: var(--ink);
    display: block;
    margin-bottom: .35rem;
}
.stat-card .label {
    font-size: .76rem;
    text-transform: uppercase;
    letter-spacing: .08em;
    color: var(--muted);
    opacity: .7;
}

.page-head {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    margin-bottom: 1.5rem;
    gap: 1rem;
    flex-wrap: wrap;
}
.page-head p { margin: 0; color: var(--muted); opacity: .8; font-size: .92rem; }

.meta-line { color: var(--muted); opacity: .8; font-size: .92rem; margin-bottom: 1.5rem; }

/* ---------- Auth screens (admin login) ---------- */
.auth-screen {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(180deg, var(--ink) 0%, #1a1610 100%);
    padding: 1.5rem;
}
.auth-card {
    background: var(--white);
    border-radius: 24px;
    padding: 2.5rem 2.25rem;
    width: 100%;
    max-width: 380px;
    box-shadow: var(--shadow-lift);
    text-align: center;
}
.auth-card .brand { color: var(--gold); text-align: center; margin-bottom: .1rem; }
.auth-card .brand-sub { color: var(--muted); opacity: .6; text-align: center; margin-bottom: 1.75rem; }
.auth-card h1 { font-size: 1.6rem; margin-bottom: 1.5rem; }
.auth-card form { text-align: left; }

/* ---------- Captive portal (guest-facing) ---------- */
.portal-screen {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(180deg, var(--ink) 0%, #1a1610 100%);
    padding: 1.5rem;
}
.portal-card {
    background: var(--champagne);
    border-radius: 28px;
    padding: 2.75rem 2.25rem;
    width: 100%;
    max-width: 400px;
    box-shadow: var(--shadow-lift);
    text-align: center;
}
.portal-card .brand { color: var(--gold-deep); text-align: center; }
.portal-card .brand-sub { color: var(--muted); opacity: .65; text-align: center; margin-bottom: 2rem; }
.portal-card h1 { font-size: 1.5rem; margin-bottom: .5rem; }
.portal-card .lede { color: var(--muted); font-size: .9rem; margin-bottom: 1.75rem; }
.code-input {
    text-align: center;
    font-size: 1.4rem;
    letter-spacing: .35em;
    text-transform: uppercase;
    padding: 1rem .5rem;
    font-family: 'Jost', sans-serif;
}
.portal-icon {
    width: 56px;
    height: 56px;
    border-radius: 999px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 1.25rem;
}
.portal-icon.success { background: #eaf3e6; color: #2f6b31; }
.portal-icon.error { background: #fbe9e7; color: #a33a2e; }

/* ---------- Accessibility utility ---------- */
.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;
}

/* ---------- Trend chart ---------- */
.trend-chart {
    display: flex;
    align-items: flex-end;
    gap: 6px;
    height: 150px;
    padding-top: 1rem;
    border-bottom: 1px solid var(--line);
}
.trend-bar-wrap {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-end;
    height: 100%;
    gap: .5rem;
}
.trend-bar {
    position: relative;
    width: 60%;
    min-height: 3px;
    background: var(--gold);
    border-radius: 4px 4px 0 0;
    cursor: default;
    transition: background .15s ease;
}
.trend-bar:hover { background: var(--gold-deep); }
.trend-bar::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%) translateY(-8px);
    background: var(--ink);
    color: var(--champagne);
    font-size: .72rem;
    padding: .35rem .65rem;
    border-radius: 8px;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity .12s ease;
    z-index: 10;
}
.trend-bar:hover::after { opacity: 1; }
.trend-label {
    font-size: .66rem;
    color: var(--muted);
    opacity: .55;
}

/* ---------- Dashboard recent-activity cards ---------- */
.dash-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.25rem;
}
.card-head-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}
.card-head-row h2 { font-size: 1.05rem; margin: 0; }
.card-head-row a { font-size: .8rem; color: var(--gold-deep); text-decoration: none; }
.card-head-row a:hover { text-decoration: underline; }

.recent-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: .75rem;
    padding: .7rem 0;
    border-bottom: 1px solid var(--line);
}
.recent-row:last-child { border-bottom: none; }
.recent-sub {
    font-size: .75rem;
    color: var(--muted);
    opacity: .7;
    margin-top: .15rem;
}
.recent-empty {
    color: var(--muted);
    opacity: .7;
    font-size: .9rem;
    margin: 0;
}

.copy-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    width: 30px;
    height: 30px;
    border-radius: 999px;
    border: 1px solid var(--line);
    background: var(--champagne);
    color: var(--muted);
    cursor: pointer;
    transition: background .15s ease, color .15s ease, border-color .15s ease;
}
.copy-btn:hover { border-color: var(--gold); color: var(--gold-deep); }
.copy-btn.copied { background: #eaf3e6; border-color: #cfe6c8; color: #2f6b31; }

/* ---------- Confirm modal ---------- */
.modal-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(12, 10, 5, .55);
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 1.5rem;
}
.modal-backdrop.open { display: flex; }
.modal-card {
    background: var(--white);
    border-radius: 20px;
    padding: 2rem;
    max-width: 400px;
    width: 100%;
    box-shadow: var(--shadow-lift);
    text-align: center;
}
.modal-card h3 { font-size: 1.3rem; margin-bottom: .75rem; }
.modal-card p { color: var(--muted); font-size: .92rem; margin-bottom: 1.5rem; line-height: 1.6; }
.modal-actions { display: flex; gap: .75rem; }
.modal-actions .btn { flex: 1; }

/* ---------- Responsive ---------- */
@media (max-width: 860px) {
    .app-shell { flex-direction: column; }
    .sidebar {
        width: auto;
        flex-direction: row;
        align-items: center;
        padding: 1rem 1.25rem;
        overflow-x: auto;
    }
    .brand-sub, .nav-section-label, .sidebar-user { display: none; }
    .sidebar-spacer { display: none; }
    .sidebar nav { display: flex; gap: .25rem; }
    .sidebar-foot { border-top: none; margin: 0 0 0 auto; padding: 0; }
    .brand { margin-right: 1.5rem; margin-bottom: 0; white-space: nowrap; }
    .topbar { padding: 1.25rem 1.5rem; }
    .content { padding: 1.5rem; }
}
