/* ==========================================================================
   ERP — Design system "Retail unifié"
   Domain colours: till/payment = green, stock = blue, customers = orange.
   ========================================================================== */

:root {
    /* Domain colours */
    --till: #3b8220;
    --till-hover: #2f6a19;
    --till-soft: #e6f2e0;
    --stock: #3e5e86;
    --stock-hover: #314b6c;
    --stock-soft: #e4ebf4;
    --client: #e8853b;
    --client-hover: #cf6f27;
    --client-soft: #fcefe3;

    /* Brand & secondary palette */
    --brand: #1e6fd9;
    --brand-hover: #175bb4;
    --brand-soft: #e3eefc;
    --danger: #d64545;
    --danger-hover: #b93636;
    --danger-soft: #fbe7e7;
    --warning: #e0a526;
    --warning-soft: #fdf3dc;
    --violet: #6b57a8;
    --berry: #a3306b;
    --slate: #4a5568;
    --slate-hover: #3a4352;

    /* Neutrals */
    --nav: #1b2a3d;
    --nav-hover: #24384f;
    --nav-active: #2e4865;
    --nav-text: #b8c6d8;
    --bg: #f2f4f7;
    --surface: #ffffff;
    --surface-alt: #f8f9fb;
    --surface-solid: #ffffff; /* opaque surface: dialogs, dropdowns, chart separators */
    --surface-hover: #f8f9fb;
    --row-hover: #fafbfd;
    --input-border: #cdd4dd;
    --focus-ring: rgba(30, 111, 217, .18);
    --border: #dfe4ea;
    --text: #1f2933;
    --muted: #697586;

    /* Type scale */
    --font: 'Barlow', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
    --font-title: 'Barlow Semi Condensed', 'Barlow', system-ui, sans-serif;
    --fs-title-1: 1.75rem;
    --fs-title-2: 1.25rem;
    --fs-body: 0.95rem;
    --fs-small: 0.82rem;

    --radius: 10px;
    --radius-sm: 6px;
    --shadow: 0 1px 2px rgba(16, 24, 40, .06), 0 1px 3px rgba(16, 24, 40, .08);
    --shadow-lg: 0 10px 30px rgba(16, 24, 40, .18);
    --sidebar-width: 248px;
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
    margin: 0;
    font-family: var(--font);
    font-size: var(--fs-body);
    line-height: 1.45;
    color: var(--text);
    background: var(--bg);
}

h1, h2, h3, h4 { font-family: var(--font-title); margin: 0; line-height: 1.2; }
h1 { font-size: var(--fs-title-1); font-weight: 700; }
h2 { font-size: var(--fs-title-2); font-weight: 600; }
h3 { font-size: 1.05rem; font-weight: 600; }
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
small, .caption { font-size: var(--fs-small); color: var(--muted); }
.muted { color: var(--muted); }
.nowrap { white-space: nowrap; }
.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.center { text-align: center; }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

svg.icon { width: 1.15em; height: 1.15em; flex: none; vertical-align: -0.2em; }

/* ---------- App shell ------------------------------------------------------ */

.shell { display: grid; grid-template-columns: var(--sidebar-width) 1fr; min-height: 100vh; }

