/* ============================================
   Luxury & Clean Design System — Starter CSS
   ============================================
   Drop this file into a new project as styles.css
   Customize :root tokens (especially --brand-primary*) for your brand
   See: references/design-tokens.md
   ============================================ */

:root {
    /* Primary Brand Colors - nightlife luxe violet */
    --brand-primary: #7C3AED;
    --brand-primary-dark: #6D28D9;
    --brand-primary-light: #A78BFA;
    --brand-primary-lighter: #F3EEFF;
    --brand-primary-soft: #FAF8FF;

    /* Accent / Luxury */
    --accent-gold: #C9A961;
    --accent-gold-light: #E5D4A8;
    --accent-charcoal: #1A1F2E;

    /* Neutrals */
    --color-ink: #0A0E1A;
    --color-graphite: #2C3142;
    --color-slate: #5C6478;
    --color-stone: #8B92A5;
    --color-mist: #C7CCD8;
    --color-fog: #E8EBF1;
    --color-cloud: #F4F6FA;
    --color-pearl: #FAFBFD;
    --color-white: #FFFFFF;

    /* Semantic */
    --color-success: #16A34A;
    --color-success-bg: #DCFCE7;
    --color-success-border: #86EFAC;
    --color-danger: #DC2626;
    --color-danger-bg: #FEE2E2;
    --color-danger-border: #FCA5A5;
    --color-warning: #D97706;
    --color-warning-bg: #FEF3C7;
    --color-neutral: #6B7280;
    --color-neutral-bg: #F3F4F6;
    --color-neutral-border: #D1D5DB;

    /* Typography */
    --font-display: 'Cormorant Garamond', 'Sarabun', Georgia, serif;
    --font-body: 'Inter', 'Sarabun', -apple-system, BlinkMacSystemFont, sans-serif;
    --font-thai: 'Sarabun', sans-serif;

    /* Spacing */
    --sp-1: 0.25rem;
    --sp-2: 0.5rem;
    --sp-3: 0.75rem;
    --sp-4: 1rem;
    --sp-5: 1.25rem;
    --sp-6: 1.5rem;
    --sp-8: 2rem;
    --sp-10: 2.5rem;
    --sp-12: 3rem;
    --sp-16: 4rem;

    /* Radius */
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 16px;
    --radius-xl: 24px;

    /* Shadows */
    --shadow-sm: 0 1px 2px rgba(10, 14, 26, 0.04);
    --shadow-md: 0 4px 12px rgba(10, 14, 26, 0.06), 0 2px 4px rgba(10, 14, 26, 0.04);
    --shadow-lg: 0 12px 32px rgba(10, 14, 26, 0.08), 0 4px 12px rgba(10, 14, 26, 0.04);
    --shadow-xl: 0 24px 64px rgba(10, 14, 26, 0.12), 0 8px 24px rgba(10, 14, 26, 0.06);
    --shadow-brand: 0 8px 24px rgba(124, 58, 237, 0.18);

    /* Transitions */
    --ease: cubic-bezier(0.16, 1, 0.3, 1);
    --ease-smooth: cubic-bezier(0.4, 0, 0.2, 1);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
}

body {
    font-family: var(--font-body);
    font-size: 0.9375rem;
    line-height: 1.6;
    color: var(--color-ink);
    background: var(--color-pearl);
    overflow-x: hidden;
}

/* ============================================
   SCREEN MANAGEMENT
   ============================================ */
.screen {
    display: none;
    min-height: 100vh;
}
.screen.active {
    display: block;
}

/* ============================================
   LOGIN SCREEN
   ============================================ */
#login-screen.active {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background:
        radial-gradient(ellipse at top right, rgba(11, 124, 255, 0.08), transparent 60%),
        radial-gradient(ellipse at bottom left, rgba(201, 169, 97, 0.05), transparent 60%),
        linear-gradient(135deg, var(--color-pearl) 0%, var(--color-cloud) 100%);
    position: relative;
    padding: var(--sp-6);
}

#login-screen::before {
    content: '';
    position: absolute;
    inset: 0;
    background-image:
        radial-gradient(circle at 1px 1px, rgba(11, 124, 255, 0.05) 1px, transparent 0);
    background-size: 32px 32px;
    pointer-events: none;
}

.login-container {
    width: 100%;
    max-width: 480px;
    position: relative;
    z-index: 1;
}

.login-card {
    background: var(--color-white);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-xl);
    overflow: hidden;
    border: 1px solid rgba(11, 124, 255, 0.06);
}

.login-brand {
    padding: var(--sp-10) var(--sp-8) var(--sp-8);
    text-align: center;
    background: linear-gradient(180deg, var(--brand-primary-soft) 0%, var(--color-white) 100%);
    border-bottom: 1px solid var(--color-fog);
    position: relative;
}

.brand-emblem {
    width: 72px;
    height: 72px;
    margin: 0 auto var(--sp-5);
    color: var(--brand-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    overflow: hidden;
}

.brand-emblem img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.brand-emblem svg {
    width: 100%;
    height: 100%;
}

.brand-name {
    font-family: var(--font-display);
    font-size: 2.5rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    color: var(--color-ink);
    line-height: 1;
    margin-bottom: var(--sp-2);
}

.brand-tagline {
    font-family: var(--font-body);
    font-size: 0.8125rem;
    text-transform: uppercase;
    letter-spacing: 0.18em;
    color: var(--color-slate);
    font-weight: 500;
}

.brand-divider {
    width: 32px;
    height: 1px;
    background: var(--accent-gold);
    margin: var(--sp-4) auto;
}

.brand-by {
    font-family: var(--font-display);
    font-size: 0.875rem;
    font-style: italic;
    color: var(--color-stone);
    letter-spacing: 0.05em;
}

.login-form {
    padding: var(--sp-8);
}

.form-title {
    font-family: var(--font-display);
    font-size: 1.75rem;
    font-weight: 600;
    color: var(--color-ink);
    margin-bottom: var(--sp-1);
}

.form-subtitle {
    font-size: 0.875rem;
    color: var(--color-slate);
    margin-bottom: var(--sp-6);
}

/* ============================================
   BUTTONS
   ============================================ */
.btn-primary, .btn-secondary, .btn-google, .btn-danger, .btn-ghost {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--sp-2);
    padding: var(--sp-3) var(--sp-5);
    font-family: var(--font-body);
    font-size: 0.9375rem;
    font-weight: 500;
    border: 1px solid transparent;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all 0.25s var(--ease);
    text-decoration: none;
    white-space: nowrap;
    letter-spacing: 0.01em;
}

.btn-full {
    width: 100%;
}

.btn-primary {
    background: var(--brand-primary);
    color: white;
    box-shadow: var(--shadow-brand);
}
.btn-primary:hover {
    background: var(--brand-primary-dark);
    transform: translateY(-1px);
    box-shadow: 0 12px 32px rgba(11, 124, 255, 0.25);
}
.btn-primary:active {
    transform: translateY(0);
}

.btn-secondary {
    background: var(--color-white);
    color: var(--color-ink);
    border-color: var(--color-mist);
}
.btn-secondary:hover {
    border-color: var(--brand-primary);
    color: var(--brand-primary);
}

