:root {
    --color-bg: #1A1B26;
    --color-surface: #24283B;
    --color-accent-primary: #9D7CD8;
    --color-accent-secondary: #E0AF68;
    --color-text: #C0CAF5;
}

*, *::before, *::after {
    box-sizing: border-box;
}

html, body {
    background-color: var(--color-bg);
    color: var(--color-text);
    font-family: 'DM Sans', sans-serif;
    margin: 0;
    padding: 0;
}

h1, h2, h3, h4, h5, h6 {
    font-family: 'Space Grotesk', sans-serif;
    color: var(--color-text);
}

a {
    color: var(--color-accent-primary);
    text-decoration: none;
}

a:hover {
    color: var(--color-accent-secondary);
}

/* ── Shared UI Components ─────────────────────────────────────────── */

.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.45rem 1rem;
    border-radius: 6px;
    border: none;
    cursor: pointer;
    font-family: 'DM Sans', sans-serif;
    font-size: 0.9rem;
    transition: opacity 0.15s;
}

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

.btn--danger {
    background-color: #c0392b;
    color: #fff;
}

.btn--ghost {
    background-color: transparent;
    color: var(--color-text);
    border: 1px solid #3a3f5c;
}

.btn--sm {
    padding: 0.25rem 0.6rem;
    font-size: 0.8rem;
}

.btn:hover { opacity: 0.85; }
.btn:disabled { opacity: 0.4; cursor: not-allowed; }

.input, .textarea, select {
    width: 100%;
    background-color: var(--color-surface);
    border: 1px solid #3a3f5c;
    border-radius: 6px;
    color: var(--color-text);
    font-family: 'DM Sans', sans-serif;
    font-size: 0.9rem;
    padding: 0.5rem 0.75rem;
    margin-bottom: 0.75rem;
}

.input:focus, .textarea:focus, select:focus {
    outline: none;
    border-color: var(--color-accent-primary);
}

.input--error {
    border-color: #c0392b;
}

.field-error {
    color: #f87171;
    font-size: 0.8rem;
    margin: -0.5rem 0 0.75rem 0;
}

.field-required {
    color: var(--color-accent-secondary);
    font-size: 0.85rem;
}

label {
    display: block;
    font-size: 0.8rem;
    color: var(--color-text);
    opacity: 0.7;
    margin-bottom: 0.25rem;
}

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

.data-table th {
    text-align: left;
    padding: 0.6rem 0.75rem;
    border-bottom: 2px solid #3a3f5c;
    font-family: 'Space Grotesk', sans-serif;
    font-size: 0.8rem;
    opacity: 0.7;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.data-table td {
    padding: 0.6rem 0.75rem;
    border-bottom: 1px solid #2d3250;
    vertical-align: middle;
}

.data-table tr:hover td {
    background-color: #1e2035;
}

.table-actions {
    display: flex;
    gap: 0.5rem;
    justify-content: flex-end;
}

.tab-bar {
    display: flex;
    gap: 0.25rem;
    margin-bottom: 1.5rem;
    border-bottom: 1px solid #3a3f5c;
    padding-bottom: 0;
}

.tab-btn {
    background: none;
    border: none;
    color: var(--color-text);
    cursor: pointer;
    font-family: 'DM Sans', sans-serif;
    font-size: 0.9rem;
    opacity: 0.6;
    padding: 0.5rem 1rem;
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
    transition: opacity 0.15s;
}

.tab-btn:hover { opacity: 0.9; }

.tab-btn--active {
    opacity: 1;
    color: var(--color-accent-primary);
    border-bottom-color: var(--color-accent-primary);
}

.modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 500;
}

.modal {
    background-color: var(--color-surface);
    border-radius: 10px;
    border: 1px solid #3a3f5c;
    padding: 1.5rem;
    width: 100%;
    max-width: 520px;
    display: flex;
    flex-direction: column;
}

.modal h3 {
    margin: 0 0 1.25rem 0;
}

.modal__actions {
    display: flex;
    gap: 0.75rem;
    justify-content: flex-end;
    margin-top: 1rem;
}

.lookup-panel__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1rem;
}

