
/* Invoay ERP — component styles, copied from the design system's components/bundle.css minus its page-level
   rules (html/body, global box-sizing, font @import) so it is safe to load on every ERP page.
   Tokens come from invoay-tokens.css. */
[class^="iv-"], [class^="iv-"] *, [class^="iv-"] *::before, [class^="iv-"] *::after { box-sizing: border-box; }
.iv-scope, .iv-card, .iv-ph, .iv-alert, .iv-dialog, .iv-toast, .iv-side, .iv-field, .iv-check, .iv-badge, .iv-tabs, .iv-seg, .iv-grid { font-family: var(--font-sans); color: var(--ink); }
.iv-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.iv-stack { display: flex; flex-direction: column; gap: 16px; }
.iv-num { font-family: var(--font-mono); font-variant-numeric: tabular-nums; text-align: right; }
.iv-muted { color: var(--ink-muted); }
.iv-icon { flex: none; display: inline-block; vertical-align: middle; }

:where(.iv-btn, .iv-input, .iv-select, .iv-check input, .iv-switch, .iv-tab, .iv-nav-item, .iv-icon-btn, .iv-pg-btn):focus-visible {
  outline: 2px solid var(--focus-ring); outline-offset: 2px;
}

/* ---------- Button ---------- */
.iv-btn {
  --h: var(--control-md);
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: var(--h); padding: 0 14px; border-radius: var(--radius-sm); border: 1px solid transparent;
  font: 500 14px/20px var(--font-sans); white-space: nowrap; cursor: pointer; user-select: none;
  transition: background-color var(--dur-fast), border-color var(--dur-fast), color var(--dur-fast), box-shadow var(--dur-fast), transform var(--dur-base) var(--ease-out);
}
.iv-btn:active:not(:disabled) { transform: scale(0.98); }
.iv-btn, .iv-btn:hover, .iv-btn:focus { text-decoration: none; }
.iv-btn:disabled { opacity: 0.5; cursor: not-allowed; }
.iv-btn-sm { --h: var(--control-sm); padding: 0 10px; font-size: 13px; }
.iv-btn-lg { --h: var(--control-lg); padding: 0 18px; }
.iv-btn-icon { width: var(--h); padding: 0; }
.iv-btn-primary { background: var(--primary); color: var(--on-primary); box-shadow: var(--shadow-xs); }
.iv-btn-primary:hover:not(:disabled) { background: var(--primary-hover); }
.iv-btn-secondary { background: var(--surface-sunken); color: var(--ink); border-color: var(--line); }
.iv-btn-secondary:hover:not(:disabled) { background: var(--surface-hover); border-color: var(--line-strong); }
.iv-btn-outline { background: var(--surface); color: var(--ink); border-color: var(--line-strong); box-shadow: var(--shadow-xs); }
.iv-btn-outline:hover:not(:disabled) { background: var(--surface-hover); }
.iv-btn-ghost { background: transparent; color: var(--ink-muted); }
.iv-btn-ghost:hover:not(:disabled) { background: var(--surface-hover); color: var(--ink); }
.iv-btn-danger { background: var(--danger); color: var(--on-danger); }
.iv-btn-danger:hover:not(:disabled) { filter: brightness(0.92); }
/* Buttons that are links: Bootstrap's a:hover / a:focus colour (#23527c) outranks the variant classes. */
a.iv-btn-primary, a.iv-btn-primary:hover, a.iv-btn-primary:focus { color: var(--on-primary); }
a.iv-btn-secondary, a.iv-btn-secondary:hover, a.iv-btn-secondary:focus,
a.iv-btn-outline, a.iv-btn-outline:hover, a.iv-btn-outline:focus { color: var(--ink); }
a.iv-btn-ghost, a.iv-btn-ghost:focus { color: var(--ink-muted); }
a.iv-btn-ghost:hover { color: var(--ink); }
a.iv-btn-danger, a.iv-btn-danger:hover, a.iv-btn-danger:focus { color: var(--on-danger); }
.iv-btn-link { background: none; color: var(--primary); padding: 0; height: auto; }
.iv-btn-link:hover:not(:disabled) { text-decoration: underline; text-underline-offset: 3px; }
.iv-spin { width: 14px; height: 14px; border-radius: 50%; border: 2px solid currentColor; border-right-color: transparent; animation: iv-spin 0.7s linear infinite; }
@keyframes iv-spin { to { transform: rotate(360deg); } }

