:root {
    --background: #f6f1e8;
    --paper: #fffaf1;
    --ink: #17251f;
    --muted: #64736d;
    --deep: #0e3b2e;
    --green: #0f6b4f;
    --green-2: #0b513d;
    --gold: #d9a441;
    --red: #c6513b;
    --blue: #345c7c;
}

* {
    box-sizing: border-box;
}

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

.topbar {
    position: sticky;
    top: 16px;
    z-index: 5;
    display: flex;
    align-items: center;
    justify-content: space-between;
    max-width: 1120px;
    margin: 16px auto;
    padding: 10px 14px;
    border: 1px solid rgba(23, 37, 31, .14);
    border-radius: 42px;
    background: rgba(255, 250, 241, .94);
    box-shadow: 0 14px 34px rgba(14, 59, 46, .13);
}

.brand,
.tabs a,
.icon-link,
.nav a,
.secondary-link a,
.section-pills a,
.button-link {
    color: var(--deep);
    text-decoration: none;
}

.brand {
    font-weight: 800;
}

.nav {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 10px;
}

.icon-link {
    display: inline-grid;
    width: 38px;
    height: 38px;
    place-items: center;
    border-radius: 50%;
    background: var(--background);
    font-size: 20px;
}

.shell {
    width: min(1120px, calc(100% - 28px));
    margin: 28px auto 64px;
}

.panel {
    border: 1px solid rgba(23, 37, 31, .12);
    border-radius: 28px;
    background: var(--paper);
    box-shadow: 0 18px 42px rgba(14, 59, 46, .12);
    padding: 24px;
}

.eyebrow {
    margin: 0 0 8px;
    color: var(--red);
    font-size: 12px;
    font-weight: 800;
    letter-spacing: .14em;
}

.control-hero {
    display: flex;
    align-items: end;
    justify-content: space-between;
    gap: 18px;
    margin-bottom: 18px;
    border: 1px solid rgba(23, 37, 31, .12);
    border-radius: 28px;
    background: var(--paper);
    padding: 24px;
}

.compact-hero {
    align-items: center;
}

.hero-actions {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 10px;
    width: min(100%, 560px);
}

.hero-actions form {
    width: 100%;
}

#google-kpi-root.is-loading {
    opacity: .72;
}

.admin-search {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 92px;
    gap: 8px;
}

.button-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 42px;
    border: 1px solid var(--green-2);
    border-radius: 999px;
    background: var(--green);
    color: white;
    padding: 8px 14px;
    font-weight: 800;
}

.section-pills {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 18px;
}

.section-pills a,
.status-badge {
    display: inline-flex;
    align-items: center;
    min-height: 32px;
    border: 1px solid rgba(23, 37, 31, .14);
    border-radius: 999px;
    background: var(--paper);
    padding: 6px 10px;
    font-size: 13px;
}

.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 18px;
    margin-bottom: 18px;
}

.action-strip,
.kpi-stack {
    display: grid;
    gap: 12px;
    margin-bottom: 18px;
}

.diagnostic-stack {
    margin-bottom: 18px;
}

.diagnostic-grid {
    display: grid;
    gap: 14px;
}

.diagnostic-card {
    display: grid;
    gap: 12px;
    border: 1px solid rgba(23, 37, 31, .14);
    border-left-width: 6px;
    border-radius: 8px;
    background: white;
    padding: 16px;
}

.diagnostic-card.ok {
    border-left-color: var(--green);
}

.diagnostic-card.warning {
    border-left-color: var(--gold);
}

.diagnostic-card.bad {
    border-left-color: var(--red);
}

.diagnostic-card.unknown {
    border-left-color: var(--blue);
}

.diagnostic-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
}

.diagnostic-head h3,
.diagnostic-card p,
.diagnostic-card ol {
    margin: 0;
}

.diagnostic-card ol {
    display: grid;
    gap: 6px;
    padding-left: 22px;
    margin-top: 6px;
}

.diagnostic-related {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
    gap: 8px;
}

.diagnostic-related > div {
    display: grid;
    gap: 4px;
    border: 1px solid rgba(23, 37, 31, .12);
    border-left-width: 5px;
    border-radius: 8px;
    background: rgba(246, 241, 232, .72);
    padding: 10px;
}