.btn-ghost {
    background: transparent;
    color: var(--color-slate);
}
.btn-ghost:hover {
    background: var(--color-fog);
    color: var(--color-ink);
}

.btn-danger {
    background: var(--color-danger);
    color: white;
}
.btn-danger:hover {
    background: #B91C1C;
}

.btn-google {
    background: var(--color-white);
    color: var(--color-ink);
    border-color: var(--color-mist);
    width: 100%;
    padding: var(--sp-3) var(--sp-5);
    font-weight: 500;
}
.btn-google:hover {
    border-color: var(--color-stone);
    background: var(--color-pearl);
}

.btn-sm {
    padding: var(--sp-2) var(--sp-3);
    font-size: 0.8125rem;
}

.btn-icon {
    padding: var(--sp-2);
    width: 36px;
    height: 36px;
    border-radius: var(--radius-md);
}

.icon-btn {
    background: transparent;
    border: none;
    cursor: pointer;
    padding: var(--sp-2);
    border-radius: var(--radius-md);
    color: var(--color-slate);
    transition: all 0.2s var(--ease);
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
.icon-btn:hover {
    background: var(--color-fog);
    color: var(--color-ink);
}

/* ============================================
   FORM ELEMENTS
   ============================================ */
.form-field {
    margin-bottom: var(--sp-4);
}

.form-field label {
    display: block;
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--color-graphite);
    margin-bottom: var(--sp-2);
    letter-spacing: 0.01em;
}

.form-field label .required {
    color: var(--color-danger);
}

.form-field input,
.form-field select,
.form-field textarea {
    width: 100%;
    padding: var(--sp-3) var(--sp-4);
    font-family: var(--font-body);
    font-size: 0.9375rem;
    color: var(--color-ink);
    background: var(--color-white);
    border: 1px solid var(--color-mist);
    border-radius: var(--radius-md);
    transition: all 0.2s var(--ease);
    outline: none;
}

.form-field input:focus,
.form-field select:focus,
.form-field textarea:focus {
    border-color: var(--brand-primary);
    box-shadow: 0 0 0 3px rgba(11, 124, 255, 0.12);
}

.form-field input::placeholder {
    color: var(--color-stone);
}

.form-field input[type="number"] {
    text-align: right;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--sp-4);
}

.form-row-3 {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: var(--sp-4);
}

.form-row-4 {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: var(--sp-4);
    margin-bottom: var(--sp-3);
}

.form-row-5 {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: var(--sp-3);
}

.divider {
    display: flex;
    align-items: center;
    margin: var(--sp-6) 0;
    color: var(--color-stone);
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.16em;
}

.divider::before,
.divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--color-fog);
}
.divider span {
    padding: 0 var(--sp-3);
}

.error-message {
    color: var(--color-danger);
    font-size: 0.8125rem;
    margin-top: var(--sp-3);
    text-align: center;
    min-height: 1rem;
}

/* ============================================
   APP LAYOUT
   ============================================ */
#app-screen.active {
    display: grid;
    grid-template-columns: 260px 1fr;
    grid-template-rows: 64px 1fr;
    grid-template-areas:
        "header header"
        "sidebar main";
    min-height: 100vh;
}

.app-header {
    grid-area: header;
    background: var(--color-white);
    border-bottom: 1px solid var(--color-fog);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 var(--sp-6);
    position: sticky;
    top: 0;
    z-index: 50;
    box-shadow: var(--shadow-sm);
}

.header-left {
    display: flex;
    align-items: center;
    gap: var(--sp-4);
}

.menu-btn {
    display: none;
}

.brand-header {
    display: flex;
    align-items: center;
    gap: var(--sp-3);
}

.brand-logo-container {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-md);
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--brand-primary-soft);
    border: 1px solid var(--color-fog);
}

.brand-logo-container img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.brand-logo-container .placeholder {
    font-family: var(--font-display);
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--brand-primary);
}

.brand-text {
    font-family: var(--font-display);
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--color-ink);
    letter-spacing: 0.02em;
}

.user-menu {
    position: relative;
}

.user-menu-btn {
    display: flex;
    align-items: center;
    gap: var(--sp-3);
    padding: var(--sp-2) var(--sp-3);
    background: transparent;
    border: 1px solid transparent;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all 0.2s var(--ease);
    color: var(--color-graphite);
}
.user-menu-btn:hover {
    background: var(--color-cloud);
    border-color: var(--color-fog);
}

.user-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--brand-primary), var(--brand-primary-dark));
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 0.875rem;
    overflow: hidden;
}
.user-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.user-name {
    font-size: 0.875rem;
    font-weight: 500;
}

.user-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    min-width: 240px;
    background: var(--color-white);
    border: 1px solid var(--color-fog);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    padding: var(--sp-2);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-4px);
    transition: all 0.2s var(--ease);
}
.user-dropdown.open {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.user-info {
    padding: var(--sp-3);
}
.user-info-name {
    font-weight: 600;
    font-size: 0.875rem;
    color: var(--color-ink);
}
.user-info-email {
    font-size: 0.8125rem;
    color: var(--color-slate);
    margin-top: 2px;
    word-break: break-all;
}
.user-info-role {
    display: inline-block;
    margin-top: var(--sp-2);
    padding: 2px var(--sp-2);
    background: var(--brand-primary-lighter);
    color: var(--brand-primary-dark);
    border-radius: var(--radius-sm);
    font-size: 0.6875rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.dropdown-divider {
    border: none;
    height: 1px;
    background: var(--color-fog);
    margin: var(--sp-1) 0;
}

.dropdown-item {
    display: flex;
    align-items: center;
    gap: var(--sp-3);
    width: 100%;
    padding: var(--sp-3);
    background: transparent;
    border: none;
    border-radius: var(--radius-sm);
    font-family: var(--font-body);
    font-size: 0.875rem;
    color: var(--color-graphite);
    cursor: pointer;
    text-align: left;
    transition: all 0.15s var(--ease);
}
.dropdown-item:hover {
    background: var(--color-cloud);
    color: var(--color-ink);
}

/* ============================================
   SIDEBAR
   ============================================ */
.sidebar {
    grid-area: sidebar;
    background: var(--color-white);
    border-right: 1px solid var(--color-fog);
    overflow-y: auto;
    padding: var(--sp-4);
    position: sticky;
    top: 64px;
    height: calc(100vh - 64px);
}

.sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: var(--sp-3);
    padding: var(--sp-3) var(--sp-4);
    background: transparent;
    border: none;
    border-radius: var(--radius-md);
    font-family: var(--font-body);
    font-size: 0.9375rem;
    font-weight: 500;
    color: var(--color-slate);
    cursor: pointer;
    transition: all 0.2s var(--ease);
    text-align: left;
    width: 100%;
}

.nav-item:hover {
    background: var(--color-cloud);
    color: var(--color-ink);
}

.nav-item.active {
    background: var(--brand-primary-lighter);
    color: var(--brand-primary-dark);
    font-weight: 600;
    position: relative;
}
.nav-item.active::before {
    content: '';
    position: absolute;
    left: -16px;
    top: 50%;
    transform: translateY(-50%);
    width: 3px;
    height: 20px;
    background: var(--brand-primary);
    border-radius: 0 2px 2px 0;
}

.nav-item svg {
    flex-shrink: 0;
}

.nav-divider {
    height: 1px;
    background: var(--color-fog);
    margin: var(--sp-3) 0;
}

.nav-section-title {
    padding: var(--sp-2) var(--sp-4);
    font-size: 0.6875rem;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--color-stone);
    font-weight: 600;
}

