/*
 * SNB Business — web layout layer.
 * snb.css (identical to the mobile app's) supplies the colours, themes and components;
 * this file only adds the desktop shell: header, side navigation, journey stepper,
 * two-column pages, tables and centred dialogs. Collapses to one column on small screens.
 */

:root,
[data-theme="dark"] {
    --header-bg: rgba(6, 30, 24, 0.72);
    --nav-bg: rgba(255, 255, 255, 0.04);
    --nav-active: rgba(134, 188, 37, 0.16);
    --step-track: rgba(255, 255, 255, 0.14);
    --step-current: #FFFFFF;
    --table-head: rgba(255, 255, 255, 0.06);
}

[data-theme="light"] {
    --header-bg: rgba(255, 255, 255, 0.88);
    --nav-bg: #FFFFFF;
    --nav-active: #E4F2D4;
    --step-track: #DDE3DB;
    --step-current: #1E2B26;
    --table-head: #F3F6F1;
}

body {
    padding: 0 !important;
    background: #06201A;
}

[data-theme="light"] body {
    background: #E9EFE6;
}

/* ── Shell ── */
.web {
    min-height: 100vh;
    background: var(--bg);
    background-attachment: fixed;
    display: flex;
    flex-direction: column;
}

.web-header {
    position: sticky;
    top: 0;
    z-index: 20;
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 12px 28px;
    background: var(--header-bg);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--divider);
}

.web-brand {
    display: flex;
    align-items: center;
    gap: 14px;
}

.web-brand .wordmark b {
    font-size: 24px;
}

.web-brand-tag {
    padding-inline-start: 14px;
    border-inline-start: 1px solid var(--divider);
    color: var(--muted);
    font-size: 14px;
}

.web-header-end {
    margin-inline-start: auto;
    display: flex;
    align-items: center;
    gap: 6px;
}

.header-link {
    color: var(--muted);
    font-size: 14px;
    padding: 8px 10px;
    border-radius: 8px;
}

.header-link:hover {
    color: var(--text);
}

.user-chip {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 12px 6px 6px;
    border-radius: 24px;
    background: var(--surface);
}

.user-chip .avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--btn-bg);
    color: var(--btn-fg);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 13px;
}

.user-chip .who {
    line-height: 1.2;
}

.user-chip .who b {
    display: block;
    font-size: 13px;
}

.user-chip .who span {
    font-size: 11px;
    color: var(--muted);
}

.menu-btn {
    display: none;
}

.web-body {
    flex: 1;
    display: flex;
    min-height: 0;
}

/* Side navigation */
.web-nav {
    width: 232px;
    flex-shrink: 0;
    padding: 24px 14px;
    border-inline-end: 1px solid var(--divider);
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.nav-label {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--faint);
    padding: 14px 12px 6px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    padding: 11px 12px;
    border-radius: 10px;
    color: var(--muted);
    font-size: 15px;
    text-align: start;
}

.nav-item i {
    width: 20px;
    text-align: center;
    color: var(--accent);
}

.nav-item:hover {
    background: var(--surface);
    color: var(--text);
}

.nav-item.on {
    background: var(--nav-active);
    color: var(--text);
    font-weight: 700;
}

.web-main {
    flex: 1;
    min-width: 0;
    padding: 0 0 48px;
}

.web-page {
    max-width: 1180px;
    margin: 0 auto;
    padding: 28px 32px 0;
    display: flex;
    flex-direction: column;
    gap: 20px;
    animation: screen-in 0.22s ease-out;
}

/* ── Journey stepper (stage segments, one per sub-step) ── */
.stepper {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 14px;
    padding: 18px 32px 0;
    max-width: 1180px;
    margin: 0 auto;
}