/* ---------- Field / Input / Select ---------- */
.iv-field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.iv-label { font-size: 12px; line-height: 16px; font-weight: 500; color: var(--ink-muted); }
.iv-label .iv-req { color: var(--danger); margin-left: 2px; }
.iv-hint { font-size: 12px; line-height: 16px; color: var(--ink-subtle); }
.iv-field.is-invalid .iv-hint { color: var(--danger); }
.iv-control {
  display: flex; align-items: center; height: var(--control-md); background: var(--surface);
  border: 1px solid var(--control-border); border-radius: var(--radius-sm); box-shadow: var(--shadow-xs);
  transition: border-color var(--dur-fast), box-shadow var(--dur-fast);
}
.iv-control:hover { border-color: var(--ink-muted); }
.iv-control:focus-within { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
.iv-field.is-invalid .iv-control { border-color: var(--danger); }
.iv-field.is-invalid .iv-control:focus-within { box-shadow: 0 0 0 3px var(--danger-soft); }
.iv-field.is-readonly .iv-control { background: var(--surface-sunken); border-color: var(--line-strong); box-shadow: none; }
.iv-affix { padding: 0 0 0 10px; color: var(--ink-subtle); font-size: 13px; display: inline-flex; }
.iv-affix-end { padding: 0 10px 0 0; }
.iv-input, .iv-select {
  flex: 1; min-width: 0; height: 100%; border: 0; outline: 0; background: transparent; color: var(--ink);
  font: 400 14px/20px var(--font-sans); padding: 0 10px;
}
.iv-input::placeholder { color: var(--ink-subtle); }
.iv-control { overflow: hidden; }
.iv-input, .iv-select { border-radius: inherit; }
/* Browser autofill paints its own square, tinted box: keep the control's surface, ink and corners. */
.iv-input:-webkit-autofill, .iv-input:-webkit-autofill:hover, .iv-input:-webkit-autofill:focus {
  -webkit-box-shadow: 0 0 0 1000px var(--surface) inset; box-shadow: 0 0 0 1000px var(--surface) inset;
  -webkit-text-fill-color: var(--ink); caret-color: var(--ink); transition: background-color 9999s ease-out 0s;
}
/* The .iv-control box draws the focus ring (:focus-within). bootstrap-shadcn's `input:focus-visible` ring on the
   input inside it would show as a second, clipped grey border. Autofill keeps its own inset shadow. */
.iv-control .iv-input:not(:-webkit-autofill):focus-visible,
.iv-control .iv-select:focus-visible { box-shadow: none; outline: none; }
.iv-select { appearance: none; cursor: pointer; padding-right: 30px; }
.iv-select-wrap { position: relative; }
.iv-select-wrap .iv-chev { position: absolute; right: 9px; top: 50%; transform: translateY(-50%); pointer-events: none; color: var(--ink-muted); }
.iv-select option { background: var(--surface-raised); color: var(--ink); }

/* ---------- Checkbox / Switch ---------- */
.iv-check { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; font-size: 14px; color: var(--ink); }
.iv-check input:not(.iv-switch), .iv-grid input[type="checkbox"] { appearance: none; margin: 0; width: 16px; height: 16px; border-radius: var(--radius-xs); border: 1px solid var(--control-border); background: var(--surface); display: grid; place-items: center; cursor: pointer; transition: background-color var(--dur-fast), border-color var(--dur-fast); }
.iv-check input:not(.iv-switch)::after, .iv-grid input[type="checkbox"]::after { content: ""; width: 9px; height: 5px; border-left: 2px solid var(--on-primary); border-bottom: 2px solid var(--on-primary); transform: translateY(-1px) rotate(-45deg) scale(0); transition: transform var(--dur-base) var(--ease-spring); }
.iv-check input:not(.iv-switch):checked, .iv-grid input[type="checkbox"]:checked { background: var(--primary); border-color: var(--primary); }
.iv-check input:not(.iv-switch):checked::after, .iv-grid input[type="checkbox"]:checked::after { transform: translateY(-1px) rotate(-45deg) scale(1); }
.iv-check input[type="radio"] { border-radius: 50%; }
.iv-check input[type="radio"]::after { width: 6px; height: 6px; border: 0; border-radius: 50%; background: var(--on-primary); transform: scale(0); }
.iv-check input[type="radio"]:checked::after { transform: scale(1); }
.iv-check input:disabled { opacity: 0.5; cursor: not-allowed; }
.iv-switch { appearance: none; margin: 0; position: relative; width: 34px; height: 20px; border-radius: var(--radius-full); background: var(--line-strong); border: 1px solid var(--control-border); cursor: pointer; transition: background-color var(--dur-base); }
.iv-switch::after { content: ""; position: absolute; top: 2px; left: 2px; width: 14px; height: 14px; border-radius: 50%; background: var(--surface); box-shadow: var(--shadow-xs); transition: transform var(--dur-base) var(--ease-spring); }
.iv-switch:checked { background: var(--primary); border-color: var(--primary); }
.iv-switch:checked::after { transform: translateX(14px); background: var(--on-primary); }

/* ---------- Badge ---------- */
.iv-badge { display: inline-flex; align-items: center; gap: 6px; height: 22px; padding: 0 8px; border-radius: var(--radius-full); font-size: 12px; line-height: 16px; font-weight: 500; white-space: nowrap; background: var(--surface-sunken); color: var(--ink-muted); border: 1px solid var(--line); }
.iv-badge-dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.iv-badge-success { background: var(--success-soft); color: var(--success); border-color: transparent; }
.iv-badge-warning { background: var(--warning-soft); color: var(--warning); border-color: transparent; }
.iv-badge-danger { background: var(--danger-soft); color: var(--danger); border-color: transparent; }
.iv-badge-info { background: var(--info-soft); color: var(--info); border-color: transparent; }
.iv-badge-accent { background: var(--accent-soft); color: var(--accent); border-color: transparent; }
.iv-badge-live .iv-badge-dot { animation: iv-pulse 1.6s var(--ease-out) infinite; }
@keyframes iv-pulse { 0% { box-shadow: 0 0 0 0 currentColor; } 70%, 100% { box-shadow: 0 0 0 5px transparent; } }

/* ---------- Tabs ---------- */
.iv-tabs { position: relative; display: flex; gap: 4px; border-bottom: 1px solid var(--line); }
.iv-tab { position: relative; background: none; border: 0; padding: 10px 12px; font: 500 14px/20px var(--font-sans); color: var(--ink-muted); cursor: pointer; border-radius: var(--radius-sm) var(--radius-sm) 0 0; transition: color var(--dur-fast); display: inline-flex; gap: 6px; align-items: center; }
.iv-tab:hover { color: var(--ink); }
.iv-tab[aria-selected="true"] { color: var(--ink); }
.iv-tab-count { font-size: 12px; padding: 0 6px; border-radius: var(--radius-full); background: var(--surface-sunken); color: var(--ink-muted); }
.iv-tab-ink { position: absolute; bottom: -1px; height: 2px; background: var(--primary); border-radius: 2px; transition: transform var(--dur-base) var(--ease-out), width var(--dur-base) var(--ease-out); left: 0; }
.iv-seg { display: inline-flex; width: max-content; padding: 3px; gap: 2px; background: var(--surface-sunken); border: 1px solid var(--line); border-radius: var(--radius-sm); position: relative; }
.iv-seg .iv-tab { padding: 4px 12px; font-size: 13px; border-radius: 4px; z-index: 1; }
.iv-seg .iv-tab-ink { top: 3px; bottom: 3px; height: auto; background: var(--surface); box-shadow: var(--shadow-xs); border-radius: 4px; z-index: 0; }

/* ---------- Dashboard switcher (same strip on every dashboard; current page highlighted) ---------- */
.iv-dash-nav { display: flex; gap: 4px; margin: 0 0 var(--space-5); border-bottom: 1px solid var(--line); overflow-x: auto; scrollbar-width: none; }
.iv-dash-nav::-webkit-scrollbar { display: none; }
.iv-dash-nav a { position: relative; flex: none; display: inline-flex; align-items: center; gap: 6px; padding: 10px 12px; font: 500 14px/20px var(--font-sans); color: var(--ink-muted); text-decoration: none; white-space: nowrap; border-radius: var(--radius-sm) var(--radius-sm) 0 0; transition: color var(--dur-fast), background-color var(--dur-fast); }
.iv-dash-nav a:hover { color: var(--ink); background: var(--surface-hover); text-decoration: none; }
.iv-dash-nav a:focus-visible { outline: 2px solid var(--primary); outline-offset: -2px; }
.iv-dash-nav a[aria-current="page"] { color: var(--primary); font-weight: 600; }
.iv-dash-nav a[aria-current="page"]::after { content: ""; position: absolute; left: 8px; right: 8px; bottom: -1px; height: 2px; border-radius: 2px; background: var(--primary); }

/* ---------- Alert ---------- */
.iv-alert { display: flex; gap: 12px; padding: 12px 16px; border-radius: var(--radius-md); border: 1px solid var(--line); background: var(--surface); color: var(--ink); font-size: 14px; }
.iv-alert-title { font-weight: 600; }
.iv-alert-body { color: var(--ink-muted); margin-top: 2px; }
.iv-alert-info { background: var(--info-soft); border-color: transparent; } .iv-alert-info > .iv-icon { color: var(--info); }
.iv-alert-success { background: var(--success-soft); border-color: transparent; } .iv-alert-success > .iv-icon { color: var(--success); }
.iv-alert-warning { background: var(--warning-soft); border-color: transparent; } .iv-alert-warning > .iv-icon { color: var(--warning); }
.iv-alert-danger { background: var(--danger-soft); border-color: transparent; } .iv-alert-danger > .iv-icon { color: var(--danger); }
.iv-alert .iv-alert-actions { margin-left: auto; display: flex; gap: 8px; align-items: flex-start; }

/* ---------- Card / StatCard ---------- */
.iv-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); box-shadow: var(--shadow-sm); }
.iv-card-head { display: flex; align-items: center; gap: 12px; padding: 16px 20px; border-bottom: 1px solid var(--line); }
.iv-card-title { font-size: 15px; line-height: 22px; font-weight: 600; margin: 0; }
.iv-card-sub { font-size: 13px; color: var(--ink-muted); }
.iv-card-body { padding: 20px; }
.iv-stat { padding: 16px 20px; display: flex; flex-direction: column; gap: 6px; transition: transform var(--dur-base) var(--ease-out), box-shadow var(--dur-base) var(--ease-out); }
.iv-stat:hover { transform: translateY(-1px); box-shadow: var(--shadow-md); }
.iv-stat-label { font-size: 11px; line-height: 16px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--ink-muted); }
.iv-stat-value { font-size: 28px; line-height: 36px; font-weight: 600; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.iv-stat-foot { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--ink-muted); }
.iv-delta { display: inline-flex; align-items: center; gap: 2px; font-weight: 600; font-variant-numeric: tabular-nums; }
.iv-delta-up { color: var(--success); } .iv-delta-down { color: var(--danger); }
.iv-spark { margin-top: 4px; }
.iv-spark path.l { fill: none; stroke: var(--chart-1); stroke-width: 1.75; stroke-linejoin: round; stroke-linecap: round; stroke-dasharray: 400; stroke-dashoffset: 400; animation: iv-draw 900ms var(--ease-out) forwards; }
.iv-spark path.a { fill: var(--primary-soft); opacity: 0; animation: iv-fade 600ms 300ms var(--ease-out) forwards; }
@keyframes iv-draw { to { stroke-dashoffset: 0; } }
@keyframes iv-fade { to { opacity: 1; } }

