#topol-sale-readiness:not([hidden]) {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
    padding: 14px 16px;
    margin-bottom: 12px;
    border: 1px solid var(--line);
    border-radius: var(--r);
    background: var(--brand-soft);
}
#topol-sale-readiness h3 { margin: 0; color: var(--brand-ink); }
#topol-sale-readiness a { color: var(--ink-inv); }

#topol-workspace { min-height: 100vh; }
#topol-workspace [hidden] { display: none !important; }
.topol-workbar { background: var(--side); color: var(--ink-inv); }
.topol-workbar-inner, .topol-workbody { width: min(100% - 48px, 1440px); margin: 0 auto; }
.topol-workbar-inner {
    min-height: 63px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
}
.topol-back { color: var(--side-ink); text-decoration: none; }
.topol-back:hover { color: var(--ink-inv); text-decoration: underline; }
.topol-brand { font-size: 15px; letter-spacing: .01em; }
.topol-shift {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 4px 10px;
    border: 1px solid var(--ok-line);
    border-radius: var(--r-full);
    color: var(--ok);
    background: var(--ok-soft);
    white-space: nowrap;
    font-weight: 600;
    font-size: 12px;
}
.topol-shift::before {
    content: "";
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: currentColor;
}
.topol-workbody { padding: 22px 0 20px; }
.topol-worktitle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 16px;
}
.topol-worktitle h1 { margin: 0; font-size: clamp(26px, 3.5vw, 34px); letter-spacing: -.035em; }
.topol-worktitle p { margin: 4px 0 0; color: var(--ink-2); }
.topol-secondary {
    background: var(--surface);
    color: var(--brand-ink);
    border: 1px solid var(--line-3);
    white-space: nowrap;
}
.topol-secondary:hover:not(:disabled) { background: var(--brand-soft); }
.topol-layout { display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; }
.topol-basket, .topol-total, .topol-access {
    border: 1px solid var(--line);
    border-radius: var(--r-lg);
    background: var(--surface);
    box-shadow: var(--shadow);
}
.topol-basket { overflow: hidden; }
.topol-basket-heading {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    flex-wrap: wrap;
    gap: 8px 18px;
    padding: 18px 20px 0;
}
.topol-basket-heading h2 { font-size: 18px; margin: 0; }
.topol-scan { padding: 14px 20px 20px; }
.topol-scan label { display: block; margin-bottom: 5px; font-size: 13px; font-weight: 600; }
.topol-scan div { display: flex; gap: 8px; align-items: stretch; }
.topol-scan input, .topol-uds-panel input {
    background: var(--surface-3);
    border: 1px solid var(--line-3);
    border-radius: var(--r-sm);
    color: var(--ink);
    flex: 1;
    font: inherit;
    min-width: 0;
    padding: 8px 10px;
}
.topol-uds-button { color: var(--brand-ink); background: var(--brand-soft); }
.topol-uds-button[aria-expanded="true"] { border-color: var(--brand); }
.topol-uds-panel {
    display: flex;
    align-items: end;
    flex-wrap: wrap;
    gap: 8px 12px;
    padding: 12px;
    margin: -4px 20px 16px;
    border: 1px solid var(--line);
    border-radius: var(--r);
    background: var(--brand-soft);
}
.topol-uds-panel label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 4px; }
.topol-uds-panel input { background: var(--surface); width: 100%; }
.topol-uds-panel p { margin: 0; color: var(--ink-2); font-size: 12px; align-self: center; }
.topol-table-scroll { overflow-x: auto; }
.topol-table {
    font-size: 14px;
    width: 100%;
    border-collapse: collapse;
    font-variant-numeric: tabular-nums;
}
.topol-table th {
    border-top: 1px solid var(--line);
    border-bottom: 1px solid var(--line);
    background: var(--surface-2);
    color: var(--ink-2);
    font-size: 12px;
    font-weight: 600;
    text-align: left;
    padding: 12px;
    white-space: nowrap;
}
.topol-table th:first-child { padding-left: 20px; width: 44%; }
.topol-table th:nth-child(n+3) { text-align: right; }
.topol-table th:last-child { padding-right: 20px; }
.topol-table td:not(.topol-empty) {
    padding: 10px 12px;
    border-bottom: 1px solid var(--line);
    overflow-wrap: anywhere;
}
.topol-table td:first-child:not(.topol-empty) { padding-left: 20px; }
.topol-table td:nth-child(n+3) { text-align: right; white-space: nowrap; }
.topol-table td:last-child:not(.topol-empty) { padding-right: 20px; }
.topol-empty {
    height: clamp(160px, 30vh, 340px);
    padding: 22px;
    text-align: center;
    color: var(--ink-2);
}
.topol-total {
    position: sticky;
    bottom: 8px;
    z-index: 1;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 10px 24px;
    padding: 10px 16px;
}
.topol-total dl {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px 24px;
    margin: 0 0 0 auto;
    line-height: 1.2;
    font-variant-numeric: tabular-nums;
}
.topol-total dt { color: var(--ink-2); font-size: 12px; }
.topol-total dd { margin: 0; white-space: nowrap; font-weight: 600; }
.topol-payable dd { font-size: 24px; color: var(--brand-ink); }
.topol-pay { white-space: nowrap; }
.topol-payment-methods {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
}
.topol-total p { margin: 0; color: var(--ink-2); font-size: 12px; }
.topol-stock { display: flex; flex-wrap: wrap; gap: 3px 8px; color: var(--ink-2); font-size: 12px; }
.topol-stock strong { color: var(--ink); }
.topol-stock .topol-stock-ok { color: var(--ok); }
.topol-access { color: var(--ink-2); margin: 0; padding: 22px; }