.stage-label {
    font-size: 14px;
    font-weight: 600;
    color: var(--muted);
    text-align: center;
    margin-bottom: 10px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.stage.on .stage-label {
    color: var(--text);
    font-weight: 700;
}

.stage-segs {
    display: flex;
    gap: 4px;
}

.stage-segs span {
    flex: 1;
    height: 5px;
    border-radius: 3px;
    background: var(--step-track);
}

.stage-segs span.done {
    background: var(--accent);
}

.stage-segs span.current {
    background: var(--step-current);
}

/* ── Page header ── */
.page-head {
    display: flex;
    align-items: center;
    gap: 16px;
}

.circle-btn {
    width: 46px;
    height: 46px;
    border-radius: 50%;
    border: 1px solid var(--divider);
    background: var(--surface);
    color: var(--text);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    flex-shrink: 0;
}

.circle-btn:hover {
    border-color: var(--accent);
    color: var(--accent);
}

.crumb {
    font-size: 12px;
    color: var(--muted);
}

.page-title {
    font-size: 26px;
    font-weight: 700;
    line-height: 1.2;
}

.page-head-end {
    margin-inline-start: auto;
    display: flex;
    gap: 10px;
    align-items: center;
}

.countdown {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 12px 18px;
    border-radius: 12px;
    background: rgba(245, 196, 81, 0.16);
    color: var(--warning);
    font-weight: 700;
    font-size: 14px;
    white-space: nowrap;
}

/* Company strip shown on every journey page */
.company-strip {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 18px;
    border-radius: 14px;
    background: var(--surface);
    border: 1px solid var(--divider);
    box-shadow: var(--shadow);
}

.company-strip .name {
    font-weight: 700;
    font-size: 16px;
}

.company-strip .ar {
    font-size: 14px;
    color: var(--muted);
}

.company-strip .ids {
    margin-inline-start: auto;
    text-align: end;
    font-size: 12px;
    color: var(--muted);
    line-height: 1.6;
}

/* ── Grids ── */
.grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 18px 20px;
}

.grid-3 {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 18px;
}

.split {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 340px;
    gap: 24px;
    align-items: start;
}

.split.form-left {
    grid-template-columns: 360px minmax(0, 1fr);
}

.sticky {
    position: sticky;
    top: 96px;
}

.section-title {
    font-size: 18px;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 10px;
}

.count-pill {
    min-width: 30px;
    height: 30px;
    padding: 0 8px;
    border-radius: 15px;
    background: var(--surface-strong);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: 700;
}

/* ── Page actions (bottom of the page, right-aligned) ── */
.page-actions {
    display: flex;
    align-items: center;
    gap: 12px;
    padding-top: 20px;
    border-top: 1px solid var(--divider);
}

.page-actions .spacer {
    flex: 1;
}

.page-actions .btn {
    width: auto;
    min-width: 200px;
}

.btn.ghost {
    background: transparent;
    color: var(--muted);
    min-width: 0 !important;
}

/* ── Product cards ── */
.product {
    display: flex;
    flex-direction: column;
    gap: 12px;
    min-height: 250px;
}

.product .icon-tile {
    width: 56px;
    height: 56px;
    font-size: 26px;
}

.product p {
    color: var(--muted);
    font-size: 14px;
    line-height: 1.55;
    flex: 1;
}

.product.disabled {
    opacity: 0.6;
}

.product .pill-btn:disabled {
    background: var(--btn-disabled);
    color: var(--faint);
    cursor: not-allowed;
}

/* ── Method cards (manual vs bulk upload) ── */
.method {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 10px;
    padding: 36px 24px;
}

.method .icon-tile {
    width: 64px;
    height: 64px;
    font-size: 28px;
    margin-bottom: 6px;
}

/* ── Tables ── */
.table-wrap {
    overflow-x: auto;
    border-radius: 14px;
    border: 1px solid var(--divider);
}