.diagnostic-related > div.ok {
    border-left-color: var(--green);
}

.diagnostic-related > div.warning {
    border-left-color: var(--gold);
}

.diagnostic-related > div.bad {
    border-left-color: var(--red);
}

.diagnostic-related > div.unknown {
    border-left-color: var(--blue);
}

.diagnostic-related span {
    font-size: 20px;
    font-weight: 800;
}

.diagnostic-related small {
    color: var(--muted);
    overflow-wrap: anywhere;
}

.action-strip {
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
}

.action-strip a {
    color: var(--ink);
    text-decoration: none;
}

.trust-score-band {
    display: grid;
    gap: 14px;
    margin: 18px 0;
}

.section-heading-row {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 16px;
}

.section-heading-row h2,
.section-heading-row p {
    margin: 0;
}

.trust-score-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
    gap: 12px;
}

.trust-score-card {
    display: grid;
    min-height: 156px;
    align-content: space-between;
    gap: 8px;
    border: 1px solid rgba(23, 37, 31, .14);
    border-top-width: 7px;
    border-radius: 8px;
    background: #fff;
    color: var(--ink);
    padding: 14px;
    text-align: left;
    cursor: pointer;
}

.trust-score-card:hover,
.trust-score-card:focus-visible {
    transform: translateY(-1px);
    box-shadow: 0 12px 26px rgba(14, 59, 46, .13);
}

.trust-score-card > span {
    color: var(--muted);
    font-size: 13px;
    font-weight: 800;
}

.trust-score-card > strong {
    font-size: 42px;
    line-height: 1;
}

.trust-score-card > em {
    color: var(--deep);
    font-style: normal;
    font-weight: 800;
}

.trust-score-card > small {
    color: var(--muted);
    line-height: 1.35;
}

.trust-score-card.ok,
.score-modal-summary.ok,
.score-check.ok {
    border-color: rgba(15, 107, 79, .42);
}

.trust-score-card.ok {
    border-top-color: var(--green);
}

.trust-score-card.warning,
.score-modal-summary.warning,
.score-check.warning {
    border-color: rgba(217, 164, 65, .56);
}

.trust-score-card.warning {
    border-top-color: var(--gold);
}

.trust-score-card.bad,
.score-modal-summary.bad,
.score-check.bad {
    border-color: rgba(198, 81, 59, .62);
}

.trust-score-card.bad {
    border-top-color: var(--red);
}

.score-modal {
    width: min(760px, calc(100% - 28px));
    max-height: min(820px, calc(100vh - 36px));
    overflow: auto;
    border: 1px solid rgba(23, 37, 31, .18);
    border-radius: 12px;
    background: var(--paper);
    color: var(--ink);
    padding: 0;
    box-shadow: 0 24px 70px rgba(14, 59, 46, .28);
}

.score-modal::backdrop {
    background: rgba(14, 31, 25, .48);
}

.score-modal-head,
.modal-actions {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 14px;
    padding: 18px;
}

.score-modal-head h2,
.score-modal-head p {
    margin: 0;
}

.modal-close {
    display: grid;
    width: 38px;
    height: 38px;
    place-items: center;
    border: 1px solid rgba(23, 37, 31, .18);
    border-radius: 50%;
    background: #fff;
    color: var(--ink);
    font-size: 22px;
    cursor: pointer;
}

.score-modal-summary {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 0 18px 14px;
    border: 1px solid rgba(23, 37, 31, .14);
    border-left-width: 7px;
    border-radius: 8px;
    background: #fff;
    padding: 14px;
}

.score-modal-summary strong {
    font-size: 36px;
    line-height: 1;
}

.score-check-list {
    display: grid;
    gap: 10px;
    padding: 0 18px;
}

.score-check {
    display: grid;
    gap: 8px;
    border: 1px solid rgba(23, 37, 31, .14);
    border-left-width: 6px;
    border-radius: 8px;
    background: #fff;
    padding: 12px;
}

.score-check > div {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
}

.score-check span {
    color: var(--muted);
    font-weight: 800;
}

.score-check p,
.score-check small {
    margin: 0;
    color: var(--muted);
    line-height: 1.4;
}