@media (max-width: 820px) {
    .topol-workbar-inner, .topol-workbody { width: calc(100% - 28px); }
    .topol-workbar-inner { flex-wrap: wrap; gap: 6px 12px; padding: 9px 0; }
    .topol-table { min-width: 480px; }
    .topol-total dl { margin-left: 0; }
}

#topol-test-status { margin: 0 20px 10px; font-size: 13px; color: var(--ok); }
#topol-test-status:empty { display: none; }
#topol-test-items small { display: block; color: var(--ink-2); margin-top: 3px; }
#topol-test-status.topol-check-error, #topol-uds-message.topol-check-error { color: var(--bad); }
.topol-check-actions, #topol-held-list li { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.topol-check-actions { padding: 10px 20px; border-top: 1px solid var(--line); }
#topol-held-list { margin: 0; padding: 0 20px 10px; list-style: none; }
#topol-held-list li { padding: 8px 0; border-top: 1px solid var(--line); }
#topol-held-list li span { flex: 1 1 190px; }
@media (min-height: 650px) { #topol-workspace .topol-empty { height: min(24vh, 230px); } }

#topol-test-items tr.topol-scan-blocked { background: var(--bad-soft, #fff1f0); color: var(--bad, #a32323); }
#topol-test-items tr.topol-scan-blocked small { color: inherit; }

#topol-uds-message { flex: 0 0 100%; font-size: 13px; }
#topol-uds-message:empty { display: none; }
#topol-uds-loyalty {
    display: flex;
    flex: 0 0 100%;
    min-width: 0;
    flex-wrap: wrap;
    align-items: end;
    gap: 8px 12px;
}
.topol-uds-metrics {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    flex: 1 1 19rem;
    min-width: 0;
    gap: 8px;
    margin: 0;
}
.topol-uds-metrics > div {
    min-width: 0;
    padding: 8px 10px;
    border: 1px solid var(--line-3);
    border-radius: var(--r-sm);
    background: var(--surface);
}
.topol-uds-metrics > .topol-uds-metric-limit { border-color: var(--brand); }
.topol-uds-metrics dt { color: var(--ink-2); font-size: 13px; font-weight: 650; line-height: 1.25; }
.topol-uds-metrics dd {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 3px 5px;
    margin: 4px 0 0;
    color: var(--brand-ink);
}
.topol-uds-metrics strong {
    font-size: clamp(1.25rem, 3vw, 1.65rem);
    font-variant-numeric: tabular-nums;
    line-height: 1;
    overflow-wrap: anywhere;
}
.topol-uds-metrics small { font-size: 12px; }
#topol-uds-redeem { display: flex; flex-wrap: wrap; align-items: end; gap: 8px; }
#topol-uds-points { width: 120px; }
@media (max-width: 430px) {
    .topol-uds-panel > div:first-child { flex: 1 1 8rem; min-width: 0; }
    #topol-uds-code { box-sizing: border-box; }
    #topol-uds-redeem { flex: 1 1 100%; }
    #topol-uds-redeem > div { flex: 1; min-width: 4rem; }
    #topol-uds-points { box-sizing: border-box; width: 100%; }
    .topol-layout:has(#topol-uds-panel:not([hidden])) > .topol-total { position: static; }
}
#topol-uds-preview-note { flex: 0 0 100%; margin: 0; font-size: 13px; color: var(--bad); }

.topol-receipt { display: grid; gap: 4px; font-size: 13px; }
.topol-receipt[hidden], .topol-payment-state[hidden] { display: none; }
.topol-receipt input { max-width: 100%; }
.topol-payment-state { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 8px 16px; }
.topol-payment-state p { margin: 0; flex: 1 1 210px; }
.topol-payment-state .topol-check-error { color: var(--bad); }

.topol-payment-dialog {
    width: min(30rem, calc(100vw - 2rem));
    box-sizing: border-box;
    padding: 2rem;
    border: 1px solid #dfe5ec;
    border-radius: 1rem;
    background: #fff;
    color: var(--ink, #101c2c);
    box-shadow: 0 1.5rem 4rem rgb(15 31 52 / 24%);
    text-align: center;
}

.topol-payment-dialog::backdrop {
    background: rgb(15 31 52 / 58%);
}

.topol-payment-dialog h2 {
    margin: 0;
    font-size: clamp(1.5rem, 5vw, 2rem);
}

.topol-payment-dialog-icon {
    width: 4rem;
    margin: 0 auto 1rem;
    border-radius: 50%;
    background: #dcfce7;
    color: #167347;
    font-size: 2.5rem;
    line-height: 4rem;
}

.topol-payment-dialog-paid h2 {
    color: #167347;
}

.topol-payment-dialog-amount {
    margin-top: 0.5rem;
    font-size: 1.8rem;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}

.topol-payment-dialog-status {
    margin: 0.75rem 0 1.25rem;
}

.topol-payment-dialog-actions {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.topol-worktitle-actions,
.topol-history-title {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.6rem;
}

.topol-history-dialog {
    width: min(45rem, calc(100vw - 2rem));
    max-height: min(45rem, calc(100dvh - 2rem));
    overflow: auto;
    text-align: left;
}

.topol-history-title h2 {
    font-size: clamp(1.3rem, 5vw, 1.65rem);
}

.topol-history-item {
    margin-bottom: 0.5rem;
    border: 1px solid var(--line, #dfe5ec);
    border-radius: 0.5rem;
}

.topol-history-item summary {
    padding: 0.75rem;
    cursor: pointer;
}

.topol-history-item summary strong {
    float: right;
    margin-left: 1rem;
}

.topol-history-item p {
    margin: 0.3rem 0.75rem;
}

.topol-history-item ul {
    margin: 0.75rem;
    padding: 0;
    list-style: none;
}

.topol-history-item li {
    display: grid;
    grid-template-columns: minmax(0, 1fr) max-content;
    gap: 0.75rem;
    padding: 0.5rem 0;
    border-top: 1px solid var(--line, #dfe5ec);
}

.topol-history-more {
    margin-top: 0.5rem;
}
