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

:root {
    --primary: #2563eb;
    --primary-dark: #1d4ed8;
    --success: #16a34a;
    --danger: #dc2626;
    --warning: #f59e0b;
    --bg: #f1f5f9;
    --card-bg: #ffffff;
    --text: #1e293b;
    --text-secondary: #64748b;
    --border: #e2e8f0;
    --radius: 12px;
    --shadow: 0 1px 3px rgba(0, 0, 0, 0.1), 0 1px 2px rgba(0, 0, 0, 0.06);
}

html {
    font-size: 16px;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.5;
    -webkit-tap-highlight-color: transparent;
    -webkit-font-smoothing: antialiased;
}

.page {
    max-width: 480px;
    margin: 0 auto;
    min-height: 100vh;
}

/* ====== Auth ====== */
.auth-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 24px;
}

.app-title {
    font-size: 1.75rem;
    margin-bottom: 24px;
    color: var(--primary);
}

.auth-card {
    background: var(--card-bg);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 24px;
    width: 100%;
}

.role-selector {
    display: flex;
    gap: 8px;
    margin-bottom: 20px;
}

.role-btn {
    flex: 1;
    padding: 10px;
    border: 2px solid var(--border);
    border-radius: 8px;
    background: none;
    font-size: 0.95rem;
    cursor: pointer;
    transition: all 0.2s;
}

.role-btn.active {
    border-color: var(--primary);
    background: #eff6ff;
    color: var(--primary);
    font-weight: 600;
}

.auth-tabs {
    display: flex;
    margin-bottom: 20px;
    border-bottom: 2px solid var(--border);
}

.auth-tab {
    flex: 1;
    padding: 10px;
    border: none;
    background: none;
    font-size: 1rem;
    color: var(--text-secondary);
    cursor: pointer;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
}

.auth-tab.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
    font-weight: 600;
}

.auth-form {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.form-group label {
    font-size: 0.875rem;
    color: var(--text-secondary);
    font-weight: 500;
}

.form-group input,
.form-group textarea,
.form-group select {
    padding: 10px 14px;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 1rem;
    outline: none;
    font-family: inherit;
}

.form-group input:focus,
.form-group textarea:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.form-group textarea {
    resize: vertical;
    min-height: 60px;
}

/* ====== Buttons ====== */
.btn {
    padding: 10px 20px;
    border: none;
    border-radius: 8px;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    min-height: 44px;
}

.btn-primary {
    background: var(--primary);
    color: #fff;
}

.btn-primary:active {
    background: var(--primary-dark);
    transform: scale(0.98);
}

.btn-block {
    width: 100%;
}

.btn-outline {
    background: none;
    border: 1px solid var(--border);
    color: var(--text-secondary);
}

.btn-outline:active {
    background: var(--bg);
}

.btn-sm {
    min-height: 36px;
    padding: 6px 14px;
    font-size: 0.85rem;
}

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

.btn-row {
    display: flex;
    gap: 8px;
    margin-top: 12px;
}

/* ====== Check-in ====== */
#member-page {
    background: linear-gradient(180deg, #eef2ff 0%, #f1f5f9 40%, #f8fafc 100%);
}

.checkin-page {
    padding: 16px 16px 100px;
    display: flex;
    flex-direction: column;
    align-items: center;
}

#checkin-idle,
#checkin-active {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
}

.gps-status {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 6px;
    font-size: 0.8rem;
    color: var(--text-secondary);
    background: var(--card-bg);
    padding: 8px 16px;
    border-radius: 20px;
    box-shadow: var(--shadow);
}

.gps-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--warning);
    animation: gpsPulse 1.5s infinite;
}

.gps-dot.ready {
    background: var(--success);
    animation: none;
}

@keyframes gpsPulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.3; transform: scale(1.5); }
}

.gps-coords {
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin-bottom: 32px;
    text-align: center;
}