.score-check small {
    color: var(--deep);
    font-weight: 700;
}

.secondary-button {
    border: 1px solid rgba(23, 37, 31, .14);
    border-radius: 8px;
    background: #fff;
    color: var(--deep);
    padding: 10px 14px;
    font-weight: 800;
    cursor: pointer;
}

.kpi-band {
    display: grid;
    gap: 14px;
}

.kpi-band h2 {
    margin-bottom: 0;
}

.kpi-grid,
.status-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
    gap: 12px;
}

.kpi-card,
.status-card {
    display: grid;
    min-height: 128px;
    align-content: space-between;
    gap: 8px;
    border: 1px solid rgba(23, 37, 31, .14);
    border-left-width: 6px;
    border-radius: 8px;
    background: white;
    color: var(--ink);
    padding: 14px;
    text-decoration: none;
}

.kpi-card > span,
.status-card > strong {
    color: var(--muted);
    font-size: 13px;
    font-weight: 800;
}

.kpi-card > strong,
.status-card > span {
    overflow-wrap: anywhere;
    font-size: 28px;
    line-height: 1.05;
}

.status-card > span {
    font-size: 24px;
    font-weight: 800;
}

.kpi-card small,
.status-card small {
    color: var(--muted);
    line-height: 1.35;
}

.kpi-card.ok,
.status-card.ok {
    border-left-color: var(--green);
}

.kpi-card.warning,
.status-card.warning {
    border-left-color: var(--gold);
}

.kpi-card.bad,
.status-card.bad {
    border-left-color: var(--red);
}

.kpi-card.unknown,
.status-card.unknown {
    border-left-color: var(--blue);
}

.smart-feature-grid {
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
}

.module-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
    gap: 12px;
}

.mini-card,
.callout {
    display: grid;
    gap: 6px;
    border: 1px solid rgba(23, 37, 31, .12);
    border-radius: 14px;
    background: rgba(255, 250, 241, .74);
    padding: 12px;
}

.button-card {
    color: var(--ink);
    text-decoration: none;
}

.callout.critical {
    border-color: rgba(198, 81, 59, .6);
    background: rgba(198, 81, 59, .12);
}

.callout.warning {
    border-color: rgba(217, 164, 65, .6);
    background: rgba(217, 164, 65, .14);
}

.inline-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    gap: 8px;
}

.inline-actions details {
    min-width: 180px;
}

.inline-actions summary {
    cursor: pointer;
    font-weight: 800;
}

.technical-details {
    border-top: 1px solid rgba(23, 37, 31, .12);
    padding: 14px 0;
}

.technical-details summary {
    cursor: pointer;
    color: var(--deep);
    font-weight: 800;
}

.technical-details h3 {
    margin: 18px 0 10px;
}

.secret-box {
    margin-bottom: 14px;
    overflow-wrap: anywhere;
    border: 1px solid rgba(23, 37, 31, .14);
    border-radius: 14px;
    background: var(--background);
    padding: 12px;
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    font-size: 13px;
}

.auth-panel {
    max-width: 920px;
    margin: 56px auto;
}

.auth-choice {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 18px;
}

.choice-card {
    display: grid;
    align-content: start;
    gap: 16px;
    border: 1px solid rgba(23, 37, 31, .12);
    border-radius: 18px;
    background: rgba(255, 250, 241, .72);
    padding: 18px;
}

.choice-card.compact {
    gap: 10px;
}

.choice-card h2,
.choice-card p {
    margin: 0;
}

.qr-frame {
    display: grid;
    place-items: center;
    width: min(100%, 280px);
    aspect-ratio: 1;
    margin: 0 auto;
    border: 1px solid rgba(23, 37, 31, .14);
    border-radius: 18px;
    background: white;
    padding: 18px;
}

.qr-frame svg {
    width: 100%;
    height: auto;
}

.manual-fallback {
    border-top: 1px solid rgba(23, 37, 31, .1);
    padding-top: 12px;
}

.manual-fallback summary {
    cursor: pointer;
    color: var(--deep);
    font-weight: 700;
}

.webauthn-status {
    min-height: 22px;
    color: var(--muted);
}

.recovery-list {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 8px;
    padding: 0;
    list-style: none;
}

