* { box-sizing: border-box; }

:root {
    --violet: #6d4ce0;
    --violet-dark: #5836c4;
    --amber: #eda100;
    --coral: #eb6834;
    --blue: #2a78d6;
    --ink: #182420;
    --muted: #8a8f8c;
    --line: #e7e5f1;
    --plane: #efedfa;
    --danger: #b23a3a;
    --shadow-tile: 0 10px 24px rgba(60, 40, 140, 0.16);
    --shadow-lg: 0 20px 48px rgba(40, 30, 90, 0.14);
}

body {
    margin: 0;
    padding: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
    background: #fff;
    color: #222;
}

.tabular { font-variant-numeric: tabular-nums; }

a { color: var(--violet-dark); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ---------- App shell: sidebar + main area ---------- */

.sidebar-toggle-state { display: none; }

.app-shell {
    display: flex;
    align-items: stretch;
    min-height: 100vh;
    background: #fff;
}

.sidebar {
    width: 240px;
    flex-shrink: 0;
    background: linear-gradient(190deg, var(--violet) 0%, var(--violet-dark) 100%);
    display: flex;
    flex-direction: column;
    padding: 1.5rem 1rem;
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0 0.4rem 1.25rem;
    margin-bottom: 0.75rem;
    border-bottom: 1px solid rgba(255,255,255,0.16);
}
.brand-mark {
    width: 34px;
    height: 34px;
    border-radius: 9px;
    background: rgba(255,255,255,0.2);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.85rem;
    flex-shrink: 0;
}
.brand-name { font-weight: 700; font-size: 1.05rem; letter-spacing: 0.01em; color: #fff; }

.sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
    margin-top: 0.5rem;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 0.7rem;
    padding: 0.65rem 0.75rem;
    border-radius: 10px;
    color: rgba(255,255,255,0.72);
    font-size: 0.92rem;
    font-weight: 500;
}
.nav-item:hover { background: rgba(255,255,255,0.12); color: #fff; text-decoration: none; }
.nav-item.active { background: #fff; color: var(--violet-dark); font-weight: 700; box-shadow: 0 6px 16px rgba(20,10,60,0.25); }
.nav-icon { display: flex; align-items: center; justify-content: center; width: 1.3rem; flex-shrink: 0; }
.nav-icon .icon-svg { width: 18px; height: 18px; }

.icon-svg { display: block; }

.sidebar-footer {
    margin-top: auto;
    padding-top: 1rem;
    border-top: 1px solid rgba(255,255,255,0.16);
}

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

.topbar {
    background: #fff;
    border-bottom: 1px solid var(--line);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.25rem 1.75rem;
    gap: 1rem;
}
.topbar-title h1 { margin: 0; font-size: 1.35rem; color: var(--ink); }
.topbar-title p { margin: 0.15rem 0 0; color: var(--muted); font-size: 0.85rem; }

.topbar-right {
    display: flex;
    align-items: center;
    gap: 0.9rem;
    flex-shrink: 0;
}

.user-chip { display: flex; align-items: center; gap: 0.55rem; }
.avatar {
    width: 34px;
    height: 34px;
    border-radius: 999px;
    background: var(--violet);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.78rem;
}
.user-name { font-weight: 600; font-size: 0.9rem; }

.sidebar-toggle-btn {
    display: none;
    cursor: pointer;
    margin-right: 0.25rem;
    color: #444;
}
.sidebar-toggle-btn .icon-svg { width: 22px; height: 22px; }

.content {
    flex: 1;
    padding: 1.75rem;
    background: #fbfbfc;
}

.footer {
    text-align: center;
    color: #888;
    font-size: 0.85rem;
    padding: 1.5rem 1rem;
}

.alert {
    padding: 0.75rem 1rem;
    border-radius: 6px;
    margin-bottom: 1rem;
    font-size: 0.95rem;
}
.alert-success { background: #e2f6ec; color: #0f6b3f; border: 1px solid #a7e3c3; }
.alert-error { background: #fdeaea; color: #9c1f1f; border: 1px solid #f3b8b8; }

.card {
    background: #fff;
    border-radius: 8px;
    padding: 1.25rem;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
    margin-bottom: 1.25rem;
}

.stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.stat-card {
    background: #fff;
    border-radius: 8px;
    padding: 1rem 1.1rem;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
    border-left: 4px solid var(--violet);
}
.stat-card .label { font-size: 0.8rem; color: #666; text-transform: uppercase; letter-spacing: 0.03em; }
.stat-card .value { font-size: 1.6rem; font-weight: 700; margin-top: 0.25rem; }

.page-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 1rem;
}
.page-head h1 { margin: 0; font-size: 1.4rem; }

.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    background: var(--violet);
    color: #fff;
    border: none;
    padding: 0.55rem 1.1rem;
    border-radius: 6px;
    font-size: 0.9rem;
    cursor: pointer;
}
.btn .icon-svg { width: 15px; height: 15px; flex-shrink: 0; }
.btn:hover { background: var(--violet-dark); text-decoration: none; }
.btn-secondary { background: #666; }
.btn-secondary:hover { background: #4d4d4d; }
.btn-danger { background: #b23a3a; }
.btn-danger:hover { background: #8f2c2c; }
.btn-sm { padding: 0.3rem 0.7rem; font-size: 0.82rem; }
.btn.is-copied { background: #1a9c63; }

table {
    width: 100%;
    border-collapse: collapse;
    background: #fff;
    border-radius: 8px;
    overflow: hidden;
}
th, td {
    padding: 0.65rem 0.8rem;
    text-align: left;
    border-bottom: 1px solid #eee;
    font-size: 0.92rem;
}
th { background: #f0f2f4; font-weight: 600; }
tr:last-child td { border-bottom: none; }

.table-wrap { overflow-x: auto; background: #fff; border-radius: 8px; box-shadow: 0 1px 3px rgba(0,0,0,0.08); }
.table-wrap table { box-shadow: none; }

.badge {
    display: inline-block;
    padding: 0.15rem 0.55rem;
    border-radius: 999px;
    font-size: 0.78rem;
    font-weight: 600;
}
.badge-active { background: #e2f6ec; color: #0f6b3f; }
.badge-inactive { background: #f0f0f0; color: #777; }

form.inline-form { display: inline; }

.form-card {
    background: #fff;
    border-radius: 8px;
    padding: 1.5rem;
    max-width: 480px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}
.form-group { margin-bottom: 1rem; }
.form-group label { display: block; margin-bottom: 0.3rem; font-weight: 600; font-size: 0.9rem; }
.form-group input, .form-group select, .form-group textarea {
    width: 100%;
    padding: 0.55rem 0.7rem;
    border: 1px solid #ccc;
    border-radius: 6px;
    font-size: 0.95rem;
}
.form-actions { display: flex; gap: 0.6rem; margin-top: 1.25rem; }

.filter-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    align-items: flex-end;
    background: #fff;
    padding: 1rem;
    border-radius: 8px;
    margin-bottom: 1rem;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}
.filter-bar .form-group { margin-bottom: 0; min-width: 160px; }

.qr-box {
    text-align: center;
    background: #fff;
    padding: 2rem;
    border-radius: 8px;
    max-width: 420px;
    margin: 0 auto;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}
.qr-box img { max-width: 260px; width: 100%; border-radius: 8px; }
.qr-box h2 { margin: 0 0 0.5rem; }
.qr-box-avatar {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: linear-gradient(135deg, #7a5aea, var(--violet-dark));
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 1.3rem;
    margin: 0 auto 0.9rem;
}
.qr-box-meta {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    margin-bottom: 1.2rem;
    font-size: 0.85rem;
    color: var(--muted);
}
.qr-box-actions { display: flex; justify-content: center; gap: 0.6rem; margin-top: 1rem; flex-wrap: wrap; }

.qr-design-card { max-width: 1020px; margin: 0 auto; }

.qr-design-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 280px;
    gap: 1.5rem;
    align-items: start;
}
@media (max-width: 800px) {
    .qr-design-grid { grid-template-columns: 1fr; }
}

.qr-preview-panel {
    background: #f7f6fc;
    border: 1px solid var(--line);
    border-radius: 14px;
    padding: 1.25rem;
    display: flex;
    flex-direction: column;
    gap: 1.4rem;
}
.qr-preview-panel-section + .qr-preview-panel-section { padding-top: 1.2rem; border-top: 1px solid var(--line); }
.qr-panel-heading {
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--muted);
    margin: 0 0 0.9rem;
}
.qr-panel-save { width: 100%; justify-content: center; }

.qr-editor-wrap { position: relative; margin-bottom: 0.5rem; }
.qr-editor-canvas {
    max-width: 100%;
    max-height: 480px;
    width: auto;
    height: auto;
    border-radius: 10px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    margin: 0 auto;
    display: block;
    cursor: move;
    touch-action: none;
}
.qr-editor-empty {
    text-align: center;
    color: var(--muted);
    padding: 3rem 1rem;
    border: 2px dashed var(--line);
    border-radius: 10px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
}
.qr-editor-empty .icon-svg { width: 30px; height: 30px; color: var(--violet); }

/* ---------- Phone-frame live preview (QR Design) ---------- */
.phone-frame {
    width: 190px;
    margin: 0 auto;
    background: #1c1c1e;
    border-radius: 28px;
    padding: 12px 8px;
    box-shadow: 0 14px 30px rgba(20, 10, 40, 0.28);
}
.phone-frame .notch {
    width: 46px;
    height: 5px;
    background: #3a3a3c;
    border-radius: 4px;
    margin: 0 auto 8px;
}
.phone-frame .screen {
    background: #f4f4f6;
    border-radius: 15px;
    overflow: hidden;
    min-height: 300px;
    aspect-ratio: 9 / 19.5;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}
.phone-frame .screen canvas { width: 100%; height: auto; display: block; }
.phone-frame .home-indicator {
    width: 38px;
    height: 4px;
    background: #3a3a3c;
    border-radius: 2px;
    margin: 8px auto 0;
}

.qr-style-heading { font-size: 0.92rem; margin: 0 0 0.9rem; color: var(--ink); }
.qr-design-controls input[type="range"] { width: 100%; accent-color: var(--violet); }
.qr-design-controls input[type="color"] { width: 100%; height: 40px; padding: 0.25rem; cursor: pointer; }

.checkbox-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.85rem;
    color: var(--muted);
    margin-top: 0.85rem;
}
.checkbox-row input { width: auto; }

.toggle-switch {
    display: inline-flex;
    background: #eef0f4;
    border-radius: 999px;
    padding: 4px;
    position: relative;
    width: max-content;
}
.toggle-switch::before {
    content: '';
    position: absolute;
    top: 4px;
    bottom: 4px;
    left: 4px;
    width: calc(50% - 4px);
    background: var(--violet);
    border-radius: 999px;
    transition: transform 0.25s cubic-bezier(0.22, 1, 0.36, 1);
    z-index: 0;
}
.toggle-switch[data-active="1"]::before { transform: translateX(100%); }
.toggle-option {
    position: relative;
    z-index: 1;
    border: none;
    background: none;
    padding: 0.55rem 1.2rem;
    border-radius: 999px;
    font-size: 0.88rem;
    font-weight: 600;
    color: #666;
    cursor: pointer;
    transition: color 0.2s ease;
}
.toggle-option.is-active { color: #fff; }

/* ---------- Single on/off status toggle (Deactivate/Activate) ---------- */
.status-toggle { display: inline-flex; cursor: pointer; }
.status-toggle input {
    position: absolute;
    width: 1px;
    height: 1px;
    opacity: 0;
    pointer-events: none;
}
.status-toggle-track {
    width: 38px;
    height: 22px;
    background: #d8d8de;
    border-radius: 999px;
    position: relative;
    display: inline-block;
    transition: background 0.2s ease;
}
.status-toggle-thumb {
    position: absolute;
    top: 2px;
    left: 2px;
    width: 18px;
    height: 18px;
    background: #fff;
    border-radius: 50%;
    box-shadow: 0 1px 3px rgba(0,0,0,0.3);
    transition: transform 0.2s cubic-bezier(0.22, 1, 0.36, 1);
}
.status-toggle input:checked ~ .status-toggle-track { background: #1a9c63; }
.status-toggle input:checked ~ .status-toggle-track .status-toggle-thumb { transform: translateX(16px); }

.scanner-frame {
    position: relative;
    width: 100%;
    aspect-ratio: 4 / 3;
    background: #111;
    border-radius: 12px;
    overflow: hidden;
}
.scanner-frame video { width: 100%; height: 100%; object-fit: cover; display: block; }
.scanner-frame-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.6rem;
    color: #ddd;
    background: rgba(10, 10, 15, 0.75);
    text-align: center;
    padding: 1rem;
    font-size: 0.85rem;
}
.scanner-frame-overlay .icon-svg { width: 30px; height: 30px; opacity: 0.7; }

.profile-card {
    background: #fff;
    border-radius: 16px;
    padding: 2rem 1.75rem;
    text-align: center;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}
.profile-photo-wrap { display: flex; justify-content: center; margin-bottom: 1rem; }
.profile-photo {
    width: 110px;
    height: 110px;
    border-radius: 50%;
    object-fit: cover;
    box-shadow: 0 4px 16px rgba(30, 20, 70, 0.15);
}
.profile-photo-fallback {
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #7a5aea, var(--violet-dark));
    color: #fff;
    font-size: 2.4rem;
    font-weight: 700;
}
.profile-card h2 { margin: 0 0 0.5rem; }
.profile-contact {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    align-items: center;
    color: var(--muted);
    font-size: 0.88rem;
    margin-bottom: 1.25rem;
}
.profile-contact div { display: flex; align-items: center; gap: 0.5rem; }
.profile-contact .icon-svg { width: 15px; height: 15px; flex-shrink: 0; }
.profile-photo-actions { display: flex; justify-content: center; gap: 0.5rem; flex-wrap: wrap; }

/* ---------- Tour guide cards (Tour Guides list) ---------- */
.guide-card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
    gap: 1.1rem;
}
.guide-card {
    position: relative;
    background: #fff;
    border-radius: 16px;
    padding: 1.5rem 1.1rem 1.25rem;
    text-align: center;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
    transition: box-shadow 0.18s ease, transform 0.18s ease;
    display: flex;
    flex-direction: column;
}
.guide-card:hover { box-shadow: 0 10px 26px rgba(30, 20, 70, 0.12); transform: translateY(-2px); }
.guide-card-kebab { position: absolute; top: 0.6rem; right: 0.6rem; }

.guide-card-photo-wrap { display: flex; justify-content: center; margin-bottom: 0.85rem; }
.guide-card-photo {
    width: 68px;
    height: 68px;
    border-radius: 50%;
    object-fit: cover;
}
.guide-card-photo-fallback {
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #7a5aea, var(--violet-dark));
    color: #fff;
    font-size: 1.55rem;
    font-weight: 700;
}
.guide-card h3 { margin: 0 0 0.4rem; font-size: 1.02rem; }
.guide-card-meta {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.8rem;
    color: var(--muted);
    margin-bottom: 0.7rem;
}
.guide-card-brief {
    font-size: 0.82rem;
    color: var(--muted);
    margin-bottom: 1.1rem;
}
.guide-card-brief strong { color: var(--ink); font-weight: 700; }
.guide-card-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
}
.guide-card-qr-btn { flex: 1; justify-content: center; min-width: 0; }
.guide-card-view-more {
    justify-content: center;
    margin-top: auto;
}
.qr-link {
    word-break: break-all;
    background: #f4f6f8;
    padding: 0.6rem;
    border-radius: 6px;
    font-size: 0.82rem;
    margin: 1rem 0;
}

/* ---------- Card-style list rows (Tour Guides) ---------- */

.list-rows {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.list-row {
    background: #fff;
    border-radius: 12px;
    padding: 0.85rem 1.1rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    box-shadow: 0 1px 3px rgba(0,0,0,0.06);
}

.list-row-icon {
    width: 46px;
    height: 46px;
    border-radius: 10px;
    background: #ece7fb;
    color: var(--violet-dark);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 1.05rem;
    flex-shrink: 0;
}
.list-row-icon.is-inactive { background: #f0f0f0; color: #999; }

.list-row-main { flex: 1; min-width: 0; }
.list-row-title { font-weight: 700; font-size: 0.98rem; }
.list-row-sub {
    color: #888;
    font-size: 0.83rem;
    margin-top: 0.15rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.list-row-meta {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    flex-shrink: 0;
    font-size: 0.85rem;
    color: #666;
}

.list-row-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-shrink: 0;
}

.empty-state {
    background: #fff;
    border-radius: 12px;
    padding: 2rem;
    text-align: center;
    color: #888;
    box-shadow: 0 1px 3px rgba(0,0,0,0.06);
}

/* Kebab (⋮) dropdown menu, CSS-only via <details> */
.kebab { position: relative; }
.kebab > summary {
    list-style: none;
    cursor: pointer;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    color: #555;
    font-size: 1.1rem;
}
.kebab > summary::-webkit-details-marker { display: none; }
.kebab > summary:hover, .kebab[open] > summary { background: #f0f2f4; }
.kebab-menu {
    position: absolute;
    right: 0;
    top: 38px;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 6px 20px rgba(0,0,0,0.15);
    min-width: 170px;
    padding: 0.4rem;
    z-index: 30;
}
.kebab-menu a, .kebab-menu button {
    display: block;
    width: 100%;
    text-align: left;
    background: none;
    border: none;
    padding: 0.5rem 0.6rem;
    border-radius: 6px;
    font-size: 0.87rem;
    color: #333;
    cursor: pointer;
}
.kebab-menu a:hover, .kebab-menu button:hover { background: #f4f6f8; text-decoration: none; }
.kebab-menu form { margin: 0; }
.kebab-menu .danger { color: #b23a3a; }

/* Public scan/submit pages */
.scan-wrap {
    max-width: 420px;
    margin: 2rem auto;
    padding: 0 1rem;
}
.scan-card {
    background: #fff;
    border-radius: 10px;
    padding: 1.75rem;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}
.scan-card h1 { font-size: 1.25rem; margin-top: 0; }
.scan-guide { color: var(--violet-dark); font-weight: 700; }

@media (max-width: 900px) {
    .sidebar-toggle-btn { display: inline-block; }
    .sidebar {
        position: fixed;
        top: 0;
        left: 0;
        height: 100vh;
        z-index: 100;
        transform: translateX(-100%);
        transition: transform 0.2s ease;
        box-shadow: 4px 0 16px rgba(0,0,0,0.15);
    }
    #sidebarToggle:checked ~ .sidebar { transform: translateX(0); }
    .list-row { flex-wrap: wrap; }
    .list-row-sub { white-space: normal; }
    .dash-grid { grid-template-columns: 1fr; }
    .hero-banner { flex-direction: column; align-items: flex-start; text-align: left; }
}

/* ---------- Dashboard: hero, tiles, avatar strip, chart ---------- */

.dash-grid {
    display: grid;
    grid-template-columns: 1.7fr 1fr;
    gap: 1.25rem;
    align-items: start;
}

.hero-banner {
    background: linear-gradient(120deg, #fdeacb 0%, #fbd9a3 100%);
    border-radius: 20px;
    padding: 1.6rem 1.9rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1.5rem;
    margin-bottom: 1.25rem;
}
.hero-banner h2 { margin: 0 0 0.4rem; font-size: 1.35rem; color: #7a4a12; }
.hero-banner p { margin: 0; color: #8a5c22; font-size: 0.9rem; max-width: 44ch; line-height: 1.5; }
.hero-icon {
    width: 72px;
    height: 72px;
    border-radius: 50%;
    background: rgba(255,255,255,0.55);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    color: #9a6a2a;
}
.hero-icon .icon-svg { width: 34px; height: 34px; }

.tile-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.9rem;
    margin-bottom: 1.25rem;
}
.tile-grid.cols-3 { grid-template-columns: repeat(3, 1fr); }
@media (max-width: 780px) {
    .tile-grid.cols-3 { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 480px) {
    .tile-grid.cols-3 { grid-template-columns: 1fr; }
}
.tile {
    border-radius: 18px;
    padding: 1.05rem 1.15rem;
    color: #fff;
    box-shadow: var(--shadow-tile);
}
.tile .tile-icon {
    width: 34px;
    height: 34px;
    border-radius: 9px;
    background: rgba(255,255,255,0.24);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 1.4rem;
}
.tile .tile-icon .icon-svg { width: 18px; height: 18px; }
.tile .tile-value { font-size: 1.35rem; font-weight: 700; }
.tile .tile-label { font-size: 0.76rem; opacity: 0.88; margin-top: 0.15rem; }
.tile.violet { background: linear-gradient(135deg, #7a5aea, var(--violet-dark)); }
.tile.amber  { background: linear-gradient(135deg, #f5b93f, var(--amber)); }
.tile.coral  { background: linear-gradient(135deg, #f2825f, var(--coral)); }
.tile.blue   { background: linear-gradient(135deg, #4a90e2, var(--blue)); }

.side-card {
    background: #fff;
    border-radius: 16px;
    padding: 1.15rem 1.25rem;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
    margin-bottom: 1.25rem;
}
.side-card h3 { margin: 0 0 0.9rem; font-size: 0.98rem; color: var(--ink); }

.avatar-strip { display: flex; gap: 1.1rem; flex-wrap: wrap; }
.avatar-strip .person { text-align: center; width: 68px; }
.avatar-strip .p-avatar {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    margin: 0 auto 0.4rem;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-weight: 700;
    font-size: 0.82rem;
}
.avatar-strip .p-name { font-size: 0.76rem; font-weight: 700; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.avatar-strip .p-role { font-size: 0.68rem; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.chart-head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 0.6rem; }
.chart-head .chart-total { font-size: 0.82rem; color: var(--muted); }
.chart-svg { width: 100%; height: auto; display: block; overflow: visible; }
.chart-svg .grid-line { stroke: var(--line); stroke-width: 1; }
.chart-svg .axis-label { fill: var(--muted); font-size: 10px; font-family: -apple-system, "Segoe UI", sans-serif; }
.chart-svg .end-label { fill: var(--ink); font-size: 10.5px; font-weight: 700; font-family: -apple-system, "Segoe UI", sans-serif; }

@media (max-width: 1100px) {
    .dash-grid { grid-template-columns: 1fr; }
}
@media (max-width: 520px) {
    .tile-grid { grid-template-columns: 1fr; }
}

@media print {
    .sidebar, .topbar, .footer, .no-print { display: none !important; }
    .content { padding: 0; }
}

/* ---------- Motion ---------- */

@keyframes fadeSlideUp {
    from { opacity: 0; transform: translateY(10px); }
    to   { opacity: 1; transform: translateY(0); }
}
@keyframes toastIn {
    from { opacity: 0; transform: translateY(-14px) scale(0.97); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}
@keyframes spin {
    to { transform: rotate(360deg); }
}

.animate-in {
    opacity: 0;
    animation: fadeSlideUp 0.38s cubic-bezier(0.22, 1, 0.36, 1) forwards;
    animation-delay: calc(var(--i, 0) * 45ms);
}

@media (prefers-reduced-motion: reduce) {
    .animate-in { opacity: 1; animation: none; }
    *, *::before, *::after { transition-duration: 0.001ms !important; animation-duration: 0.001ms !important; }
}

/* ---------- Toast notifications ---------- */

.toast-stack {
    position: fixed;
    top: 1.25rem;
    right: 1.25rem;
    z-index: 200;
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
    max-width: min(360px, calc(100vw - 2.5rem));
}

.toast {
    display: flex;
    align-items: flex-start;
    gap: 0.65rem;
    background: #fff;
    border-radius: 12px;
    padding: 0.8rem 0.9rem;
    box-shadow: 0 12px 32px rgba(20, 20, 30, 0.16);
    border-left: 4px solid var(--violet);
    opacity: 0;
    transform: translateY(-14px) scale(0.97);
    transition: opacity 0.28s ease, transform 0.28s cubic-bezier(0.22, 1, 0.36, 1);
}
.toast.is-in { opacity: 1; transform: translateY(0) scale(1); }
.toast.is-out { opacity: 0; transform: translateY(-8px) scale(0.98); }
.toast-success { border-left-color: #1a9c63; }
.toast-error { border-left-color: var(--danger); }
.toast-icon { flex-shrink: 0; margin-top: 0.05rem; color: #1a9c63; }
.toast-error .toast-icon { color: var(--danger); }
.toast-icon .icon-svg { width: 19px; height: 19px; }
.toast-msg { flex: 1; font-size: 0.87rem; color: var(--ink); line-height: 1.4; padding-top: 0.05rem; }
.toast-close {
    background: none; border: none; cursor: pointer; color: #bbb; font-size: 1.1rem;
    line-height: 1; padding: 0; flex-shrink: 0;
}
.toast-close:hover { color: #888; }

/* ---------- Confirm modal (replaces window.confirm) ---------- */

.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(24, 16, 48, 0.45);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 300;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
    padding: 1rem;
}
.modal-overlay.is-open { opacity: 1; pointer-events: auto; }
body.modal-lock { overflow: hidden; }

.modal-box {
    background: #fff;
    border-radius: 16px;
    padding: 1.5rem;
    max-width: 380px;
    width: 100%;
    box-shadow: 0 24px 60px rgba(20, 10, 50, 0.3);
    transform: scale(0.94) translateY(8px);
    transition: transform 0.22s cubic-bezier(0.22, 1, 0.36, 1);
}
.modal-overlay.is-open .modal-box { transform: scale(1) translateY(0); }
.modal-box h3 { margin: 0 0 0.6rem; font-size: 1.05rem; }
.modal-box p { margin: 0; color: var(--muted); font-size: 0.9rem; line-height: 1.5; }
.modal-actions { display: flex; justify-content: flex-end; gap: 0.6rem; margin-top: 1.4rem; }

.qr-modal-box {
    max-width: 460px;
    padding: 0;
    background: transparent;
    box-shadow: none;
    position: relative;
}
.qr-modal-frame {
    width: 100%;
    height: min(80vh, 640px);
    border: none;
    border-radius: 16px;
    background: #fff;
    box-shadow: 0 24px 60px rgba(20, 10, 50, 0.35);
    display: block;
}
.qr-modal-close {
    position: absolute;
    top: -14px;
    right: -14px;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: #fff;
    border: none;
    box-shadow: 0 4px 12px rgba(0,0,0,0.25);
    font-size: 1.2rem;
    line-height: 1;
    color: #444;
    cursor: pointer;
    z-index: 1;
}
.qr-modal-close:hover { background: #f4f4f6; }

/* ---------- Buttons: hover lift + loading spinner ---------- */

.btn {
    transition: background 0.15s ease, transform 0.12s ease, box-shadow 0.15s ease;
}
.btn:hover:not(:disabled) { transform: translateY(-1px); box-shadow: 0 4px 10px rgba(30, 20, 70, 0.18); }
.btn:active:not(:disabled) { transform: translateY(0); }
.btn:disabled { opacity: 0.75; cursor: default; }
.btn.is-loading { display: inline-flex; align-items: center; gap: 0.5rem; }
.btn-spinner {
    width: 13px;
    height: 13px;
    border: 2px solid rgba(255,255,255,0.4);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
    flex-shrink: 0;
}

/* ---------- Rows / cards: hover + focus polish ---------- */

.list-row, .table-wrap tbody tr, .side-card, .card {
    transition: box-shadow 0.18s ease, transform 0.18s ease;
}
.list-row:hover { box-shadow: 0 8px 20px rgba(30, 20, 70, 0.1); transform: translateY(-1px); }
.table-wrap tbody tr:hover { background: #f7f6fd; }

.form-group input, .form-group select, .form-group textarea {
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.form-group input:focus, .form-group select:focus, .form-group textarea:focus {
    outline: none;
    border-color: var(--violet);
    box-shadow: 0 0 0 3px rgba(109, 76, 224, 0.15);
}
.form-group input:disabled { background: #f4f4f6; color: #999; }

.hint-text { font-size: 0.82rem; color: var(--muted); margin-top: 0.35rem; }
.hint-text strong { color: var(--violet-dark); }

.icon-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    color: #666;
    background: #f4f6f8;
    transition: background 0.15s ease, color 0.15s ease, transform 0.15s ease;
}
.icon-btn .icon-svg { width: 16px; height: 16px; }
.icon-btn:hover { background: #ece7fb; color: var(--violet-dark); transform: translateY(-1px); text-decoration: none; }
.icon-btn.is-static { color: #bbb; cursor: default; }
.icon-btn.is-static:hover { background: #f4f6f8; color: #bbb; transform: none; }

.payout-amount { text-align: right; flex-shrink: 0; }
.payout-amount-value { font-size: 1.05rem; font-weight: 700; color: var(--ink); }
.payout-amount-label { font-size: 0.72rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.03em; }

.empty-state { display: flex; flex-direction: column; align-items: center; }
.empty-state .icon-svg { width: 26px; height: 26px; }

/* ---------- Login page ---------- */
.login-page { min-height: 100vh; display: flex; }

.login-branding {
    flex: 1;
    max-width: 460px;
    background: linear-gradient(160deg, var(--violet) 0%, var(--violet-dark) 100%);
    position: relative;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 3rem;
}
.login-blob { position: absolute; border-radius: 50%; background: rgba(255,255,255,0.08); }
.login-blob-1 { width: 320px; height: 320px; top: -110px; left: -90px; }
.login-blob-2 { width: 240px; height: 240px; bottom: -80px; right: -60px; background: rgba(255,255,255,0.06); }
.login-branding-content { position: relative; z-index: 1; color: #fff; text-align: center; max-width: 320px; }
.login-brand-mark {
    width: 62px;
    height: 62px;
    border-radius: 18px;
    background: rgba(255,255,255,0.16);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 1.5rem;
}
.login-brand-mark .icon-svg { width: 30px; height: 30px; }
.login-branding-content h1 { font-size: 1.65rem; margin: 0 0 0.75rem; }
.login-branding-content p { font-size: 0.94rem; opacity: 0.85; line-height: 1.6; margin: 0; }

.login-form-panel {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    background: #fff;
}
.login-form-card { width: 100%; max-width: 360px; }
.login-form-card h2 { margin: 0 0 0.35rem; font-size: 1.5rem; }
.login-form-sub { color: var(--muted); margin: 0 0 1.5rem; font-size: 0.92rem; }

.input-icon-group { position: relative; }
.input-icon-group input { padding-left: 2.5rem; }
.input-icon {
    position: absolute;
    left: 0.8rem;
    top: 50%;
    transform: translateY(-50%);
    color: #999;
    display: flex;
    pointer-events: none;
}
.input-icon .icon-svg { width: 17px; height: 17px; }
.password-toggle {
    position: absolute;
    right: 0.5rem;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    cursor: pointer;
    color: #999;
    display: flex;
    padding: 0.3rem;
}
.password-toggle:hover { color: #666; }
.password-toggle .icon-svg { width: 17px; height: 17px; }
.login-submit { width: 100%; justify-content: center; margin-top: 0.4rem; }

@media (max-width: 760px) {
    .login-page { flex-direction: column; }
    .login-branding { max-width: none; flex: none; padding: 2.25rem 1.5rem; }
    .login-form-panel { flex: 1; }
}
