:root {
    --tbc-red: #ed1c24;
    --tbc-red-dark: #c9141b;
    --tbc-red-soft: #fff0f1;
    --tbc-graphite: #333436;
    --tbc-graphite-dark: #242527;
    --tbc-muted: #697077;
    --tbc-border: #e3e5e8;
    --tbc-surface: #ffffff;
    --tbc-background: #f5f6f7;
    --tbc-shadow: 0 10px 30px rgba(32, 35, 38, .07);
}

* { box-sizing: border-box; }
html { max-width: 100%; overflow-x: hidden; }
img { max-width: 100%; }

body {
    margin: 0;
    color: var(--tbc-graphite);
    background: var(--tbc-background);
    font-family: Inter, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    -webkit-font-smoothing: antialiased;
}

a { color: var(--tbc-red-dark); }
a:hover { color: var(--tbc-red); }

.app-shell { display: flex; min-height: 100vh; }
.mobile-topbar, .sidebar-backdrop, .sidebar-close { display: none; }

.sidebar {
    position: sticky;
    top: 0;
    display: flex;
    flex: 0 0 274px;
    flex-direction: column;
    width: 274px;
    height: 100vh;
    height: 100dvh;
    padding: 22px 16px 18px;
    overflow: hidden;
    color: #fff;
    background: linear-gradient(180deg, var(--tbc-graphite) 0%, var(--tbc-graphite-dark) 100%);
    border-top: 4px solid var(--tbc-red);
}

.brand-panel {
    display: block;
    flex: 0 0 auto;
    padding: 12px 14px;
    background: #fff;
    border-radius: 10px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, .14);
}

.brand-panel img { display: block; width: 100%; height: auto; }

.sidebar-product { flex: 0 0 auto; padding: 22px 10px 18px; }
.sidebar-product strong { display: block; margin-top: 3px; font-size: .98rem; font-weight: 650; }
.sidebar > .nav { flex: 1 1 auto; min-height: 0; padding-right: 2px; overflow-x: hidden; overflow-y: auto; }

.product-kicker,
.page-eyebrow,
.login-kicker {
    color: var(--tbc-red);
    font-size: .69rem;
    font-weight: 750;
    letter-spacing: .105em;
    text-transform: uppercase;
}

.sidebar .nav-link {
    display: flex;
    align-items: center;
    min-height: 44px;
    padding: .65rem .8rem;
    color: #d9dcdf;
    border-radius: 8px;
    font-size: .9rem;
    font-weight: 500;
    transition: background-color .16s ease, color .16s ease, transform .16s ease;
}