.lookup-panel__header h2 {
    margin: 0;
}

.empty-state {
    opacity: 0.5;
    font-style: italic;
}

.site-icon {
    width: 24px;
    height: 24px;
    object-fit: contain;
}

/* ── Status Badges ────────────────────────────────────────────────── */

.badge {
    display: inline-block;
    padding: 0.15rem 0.6rem;
    border-radius: 99px;
    font-size: 0.75rem;
    font-weight: 500;
}

.badge--pending  { background: #3a3f5c; color: var(--color-text); }
.badge--approved { background: #1a4731; color: #4ade80; }
.badge--rejected { background: #4a1a1a; color: #f87171; }

h1:focus {
    outline: none;
}

/* ── Site Slicer ─────────────────────────────────────────────────── */

.site-slicer {
    display: flex;
    gap: 0.4rem;
    align-items: center;
    margin-bottom: 1rem;
    flex-wrap: wrap;
}

.site-slicer__btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.3rem 0.5rem;
    background: var(--color-surface);
    border: 2px solid transparent;
    border-radius: 8px;
    cursor: pointer;
    transition: border-color 0.15s, opacity 0.15s;
    opacity: 0.6;
    font-family: 'DM Sans', sans-serif;
    font-size: 0.8rem;
    color: var(--color-text);
    min-width: 2.2rem;
    min-height: 2.2rem;
}

.site-slicer__btn:hover { opacity: 0.9; }

.site-slicer__btn--active {
    border-color: var(--color-accent-primary);
    opacity: 1;
}

/* ── Dashboard ───────────────────────────────────────────────────── */

.dashboard {
    max-width: 960px;
}

.dashboard-hero {
    display: flex;
    align-items: center;
    gap: 1.25rem;
    margin-bottom: 2rem;
}

.dashboard-logo {
    width: 72px;
    height: 72px;
    border-radius: 16px;
    flex-shrink: 0;
}

.dashboard-title {
    font-size: 2rem;
    margin: 0 0 0.2rem 0;
}

.dashboard-subtitle {
    margin: 0;
    opacity: 0.6;
    font-size: 0.9rem;
}

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

.stat-card {
    background: var(--color-surface);
    border-radius: 10px;
    padding: 1.25rem 1rem;
    text-decoration: none;
    color: var(--color-text);
    border: 1px solid transparent;
    transition: border-color 0.15s, transform 0.15s;
    display: block;
}

.stat-card:hover {
    border-color: var(--color-accent-primary);
    transform: translateY(-2px);
    color: var(--color-text);
}

.stat-card__value {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 2rem;
    font-weight: 700;
    line-height: 1;
    margin-bottom: 0.35rem;
}

.stat-card__label {
    font-size: 0.8rem;
    opacity: 0.6;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.stat-card--gold .stat-card__value   { color: var(--color-accent-secondary); }
.stat-card--accent .stat-card__value { color: var(--color-accent-primary); }
.stat-card--warning .stat-card__value { color: var(--color-accent-secondary); }

.metric-card {
    background: var(--color-surface);
    border-radius: 10px;
    padding: 1.25rem;
}

.metric-card__title {
    margin: 0 0 1rem 0;
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    opacity: 0.7;
}

/* ── Insights Tab ────────────────────────────────────────────────── */

.insights-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.25rem;
}

.insight-chart {
    background: var(--color-surface);
    border-radius: 10px;
    padding: 1rem 1.1rem 1.1rem;
}

.insight-chart__title {
    font-size: 0.82rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    opacity: 0.6;
    margin: 0 0 0.85rem 0;
}

/* ── Observable Items Chart ──────────────────────────────────────── */

.obs-chart-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
    margin-bottom: 1.25rem;
}

.obs-chart-tabs {
    display: flex;
    gap: 0.35rem;
    margin-left: auto;
}

.tab-btn--sm {
    font-size: 0.78rem;
    padding: 0.25rem 0.65rem;
}

.obs-chart {
    display: flex;
    flex-direction: column;
    gap: 0.55rem;
}

.obs-chart__row {
    display: grid;
    grid-template-columns: 180px 1fr 36px;
    align-items: center;
    gap: 0.75rem;
    font-size: 0.82rem;
}

.obs-chart__label {
    text-align: right;
    opacity: 0.85;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.obs-chart__bar-wrap {
    background: #2e3350;
    border-radius: 4px;
    height: 18px;
    overflow: hidden;
}

.obs-chart__bar {
    height: 100%;
    background: linear-gradient(90deg, var(--color-accent-primary), #7b5ea7);
    border-radius: 4px;
    min-width: 4px;
    transition: width 0.4s ease;
}

.obs-chart__count {
    opacity: 0.6;
    text-align: right;
    font-variant-numeric: tabular-nums;
}

.overdue-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.overdue-user {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.35rem;
    text-decoration: none;
    color: var(--color-text);
    width: 64px;
}

.overdue-user__img {
    width: 64px;
    height: 96px;
    object-fit: cover;
    border-radius: 6px;
    border: 2px solid var(--color-accent-secondary);
}

.overdue-user__name {
    font-size: 0.7rem;
    text-align: center;
    line-height: 1.2;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    width: 100%;
}

.overdue-user:hover .overdue-user__img {
    border-color: var(--color-accent-primary);
}

/* ── User List ───────────────────────────────────────────────────── */

.users-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-bottom: 1.25rem;
    align-items: center;
}

.users-toolbar .input {
    width: 260px;
}

.attr-slicer {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
}

/* ── User Cards ──────────────────────────────────────────────────── */

.user-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 1rem;
}

.user-card {
    display: flex;
    flex-direction: column;
    background: var(--color-surface);
    border-radius: 10px;
    overflow: hidden;
    text-decoration: none;
    color: var(--color-text);
    border: 1px solid transparent;
    transition: border-color 0.15s, transform 0.15s;
}

.user-card:hover {
    border-color: var(--color-accent-primary);
    transform: translateY(-2px);
    color: var(--color-text);
}

.user-card__image-wrap {
    position: relative;
    width: 100%;
    aspect-ratio: 2 / 3;
    overflow: hidden;
    flex-shrink: 0;
}

.user-card__image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.user-card__image-wrap .avatar-hof-badge {
    position: absolute;
    bottom: 6px;
    right: 6px;
}

.user-card__body {
    padding: 0.6rem 0.65rem 0.75rem;
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.user-card__name {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 0.9rem;
    font-weight: 600;
    line-height: 1.2;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.attr-badges--sm {
    gap: 0.2rem;
}

.attr-badges--sm .badge--attr {
    font-size: 0.65rem;
    padding: 0.1rem 0.35rem;
}

.user-card__ratings {
    display: flex;
    flex-direction: column;
    gap: 0.1rem;
    font-size: 0.72rem;
    opacity: 0.85;
}

.user-card__obs {
    font-size: 0.72rem;
    opacity: 0.7;
    margin-top: 0.1rem;
}

.user-card__obs.overdue {
    opacity: 1;
}

.overdue { color: var(--color-accent-secondary); }

.obs-due {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    background: rgba(157, 124, 216, 0.1);
    border: 1px solid rgba(157, 124, 216, 0.2);
    border-radius: 6px;
    padding: 0.3rem 0.65rem;
    font-size: 0.8rem;
    margin-top: 0.25rem;
}

.obs-due__label {
    opacity: 0.65;
}

.obs-due__date {
    font-weight: 600;
    color: var(--color-accent-primary);
}

.obs-due--overdue {
    background: rgba(224, 175, 104, 0.1);
    border-color: rgba(224, 175, 104, 0.3);
}

.obs-due--overdue .obs-due__label {
    opacity: 1;
    color: var(--color-accent-secondary);
}

.obs-due--overdue .obs-due__date {
    color: var(--color-accent-secondary);
}

/* ── Tab Panel ───────────────────────────────────────────────────── */

.tab-panel {
    padding-top: 1rem;
}

/* ── Social Identities ───────────────────────────────────────────── */

.identity-group {
    margin-bottom: 1rem;
}

.identity-group__site {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.4rem;
    font-size: 0.9rem;
}

.identity-table {
    margin-left: 2rem;
    width: auto;
    border: none;
}

.identity-table td {
    border: none;
    padding: 0.25rem 0.75rem 0.25rem 0;
    background: none;
}

/* ── Profile Links ───────────────────────────────────────────────── */

.profile-links {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
}

.profile-link {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    background: rgba(157, 124, 216, 0.1);
    border: 1px solid rgba(157, 124, 216, 0.2);
    transition: background 0.15s, border-color 0.15s, transform 0.15s;
}

.profile-link:hover {
    background: rgba(157, 124, 216, 0.22);
    border-color: var(--color-accent-primary);
    transform: translateY(-2px);
}

.profile-link__icon {
    width: 20px;
    height: 20px;
    object-fit: contain;
    border-radius: 4px;
}

.profile-link__fallback {
    font-size: 0.65rem;
    font-weight: 600;
    color: var(--color-accent-primary);
    text-align: center;
    line-height: 1;
}

/* ── User Detail ─────────────────────────────────────────────────── */

.user-detail-header {
    display: flex;
    gap: 1.5rem;
    align-items: flex-start;
    margin-bottom: 2rem;
}

.user-detail-avatar {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.avatar-wrapper {
    position: relative;
    display: inline-block;
}

.avatar {
    width: 150px;
    height: 225px;
    border-radius: 6px;
    object-fit: cover;
    border: 2px solid var(--color-accent-primary);
    display: block;
}

.avatar-hof-badge {
    position: absolute;
    bottom: -8px;
    right: -8px;
    background: #b8860b;
    color: #fff8e1;
    font-size: 0.85rem;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid var(--color-bg);
    box-shadow: 0 2px 6px rgba(0,0,0,0.4);
    line-height: 1;
}

.attr-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.badge--attr {
    background: rgba(157, 124, 216, 0.18);
    color: var(--color-accent-primary);
    border: 1px solid rgba(157, 124, 216, 0.35);
}

.user-detail-info { flex: 1; }

.user-detail-actions {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    align-items: flex-end;
}

.handle-list { display: flex; flex-wrap: wrap; gap: 0.4rem; margin-top: 0.4rem; }

.handle-chip {
    background: var(--color-surface);
    border: 1px solid #3a3f5c;
    border-radius: 99px;
    padding: 0.15rem 0.65rem;
    font-size: 0.8rem;
    color: var(--color-accent-primary);
    text-decoration: none;
}

.detail-section {
    margin-bottom: 2rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid #2d3250;
}

.attr-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
}

.attr-grid label {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    opacity: 1;
    cursor: pointer;
    font-size: 0.9rem;
}

.ratings-grid {
    display: flex;
    gap: 2rem;
    flex-wrap: wrap;
}

.rating-field label { margin-bottom: 0.4rem; }

.rating-input { display: flex; gap: 0.15rem; align-items: center; }

.star {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: #3a3f5c;
    cursor: pointer;
    padding: 0;
    line-height: 1;
    transition: color 0.1s;
}

.star--filled { color: var(--color-accent-secondary); }
.star--clear { font-size: 0.9rem; color: #666; margin-left: 0.25rem; }
.star:disabled { cursor: default; }

/* ── Drop Zone ───────────────────────────────────────────────────── */

.drop-zone {
    border: 2px dashed #3a3f5c;
    border-radius: 8px;
    padding: 1.5rem;
    text-align: center;
    cursor: pointer;
    transition: border-color 0.15s, background-color 0.15s;
}

.drop-zone--over,
.drop-zone:hover {
    border-color: var(--color-accent-primary);
    background-color: rgba(157, 124, 216, 0.07);
}

.drop-zone__label {
    display: block;
    cursor: pointer;
    font-size: 0.9rem;
    opacity: 0.7;
    margin: 0;
}

/* ── Gallery ─────────────────────────────────────────────────────── */

.gallery-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.gallery-item {
    position: relative;
    width: 120px;
    border-radius: 8px;
    overflow: hidden;
    border: 2px solid transparent;
}

.gallery-item--profile { border-color: var(--color-accent-primary); }

.gallery-item__thumb {
    width: 100%;
    aspect-ratio: 2 / 3;
    object-fit: cover;
    display: block;
    cursor: zoom-in;
}

.lightbox-backdrop {
    background: rgba(0, 0, 0, 0.88);
    cursor: zoom-out;
}

.lightbox-img {
    max-width: 90vw;
    max-height: 90vh;
    object-fit: contain;
    border-radius: 6px;
    cursor: default;
    box-shadow: 0 8px 40px rgba(0,0,0,0.6);
}

.gallery-item__actions {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    padding: 0.4rem;
    background: var(--color-surface);
}

/* ── Observations ────────────────────────────────────────────────── */

.obs-card {
    background: var(--color-surface);
    border-radius: 8px;
    border: 1px solid #2d3250;
    padding: 1rem;
    margin-bottom: 0.75rem;
}

.obs-card__header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 0.75rem;
    font-size: 0.9rem;
}

.obs-card__body { display: flex; gap: 1.5rem; flex-wrap: wrap; }

.obs-summary strong { display: block; font-size: 0.8rem; opacity: 0.7; margin-bottom: 0.25rem; }

.obs-summary__table { font-size: 0.8rem; }
.obs-summary__table th { opacity: 0.6; font-weight: normal; padding-right: 1rem; }
.obs-summary__table td { padding-right: 1rem; }

.obs-editor { margin-bottom: 1rem; }
.obs-editor h4 { margin: 0 0 0.5rem 0; font-size: 0.9rem; }

.obs-editor__row {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    margin-bottom: 0.4rem;
}

.obs-editor__counts {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.8rem;
}

.obs-editor__counts label { margin: 0; opacity: 0.7; }

.input--sm { width: 60px; padding: 0.3rem 0.4rem; margin: 0; }

/* ── Paste Zone ──────────────────────────────────────────────────── */

.paste-zone {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    border: 2px dashed #3a3f5c;
    border-radius: 8px;
    padding: 1rem 1.25rem;
    margin-bottom: 1rem;
    font-size: 0.9rem;
    flex-wrap: wrap;
}

.paste-zone kbd {
    background: #3a3f5c;
    border-radius: 4px;
    padding: 0.1rem 0.4rem;
    font-size: 0.85rem;
    font-family: monospace;
    color: var(--color-accent-primary);
}

.paste-zone__or {
    opacity: 0.5;
    font-size: 0.8rem;
}

/* ── Vetting ─────────────────────────────────────────────────────── */

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

.modal--scrollable {
    max-height: 90vh;
    overflow-y: auto;
}

/* ── Autocomplete ─────────────────────────────────────────────────── */

.autocomplete {
    position: relative;
    flex: 2;
}

.autocomplete__dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--color-surface);
    border: 1px solid #3a3f5c;
    border-radius: 6px;
    z-index: 200;
    max-height: 220px;
    overflow-y: auto;
    box-shadow: 0 4px 16px rgba(0,0,0,0.4);
}

.autocomplete__option {
    display: block;
    width: 100%;
    text-align: left;
    background: none;
    border: none;
    color: var(--color-text);
    font-family: 'DM Sans', sans-serif;
    font-size: 0.9rem;
    padding: 0.45rem 0.75rem;
    cursor: pointer;
}

.autocomplete__option:hover {
    background: rgba(157, 124, 216, 0.15);
    color: var(--color-accent-primary);
}

.match-cell {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.85rem;
    text-align: center;
}

.match-thumb {
    width: 80px;
    height: 120px;
    object-fit: cover;
    border-radius: 6px;
    border: 1px solid #3a3f5c;
}

.vet-preview {
    width: 120px;
    height: 120px;
    object-fit: cover;
    border-radius: 8px;
    border: 2px solid var(--color-accent-primary);
    margin-bottom: 1rem;
}

.valid.modified:not([type=checkbox]) {
    outline: 1px solid #26b050;
}

.invalid {
    outline: 1px solid #e50000;
}

.validation-message {
    color: #e50000;
}

.blazor-error-boundary {
    background: var(--color-surface);
    border-left: 4px solid var(--color-accent-secondary);
    padding: 1rem;
    color: var(--color-text);
}

    .blazor-error-boundary::after {
        content: "An unhandled error has occurred."
    }
