:root {
    --ink: #17202a;
    --muted: #6b7280;
    --brand: #6548e8;
    --brand-dark: #5235d0;
    --soft: #f4f2ff;
    --surface: #fff;
    --line: #e7e9ef;
    --sidebar: #181a25;
}

* {
    box-sizing: border-box;
}

body {
    color: var(--ink);
    font-family: Inter, system-ui, -apple-system, "Segoe UI", sans-serif;
}

/* Public pages */
.public-bg {
    background: radial-gradient(circle at 15% 10%, #e8e2ff 0, transparent 32%), radial-gradient(circle at 90% 80%, #dff9f0 0, transparent 28%), #f8f9fc;
}

.hero-card,
.result-card,
.claim-card {
    background: rgba(255, 255, 255, .93);
    box-shadow: 0 24px 70px rgba(26, 31, 55, .12);
    border: 1px solid rgba(255, 255, 255, .7);
    border-radius: 28px;
}

.hero-card {
    max-width: 850px;
    padding: clamp(2rem, 6vw, 5rem);
}

.hero-card .lead {
    max-width: 660px;
}

.brand-mark {
    width: 72px;
    height: 72px;
    border-radius: 22px;
    display: grid;
    place-items: center;
    background: linear-gradient(135deg, var(--brand), #9e8cff);
    color: #fff;
    font-weight: 800;
    font-size: 1.4rem;
    box-shadow: 0 14px 35px rgba(109, 74, 255, .3);
}

.eyebrow {
    text-transform: uppercase;
    letter-spacing: .14em;
    font-size: .7rem;
    font-weight: 800;
    color: var(--brand);
}

.result-card {
    max-width: 600px;
    padding: clamp(2rem, 6vw, 4.5rem);
    border-top-width: 5px !important;
}

.result-icon {
    width: 86px;
    height: 86px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    margin: auto;
    font-weight: 800;
    font-size: 2.5rem;
}

.claim-card {
    max-width: 680px;
    padding: clamp(1.5rem, 5vw, 3.5rem);
}

.claim-reference {
    max-width: 360px;
    margin: 1.25rem auto 0;
    padding: 1rem;
    border: 2px dashed #b8acef;
    border-radius: 14px;
    background: #f7f5ff;
}

.claim-reference span,
.claim-reference strong {
    display: block;
}

.claim-reference span {
    color: var(--muted);
    font-size: .72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .08em;
}

.claim-reference strong {
    color: var(--brand-dark);
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    font-size: clamp(1.35rem, 5vw, 1.8rem);
    letter-spacing: .08em;
    margin-top: .3rem;
}

/* Shared controls */
.form-control {
    border-radius: 10px;
    padding: .65rem .85rem;
    border-color: #d9dce4;
}

.form-control:focus {
    border-color: var(--brand);
    box-shadow: 0 0 0 .2rem rgba(109, 74, 255, .12);
}

.form-label {
    color: #3e4552;
    font-size: .82rem;
    font-weight: 700;
    margin-bottom: .38rem;
}

.btn {
    border-radius: 9px;
    font-weight: 700;
    padding: .62rem .9rem;
}

.btn-sm {
    border-radius: 8px;
    padding: .36rem .62rem;
}

.btn-primary {
    background: var(--brand);
    border-color: var(--brand);
}

.btn-primary:hover,
.btn-primary:focus {
    background: var(--brand-dark);
    border-color: var(--brand-dark);
}

/* Admin shell */
.admin-body {
    background: #f4f5f8;
}

.admin-sidebar {
    width: 224px;
    min-height: 100vh;
    background: var(--sidebar);
    color: #fff;
    position: fixed;
    inset: 0 auto 0 0;
    padding: 1.15rem;
    display: flex;
    flex-direction: column;
    z-index: 1030;
}

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

.admin-brand {
    color: #fff;
    text-decoration: none;
    font-weight: 800;
    display: flex;
    align-items: center;
    gap: .65rem;
    letter-spacing: -.01em;
}

.admin-brand-mark {
    width: 34px;
    height: 34px;
    display: grid;
    place-items: center;
    border-radius: 10px;
    background: linear-gradient(135deg, var(--brand), #927dff);
    font-size: .72rem;
    box-shadow: 0 7px 18px rgba(101, 72, 232, .35);
}

.sidebar-toggle {
    display: none;
    color: #fff;
    background: #2b2e3d;
    border: 1px solid #383c4e;
    border-radius: 8px;
    padding: .38rem .58rem;
    font-size: .75rem;
    font-weight: 700;
}

.admin-nav {
    margin-top: 1.5rem;
    gap: .25rem;
}

.admin-sidebar .nav-link {
    display: flex;
    align-items: center;
    gap: .65rem;
    color: #aeb3c2;
    border-radius: 9px;
    padding: .64rem .72rem;
    font-size: .88rem;
    font-weight: 650;
    transition: background .15s ease, color .15s ease;
}

.admin-sidebar .nav-link:hover,
.admin-sidebar .nav-link.active {
    color: #fff;
    background: #292d3e;
}

.nav-indicator {
    width: 6px;
    height: 6px;
    flex: 0 0 auto;
    border-radius: 50%;
    background: #555b70;
}

.nav-link.active .nav-indicator {
    background: #a996ff;
    box-shadow: 0 0 0 4px rgba(169, 150, 255, .12);
}

.sidebar-account {
    margin-top: auto;
    padding-top: 1rem;
    border-top: 1px solid #303342;
}

.admin-main {
    margin-left: 224px;
    min-height: 100vh;
    background: #f4f5f8;
    padding: 1.5rem clamp(1.25rem, 3vw, 2.5rem) 2.5rem;
}

.page-heading {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.25rem;
}

.page-heading h1 {
    font-size: clamp(1.45rem, 2vw, 1.8rem);
    font-weight: 800;
    letter-spacing: -.035em;
    margin: .15rem 0 0;
}

/* Admin content */
.stat-card,
.table-card {
    background: var(--surface);
    border: 1px solid rgba(226, 228, 235, .8);
    border-radius: 14px;
    box-shadow: 0 5px 18px rgba(27, 34, 55, .045);
}

.stat-value {
    font-size: 1.75rem;
    line-height: 1;
    font-weight: 800;
    letter-spacing: -.04em;
}

.compact-card {
    padding: 1.15rem;
}

.section-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: .9rem;
}

.section-heading h2 {
    font-size: 1rem;
    font-weight: 800;
    letter-spacing: -.015em;
    margin: .1rem 0 0;
}

.section-kicker,
.detail-label {
    display: block;
    color: var(--muted);
    font-size: .63rem;
    font-weight: 800;
    letter-spacing: .11em;
    text-transform: uppercase;
}

.heading-count,
.button-count {
    display: inline-grid;
    place-items: center;
    min-width: 22px;
    height: 22px;
    padding: 0 .35rem;
    margin-left: .25rem;
    border-radius: 20px;
    background: #f0eefc;
    color: var(--brand);
    font-size: .72rem;
    vertical-align: middle;
}

.button-count {
    height: 19px;
    min-width: 19px;
    color: #17643c;
    background: rgba(255, 255, 255, .65);
}

.empty-state {
    padding: 1.5rem;
    border: 1px dashed #d9dce5;
    border-radius: 10px;
    color: var(--muted);
    text-align: center;
    font-size: .86rem;
    background: #fafbfc;
}

.batch-list {
    display: grid;
    gap: .42rem;
}

.batch-row {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: .67rem .75rem;
    border: 1px solid var(--line);
    border-radius: 9px;
    color: var(--ink);
    background: #fff;
    text-align: left;
    text-decoration: none;
    transition: border-color .15s ease, background .15s ease;
}

.batch-row:hover,
.batch-row.active {
    border-color: #c7bcfb;
    background: #f8f6ff;
    color: var(--ink);
}

.batch-row>div:first-child {
    display: grid;
}

.batch-row strong {
    font-size: .86rem;
}

.batch-row span {
    color: var(--muted);
    font-size: .7rem;
}

.batch-metrics {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: .25rem;
}

.batch-metrics span {
    background: #f1f2f6;
    border-radius: 20px;
    padding: .22rem .48rem;
    white-space: nowrap;
}

.qr-toolbar {
    justify-content: flex-start;
    flex-wrap: wrap;
}

.qr-toolbar>div:first-child {
    margin-right: auto;
}

.filter-form {
    display: flex;
    gap: .45rem;
}

.filter-form .form-control {
    width: 155px;
}

.compact-table {
    margin-bottom: 0;
    font-size: .83rem;
}

.compact-table> :not(caption)>*>* {
    padding: .68rem .55rem;
    border-bottom-color: #eceef2;
}

.compact-table thead th {
    color: #727987;
    font-size: .65rem;
    letter-spacing: .08em;
    text-transform: uppercase;
    white-space: nowrap;
    border-top: 1px solid #eceef2;
}

.compact-table tbody tr:last-child td {
    border-bottom: 0;
}

.table-subtext {
    color: var(--muted);
    font-size: .7rem;
    margin-top: .1rem;
}

.table-link {
    color: var(--brand-dark);
    font-weight: 700;
    text-decoration: none;
}

.table-link:hover {
    text-decoration: underline;
}

.status-pill {
    display: inline-flex;
    align-items: center;
    border-radius: 20px;
    padding: .28rem .52rem;
    font-size: .68rem;
    font-weight: 800;
    white-space: nowrap;
}

.status-pill.success {
    color: #12663d;
    background: #ddf6e9;
}

.status-pill.neutral {
    color: #606777;
    background: #eceef2;
}

.status-pill.primary {
    color: #5035c5;
    background: #ebe7ff;
}

.status-pill.warning {
    color: #8a5b08;
    background: #fff0cc;
}

.btn-quiet-danger {
    color: #b23842;
    background: #fff4f4;
    border: 1px solid transparent;
}

.btn-quiet-danger:hover {
    color: #fff;
    background: #bd3c47;
}

/* Users and record search */
.search-form {
    display: flex;
    align-items: center;
    gap: .5rem;
}

.search-input-wrap {
    flex: 1 1 auto;
    position: relative;
}

.date-filter {
    width: 165px;
    flex: 0 0 165px;
}

.search-input-wrap .form-control {
    padding-left: 2.35rem;
}

.search-symbol {
    position: absolute;
    left: .9rem;
    top: 50%;
    width: 13px;
    height: 13px;
    border: 2px solid #8a91a0;
    border-radius: 50%;
    transform: translateY(-58%);
    pointer-events: none;
}

.search-symbol::after {
    content: '';
    position: absolute;
    width: 6px;
    height: 2px;
    background: #8a91a0;
    right: -5px;
    bottom: -3px;
    transform: rotate(45deg);
    border-radius: 2px;
}

.form-hint {
    color: var(--muted);
    font-size: .72rem;
    margin-top: .55rem;
}

.results-summary {
    display: flex;
    align-items: end;
    justify-content: space-between;
    margin: 1.15rem .2rem .65rem;
}

.record-card {
    padding: 1rem 1.1rem;
}

.record-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding-bottom: .8rem;
    border-bottom: 1px solid var(--line);
}

.user-identity {
    display: flex;
    align-items: center;
    gap: .7rem;
    min-width: 0;
}

.user-identity h3 {
    font-size: .95rem;
    font-weight: 800;
    margin: 0;
}

.user-identity.compact strong,
.user-identity.compact span {
    display: block;
}

.user-identity.compact span {
    color: var(--muted);
    font-size: .7rem;
}

.avatar {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    object-fit: cover;
    background: #eee;
    flex: 0 0 auto;
}

.avatar-placeholder {
    display: grid;
    place-items: center;
    color: #5e4ac5;
    background: #efecff;
    font-size: .73rem;
    font-weight: 800;
}

.record-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 1rem;
    padding: .9rem 0;
}