.sidebar .nav-link i { display: inline-grid; flex: 0 0 1.15rem; width: 1.15rem; color: #aeb3b8; font-size: 1rem; line-height: 1; place-items: center; }
.sidebar .nav-link:hover { color: #fff; background-color: rgba(255, 255, 255, .08); transform: translateX(2px); }
.sidebar .nav-link:hover i { color: #fff; }
.sidebar .nav-link.active { color: #fff; background: var(--tbc-red); box-shadow: 0 7px 18px rgba(237, 28, 36, .22); }
.sidebar .nav-link.active i { color: #fff; }

.sidebar-footer { flex: 0 0 auto; margin-top: 14px; padding-top: 14px; border-top: 1px solid rgba(255, 255, 255, .12); }
.user-summary { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; padding: 0 4px; }
.user-avatar { display: grid; flex: 0 0 34px; height: 34px; place-items: center; color: #fff; background: rgba(255, 255, 255, .1); border-radius: 50%; }
.user-copy { min-width: 0; }
.user-copy strong, .user-copy small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-copy strong { color: #f6f7f8; font-size: .82rem; }
.user-copy small { margin-top: 1px; color: #aeb3b8; font-size: .7rem; text-transform: capitalize; }
.btn-sidebar { color: #fff !important; background: rgba(255, 255, 255, .08); border: 1px solid rgba(255, 255, 255, .48); }
.btn-sidebar:hover, .btn-sidebar:focus { color: #fff !important; background: var(--tbc-red); border-color: var(--tbc-red); box-shadow: 0 0 0 .2rem rgba(237, 28, 36, .2); }

.app-main { flex: 1; min-width: 0; }
.page-container { width: 100%; max-width: 1540px; margin: 0 auto; padding: 32px clamp(20px, 3vw, 48px) 48px; }
.page-header { display: flex; align-items: center; justify-content: space-between; gap: 18px; margin-bottom: 28px; }
.page-header h1 { margin: 5px 0 0; color: var(--tbc-graphite-dark); font-size: clamp(1.55rem, 2.4vw, 2rem); font-weight: 700; letter-spacing: -.025em; }
.brand-mark { width: 42px; height: 4px; background: var(--tbc-red); border-radius: 10px; }

.card { overflow: hidden; border: 1px solid var(--tbc-border) !important; border-radius: 12px; box-shadow: var(--tbc-shadow) !important; }
.card-header { padding: 1rem 1.2rem; border-bottom: 1px solid var(--tbc-border); }
.card-body { padding: 1.2rem; }

.btn { border-radius: 8px; font-weight: 650; }
.btn .bi { font-size: .95em; line-height: 1; }
.btn-primary { --bs-btn-bg: var(--tbc-red); --bs-btn-border-color: var(--tbc-red); --bs-btn-hover-bg: var(--tbc-red-dark); --bs-btn-hover-border-color: var(--tbc-red-dark); --bs-btn-active-bg: var(--tbc-red-dark); --bs-btn-active-border-color: var(--tbc-red-dark); }
.btn-outline-primary { --bs-btn-color: var(--tbc-red); --bs-btn-border-color: var(--tbc-red); --bs-btn-hover-bg: var(--tbc-red); --bs-btn-hover-border-color: var(--tbc-red); --bs-btn-active-bg: var(--tbc-red-dark); --bs-btn-active-border-color: var(--tbc-red-dark); }
.bg-primary { background-color: var(--tbc-red) !important; }
.text-primary { color: var(--tbc-red) !important; }

.form-control, .form-select { min-height: 42px; border-color: #d8dade; border-radius: 8px; }
.form-control:focus, .form-select:focus { border-color: var(--tbc-red); box-shadow: 0 0 0 .22rem rgba(237, 28, 36, .12); }
.form-label { color: #4c5054; font-size: .83rem; font-weight: 650; }

.table { --bs-table-bg: transparent; margin-bottom: 0; }
.table thead th { padding: .8rem 1rem; color: #686d72; background: #f8f9fa; border-bottom-color: var(--tbc-border); font-size: .72rem; font-weight: 750; letter-spacing: .035em; text-transform: uppercase; white-space: nowrap; }
.table tbody td { padding: .9rem 1rem; color: #44484c; border-bottom-color: #eceeef; }
.table-hover > tbody > tr:hover > * { --bs-table-bg-state: #fff8f8; }
table td, table th { vertical-align: middle; }
.card-body.p-0 { overflow-x: auto; }
.card-body.p-0 > .table { min-width: 640px; }

.badge { padding: .42em .66em; border-radius: 6px; font-weight: 650; }
.text-success { color: #168157 !important; }
.text-warning { color: #b86f00 !important; }
.nav-tabs { border-bottom-color: var(--tbc-border); }
.nav-tabs .nav-link { color: var(--tbc-muted); border: 0; border-bottom: 2px solid transparent; }
.nav-tabs .nav-link:hover { color: var(--tbc-graphite); border-bottom-color: #c7cacf; }
.nav-tabs .nav-link.active { color: var(--tbc-red); background: transparent; border-bottom-color: var(--tbc-red); font-weight: 650; }

.admin-alert { border-radius: 10px; }
.admin-tabs { flex-wrap: nowrap; overflow-x: auto; overflow-y: hidden; }
.admin-tabs .nav-link { white-space: nowrap; }
.admin-editor { border-left: 4px solid var(--tbc-red) !important; }
.admin-card-heading, .admin-list-heading { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.admin-card-heading h2 { margin: 2px 0 0; color: var(--tbc-graphite-dark); font-size: 1.08rem; font-weight: 700; }
.admin-card-kicker { color: var(--tbc-red); font-size: .65rem; font-weight: 750; letter-spacing: .09em; text-transform: uppercase; }
.admin-list-heading span { color: var(--tbc-muted); font-size: .76rem; }
.admin-switch { min-height: 42px; margin: 0; padding-top: 9px; }
.admin-switch .form-check-input { margin-top: .15rem; }
.admin-switch .form-check-input:checked { background-color: var(--tbc-red); border-color: var(--tbc-red); }
.admin-switch .form-check-input:focus { border-color: var(--tbc-red); box-shadow: 0 0 0 .22rem rgba(237, 28, 36, .12); }
.admin-actions { min-width: 218px; white-space: nowrap; }
.admin-actions form { display: inline-block; margin-left: 4px; }
.admin-table { min-width: 720px; }
.admin-table code { color: #6a3840; background: #f7f0f1; padding: .22rem .4rem; border-radius: 5px; }
.form-hint { color: var(--tbc-muted); font-size: .78rem; }
.status-pill { display: inline-flex; align-items: center; gap: 6px; padding: .34rem .62rem; border-radius: 999px; font-size: .72rem; font-weight: 700; }
.status-pill::before { width: 6px; height: 6px; content: ""; border-radius: 50%; }
.status-pill.is-active { color: #116c49; background: #e8f7f0; }
.status-pill.is-active::before { background: #198754; }
.status-pill.is-inactive { color: #7a7f84; background: #eef0f2; }
.status-pill.is-inactive::before { background: #8e9499; }
.empty-state { display: flex; align-items: center; gap: 10px; margin: 0; padding: 24px; color: var(--tbc-muted); }
.empty-state i { color: var(--tbc-red); font-size: 1.2rem; }

.login-page { min-height: 100vh; background: #eef0f2; }
.login-shell { display: grid; grid-template-columns: minmax(350px, 42%) 1fr; min-height: 100vh; }
.login-brand { position: relative; display: flex; flex-direction: column; padding: clamp(30px, 5vw, 72px); overflow: hidden; color: #fff; background: linear-gradient(145deg, #3b3c3f 0%, #242527 78%); border-top: 6px solid var(--tbc-red); }
.login-brand::after { position: absolute; right: -140px; bottom: -170px; width: 430px; height: 430px; content: ""; border: 80px solid rgba(237, 28, 36, .1); border-radius: 50%; }
.login-logo { position: relative; z-index: 1; width: min(100%, 430px); height: auto; padding: 14px 18px; background: #fff; border-radius: 12px; box-shadow: 0 14px 35px rgba(0, 0, 0, .18); }
.login-brand-copy { position: relative; z-index: 1; max-width: 600px; margin: auto 0; padding: 54px 0; }
.login-brand-copy h1 { margin: 12px 0 18px; font-size: clamp(2.15rem, 4.8vw, 4.2rem); font-weight: 730; letter-spacing: -.045em; line-height: .98; }
.login-brand-copy p { max-width: 520px; margin: 0; color: #cbd0d4; font-size: clamp(.98rem, 1.4vw, 1.1rem); line-height: 1.65; }
.login-brand-footer { position: relative; z-index: 1; display: flex; align-items: center; gap: 10px; color: #9fa4a9; font-size: .76rem; font-weight: 650; letter-spacing: .08em; text-transform: uppercase; }
.login-brand-footer span { width: 28px; height: 3px; background: var(--tbc-red); }

.login-form-area { display: grid; padding: 34px; place-items: center; }
.login-card { width: min(100%, 430px); padding: clamp(28px, 4vw, 44px); background: #fff; border: 1px solid var(--tbc-border); border-radius: 16px; box-shadow: 0 22px 55px rgba(28, 31, 34, .1); }
.login-card-heading { display: flex; align-items: center; gap: 14px; margin-bottom: 30px; }
.login-card-heading h2 { margin: 3px 0 0; color: var(--tbc-graphite-dark); font-size: 1.55rem; font-weight: 700; letter-spacing: -.025em; }
.login-icon { display: grid; flex: 0 0 48px; height: 48px; color: var(--tbc-red); background: var(--tbc-red-soft); border-radius: 12px; place-items: center; font-size: 1.3rem; }
.input-with-icon { position: relative; }
.input-with-icon > i { position: absolute; top: 50%; left: 14px; z-index: 2; color: #90959a; transform: translateY(-50%); }
.input-with-icon .form-control { height: 48px; padding-left: 42px; }
.btn-login { height: 48px; }
.login-help { margin: 22px 0 0; color: #858a8f; font-size: .76rem; text-align: center; }
.alert-danger { color: #991b20; background: #fff0f1; border-color: #ffd4d6; }

@media (max-width: 1199.98px) {
    body.menu-open { overflow: hidden; }
    .app-shell { display: block; min-height: 100dvh; }
    .mobile-topbar {
        position: sticky;
        top: 0;
        z-index: 1030;
        display: flex;
        align-items: center;
        justify-content: space-between;
        min-height: 68px;
        padding: 10px 18px;
        background: #fff;
        border-top: 4px solid var(--tbc-red);
        border-bottom: 1px solid var(--tbc-border);
        box-shadow: 0 5px 20px rgba(32, 35, 38, .08);
    }
    .mobile-brand { display: block; width: 182px; }
    .mobile-brand img { display: block; width: 100%; height: auto; }
    .sidebar-toggle, .sidebar-close {
        display: grid;
        width: 42px;
        height: 42px;
        padding: 0;
        color: var(--tbc-graphite-dark);
        background: #f4f5f6;
        border: 1px solid var(--tbc-border);
        border-radius: 9px;
        place-items: center;
    }
    .sidebar-toggle .bi { font-size: 1.45rem; line-height: 1; }
    .sidebar-close {
        position: absolute;
        top: 14px;
        right: 14px;
        z-index: 2;
        width: 36px;
        height: 36px;
        color: #fff;
        background: rgba(255, 255, 255, .08);
        border-color: rgba(255, 255, 255, .18);
    }
    .sidebar-backdrop {
        position: fixed;
        inset: 0;
        z-index: 1040;
        display: block;
        visibility: hidden;
        background: rgba(20, 22, 24, .52);
        opacity: 0;
        transition: opacity .2s ease, visibility .2s ease;
    }
    .sidebar-backdrop.is-visible { visibility: visible; opacity: 1; }
    .sidebar {
        position: fixed;
        top: 0;
        left: 0;
        z-index: 1050;
        width: min(84vw, 310px);
        height: 100vh;
        height: 100dvh;
        padding: 20px 16px 18px;
        overflow-x: hidden;
        overflow-y: auto;
        transform: translateX(-105%);
        transition: transform .22s ease;
        box-shadow: 20px 0 45px rgba(0, 0, 0, .25);
    }
    .sidebar.is-open { transform: translateX(0); }
    .brand-panel { width: calc(100% - 48px); max-width: 220px; }
    .sidebar-product { padding: 18px 8px 14px; }
    .sidebar > .nav { display: flex; overflow: visible; }
    .sidebar-footer { margin-top: 18px; }
    .page-container { padding: 24px clamp(18px, 4vw, 32px) 38px; }
    .page-header { margin-bottom: 22px; }
    .page-header h1 { font-size: clamp(1.45rem, 4vw, 1.85rem); }
    .admin-card-heading { align-items: flex-start; }
    .login-shell { grid-template-columns: 1fr; }
    .login-brand { min-height: 340px; padding: 28px; }
    .login-logo { width: min(100%, 340px); }
    .login-brand-copy { padding: 48px 0 28px; }
    .login-brand-footer { display: none; }
}

@media (max-width: 575.98px) {
    .mobile-topbar { min-height: 62px; padding: 8px 14px; }
    .mobile-brand { width: 154px; }
    .sidebar-toggle { width: 40px; height: 40px; }
    .page-container { padding: 20px 14px 32px; }
    .page-header { align-items: flex-end; gap: 12px; margin-bottom: 18px; }
    .page-header h1 { font-size: 1.42rem; line-height: 1.15; }
    .page-eyebrow { font-size: .61rem; letter-spacing: .085em; }
    .brand-mark { width: 28px; }
    .card { border-radius: 10px; }
    .card-header { padding: .85rem 1rem; }
    .card-body { padding: 1rem; }
    .table { font-size: .84rem; }
    .table thead th { padding: .72rem .8rem; font-size: .66rem; }
    .table tbody td { padding: .78rem .8rem; }
    .admin-card-heading, .admin-list-heading { gap: 10px; }
    .admin-card-heading h2 { font-size: 1rem; }
    .admin-list-heading span { white-space: nowrap; }
    .admin-tabs { margin-right: -14px; padding-right: 14px; }
    .admin-tabs .nav-link { padding-right: .8rem; padding-left: .8rem; font-size: .86rem; }
    .admin-actions { min-width: 192px; }
    .admin-actions .btn { padding: .34rem .52rem; font-size: .76rem; }
    .empty-state { padding: 20px 16px; }
    .login-brand { min-height: auto; padding: 20px; }
    .login-logo { width: min(100%, 250px); }
    .login-brand-copy { padding: 28px 0 10px; }
    .login-brand-copy h1 { margin-bottom: 0; font-size: 1.8rem; line-height: 1.05; }
    .login-brand-copy p { display: none; }
    .login-form-area { padding: 20px 14px 30px; }
    .login-card { padding: 26px 22px; }
    .login-card-heading { margin-bottom: 24px; }
    .login-icon { flex-basis: 42px; height: 42px; font-size: 1.1rem; }
    .login-card-heading h2 { font-size: 1.35rem; }
}
