:root {
    --bg-deep: #0a0a0c;
    --bg-card: #121218;
    --bg-card-hover: #1a1a24;
    --gold: #c9a227;
    --gold-light: #e8c547;
    --gold-dim: #8a7020;
    --text: #e8e4d9;
    --text-muted: #9a9588;
    --success: #3d8f5f;
    --danger: #c45c5c;
    --border: rgba(201, 162, 39, 0.22);
    --shadow: 0 8px 32px rgba(0, 0, 0, 0.45);
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
    background: radial-gradient(ellipse at top, #1a1610 0%, var(--bg-deep) 55%);
    color: var(--text);
    min-height: 100vh;
}

a {
    color: var(--gold-light);
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

.header {
    padding: 1.5rem 2rem;
    border-bottom: 1px solid var(--border);
    background: linear-gradient(180deg, rgba(201, 162, 39, 0.08), transparent);
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 1rem;
}

.logo {
    font-size: 1.5rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    color: var(--gold-light);
}

.logo span {
    color: var(--text-muted);
    font-weight: 400;
    font-size: 0.95rem;
    margin-left: 0.5rem;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 1.5rem 2rem 3rem;
}

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

.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 1.25rem;
    box-shadow: var(--shadow);
}

.stat-card .label {
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted);
}

.stat-card .value {
    font-size: 2rem;
    font-weight: 700;
    color: var(--gold-light);
    margin-top: 0.35rem;
}

.stat-card.success .value { color: var(--success); }
.stat-card.danger .value { color: var(--danger); }

.filters {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    margin-bottom: 1.5rem;
}

.filter-chip {
    padding: 0.4rem 0.9rem;
    border-radius: 999px;
    border: 1px solid var(--border);
    background: transparent;
    color: var(--text-muted);
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.2s;
}

.filter-chip:hover,
.filter-chip.active {
    background: rgba(201, 162, 39, 0.15);
    color: var(--gold-light);
    border-color: var(--gold);
}

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

.report-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 1rem 1.25rem;
    transition: background 0.2s, border-color 0.2s;
    display: block;
    color: inherit;
}

.report-card:hover {
    background: var(--bg-card-hover);
    border-color: var(--gold-dim);
    text-decoration: none;
}

.report-card.pinned {
    border-left: 3px solid var(--gold);
}

.report-card .meta {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1rem;
    flex-wrap: wrap;
}

.badge {
    display: inline-block;
    padding: 0.2rem 0.55rem;
    border-radius: 6px;
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    background: rgba(201, 162, 39, 0.12);
    color: var(--gold-light);
    border: 1px solid var(--border);
}

.badge.fail {
    background: rgba(196, 92, 92, 0.15);
    color: #e8a0a0;
    border-color: rgba(196, 92, 92, 0.35);
}

.badge.ok {
    background: rgba(61, 143, 95, 0.15);
    color: #9fd4b0;
    border-color: rgba(61, 143, 95, 0.35);
}

.report-card h3 {
    margin: 0.5rem 0 0.35rem;
    font-size: 1.05rem;
    color: var(--text);
}

.report-card .stats-line {
    font-size: 0.9rem;
    color: var(--text-muted);
}

.report-card .stats-line strong {
    color: var(--gold);
}

.time {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.empty-state {
    text-align: center;
    padding: 3rem;
    color: var(--text-muted);
    border: 1px dashed var(--border);
    border-radius: 12px;
}

.detail-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
}

@media (max-width: 768px) {
    .detail-grid { grid-template-columns: 1fr; }
}

.panel {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 1.25rem;
    box-shadow: var(--shadow);
}