.checkline {
    display: flex;
    align-items: center;
    gap: 10px;
}

.checkline input {
    width: auto;
    min-height: auto;
}

.narrow {
    max-width: 460px;
    margin: 56px auto;
}

h1,
h2 {
    margin: 0 0 18px;
}

.settings-head {
    display: flex;
    align-items: end;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 18px;
}

.settings-head.inline {
    align-items: center;
}

.button-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    min-width: min(100%, 320px);
}

.button-row form {
    width: auto;
}

.tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.tabs a {
    border: 1px solid rgba(23, 37, 31, .14);
    border-radius: 999px;
    padding: 9px 13px;
    background: var(--paper);
}

.tabs a.active {
    background: var(--green);
    color: white;
}

.stack,
.grid-form,
.filters {
    display: grid;
    gap: 14px;
}

.grid-form,
.filters {
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    align-items: end;
}

label span {
    display: block;
    margin-bottom: 6px;
    color: var(--muted);
    font-size: 14px;
}

input,
select,
textarea,
button {
    width: 100%;
    min-height: 42px;
    border: 1px solid rgba(23, 37, 31, .18);
    border-radius: 12px;
    padding: 9px 11px;
    font: inherit;
}

textarea {
    resize: vertical;
}

button {
    cursor: pointer;
    border-color: var(--green-2);
    background: var(--green);
    color: white;
    font-weight: 700;
}

.ghost {
    background: transparent;
    color: var(--deep);
}

.notice {
    margin-bottom: 18px;
    border-radius: 14px;
    padding: 12px 14px;
    background: rgba(15, 107, 79, .12);
}

.notice.error {
    background: rgba(198, 81, 59, .14);
}

.fixspor-modal {
    position: fixed;
    inset: 50% auto auto 50%;
    z-index: 1000;
    transform: translate(-50%, -50%);
    width: min(780px, calc(100% - 28px));
    max-height: min(760px, calc(100vh - 36px));
    border: 1px solid rgba(23, 37, 31, .16);
    border-radius: 18px;
    background: var(--paper);
    color: var(--ink);
    box-shadow: 0 28px 80px rgba(14, 59, 46, .26);
    padding: 20px;
    margin: 0;
}

.fixspor-modal:not([open]),
.fixspor-modal[hidden] {
    display: none;
}

.fixspor-modal::backdrop {
    background: rgba(14, 59, 46, .36);
}

body.fixspor-modal-open::before {
    content: "";
    position: fixed;
    inset: 0;
    z-index: 999;
    background: rgba(14, 59, 46, .36);
}

.fixspor-modal-head,
.fixspor-summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.fixspor-modal-head h2 {
    margin-bottom: 0;
}

.fixspor-progress {
    position: relative;
    height: 12px;
    overflow: hidden;
    border-radius: 999px;
    background: rgba(23, 37, 31, .12);
    margin: 16px 0 8px;
}

.fixspor-progress span {
    display: block;
    width: 0;
    height: 100%;
    border-radius: inherit;
    background: var(--green);
    transition: width .25s ease;
}

.fixspor-results {
    display: grid;
    gap: 10px;
    margin-top: 14px;
    overflow: auto;
    max-height: 440px;
}

.fixspor-result {
    display: grid;
    grid-template-columns: minmax(160px, 220px) auto;
    gap: 8px 12px;
    border: 1px solid rgba(23, 37, 31, .12);
    border-left-width: 5px;
    border-radius: 8px;
    background: white;
    padding: 12px;
}

.fixspor-result strong {
    overflow-wrap: anywhere;
}

.fixspor-result span {
    font-weight: 800;
}

.fixspor-result small {
    grid-column: 1 / -1;
    color: var(--muted);
    overflow-wrap: anywhere;
}

.fixspor-result.passed {
    border-left-color: var(--green);
}

.fixspor-result.warning {
    border-left-color: var(--gold);
}

.fixspor-result.failed {
    border-left-color: var(--red);
}

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

table {
    width: 100%;
    border-collapse: collapse;
}

th,
td {
    border-bottom: 1px solid rgba(23, 37, 31, .12);
    padding: 10px;
    text-align: left;
    vertical-align: top;
}

.facts {
    display: grid;
    grid-template-columns: minmax(140px, 220px) 1fr;
    gap: 10px 18px;
}