table.data {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

table.data th {
    text-align: start;
    font-size: 12px;
    font-weight: 600;
    color: var(--muted);
    background: var(--table-head);
    padding: 12px 14px;
    white-space: nowrap;
}

table.data td {
    padding: 13px 14px;
    border-top: 1px solid var(--divider);
    vertical-align: middle;
}

table.data tr:hover td {
    background: var(--surface);
}

/* ── Vehicle rows (fleet list) ── */
.vrow {
    display: flex;
    align-items: stretch;
    border-radius: 12px;
    background: var(--surface);
    border: 1px solid var(--divider);
    overflow: hidden;
}

.vrow-tag {
    writing-mode: vertical-rl;
    transform: rotate(180deg);
    padding: 10px 6px;
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.08em;
    background: var(--surface-strong);
    color: var(--text);
    display: flex;
    align-items: center;
    justify-content: center;
}

.vrow-tag.comp {
    background: var(--btn-bg);
    color: var(--btn-fg);
}

.vrow-body {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 12px 14px;
    min-width: 0;
}

.vrow-select {
    width: 18px;
    height: 18px;
    accent-color: var(--btn-bg);
    flex-shrink: 0;
}

.toolbar {
    display: flex;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
}

.toolbar .link-btn {
    color: var(--accent);
    font-weight: 600;
    font-size: 14px;
    display: inline-flex;
    gap: 6px;
    align-items: center;
}

.toolbar .link-btn:disabled {
    color: var(--faint);
    cursor: not-allowed;
}

/* ── Quote group (vehicles of one cover type inside a quote) ── */
.quote-group {
    border-radius: 12px;
    background: var(--surface);
    padding: 14px 16px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.quote-side {
    border-inline-start: 1px dashed var(--divider);
    padding-inline-start: 22px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    justify-content: center;
}

.quote-body {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 260px;
    gap: 22px;
}

/* ── Summary tiles ── */
.tiles {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
}

.tile {
    text-align: center;
    border: 1px solid var(--divider);
    border-radius: 12px;
    padding: 14px;
}

.tile .stat-label {
    margin-bottom: 4px;
}

/* ── Tabs ── */
.tabs {
    display: flex;
    border-bottom: 1px solid var(--divider);
}

.tab-btn {
    flex: 1;
    padding: 12px;
    font-weight: 600;
    color: var(--muted);
    border-bottom: 3px solid transparent;
}

.tab-btn.on {
    color: var(--text);
    border-bottom-color: var(--accent);
}

/* ── IBAN checks ── */
.checks {
    display: flex;
    gap: 14px;
    flex-wrap: wrap;
    font-size: 12px;
}

.checks span {
    color: var(--danger);
}

.checks span.ok {
    color: var(--accent);
}

/* ── Dialog (desktop version of the bottom sheet) ── */
.dialog-overlay {
    position: fixed;
    inset: 0;
    background: var(--overlay);
    z-index: 60;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    animation: fade-in 0.2s;
}

.dialog {
    width: 100%;
    max-width: 520px;
    max-height: calc(100vh - 48px);
    overflow-y: auto;
    background: var(--sheet-bg);
    border-radius: 20px;
    padding: 22px 24px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    box-shadow: 0 30px 80px rgba(0, 0, 0, 0.45);
    animation: screen-in 0.2s ease-out;
}

.dialog.wide {
    max-width: 760px;
}

/* ── Responsive ── */
@media (max-width: 1080px) {
    .web-nav {
        position: fixed;
        top: 65px;
        bottom: 0;
        inset-inline-start: 0;
        z-index: 30;
        background: var(--sheet-bg);
        transform: translateX(-100%);
        transition: transform 0.2s;
    }

    [dir="rtl"] .web-nav {
        transform: translateX(100%);
    }

    .web.nav-open .web-nav {
        transform: none;
    }

    .menu-btn {
        display: inline-flex;
    }

    /* minmax(0, …) lets the column shrink below its widest child instead of overflowing */
    .split,
    .split.form-left {
        grid-template-columns: minmax(0, 1fr);
    }

    .sticky {
        position: static;
    }
}

@media (max-width: 760px) {
    .web-header {
        padding: 10px 16px;
    }

    .web-brand-tag,
    .user-chip .who,
    .header-link.lang {
        display: none;
    }

    .web-page {
        padding: 20px 16px 0;
    }

    .stepper {
        padding: 14px 16px 0;
        gap: 6px;
    }

    .stage-label {
        font-size: 0;
    }

    .stage.on .stage-label {
        font-size: 12px;
        overflow: visible;
    }

    .grid-2,
    .grid-3,
    .tiles,
    .quote-body {
        grid-template-columns: minmax(0, 1fr);
    }

    /* Quote card header: badge and terms button drop below the insurer name */
    .offer-head {
        flex-wrap: wrap;
    }

    .quote-side {
        border-inline-start: none;
        padding-inline-start: 0;
        border-top: 1px dashed var(--divider);
        padding-top: 14px;
    }

    .page-head {
        flex-wrap: wrap;
    }

    .page-head-end {
        width: 100%;
        margin-inline-start: 0;
    }

    .page-title {
        font-size: 21px;
    }

    .page-actions {
        flex-wrap: wrap;
    }

    .page-actions .btn {
        width: 100%;
    }

    .company-strip {
        flex-wrap: wrap;
    }

    .company-strip .ids {
        margin-inline-start: 0;
        text-align: start;
        width: 100%;
    }
}