.panel h2 {
    margin: 0 0 1rem;
    font-size: 1rem;
    color: var(--gold);
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.kv-list dt {
    color: var(--text-muted);
    font-size: 0.8rem;
    margin-top: 0.75rem;
}

.kv-list dd {
    margin: 0.2rem 0 0;
    color: var(--text);
    word-break: break-all;
}

.test-list {
    list-style: none;
    padding: 0;
    margin: 0;
    max-height: 420px;
    overflow-y: auto;
}

.test-list li {
    padding: 0.45rem 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    font-size: 0.9rem;
}

.raw-block {
    background: #08080a;
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 1rem;
    font-family: Consolas, monospace;
    font-size: 0.78rem;
    white-space: pre-wrap;
    max-height: 300px;
    overflow: auto;
    color: var(--text-muted);
}

.back-link {
    display: inline-block;
    margin-bottom: 1rem;
    font-size: 0.9rem;
}

.links-row {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
    margin-top: 1rem;
}

.btn-link,
.btn-action {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.5rem 1rem;
    border-radius: 8px;
    border: 1px solid var(--gold);
    background: rgba(201, 162, 39, 0.1);
    color: var(--gold-light);
    font-size: 0.85rem;
    font-family: inherit;
    line-height: 1.3;
    transition: background 0.15s, border-color 0.15s;
}

.btn-action {
    cursor: pointer;
    text-decoration: none;
}

.btn-link:hover,
.btn-action:hover:not(:disabled) {
    background: rgba(201, 162, 39, 0.22);
    text-decoration: none;
}

.btn-action:disabled,
.btn-action.is-busy {
    opacity: 0.65;
    cursor: wait;
}

.category-bar {
    display: flex;
    gap: 0.35rem;
    flex-wrap: wrap;
    margin-bottom: 1.5rem;
    padding: 0.5rem;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    overflow-x: auto;
}

.category-tab {
    padding: 0.45rem 0.75rem;
    border-radius: 8px;
    border: 1px solid transparent;
    color: var(--text-muted);
    font-size: 0.82rem;
    white-space: nowrap;
    transition: all 0.15s;
}

.category-tab:hover {
    background: rgba(201, 162, 39, 0.08);
    color: var(--gold-light);
    text-decoration: none;
}

.category-tab.active {
    background: rgba(201, 162, 39, 0.18);
    border-color: var(--gold-dim);
    color: var(--gold-light);
}

.stat-pill {
    display: inline-block;
    margin-right: 0.5rem;
    padding: 0.15rem 0.45rem;
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.04);
}

.stat-pill.ok strong { color: var(--success); }
.stat-pill.fail strong { color: var(--danger); }
.stat-pill.skip strong { color: #9a8fc4; }

.stats-line.subtle {
    font-size: 0.82rem;
    opacity: 0.85;
    word-break: break-all;
}

.report-detail-page .report-hero {
    margin: 1rem 0 1.5rem;
    padding: 1.25rem 1.5rem;
    background: linear-gradient(135deg, rgba(201, 162, 39, 0.12), rgba(18, 18, 24, 0.9));
    border: 1px solid var(--border);
    border-radius: 14px;
}

.report-hero h1 {
    margin: 0;
    font-size: 1.2rem;
    color: var(--gold-light);
    font-weight: 600;
}

.hero-icon { margin-right: 0.35rem; }

.hero-meta {
    margin: 0.5rem 0 0;
    color: var(--text-muted);
    font-size: 0.88rem;
}

.info-block, .stats-block, .tests-block {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 1rem 1.25rem;
    margin-bottom: 1rem;
}

.block-title {
    margin: 0 0 0.75rem;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--gold);
    text-transform: none;
    letter-spacing: 0.02em;
}

.info-value.link {
    word-break: break-all;
    color: var(--gold-light);
}

.info-value.muted { color: var(--text-muted); }

.info-list {
    margin: 0;
    padding-left: 1.2rem;
    color: var(--text);
}

.info-code {
    display: block;
    padding: 0.6rem 0.8rem;
    background: #08080a;
    border-radius: 8px;
    border: 1px solid var(--border);
    color: var(--text);
    font-size: 0.88rem;
}

.stats-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 0.75rem;
}

.stat-box {
    text-align: center;
    padding: 0.75rem;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.06);
}

.stat-box .n {
    display: block;
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--gold-light);
}

.stat-box .l {
    display: block;
    font-size: 0.72rem;
    color: var(--text-muted);
    margin-top: 0.25rem;
}

