/* ============================================================
   CVBC Check-In — Stylesheet
   Brand: Teal #4db8bc, Slate #5d6b7a, Near-black #1a1f24
   Font: Outfit
   ============================================================ */

:root {
    --teal:        #4db8bc;
    --teal-dark:   #3a9ea2;
    --teal-deeper: #2e8285;
    --teal-light:  #e8f7f7;
    --teal-mid:    #c2e9ea;
    --slate:       #5d6b7a;
    --slate-light: #f0f2f4;

    --bg:          #f7f8f9;
    --bg-card:     #ffffff;
    --bg-input:    #ffffff;
    --bg-hover:    #f0f4f4;
    --bg-header:   #ffffff;
    --border:      #e2e7ea;
    --border-focus:var(--teal);
    --text-primary:#1a1f24;
    --text-secondary:#5d6b7a;
    --text-muted:  #9aaab4;

    --accent:      var(--teal);
    --accent-dark: var(--teal-dark);
    --accent-light:var(--teal-light);

    --danger:      #d94f4f;
    --danger-light:#fdf0f0;
    --warning:     #d08a0a;
    --warning-light:#fdf6e3;
    --success:     #2e9e6b;
    --success-light:#e8f7f0;

    --shadow-sm:   0 1px 3px rgba(0,0,0,.06), 0 1px 2px rgba(0,0,0,.04);
    --shadow-md:   0 4px 16px rgba(0,0,0,.08);
    --shadow-lg:   0 20px 48px rgba(0,0,0,.12), 0 8px 16px rgba(0,0,0,.06);

    --radius-sm:   8px;
    --radius-md:   12px;
    --radius-lg:   16px;
    --radius-xl:   24px;
    --transition:  all .17s cubic-bezier(.4,0,.2,1);
}

[data-theme="dark"] {
    --bg:          #0f1316;
    --bg-card:     #181d21;
    --bg-input:    #1e2429;
    --bg-hover:    #1e2429;
    --bg-header:   #141920;
    --border:      #252d34;
    --border-focus:#4db8bc;
    --text-primary:#e2e8ec;
    --text-secondary:#7d9099;
    --text-muted:  #445560;

    --teal-light:  #0d2f30;
    --teal-mid:    #153d3e;
    --slate-light: #1a2028;

    --accent-light:#0d2f30;

    --danger:      #e06060;
    --danger-light:#2a1515;
    --warning:     #e0a030;
    --warning-light:#2a2010;
    --success:     #3dba80;
    --success-light:#0d2820;

    --shadow-sm:   0 1px 3px rgba(0,0,0,.3);
    --shadow-md:   0 4px 16px rgba(0,0,0,.4);
    --shadow-lg:   0 20px 48px rgba(0,0,0,.5);
}

/* ── Reset ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
    font-family: 'Outfit', system-ui, sans-serif;
    background: var(--bg);
    color: var(--text-primary);
    min-height: 100vh;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    transition: background .25s ease, color .25s ease;
}

/* ── App Shell ── */
.app-shell { display: flex; flex-direction: column; min-height: 100vh; }

/* ── Header ── */
.site-header {
    background: var(--bg-header);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: var(--shadow-sm);
    transition: background .25s ease, border-color .25s ease;
}