/* ---------- DataGrid (DevExpress target look) ---------- */
.iv-grid { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); box-shadow: var(--shadow-sm); overflow: hidden; }
.iv-grid-bar { display: flex; align-items: center; gap: 8px; padding: 10px 12px; border-bottom: 1px solid var(--line); }
.iv-grid-bar .iv-control { height: var(--control-sm); }
.iv-grid-bar .iv-input { font-size: 13px; }
.iv-grid table { width: 100%; border-collapse: collapse; font-size: 13px; line-height: 18px; }
.iv-grid th { position: sticky; top: 0; z-index: 10; background: var(--surface-sunken); color: var(--ink-muted); font-size: 12px; font-weight: 500; text-align: left; padding: 8px 12px; border-bottom: 1px solid var(--line-strong); white-space: nowrap; cursor: pointer; user-select: none; transition: color var(--dur-fast); }
.iv-grid th:hover { color: var(--ink); }
.iv-grid th[aria-sort="ascending"], .iv-grid th[aria-sort="descending"] { color: var(--ink); }
.iv-grid th .iv-sort { margin-left: 4px; opacity: 0.4; transition: transform var(--dur-base) var(--ease-out), opacity var(--dur-fast); }
.iv-grid th[aria-sort] .iv-sort { opacity: 1; }
.iv-grid th[aria-sort="descending"] .iv-sort { transform: rotate(180deg); }
.iv-grid th.r, .iv-grid td.r { text-align: right; }
.iv-grid td { padding: 0 12px; height: var(--row-compact); border-bottom: 1px solid var(--line); color: var(--ink); white-space: nowrap; transition: background-color var(--dur-fast); }
.iv-grid.is-comfortable td { height: var(--row-comfortable); }
.iv-grid tbody tr { cursor: default; }
.iv-grid tbody tr:hover td { background: var(--surface-hover); }
.iv-grid tbody tr.is-selected td { background: var(--primary-soft); }
.iv-grid tbody tr.is-selected td:first-child { box-shadow: inset 2px 0 0 var(--primary); }
.iv-grid tr.iv-group td { background: var(--surface-sunken); font-weight: 500; height: 30px; }
.iv-grid tfoot td { background: var(--surface-sunken); font-weight: 600; border-top: 1px solid var(--line-strong); border-bottom: 0; }
.iv-grid td.iv-num, .iv-grid td .iv-num { font-family: var(--font-mono); font-size: 12.5px; }
.iv-grid .iv-code { font-family: var(--font-mono); font-size: 12px; color: var(--primary); }
.iv-grid-pager { display: flex; align-items: center; gap: 4px; padding: 8px 12px; border-top: 1px solid var(--line); font-size: 12px; color: var(--ink-muted); }
.iv-pg-btn { min-width: 28px; height: 28px; padding: 0 6px; border-radius: var(--radius-sm); border: 1px solid transparent; background: none; color: var(--ink-muted); font: 500 12px/1 var(--font-sans); cursor: pointer; transition: background-color var(--dur-fast), color var(--dur-fast); display: inline-flex; align-items: center; justify-content: center; }
.iv-pg-btn:hover:not(:disabled) { background: var(--surface-hover); color: var(--ink); }
.iv-pg-btn[aria-current="page"] { background: var(--primary-soft); color: var(--primary); }
.iv-pg-btn:disabled { opacity: 0.4; cursor: not-allowed; }
.iv-skel { display: block; height: 10px; border-radius: 4px; background: linear-gradient(90deg, var(--surface-sunken) 0%, var(--surface-hover) 50%, var(--surface-sunken) 100%); background-size: 200% 100%; animation: iv-shimmer 1.2s linear infinite; }
@keyframes iv-shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }

/* ---------- PivotGrid ---------- */
.iv-pivot-fields { display: flex; flex-wrap: wrap; gap: 6px; padding: 10px 12px; background: var(--surface-sunken); border-bottom: 1px solid var(--line); align-items: center; }
.iv-chip { display: inline-flex; align-items: center; gap: 4px; height: 24px; padding: 0 10px; border-radius: var(--radius-full); background: var(--surface); border: 1px solid var(--line-strong); font-size: 12px; font-weight: 500; color: var(--ink); cursor: grab; transition: box-shadow var(--dur-fast), transform var(--dur-base) var(--ease-out); }
.iv-chip:hover { box-shadow: var(--shadow-md); transform: translateY(-1px); }
.iv-chip-zone { font-size: 11px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--ink-subtle); margin: 0 4px 0 8px; }
.iv-pivot table { width: 100%; border-collapse: collapse; font-size: 13px; }
.iv-pivot th, .iv-pivot td { border: 1px solid var(--line); padding: 6px 12px; white-space: nowrap; }
.iv-pivot th { background: var(--surface-sunken); color: var(--ink-muted); font-size: 12px; font-weight: 500; text-align: left; }
.iv-pivot th.r { text-align: right; }
.iv-pivot td { text-align: right; font-family: var(--font-mono); font-size: 12.5px; font-variant-numeric: tabular-nums; }
.iv-pivot .t { background: var(--surface-sunken); font-weight: 600; }
.iv-pivot .gt { background: var(--primary-soft); font-weight: 600; color: var(--ink); }
.iv-pivot .h1 { background: color-mix(in srgb, var(--primary) 10%, var(--surface)); }
.iv-pivot .h2 { background: color-mix(in srgb, var(--primary) 20%, var(--surface)); }
.iv-pivot .h3 { background: color-mix(in srgb, var(--primary) 32%, var(--surface)); }