.stat-box.ok .n { color: var(--success); }
.stat-box.fail .n { color: var(--danger); }
.stat-box.skip .n { color: #9a8fc4; }

.duration {
    margin: 1rem 0 0;
    color: var(--text-muted);
    font-size: 0.9rem;
}

.duration strong { color: var(--text); }

.test-items {
    list-style: none;
    margin: 0;
    padding: 0;
    max-height: 480px;
    overflow-y: auto;
}

.test-items li {
    padding: 0.55rem 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    font-size: 0.9rem;
    line-height: 1.4;
}

.ti-icon { margin-right: 0.35rem; flex-shrink: 0; }

.test-items li.test-item-rich,
.suite-items li {
    display: flex;
    align-items: flex-start;
    gap: 0.35rem;
}

.test-item-body {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    flex: 1;
    min-width: 0;
}

.test-item-body > a,
.test-item-body > span {
    word-break: break-word;
}

.test-item-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    align-items: center;
}

.test-item-body .raw-block {
    margin: 0.25rem 0 0;
    max-height: 280px;
}

.test-item-body .raw-block.is-loading {
    color: var(--text-muted);
    font-style: italic;
}

.test-item-body .raw-block.is-error {
    border-color: var(--danger);
    color: #f0b0b0;
}

.screenshot-panel {
    margin: 0.25rem 0 0;
    padding: 0.5rem;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: rgba(0, 0, 0, 0.2);
}

.screenshot-panel.is-error {
    border-color: var(--danger);
}

.screenshot-placeholder {
    margin: 0;
    font-size: 0.85rem;
    color: var(--text-muted);
    font-style: italic;
}

.screenshot-panel.is-error .screenshot-placeholder {
    color: #f0b0b0;
    font-style: normal;
}

.screenshot-img {
    display: block;
    max-width: 100%;
    height: auto;
    border-radius: 6px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    cursor: zoom-in;
}

.suite-body {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
}

