/* Reusable components. No inline styles anywhere: every visual state is a class. */
/* Buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 38px; padding: 7px 14px; border-radius: var(--radius-1); border: 1px solid var(--border-input); background: var(--surface); color: var(--text); font-weight: 600; text-decoration: none; line-height: 1.2; }
.btn:hover:not(:disabled) { background: var(--surface-2); color: var(--text); }
.btn-primary { background: var(--primary); border-color: var(--primary); color: var(--on-primary); }
.btn-primary:hover:not(:disabled) { background: var(--primary-strong); border-color: var(--primary-strong); color: var(--on-primary); }
.btn-ghost { border-color: transparent; background: transparent; }
.btn-danger { background: var(--danger); border-color: var(--danger); color: var(--surface); }
.btn-danger:hover:not(:disabled) { filter: brightness(.92); background: var(--danger); color: var(--surface); }
.btn-sm { min-height: 32px; padding: 4px 10px; font-size: .85rem; }
.btn-icon { padding: 0; width: 38px; min-width: 38px; position: relative; }
.btn-icon.btn-sm { width: 32px; min-width: 32px; }
.btn:disabled, .btn[aria-disabled="true"] { opacity: .55; }
.badge-dot { position: absolute; top: 3px; right: 3px; min-width: 16px; height: 16px; padding: 0 4px; border-radius: 999px; background: var(--danger); color: var(--surface); font-size: .65rem; font-weight: 700; display: grid; place-items: center; }

/* Fields */
.field { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.field > label, .field > .label, legend.label { font-size: .82rem; font-weight: 650; }
.field .hint { font-size: .78rem; color: var(--muted); }
.field .error { font-size: .8rem; color: var(--danger); display: flex; gap: 6px; align-items: flex-start; font-weight: 600; }
.input, .select, .textarea { width: 100%; min-height: 38px; padding: 7px 10px; border: 1px solid var(--border-input); border-radius: var(--radius-1); background: var(--surface); color: var(--text); }
.textarea { min-height: 88px; resize: vertical; }
.select { appearance: none; padding-right: 30px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5l5 5 5-5' fill='none' stroke='%2364748B' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 10px center; }
.input[aria-invalid="true"], .select[aria-invalid="true"], .textarea[aria-invalid="true"] { border-color: var(--danger); box-shadow: inset 0 0 0 1px var(--danger); }
.input:disabled, .select:disabled, .textarea:disabled { background: var(--surface-2); opacity: .8; }
.input-affix { position: relative; }
.input-affix .icon { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
.input-affix .input { padding-left: 34px; }
.check { display: flex; gap: 10px; align-items: flex-start; }
.check input { width: 18px; height: 18px; margin-top: 2px; accent-color: var(--primary); flex: none; }
fieldset.field { border: 0; margin: 0; padding: 0; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 16px; }
.form-section + .form-section { margin-top: 24px; padding-top: 20px; border-top: 1px solid var(--border); }
.form-section > h3 { margin-bottom: 12px; }
.form-actions { display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; margin-top: 20px; }
.error-summary { border: 1px solid var(--danger); background: var(--danger-soft); color: var(--text); border-radius: var(--radius-1); padding: 12px 14px; margin-bottom: 16px; }
.error-summary h3 { color: var(--danger); margin-bottom: 6px; }
.error-summary ul { list-style: disc; padding-left: 20px; }

/* Cards, metrics */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-2); box-shadow: var(--shadow-1); }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 18px; border-bottom: 1px solid var(--border); }
.card-body { padding: 18px; }
.metric { display: flex; gap: 14px; padding: 16px 18px; align-items: flex-start; }
.metric-icon { width: 42px; height: 42px; border-radius: 10px; display: grid; place-items: center; background: var(--primary-soft); color: var(--primary); flex: none; }
.metric-icon.is-accent { background: var(--accent-soft); color: var(--accent); }
.metric-icon.is-warning { background: var(--warning-soft); color: var(--warning); }
.metric-icon.is-danger { background: var(--danger-soft); color: var(--danger); }
.metric-icon.is-success { background: var(--success-soft); color: var(--success); }
.metric-value { font-size: 1.55rem; font-weight: 750; line-height: 1.1; font-variant-numeric: tabular-nums; }
.metric-label { font-size: .85rem; color: var(--muted); margin-top: 2px; }
.metric-delta { font-size: .78rem; margin-top: 6px; font-weight: 600; }
.metric-delta.is-up { color: var(--success); } .metric-delta.is-down { color: var(--danger); } .metric-delta.is-flat { color: var(--muted); }

/* Badges / chips */
.badge { display: inline-flex; align-items: center; gap: 5px; padding: 2px 9px; border-radius: 999px; font-size: .74rem; font-weight: 700; background: var(--surface-2); color: var(--text); border: 1px solid transparent; white-space: nowrap; }
.badge-success { background: var(--success-soft); color: var(--success); }
.badge-warning { background: var(--warning-soft); color: var(--warning); }
.badge-danger { background: var(--danger-soft); color: var(--danger); }
.badge-info { background: var(--info-soft); color: var(--info); }
.badge-accent { background: var(--accent-soft); color: var(--accent); }
.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 3px 4px 3px 10px; border-radius: 999px; background: var(--primary-soft); color: var(--text); border: 1px solid var(--border); font-size: .8rem; }
.chip button { display: grid; place-items: center; width: 22px; height: 22px; border: 0; border-radius: 50%; background: transparent; color: var(--text); }
.chip button:hover { background: var(--surface-2); }