.btn-checkin {
    width: 176px;
    height: 176px;
    border-radius: 50%;
    border: none;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    cursor: pointer;
    font-weight: 700;
    transition: all 0.2s;
    position: relative;
    user-select: none;
    -webkit-user-select: none;
    -webkit-tap-highlight-color: transparent;
    outline: none;
}

.btn-checkin::after {
    content: "";
    position: absolute;
    inset: -8px;
    border-radius: 50%;
    z-index: -1;
}

.btn-checkin:disabled {
    opacity: 0.35;
    cursor: not-allowed;
    animation: none;
}

.btn-checkin:disabled::after {
    animation: none;
}

.btn-checkin-start {
    background: linear-gradient(135deg, #22c55e, #16a34a);
    color: #fff;
    box-shadow: 0 6px 28px rgba(22, 163, 74, 0.35);
    animation: breathe 2.4s ease-in-out infinite;
}

.btn-checkin-start::after {
    animation: glowRing 2.4s ease-in-out infinite;
}

.btn-checkin-start:active:not(:disabled) {
    transform: scale(0.92);
    box-shadow: 0 2px 8px rgba(22, 163, 74, 0.3);
    transition: transform 0.1s;
}

@keyframes breathe {
    0%, 100% { box-shadow: 0 6px 28px rgba(22, 163, 74, 0.35); }
    50% { box-shadow: 0 6px 44px rgba(22, 163, 74, 0.55), 0 0 0 14px rgba(22, 163, 74, 0.06); }
}

@keyframes glowRing {
    0%, 100% { background: rgba(22, 163, 74, 0.06); transform: scale(1); }
    50% { background: rgba(22, 163, 74, 0.14); transform: scale(1.06); }
}

.btn-checkin-end {
    background: linear-gradient(135deg, #ef4444, #dc2626);
    color: #fff;
    box-shadow: 0 6px 28px rgba(220, 38, 38, 0.3);
    animation: breatheRed 2s ease-in-out infinite;
}

.btn-checkin-end::after {
    animation: glowRingRed 2s ease-in-out infinite;
}

.btn-checkin-end:active {
    transform: scale(0.92);
    transition: transform 0.1s;
}

@keyframes breatheRed {
    0%, 100% { box-shadow: 0 6px 28px rgba(220, 38, 38, 0.3); }
    50% { box-shadow: 0 6px 40px rgba(220, 38, 38, 0.5), 0 0 0 12px rgba(220, 38, 38, 0.05); }
}

@keyframes glowRingRed {
    0%, 100% { background: rgba(220, 38, 38, 0.04); transform: scale(1); }
    50% { background: rgba(220, 38, 38, 0.12); transform: scale(1.06); }
}

.btn-icon {
    font-size: 2rem;
    line-height: 1;
}

.btn-checkin-label {
    font-size: 1rem;
}

.btn-checkin-sub {
    font-size: 0.7rem;
    opacity: 0.8;
}

/* ====== Motivational text ====== */
.motivation-wrap {
    margin-top: 20px;
    min-height: 24px;
    text-align: center;
}

.motivation-text {
    font-size: 0.82rem;
    color: var(--text-secondary);
    display: inline-block;
    padding: 6px 16px;
    background: var(--card-bg);
    border-radius: 16px;
    box-shadow: var(--shadow);
    animation: fadeUp 3.5s ease;
}

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

/* ====== Active checkin state ====== */
.active-card {
    background: var(--card-bg);
    border-radius: 20px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.08);
    padding: 28px 32px;
    text-align: center;
    margin-bottom: 24px;
    max-width: 320px;
    position: relative;
    overflow: hidden;
}

.active-card::before {
    content: "";
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 3px;
    background: linear-gradient(90deg, #22c55e, #16a34a, #15803d, #16a34a, #22c55e);
    background-size: 200% 100%;
    animation: shimmer 2s linear infinite;
}

@keyframes shimmer {
    from { background-position: 200% 0; }
    to { background-position: -200% 0; }
}

.active-label {
    font-size: 0.8rem;
    color: var(--success);
    font-weight: 600;
    margin-bottom: 4px;
    letter-spacing: 1px;
}

.active-time {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.active-duration {
    font-size: 2.6rem;
    font-weight: 800;
    background: linear-gradient(135deg, #2563eb, #7c3aed);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    font-variant-numeric: tabular-nums;
    letter-spacing: 1px;
}

.active-motivation {
    font-size: 0.78rem;
    color: var(--text-secondary);
    margin-top: 8px;
    font-style: italic;
}

/* ====== Rotating timer ring ====== */
.timer-ring-wrap {
    position: relative;
    width: 90px;
    height: 90px;
    margin: 0 auto 16px;
}

.timer-ring-svg {
    transform: rotate(-90deg);
    width: 90px;
    height: 90px;
}

.timer-ring-bg {
    fill: none;
    stroke: #e5e7eb;
    stroke-width: 5;
}

.timer-ring-fg {
    fill: none;
    stroke: #22c55e;
    stroke-width: 5;
    stroke-linecap: round;
    transition: stroke-dashoffset 1s linear;
}

.timer-ring-icon {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 1.6rem;
    animation: bounceIcon 0.6s ease-in-out infinite alternate;
}

@keyframes bounceIcon {
    from { transform: translate(-50%, -50%) translateY(-2px); }
    to { transform: translate(-50%, -50%) translateY(2px); }
}

/* Toast */
.toast {
    position: fixed;
    top: 24px;
    left: 50%;
    transform: translateX(-50%);
    padding: 14px 22px;
    border-radius: var(--radius);
    color: #fff;
    font-weight: 600;
    z-index: 1000;
    display: none;
    max-width: 90vw;
    text-align: center;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
}

.toast.success {
    background: linear-gradient(135deg, #22c55e, #16a34a);
}

.toast.error {
    background: linear-gradient(135deg, #ef4444, #dc2626);
}

.toast.show {
    display: block;
    animation: slideDown 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateX(-50%) translateY(-16px) scale(0.9);
    }
    to {
        opacity: 1;
        transform: translateX(-50%) translateY(0) scale(1);
    }
}

/* Result overlay */
.result-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 999;
    backdrop-filter: blur(2px);
}

.result-card {
    background: var(--card-bg);
    border-radius: 20px;
    padding: 32px 24px;
    text-align: center;
    margin: 24px;
    max-width: 320px;
    width: 100%;
    box-shadow: 0 20px 48px rgba(0, 0, 0, 0.15);
    animation: popIn 0.35s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes popIn {
    from { opacity: 0; transform: scale(0.85); }
    to { opacity: 1; transform: scale(1); }
}

.result-icon {
    font-size: 3.5rem;
    margin-bottom: 8px;
    animation: bounceResult 0.6s ease-in-out 0.2s both;
}

@keyframes bounceResult {
    0% { transform: scale(0); }
    50% { transform: scale(1.2); }
    100% { transform: scale(1); }
}

.result-title {
    font-size: 1.3rem;
    font-weight: 800;
    margin-bottom: 8px;
}

.result-title.success {
    color: var(--success);
}

.result-title.fail {
    color: var(--danger);
}

.result-detail {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-bottom: 18px;
    line-height: 1.6;
}

/* Confetti burst container */
.confetti-container {
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    pointer-events: none;
    z-index: 1001;
}

.confetti-piece {
    position: absolute;
    font-size: 1.4rem;
    animation: confettiFall 1.2s ease-out forwards;
}

@keyframes confettiFall {
    0% { opacity: 1; transform: translateY(0) rotate(0deg) scale(1); }
    100% { opacity: 0; transform: translateY(240px) rotate(720deg) scale(0.3); }
}

/* ====== Member Home ====== */
.home-page {
    padding: 12px 16px 80px;
}

.user-card {
    background: linear-gradient(135deg, #4f46e5 0%, #7c3aed 40%, #a855f7 100%);
    border-radius: 16px;
    padding: 20px;
    color: #fff;
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 16px;
    margin-top: 8px;
    box-shadow: 0 4px 20px rgba(124, 58, 237, 0.25);
}

.user-avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.22);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    font-weight: 700;
    backdrop-filter: blur(4px);
}

.user-name {
    font-size: 1.15rem;
    font-weight: 700;
}

.user-id {
    font-size: 0.78rem;
    opacity: 0.8;
}

.stats-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-bottom: 20px;
}

.stat-card {
    background: var(--card-bg);
    border-radius: 14px;
    padding: 16px 12px;
    text-align: center;
    box-shadow: var(--shadow);
    transition: transform 0.15s;
}

.stat-card:active {
    transform: scale(0.97);
}

.stat-card .stat-icon {
    font-size: 1.3rem;
    margin-bottom: 2px;
}

.stat-value {
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--primary);
}

.stat-label {
    font-size: 0.68rem;
    color: var(--text-secondary);
    margin-top: 2px;
}

.section {
    margin-bottom: 20px;
}

.section-title {
    font-size: 0.95rem;
    margin-bottom: 10px;
}

.record-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.record-item {
    background: var(--card-bg);
    border-radius: 8px;
    padding: 10px 14px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: var(--shadow);
}

.record-date {
    font-size: 0.85rem;
}

.record-duration {
    font-size: 0.7rem;
    color: var(--text-secondary);
}

.record-status {
    font-size: 0.7rem;
    padding: 3px 8px;
    border-radius: 10px;
    font-weight: 600;
}

.record-status.success {
    background: #dcfce7;
    color: var(--success);
}

.record-status.fail {
    background: #fef2f2;
    color: var(--danger);
}

.record-status.checking {
    background: #fef9c3;
    color: #ca8a04;
}

.record-status.manual {
    background: #ede9fe;
    color: #7c3aed;
}

.empty-state {
    text-align: center;
    color: var(--text-secondary);
    padding: 28px 0;
    font-size: 0.85rem;
}

/* ====== Carousel ====== */
.carousel {
    position: relative;
    overflow: hidden;
    border-radius: 16px;
    margin-bottom: 20px;
    background: #000;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    display: none;
    width: 100%;
    max-width: 400px;
}

.carousel.has-items {
    display: block;
}

.carousel-track {
    display: flex;
    transition: transform 0.5s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.carousel-slide {
    min-width: 100%;
    position: relative;
    height: 200px;
    display: flex;
    align-items: flex-end;
}

.carousel-slide img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.carousel-slide .slide-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 40px 18px 16px;
    background: linear-gradient(transparent, rgba(0, 0, 0, 0.75));
    color: #fff;
    z-index: 1;
}

.carousel-slide .slide-tag {
    display: inline-block;
    background: rgba(255, 255, 255, 0.25);
    backdrop-filter: blur(4px);
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 0.65rem;
    font-weight: 600;
    letter-spacing: 0.5px;
    margin-bottom: 6px;
}

.carousel-slide .slide-title {
    font-size: 1.1rem;
    font-weight: 700;
    line-height: 1.3;
    margin-bottom: 2px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.carousel-slide .slide-desc {
    font-size: 0.75rem;
    opacity: 0.85;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* carousel no-image variant */
.carousel-slide.no-img {
    background: linear-gradient(135deg, #1e3a5f, #2563eb, #7c3aed);
    height: 160px;
}

.carousel-slide.no-img .slide-overlay {
    position: static;
    padding: 24px 18px;
    background: none;
}

/* carousel footer bar */
.carousel-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 16px 12px;
    background: var(--card-bg);
}

.carousel-dots {
    display: flex;
    gap: 5px;
}

.carousel-dot {
    width: 6px;
    height: 6px;
    border-radius: 3px;
    background: #cbd5e1;
    cursor: pointer;
    transition: all 0.3s;
}

.carousel-dot.active {
    width: 20px;
    background: var(--primary);
}

.carousel-counter {
    font-size: 0.7rem;
    color: var(--text-secondary);
    font-weight: 500;
}

.carousel-arrows {
    display: flex;
    gap: 4px;
}

.carousel-arrow {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    border: none;
    background: var(--bg);
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 0.7rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.carousel-arrow:active {
    background: var(--primary);
    color: #fff;
}

/* ====== Leaderboard ====== */
.leaderboard-page {
    padding: 24px 16px 80px;
}

.week-header {
    text-align: center;
    margin-bottom: 16px;
}

.week-header h3 {
    font-size: 1.1rem;
}

.week-range {
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-top: 2px;
}

.leaderboard-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.lb-item {
    background: var(--card-bg);
    border-radius: 12px;
    padding: 12px 14px;
    display: flex;
    align-items: center;
    gap: 10px;
    box-shadow: var(--shadow);
    transition: transform 0.15s;
}

.lb-item.me {
    background: linear-gradient(135deg, #eff6ff, #eef2ff);
    border: 1.5px solid var(--primary);
    box-shadow: 0 2px 12px rgba(37, 99, 235, 0.12);
}

.lb-rank {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 0.85rem;
    flex-shrink: 0;
}

.lb-rank.top1 {
    background: linear-gradient(135deg, #fbbf24, #f59e0b);
    color: #fff;
    box-shadow: 0 2px 8px rgba(245, 158, 11, 0.4);
    font-size: 1rem;
}

.lb-rank.top2 {
    background: linear-gradient(135deg, #94a3b8, #64748b);
    color: #fff;
    box-shadow: 0 2px 8px rgba(100, 116, 139, 0.3);
}

.lb-rank.top3 {
    background: linear-gradient(135deg, #d97706, #b45309);
    color: #fff;
    box-shadow: 0 2px 8px rgba(180, 83, 9, 0.3);
}

.lb-rank.normal {
    background: var(--bg);
    color: var(--text-secondary);
}

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

.lb-name {
    font-weight: 600;
    font-size: 0.85rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.lb-id {
    font-size: 0.7rem;
    color: var(--text-secondary);
}

.lb-stats {
    text-align: right;
    flex-shrink: 0;
}

.lb-total {
    font-weight: 700;
    font-size: 0.85rem;
    color: var(--primary);
}

.lb-avg {
    font-size: 0.65rem;
    color: var(--text-secondary);
}

/* ====== Admin pages ====== */
.admin-page-inner {
    padding: 20px 16px 80px;
}

.admin-page-title {
    font-size: 1.2rem;
    margin-bottom: 16px;
}

.whitelist-add {
    display: flex;
    gap: 8px;
    margin-bottom: 10px;
}

.whitelist-add input {
    flex: 1;
}

.wl-list {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.wl-tag {
    background: #eff6ff;
    border: 1px solid var(--primary);
    border-radius: 14px;
    padding: 4px 12px;
    font-size: 0.8rem;
    display: flex;
    align-items: center;
    gap: 6px;
}

.wl-tag button {
    background: none;
    border: none;
    color: var(--danger);
    cursor: pointer;
    font-size: 1rem;
    line-height: 1;
    padding: 0;
}

.member-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.member-item {
    background: var(--card-bg);
    border-radius: 8px;
    padding: 10px 14px;
    box-shadow: var(--shadow);
    cursor: pointer;
}

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

.member-item-name {
    font-weight: 600;
    font-size: 0.9rem;
}

.member-item-stats {
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin-top: 4px;
}

.member-detail-panel {
    display: none;
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid var(--border);
}

/* Record table */
.filter-bar {
    margin-bottom: 10px;
}

.filter-bar select {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 0.9rem;
}

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

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

.record-table th,
.record-table td {
    padding: 8px 6px;
    text-align: left;
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}

.record-table th {
    background: var(--bg);
    font-weight: 600;
    position: sticky;
    top: 0;
}

.record-table .badge {
    padding: 2px 6px;
    border-radius: 8px;
    font-size: 0.65rem;
    font-weight: 600;
}

.record-table .badge.success {
    background: #dcfce7;
    color: var(--success);
}

.record-table .badge.fail {
    background: #fef2f2;
    color: var(--danger);
}

.record-table .badge.checking {
    background: #fef9c3;
    color: #ca8a04;
}

.record-table .badge.manual {
    background: #ede9fe;
    color: #7c3aed;
}

.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
    margin-top: 12px;
}

.pagination button {
    padding: 6px 14px;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--card-bg);
    cursor: pointer;
    font-size: 0.85rem;
}

.pagination button:disabled {
    opacity: 0.4;
}

.pagination span {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

/* Banner list */
.banner-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 12px;
}

.banner-item {
    background: var(--card-bg);
    border-radius: 8px;
    padding: 12px 14px;
    box-shadow: var(--shadow);
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
}

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

.banner-item-title {
    font-weight: 600;
    font-size: 0.9rem;
}

.banner-item-preview {
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin-top: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.banner-item-status {
    font-size: 0.7rem;
    padding: 3px 8px;
    border-radius: 10px;
}

.banner-item-status.on {
    background: #dcfce7;
    color: var(--success);
}

.banner-item-status.off {
    background: #f1f5f9;
    color: var(--text-secondary);
}

.banner-item-actions {
    display: flex;
    gap: 4px;
    flex-shrink: 0;
}

.banner-item-actions button {
    padding: 4px 8px;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--card-bg);
    cursor: pointer;
    font-size: 0.75rem;
}

/* Modal */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 999;
}

.modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.4);
}

.modal-card {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 20px;
    width: calc(100% - 40px);
    max-width: 400px;
    max-height: 80vh;
    overflow-y: auto;
}

.modal-card h3 {
    margin-bottom: 14px;
    font-size: 1.1rem;
}

.modal-card .form-group {
    margin-bottom: 10px;
}

.modal-card .btn-row {
    flex-direction: column;
}

/* ====== Manual checkin ====== */
.manual-entry {
    width: 100%;
    max-width: 300px;
    margin-top: 16px;
}

/* ====== Location management ====== */
.location-add {
    display: flex;
    gap: 4px;
    margin-bottom: 10px;
    flex-wrap: wrap;
}

.location-add input {
    padding: 8px 8px;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 0.8rem;
    min-width: 0;
}

.location-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.loc-item {
    background: var(--card-bg);
    border-radius: 8px;
    padding: 10px 14px;
    box-shadow: var(--shadow);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

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

.loc-item-name {
    font-weight: 600;
    font-size: 0.85rem;
}

.loc-item-detail {
    font-size: 0.7rem;
    color: var(--text-secondary);
}

.loc-item-status {
    font-size: 0.65rem;
    padding: 2px 8px;
    border-radius: 8px;
}

.loc-item-status.on {
    background: #dcfce7;
    color: var(--success);
}

.loc-item-status.off {
    background: #f1f5f9;
    color: var(--text-secondary);
}

.loc-item-actions {
    display: flex;
    gap: 4px;
}

.loc-item-actions button {
    padding: 3px 8px;
    border: 1px solid var(--border);
    border-radius: 4px;
    background: var(--card-bg);
    cursor: pointer;
    font-size: 0.7rem;
}

/* ====== Tab nav ====== */
.tab-nav {
    position: fixed;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 100%;
    max-width: 480px;
    background: var(--card-bg);
    border-top: 1px solid var(--border);
    display: flex;
    padding-bottom: env(safe-area-inset-bottom, 0);
}

.tab-btn {
    flex: 1;
    padding: 8px 0;
    border: none;
    background: none;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    cursor: pointer;
    color: var(--text-secondary);
    transition: color 0.2s;
}

.tab-btn.active {
    color: var(--primary);
}

.tab-icon {
    font-size: 1.2rem;
}

.tab-label {
    font-size: 0.65rem;
    font-weight: 500;
}

.error-msg {
    color: var(--danger);
    font-size: 0.8rem;
    text-align: center;
    padding: 4px 0;
}