.record-grid>div {
    display: grid;
    align-content: start;
    min-width: 0;
}

.record-grid strong {
    font-size: .8rem;
    margin: .24rem 0 .08rem;
    overflow-wrap: anywhere;
}

.record-grid span:not(.detail-label) {
    color: var(--muted);
    font-size: .7rem;
    overflow-wrap: anywhere;
}

.record-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.notification-list {
    display: grid;
}

.notification-item {
    padding: .65rem 0;
    border-bottom: 1px solid var(--line);
}

.notification-item:first-child {
    padding-top: 0;
}

.notification-item:last-child {
    padding-bottom: 0;
    border-bottom: 0;
}

.notification-item.full {
    padding: .85rem .2rem;
}

.notification-item.full.unread {
    border-left: 3px solid var(--brand);
    padding-left: .75rem;
}

.admin-pagination {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding-top: 1rem;
    margin-top: .35rem;
    border-top: 1px solid var(--line);
}

.pagination-summary {
    color: var(--muted);
    font-size: .72rem;
}

.pagination-links {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: .25rem;
}

.pagination-links a,
.pagination-links button,
.pagination-links span {
    min-width: 30px;
    height: 30px;
    display: grid;
    place-items: center;
    padding: 0 .5rem;
    border-radius: 8px;
    color: #606777;
    font-size: .73rem;
    font-weight: 750;
    text-decoration: none;
}