/* Callouts and lists */
.callout { display: flex; gap: 12px; padding: 12px 14px; border-radius: var(--radius-1); border: 1px solid var(--border); background: var(--surface-2); }
.callout.is-info { background: var(--info-soft); border-color: var(--info); }
.callout.is-warning { background: var(--warning-soft); border-color: var(--warning); }
.callout.is-danger { background: var(--danger-soft); border-color: var(--danger); }
.list-plain > li { display: flex; gap: 12px; align-items: flex-start; padding: 12px 18px; border-bottom: 1px solid var(--border); }
.list-plain > li:last-child { border-bottom: 0; }
.alert-item { display: flex; gap: 12px; align-items: center; width: 100%; padding: 12px 18px; text-decoration: none; color: var(--text); border: 0; background: none; text-align: left; }
a.alert-item:hover { background: var(--surface-2); color: var(--text); }
.alert-item .icon { color: var(--warning); }
.alert-item.is-danger .icon { color: var(--danger); } .alert-item.is-info .icon { color: var(--primary); }
.alert-item .alert-text { flex: 1; min-width: 0; }
.activity-time { font-size: .76rem; color: var(--muted); white-space: nowrap; }
.quick-actions { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; padding: 14px 18px 18px; }
.quick-action { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; padding: 12px; border: 1px solid var(--border); border-radius: var(--radius-1); text-decoration: none; color: var(--text); background: var(--surface); font-weight: 600; font-size: .88rem; }
.quick-action:hover { border-color: var(--primary); background: var(--primary-soft); color: var(--text); }
.quick-action .icon { color: var(--primary); }

/* Data table */
.table-card { overflow: hidden; }
.toolbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 12px 14px; border-bottom: 1px solid var(--border); }
.toolbar .grow { flex: 1 1 220px; min-width: 180px; }
.filter-panel { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; padding: 12px 14px; border-bottom: 1px solid var(--border); background: var(--surface-2); }
.active-filters { padding: 8px 14px; border-bottom: 1px solid var(--border); display: flex; gap: 8px; align-items: center; flex-wrap: wrap; font-size: .82rem; }
.bulk-bar { display: flex; align-items: center; gap: 10px; padding: 8px 14px; background: var(--primary-soft); border-bottom: 1px solid var(--border); font-weight: 600; }
.table-wrap { overflow-x: auto; }
.data-table { width: 100%; font-size: .9rem; }
.data-table caption { text-align: left; padding: 10px 14px; font-weight: 650; }
.data-table th, .data-table td { padding: 10px 14px; text-align: left; border-bottom: 1px solid var(--border); vertical-align: middle; }
.data-table thead th { position: sticky; top: 0; background: var(--surface-2); font-size: .76rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); white-space: nowrap; z-index: 1; }
.data-table tbody tr:hover { background: var(--surface-2); }
.data-table tbody tr[aria-selected="true"] { background: var(--primary-soft); }
.data-table .is-num { text-align: right; font-variant-numeric: tabular-nums; }
.data-table .col-check { width: 40px; }
.data-table.is-compact th, .data-table.is-compact td { padding: 6px 12px; }
.sort-btn { display: inline-flex; align-items: center; gap: 6px; border: 0; background: none; padding: 0; font: inherit; color: inherit; text-transform: inherit; letter-spacing: inherit; font-weight: inherit; }
.sort-btn .icon { width: 1em; height: 1em; opacity: .5; }
th[aria-sort="ascending"] .sort-btn .icon, th[aria-sort="descending"] .sort-btn .icon { opacity: 1; color: var(--primary); }
th[aria-sort="descending"] .sort-btn .icon { transform: rotate(180deg); }
.pager { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding: 10px 14px; font-size: .85rem; color: var(--muted); }
.pager-controls { display: flex; gap: 6px; align-items: center; }
.pager .select { width: auto; min-height: 32px; padding-block: 3px; }

/* States */
.state { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 10px; padding: 44px 20px; color: var(--muted); }
.state h3 { color: var(--text); }
.state .state-icon { width: 56px; height: 56px; border-radius: 50%; display: grid; place-items: center; background: var(--surface-2); color: var(--muted); }
.state.is-error .state-icon { background: var(--danger-soft); color: var(--danger); }
.state.is-denied .state-icon { background: var(--warning-soft); color: var(--warning); }
.skeleton-row td { padding: 14px; }
.skeleton { display: block; height: 12px; border-radius: 6px; background: linear-gradient(90deg, var(--surface-2), var(--border), var(--surface-2)); background-size: 200% 100%; animation: shimmer 1.2s linear infinite; }
.skeleton.w-30 { width: 30%; } .skeleton.w-50 { width: 50%; } .skeleton.w-70 { width: 70%; } .skeleton.w-90 { width: 90%; }
@keyframes shimmer { to { background-position: -200% 0; } }