.facts dt {
    color: var(--muted);
}

.facts dd {
    margin: 0;
    overflow-wrap: anywhere;
}

.muted {
    display: block;
    color: var(--muted);
    font-size: 13px;
}

.env-group {
    border: 1px solid rgba(23, 37, 31, .12);
    border-radius: 14px;
    background: rgba(255, 250, 241, .64);
    padding: 10px 12px;
}

.env-group summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    cursor: pointer;
    font-weight: 800;
}

.env-system-tests {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 12px 0;
}

.env-system-tests button,
.button-row button {
    width: auto;
}

.mini-button {
    width: auto;
    min-height: 32px;
    margin-top: 6px;
    padding: 5px 9px;
    font-size: 13px;
}

.mini-link {
    width: auto;
    min-height: 34px;
    padding: 6px 10px;
    font-size: 13px;
}

.product-actions {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px;
}

.product-actions form {
    margin: 0;
}

.mini-action {
    display: inline-flex;
    align-items: center;
    width: auto;
    min-height: 34px;
    padding: 6px 10px;
    border: 1px solid rgba(23, 37, 31, .16);
    border-radius: 999px;
    background: var(--paper);
    color: var(--deep);
    font: inherit;
    font-size: 13px;
    font-weight: 800;
    cursor: pointer;
}

.mini-action.danger {
    border-color: rgba(198, 81, 59, .28);
    color: var(--red);
    background: rgba(198, 81, 59, .08);
}

.ghost-link {
    background: transparent;
    color: var(--deep);
}

.product-cell {
    display: grid;
    grid-template-columns: 64px minmax(0, 1fr);
    align-items: start;
    gap: 12px;
    min-width: 260px;
}

.product-cell img,
.product-placeholder,
.product-image-panel img,
.product-image-empty {
    width: 64px;
    aspect-ratio: 1;
    border: 1px solid rgba(23, 37, 31, .14);
    border-radius: 8px;
    background: white;
    object-fit: cover;
}

.product-placeholder,
.product-image-empty {
    display: grid;
    place-items: center;
    color: var(--muted);
    font-weight: 800;
}

.product-editor {
    display: grid;
    gap: 18px;
}

.product-main {
    display: grid;
    grid-template-columns: 260px minmax(0, 1fr);
    gap: 18px;
}

.product-image-panel {
    display: grid;
    align-content: start;
    gap: 12px;
}

.product-image-panel img,
.product-image-empty {
    width: 100%;
    max-width: 260px;
}

.product-visible {
    margin: 16px 0;
}

.choice-options {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.choice-options label {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-height: 36px;
    border: 1px solid rgba(23, 37, 31, .16);
    border-radius: 999px;
    background: var(--paper);
    padding: 6px 10px;
}

.choice-options input {
    width: auto;
    min-height: auto;
}

.status-light {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    white-space: nowrap;
    font-weight: 800;
}

.status-light > span {
    display: inline-block;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    box-shadow: 0 0 0 3px rgba(23, 37, 31, .08);
}

.status-light.ok {
    color: var(--green-2);
}

.status-light.ok > span {
    background: #1f9d63;
}

.status-light.bad {
    color: var(--red);
}

.status-light.bad > span {
    background: var(--red);
}

.status-light.neutral {
    color: var(--muted);
}

.status-light.neutral > span {
    background: var(--gold);
}

.env-test-output {
    margin-bottom: 14px;
}

.env-test-output pre {
    max-height: 320px;
    overflow: auto;
    border-radius: 12px;
    background: var(--background);
    padding: 12px;
    white-space: pre-wrap;
}

@media (max-width: 660px) {
    .settings-head,
    .topbar,
    .control-hero,
    .hero-actions,
    .product-main {
        align-items: stretch;
        flex-direction: column;
    }

    .product-main {
        display: grid;
        grid-template-columns: 1fr;
    }

    .hero-actions,
    .admin-search {
        grid-template-columns: 1fr;
    }

    .nav {
        justify-content: flex-start;
    }

    .facts {
        grid-template-columns: 1fr;
    }

    .button-row {
        flex-direction: column;
    }

    .button-row button {
        width: 100%;
    }
}
