:root {
    --tb-bg: #f3efe8;
    --tb-panel: rgba(255, 252, 247, 0.92);
    --tb-panel-strong: #fffaf2;
    --tb-text: #25303a;
    --tb-muted: #6c7a84;
    --tb-line: rgba(37, 48, 58, 0.1);
    --tb-line-strong: rgba(37, 48, 58, 0.18);
    --tb-blue: #1360ad;
    --tb-blue-soft: #d9ebff;
    --tb-green: #11b46c;
    --tb-green-soft: #ddfff0;
    --tb-orange: #e1a33e;
    --tb-orange-soft: #fff4da;
    --tb-shadow: 0 30px 90px rgba(18, 39, 56, 0.16);
    --tb-radius-xl: 28px;
    --tb-radius-lg: 20px;
    --tb-radius-md: 14px;
}

html,
body {
    margin: 0;
    min-height: 100%;
    background:
        radial-gradient(circle at top left, rgba(19, 96, 173, 0.18), transparent 24%),
        radial-gradient(circle at right 10%, rgba(17, 180, 108, 0.15), transparent 20%),
        linear-gradient(180deg, #faf7f2 0%, #efe9de 100%);
    color: var(--tb-text);
    font-family: "Outfit", "Segoe UI", sans-serif;
}

a {
    color: inherit;
    text-decoration: none;
}

button,
input,
select,
textarea {
    font: inherit;
}

body::before {
    content: "";
    position: fixed;
    inset: 0;
    pointer-events: none;
    background-image:
        linear-gradient(rgba(19, 96, 173, 0.03) 1px, transparent 1px),
        linear-gradient(90deg, rgba(19, 96, 173, 0.03) 1px, transparent 1px);
    background-size: 48px 48px;
    mask-image: linear-gradient(180deg, rgba(0, 0, 0, 0.6), transparent);
}

.tb-shell {
    display: grid;
    grid-template-columns: 320px 1fr;
    min-height: 100vh;
}

.tb-sidebar {
    padding: 20px;
}

.tb-main {
    padding: 20px 20px 20px 0;
}

.tb-content {
    min-height: calc(100vh - 40px);
    padding: 32px;
    border: 1px solid var(--tb-line);
    border-radius: var(--tb-radius-xl);
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.9), rgba(252, 247, 240, 0.92));
    box-shadow: var(--tb-shadow);
    backdrop-filter: blur(14px);
}

.tb-nav-shell {
    display: flex;
    flex-direction: column;
    gap: 28px;
    height: calc(100vh - 40px);
    padding: 24px 22px;
    border: 1px solid var(--tb-line);
    border-radius: var(--tb-radius-xl);
    background: linear-gradient(180deg, rgba(255, 252, 247, 0.95), rgba(241, 235, 225, 0.92));
    box-shadow: var(--tb-shadow);
    position: sticky;
    top: 20px;
}

.tb-brand {
    display: grid;
    grid-template-columns: 104px minmax(0, 1fr);
    column-gap: 16px;
    align-items: center;
}

.tb-brand-logo {
    width: 104px;
    height: 104px;
    object-fit: contain;
    padding: 6px;
    border-radius: 18px;
    border: 1px solid var(--tb-line);
    background: rgba(255, 255, 255, 0.9);
    display: block;
}

.tb-brand > div {
    min-width: 0;
    padding-left: 0;
}

.tb-brand-kicker,
.tb-eyebrow,
.tb-code-label {
    margin: 0;
    color: var(--tb-muted);
    font-family: "IBM Plex Mono", Consolas, monospace;
    font-size: 0.78rem;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.tb-brand-name {
    font-size: 1.3rem;
    font-weight: 700;
}

.tb-nav-toolbar,
.tb-auth-links,
.tb-confirm-flow,
.tb-hero-actions,
.tb-form-grid,
.tb-mapping-grid,
.tb-preview-header,
.tb-page-header,
.tb-dashboard-grid,
.tb-upload-grid,
.tb-preview-grid,
.tb-grid-three,
.tb-grid-four,
.tb-mode-grid {
    display: flex;
    gap: 16px;
}

.tb-nav-toolbar {
    align-items: center;
}

.tb-nav-links {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.tb-nav-item .nav-link,
.tb-manage-link,
.tb-logout-button {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    padding: 12px 14px;
    border: 1px solid transparent;
    border-radius: 14px;
    color: var(--tb-text);
    background: transparent;
    transition: all 0.2s ease;
}

.tb-nav-item .nav-link span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 10px;
    background: rgba(19, 96, 173, 0.08);
    color: var(--tb-blue);
    font-family: "IBM Plex Mono", Consolas, monospace;
    font-size: 0.8rem;
}

.tb-nav-item .nav-link.active,
.tb-nav-item .nav-link:hover,
.tb-manage-link:hover,
.tb-logout-button:hover {
    background: rgba(19, 96, 173, 0.08);
    border-color: rgba(19, 96, 173, 0.14);
}

.tb-user-panel {
    margin-top: auto;
    padding: 18px;
    border-radius: var(--tb-radius-lg);
    border: 1px solid var(--tb-line);
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.88), rgba(244, 239, 230, 0.9));
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.55);
}

