/* ==========================================================================
   Hasbul — tokens
   ========================================================================== */
:root {
    --hb-primary: #0f766e;
    --hb-primary-600: #0d9488;
    --hb-primary-50: #f0fdfa;
    --hb-primary-100: #ccfbf1;
    --hb-accent: #f59e0b;
    --hb-danger: #dc2626;
    --hb-danger-50: #fef2f2;
    --hb-warn: #b45309;
    --hb-warn-50: #fffbeb;
    --hb-success: #15803d;
    --hb-success-50: #f0fdf4;
    --hb-text: #0f172a;
    --hb-muted: #64748b;
    --hb-line: #e5e7eb;
    --hb-line-soft: #eef0f3;
    --hb-bg: #f4f6f8;
    --hb-surface: #ffffff;
    --hb-radius: 14px;
    --hb-radius-sm: 10px;
    --hb-shadow: 0 1px 2px rgba(15, 23, 42, .04), 0 4px 16px rgba(15, 23, 42, .04);
    --hb-topbar-h: 64px;
    --hb-bottomnav-h: 64px;
    --hb-font: "Inter", "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    background: var(--hb-bg);
    color: var(--hb-text);
    font-family: var(--hb-font);
    font-size: 14px;
    -webkit-font-smoothing: antialiased;
    -webkit-tap-highlight-color: transparent;
}

h1, h2, h3 { margin: 0; letter-spacing: -.01em; }
h1 { font-size: 1.6rem; font-weight: 700; }
h2 { font-size: 1.15rem; font-weight: 650; }
h3 { font-size: 1rem; font-weight: 650; }
a { color: var(--hb-primary); text-decoration: none; }

.muted { color: var(--hb-muted); }
.small { font-size: .82rem; }
.mono { font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; font-size: .92em; letter-spacing: .01em; }
.num { text-align: right; font-variant-numeric: tabular-nums; }
.text-neg { color: var(--hb-danger) !important; }
.text-warn { color: var(--hb-warn) !important; }

.card {
    background: var(--hb-surface);
    border: 1px solid var(--hb-line);
    border-radius: var(--hb-radius);
    box-shadow: var(--hb-shadow);
}

.page-loading { display: grid; place-items: center; min-height: 40vh; }

/* ==========================================================================
   Shell
   ========================================================================== */
.shell { min-height: 100vh; display: flex; flex-direction: column; }

.topbar {
    position: sticky;
    top: 0;
    z-index: 1100;
    height: var(--hb-topbar-h);
    display: flex;
    align-items: center;
    gap: 24px;
    padding: 0 24px;
    /* Solid on purpose: a backdrop-filter would make it the containing block of the
       user menu's fixed backdrop, which then would not cover the page. */
    background: #fff;
    border-bottom: 1px solid var(--hb-line);
}

.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--hb-text); font-weight: 700; font-size: 1.15rem; }
.brand-mark {
    display: grid; place-items: center;
    width: 34px; height: 34px; border-radius: 10px;
    background: linear-gradient(135deg, var(--hb-primary), var(--hb-primary-600));
    color: #fff; font-weight: 800; font-size: 1.05rem;
    box-shadow: 0 4px 12px rgba(15, 118, 110, .3);
    position: relative;
}
.brand-mark::after {
    content: ""; position: absolute; right: -3px; bottom: -3px;
    width: 10px; height: 10px; border-radius: 50%;
    background: var(--hb-accent); border: 2px solid #fff;
}

.topnav { display: flex; gap: 4px; flex: 1; }
.topnav-link {
    display: inline-flex; align-items: center; gap: 8px;
    padding: 8px 14px; border-radius: 999px;
    color: var(--hb-muted); font-weight: 550;
    transition: background .15s, color .15s;
}
.topnav-link:hover { background: var(--hb-line-soft); color: var(--hb-text); }
.topnav-link.active { background: var(--hb-primary-50); color: var(--hb-primary); }

.topbar-right { display: flex; align-items: center; gap: 12px; margin-left: auto; }

.cart-button { border-radius: 999px !important; text-transform: none !important; font-weight: 600 !important; }
.cart-count {
    display: inline-grid; place-items: center;
    min-width: 20px; height: 20px; padding: 0 6px; margin-left: 8px;
    border-radius: 999px; background: var(--hb-accent); color: #fff;
    font-size: .75rem; font-weight: 700;
}