/* ---------- PageHeader ---------- */
.iv-ph { display: flex; flex-direction: column; gap: 6px; }
.iv-crumbs { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--ink-muted); }
.iv-crumbs a { color: inherit; text-decoration: none; transition: color var(--dur-fast); }
.iv-crumbs a:hover { color: var(--ink); }
.iv-ph-main { display: flex; align-items: flex-start; gap: 16px; }
.iv-ph-title { font-size: 24px; line-height: 32px; font-weight: 600; letter-spacing: -0.015em; margin: 0; display: flex; align-items: center; gap: 10px; }
.iv-ph-desc { font-size: 14px; color: var(--ink-muted); margin: 2px 0 0; }
.iv-ph-actions { margin-left: auto; display: flex; gap: 8px; }

/* ---------- Sidebar ---------- */
.iv-side { width: var(--sidebar-width); background: var(--surface); border-right: 1px solid var(--line); display: flex; flex-direction: column; padding: 12px; gap: 2px; height: 100%; }
.iv-side-brand { display: flex; align-items: center; gap: 8px; padding: 4px 8px 12px; }
.iv-side-store { display: flex; align-items: center; gap: 10px; padding: 8px; border: 1px solid var(--line); border-radius: var(--radius-md); margin-bottom: 8px; cursor: pointer; transition: background-color var(--dur-fast); }
.iv-side-store:hover { background: var(--surface-hover); }
.iv-avatar { width: 28px; height: 28px; border-radius: var(--radius-sm); background: var(--accent-soft); color: var(--accent); display: grid; place-items: center; font-size: 12px; font-weight: 600; flex: none; }
.iv-side-group { font-size: 11px; line-height: 16px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--ink-subtle); padding: 14px 10px 6px; }
.iv-nav-item { position: relative; display: flex; align-items: center; gap: 10px; height: 34px; padding: 0 10px; border-radius: var(--radius-sm); color: var(--ink-muted); font-size: 14px; font-weight: 500; text-decoration: none; cursor: pointer; border: 0; background: none; width: 100%; text-align: left; transition: background-color var(--dur-fast), color var(--dur-fast); }
.iv-nav-item:hover { background: var(--surface-hover); color: var(--ink); }
.iv-nav-item[aria-current="page"] { background: var(--primary-soft); color: var(--primary); }
.iv-nav-item[aria-current="page"]::before { content: ""; position: absolute; left: -12px; top: 8px; bottom: 8px; width: 3px; border-radius: 0 3px 3px 0; background: var(--primary); }
.iv-nav-item .iv-badge { margin-left: auto; height: 18px; padding: 0 6px; font-size: 11px; }