/* Dialog, menu, tabs, toast */
dialog { border: 1px solid var(--border); border-radius: var(--radius-2); background: var(--surface); color: var(--text); padding: 0; box-shadow: var(--shadow-2); width: min(560px, calc(100vw - 24px)); max-height: calc(100vh - 32px); overflow: hidden; }
dialog[open] { display: flex; flex-direction: column; }   /* header and footer stay put; only the body scrolls, never the whole dialog */
dialog.is-wide { width: min(820px, calc(100vw - 24px)); }
dialog::backdrop { background: rgba(5, 12, 24, .6); }
.dialog-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 18px; border-bottom: 1px solid var(--border); }
.dialog-body { padding: 20px 22px 22px; overflow-y: auto; flex: 1 1 auto; min-height: 0; }
.dialog-foot { display: flex; justify-content: flex-end; gap: 8px; flex-wrap: wrap; padding: 12px 18px; border-top: 1px solid var(--border); background: var(--surface-2); border-radius: 0 0 var(--radius-2) var(--radius-2); }
.menu-wrap { position: relative; display: inline-block; }
.menu { position: absolute; right: 0; top: calc(100% + 6px); z-index: 50; min-width: 220px; max-width: 320px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-1); box-shadow: var(--shadow-2); padding: 6px; }
.menu.is-left { right: auto; left: 0; }
.menu-item { display: flex; align-items: center; gap: 10px; width: 100%; min-height: 36px; padding: 6px 10px; border: 0; background: none; border-radius: 6px; text-align: left; color: var(--text); text-decoration: none; }
.menu-item:hover, .menu-item:focus-visible { background: var(--surface-2); }
.menu-item[aria-checked="true"], .menu-item[aria-current="true"] { font-weight: 700; color: var(--primary); }
.menu-item[aria-disabled="true"] { opacity: .55; }
.menu-sep { height: 1px; background: var(--border); margin: 6px 0; }
.menu-label { padding: 6px 10px 2px; font-size: .7rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.tabs [role="tablist"] { display: flex; gap: 4px; border-bottom: 1px solid var(--border); overflow-x: auto; }
.tabs [role="tab"] { border: 0; background: none; padding: 10px 14px; font-weight: 600; color: var(--muted); border-bottom: 3px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.tabs [role="tab"][aria-selected="true"] { color: var(--primary); border-bottom-color: var(--primary); }
.tabs [role="tabpanel"] { padding-top: 16px; }
.toast-region { position: fixed; right: 16px; bottom: 16px; z-index: 200; display: flex; flex-direction: column; gap: 10px; width: min(380px, calc(100vw - 32px)); }
.toast { display: flex; gap: 12px; align-items: flex-start; padding: 12px 14px; border-radius: var(--radius-1); background: var(--surface); border: 1px solid var(--border); border-left: 5px solid var(--primary); box-shadow: var(--shadow-2); }
.toast.is-success { border-left-color: var(--success); } .toast.is-warning { border-left-color: var(--warning); } .toast.is-danger { border-left-color: var(--danger); }
.toast .toast-body { flex: 1; min-width: 0; } .toast strong { display: block; }
.toast .toast-text { font-size: .86rem; color: var(--muted); }

/* Charts */
.chart { width: 100%; height: auto; display: block; }
.chart text { font-size: 12px; fill: var(--muted); font-family: var(--font); }
.chart .grid-line { stroke: var(--border); stroke-width: 1; }
.chart .axis-line { stroke: var(--border-input); stroke-width: 1; }
.chart .bar-1 { fill: var(--chart-1); } .chart .bar-2 { fill: var(--chart-2); } .chart .bar-3 { fill: var(--chart-3); } .chart .bar-4 { fill: var(--chart-4); }
.chart .line-1 { fill: none; stroke: var(--chart-2); stroke-width: 2.5; stroke-linejoin: round; stroke-linecap: round; }
.chart .dot-1 { fill: var(--surface); stroke: var(--chart-2); stroke-width: 2; }
.chart .point:focus-visible, .chart .bar-focus:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.chart-legend { display: flex; gap: 16px; flex-wrap: wrap; font-size: .8rem; color: var(--muted); margin-top: 8px; }
.chart-legend .sw { display: inline-block; width: 12px; height: 12px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }
.sw-1 { background: var(--chart-1); } .sw-2 { background: var(--chart-2); } .sw-3 { background: var(--chart-3); } .sw-4 { background: var(--chart-4); }

/* Responsive tables: rows become cards on narrow screens, labels come from data-label */
@media (max-width: 719px) {
  .data-table.is-responsive thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  .data-table.is-responsive, .data-table.is-responsive tbody, .data-table.is-responsive tr, .data-table.is-responsive td { display: block; width: 100%; }
  .data-table.is-responsive tr { padding: 10px 12px; border-bottom: 1px solid var(--border); }
  .data-table.is-responsive td { display: flex; justify-content: space-between; gap: 12px; border: 0; padding: 4px 2px; text-align: right; }
  .data-table.is-responsive td::before { content: attr(data-label); font-weight: 650; color: var(--muted); text-align: left; flex: none; }
  .data-table.is-responsive td.col-check { width: auto; }
  .data-table.is-responsive td.col-check::before { content: ""; }
  .pager { justify-content: center; }
}

/* Product composition editor (rows of components with their quantity) and the list badge */
.comp-editor { gap: var(--space-4, 1rem); }
.comp-unified-box { display: grid; border: 1px solid var(--border, #d6dde8); border-radius: var(--radius-2, .75rem); background: var(--surface); box-shadow: var(--shadow-1); overflow: hidden; }
.comp-search-bar { display: grid; gap: .45rem; padding: .85rem 1rem; background: var(--surface-2, rgba(120, 140, 170, .1)); border-bottom: 1px solid var(--border, #d6dde8); }
.comp-search-label { display: inline-flex; align-items: center; gap: .4rem; font-size: .84rem; font-weight: 650; color: var(--text); }
.comp-search-label .icon { width: 16px; height: 16px; color: var(--primary); }
.comp-list-head { display: grid; grid-template-columns: minmax(0, 1fr) 17.5rem 5.5rem; gap: .75rem; padding: .55rem 1rem; background: var(--surface-2, rgba(120, 140, 170, .06)); border-bottom: 1px solid var(--border, #d6dde8); font-size: .76rem; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.comp-rows { display: grid; gap: .5rem; }
.comp-unified-box .comp-rows { gap: 0; }
.comp-row { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: .5rem .75rem; align-items: center; padding: .65rem .85rem; border: 1px solid var(--border, #d6dde8); border-radius: var(--radius, .5rem); background: var(--surface); transition: background .12s ease; }
.comp-unified-box .comp-row { border: 0; border-bottom: 1px solid var(--border, #d6dde8); border-radius: 0; padding: .75rem 1rem; }
.comp-unified-box .comp-row:last-child { border-bottom: 0; }
.comp-row:hover { background: var(--surface-2, rgba(120, 140, 170, .05)); }
.comp-row.has-error { border-color: var(--danger, #c0392b); background: var(--danger-soft, rgba(192, 57, 43, .04)); }
.comp-name { min-width: 0; overflow-wrap: anywhere; line-height: 1.35; }
.comp-name strong { display: inline-block; margin-right: .35rem; padding: .1rem .4rem; border-radius: 4px; background: var(--surface-2, rgba(120, 140, 170, .14)); font-family: var(--font-mono); font-size: .82rem; }
.comp-qty { display: flex; align-items: center; gap: .45rem; }
.comp-qty .input { width: 7rem; text-align: right; font-weight: 600; }
.comp-qty .comp-unit-select { min-width: 9.5rem; width: auto; font-weight: 600; }
.comp-error { grid-column: 1 / -1; margin: 0; }
.comp-empty { margin: 0; padding: 1.1rem 1rem; text-align: center; }
.comp-results { display: grid; gap: .25rem; margin-top: .25rem; }
.comp-results:empty { display: none; }
.comp-pick { width: 100%; justify-content: flex-start; text-align: left; background: var(--surface); border: 1px solid var(--border); }
.comp-none { padding: .25rem .5rem; }
.text-success { color: var(--success); }
.text-danger { color: var(--danger); }
.access-list { list-style: none; margin: 0; padding: 0; display: grid; gap: .5rem; }
.access-list li { display: flex; flex-wrap: wrap; gap: .35rem .75rem; align-items: baseline; }
.party-lookup { display: grid; gap: .5rem; margin-top: .4rem; }
.party-lookup:empty { display: none; }
.party-lookup .callout { margin: 0; }
.lookup-card { display: grid; gap: .25rem; min-width: 0; overflow-wrap: anywhere; }
.lookup-line { margin: 0; display: flex; flex-wrap: wrap; gap: .35rem; align-items: center; }
.pres-rows { display: grid; gap: .65rem; }
.pres-row { display: grid; grid-template-columns: minmax(8rem, 1.2fr) minmax(6rem, .8fr) minmax(7rem, 1.2fr) minmax(6rem, .8fr) auto; gap: .55rem .75rem; align-items: end; padding: .75rem .9rem; border: 1px solid var(--border, #d6dde8); border-radius: var(--radius-2, .65rem); background: var(--surface); box-shadow: var(--shadow-1); transition: border-color .14s ease; }
.pres-row:hover { border-color: var(--border-input); }
.pres-row.has-error { border-color: var(--danger, #c0392b); }
.pres-row .field { margin: 0; }
.pres-hint, .pres-row .comp-error { grid-column: 1 / -1; margin: 0; }
.pres-hint { font-size: .8rem; color: var(--primary); font-weight: 600; }
.pres-fixed { display: inline-flex; align-items: center; min-height: 42px; padding: .35rem .65rem; border-radius: var(--radius-1, .4rem); background: var(--surface-2, rgba(120, 140, 170, .12)); font-weight: 650; font-size: .9rem; }
.pres-base { display: flex; flex-wrap: wrap; align-items: center; gap: .35rem; padding: .65rem .9rem; border-radius: var(--radius-1, .5rem); border: 1px solid var(--border); background: var(--primary-soft, rgba(11, 99, 206, .08)); }
@media (max-width: 760px) { .pres-row { grid-template-columns: 1fr 1fr; } .pres-row > button { grid-column: 1 / -1; justify-self: start; } }
.row-with-badge { display: inline-flex; flex-wrap: wrap; align-items: center; gap: .35rem; }
@media (max-width: 600px) { .comp-list-head { display: none; } .comp-row { grid-template-columns: 1fr; } .comp-qty { flex-wrap: wrap; } .comp-qty .input, .comp-qty .comp-unit-select { flex: 1 1 8rem; width: 100%; } }

/* Form dialogs (product, stock entry, customer / supplier): one narrow column, calm spacing, primary action at the end and quieter than the content. Same tokens as the rest of the interface. */
dialog.is-sm { width: min(480px, calc(100vw - 24px)); }
.dialog-head h2 { font-size: 1.08rem; letter-spacing: -.005em; }
.dialog-lead { margin: 0 0 18px; color: var(--muted); font-size: .92rem; line-height: 1.45; }
.form-stack { display: grid; gap: 18px; }
.form-stack .field { gap: 6px; }
.form-stack .field > label { font-size: .86rem; font-weight: 650; color: var(--text); }
.form-stack .input, .form-stack .select { min-height: 42px; padding: 9px 12px; font-size: .96rem; }
.form-stack .input::placeholder { color: var(--muted); opacity: .7; }
.form-stack .input:focus-visible, .form-stack .select:focus-visible { outline: 2px solid var(--focus); outline-offset: 1px; }
.form-stack .help { margin: 0; line-height: 1.35; }
.form-stack .field-error { margin: 0; display: flex; gap: 6px; align-items: flex-start; }
.form-stack .field-error::before { content: "!"; flex: none; width: 16px; height: 16px; margin-top: 1px; border-radius: 50%; background: var(--danger); color: var(--surface); font-size: .7rem; font-weight: 800; line-height: 16px; text-align: center; }
.is-code { font-family: var(--font-mono); text-transform: uppercase; letter-spacing: .02em; }
.is-code::placeholder { text-transform: none; letter-spacing: 0; font-family: var(--font); }
.form-stack .form-actions { margin-top: 4px; padding-top: 16px; border-top: 1px solid var(--border); gap: 10px; align-items: center; }
.form-actions.is-end { justify-content: flex-end; }
.form-actions.is-end > [role="status"] { margin: 0 auto 0 0; font-size: .85rem; }
.form-actions.is-end > [role="status"]:empty { display: none; }
.form-stack .form-actions .btn { min-height: 42px; padding-inline: 18px; }
.form-stack .form-actions .btn-primary { min-width: 160px; font-weight: 650; box-shadow: var(--shadow-1); }
.form-stack .form-actions .btn-primary[aria-busy="true"] { cursor: progress; }
.form-stack .form-actions .btn-ghost { color: var(--muted); }
.form-stack .form-actions .btn-ghost:hover:not(:disabled) { color: var(--text); background: var(--surface-2); }
.form-note { display: flex; gap: 8px; align-items: flex-start; margin: 2px 0 0; color: var(--muted); font-size: .8rem; line-height: 1.4; }
.form-note .icon { flex: none; width: 15px; height: 15px; margin-top: 1px; color: var(--accent); }
@media (max-width: 560px) {
  dialog.is-sm, dialog { width: calc(100vw - 16px); }
  .dialog-body { padding: 16px; }
  .form-stack .form-actions.is-end { flex-direction: column-reverse; align-items: stretch; }
  .form-stack .form-actions .btn { width: 100%; }
}

/* the buttons stay reachable while the (long, on a phone) body scrolls */
.dialog-body .form-stack .form-actions { position: sticky; bottom: -22px; z-index: 1; background: var(--surface); padding-bottom: 6px; }
.media-logo { max-width: 240px; max-height: 120px; object-fit: contain; border: 1px solid var(--border, #d0d5dd); border-radius: 6px; padding: .5rem; background: #fff; }
.media-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: .75rem; }
.media-item { margin: 0; display: grid; gap: .4rem; justify-items: start; }
.media-item img { width: 100%; aspect-ratio: 1 / 1; object-fit: cover; border: 1px solid var(--border, #d0d5dd); border-radius: 6px; background: #fff; }

/* Reports: the list of reports, the filter card with quick periods, signed amounts */
.report-grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }
.report-card { display: flex; gap: 14px; padding: 16px 18px; align-items: flex-start; color: inherit; text-decoration: none; }
.report-card:hover, .report-card:focus-visible { border-color: var(--primary); }
.report-card h3 { font-size: 1rem; margin: 0 0 4px; }
.report-card p { margin: 0; color: var(--muted); font-size: .85rem; }
.report-filters { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); align-items: end; }
.report-presets { display: flex; flex-wrap: wrap; gap: 6px; }
.num-neg { color: var(--danger); font-weight: 650; }
.num-pos { color: var(--success); font-weight: 650; }

/* ---------- Point of sale (Punto de venta): a full-window dialog, products as tiles on the left, tickets on the right ---------- */
dialog.pos-dialog { width: 100vw; height: 100vh; max-width: none; max-height: none; margin: 0; border: 0; border-radius: 0; background: var(--bg); }
.pos-shell { display: flex; flex-direction: column; height: 100%; min-height: 0; }
.pos-top { display: flex; align-items: center; gap: 14px; padding: 10px 16px; background: var(--surface); border-bottom: 1px solid var(--border); }
.pos-top h1 { display: flex; align-items: center; gap: 8px; margin: 0; font-size: 1.1rem; white-space: nowrap; }
.pos-tabs { display: flex; align-items: center; gap: 6px; flex: 1 1 auto; overflow-x: auto; padding: 2px; }
.pos-tab { display: flex; align-items: center; border: 1px solid var(--border-input); border-radius: var(--radius-1); background: var(--surface); white-space: nowrap; }
.pos-tab.is-on { background: var(--primary-soft); border-color: var(--primary); }
.pos-tab-main { border: 0; background: none; padding: 8px 10px; font: inherit; color: var(--text); cursor: pointer; }
.pos-new { white-space: nowrap; }
.pos-body { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(360px, 1fr); gap: 14px; padding: 14px 16px; flex: 1 1 auto; min-height: 0; }
.pos-catalog { display: flex; flex-direction: column; gap: 10px; min-height: 0; }
.pos-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.pos-chip { border: 1px solid var(--border-input); background: var(--surface); color: var(--text); border-radius: 999px; padding: 6px 14px; font: inherit; cursor: pointer; }
.pos-chip.is-on { background: var(--primary); border-color: var(--primary); color: var(--on-primary); }
.pos-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; overflow-y: auto; align-content: start; flex: 1 1 auto; min-height: 0; padding: 2px; }
.pos-tile { display: flex; flex-direction: column; justify-content: space-between; gap: 6px; min-height: 108px; padding: 10px 12px; text-align: left; border: 1px solid var(--border-input); border-left-width: 6px; border-radius: var(--radius-1); background: var(--surface); color: var(--text); font: inherit; cursor: pointer; }
.pos-tile:hover, .pos-tile:focus-visible { background: var(--primary-soft); }
.pos-tile-name { font-weight: 650; line-height: 1.25; }
.pos-tile-meta { font-size: .78rem; color: var(--muted); }
.pos-tile-price { font-size: 1.05rem; }
.pos-cat-0 { border-left-color: #0B63CE; } .pos-cat-1 { border-left-color: #0F766E; } .pos-cat-2 { border-left-color: #B45309; } .pos-cat-3 { border-left-color: #7C3AED; }
.pos-cat-4 { border-left-color: #B91C1C; } .pos-cat-5 { border-left-color: #15803D; } .pos-cat-6 { border-left-color: #BE185D; } .pos-cat-7 { border-left-color: #475569; }
.pos-note { margin: 0; }
.pos-ticket { display: flex; flex-direction: column; gap: 10px; min-height: 0; overflow-y: auto; padding: 14px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-2); box-shadow: var(--shadow-1); }
.pos-ticket-head h2 { margin: 0; font-size: 1.05rem; }
.pos-customer { position: relative; display: grid; gap: 6px; }
.pos-customer .row { display: flex; gap: 6px; } .pos-customer .row .input { flex: 1 1 auto; }
.pos-party { display: flex; align-items: center; gap: 8px; margin: 0; }
.pos-results { position: absolute; top: 44px; left: 0; right: 0; z-index: 3; display: grid; background: var(--surface); border: 1px solid var(--border-input); border-radius: var(--radius-1); box-shadow: var(--shadow-2); max-height: 260px; overflow-y: auto; }
.pos-result { text-align: left; border: 0; border-bottom: 1px solid var(--border); background: none; padding: 9px 12px; font: inherit; color: var(--text); cursor: pointer; }
.pos-result:hover, .pos-result:focus-visible { background: var(--primary-soft); }
.pos-lines { display: grid; gap: 10px; }
.pos-line { display: grid; gap: 8px; padding: 10px; border: 1px solid var(--border); border-radius: var(--radius-1); background: var(--surface-2); }
.pos-line-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; }
.pos-line-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 8px; align-items: end; }
.pos-line-grid .field { margin: 0; }
.pos-stepper { display: flex; gap: 4px; } .pos-stepper .pos-qty { min-width: 0; text-align: center; }
.pos-line-foot { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.pos-line-total { font-size: 1.05rem; }
.pos-empty { display: grid; justify-items: center; gap: 6px; padding: 28px 8px; color: var(--muted); }
.pos-sum { display: grid; gap: 4px; border-top: 1px solid var(--border); padding-top: 8px; }
.pos-sum-row, .pos-sum-total { display: flex; justify-content: space-between; }
.pos-sum-row.is-discount { color: var(--success); }
.pos-sum-total { font-size: 1.5rem; }
.pos-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: auto; }
.pos-actions .pos-charge { flex: 1 1 100%; min-height: 52px; font-size: 1.1rem; }
.pos-feedback:empty { display: none; }
@media (max-width: 900px) { .pos-body { grid-template-columns: 1fr; overflow-y: auto; } .pos-top { flex-wrap: wrap; } }

/* Home as tiles (menu style "Mosaico") */
.home-view .page-head { align-items: center; padding: 16px 20px; border-radius: var(--radius-2); background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow-1); margin-bottom: 8px; }
.home-view .page-head h1 { font-size: 1.35rem; margin: 0; }
.home-view .page-head .lead { margin-top: 2px; font-size: .92rem; }
.home-search { min-width: min(280px, 100%); }
.home-sections { display: flex; flex-direction: column; gap: 14px; }
.home-section-title { display: flex; align-items: center; gap: 8px; margin: 14px 0 2px; padding-top: 16px; border-top: 1px solid var(--border); font-size: .92rem; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); }
.home-section-title .icon { width: 18px; height: 18px; color: var(--primary); }
.home-tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(185px, 1fr)); gap: 14px; }
.home-tile { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; min-height: 128px; padding: 18px 14px; border-radius: 16px; color: #FFFFFF; text-align: center; text-decoration: none; font-weight: 700; font-size: .98rem; line-height: 1.22; background: linear-gradient(145deg, var(--tile-hi, var(--tile, #475569)), var(--tile, #475569)); box-shadow: inset 0 1px 0 rgba(255, 255, 255, .22), var(--shadow-1); transition: transform .14s ease, filter .14s ease, box-shadow .14s ease; }
.home-tile[hidden], .home-tiles[hidden], .home-section-title[hidden], .home-empty[hidden] { display: none; }
.home-tile-icon { width: 52px; height: 52px; border-radius: 14px; background: rgba(255, 255, 255, .16); display: grid; place-items: center; flex: none; }
.home-tile .icon { width: 30px; height: 30px; opacity: .96; }
.home-tile-label { overflow-wrap: anywhere; }
.home-tile:hover { color: #FFFFFF; filter: brightness(1.06); transform: translateY(-2px); box-shadow: inset 0 1px 0 rgba(255, 255, 255, .28), var(--shadow-2); }
.home-tile:focus-visible { outline: 3px solid var(--focus, #FFFFFF); outline-offset: 3px; }
.home-tile.is-wide { grid-column: span 2; flex-direction: row; justify-content: flex-start; text-align: left; padding: 18px 22px; gap: 16px; }
.home-tile.is-wide .home-tile-label { font-size: 1.08rem; }
.hue-1 { --tile: #4E7A17; --tile-hi: #649621; } .hue-2 { --tile: #00695C; --tile-hi: #00897B; } .hue-3 { --tile: #256929; --tile-hi: #348A39; }
.hue-4 { --tile: #00707A; --tile-hi: #00919E; } .hue-5 { --tile: #6A1B9A; --tile-hi: #8527BD; } .hue-6 { --tile: #AD1457; --tile-hi: #CC1D68; }
.hue-7 { --tile: #0266A3; --tile-hi: #0382CE; } .hue-8 { --tile: #1255A3; --tile-hi: #196FD1; } .hue-9 { --tile: #BF360C; --tile-hi: #DF4618; }
.home-tiles.is-secondary { grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 12px; }
.home-tiles.is-secondary .home-tile.hue-0 { min-height: 76px; flex-direction: row; justify-content: flex-start; text-align: left; padding: 12px 16px; gap: 12px; border-radius: 12px; font-size: .92rem; --tile: #3B495E; --tile-hi: #4B5C75; }
.home-tiles.is-secondary .home-tile.hue-0 .home-tile-icon { width: 40px; height: 40px; border-radius: 10px; background: rgba(255, 255, 255, .14); }
.home-tiles.is-secondary .home-tile.hue-0 .icon { width: 22px; height: 22px; }
@media (max-width: 640px) {
  .home-tiles, .home-tiles.is-secondary { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .home-tile { min-height: 116px; font-size: .92rem; }
  .home-tile.is-wide { grid-column: 1 / -1; }
  .home-tiles.is-secondary .home-tile.hue-0 { flex-direction: column; text-align: center; justify-content: center; min-height: 100px; }
}
/* Menu style "Mosaico": no side menu, brand + Inicio button in the top bar lead home */
.topbar-brand, .topbar-home { display: none; }
.topbar-brand { align-items: center; gap: 10px; padding-right: 12px; border-right: 1px solid var(--border); color: var(--text); text-decoration: none; flex: none; }
.topbar-brand img { width: 32px; height: 32px; border-radius: 8px; flex: none; }
.topbar-brand img.is-company-logo { width: auto; max-width: 120px; height: 36px; object-fit: contain; border-radius: 4px; background: #fff; padding: 2px; }
.topbar-brand-text { display: flex; flex-direction: column; line-height: 1.15; }
.topbar-brand-text strong { font-size: .92rem; font-weight: 750; letter-spacing: -.01em; }
.topbar-brand-text span { font-size: .68rem; color: var(--muted); }
.topbar-style-btn { gap: 6px; font-weight: 600; }
.app.menu-mosaic { grid-template-columns: minmax(0, 1fr); }
.app.menu-mosaic .sidebar, .app.menu-mosaic .sidebar-scrim { display: none; }
.app.menu-mosaic .topbar-menu { display: none; }
.app.menu-mosaic .topbar-brand, .app.menu-mosaic .topbar-home { display: inline-flex; }

/* Stock breakdown & per-presentation badges (Inventario, Productos, Ficha de producto) */
.stock-breakdown-cell { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; }
.stock-breakdown-main { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 999px; font-weight: 700; font-size: .86rem; background: var(--success-soft); color: var(--success); border: 1px solid rgba(21, 128, 61, .2); white-space: nowrap; }
.stock-breakdown-main .icon { width: 15px; height: 15px; flex: none; }
.stock-breakdown-main.is-zero { background: var(--surface-2); color: var(--muted); border-color: var(--border); font-weight: 600; }
.stock-pres-pills { display: flex; flex-wrap: wrap; gap: 5px; }
.stock-pres-pill { display: inline-flex; align-items: center; gap: 3px; padding: 2px 8px; border-radius: 6px; font-size: .76rem; background: var(--surface-2); color: var(--text-2); border: 1px solid var(--border); white-space: nowrap; }
.stock-pres-pill strong { color: var(--text); font-weight: 650; }
.stock-compact-cell { display: inline-flex; flex-direction: column; align-items: flex-end; gap: 2px; line-height: 1.2; }
.stock-compact-main { font-weight: 700; color: var(--text); }
.stock-compact-base { font-size: .74rem; }

/* Payment window: one big button per configured method, quick cash amounts and live change. */
.pay-methods { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 8px; }
.pay-method { display: grid; justify-items: center; gap: 2px; padding: 12px 8px; border: 2px solid var(--border, #d0d5dd); border-radius: 10px; background: var(--surface, #fff); color: inherit; cursor: pointer; font: inherit; }
.pay-method .icon { width: 26px; height: 26px; }
.pay-method-name { font-weight: 600; }
.pay-method[aria-checked="true"] { border-color: var(--primary, #1d4ed8); background: color-mix(in srgb, var(--primary, #1d4ed8) 10%, transparent); }
.pay-method:focus-visible { outline: 3px solid var(--primary, #1d4ed8); outline-offset: 2px; }
.pay-amount { font-size: 1.25rem; font-weight: 600; text-align: right; }
.pay-quick { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.pay-change-line { margin: 6px 0 0; font-size: 1.1rem; }
.pay-change { color: var(--success, #067647); }
.row-actions { display: inline-flex; flex-wrap: wrap; gap: 4px; }
.pos-price-locked { background: var(--surface-2, #f2f4f7); cursor: not-allowed; }

/* Roles and access screens: collapsible groups, plain-language permission rows, quick select tools. */
.perm-bar { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; justify-content: space-between; }
.perm-bar .input { max-width: 340px; }
.perm-group { padding: 8px 12px; }
.perm-group > summary { cursor: pointer; display: flex; gap: 8px; align-items: center; padding: 6px 0; }
.perm-tools { display: flex; flex-wrap: wrap; gap: 6px; margin: 4px 0 8px; }
.perm-row { align-items: flex-start; }
.perm-text { display: inline-flex; flex-wrap: wrap; gap: 4px 8px; align-items: baseline; }
.perm-desc { font-weight: 500; }
.perm-code { font-size: 0.75rem; opacity: 0.7; }
.perm-modules { display: grid; gap: 4px; }
.perm-chips { display: flex; flex-wrap: wrap; gap: 4px; }

/* Sites x roles matrix of the user access editor. */
.matrix { width: 100%; }
.matrix th, .matrix td { text-align: center; vertical-align: middle; padding: 8px 10px; }
.matrix .matrix-role { text-align: left; white-space: nowrap; }
.matrix .matrix-role small, .matrix .matrix-site small { display: block; font-weight: 400; }
.matrix .matrix-site { min-width: 120px; }
.matrix .matrix-cell input[type="checkbox"], .matrix .matrix-site input[type="checkbox"] { width: 20px; height: 20px; }
.matrix .matrix-cell.is-locked { opacity: 0.6; }
.matrix .matrix-cell .badge { display: block; margin-top: 4px; white-space: normal; }
.matrix .matrix-all { white-space: nowrap; }
.matrix tbody tr:hover { background: color-mix(in srgb, var(--primary, #1d4ed8) 6%, transparent); }
.pos-extras { border-top: 1px dashed var(--border); padding-top: 10px; }
.pos-extras-title { font-size: 1rem; margin: 0; }

/* Grouped form: a heading that spans the grid and separates sections (company data, electronic billing) */
.form-grid > .form-section { grid-column: 1 / -1; padding-top: 6px; }
.form-grid > .form-section:not(:first-child) { margin-top: 10px; padding-top: 18px; border-top: 1px solid var(--border); }
.form-section h3 { margin: 0; font-size: 1.02rem; }
.form-section p { margin: 2px 0 0; font-size: .86rem; }
.form-grid.form-stack > .field > label.check { padding-top: 26px; }
.col-qty { width: 110px; } .col-amt { width: 140px; }
.issue-lines { width: 100%; table-layout: fixed; } .issue-lines td, .issue-lines th { padding: 6px 4px; } .issue-lines th:first-child { text-align: left; } .issue-lines .input { width: 100%; box-sizing: border-box; } .issue-lines .col-qty { width: 100px; } .issue-lines .col-amt { width: 120px; }
.issue-lines .col-tax { width: 170px; } .issue-lines .select { width: 100%; box-sizing: border-box; }