.tb-user-meta {
    display: flex;
    flex-direction: column;
    gap: 2px;
    margin-bottom: 14px;
}

.tb-user-meta strong {
    font-size: 1.05rem;
}

.tb-manage-link {
    margin-bottom: 6px;
}

.tb-user-meta small,
.tb-upload-meta small,
.tb-page-header p,
.tb-feature-card p,
.tb-action-card p,
.tb-plan-card p,
.tb-suggestion {
    color: var(--tb-muted);
}

.tb-page-header {
    flex-direction: column;
    margin-bottom: 28px;
}

.tb-page-header h1,
.tb-hero-copy h1,
.tb-auth-card h1 {
    margin: 0;
    font-size: clamp(2rem, 3vw, 3.4rem);
    line-height: 1.05;
}

.tb-page-header p:last-child,
.tb-hero-subtitle {
    max-width: 760px;
    margin: 0;
    font-size: 1.02rem;
    line-height: 1.7;
}

.tb-landing {
    display: flex;
    flex-direction: column;
    gap: 28px;
}

.tb-hero-card,
.tb-feature-card,
.tb-plan-card,
.tb-action-card,
.tb-metric-card,
.tb-wizard-section,
.tb-upload-card,
.tb-preview-card,
.tb-auth-card {
    border: 1px solid var(--tb-line);
    border-radius: var(--tb-radius-xl);
    background: var(--tb-panel);
    box-shadow: var(--tb-shadow);
}

.tb-hero-card {
    display: grid;
    grid-template-columns: 1.2fr 1fr;
    gap: 28px;
    padding: 28px;
}

.tb-hero-copy {
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.tb-hero-preview {
    display: flex;
    align-items: center;
}

.tb-window {
    width: 100%;
    border: 1px solid var(--tb-line);
    border-radius: 24px;
    overflow: hidden;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.9), rgba(246, 240, 231, 0.95));
}

.tb-window-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 18px;
    border-bottom: 1px solid var(--tb-line);
    font-family: "IBM Plex Mono", Consolas, monospace;
    color: var(--tb-muted);
}

.tb-window-header span {
    width: 12px;
    height: 12px;
    border-radius: 50%;
}

.tb-window-header span:nth-child(1) { background: #ff6a55; }
.tb-window-header span:nth-child(2) { background: #ffbf3f; }
.tb-window-header span:nth-child(3) { background: #22c36d; }

.tb-window-body {
    padding: 18px;
}

@media (max-width: 900px) {
    .tb-shell {
        grid-template-columns: 1fr;
    }

    .tb-sidebar,
    .tb-main {
        padding: 16px;
    }

    .tb-content,
    .tb-nav-shell {
        min-height: auto;
    }

    .tb-nav-shell {
        position: static;
    }
}

.tb-mock-table,
.tb-preview-table {
    width: 100%;
    border-collapse: collapse;
    font-family: "IBM Plex Mono", Consolas, monospace;
}

.tb-mock-table th,
.tb-mock-table td,
.tb-preview-table th,
.tb-preview-table td {
    padding: 12px 10px;
    border-bottom: 1px solid var(--tb-line);
    text-align: left;
    font-size: 0.86rem;
}

.tb-progress-mock,
.tb-progress {
    margin-top: 18px;
    height: 12px;
    border-radius: 999px;
    background: rgba(19, 96, 173, 0.1);
    position: relative;
    overflow: hidden;
}

.tb-progress-mock span {
    display: block;
    margin-top: 14px;
    text-align: right;
    color: var(--tb-muted);
    font-family: "IBM Plex Mono", Consolas, monospace;
    font-size: 0.82rem;
}

.tb-progress-mock-fill,
.tb-progress-fill {
    position: absolute;
    inset: 0 auto 0 0;
    width: 62%;
    border-radius: inherit;
    background: linear-gradient(90deg, var(--tb-blue), var(--tb-green));
}

.tb-grid-three {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.tb-grid-four {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 18px;
}

.tb-feature-card,
.tb-plan-card,
.tb-action-card,
.tb-metric-card,
.tb-upload-card,
.tb-preview-card {
    padding: 22px;
}

.tb-dashboard-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 18px;
    margin-bottom: 18px;
}

.tb-action-card,
.tb-wizard-section {
    overflow: hidden;
}

.tb-action-card h3,
.tb-plan-card h3,
.tb-feature-card h3,
.tb-upload-card h3,
.tb-preview-card h3 {
    margin: 8px 0 10px;
}

.tb-metric-card {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.tb-metric-card small {
    color: var(--tb-muted);
    font-family: "IBM Plex Mono", Consolas, monospace;
    text-transform: uppercase;
}

.tb-metric-value {
    font-size: 1.8rem;
    font-weight: 700;
}

.tb-wizard-section {
    margin-bottom: 20px;
    padding: 22px;
}

.tb-wizard-section header,
.tb-preview-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 18px;
}

.tb-upload-grid,
.tb-preview-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.tb-mapping-grid,
.tb-form-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.tb-mode-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 16px;
}

.tb-mode-card {
    display: flex;
    gap: 12px;
    align-items: center;
    padding: 16px 18px;
    border: 1px solid var(--tb-line);
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.7);
}

.tb-confirm-flow {
    display: flex;
    flex-wrap: wrap;
    margin-top: 20px;
}

.tb-button-primary,
.tb-button-secondary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    min-height: 46px;
    padding: 0 18px;
    border-radius: 14px;
    border: 1px solid transparent;
    cursor: pointer;
    transition: transform 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
}