/* ---------- Dialog ---------- */
.iv-overlay { position: fixed; inset: 0; background: var(--overlay); display: grid; place-items: center; z-index: var(--z-dialog); animation: iv-fade var(--dur-slow) var(--ease-out) both; opacity: 0; }
.iv-overlay.is-inline { position: relative; inset: auto; min-height: 100%; padding: 24px; }
.iv-dialog { width: min(480px, 100%); background: var(--surface-raised); border-radius: var(--radius-lg); box-shadow: var(--shadow-lg); border: 1px solid var(--line); animation: iv-rise var(--dur-slow) var(--ease-out) both; }
@keyframes iv-rise { from { opacity: 0; transform: translateY(8px) scale(0.98); } to { opacity: 1; transform: none; } }
.iv-dialog-head { display: flex; align-items: flex-start; gap: 12px; padding: 20px 20px 0; }
.iv-dialog-title { font-size: 18px; line-height: 26px; font-weight: 600; margin: 0; }
.iv-dialog-body { padding: 8px 20px 20px; color: var(--ink-muted); }
.iv-dialog-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 12px 20px; border-top: 1px solid var(--line); background: var(--surface-sunken); border-radius: 0 0 var(--radius-lg) var(--radius-lg); }
.iv-dialog-icon { width: 36px; height: 36px; border-radius: var(--radius-full); display: grid; place-items: center; flex: none; background: var(--danger-soft); color: var(--danger); }

/* ---------- Toast ---------- */
.iv-toasts { display: flex; flex-direction: column; gap: 8px; width: 360px; max-width: 100%; }
.iv-toast { display: flex; gap: 12px; align-items: flex-start; padding: 12px 14px; background: var(--surface-raised); border: 1px solid var(--line); border-radius: var(--radius-md); box-shadow: var(--shadow-md); animation: iv-slide var(--dur-slow) var(--ease-out) both; font-size: 14px; }
@keyframes iv-slide { from { opacity: 0; transform: translateX(16px); } to { opacity: 1; transform: none; } }
.iv-toast-title { font-weight: 600; color: var(--ink); }
.iv-toast-body { color: var(--ink-muted); font-size: 13px; margin-top: 2px; }
.iv-toast > .iv-icon.success { color: var(--success); } .iv-toast > .iv-icon.danger { color: var(--danger); } .iv-toast > .iv-icon.info { color: var(--info); }
.iv-toast .iv-x { margin-left: auto; }

/* ---------- Legacy icons (Font Awesome 4 / Glyphicons) drawn as Lucide by invoay.js ---------- */
.iv-fa {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    vertical-align: -0.15em;
    font-style: normal;
    line-height: 1;
}

    .iv-fa::before {
        content: none !important;
    }

    .iv-fa > .iv-icon {
        display: block;
    }

    /* Glyphicons sit 1px low; keep the Lucide glyph on the text baseline. */
    .glyphicon.iv-fa {
        top: 0;
    }

    /* Font Awesome is no longer loaded; these are the few modifier classes the markup still uses. */
    .fa-spin {
        animation: iv-spin 1s linear infinite;
    }

    .fa-lg { font-size: 1.333em; }
    .fa-2x { font-size: 2em; }
    .fa-3x { font-size: 3em; }
    .fa-4x { font-size: 4em; }
    .fa-5x { font-size: 5em; }

    .fa-fw {
        width: 1.28571em;
        text-align: center;
    }

/* ---------- Behaviour hooks (invoay.js) ---------- */
.iv-overlay[hidden] { display: none; }
.iv-toasts.is-fixed { position: fixed; right: 24px; bottom: 24px; z-index: var(--z-toast, 1070); max-width: calc(100vw - 32px); } /* above the Ask Invoay button (1040), Save bar and dialogs */
@media (max-width: 767px) { .iv-toasts.is-fixed { right: 16px; } }
.iv-toast.is-leaving { animation: iv-leave 180ms var(--ease-out) forwards; }
@keyframes iv-leave { to { opacity: 0; transform: translateX(16px); } }
[role="tabpanel"][hidden] { display: none; }