.sidebar {
    background: var(--nav);
    color: var(--nav-text);
    display: flex;
    flex-direction: column;
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
}
.sidebar__brand {
    display: flex; align-items: center; gap: .6rem;
    padding: 1.1rem 1.25rem;
    color: #fff;
    font-family: var(--font-title);
    font-size: 1.2rem;
    font-weight: 700;
    letter-spacing: .02em;
    border-bottom: 1px solid rgba(255, 255, 255, .08);
}
.sidebar__brand span { color: var(--nav-text); font-weight: 500; font-size: .85rem; }
.sidebar__brand:hover { text-decoration: none; }
.sidebar__logo {
    width: 34px; height: 34px; border-radius: 8px;
    display: grid; place-items: center;
    background: linear-gradient(135deg, var(--brand), var(--till));
    color: #fff;
}
.pos--training { background: repeating-linear-gradient(-45deg, transparent 0 18px, rgba(232, 133, 59, .06) 18px 36px); }
.training-banner { border: 2px dashed var(--client); }
.sidebar__logo--image { background: #fff; padding: 3px; width: 38px; height: 38px; }
.sidebar__logo--image img { width: 100%; height: 100%; object-fit: contain; }
.nav { padding: .75rem .6rem 1.5rem; display: flex; flex-direction: column; gap: 2px; }
.nav__group {
    margin: 1rem .65rem .35rem;
    font-size: .72rem; font-weight: 600; text-transform: uppercase; letter-spacing: .08em;
    color: #7f93ad;
}
.nav__link {
    display: flex; align-items: center; gap: .7rem;
    padding: .55rem .75rem;
    border-radius: var(--radius-sm);
    color: var(--nav-text);
    font-weight: 500;
}
.nav__link:hover { background: var(--nav-hover); color: #fff; text-decoration: none; }
.nav__link.is-active { background: var(--nav-active); color: #fff; box-shadow: inset 3px 0 0 var(--brand); }
.nav__link--till .icon { color: #7fc35f; }
.nav__link--stock .icon { color: #8fb0d8; }
.nav__link--client .icon { color: #f3a86d; }

.main { min-width: 0; display: flex; flex-direction: column; }

.topbar {
    position: sticky; top: 0; z-index: 20;
    display: flex; align-items: center; gap: 1rem;
    padding: .65rem 1.75rem;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
}
.topbar__menu { display: none; }
.topbar__spacer { flex: 1; }
.topbar__user { display: flex; align-items: center; gap: .6rem; }
.avatar {
    width: 34px; height: 34px; border-radius: 50%;
    display: grid; place-items: center;
    background: var(--brand-soft); color: var(--brand);
    font-weight: 700; text-transform: uppercase;
}
.store-switch { display: flex; align-items: center; gap: .5rem; }
.store-switch select { min-width: 200px; }

.content { padding: 1.5rem 1.75rem 3rem; width: 100%; max-width: 1500px; }

.page-header {
    display: flex; align-items: flex-end; justify-content: space-between; gap: 1rem; flex-wrap: wrap;
    margin-bottom: 1.25rem;
}
.page-header p { margin: .2rem 0 0; color: var(--muted); }
.page-header__actions { display: flex; gap: .5rem; flex-wrap: wrap; }

/* ---------- Cards, grids --------------------------------------------------- */

.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}
.card__header {
    display: flex; align-items: center; justify-content: space-between; gap: .75rem;
    padding: .9rem 1.15rem;
    border-bottom: 1px solid var(--border);
}
.card__body { padding: 1.15rem; }
.card__body--flush { padding: 0; }
.card + .card { margin-top: 1.25rem; }
.grid > .card + .card { margin-top: 0; } /* grids space their cards with gap */

.grid { display: grid; gap: 1.25rem; }
.grid--kpi { grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); margin-bottom: 1.25rem; }
.grid--2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid--3-1 { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); }
.grid--stores { grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }
.stack > * + * { margin-top: 1.25rem; }

.kpi { display: flex; gap: .9rem; align-items: center; padding: 1rem 1.15rem; }
.kpi__icon {
    width: 46px; height: 46px; border-radius: 12px; flex: none;
    display: grid; place-items: center; font-size: 1.35rem;
    background: var(--brand-soft); color: var(--brand);
}
.kpi__icon--till { background: var(--till-soft); color: var(--till); }
.kpi__icon--stock { background: var(--stock-soft); color: var(--stock); }
.kpi__icon--client { background: var(--client-soft); color: var(--client); }
.kpi__icon--warning { background: var(--warning-soft); color: #a8740a; }
.kpi__label { font-size: var(--fs-small); color: var(--muted); }
.kpi__value { font-family: var(--font-title); font-size: 1.55rem; font-weight: 700; line-height: 1.1; }
.trend { font-size: var(--fs-small); font-weight: 600; }
.trend--up { color: var(--till); }
.trend--down { color: var(--danger); }

.store-card { padding: 1rem 1.1rem; display: flex; flex-direction: column; gap: .6rem; }
.store-card__head { display: flex; align-items: center; gap: .6rem; }
.store-card__head .kpi__icon { width: 36px; height: 36px; font-size: 1.05rem; }
.store-card__stats { display: grid; grid-template-columns: 1fr 1fr; gap: .5rem; }
.store-card__stats strong { display: block; font-size: 1.05rem; font-variant-numeric: tabular-nums; }
.bar { height: 6px; border-radius: 3px; background: var(--surface-alt); overflow: hidden; }
.bar > span { display: block; height: 100%; background: var(--brand); border-radius: 3px; }

.chart { position: relative; height: 300px; }
.chart--sm { height: 240px; }

/* ---------- Buttons -------------------------------------------------------- */

.btn {
    --btn-bg: var(--surface); --btn-fg: var(--text); --btn-border: var(--border); --btn-hover: var(--surface-hover);
    display: inline-flex; align-items: center; justify-content: center; gap: .45rem;
    min-height: 38px; padding: .45rem .95rem;
    border-radius: var(--radius-sm);
    border: 1px solid var(--btn-border);
    background: var(--btn-bg); color: var(--btn-fg);
    font: inherit; font-weight: 600; line-height: 1.1;
    cursor: pointer; text-decoration: none; white-space: nowrap;
    transition: background-color .12s ease, border-color .12s ease, box-shadow .12s ease;
}
.btn:hover { background: var(--btn-hover); text-decoration: none; }
.btn:focus-visible { outline: 3px solid rgba(30, 111, 217, .35); outline-offset: 1px; }
.btn:disabled, .btn.is-disabled { opacity: .45; cursor: not-allowed; pointer-events: none; }
.btn--primary { --btn-bg: var(--brand); --btn-fg: #fff; --btn-border: var(--brand); --btn-hover: var(--brand-hover); }
.btn--till { --btn-bg: var(--till); --btn-fg: #fff; --btn-border: var(--till); --btn-hover: var(--till-hover); }
.btn--stock { --btn-bg: var(--stock); --btn-fg: #fff; --btn-border: var(--stock); --btn-hover: var(--stock-hover); }
.btn--client { --btn-bg: var(--client); --btn-fg: #fff; --btn-border: var(--client); --btn-hover: var(--client-hover); }
.btn--danger { --btn-bg: var(--danger); --btn-fg: #fff; --btn-border: var(--danger); --btn-hover: var(--danger-hover); }
.btn--dark { --btn-bg: var(--slate); --btn-fg: #fff; --btn-border: var(--slate); --btn-hover: var(--slate-hover); }
.btn--ghost { --btn-bg: transparent; --btn-border: transparent; --btn-hover: var(--surface-hover); }
.btn--sm { min-height: 30px; padding: .25rem .6rem; font-size: var(--fs-small); }
.btn--lg { min-height: 56px; padding: .75rem 1.1rem; font-size: 1rem; text-transform: uppercase; letter-spacing: .02em; }
.btn--block { width: 100%; }
.btn--icon { padding: .4rem; min-width: 38px; }
.btn-group { display: flex; gap: .4rem; flex-wrap: wrap; align-items: center; }

/* ---------- Badges, alerts ------------------------------------------------- */

.badge {
    display: inline-flex; align-items: center; gap: .3rem;
    padding: .15rem .55rem; border-radius: 999px;
    font-size: .75rem; font-weight: 600;
    background: var(--surface-alt); color: var(--muted); border: 1px solid var(--border);
}
.badge--till { background: var(--till-soft); color: var(--till); border-color: transparent; }
.badge--stock { background: var(--stock-soft); color: var(--stock); border-color: transparent; }
.badge--client { background: var(--client-soft); color: var(--client-hover); border-color: transparent; }
.badge--danger { background: var(--danger-soft); color: var(--danger); border-color: transparent; }
.badge--warning { background: var(--warning-soft); color: #8a5d00; border-color: transparent; }

.alert {
    display: flex; gap: .65rem; align-items: flex-start;
    padding: .75rem 1rem; margin-bottom: 1rem;
    border-radius: var(--radius-sm); border: 1px solid transparent;
    background: var(--brand-soft); color: #144b93;
}
.alert--success { background: var(--till-soft); color: #2a5e17; }
.alert--warning { background: var(--warning-soft); color: #7a5300; }
.alert--danger, .alert--error { background: var(--danger-soft); color: #8f2626; }

.alert-list { list-style: none; margin: 0; padding: 0; }
.alert-list li { display: flex; justify-content: space-between; gap: .75rem; padding: .65rem 1.15rem; border-bottom: 1px solid var(--border); border-left: 3px solid var(--warning); }
.alert-list li.is-critical { border-left-color: var(--danger); }
.alert-list li:last-child { border-bottom: 0; }

.empty { padding: 2.5rem 1rem; text-align: center; color: var(--muted); }
.empty .icon { width: 2.5rem; height: 2.5rem; opacity: .4; display: block; margin: 0 auto .5rem; }

/* ---------- Tables --------------------------------------------------------- */

.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: .92rem; }
.table th {
    text-align: left; font-weight: 600; font-size: .78rem; text-transform: uppercase; letter-spacing: .04em;
    color: var(--muted); background: var(--surface-alt);
    padding: .6rem .9rem; border-bottom: 1px solid var(--border); white-space: nowrap;
}
.table td { padding: .6rem .9rem; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tbody tr:hover { background: var(--row-hover); }
.table tbody tr:last-child td { border-bottom: 0; }
.table tfoot td { font-weight: 700; background: var(--surface-alt); border-top: 2px solid var(--border); }
.table th.num, .table td.num { text-align: right; }
.table .actions { text-align: right; white-space: nowrap; }
.row-warning td:first-child { box-shadow: inset 3px 0 0 var(--warning); }
.row-danger td:first-child { box-shadow: inset 3px 0 0 var(--danger); }

.pagination { display: flex; gap: .3rem; justify-content: flex-end; align-items: center; padding: .75rem 1.15rem; border-top: 1px solid var(--border); }

/* ---------- Forms ---------------------------------------------------------- */

.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: .9rem 1.1rem; }
.form-grid .span-all { grid-column: 1 / -1; }
.form-row { display: flex; flex-direction: column; gap: .3rem; }
.form-row label, .label { font-weight: 600; font-size: .85rem; }
.form-row .required::after { content: ' *'; color: var(--danger); }
.form-help { font-size: var(--fs-small); color: var(--muted); }
.form-errors { margin: 0; padding: 0; list-style: none; color: var(--danger); font-size: var(--fs-small); }
.form-actions { display: flex; gap: .5rem; justify-content: flex-end; margin-top: 1.25rem; flex-wrap: wrap; }
.form-inline { display: flex; gap: .6rem; align-items: flex-end; flex-wrap: wrap; }
.form-inline .form-row { min-width: 160px; }

input[type=text], input[type=email], input[type=password], input[type=number], input[type=search],
input[type=date], input[type=tel], select, textarea {
    width: 100%;
    min-height: 38px;
    padding: .45rem .7rem;
    font: inherit;
    color: var(--text);
    background: var(--surface);
    border: 1px solid var(--input-border);
    border-radius: var(--radius-sm);
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px var(--focus-ring); }
input[aria-invalid=true], .has-error input, .has-error select { border-color: var(--danger); }
.checkbox { display: flex; align-items: center; gap: .5rem; font-weight: 500; }
.checkbox input { width: 18px; height: 18px; }
.checkbox-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: .4rem; }

.search-input { position: relative; }
.search-input .icon { position: absolute; left: .7rem; top: 50%; transform: translateY(-50%); color: var(--muted); }
.search-input input { padding-left: 2.2rem; }

/* ---------- Dialogs -------------------------------------------------------- */

dialog.modal {
    width: min(560px, calc(100vw - 2rem));
    border: 0; border-radius: var(--radius); padding: 0;
    background: var(--surface-solid); color: var(--text);
    box-shadow: var(--shadow-lg);
}
dialog.modal::backdrop { background: rgba(15, 23, 42, .45); }
.modal__header { display: flex; justify-content: space-between; align-items: center; padding: 1rem 1.2rem; border-bottom: 1px solid var(--border); }
.modal__body { padding: 1.2rem; }

/* ---------- Login ---------------------------------------------------------- */

.login {
    min-height: 100vh; display: grid; place-items: center; padding: 1rem;
    background: radial-gradient(circle at 20% 20%, #24405f 0, var(--nav) 55%);
}
.login__card { width: min(420px, 100%); padding: 2rem; }
.login__brand { display: flex; justify-content: center; margin-bottom: 1.5rem; }
.login__brand img { width: min(300px, 100%); height: auto; }

/* ---------- Till (POS) ----------------------------------------------------- */

.pos {
    display: grid;
    grid-template-columns: minmax(340px, 1.1fr) minmax(0, 1.6fr) 280px;
    grid-template-rows: auto 1fr;
    gap: 1rem;
    height: calc(100vh - 57px);
    padding: 1rem;
}
.pos__header { grid-column: 1 / -1; display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
.pos__header h1 { font-size: 1.45rem; text-transform: uppercase; }
.pos__header h1 span { text-transform: none; font-weight: 500; color: var(--muted); }
.pos__col { min-height: 0; display: flex; flex-direction: column; gap: 1rem; overflow-y: auto; }
/* Cards keep their content: the column scrolls instead of squeezing them (they overlapped). */
.pos__col > .card { flex-shrink: 0; }
.pos__col > .card.pos__products { flex: 1 0 220px; min-height: 220px; }

.ticket { display: flex; flex-direction: column; flex: 1; min-height: 0; }
.ticket__lines { flex: 1; overflow-y: auto; }
.ticket__line { display: grid; grid-template-columns: 1fr auto auto; gap: .35rem .75rem; align-items: center; padding: .6rem 1rem; border-bottom: 1px solid var(--border); }
.ticket__line.is-reward { background: var(--till-soft); }
.ticket__line.is-packaging { color: var(--muted); }
.ticket__name { font-weight: 600; }
.ticket__meta { grid-column: 1 / -1; display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; font-size: var(--fs-small); color: var(--muted); }
.ticket__total { font-weight: 700; font-variant-numeric: tabular-nums; }
.qty { display: inline-flex; align-items: center; border: 1px solid var(--border); border-radius: var(--radius-sm); overflow: hidden; }
.qty button { width: 30px; height: 30px; border: 0; background: var(--surface-alt); cursor: pointer; font-size: 1rem; font-weight: 700; color: var(--text); }
.qty button:hover { background: var(--border); }
.qty span { min-width: 34px; text-align: center; font-weight: 600; }
.ticket__summary { padding: .85rem 1rem; border-top: 1px solid var(--border); background: var(--surface-alt); border-radius: 0 0 var(--radius) var(--radius); }
.ticket__summary dl { display: grid; grid-template-columns: 1fr auto; gap: .2rem .75rem; margin: 0; font-variant-numeric: tabular-nums; }
.ticket__summary dd { margin: 0; text-align: right; }
.ticket__discount { color: var(--till); }
.ticket__pay { display: flex; justify-content: space-between; align-items: baseline; margin-top: .6rem; padding-top: .6rem; border-top: 1px dashed var(--border); font-family: var(--font-title); }
.ticket__pay strong { font-size: 2rem; }

.product-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: .6rem; overflow-y: auto; padding: .9rem; align-content: start; }
.product-tile {
    display: flex; flex-direction: column; justify-content: space-between; gap: .35rem;
    min-height: 96px; padding: .65rem;
    text-align: left; cursor: pointer;
    background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm);
    border-top: 3px solid var(--stock);
    font: inherit;
}
.product-tile:hover { border-color: var(--stock); background: var(--stock-soft); }
.product-tile__name { font-weight: 600; font-size: .88rem; line-height: 1.2; }
.product-tile__price { font-weight: 700; color: var(--stock); }
.product-tile.is-low { border-top-color: var(--warning); }

.pos-actions { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: .6rem; }
/* Long labels wrap rather than pushing the grid under the keypad. */
.pos-actions > * { min-width: 0; }
.pos-actions .btn { white-space: normal; line-height: 1.2; }

.keypad { display: grid; grid-template-columns: repeat(3, 1fr); gap: .45rem; padding: .9rem; }
.keypad__display { grid-column: 1 / -1; text-align: right; font-size: 1.4rem; font-variant-numeric: tabular-nums; }
.keypad button {
    min-height: 50px; font: inherit; font-size: 1.2rem; font-weight: 600;
    background: var(--surface-alt); border: 1px solid var(--border); border-radius: var(--radius-sm); cursor: pointer;
}
.keypad button:hover { background: var(--border); }
.keypad button.keypad__ok { background: var(--stock); color: #fff; border-color: var(--stock); }

.mini-list { list-style: none; margin: 0; padding: 0; }
.mini-list li { display: flex; justify-content: space-between; gap: .5rem; padding: .5rem 1rem; border-bottom: 1px solid var(--border); font-size: .88rem; }
.mini-list li:last-child { border-bottom: 0; }

.autocomplete { position: relative; }
.autocomplete__results {
    position: absolute; z-index: 30; left: 0; right: 0; top: calc(100% + 4px);
    max-height: 340px; overflow-y: auto;
    background: var(--surface-solid); border: 1px solid var(--border); border-radius: var(--radius-sm); box-shadow: var(--shadow-lg);
    list-style: none; margin: 0; padding: .25rem 0;
}
.autocomplete__results li { padding: .5rem .8rem; cursor: pointer; display: flex; justify-content: space-between; gap: .75rem; }
.autocomplete__results li[aria-selected=true], .autocomplete__results li:hover { background: var(--brand-soft); }

.customer-chip { display: flex; align-items: center; gap: .75rem; padding: .75rem 1rem; }
.customer-chip .avatar { background: var(--client-soft); color: var(--client-hover); }

/* ---------- Style guide ---------------------------------------------------- */

.swatches { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: .75rem; }
.swatch { border-radius: var(--radius-sm); overflow: hidden; border: 1px solid var(--border); background: var(--surface); }
.swatch__color { height: 64px; }
.swatch__label { padding: .4rem .6rem; font-size: var(--fs-small); }

/* ---------- Responsive ----------------------------------------------------- */

@media (max-width: 1280px) {
    .pos { grid-template-columns: minmax(320px, 1fr) minmax(0, 1.4fr); height: auto; }
    .pos__col--side { grid-column: 1 / -1; display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
}

@media (max-width: 960px) {
    .shell { grid-template-columns: 1fr; }
    .sidebar { position: fixed; z-index: 50; width: var(--sidebar-width); transform: translateX(-100%); transition: transform .2s ease; }
    .shell.is-nav-open .sidebar { transform: none; box-shadow: var(--shadow-lg); }
    .topbar { padding: .6rem 1rem; }
    .topbar__menu { display: inline-flex; }
    .store-switch select { min-width: 140px; }
    .content { padding: 1rem 1rem 2rem; }
    .grid--2, .grid--3-1 { grid-template-columns: 1fr; }
    .pos { grid-template-columns: 1fr; padding: .75rem; }
    .topbar__user .caption { display: none; }
}

/* Wide stock matrix (one column per store): the product name stays visible while scrolling sideways. */
.table--matrix th:first-child, .table--matrix td:first-child { position: sticky; left: 0; z-index: 1; background: var(--surface); box-shadow: 1px 0 0 var(--border); }
.table--matrix thead th:first-child, .table--matrix tfoot th:first-child { background: var(--surface-alt); }
.table--matrix .table__group th:first-child { background: var(--bg); }
.table--matrix tfoot th { border-top: 2px solid var(--border); border-bottom: 0; }

/* Group heading inside a table (liquids table: one group per category). */
.table__group th { background: var(--bg); font-size: .8rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }

/* Lead score with its reasons (real estate prospecting). */
.lead-score details { position: relative; }
.lead-score summary { cursor: pointer; list-style: none; }
.lead-score summary::-webkit-details-marker { display: none; }
.lead-signals { position: absolute; z-index: 5; left: 0; top: 1.8rem; min-width: 22rem; margin: 0; padding: .6rem .8rem; list-style: none; text-align: left; white-space: normal; background: var(--surface, #fff); border: 1px solid var(--border); border-radius: 8px; box-shadow: 0 8px 24px rgba(0, 0, 0, .12); font-size: .82rem; }
.lead-signals li { padding: .15rem 0; }
.lead-signals__plus { display: inline-block; min-width: 2.2rem; font-weight: 700; color: var(--success, #1a7f37); }
.lead-signals__minus { display: inline-block; min-width: 2.2rem; font-weight: 700; color: var(--danger); }

@media print {
    .sidebar, .topbar, .page-header__actions, .btn, .no-print { display: none !important; }
    .shell { display: block; }
    .card { box-shadow: none; }
}

/* Filter chips (pipeline steps, contact profiles); scroll sideways on a phone. */
.chips { display: flex; gap: .5rem; overflow-x: auto; padding-bottom: .25rem; margin-bottom: 1rem; scrollbar-width: none; }
.chip {
    display: inline-flex; align-items: center; gap: .4rem; white-space: nowrap;
    padding: .35rem .8rem; border: 1px solid var(--border); border-radius: 999px;
    color: var(--muted); text-decoration: none; font-size: .85rem; font-weight: 600;
}
.chip span { font-size: .75rem; opacity: .8; }
.chip:hover { color: var(--text); }
.chip.is-active { background: var(--brand-soft); border-color: var(--brand); color: var(--brand-hover, var(--brand)); }