.admin-only {
    display: none;
}
body.role-admin .admin-only {
    display: flex;
}
body.role-admin .nav-section-title.admin-only,
body.role-admin div.admin-only {
    display: block;
}

/* ============================================
   MAIN CONTENT
   ============================================ */
.main-content {
    grid-area: main;
    padding: var(--sp-8);
    overflow-y: auto;
    max-width: 100%;
}

.page-header {
    margin-bottom: var(--sp-8);
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    gap: var(--sp-4);
    flex-wrap: wrap;
}

.page-title {
    font-family: var(--font-display);
    font-size: 2.25rem;
    font-weight: 600;
    color: var(--color-ink);
    line-height: 1.1;
    letter-spacing: 0.005em;
}

.page-subtitle {
    color: var(--color-slate);
    margin-top: var(--sp-2);
    font-size: 0.9375rem;
}

.page-actions {
    display: flex;
    gap: var(--sp-3);
    flex-wrap: wrap;
}

/* ============================================
   CARDS
   ============================================ */
.card {
    background: var(--color-white);
    border: 1px solid var(--color-fog);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
}

.card-padded {
    padding: var(--sp-6);
}

.card-header {
    padding: var(--sp-5) var(--sp-6);
    border-bottom: 1px solid var(--color-fog);
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: var(--sp-4);
    flex-wrap: wrap;
}

.card-title {
    font-family: var(--font-display);
    font-size: 1.375rem;
    font-weight: 600;
    color: var(--color-ink);
}

.card-body {
    padding: var(--sp-6);
}

/* ============================================
   TABLE
   ============================================ */
.table-wrapper {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

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

table.data-table th {
    text-align: left;
    padding: var(--sp-3) var(--sp-4);
    font-weight: 600;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--color-stone);
    background: var(--color-pearl);
    border-bottom: 1px solid var(--color-fog);
    white-space: nowrap;
}

table.data-table td {
    padding: var(--sp-4);
    border-bottom: 1px solid var(--color-fog);
    color: var(--color-graphite);
    vertical-align: middle;
}

table.data-table tbody tr {
    transition: background 0.15s var(--ease);
}
table.data-table tbody tr:hover {
    background: var(--color-pearl);
}

table.data-table tbody tr:last-child td {
    border-bottom: none;
}

/* ============================================
   STATUS BADGES
   ============================================ */
.status-badge {
    display: inline-flex;
    align-items: center;
    gap: var(--sp-2);
    padding: var(--sp-1) var(--sp-3);
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 600;
    white-space: nowrap;
}

.status-badge::before {
    content: '';
    display: inline-block;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: currentColor;
}

.status-completed {
    background: var(--color-success-bg);
    color: var(--color-success);
    border: 1px solid var(--color-success-border);
}

.status-pending {
    background: var(--color-danger-bg);
    color: var(--color-danger);
    border: 1px solid var(--color-danger-border);
}

.status-cancelled {
    background: var(--color-neutral-bg);
    color: var(--color-neutral);
    border: 1px solid var(--color-neutral-border);
}

/* ============================================
   STAT CARDS
   ============================================ */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: var(--sp-5);
    margin-bottom: var(--sp-8);
}

.stat-card {
    background: var(--color-white);
    border: 1px solid var(--color-fog);
    border-radius: var(--radius-lg);
    padding: var(--sp-6);
    position: relative;
    overflow: hidden;
    transition: all 0.3s var(--ease);
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
    border-color: var(--brand-primary-light);
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--brand-primary), var(--brand-primary-light));
}

.stat-card.gold::before {
    background: linear-gradient(90deg, var(--accent-gold), var(--accent-gold-light));
}

.stat-card.success::before {
    background: linear-gradient(90deg, var(--color-success), #4ADE80);
}

.stat-label {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--color-stone);
    font-weight: 600;
    margin-bottom: var(--sp-3);
}

.stat-value {
    font-family: var(--font-display);
    font-size: 2.25rem;
    font-weight: 600;
    color: var(--color-ink);
    line-height: 1.1;
    letter-spacing: 0.005em;
}

.stat-value-sm {
    font-size: 1.5rem;
}

.stat-suffix {
    font-size: 0.875rem;
    color: var(--color-slate);
    font-family: var(--font-body);
    font-weight: 400;
    margin-left: var(--sp-1);
}

/* ============================================
   FILTERS
   ============================================ */
.filter-bar {
    background: var(--color-white);
    border: 1px solid var(--color-fog);
    border-radius: var(--radius-lg);
    padding: var(--sp-4) var(--sp-5);
    margin-bottom: var(--sp-6);
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--sp-4);
}

.filter-group {
    display: flex;
    align-items: center;
    gap: var(--sp-2);
}

.filter-label {
    font-size: 0.8125rem;
    color: var(--color-slate);
    font-weight: 500;
}

.filter-bar input[type="date"],
.filter-bar input[type="month"],
.filter-bar input[type="search"],
.filter-bar select {
    padding: var(--sp-2) var(--sp-3);
    border: 1px solid var(--color-mist);
    border-radius: var(--radius-md);
    font-family: var(--font-body);
    font-size: 0.875rem;
    color: var(--color-ink);
    background: var(--color-white);
    outline: none;
    transition: all 0.2s var(--ease);
}

.filter-bar input:focus,
.filter-bar select:focus {
    border-color: var(--brand-primary);
    box-shadow: 0 0 0 3px rgba(11, 124, 255, 0.1);
}

/* Search input with embedded icon */
.filter-search {
    position: relative;
    flex: 1;
    min-width: 240px;
    max-width: 420px;
}

.filter-search-icon {
    position: absolute;
    left: var(--sp-3);
    top: 50%;
    transform: translateY(-50%);
    color: var(--color-stone);
    pointer-events: none;
}

.filter-bar input[type="search"] {
    width: 100%;
    padding-left: 36px;
}

.filter-bar input[type="search"]::-webkit-search-cancel-button {
    cursor: pointer;
}

/* ============================================
   MODAL
   ============================================ */
.modal-container {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: none;
    align-items: center;
    justify-content: center;
    padding: var(--sp-4);
}

.modal-container.active {
    display: flex;
}

.modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(10, 14, 26, 0.5);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    animation: fadeIn 0.2s var(--ease);
}

.modal {
    position: relative;
    background: var(--color-white);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-xl);
    max-width: 540px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    animation: slideUp 0.3s var(--ease);
}