.user-chip {
    display: inline-flex; align-items: center; gap: 10px;
    padding: 4px 8px 4px 4px; border: 1px solid var(--hb-line); border-radius: 999px;
    background: #fff; cursor: pointer; font: inherit; color: inherit;
}
.user-chip:hover { border-color: #cbd5e1; }
.user-chip-text { display: flex; flex-direction: column; align-items: flex-start; line-height: 1.15; text-align: left; }
.user-chip-text strong { font-size: .85rem; }
.user-chip-text small { font-size: .74rem; color: var(--hb-muted); }

.avatar {
    display: inline-grid; place-items: center;
    width: 32px; height: 32px; border-radius: 50%;
    background: var(--hb-primary-100); color: var(--hb-primary);
    font-weight: 700; font-size: .8rem;
}
.avatar.small { width: 28px; height: 28px; font-size: .75rem; }

.user-menu { position: relative; }
.menu-backdrop { position: fixed; inset: 0; z-index: 1300; }
.menu-panel {
    position: absolute; top: calc(100% + 8px); right: 0; z-index: 1301;
    min-width: 260px; overflow: hidden;
    background: #fff; border: 1px solid var(--hb-line); border-radius: 12px;
    box-shadow: 0 12px 32px rgba(15, 23, 42, .14);
    animation: menu-in .12s ease-out;
}
@keyframes menu-in { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }
.menu-header { display: flex; align-items: center; gap: 12px; padding: 14px 16px; border-bottom: 1px solid var(--hb-line-soft); }
.menu-header > div { display: flex; flex-direction: column; min-width: 0; }
.menu-header small { color: var(--hb-muted); }
.menu-panel form { margin: 0; }
.menu-button {
    display: flex; align-items: center; gap: 10px; width: 100%;
    padding: 10px 16px; border: 0; background: none; cursor: pointer;
    font: inherit; color: var(--hb-danger); text-align: left;
}
.menu-button:hover { background: var(--hb-danger-50); }

.content {
    width: 100%;
    max-width: 1440px;
    margin: 0 auto;
    padding: 24px;
    flex: 1;
}

.bottomnav { display: none; }

/* ==========================================================================
   Page header & toolbars
   ========================================================================== */
.page-head {
    display: flex; align-items: flex-end; justify-content: space-between; gap: 16px;
    margin-bottom: 18px;
}
.page-head h1.mono { font-size: 1.5rem; font-weight: 700; letter-spacing: .02em; }
.page-head p { margin: 6px 0 0; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.page-head-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.back-link { display: inline-flex; align-items: center; gap: 4px; color: var(--hb-muted); font-weight: 500; margin-bottom: 6px; }
.back-link:hover { color: var(--hb-primary); }
.crumb { font-weight: 600; color: var(--hb-text); }
.link-button { border: 0; background: none; color: var(--hb-primary); cursor: pointer; font: inherit; padding: 0 4px; text-decoration: underline; }

.link-btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 6px;
    height: 36px; padding: 0 14px; border-radius: 10px;
    border: 1px solid #bbf7d0; background: var(--hb-success-50); color: var(--hb-success);
    font-weight: 600; font-size: .85rem; white-space: nowrap;
}
.link-btn:hover { background: #dcfce7; }

.toolbar { padding: 12px; margin-bottom: 14px; display: flex; flex-direction: column; gap: 12px; }
.toolbar-row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }

.mode-tabs {
    display: inline-flex; gap: 4px; padding: 4px;
    background: var(--hb-line-soft); border-radius: 12px;
    overflow-x: auto; scrollbar-width: none; max-width: 100%;
}
.mode-tabs::-webkit-scrollbar { display: none; }
.mode-tab {
    display: inline-flex; align-items: center; gap: 8px; white-space: nowrap;
    padding: 8px 14px; border: 0; border-radius: 9px;
    background: transparent; color: var(--hb-muted);
    font: inherit; font-weight: 600; cursor: pointer;
    transition: background .15s, color .15s, box-shadow .15s;
}
.mode-tab:hover { color: var(--hb-text); }
.mode-tab.is-active { background: #fff; color: var(--hb-text); box-shadow: 0 1px 3px rgba(15, 23, 42, .1); }
.mode-tab.mode-missing.is-active { color: var(--hb-danger); }
.mode-tab.mode-critical.is-active { color: var(--hb-warn); }
.mode-tab.mode-all.is-active { color: var(--hb-primary); }
.mode-count {
    display: inline-grid; place-items: center;
    min-width: 22px; height: 20px; padding: 0 7px; border-radius: 999px;
    background: var(--hb-line-soft); color: inherit; font-size: .75rem; font-weight: 700;
}
.mode-tab.is-active .mode-count { background: var(--hb-primary); color: #fff; }
.mode-tab.mode-missing.is-active .mode-count { background: var(--hb-danger); }
.mode-tab.mode-critical.is-active .mode-count { background: var(--hb-warn); }
.mode-tabs.compact .mode-tab { padding: 6px 12px; }

.search-box {
    flex: 1 1 280px;
    display: flex; align-items: center; gap: 8px;
    height: 40px; padding: 0 12px;
    border: 1px solid var(--hb-line); border-radius: var(--hb-radius-sm);
    background: #fff; color: var(--hb-muted);
    transition: border-color .15s, box-shadow .15s;
}
.search-box:focus-within { border-color: var(--hb-primary); box-shadow: 0 0 0 3px rgba(15, 118, 110, .12); }
.search-box input { flex: 1; min-width: 0; border: 0; outline: 0; font: inherit; color: var(--hb-text); background: transparent; height: 100%; }
.camera-btn {
    display: inline-flex; align-items: center; gap: 6px; flex: 0 0 auto;
    height: 30px; padding: 0 10px; margin-right: -6px; border: 0; border-radius: 8px;
    background: var(--hb-primary-50); color: var(--hb-primary); font: inherit; font-weight: 600; font-size: .8rem; cursor: pointer;
}
.camera-btn:hover { background: var(--hb-primary-100); }
.camera-dialog { padding-bottom: 8px !important; }
.camera-hint { margin: 0 0 10px; }
.camera-view { width: 100%; min-height: 240px; border-radius: 12px; overflow: hidden; background: #0f172a; }
.camera-view video { width: 100% !important; height: auto !important; display: block; }

.tool-button {
    position: relative;
    display: inline-flex; align-items: center; gap: 6px;
    height: 40px; padding: 0 14px;
    border: 1px solid var(--hb-line); border-radius: var(--hb-radius-sm);
    background: #fff; color: var(--hb-text); font: inherit; font-weight: 550; cursor: pointer;
}
.tool-button:hover { border-color: #cbd5e1; }
.tool-button.is-active { border-color: var(--hb-primary); color: var(--hb-primary); background: var(--hb-primary-50); }
.tool-button .badge {
    display: inline-grid; place-items: center; min-width: 18px; height: 18px; padding: 0 5px;
    border-radius: 999px; background: var(--hb-primary); color: #fff; font-size: .7rem; font-weight: 700;
}
.tool-button .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--hb-accent); }

.sort-select { flex: 0 0 230px; margin: 0 !important; }
.sort-select .mud-input-control-input-container { background: #fff; }

.filter-panel {
    display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)) auto; gap: 10px; align-items: center;
    padding-top: 4px; border-top: 1px dashed var(--hb-line);
}

.only-mobile { display: none; }

/* ==========================================================================
   Products
   ========================================================================== */
.products-layout { display: grid; grid-template-columns: 280px minmax(0, 1fr); gap: 18px; align-items: start; }
.products-aside {
    position: sticky; top: calc(var(--hb-topbar-h) + 16px);
    max-height: calc(100vh - var(--hb-topbar-h) - 32px);
    overflow: auto; padding: 12px;
}
.products-main { min-width: 0; }

/* Category tree */
.cat-tree { display: flex; flex-direction: column; gap: 2px; }
.cat-search {
    display: flex; align-items: center; gap: 6px; height: 36px; padding: 0 10px; margin-bottom: 8px;
    border: 1px solid var(--hb-line); border-radius: 9px; color: var(--hb-muted);
}
.cat-search input { flex: 1; min-width: 0; border: 0; outline: 0; font: inherit; background: transparent; }
.cat-row { display: flex; align-items: center; gap: 2px; }
.cat-row.indent-1 { padding-left: 18px; }
.cat-row.indent-2 { padding-left: 46px; }
.cat-toggle {
    display: grid; place-items: center; flex: 0 0 26px; height: 26px;
    border: 0; border-radius: 6px; background: none; color: var(--hb-muted); cursor: pointer;
}
.cat-toggle:hover { background: var(--hb-line-soft); }
.cat-node {
    flex: 1; min-width: 0;
    display: flex; align-items: center; gap: 8px;
    padding: 7px 10px; border: 0; border-radius: 8px;
    background: none; color: var(--hb-text); font: inherit; text-align: left; cursor: pointer;
}
.cat-node:hover { background: var(--hb-line-soft); }
.cat-node.is-active { background: var(--hb-primary-50); color: var(--hb-primary); font-weight: 600; }
.cat-node.level-0 { font-weight: 600; }
.cat-node.level-1, .cat-node.level-2 { font-size: .9rem; }
.cat-node.level-all { margin-bottom: 4px; }
.cat-label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cat-count { flex: 0 0 auto; font-size: .75rem; font-weight: 600; color: var(--hb-muted); background: var(--hb-line-soft); padding: 1px 7px; border-radius: 999px; }
.cat-node.is-active .cat-count { background: var(--hb-primary-100); color: var(--hb-primary); }
.cat-empty { color: var(--hb-muted); padding: 8px; }
.category-dialog { padding: 0 8px 16px !important; }

/* Product list — one markup: table-like rows on desktop, cards on phones */
.product-list { overflow: hidden; }
.product-head, .product-row {
    display: grid;
    grid-template-columns: 36px minmax(0, 1fr) 110px 90px 90px 268px;
    gap: 12px;
    align-items: center;
    padding: 10px 16px;
}
.product-list.is-critical .product-head,
.product-list.is-critical .product-row {
    grid-template-columns: 36px minmax(0, 1fr) 100px 80px 80px 80px 80px 268px;
}
.product-head {
    background: #f8fafc; border-bottom: 1px solid var(--hb-line);
    color: var(--hb-muted); font-size: .75rem; font-weight: 650; text-transform: uppercase; letter-spacing: .04em;
}
.product-row { border-bottom: 1px solid var(--hb-line-soft); transition: background .12s; }
.product-row:last-child { border-bottom: 0; }
.product-row:hover { background: #fafbfc; }
.product-row.is-selected { background: var(--hb-primary-50); }
.pr-check { display: grid; place-items: center; }
.pr-check input { width: 17px; height: 17px; accent-color: var(--hb-primary); cursor: pointer; }
.pr-main { min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.pr-name {
    display: block; width: 100%;
    padding: 0; border: 0; background: none; cursor: pointer; text-align: left !important;
    font: inherit; font-weight: 600; color: var(--hb-text); line-height: 1.3;
}
.pr-name:hover { color: var(--hb-primary); }
.pr-meta { display: flex; gap: 6px; flex-wrap: wrap; color: var(--hb-muted); font-size: .8rem; }
.in-cart {
    align-self: flex-start;
    display: inline-flex; align-items: center; gap: 4px;
    padding: 2px 8px; border-radius: 999px;
    background: var(--hb-success-50); color: var(--hb-success); font-size: .75rem; font-weight: 600;
}
.pr-stat label { display: none; }
.pr-stat strong { font-weight: 600; font-variant-numeric: tabular-nums; }
.pr-actions, .actions-col { display: flex; align-items: center; justify-content: flex-end; gap: 8px; }

/* Quantity stepper */
.qty-stepper {
    display: inline-flex; align-items: stretch; height: 34px;
    border: 1px solid var(--hb-line); border-radius: 9px; overflow: hidden; background: #fff;
}
.qty-stepper button {
    width: 32px; border: 0; background: #f8fafc; color: var(--hb-text);
    font-size: 1.1rem; font-weight: 600; cursor: pointer;
}
.qty-stepper button:hover:not(:disabled) { background: var(--hb-line-soft); }
.qty-stepper button:disabled { color: #cbd5e1; cursor: default; }
.qty-stepper input {
    width: 52px; border: 0; border-inline: 1px solid var(--hb-line);
    text-align: center; font: inherit; font-weight: 600; outline: 0;
    -moz-appearance: textfield; appearance: textfield;
}
.qty-stepper input::-webkit-outer-spin-button,
.qty-stepper input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.qty-stepper.qty-lg { height: 44px; }
.qty-stepper.qty-lg button { width: 44px; font-size: 1.3rem; }
.qty-stepper.qty-lg input { width: 80px; font-size: 1.1rem; }

/* Unit switch */
.unit-switch { display: inline-flex; padding: 3px; gap: 2px; background: var(--hb-line-soft); border-radius: 9px; }
.unit-switch button {
    border: 0; background: none; padding: 6px 12px; border-radius: 7px;
    font: inherit; font-weight: 600; color: var(--hb-muted); cursor: pointer; white-space: nowrap;
}
.unit-switch button.is-active { background: #fff; color: var(--hb-primary); box-shadow: 0 1px 2px rgba(15, 23, 42, .1); }
.unit-switch.small button { padding: 4px 8px; font-size: .78rem; }

/* Pager */
.pager { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; padding: 14px 4px; }
.pager-right { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.page-size { width: 130px; margin: 0 !important; }

/* Bulk action bar */
.bulk-bar {
    position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%); z-index: 1200;
    display: flex; align-items: center; gap: 12px; flex-wrap: wrap; justify-content: center;
    padding: 10px 14px; border-radius: 16px;
    background: #0f172a; color: #fff; box-shadow: 0 12px 32px rgba(15, 23, 42, .3);
    max-width: calc(100vw - 24px);
}
.bulk-bar .unit-switch { background: rgba(255, 255, 255, .1); }
.bulk-bar .unit-switch button { color: #cbd5e1; }
.bulk-bar .unit-switch button.is-active { background: #fff; color: var(--hb-primary); }
.bulk-bar .mud-button-text { color: #cbd5e1 !important; }

/* Skeleton & empty */
.list-skeleton { padding: 8px 16px; }
.skeleton-row { padding: 10px 0; border-bottom: 1px solid var(--hb-line-soft); }
.empty-state {
    display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center;
    gap: 8px; padding: 48px 20px; color: var(--hb-muted);
}
.empty-state h2 { color: var(--hb-text); }
.empty-state p { margin: 0 0 8px; max-width: 420px; }

/* Dialogs */
.dialog-title { display: flex; flex-direction: column; gap: 2px; padding-right: 32px; }
.dialog-title span { font-weight: 650; line-height: 1.3; }
.dialog-title small { color: var(--hb-muted); font-family: ui-monospace, Consolas, monospace; }
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); gap: 10px; margin-bottom: 14px; }
.stat { display: flex; flex-direction: column; gap: 2px; padding: 10px 12px; border-radius: 10px; background: #f8fafc; border: 1px solid var(--hb-line-soft); }
.stat label { font-size: .72rem; text-transform: uppercase; letter-spacing: .04em; color: var(--hb-muted); font-weight: 600; }
.stat strong { font-size: 1.1rem; font-variant-numeric: tabular-nums; }
.stat small { color: var(--hb-muted); font-size: .72rem; }
.dialog-unit { margin: 0 0 12px; color: var(--hb-muted); }
.dialog-qty { display: flex; align-items: center; gap: 12px; margin-top: 14px; flex-wrap: wrap; }
.confirm-text { margin: 0; line-height: 1.55; }

/* ==========================================================================
   Cart
   ========================================================================== */
.cart-layout { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 18px; align-items: start; }
.cart-lines { overflow: hidden; }
.cart-line {
    display: grid; grid-template-columns: minmax(0, 1fr) auto 120px 36px; gap: 14px; align-items: center;
    padding: 12px 16px; border-bottom: 1px solid var(--hb-line-soft);
}
.cart-line:last-child { border-bottom: 0; }
.cl-main { min-width: 0; }
.cl-name { font-weight: 600; line-height: 1.3; }
.cl-qty { display: flex; align-items: center; gap: 8px; }
.cl-unit { display: flex; flex-direction: column; font-weight: 600; font-size: .85rem; min-width: 56px; }
.cl-unit small { font-weight: 500; color: var(--hb-muted); }
.cl-total { font-weight: 650; }
.cart-side { position: sticky; top: calc(var(--hb-topbar-h) + 16px); display: flex; flex-direction: column; gap: 14px; }
.summary, .notes { padding: 18px; }
.summary h3, .notes h3 { margin-bottom: 12px; }
.summary dl { display: grid; grid-template-columns: 1fr auto; gap: 8px 12px; margin: 0 0 8px; }
.summary dt { color: var(--hb-muted); }
.summary dd { margin: 0; text-align: right; font-weight: 600; font-variant-numeric: tabular-nums; }
.summary-total { font-size: 1.3rem; color: var(--hb-primary); }
.summary-target { display: grid; gap: 6px; padding: 12px; margin: 12px 0; border-radius: 10px; background: #f8fafc; border: 1px solid var(--hb-line-soft); }
.summary-target div { display: flex; justify-content: space-between; gap: 12px; }
.summary-target label { color: var(--hb-muted); }
.summary-target span { font-weight: 600; text-align: right; }

/* ==========================================================================
   Orders
   ========================================================================== */
.order-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 14px; }
.order-card { display: flex; flex-direction: column; gap: 14px; padding: 16px; color: inherit; transition: border-color .15s, transform .15s; }
.order-card:hover { border-color: var(--hb-primary); transform: translateY(-1px); }
.order-card-top { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.order-no { font-weight: 700; font-size: 1rem; }
.order-card-body { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.order-card-body div, .info-grid div { display: flex; flex-direction: column; gap: 2px; }
.order-card-body label, .info-grid label { font-size: .72rem; text-transform: uppercase; letter-spacing: .04em; color: var(--hb-muted); font-weight: 600; }
.order-card-body span { font-weight: 600; font-variant-numeric: tabular-nums; }
.order-card-foot { display: flex; align-items: center; gap: 6px; font-size: .82rem; border-top: 1px solid var(--hb-line-soft); padding-top: 10px; }

/* Orders: table on wide screens, cards on phones */
.orders-cards { display: none; }
.orders-table { overflow-x: auto; }
.hb-table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.hb-table th {
    text-align: left; padding: 10px 14px; background: #f8fafc; border-bottom: 1px solid var(--hb-line);
    color: var(--hb-muted); font-size: .75rem; font-weight: 650; text-transform: uppercase; letter-spacing: .04em; white-space: nowrap;
}
.hb-table td { padding: 11px 14px; border-bottom: 1px solid var(--hb-line-soft); white-space: nowrap; }
.hb-table tbody tr:hover { background: #fafbfc; }
.hb-table tfoot td { border-bottom: 0; background: #f8fafc; }
.hb-table .num { text-align: right; }
.hb-table .strong { font-weight: 650; }
.row-actions { width: 1%; text-align: right; }
.icon-link { display: inline-grid; place-items: center; width: 32px; height: 32px; border-radius: 8px; color: var(--hb-success); }
.icon-link:hover { background: var(--hb-success-50); }

.date-range { flex: 0 1 280px; min-width: 240px; }
.date-range .mud-input-control { margin: 0 !important; }
.quick-ranges { display: flex; gap: 6px; }
.chip-btn {
    height: 32px; padding: 0 12px; border-radius: 999px; border: 1px solid var(--hb-line);
    background: #fff; color: var(--hb-text); font: inherit; font-size: .8rem; font-weight: 550; cursor: pointer;
}
.chip-btn:hover { border-color: var(--hb-primary); color: var(--hb-primary); }

.status-chip, .role-chip {
    display: inline-flex; align-items: center; gap: 4px;
    padding: 3px 10px; border-radius: 999px; font-size: .75rem; font-weight: 650;
}
.status-draft { background: #eff6ff; color: #1d4ed8; }
.status-transferred { background: var(--hb-success-50); color: var(--hb-success); }
.status-passive { background: var(--hb-line-soft); color: var(--hb-muted); }
.role-admin { background: #fef2f2; color: #b91c1c; }
.role-branch { background: #eff6ff; color: #1d4ed8; }

.info-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 16px; padding: 16px; margin-bottom: 14px; }
.info-grid span { font-weight: 600; }
.span-all { grid-column: 1 / -1; }
.table-card { overflow: hidden; }
.table-card .mud-table { background: transparent; }
.clickable { cursor: pointer; }
.user-cell { display: flex; align-items: center; gap: 10px; }

/* ==========================================================================
   Admin forms
   ========================================================================== */
.form-layout { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr); gap: 18px; align-items: start; }
.form-section { padding: 20px; }
.form-section h3 { display: flex; align-items: center; gap: 8px; margin-bottom: 14px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px 16px; }
.form-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.vat-toggle { display: flex; flex-direction: column; gap: 6px; justify-content: center; }
.vat-toggle label { font-size: .8rem; color: var(--hb-muted); }
.form-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 18px; }

/* ==========================================================================
   Auth
   ========================================================================== */
.auth-page { min-height: 100vh; display: grid; grid-template-columns: 1.1fr 1fr; background: var(--hb-surface); }
.auth-side {
    display: flex; align-items: center; padding: 56px;
    background:
        radial-gradient(circle at 20% 20%, rgba(245, 158, 11, .25), transparent 40%),
        radial-gradient(circle at 80% 80%, rgba(20, 184, 166, .35), transparent 45%),
        linear-gradient(140deg, #0f766e, #134e4a);
    color: #e6fffb;
}
.auth-side-inner { max-width: 460px; }
.auth-side h1 { font-size: 2.2rem; color: #fff; margin: 28px 0 12px; }
.auth-side p { font-size: 1.05rem; line-height: 1.6; opacity: .9; }
.auth-side ul { list-style: none; padding: 0; margin: 24px 0 0; display: grid; gap: 10px; }
.auth-side li { display: flex; align-items: center; gap: 10px; }
.auth-side li::before { content: "✓"; display: grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; background: rgba(255, 255, 255, .15); font-size: .75rem; }
.brand-light { color: #fff; }
.brand-light .brand-mark { background: #fff; color: var(--hb-primary); box-shadow: none; }
.auth-main { display: grid; place-items: center; padding: 32px 20px; }
.auth-card { width: 100%; max-width: 380px; }
.auth-card h2 { font-size: 1.5rem; margin-bottom: 4px; }
.auth-card .muted { margin: 0 0 22px; }
.auth-card-brand { display: none; margin-bottom: 28px; }
.auth-form { display: flex; flex-direction: column; gap: 6px; }
.auth-form label { font-weight: 600; font-size: .85rem; margin-top: 10px; }
.auth-form input[type=text], .auth-form input[type=password], .auth-form input:not([type]) {
    height: 46px; padding: 0 14px; border: 1px solid var(--hb-line); border-radius: 10px;
    font: inherit; font-size: 1rem; outline: 0; transition: border-color .15s, box-shadow .15s;
}
.auth-form input:focus { border-color: var(--hb-primary); box-shadow: 0 0 0 3px rgba(15, 118, 110, .15); }
.auth-remember { display: flex !important; align-items: center; gap: 8px; font-weight: 500 !important; color: var(--hb-muted); }
.auth-remember input { width: 16px; height: 16px; accent-color: var(--hb-primary); }
.auth-submit {
    display: grid; place-items: center; height: 48px; margin-top: 18px;
    border: 0; border-radius: 10px; background: var(--hb-primary); color: #fff;
    font: inherit; font-weight: 650; font-size: 1rem; cursor: pointer;
    box-shadow: 0 6px 16px rgba(15, 118, 110, .3);
}
.auth-submit:hover { background: #115e59; }
.auth-link {
    display: block; width: 100%; margin-top: 16px; padding: 8px; border: 0; background: none;
    color: var(--hb-muted); font: inherit; font-size: .85rem; text-decoration: underline; cursor: pointer;
}
.auth-error { padding: 10px 14px; border-radius: 10px; background: var(--hb-danger-50); color: var(--hb-danger); border: 1px solid #fecaca; margin-bottom: 6px; }
.field-error { color: var(--hb-danger); font-size: .8rem; }

/* ==========================================================================
   Responsive
   ========================================================================== */
@media (max-width: 1280px) {
    .product-list.is-critical .product-head,
    .product-list.is-critical .product-row {
        grid-template-columns: 36px minmax(0, 1fr) 90px 70px 70px 70px 70px 240px;
    }
}

@media (max-width: 1100px) {
    .products-layout { grid-template-columns: 1fr; }
    .products-aside { display: none; }
    .only-mobile { display: inline-flex; }
    .cart-layout { grid-template-columns: 1fr; }
    .cart-side { position: static; }
    .form-layout { grid-template-columns: 1fr; }
}

@media (max-width: 900px) {
    .orders-table { display: none; }
    .orders-cards { display: grid; }
    .date-range { flex: 1 1 100%; }

    /* Product rows become cards */
    .product-head { display: none; }
    .product-row,
    .product-list.is-critical .product-row {
        grid-template-columns: 28px 1fr 1fr 1fr;
        grid-template-areas:
            "check main main main"
            ".     s1   s2   s3"
            ".     s4   s5   ."
            "act   act  act  act";
        gap: 10px 12px;
        padding: 14px;
    }
    .product-row .pr-check { grid-area: check; align-self: start; padding-top: 2px; }
    .product-row .pr-main { grid-area: main; }
    .product-row .stat-price { grid-area: s1; }
    .product-row .stat-depot { grid-area: s2; }
    .product-row .stat-branch { grid-area: s3; }
    .product-row .stat-avg { grid-area: s4; }
    .product-row .stat-days { grid-area: s5; }
    .pr-stat { text-align: left; display: flex; flex-direction: column; gap: 1px; }
    .pr-stat label { display: block; font-size: .7rem; text-transform: uppercase; letter-spacing: .04em; color: var(--hb-muted); font-weight: 600; }
    .pr-actions { grid-area: act; justify-content: stretch; padding-top: 4px; border-top: 1px dashed var(--hb-line-soft); }
    .pr-actions .qty-stepper { flex: 1; min-width: 0; height: 40px; }
    .pr-actions .qty-stepper input { flex: 1; min-width: 0; width: auto; }
    .pr-actions .qty-stepper button { flex: 0 0 40px; width: 40px; }
    .pr-actions .unit-switch { flex: 0 0 auto; }
    .pr-actions .mud-icon-button { width: 44px; height: 40px; border-radius: 10px; }
    .filter-panel { grid-template-columns: 1fr; }
    .sort-select { flex: 1 1 100%; }
}

@media (max-width: 720px) {
    :root { --hb-topbar-h: 56px; }
    .topbar { padding: 0 14px; gap: 12px; }
    .topnav, .cart-button, .user-chip-text { display: none !important; }
    .user-chip { padding: 2px; }
    .content { padding: 16px 12px; }
    .content.has-bottomnav { padding-bottom: calc(var(--hb-bottomnav-h) + 24px + env(safe-area-inset-bottom)); }
    h1 { font-size: 1.35rem; }
    .page-head { align-items: flex-start; flex-wrap: wrap; margin-bottom: 14px; }
    .page-head > div:first-child { min-width: 0; flex: 1 1 200px; }
    .info-grid { grid-template-columns: 1fr 1fr; }
    .mud-snackbar-location-bottom-center { bottom: calc(var(--hb-bottomnav-h) + 12px + env(safe-area-inset-bottom)) !important; }
    .mode-tabs:not(.compact) { display: grid; grid-template-columns: repeat(auto-fit, minmax(0, 1fr)); }
    .mode-tabs:not(.compact) .mode-tab { justify-content: center; padding: 8px 6px; gap: 5px; font-size: .82rem; }
    .mode-tabs:not(.compact) .mode-tab .mud-icon-root { display: none; }
    .hide-xs { display: none; }

    .bottomnav {
        display: grid; grid-template-columns: repeat(3, 1fr);
        position: fixed; left: 0; right: 0; bottom: 0; z-index: 1150;
        height: calc(var(--hb-bottomnav-h) + env(safe-area-inset-bottom));
        padding-bottom: env(safe-area-inset-bottom);
        background: rgba(255, 255, 255, .96); backdrop-filter: blur(10px);
        border-top: 1px solid var(--hb-line);
    }
    .bottomnav-link {
        display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
        color: var(--hb-muted); font-size: .72rem; font-weight: 600;
    }
    .bottomnav-link.active { color: var(--hb-primary); }
    .bottomnav-icon { position: relative; display: inline-flex; }
    .bottomnav-icon .cart-count { position: absolute; top: -6px; right: -14px; margin: 0; }

    .bulk-bar { bottom: calc(var(--hb-bottomnav-h) + 12px + env(safe-area-inset-bottom)); width: calc(100vw - 24px); }
    .bulk-info { width: 100%; text-align: center; }

    .cart-line { grid-template-columns: 1fr auto; grid-template-areas: "main del" "qty total"; gap: 10px; }
    .cart-line .cl-main { grid-area: main; }
    .cart-line .cl-qty { grid-area: qty; }
    .cart-line .cl-total { grid-area: total; align-self: center; }
    .cart-line .mud-icon-button { grid-area: del; align-self: start; }

    .order-grid { grid-template-columns: 1fr; }
    .form-grid { grid-template-columns: 1fr; }
    .form-actions > * { flex: 1; }

    .auth-page { grid-template-columns: 1fr; }
    .auth-side { display: none; }
    .auth-card-brand { display: inline-flex; }
}