.header-inner {
    max-width: 1140px;
    margin: 0 auto;
    padding: .75rem 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.brand { display: flex; align-items: center; gap: .85rem; }

.brand-logo {
    height: 44px;
    width: auto;
    display: block;
}
[data-theme="dark"] .brand-logo { filter: brightness(0) invert(1); }

.brand-text { display: flex; flex-direction: column; line-height: 1.15; }
.brand-name {
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -.01em;
}
.brand-sub {
    font-size: .7rem;
    color: var(--text-muted);
    font-weight: 400;
    letter-spacing: .03em;
}

.header-nav {
    display: flex;
    align-items: center;
    gap: .35rem;
}

.nav-btn {
    padding: .45rem .95rem;
    border-radius: var(--radius-sm);
    font-size: .83rem;
    font-weight: 500;
    color: var(--text-secondary);
    text-decoration: none;
    border: 1px solid transparent;
    transition: var(--transition);
    cursor: pointer;
    background: transparent;
    font-family: 'Outfit', sans-serif;
    white-space: nowrap;
}
.nav-btn:hover { background: var(--bg-hover); color: var(--text-primary); }
.nav-btn.active {
    background: var(--teal-light);
    color: var(--teal-dark);
    border-color: var(--teal-mid);
    font-weight: 600;
}

.user-chip {
    display: flex;
    align-items: center;
    gap: .5rem;
    padding: .35rem .75rem .35rem .45rem;
    border-radius: 50px;
    background: var(--bg-hover);
    border: 1px solid var(--border);
    font-size: .8rem;
    color: var(--text-secondary);
}
.user-avatar {
    width: 26px; height: 26px;
    border-radius: 50%;
    background: var(--teal);
    color: #fff;
    font-size: .72rem;
    font-weight: 700;
    display: flex; align-items: center; justify-content: center;
    text-transform: uppercase;
    flex-shrink: 0;
}

.theme-toggle {
    width: 36px; height: 36px;
    border-radius: 50%;
    border: 1px solid var(--border);
    background: var(--bg-card);
    cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    font-size: 1rem;
    transition: var(--transition);
    flex-shrink: 0;
}
.theme-toggle:hover { background: var(--bg-hover); transform: scale(1.08); }

/* ── Main ── */
.main-content {
    flex: 1;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding: 2.5rem 1.5rem;
}

.checkin-container { width: 100%; max-width: 560px; }

/* ── Service Info ── */
.service-info { text-align: center; margin-bottom: 2.25rem; }
.service-date {
    font-size: 1.65rem;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -.02em;
    margin-bottom: .2rem;
}
.service-time { font-size: .9rem; color: var(--text-muted); font-weight: 400; letter-spacing: .03em; }

/* ── Search ── */
.search-label {
    font-size: .72rem;
    font-weight: 700;
    letter-spacing: .1em;
    text-transform: uppercase;
    color: var(--text-muted);
    margin-bottom: .5rem;
}

.search-wrap { position: relative; display: flex; align-items: center; }

.search-icon {
    position: absolute;
    left: 1.1rem;
    font-size: 1.2rem;
    color: var(--text-muted);
    pointer-events: none;
    line-height: 1;
}

.search-input {
    width: 100%;
    padding: .95rem 3rem .95rem 3rem;
    font-size: 1.1rem;
    font-family: 'Outfit', sans-serif;
    font-weight: 400;
    background: var(--bg-card);
    border: 1.5px solid var(--border);
    border-radius: var(--radius-lg);
    color: var(--text-primary);
    outline: none;
    box-shadow: var(--shadow-md);
    transition: border-color .17s, box-shadow .17s;
}
.search-input::placeholder { color: var(--text-muted); }
.search-input:focus {
    border-color: var(--teal);
    box-shadow: 0 0 0 3px rgba(77,184,188,.15), var(--shadow-md);
}

.search-clear {
    position: absolute;
    right: 1rem;
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: .85rem;
    padding: .25rem;
    border-radius: 50%;
    width: 26px; height: 26px;
    display: flex; align-items: center; justify-content: center;
    transition: var(--transition);
}
.search-clear:hover { background: var(--bg-hover); color: var(--text-primary); }

/* ── Search Results ── */
.search-results {
    margin-top: .6rem;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    overflow: hidden;
    display: none;
}
.search-results.visible { display: block; }

.result-item {
    display: flex;
    align-items: center;
    gap: .9rem;
    padding: .85rem 1.1rem;
    cursor: pointer;
    border-bottom: 1px solid var(--border);
    transition: background .1s;
}
.result-item:last-child { border-bottom: none; }
.result-item:hover { background: var(--bg-hover); }
.result-item.checked-in { opacity: .6; }

.result-avatar {
    width: 40px; height: 40px;
    border-radius: 50%;
    background: var(--teal-light);
    color: var(--teal-dark);
    display: flex; align-items: center; justify-content: center;
    font-weight: 700;
    font-size: .88rem;
    flex-shrink: 0;
    text-transform: uppercase;
}
.result-avatar.female { background: #f5e8f5; color: #9b40a8; }
[data-theme="dark"] .result-avatar.female { background: #2a1530; color: #c070d0; }

.result-info { flex: 1; min-width: 0; }
.result-name {
    font-weight: 600;
    font-size: .95rem;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.result-detail {
    font-size: .78rem;
    color: var(--text-secondary);
    margin-top: .1rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.result-badge {
    padding: .22rem .65rem;
    border-radius: 20px;
    font-size: .72rem;
    font-weight: 600;
    flex-shrink: 0;
    white-space: nowrap;
}
.badge-checked { background: var(--success-light); color: var(--success); }
.badge-ready   { background: var(--teal-light);    color: var(--teal-dark); }

.result-empty, .result-loading {
    padding: 1.4rem 1.1rem;
    text-align: center;
    color: var(--text-muted);
    font-size: .88rem;
}

.add-new-row {
    display: flex;
    align-items: center;
    gap: .9rem;
    padding: .85rem 1.1rem;
    cursor: pointer;
    background: var(--teal-light);
    color: var(--teal-dark);
    font-weight: 600;
    font-size: .9rem;
    transition: background .1s;
}
.add-new-row:hover { background: var(--teal-mid); }
.add-new-icon {
    width: 40px; height: 40px;
    border-radius: 50%;
    background: var(--teal);
    color: #fff;
    display: flex; align-items: center; justify-content: center;
    font-size: 1.25rem;
    flex-shrink: 0;
    font-weight: 300;
}

/* ── Tribe pip ── */
.tribe-pip {
    display: inline-block;
    width: 8px; height: 8px;
    border-radius: 50%;
    margin-right: 4px;
    flex-shrink: 0;
    vertical-align: middle;
}

/* ── Modals ── */
.modal-overlay {
    position: fixed; inset: 0;
    background: rgba(0,0,0,.45);
    backdrop-filter: blur(3px);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    animation: fadeIn .18s ease;
}
@keyframes fadeIn { from { opacity:0 } to { opacity:1 } }

.modal {
    background: var(--bg-card);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-lg);
    width: 100%;
    max-width: 440px;
    padding: 1.75rem;
    animation: slideUp .2s cubic-bezier(.4,0,.2,1);
    max-height: 92vh;
    overflow-y: auto;
}
.modal-wide  { max-width: 640px; }
.modal-small { max-width: 340px; text-align: center; }
@keyframes slideUp { from { transform:translateY(20px); opacity:0 } to { transform:translateY(0); opacity:1 } }

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.4rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border);
}
.modal-title { font-size: 1.15rem; font-weight: 700; color: var(--text-primary); }
.modal-close {
    width: 30px; height: 30px;
    border-radius: 50%;
    border: 1px solid var(--border);
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    font-size: .85rem;
    display: flex; align-items: center; justify-content: center;
    transition: var(--transition);
}
.modal-close:hover { background: var(--bg-hover); color: var(--text-primary); }

/* ── Person Card ── */
.person-card {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 1.1rem;
    margin-bottom: 1.4rem;
}
.person-card-inner { display: flex; align-items: center; gap: .9rem; }
.person-avatar-lg {
    width: 52px; height: 52px;
    border-radius: 50%;
    background: var(--teal-light);
    color: var(--teal-dark);
    display: flex; align-items: center; justify-content: center;
    font-weight: 700;
    font-size: 1.1rem;
    flex-shrink: 0;
    text-transform: uppercase;
}
.person-avatar-lg.female { background: #f5e8f5; color: #9b40a8; }
[data-theme="dark"] .person-avatar-lg.female { background: #2a1530; color: #c070d0; }
.person-card-name { font-size: 1.15rem; font-weight: 700; color: var(--text-primary); }
.person-card-detail { font-size: .82rem; color: var(--text-secondary); margin-top: .15rem; }

/* ── Already checked in ── */
.already-icon {
    width: 60px; height: 60px;
    border-radius: 50%;
    background: var(--warning-light);
    color: var(--warning);
    font-size: 1.6rem;
    display: flex; align-items: center; justify-content: center;
    margin: 0 auto 1rem;
    border: 2px solid var(--warning);
}
.already-title { font-size: 1.3rem; font-weight: 700; color: var(--text-primary); margin-bottom: .4rem; }
.already-msg   { color: var(--text-secondary); font-size: .88rem; }

/* ── Forms ── */
.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: .9rem;
    margin-bottom: 1.4rem;
}
.field-full { grid-column: 1 / -1; }

.field-label {
    display: block;
    font-size: .75rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: .3rem;
    letter-spacing: .04em;
    text-transform: uppercase;
}
.req { color: var(--danger); margin-left: .1rem; }

.field-input {
    width: 100%;
    padding: .6rem .85rem;
    font-size: .9rem;
    font-family: 'Outfit', sans-serif;
    background: var(--bg-input);
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    outline: none;
    transition: border-color .15s, box-shadow .15s;
    appearance: auto;
}
.field-input:focus {
    border-color: var(--teal);
    box-shadow: 0 0 0 3px rgba(77,184,188,.12);
}
.field-input::placeholder { color: var(--text-muted); }

/* ── Buttons ── */
.modal-actions { display: flex; gap: .65rem; justify-content: flex-end; margin-top: 1.25rem; }

.btn {
    padding: .62rem 1.25rem;
    border-radius: var(--radius-sm);
    font-size: .875rem;
    font-weight: 600;
    font-family: 'Outfit', sans-serif;
    cursor: pointer;
    border: none;
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    gap: .4rem;
    white-space: nowrap;
    text-decoration: none;
}
.btn:disabled { opacity: .5; cursor: not-allowed; }

.btn-primary { background: var(--teal); color: #fff; }
.btn-primary:hover:not(:disabled) {
    background: var(--teal-dark);
    transform: translateY(-1px);
    box-shadow: 0 4px 14px rgba(77,184,188,.35);
}

.btn-secondary {
    background: var(--bg-hover);
    color: var(--text-secondary);
    border: 1px solid var(--border);
}
.btn-secondary:hover { background: var(--border); color: var(--text-primary); }

.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: #b83e3e; }

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

/* ── Toast ── */
.toast {
    position: fixed;
    bottom: 2rem;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: #1a1f24;
    color: #e2e8ec;
    padding: .75rem 1.35rem;
    border-radius: 50px;
    font-size: .875rem;
    font-weight: 500;
    box-shadow: var(--shadow-lg);
    z-index: 9999;
    transition: transform .28s cubic-bezier(.4,0,.2,1), opacity .28s;
    opacity: 0;
    white-space: nowrap;
    pointer-events: none;
    max-width: 90vw;
}
[data-theme="dark"] .toast { background: #e2e8ec; color: #1a1f24; }
.toast.show { transform: translateX(-50%) translateY(0); opacity: 1; }
.toast.success::before { content: '✓  '; color: #3dba80; }
.toast.error::before   { content: '✕  '; color: #e06060; }

/* ── Shared page layout ── */
.page-wrap { width: 100%; max-width: 1100px; margin: 0 auto; }
.page-header { margin-bottom: 1.75rem; }
.page-title {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -.02em;
    margin-bottom: .2rem;
}
.page-subtitle { color: var(--text-secondary); font-size: .875rem; }

.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    box-shadow: var(--shadow-sm);
    margin-bottom: 1.25rem;
}
.card-title {
    font-weight: 700;
    font-size: .95rem;
    color: var(--text-primary);
    margin-bottom: 1.1rem;
    display: flex;
    align-items: center;
    gap: .5rem;
}

/* ── Tables ── */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: .85rem; }
thead th {
    text-align: left;
    padding: .55rem .9rem;
    font-weight: 600;
    font-size: .72rem;
    letter-spacing: .07em;
    text-transform: uppercase;
    color: var(--text-muted);
    border-bottom: 2px solid var(--border);
    white-space: nowrap;
    background: var(--bg);
}
tbody tr { border-bottom: 1px solid var(--border); }
tbody tr:last-child { border-bottom: none; }
tbody tr:hover { background: var(--bg-hover); }
tbody td { padding: .72rem .9rem; color: var(--text-primary); vertical-align: middle; }

/* ── Badges ── */
.badge {
    display: inline-flex;
    align-items: center;
    padding: .22rem .6rem;
    border-radius: 20px;
    font-size: .72rem;
    font-weight: 600;
    white-space: nowrap;
}
.badge-teal   { background: var(--teal-light);    color: var(--teal-dark); }
.badge-green  { background: var(--success-light); color: var(--success); }
.badge-yellow { background: var(--warning-light); color: var(--warning); }
.badge-red    { background: var(--danger-light);  color: var(--danger);  }
.badge-grey   { background: var(--bg-hover);      color: var(--text-muted); }
.badge-slate  { background: var(--slate-light);   color: var(--slate); }

/* ── Stats ── */
.stats-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}
.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 1.1rem 1.25rem;
    text-align: center;
    box-shadow: var(--shadow-sm);
}
.stat-number {
    font-size: 2rem;
    font-weight: 700;
    color: var(--teal);
    line-height: 1;
    margin-bottom: .25rem;
    letter-spacing: -.03em;
}
.stat-label { font-size: .75rem; color: var(--text-muted); font-weight: 500; }

/* ── Tabs ── */
.tab-bar {
    display: flex;
    gap: .15rem;
    border-bottom: 2px solid var(--border);
    margin-bottom: 1.5rem;
    overflow-x: auto;
    scrollbar-width: none;
}
.tab-bar::-webkit-scrollbar { display: none; }
.tab-btn {
    padding: .6rem 1rem;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    font-family: 'Outfit', sans-serif;
    font-size: .83rem;
    font-weight: 500;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    transition: var(--transition);
    border-radius: var(--radius-sm) var(--radius-sm) 0 0;
    white-space: nowrap;
}
.tab-btn:hover { color: var(--text-primary); background: var(--bg-hover); }
.tab-btn.active { color: var(--teal-dark); border-bottom-color: var(--teal); font-weight: 600; }

.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* ── Input row ── */
.input-row {
    display: flex;
    gap: .65rem;
    align-items: flex-end;
    flex-wrap: wrap;
    margin-bottom: 1.25rem;
}

/* ── Upload zone ── */
.upload-zone {
    border: 2px dashed var(--border);
    border-radius: var(--radius-md);
    padding: 2.5rem 2rem;
    text-align: center;
    cursor: pointer;
    transition: var(--transition);
    color: var(--text-muted);
}
.upload-zone:hover, .upload-zone.drag-over {
    border-color: var(--teal);
    background: var(--teal-light);
    color: var(--teal-dark);
}
.upload-zone input { display: none; }

.import-result {
    margin-top: 1rem;
    padding: .85rem 1.1rem;
    border-radius: var(--radius-sm);
    font-size: .85rem;
    font-weight: 500;
    display: none;
    white-space: pre-wrap;
}
.import-result.ok  { background: var(--success-light); color: var(--success); }
.import-result.err { background: var(--danger-light);  color: var(--danger);  }

/* ── Empty state ── */
.empty-state {
    text-align: center;
    padding: 2.5rem;
    color: var(--text-muted);
    font-size: .88rem;
}
.empty-state-icon { font-size: 2rem; margin-bottom: .5rem; }

/* ── Action buttons (tables) ── */
.action-btn {
    padding: .28rem .65rem;
    border-radius: 6px;
    border: 1px solid var(--border);
    background: var(--bg);
    color: var(--text-secondary);
    font-size: .75rem;
    font-weight: 500;
    font-family: 'Outfit', sans-serif;
    cursor: pointer;
    transition: var(--transition);
}
.action-btn:hover { background: var(--bg-hover); color: var(--text-primary); }
.action-btn.primary { background: var(--teal-light); color: var(--teal-dark); border-color: var(--teal-mid); }
.action-btn.primary:hover { background: var(--teal-mid); }
.action-btn.danger { background: var(--danger-light); color: var(--danger); border-color: var(--danger-light); }

/* ── History rows ── */
.history-date-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: .8rem 1rem;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    margin-bottom: .4rem;
    cursor: pointer;
    transition: var(--transition);
    font-weight: 600;
    font-size: .875rem;
}
.history-date-row:hover { background: var(--bg-hover); }
.history-date-count {
    background: var(--teal-light);
    color: var(--teal-dark);
    border-radius: 20px;
    padding: .18rem .6rem;
    font-size: .72rem;
    font-weight: 700;
}

/* ── Link results ── */
.link-result-item {
    display: flex;
    align-items: center;
    gap: .75rem;
    padding: .7rem 1rem;
    cursor: pointer;
    border-bottom: 1px solid var(--border);
    transition: background .1s;
    font-size: .875rem;
}
.link-result-item:last-child { border-bottom: none; }
.link-result-item:hover { background: var(--bg-hover); }

/* ── Tribe color swatch ── */
.tribe-swatch {
    width: 18px; height: 18px;
    border-radius: 4px;
    display: inline-block;
    flex-shrink: 0;
    border: 1px solid rgba(0,0,0,.1);
    vertical-align: middle;
}

/* ── Responsive ── */
@media (max-width: 640px) {
    .brand-sub, .brand-text { display: none; }
    .main-content { padding: 1.5rem 1rem; }
    .service-date { font-size: 1.3rem; }
    .form-grid { grid-template-columns: 1fr; }
    .field-full { grid-column: 1; }
    .modal { padding: 1.25rem; }
    .stats-row { grid-template-columns: 1fr 1fr; }
    .header-inner { padding: .65rem 1rem; }
}