.pagination-links a,
.pagination-links button {
    border: 1px solid var(--line);
    background: #fff;
}

.pagination-links a:hover,
.pagination-links button:hover {
    border-color: #c7bcfb;
    color: var(--brand-dark);
    background: #f8f6ff;
}

.pagination-links a.active,
.pagination-links button.active {
    color: #fff;
    border-color: var(--brand);
    background: var(--brand);
}

.loading-dot {
    width: 13px;
    height: 13px;
    display: block;
    border-radius: 50%;
    background: currentColor;
    animation: loadingPulse 1s ease-in-out infinite alternate;
}

@keyframes loadingPulse {
    to {
        opacity: .25;
        transform: scale(.65);
    }
}

.place-items-center {
    place-items: center;
}

@media (max-width: 991px) {
    .admin-sidebar {
        position: sticky;
        top: 0;
        width: 100%;
        min-height: auto;
        padding: .75rem 1rem;
    }

    .admin-main {
        margin-left: 0;
        padding: 1.15rem;
    }

    .sidebar-toggle {
        display: block;
    }

    .admin-nav,
    .sidebar-account {
        display: none;
    }

    .admin-sidebar.nav-open .admin-nav {
        display: flex;
        margin-top: .75rem;
    }

    .admin-sidebar.nav-open .sidebar-account {
        display: block;
        margin-top: .75rem;
    }

    .record-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 575px) {
    .admin-main {
        padding: .9rem;
    }

    .page-heading {
        margin-bottom: .9rem;
    }

    .compact-card,
    .record-card {
        padding: .9rem;
    }

    .search-form,
    .qr-toolbar {
        align-items: stretch;
    }

    .search-form {
        flex-wrap: wrap;
    }

    .search-input-wrap {
        flex-basis: 100%;
    }

    .search-form .btn {
        flex: 1;
    }

    .date-filter {
        width: 100%;
        flex-basis: 100%;
    }

    .filter-form {
        width: 100%;
    }

    .filter-form .form-control {
        width: auto;
        flex: 1;
    }

    .qr-toolbar>.btn {
        width: 100%;
    }

    .batch-row {
        align-items: flex-start;
    }

    .batch-metrics {
        max-width: 55%;
    }

    .record-header {
        align-items: flex-start;
    }

    .record-grid {
        grid-template-columns: 1fr 1fr;
        gap: .85rem .65rem;
    }

    .admin-pagination {
        align-items: flex-start;
        flex-direction: column;
    }

    .pagination-links {
        justify-content: flex-start;
    }

    .compact-table {
        min-width: 620px;
    }
}