.modal-large {
    max-width: 720px;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.modal-header {
    padding: var(--sp-6);
    border-bottom: 1px solid var(--color-fog);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.modal-title {
    font-family: var(--font-display);
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--color-ink);
}

.modal-body {
    padding: var(--sp-6);
}

.modal-footer {
    padding: var(--sp-4) var(--sp-6);
    border-top: 1px solid var(--color-fog);
    display: flex;
    justify-content: flex-end;
    gap: var(--sp-3);
    background: var(--color-pearl);
}

/* ============================================
   TOAST
   ============================================ */
.toast-container {
    position: fixed;
    top: var(--sp-6);
    right: var(--sp-6);
    z-index: 2000;
    display: flex;
    flex-direction: column;
    gap: var(--sp-3);
    pointer-events: none;
}

.toast {
    background: var(--color-white);
    border: 1px solid var(--color-fog);
    border-radius: var(--radius-md);
    padding: var(--sp-4) var(--sp-5);
    box-shadow: var(--shadow-lg);
    min-width: 280px;
    max-width: 400px;
    pointer-events: auto;
    display: flex;
    align-items: flex-start;
    gap: var(--sp-3);
    animation: toastIn 0.3s var(--ease);
    border-left: 3px solid var(--brand-primary);
}

.toast.success {
    border-left-color: var(--color-success);
}
.toast.error {
    border-left-color: var(--color-danger);
}
.toast.warning {
    border-left-color: var(--color-warning);
}

.toast-icon {
    flex-shrink: 0;
    margin-top: 2px;
}

.toast-message {
    flex: 1;
    font-size: 0.875rem;
    color: var(--color-ink);
}

.toast-title {
    font-weight: 600;
    margin-bottom: 2px;
}

@keyframes toastIn {
    from {
        opacity: 0;
        transform: translateX(20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes toastOut {
    to {
        opacity: 0;
        transform: translateX(20px);
    }
}

/* ============================================
   LOADING
   ============================================ */
.loading-overlay {
    position: fixed;
    inset: 0;
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 3000;
    display: none;
    align-items: center;
    justify-content: center;
}

.loading-overlay.active {
    display: flex;
}

.loading-spinner {
    width: 48px;
    height: 48px;
    border: 3px solid var(--color-fog);
    border-top-color: var(--brand-primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

/* ============================================
   EMPTY STATE
   ============================================ */
.empty-state {
    text-align: center;
    padding: var(--sp-12) var(--sp-6);
    color: var(--color-slate);
}

.empty-state svg {
    color: var(--color-mist);
    margin-bottom: var(--sp-4);
}

.empty-state-title {
    font-family: var(--font-display);
    font-size: 1.25rem;
    color: var(--color-graphite);
    margin-bottom: var(--sp-2);
}

.empty-state-subtitle {
    font-size: 0.875rem;
    color: var(--color-stone);
}

/* ============================================
   PARAMETER LIST
   ============================================ */
.param-list {
    display: flex;
    flex-direction: column;
    gap: var(--sp-3);
}

.param-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--sp-4);
    padding: var(--sp-4);
    background: var(--color-pearl);
    border: 1px solid var(--color-fog);
    border-radius: var(--radius-md);
    transition: all 0.2s var(--ease);
}

.param-item:hover {
    border-color: var(--brand-primary-light);
    background: var(--color-white);
}

.param-info {
    flex: 1;
    min-width: 0;
}

.param-name {
    font-weight: 600;
    color: var(--color-ink);
    margin-bottom: 2px;
}

.param-detail {
    font-size: 0.8125rem;
    color: var(--color-slate);
}

.param-actions {
    display: flex;
    gap: var(--sp-2);
}

/* ============================================
   IMAGE UPLOADER
   ============================================ */
.image-uploader {
    border: 2px dashed var(--color-mist);
    border-radius: var(--radius-lg);
    padding: var(--sp-8);
    text-align: center;
    background: var(--color-pearl);
    cursor: pointer;
    transition: all 0.2s var(--ease);
}

.image-uploader:hover,
.image-uploader.dragover {
    border-color: var(--brand-primary);
    background: var(--brand-primary-soft);
}

.image-uploader svg {
    color: var(--brand-primary);
    margin-bottom: var(--sp-3);
}

.image-uploader-text {
    color: var(--color-graphite);
    font-weight: 500;
    margin-bottom: var(--sp-1);
}

.image-uploader-hint {
    color: var(--color-stone);
    font-size: 0.8125rem;
}

.image-preview {
    display: flex;
    align-items: center;
    gap: var(--sp-4);
    padding: var(--sp-4);
    background: var(--color-pearl);
    border-radius: var(--radius-md);
    border: 1px solid var(--color-fog);
}

.image-preview img {
    width: 80px;
    height: 80px;
    object-fit: cover;
    border-radius: var(--radius-md);
    border: 1px solid var(--color-fog);
}

.image-preview-info {
    flex: 1;
}

.image-preview-name {
    font-weight: 600;
    margin-bottom: 2px;
}

.image-preview-size {
    font-size: 0.8125rem;
    color: var(--color-slate);
}

/* ============================================
   UTILITIES
   ============================================ */
.text-mono {
    font-family: 'SF Mono', Monaco, 'Cascadia Code', Consolas, monospace;
    font-size: 0.8125rem;
}

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

.text-right {
    text-align: right;
}

.text-center {
    text-align: center;
}

.font-display {
    font-family: var(--font-display);
}

.flex {
    display: flex;
}

.flex-between {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.gap-2 { gap: var(--sp-2); }
.gap-3 { gap: var(--sp-3); }
.gap-4 { gap: var(--sp-4); }

.mt-4 { margin-top: var(--sp-4); }
.mt-6 { margin-top: var(--sp-6); }
.mb-4 { margin-bottom: var(--sp-4); }
.mb-6 { margin-bottom: var(--sp-6); }

.hidden {
    display: none !important;
}

.role-pill {
    display: inline-block;
    padding: 2px var(--sp-2);
    border-radius: var(--radius-sm);
    font-size: 0.6875rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.role-pill.admin {
    background: var(--brand-primary-lighter);
    color: var(--brand-primary-dark);
}

.role-pill.kcity {
    background: var(--accent-gold-light);
    color: #8B6F2D;
}

/* View Mode Toggle (Dashboard: Month / All) */
.view-mode-toggle {
    display: inline-flex;
    background: var(--color-cloud);
    border: 1px solid var(--color-fog);
    border-radius: var(--radius-md);
    padding: 3px;
    gap: 2px;
}

.view-mode-btn {
    padding: 6px var(--sp-4);
    background: transparent;
    border: none;
    border-radius: 7px;
    font-family: var(--font-body);
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--color-slate);
    cursor: pointer;
    transition: all 0.2s var(--ease);
    white-space: nowrap;
}

.view-mode-btn:hover {
    color: var(--color-ink);
}

.view-mode-btn.active {
    background: var(--color-white);
    color: var(--brand-primary);
    box-shadow: var(--shadow-sm);
    font-weight: 600;
}

/* ============================================
   RESPONSIVE
   ============================================ */
@media (max-width: 1024px) {
    #app-screen.active {
        grid-template-columns: 1fr;
        grid-template-areas:
            "header"
            "main";
    }

    .menu-btn {
        display: inline-flex;
    }

    .sidebar {
        position: fixed;
        top: 64px;
        left: 0;
        width: 280px;
        height: calc(100vh - 64px);
        z-index: 100;
        transform: translateX(-100%);
        transition: transform 0.3s var(--ease);
        box-shadow: var(--shadow-xl);
    }

    .sidebar.open {
        transform: translateX(0);
    }

    .main-content {
        padding: var(--sp-5);
    }
}

@media (max-width: 640px) {
    .form-row,
    .form-row-3 {
        grid-template-columns: 1fr;
    }

    .form-row-4,
    .form-row-5 {
        grid-template-columns: repeat(2, 1fr);
    }

    .page-title {
        font-size: 1.75rem;
    }

    .stat-value {
        font-size: 1.75rem;
    }

    .main-content {
        padding: var(--sp-4);
    }

    .card-padded,
    .card-body {
        padding: var(--sp-4);
    }

    .user-name {
        display: none;
    }

    .header-left {
        gap: var(--sp-2);
    }

    .brand-text {
        font-size: 1.25rem;
    }
}

/* Print styles */
@media print {
    .sidebar, .app-header, .page-actions, .filter-bar {
        display: none;
    }

    #app-screen.active {
        grid-template-columns: 1fr;
        grid-template-areas: "main";
    }

    .main-content {
        padding: 0;
    }
}

/* ============================================================
   MEMBERSHIP PLATFORM — ADDITIONAL COMPONENTS
   (appended on top of the Luxury & Clean starter)
   ============================================================ */

/* ---- Role badge in sidebar ---- */
.role-pill {
    display: inline-block;
    font-size: 0.6875rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    padding: 2px 8px;
    border-radius: var(--radius-sm);
    background: var(--brand-primary-lighter);
    color: var(--brand-primary-dark);
}

/* ---- Store-context banner (shows which store admin is acting on) ---- */
.context-banner {
    display: flex;
    align-items: center;
    gap: var(--sp-3);
    padding: var(--sp-3) var(--sp-4);
    background: linear-gradient(120deg, var(--brand-primary-soft), var(--color-white));
    border: 1px solid var(--color-fog);
    border-radius: var(--radius-md);
    margin-bottom: var(--sp-6);
    font-size: 0.875rem;
}
.context-banner .ctx-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--brand-primary); }
.context-banner strong { color: var(--color-graphite); }

/* ---- Tier chips ---- */
.tier-chip {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 0.75rem;
    font-weight: 600;
    padding: 3px 10px;
    border-radius: 999px;
    border: 1px solid transparent;
}
.tier-bronze  { background:#FBEFE3; color:#8A5A2B; border-color:#E9CBA7; }
.tier-silver  { background:#EEF1F5; color:#5C6478; border-color:#CfD6E0; }
.tier-gold    { background:#FBF3DB; color:#8A6D1F; border-color:#E5D4A8; }
.tier-platinum{ background:#EDE9FB; color:#5B3BB0; border-color:#C9BCF0; }

/* ---- Avatar circle for store/member ---- */
.entity-avatar {
    width: 40px; height: 40px; border-radius: var(--radius-md);
    display:flex; align-items:center; justify-content:center;
    font-family: var(--font-display); font-weight:600; font-size:1.1rem;
    background: var(--brand-primary-lighter); color: var(--brand-primary-dark);
    flex-shrink:0;
}
.entity-avatar.lg { width:56px; height:56px; font-size:1.5rem; border-radius:var(--radius-lg); }

/* ---- Generic flex row helpers used in lists ---- */
.row-between { display:flex; align-items:center; justify-content:space-between; gap:var(--sp-3); }
.row-gap { display:flex; align-items:center; gap:var(--sp-3); }
.stack-2 > * + * { margin-top: var(--sp-2); }
.muted { color: var(--color-slate); }
.tiny { font-size: 0.75rem; }

/* ============================================================
   MEMBER WEB APP (mobile-first PWA)
   ============================================================ */
.member-body {
    background: var(--color-pearl);
    min-height: 100vh;
}
.member-shell {
    max-width: 480px;
    margin: 0 auto;
    min-height: 100vh;
    background: var(--color-pearl);
    position: relative;
    padding-bottom: 84px; /* room for bottom nav */
}

/* Onboarding / auth screens */
.member-auth {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: var(--sp-8) var(--sp-6);
    max-width: 480px; margin: 0 auto;
    background:
        radial-gradient(1200px 400px at 50% -10%, var(--brand-primary-lighter), transparent),
        var(--color-pearl);
}
.member-auth .auth-emblem {
    width: 72px; height: 72px; border-radius: var(--radius-lg);
    background: var(--brand-primary); color:#fff;
    display:flex; align-items:center; justify-content:center;
    font-family: var(--font-display); font-size: 2rem; font-weight:600;
    margin: 0 auto var(--sp-5); box-shadow: var(--shadow-brand);
}
.member-auth h1 {
    font-family: var(--font-display); font-style: italic;
    font-size: 1.9rem; text-align:center; color: var(--color-graphite);
    margin-bottom: var(--sp-2); font-weight:600;
}
.member-auth .auth-sub { text-align:center; color: var(--color-slate); margin-bottom: var(--sp-8); }
.member-auth .form-field input { font-size: 1.05rem; padding: var(--sp-4); }
.btn-xl { width:100%; padding: var(--sp-4); font-size: 1.0625rem; border-radius: var(--radius-md); }

/* OTP boxes */
.otp-row { display:flex; gap:var(--sp-2); justify-content:center; margin: var(--sp-4) 0; }
.otp-row input {
    width: 48px; height: 56px; text-align:center;
    font-size: 1.5rem; font-family: var(--font-body); font-weight:600;
    border: 1.5px solid var(--color-mist); border-radius: var(--radius-md);
    background: var(--color-white);
}
.otp-row input:focus { outline:none; border-color: var(--brand-primary); box-shadow: 0 0 0 3px var(--brand-primary-lighter); }

/* Member top bar */
.member-topbar {
    display:flex; align-items:center; justify-content:space-between;
    padding: var(--sp-4) var(--sp-5);
    position: sticky; top:0; z-index:10;
    background: rgba(250,251,253,0.92); backdrop-filter: blur(8px);
    border-bottom: 1px solid var(--color-fog);
}
.member-topbar .store-name { font-family: var(--font-display); font-style:italic; font-size:1.25rem; color: var(--color-graphite); font-weight:600; }
.member-page { padding: var(--sp-5); }

/* Digital membership card */
.member-card {
    border-radius: var(--radius-lg);
    padding: var(--sp-6);
    color: #fff;
    background:
        radial-gradient(600px 200px at 110% -20%, rgba(255,255,255,0.18), transparent),
        linear-gradient(135deg, var(--accent-charcoal), var(--brand-primary-dark));
    box-shadow: var(--shadow-lg);
    position: relative;
    overflow: hidden;
}
.member-card::after {
    content:""; position:absolute; right:-40px; bottom:-60px;
    width:180px; height:180px; border-radius:50%;
    background: radial-gradient(circle, rgba(201,169,97,0.35), transparent 70%);
}
.member-card .mc-top { display:flex; justify-content:space-between; align-items:flex-start; margin-bottom: var(--sp-6); }
.member-card .mc-label { font-size:0.6875rem; letter-spacing:0.12em; text-transform:uppercase; opacity:0.8; }
.member-card .mc-name { font-family: var(--font-display); font-size:1.6rem; font-weight:600; margin-top:2px; }
.member-card .mc-points { font-size: 2.4rem; font-weight:700; font-family: var(--font-display); line-height:1; }
.member-card .mc-foot { display:flex; justify-content:space-between; align-items:flex-end; margin-top: var(--sp-5); position:relative; z-index:1; }
.member-card .mc-tier {
    font-size:0.75rem; font-weight:600; padding:4px 12px; border-radius:999px;
    background: rgba(255,255,255,0.18); border:1px solid rgba(255,255,255,0.25);
}

/* QR display block */
.qr-block { display:flex; flex-direction:column; align-items:center; gap:var(--sp-3); padding: var(--sp-5); }
.qr-canvas-wrap { background:#fff; padding: var(--sp-4); border-radius: var(--radius-md); box-shadow: var(--shadow-sm); }
.qr-canvas-wrap canvas, .qr-canvas-wrap img { display:block; }

/* Member stat row */
.member-stats { display:grid; grid-template-columns: repeat(3,1fr); gap:var(--sp-3); margin-top: var(--sp-5); }
.member-stat { background:var(--color-white); border:1px solid var(--color-fog); border-radius:var(--radius-md); padding:var(--sp-4); text-align:center; }
.member-stat .ms-val { font-family:var(--font-display); font-size:1.5rem; font-weight:700; color:var(--color-graphite); }
.member-stat .ms-lab { font-size:0.6875rem; color:var(--color-stone); text-transform:uppercase; letter-spacing:0.04em; }

/* List item card (rewards, bottle keeps, history) */
.list-card {
    background: var(--color-white); border:1px solid var(--color-fog);
    border-radius: var(--radius-md); padding: var(--sp-4);
    display:flex; align-items:center; justify-content:space-between; gap:var(--sp-3);
}
.list-card + .list-card { margin-top: var(--sp-3); }
.list-card .lc-title { font-weight:600; color:var(--color-graphite); }
.list-card .lc-sub { font-size:0.8125rem; color:var(--color-slate); }

/* Bottle keep progress bar */
.keep-bar { height:6px; border-radius:999px; background:var(--color-fog); overflow:hidden; margin-top:6px; }
.keep-bar > span { display:block; height:100%; background: linear-gradient(90deg, var(--brand-primary), var(--accent-gold)); }

/* Section title for member */
.member-section-title { font-family:var(--font-display); font-style:italic; font-size:1.25rem; color:var(--color-graphite); margin: var(--sp-6) 0 var(--sp-3); font-weight:600; }

/* Bottom navigation */
.member-bottom-nav {
    position: fixed; bottom:0; left:50%; transform:translateX(-50%);
    width:100%; max-width:480px;
    display:flex; justify-content:space-around;
    background: rgba(255,255,255,0.96); backdrop-filter: blur(10px);
    border-top:1px solid var(--color-fog);
    padding: var(--sp-2) 0 calc(var(--sp-2) + env(safe-area-inset-bottom));
    z-index: 30;
}
.member-bottom-nav button {
    background:none; border:none; cursor:pointer;
    display:flex; flex-direction:column; align-items:center; gap:2px;
    color: var(--color-stone); font-size:0.6875rem; font-family:var(--font-body);
    padding: var(--sp-2) var(--sp-3); border-radius: var(--radius-sm);
    transition: color 0.2s var(--ease);
}
.member-bottom-nav button.active { color: var(--brand-primary); }
.member-bottom-nav button svg { width:22px; height:22px; }

/* POS quick-lookup styles */
.pos-search-big input { font-size:1.25rem; padding: var(--sp-4); letter-spacing:0.05em; }
.pos-result-card { border:1px solid var(--color-fog); border-radius:var(--radius-md); padding:var(--sp-5); background:var(--color-white); }
.scan-region { width:100%; max-width:320px; margin:0 auto; border-radius:var(--radius-md); overflow:hidden; }

/* Inline metric strip (member detail modal) */
.metric-strip { display:grid; grid-template-columns:repeat(4,1fr); gap:var(--sp-2); margin-bottom:var(--sp-4); }
.metric-strip .m { background:var(--color-cloud); border-radius:var(--radius-sm); padding:var(--sp-3); text-align:center; }
.metric-strip .m b { display:block; font-family:var(--font-display); font-size:1.25rem; color:var(--color-graphite); }
.metric-strip .m span { font-size:0.6875rem; color:var(--color-stone); }

/* Pill toggle reused for member tabs in admin */
.timeline { position:relative; padding-left: var(--sp-5); }
.timeline-item { position:relative; padding-bottom: var(--sp-4); }
.timeline-item::before { content:""; position:absolute; left:calc(-1 * var(--sp-5) + 4px); top:4px; width:9px; height:9px; border-radius:50%; background:var(--brand-primary); }
.timeline-item::after { content:""; position:absolute; left:calc(-1 * var(--sp-5) + 8px); top:13px; bottom:-4px; width:1px; background:var(--color-fog); }
.timeline-item:last-child::after { display:none; }

@media (max-width: 480px) {
    .member-stats { gap: var(--sp-2); }
    .metric-strip { grid-template-columns: repeat(2,1fr); }
}

/* ============================================================
   COMPATIBILITY LAYER — bridge markup class names to the
   design-system styles (modal/toast/login/sidebar emblems)
   ============================================================ */

/* Brand emblem images (login + sidebar) */
.brand-mark-lg { width:72px; height:72px; margin:0 auto var(--sp-5); display:block; border-radius:var(--radius-lg); box-shadow:var(--shadow-brand); }
.brand-mark { width:38px; height:38px; border-radius:var(--radius-md); display:block; }

/* Login title/subtitle (alias of brand-name/tagline sizing for the console login) */
.login-title { font-family:var(--font-display); font-style:italic; font-size:2rem; font-weight:600; color:var(--color-ink); line-height:1.1; margin-bottom:var(--sp-2); text-align:center; }
.login-subtitle { font-size:0.875rem; color:var(--color-slate); text-align:center; margin-bottom:var(--sp-2); }

/* Sidebar brand header + user text block */
.sidebar-brand { display:flex; align-items:center; gap:var(--sp-3); padding:var(--sp-5) var(--sp-5) var(--sp-4); border-bottom:1px solid var(--color-fog); }
.user-text { display:flex; flex-direction:column; line-height:1.2; min-width:0; }
.user-text .user-name { font-size:0.875rem; font-weight:600; color:var(--color-graphite); white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.user-role { font-size:0.6875rem; color:var(--color-stone); text-transform:uppercase; letter-spacing:0.04em; }

/* Modal — markup is .modal-backdrop > .modal-content, toggled with .open */
.modal-backdrop {
    position: fixed; inset: 0; z-index: 1000;
    display: flex; align-items: center; justify-content: center; padding: var(--sp-4);
    background: rgba(10, 14, 26, 0.5); -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px);
    opacity: 0; transition: opacity 0.2s var(--ease);
}
.modal-backdrop.open { opacity: 1; }
.modal-content {
    position: relative; background: var(--color-white);
    border-radius: var(--radius-xl); box-shadow: var(--shadow-xl);
    max-width: 540px; width: 100%; max-height: 90vh; overflow-y: auto;
    transform: translateY(20px) scale(0.98); transition: transform 0.3s var(--ease);
}
.modal-backdrop.open .modal-content { transform: translateY(0) scale(1); }
.modal-content.modal-large { max-width: 720px; }
.modal-close-btn {
    background: none; border: none; font-size: 1.5rem; line-height: 1; cursor: pointer;
    color: var(--color-stone); width: 32px; height: 32px; border-radius: var(--radius-sm);
    transition: all 0.2s var(--ease);
}
.modal-close-btn:hover { background: var(--color-cloud); color: var(--color-ink); }

/* Toast — markup uses #toast-container and .toast-<type> */
#toast-container { position: fixed; top: var(--sp-6); right: var(--sp-6); z-index: 2000; display: flex; flex-direction: column; gap: var(--sp-3); pointer-events: none; }
.toast { opacity: 0; transform: translateX(20px); transition: opacity 0.3s var(--ease), transform 0.3s var(--ease); }
.toast.show { opacity: 1; transform: translateX(0); }
.toast-success { border-left-color: var(--color-success); }
.toast-error { border-left-color: var(--color-danger); }
.toast-warning { border-left-color: var(--color-warning); }
.toast-info { border-left-color: var(--brand-primary); }

@media (max-width: 640px) {
    #toast-container { top: auto; bottom: var(--sp-6); left: var(--sp-4); right: var(--sp-4); }
    .toast { min-width: 0; max-width: none; }
}

/* Sidebar brand sizing (brand-name default is display-sized for login) */
.sidebar-brand .brand-name { font-size: 1.0625rem; line-height: 1.1; margin-bottom: 0; }
.sidebar-brand .brand-tagline { font-size: 0.625rem; letter-spacing: 0.16em; }

/* Apple Sign-In button */
.btn-apple {
    background: #000; color: #fff; border-color: #000;
    margin-top: var(--sp-3);
    display: inline-flex; align-items: center; justify-content: center; gap: var(--sp-2);
    padding: var(--sp-3) var(--sp-5); font-family: var(--font-body);
    font-size: 0.9375rem; font-weight: 500; border-radius: var(--radius-md);
    cursor: pointer; transition: all 0.25s var(--ease); letter-spacing: 0.01em;
}
.btn-apple:hover { background: #1a1a1a; }
.btn-apple svg { margin-top: -1px; }

/* ============================================================
   MOBILE NAV — hamburger menu button + sidebar overlay
   ============================================================ */
.menu-btn {
    background: none; border: none; cursor: pointer; color: var(--color-graphite);
    padding: var(--sp-2); border-radius: var(--radius-sm); align-items: center; justify-content: center;
}
.menu-btn:hover { background: var(--color-cloud); }

.sidebar-overlay { display: none; }
@media (max-width: 1024px) {
    .sidebar-overlay {
        position: fixed; inset: 64px 0 0 0; z-index: 90;
        background: rgba(10, 14, 26, 0.4); -webkit-backdrop-filter: blur(2px); backdrop-filter: blur(2px);
    }
    .sidebar-overlay.open { display: block; }
    /* header brand text smaller on phones */
    .app-header .brand-text { font-size: 1.125rem; }
}

/* logo image inside header container */
.brand-logo-container img { width: 100%; height: 100%; object-fit: cover; }

/* ============================================================
   SIDEBAR — SIMPLE & ROBUST: the whole panel scrolls as one.
   No flex/pinned-footer trickery (which broke on mobile browsers).
   The logout footer is always reachable by scrolling the drawer.
   ============================================================ */
.sidebar {
    display: flex;
    flex-direction: column;
    overflow-y: auto;                 /* whole drawer scrolls */
    -webkit-overflow-scrolling: touch;/* momentum scroll on iOS */
}
.sidebar-nav { display: flex; flex-direction: column; gap: 2px; }
.sidebar-footer {
    margin-top: auto;                 /* sit at the bottom when content is short */
    padding-top: var(--sp-3);
    border-top: 1px solid var(--color-fog);
}

@media (max-width: 1024px) {
    /* dynamic viewport height so the bottom is reachable even with mobile chrome */
    .sidebar { height: calc(100vh - 64px); height: calc(100dvh - 64px); padding-bottom: var(--sp-8); }
    /* freeze the page behind the open drawer */
    body.drawer-open { overflow: hidden; }
}

/* ============================================================
   HEADER LOGOUT — always visible, independent of sidebar length
   ============================================================ */
.header-right { display: flex; align-items: center; gap: var(--sp-3); }
.header-logout-btn {
    display: inline-flex; align-items: center; gap: var(--sp-2);
    background: var(--color-white); color: var(--color-slate);
    border: 1px solid var(--color-fog); border-radius: var(--radius-md);
    padding: var(--sp-2) var(--sp-4); font-family: var(--font-body);
    font-size: 0.875rem; font-weight: 500; cursor: pointer;
    transition: all 0.2s var(--ease); white-space: nowrap;
}
.header-logout-btn:hover { background: var(--brand-primary-soft); color: var(--brand-primary-dark); border-color: var(--brand-primary-lighter); }
.header-logout-btn svg { flex-shrink: 0; }
@media (max-width: 480px) {
    .header-logout-label { display: none; } /* icon-only on small phones */
    .header-logout-btn { padding: var(--sp-2); }
}

/* ============================================================
   MEMBER SEARCH PICKER — type-ahead list (replaces long <select>)
   ============================================================ */
.member-search { position: relative; }
.member-search-results {
    position: absolute; top: 100%; left: 0; right: 0; z-index: 60;
    margin-top: 4px; background: var(--color-white);
    border: 1px solid var(--color-fog); border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg); max-height: 260px; overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}
.member-search-results[hidden] { display: none; }
.ms-item {
    display: flex; flex-direction: column; gap: 2px; width: 100%;
    text-align: left; background: none; border: none; cursor: pointer;
    padding: var(--sp-3) var(--sp-4); border-bottom: 1px solid var(--color-cloud);
    transition: background 0.15s var(--ease);
}
.ms-item:last-child { border-bottom: none; }
.ms-item:hover, .ms-item:focus { background: var(--brand-primary-soft); }
.ms-name { font-size: 0.9375rem; font-weight: 600; color: var(--color-ink); }
.ms-phone { font-size: 0.8125rem; color: var(--color-stone); }
.ms-empty { padding: var(--sp-4); font-size: 0.8125rem; color: var(--color-stone); text-align: center; }

/* LINE connect button */
.btn-line { background:#06C755; color:#fff; border:none; display:inline-flex; align-items:center; justify-content:center; gap:var(--sp-2); width:100%; padding:var(--sp-4); border-radius:var(--radius-md); font-family:var(--font-body); font-size:1rem; font-weight:600; cursor:pointer; transition:background .2s var(--ease); }
.btn-line:hover { background:#05b34c; }

/* ============================================================
   ENGAGEMENT — multiplier banner, coupon code, referral code
   ============================================================ */
.mult-banner {
    background: linear-gradient(135deg, #C9A961, #b8924a); color: #fff;
    border-radius: var(--radius-md); padding: var(--sp-3) var(--sp-4);
    font-weight: 600; font-size: 0.9375rem; text-align: center; margin-bottom: var(--sp-4);
    box-shadow: 0 6px 16px rgba(201,169,97,0.35);
}
.coupon-code {
    font-family: var(--font-mono, monospace); font-size: 1.5rem; font-weight: 700; letter-spacing: 0.18em;
    text-align: center; color: var(--brand-primary-dark); background: var(--brand-primary-soft);
    border: 1px dashed var(--brand-primary-lighter); border-radius: var(--radius-md);
    padding: var(--sp-3); margin-top: var(--sp-2);
}
.ref-code {
    font-family: var(--font-mono, monospace); font-size: 1.125rem; font-weight: 700; letter-spacing: 0.14em;
    color: var(--brand-primary-dark); background: var(--brand-primary-soft);
    border-radius: var(--radius-sm); padding: 6px 12px;
}

/* ---- PWA install instructions popup ---- */
.install-steps { margin: 0; padding-left: 1.25rem; display: flex; flex-direction: column; gap: 10px; }
.install-steps li { line-height: 1.55; color: var(--color-ink, #1B1B2A); }
.install-steps b { color: var(--brand-primary-dark, #6D28D9); }

/* ============================================================
   Reservation calendar + store hidden-menu checkboxes
   ============================================================ */
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.cal-grid.cal-head { margin-bottom: 6px; gap: 6px; }
.cal-dow { text-align: center; font-size: 0.75rem; color: var(--color-stone, #8A8AA0); font-weight: 600; padding: 4px 0; }
.cal-cell { position: relative; aspect-ratio: 1 / 1; border: 1px solid var(--color-fog, #E6E6EF); border-radius: 10px; background: #fff; cursor: pointer; display: flex; align-items: flex-start; justify-content: flex-start; padding: 6px; transition: all .12s; font-family: inherit; }
.cal-cell:hover { border-color: var(--brand-primary, #7C3AED); background: var(--brand-primary-soft, #F3EEFF); }
.cal-cell.empty { border: none; background: transparent; cursor: default; }
.cal-cell .cal-num { font-size: 0.85rem; font-weight: 600; color: var(--color-ink, #1B1B2A); }
.cal-cell.today { border-color: var(--brand-primary, #7C3AED); box-shadow: inset 0 0 0 1px var(--brand-primary, #7C3AED); }
.cal-cell.selected { background: var(--brand-primary, #7C3AED); }
.cal-cell.selected .cal-num { color: #fff; }
.cal-cell.holiday { background: #FEF2F2; border-color: #FCA5A5; }
.cal-cell.holiday .cal-num { color: #DC2626; }
.cal-dot { position: absolute; bottom: 5px; right: 6px; min-width: 16px; height: 16px; padding: 0 4px; border-radius: 8px; background: var(--brand-primary, #7C3AED); color: #fff; font-size: 0.65rem; font-weight: 700; display: flex; align-items: center; justify-content: center; }
.cal-tag { position: absolute; bottom: 4px; left: 6px; font-size: 0.6rem; font-weight: 700; color: #DC2626; }
.cal-select { padding: 4px 8px; border: 1px solid var(--color-fog, #E6E6EF); border-radius: 8px; font-family: inherit; font-size: 0.85rem; }
.res-status-sel { padding: 5px 8px; border: 1px solid var(--color-fog, #E6E6EF); border-radius: 8px; font-family: inherit; font-size: 0.8rem; background: #fff; }
.chk-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 8px; }
.chk { display: flex; align-items: center; gap: 6px; font-size: 0.85rem; padding: 6px 8px; border: 1px solid var(--color-fog, #E6E6EF); border-radius: 8px; cursor: pointer; }
.chk input { width: auto; }
@media (max-width: 480px) { .cal-cell { padding: 3px; border-radius: 7px; } .cal-cell .cal-num { font-size: 0.72rem; } .cal-dot { min-width: 13px; height: 13px; font-size: 0.55rem; } }

/* ============================================================
   Type editor rows (store types / reservation types) + booking customer col
   ============================================================ */
.type-editor-list { display: flex; flex-direction: column; gap: 8px; margin-bottom: var(--sp-3); }
.type-editor-row { display: flex; align-items: center; gap: 8px; background: var(--color-cloud, #F4F4F8); border: 1px solid var(--color-fog, #E6E6EF); border-radius: 10px; padding: 6px 8px 6px 10px; }
.type-editor-row .type-code { flex: 0 0 auto; font-family: var(--font-mono, monospace); font-size: 0.72rem; font-weight: 700; color: var(--brand-primary-dark, #6D28D9); background: var(--brand-primary-soft, #F3EEFF); border-radius: 6px; padding: 3px 8px; min-width: 54px; text-align: center; }
.input-clean { flex: 1; min-width: 0; border: 1px solid transparent; background: #fff; border-radius: 8px; padding: 8px 10px; font-family: inherit; font-size: 0.9rem; transition: border-color .12s, box-shadow .12s; }
.input-clean:focus { outline: none; border-color: var(--brand-primary, #7C3AED); box-shadow: 0 0 0 3px var(--brand-primary-soft, #F3EEFF); }
.type-editor-row .input-clean { background: #fff; border-color: var(--color-fog, #E6E6EF); }
.icon-btn { flex: 0 0 auto; width: 32px; height: 32px; border-radius: 8px; border: 1px solid var(--color-fog, #E6E6EF); background: #fff; color: var(--color-slate, #4A4A5E); font-size: 0.95rem; line-height: 1; cursor: pointer; display: flex; align-items: center; justify-content: center; transition: all .12s; }
.icon-btn:hover { border-color: var(--brand-primary, #7C3AED); color: var(--brand-primary, #7C3AED); background: var(--brand-primary-soft, #F3EEFF); }
.icon-btn.danger:hover { border-color: #EF4444; color: #EF4444; background: #FEF2F2; }
.type-add-row { display: flex; align-items: center; gap: 8px; }
.type-add-row .input-clean { border-color: var(--color-fog, #E6E6EF); }
.type-add-row .type-code-input { flex: 0 0 140px; font-family: var(--font-mono, monospace); }
@media (max-width: 480px) { .type-add-row { flex-wrap: wrap; } .type-add-row .type-code-input { flex: 1 1 100%; } }
/* reservation customer column — single line with phone, table already scrolls horizontally */
.col-customer { white-space: nowrap; min-width: 220px; }
.col-customer .cust-name { font-weight: 600; }
/* service column matches the customer column width */
.col-service { white-space: nowrap; min-width: 220px; }

/* API usage example (settings) */
.api-example { background: #1B1B2A; color: #E6E6EF; border-radius: 10px; padding: 12px 14px; font-family: var(--font-mono, monospace); font-size: 0.72rem; line-height: 1.5; white-space: pre-wrap; word-break: break-all; overflow-x: auto; margin: 0; }

/* reservation transfer-slip preview */
.slip-box { min-height: 40px; display: flex; align-items: center; }
.slip-thumb { width: 96px; height: 96px; object-fit: cover; border-radius: 10px; border: 1px solid var(--color-fog, #E6E6EF); cursor: pointer; transition: transform .12s, box-shadow .12s; }
.slip-thumb:hover { transform: scale(1.03); box-shadow: 0 4px 14px rgba(0,0,0,.15); }

/* members table — name column is wide + single-line (table scrolls horizontally) */
.col-member { min-width: 280px; white-space: nowrap; }
.col-member .lc-title, .col-member strong { white-space: nowrap; }