/* Help: info buttons beside labels (Html.HelpTip + invoay.js) and the page's Help panel (a dialog docked right). */
.iv-tip { position: relative; display: inline-grid; place-items: center; width: 16px; height: 16px; margin: 0 0 0 2px; padding: 0; border: 0; border-radius: var(--radius-full); background: none; color: var(--ink-subtle); vertical-align: -3px; cursor: help; box-shadow: none; }
.iv-tip::after { content: ""; position: absolute; inset: -6px; }
.iv-tip:hover, .iv-tip[aria-expanded="true"] { color: var(--primary); background: none; }
.iv-tip:focus { outline: none; }
.iv-tip:focus-visible { outline: 2px solid var(--focus-ring); outline-offset: 2px; }
.iv-tip-pop { position: fixed; z-index: 1100; width: min(300px, calc(100vw - 16px)); padding: 10px 12px; background: var(--surface-raised); border: 1px solid var(--line); border-radius: var(--radius-md); box-shadow: var(--shadow-md); font-size: 13px; line-height: 18px; font-weight: 400; color: var(--ink); text-transform: none; letter-spacing: normal; white-space: normal; }
.iv-tip-pop[hidden] { display: none; }
.iv-tip-pop a { display: flex; align-items: center; gap: 4px; margin-top: 6px; font-weight: 500; color: var(--primary); }

.iv-overlay.iv-help-sheet { z-index: 1050; place-items: stretch end; grid-template-rows: minmax(0, 1fr); }
.iv-help-sheet .iv-dialog { display: flex; flex-direction: column; width: min(440px, 100%); height: 100%; border-width: 0 0 0 1px; border-radius: 0; animation: none; }
.iv-help-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 20px; border-bottom: 1px solid var(--line); }
.iv-help-head .iv-dialog-title { color: var(--ink); }
.iv-help-body { flex: 1; min-height: 0; overflow-y: auto; padding: 16px 20px; font-size: 14px; line-height: 20px; color: var(--ink-muted); }
.iv-help-intro { margin: 0 0 16px; color: var(--ink); }
.iv-help-sec { padding: 16px 0; border-top: 1px solid var(--line); }
.iv-help-sec h3 { margin: 0 0 8px; font: 600 14px/20px var(--font-sans); color: var(--ink); }
.iv-help-sec h3 .iv-icon { margin-right: 6px; vertical-align: -2px; color: var(--ink-muted); }
.iv-help-sec p { margin: 0 0 8px; }
.iv-help-sec strong { font-weight: 500; color: var(--ink); }
.iv-help-sec ul { margin: 0 0 8px; padding-left: 18px; }
.iv-help-sec li { margin-bottom: 4px; }
.iv-help-sec dl { margin: 0 0 8px; }
.iv-help-sec dt { font-weight: 500; color: var(--ink); }
.iv-help-sec dd { margin: 0 0 8px; }
.iv-help-more, .iv-help-links a { display: inline-flex; align-items: center; gap: 4px; font-size: 13px; font-weight: 500; color: var(--primary); }
.iv-help-links { list-style: none; padding-left: 0 !important; }
.iv-help-sheet .iv-dialog-foot .iv-btn { gap: 6px; }
/* "What's new" panel (_ChangeLog): one entry per change, a kind badge and the menu area above the headline. */
.iv-changelog .iv-dialog-title .iv-icon, #changeLogTitle .iv-icon { color: var(--accent); vertical-align: -2px; }
.iv-changelog-list { list-style: none; margin: 0; padding: 0 !important; }
.iv-changelog-list li { padding: 10px 0; border-top: 1px dashed var(--line); margin: 0; }
.iv-changelog-list li:first-child { border-top: 0; padding-top: 4px; }
.iv-changelog-list strong { display: block; margin: 6px 0 2px; color: var(--ink); }
.iv-changelog-list p { margin: 0; }
.iv-changelog-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.iv-changelog-area { font-size: 12px; color: var(--ink-subtle); }
.iv-changelog-version { font-size: 12px; color: var(--ink-subtle); margin-left: auto; font-variant-numeric: tabular-nums; }
.iv-changelog-empty { display: flex; gap: 8px; align-items: flex-start; }
#changeLog .iv-dialog-foot { flex-wrap: wrap; }
#changeLog .iv-dialog-foot .iv-btn { flex: 1 1 auto; }
@media (max-width: 480px) { .iv-help-sheet .iv-dialog { border-left: 0; } }