.tb-button-primary {
    background: linear-gradient(135deg, var(--tb-blue), #0d4e8d);
    color: white;
    box-shadow: 0 14px 26px rgba(19, 96, 173, 0.24);
}

.tb-button-secondary {
    background: rgba(255, 255, 255, 0.72);
    color: var(--tb-text);
    border-color: var(--tb-line-strong);
}

.tb-button-primary:hover,
.tb-button-secondary:hover {
    transform: translateY(-1px);
}

.tb-button-primary:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.tb-plan-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 88px;
    min-height: 34px;
    padding: 0 12px;
    border-radius: 999px;
    font-family: "IBM Plex Mono", Consolas, monospace;
    font-size: 0.8rem;
    font-weight: 600;
}

.tb-plan-free {
    background: rgba(108, 122, 132, 0.12);
    color: var(--tb-muted);
}

.tb-plan-start {
    background: var(--tb-blue-soft);
    color: var(--tb-blue);
}

.tb-plan-pro {
    background: var(--tb-green-soft);
    color: #0a9357;
}

.tb-plan-enterprise {
    background: var(--tb-orange-soft);
    color: #aa6a00;
}

.tb-language-picker,
.form-control,
.form-select {
    width: 100%;
    min-height: 46px;
    border: 1px solid var(--tb-line-strong);
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.9);
    color: var(--tb-text);
    box-shadow: none !important;
}

.form-control:focus,
.form-select:focus,
.tb-language-picker:focus {
    border-color: rgba(19, 96, 173, 0.36);
}

.tb-preview-table-wrapper {
    margin-top: 16px;
    overflow: auto;
    border: 1px solid var(--tb-line);
    border-radius: 18px;
}

.tb-upload-meta,
.tb-inline-result {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 16px;
}

.tb-inline-result code {
    padding: 10px 12px;
    border-radius: 12px;
    background: rgba(19, 96, 173, 0.08);
    word-break: break-all;
}

.tb-simple-list,
.tb-plan-list {
    margin: 12px 0 0;
    padding-left: 18px;
    color: var(--tb-muted);
}

.tb-simple-list li {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    padding: 8px 0;
    border-bottom: 1px solid var(--tb-line);
}

.tb-simple-list li span {
    color: var(--tb-muted);
    font-size: 0.92rem;
}

.tb-state {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 10px;
    border-radius: 10px;
    font-size: 0.78rem;
    font-weight: 600;
}

.tb-state.ok {
    background: var(--tb-green-soft);
    color: #0b9c5c;
}

.tb-state.wait {
    background: var(--tb-orange-soft);
    color: #aa6a00;
}

.tb-state.info {
    background: rgba(19, 96, 173, 0.1);
    color: var(--tb-blue);
}

.tb-alert {
    margin-bottom: 16px;
    padding: 14px 16px;
    border-radius: 16px;
    border: 1px solid var(--tb-line);
}

.tb-alert.success {
    background: var(--tb-green-soft);
    color: #0d8b56;
}

.tb-alert.error {
    background: #fff0ef;
    color: #b94635;
}

.tb-auth-shell {
    display: flex;
    justify-content: center;
    padding: 32px 0;
}

.tb-auth-card {
    width: min(100%, 720px);
    padding: 28px;
}

.tb-auth-links {
    justify-content: space-between;
    margin-top: 18px;
    color: var(--tb-blue);
}

.tb-checkbox {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 12px 0;
}

#blazor-error-ui {
    display: none;
}

@media (max-width: 1180px) {
    .tb-shell {
        grid-template-columns: 1fr;
    }

    .tb-sidebar {
        padding: 20px 20px 0;
    }

    .tb-main {
        padding: 20px;
    }

    .tb-nav-shell {
        position: static;
        height: auto;
    }

    .tb-hero-card,
    .tb-upload-grid,
    .tb-preview-grid,
    .tb-grid-three,
    .tb-grid-four,
    .tb-dashboard-grid {
        grid-template-columns: 1fr 1fr;
    }
}

@media (max-width: 860px) {
    .tb-content {
        padding: 20px;
        min-height: auto;
    }

    .tb-hero-card,
    .tb-upload-grid,
    .tb-preview-grid,
    .tb-grid-three,
    .tb-grid-four,
    .tb-dashboard-grid,
    .tb-form-grid,
    .tb-mapping-grid,
    .tb-mode-grid {
        grid-template-columns: 1fr;
    }

    .tb-nav-toolbar,
    .tb-confirm-flow,
    .tb-hero-actions {
        flex-direction: column;
        align-items: stretch;
    }
}