.suite-meta {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.suite-path {
    font-size: 0.8rem;
    color: var(--gold-dim);
    background: rgba(0, 0, 0, 0.25);
    padding: 0.15rem 0.4rem;
    border-radius: 4px;
    align-self: flex-start;
}

.fail-block { border-left: 3px solid var(--danger); }
.pass-block { border-left: 3px solid var(--success); }
.skip-block { border-left: 3px solid #7a6fb0; }

.header-nav {
    display: flex;
    gap: 1.25rem;
    font-size: 0.95rem;
    align-items: center;
}

.header-nav a {
    color: var(--text-muted);
    text-decoration: none;
}

.header-nav a:hover,
.header-nav a.active {
    color: var(--gold-light);
    text-decoration: none;
}

.header-nav a.active {
    border-bottom: 2px solid var(--gold);
    padding-bottom: 0.15rem;
}

.header-nav .inline-form {
    margin: 0;
}

.header-nav .btn-action {
    padding: 0.35rem 0.7rem;
    font-size: 0.8rem;
}

.backup-page .info-list.compact li {
    margin-bottom: 0.35rem;
}

.backup-actions {
    margin: 1.5rem 0;
}

.btn-primary,
.btn-danger {
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 0.55rem 1.1rem;
    font-size: 0.95rem;
    cursor: pointer;
    font-family: inherit;
}

.btn-primary {
    background: linear-gradient(135deg, var(--gold-dim), var(--gold));
    color: #1a1408;
    font-weight: 600;
}

.btn-danger {
    background: rgba(196, 92, 92, 0.2);
    color: #f0a0a0;
    border-color: rgba(196, 92, 92, 0.45);
}

.hint {
    margin-top: 0.75rem;
    color: var(--text-muted);
    font-size: 0.85rem;
}

.flash {
    padding: 0.75rem 1rem;
    border-radius: 8px;
    margin-bottom: 1rem;
    border: 1px solid var(--border);
}

.flash.ok {
    background: rgba(61, 143, 95, 0.15);
    border-color: var(--success);
}

.flash.error {
    background: rgba(196, 92, 92, 0.15);
    border-color: var(--danger);
}

.flash.warn {
    background: rgba(201, 162, 39, 0.12);
    border-color: var(--gold);
}

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

.backup-table th,
.backup-table td {
    text-align: left;
    padding: 0.6rem 0.5rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.backup-row-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    align-items: center;
}

.inline-form {
    display: inline;
}

.backup-table code {
    font-size: 0.82rem;
    color: var(--gold-light);
}

.upload-form {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem 1rem;
    align-items: center;
    margin-top: 0.5rem;
}

.upload-form input[type="file"] {
    max-width: 100%;
    color: var(--text-muted);
    font-size: 0.9rem;
}

.upload-restore {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.9rem;
    color: var(--text-muted);
    cursor: pointer;
}

.upload-block {
    margin-top: 1.5rem;
}

.auth-page {
    max-width: 860px;
}

.auth-card {
    margin-bottom: 1.2rem;
}

.auth-form {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
}

.auth-label {
    color: var(--text-muted);
    font-size: 0.86rem;
}

.auth-input {
    border-radius: 8px;
    border: 1px solid var(--border);
    background: #08080a;
    color: var(--text);
    padding: 0.55rem 0.65rem;
    font-size: 0.95rem;
    font-family: inherit;
}

.auth-input:focus {
    outline: 1px solid var(--gold-dim);
    border-color: var(--gold);
}

.category-form {
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
    margin-top: 0.75rem;
}

.category-form label {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    font-size: 0.86rem;
    color: var(--text-muted);
}

.category-form input,
.category-form select {
    border-radius: 8px;
    border: 1px solid var(--border);
    background: #08080a;
    color: var(--text);
    padding: 0.55rem 0.65rem;
    font-size: 0.95rem;
    font-family: inherit;
}

.category-form select {
    max-width: 8rem;
    font-size: 1.25rem;
}

.category-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
    margin-top: 0.5rem;
}

.category-table th,
.category-table td {
    text-align: left;
    padding: 0.55rem 0.5rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.category-table code {
    font-size: 0.82rem;
    color: var(--gold-light);
}

.badge.notification {
    background: rgba(201, 162, 39, 0.18);
    border-color: var(--gold-dim);
    color: var(--gold-light);
}

.report-card.notification-card {
    border-left: 3px solid var(--gold-dim);
}

.notification-items .field-line {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem 0.5rem;
    align-items: baseline;
}

.notification-items .field-label {
    color: var(--text-muted);
    font-size: 0.88rem;
}

.notification-items .status-line .notification-body {
    flex: 1;
}

/* ——— Auth screen ——— */
body.auth-screen {
    background:
        radial-gradient(ellipse 80% 50% at 50% -20%, rgba(201, 162, 39, 0.18), transparent),
        radial-gradient(ellipse 60% 40% at 100% 100%, rgba(90, 70, 30, 0.12), transparent),
        var(--bg-deep);
}

.header-compact {
    padding: 1rem 2rem;
}

.auth-screen-main {
    max-width: 920px;
    margin: 0 auto;
    padding: 1rem 2rem 3rem;
}

.auth-hero {
    text-align: center;
    margin-bottom: 2rem;
}

.auth-eyebrow {
    text-transform: uppercase;
    letter-spacing: 0.14em;
    font-size: 0.72rem;
    color: var(--gold-dim);
    margin: 0 0 0.5rem;
}

.auth-hero h1 {
    margin: 0;
    font-size: 2rem;
    font-weight: 600;
    color: var(--gold-light);
}

.auth-lead {
    margin: 0.75rem auto 0;
    max-width: 32rem;
    color: var(--text-muted);
    line-height: 1.5;
}

.auth-flash {
    max-width: 920px;
    margin: 0 auto 1rem;
}

.auth-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.25rem;
    align-items: stretch;
}

.auth-panel {
    background: linear-gradient(165deg, rgba(26, 26, 36, 0.95), rgba(12, 12, 16, 0.98));
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 1.5rem 1.6rem;
    box-shadow: var(--shadow);
    display: flex;
    flex-direction: column;
}

.auth-panel-accent {
    border-color: rgba(201, 162, 39, 0.45);
    box-shadow: 0 12px 40px rgba(201, 162, 39, 0.08);
}

.auth-panel-icon {
    font-size: 1.75rem;
    margin-bottom: 0.5rem;
}

.auth-panel h2 {
    margin: 0;
    font-size: 1.15rem;
    color: var(--gold-light);
}

.auth-panel-desc {
    margin: 0.35rem 0 1rem;
    font-size: 0.88rem;
    color: var(--text-muted);
}

.auth-panel-footer {
    margin-top: auto;
    padding-top: 1rem;
    font-size: 0.82rem;
    color: var(--text-muted);
}

.auth-features {
    margin: 1rem 0 0;
    padding-left: 1.1rem;
    font-size: 0.85rem;
    color: var(--text-muted);
    line-height: 1.55;
}

.btn-block {
    width: 100%;
    margin-top: 0.25rem;
}

.btn-sm {
    padding: 0.4rem 0.75rem;
    font-size: 0.82rem;
}

.flash.admin-hint {
    background: rgba(201, 162, 39, 0.1);
    border-color: var(--gold-dim);
    font-size: 0.9rem;
    margin-bottom: 1.25rem;
}

/* ——— Header admin group ——— */
.nav-admin-group {
    display: inline-flex;
    align-items: center;
    gap: 0.65rem;
    padding: 0.25rem 0.65rem;
    margin-left: 0.25rem;
    border-radius: 999px;
    border: 1px solid rgba(201, 162, 39, 0.35);
    background: rgba(201, 162, 39, 0.08);
}

.nav-admin-label {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--gold-dim);
    white-space: nowrap;
}