@media (prefers-reduced-motion: reduce) {
  [class*="iv-"], [class*="iv-"]::before, [class*="iv-"]::after { animation-duration: 1ms !important; animation-iteration-count: 1 !important; transition-property: opacity, background-color, color, border-color !important; }
  .iv-btn:active:not(:disabled), .iv-stat:hover, .iv-chip:hover { transform: none; }
}

/* Phones: form text is 16px, so iPhone Safari does not zoom the page when a field gets focus. Covers the plain
   inputs, the DevExpress editors' inner input, and Select2/ComboBox text. */
@media (max-width: 767px) {
  input:not([type="checkbox"]):not([type="radio"]):not([type="range"]):not([type="file"]):not([type="button"]):not([type="submit"]):not([type="reset"]):not([type="image"]):not([type="color"]):not([type="hidden"]),
  select, textarea,
  .form-control, .iv-input, .iv-select, .iv-textarea,
  input[class*="dxeEditArea_"], textarea[class*="dxeMemoEditArea_"], .dxeEditArea, .dxeMemoEditArea, .select2-search__field, .select2-selection__rendered {
    font-size: 16px !important;
  }
}

/* The note above very wide grids on phones (added by invoay.js) */
.iv-grid-wide-note { display: none; }
@media (max-width: 767px) {
  .iv-grid-wide-note { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin: 0 0 8px; padding: 8px 10px; background: var(--surface-sunken, #f6f6f7); border: 1px solid var(--line, #e4e4e7); border-radius: var(--radius-md, 8px); font: 400 13px/18px var(--font-sans); color: var(--ink-muted, #52525b); }
  .iv-grid-wide-note .iv-btn { flex: none; }
}

/* ---------- Phones: 44px tap targets ----------
   Buttons, menu and nav links, text fields, selects, checkboxes and radios are at least 44px tall. Anything inside a
   DevExpress grid keeps its compact rows and headers; invoay-devexpress.css handles the grid toolbar and editors. */
@media (max-width: 767px) {
  .iv-btn:not([class*="dxgvControl_"] *),
  .btn:not([class*="dxgvControl_"] *),
  .iv-menu > summary {
    height: auto;
    min-height: 44px;
  }
  .iv-btn.iv-btn-icon:not([class*="dxgvControl_"] *) { min-width: 44px; }

  .iv-menu-list a,
  .dropdown-menu > li > a,
  .iv-shell .navbar-nav > li > a {
    display: flex; align-items: center; gap: 8px; min-height: 44px; box-sizing: border-box;
  }

  /* The pinned footer stays thin, so its links get an invisible hit area instead of extra height. */
  .iv-footer a { position: relative; }
  .iv-footer a::after { content: ""; position: absolute; inset: -12px -6px; }

  input:not([type="checkbox"]):not([type="radio"]):not([type="range"]):not([type="hidden"]):not([type="button"]):not([type="submit"]):not([type="reset"]):not([type="image"]):not([type="file"]):not([type="color"]):not([class*="dxeEditArea_"]):not(.select2-search__field):not([class*="dxgvControl_"] *),
  select:not([class*="dxgvControl_"] *),
  .form-control:not([class*="dxgvControl_"] *),
  .iv-input:not([class*="dxgvControl_"] *),
  .iv-select:not([class*="dxgvControl_"] *) {
    min-height: 44px;
  }

  /* Checkbox and radio rows: the whole label is the target, not just the 16px box. */
  .iv-check, .checkbox > label, .radio > label, .checkbox-inline, .radio-inline {
    min-height: 44px; display: inline-flex; align-items: center; gap: 8px;
  }
  .iv-check input[type="checkbox"], .iv-check input[type="radio"] { position: relative; }
  .iv-check input[type="checkbox"]::before, .iv-check input[type="radio"]::before {
    content: ""; position: absolute; inset: -14px; /* extends the hit area around the 16px box */
  }
}

/* ---------- Phones: tab rows wrap instead of scrolling sideways ----------
   Dashboard tabs (.iv-dash-nav) and page tabs (.iv-tabs, Bootstrap .nav-tabs) put every tab in view over several rows. */
@media (max-width: 767px) {
  .iv-dash-nav, .iv-tabs, .nav-tabs { flex-wrap: wrap; overflow-x: visible; }
  .iv-dash-nav a, .iv-tab, .nav-tabs > li > a { min-height: 44px; box-sizing: border-box; }
  .nav-tabs > li { float: none; display: inline-block; }
  /* The small info button keeps its look; an invisible 44px area around it is the tap target. */
  .iv-tip { position: relative; }
  .iv-tip::after { content: ""; position: absolute; inset: -15px; }
}