.nav-admin-group a {
    color: var(--gold-light);
    font-size: 0.88rem;
}

.nav-admin-group a.active {
    border-bottom: none;
    font-weight: 600;
}

.nav-admin-entry {
    color: var(--gold-dim) !important;
    font-size: 0.88rem;
}

/* ——— Admin categories ——— */
.admin-page {
    max-width: 1100px;
}

.admin-grid {
    display: grid;
    grid-template-columns: minmax(280px, 1fr) minmax(300px, 1.1fr);
    gap: 1.25rem;
    align-items: start;
}

@media (max-width: 860px) {
    .admin-grid {
        grid-template-columns: 1fr;
    }
}

.icon-picker-block {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.icon-picker-label {
    font-size: 0.86rem;
    color: var(--text-muted);
}

.icon-picker-preview {
    font-size: 2rem;
    line-height: 1;
    padding: 0.5rem 0;
}

.icon-picker-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
    max-height: 140px;
    overflow-y: auto;
    padding: 0.35rem;
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.06);
    background: rgba(0, 0, 0, 0.25);
}

.icon-picker-item {
    width: 2.25rem;
    height: 2.25rem;
    border: 1px solid transparent;
    border-radius: 8px;
    background: transparent;
    font-size: 1.2rem;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s, transform 0.1s;
}

.icon-picker-item:hover {
    background: rgba(201, 162, 39, 0.12);
    border-color: var(--border);
}

.icon-picker-item.selected {
    background: rgba(201, 162, 39, 0.22);
    border-color: var(--gold);
    transform: scale(1.08);
}

.category-list {
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
}

.category-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.75rem 0.85rem;
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.06);
    background: rgba(0, 0, 0, 0.2);
}

.category-row-main {
    display: flex;
    align-items: flex-start;
    gap: 0.65rem;
    min-width: 0;
}

.category-row-icon {
    font-size: 1.5rem;
    line-height: 1;
}

.category-row h3 {
    margin: 0;
    font-size: 0.95rem;
    color: var(--text);
}

.category-row-meta {
    margin: 0.2rem 0 0;
    font-size: 0.8rem;
    color: var(--text-muted);
}

.builtin-category-list {
    margin: 0.5rem 0 0;
    padding-left: 1.2rem;
    color: var(--text-muted);
    font-size: 0.88rem;
    line-height: 1.6;
}

.subtle-title {
    margin-top: 1.5rem;
    font-size: 0.95rem;
    color: var(--text-muted);
}
