/*
 * Daryng Retail Labels v4.42.0 — Product Quality & Interaction Pass
 * Interaction/accessibility/responsive guardrails only. This file is intentionally
 * loaded last so older visual generations cannot weaken current usability rules.
 */

:root {
  --quality-focus: color-mix(in srgb, var(--ui-accent, #0b8e89) 72%, #0b4d61);
  --quality-focus-soft: color-mix(in srgb, var(--ui-accent, #0b8e89) 18%, transparent);
  --quality-touch: 42px;
}

html { scroll-padding-top: calc(var(--workspace-bar-height, 64px) + 18px); }

/* Company identity uses one stable viewport. Uploaded marks are never stretched or cropped. */
.company-logo-viewport {
  width: 42px;
  height: 42px;
  flex: 0 0 42px;
  display: grid;
  place-items: center;
  overflow: hidden;
  box-sizing: border-box;
  padding: 3px;
  border: 1px solid color-mix(in srgb, currentColor 11%, transparent);
  border-radius: 9px;
  background: color-mix(in srgb, currentColor 5%, transparent);
}
.company-logo-viewport > .saas-brand-logo {
  width: 100% !important;
  height: 100% !important;
  max-width: 100% !important;
  max-height: 100% !important;
  min-width: 0 !important;
  min-height: 0 !important;
  display: block;
  padding: 0 !important;
  border: 0 !important;
  border-radius: 5px !important;
  background: transparent !important;
  object-fit: contain !important;
  object-position: center !important;
  box-shadow: none !important;
}
.mobile-nav-heading .company-logo-viewport { width: 38px; height: 38px; flex-basis: 38px; }

/* We render our own caret. Suppress every native disclosure glyph so it can never double up. */
details > summary {
  list-style: none !important;
  -webkit-appearance: none;
  appearance: none;
}
details > summary::marker { content: "" !important; font-size: 0 !important; }
details > summary::-webkit-details-marker { display: none !important; }
.account-menu-caret {
  display: inline-block;
  transform: rotate(0deg);
  transform-origin: center;
  transition: transform 140ms ease;
}
.account-menu[open] > summary .account-menu-caret { transform: rotate(180deg); }

/* Strong, consistent keyboard focus. Mouse users do not receive decorative rings. */
:where(a, button, summary, input, select, textarea, [tabindex]):focus-visible {
  outline: 2px solid var(--quality-focus) !important;
  outline-offset: 2px !important;
}
:where(input, select, textarea):focus-visible {
  border-color: var(--quality-focus) !important;
  box-shadow: 0 0 0 3px var(--quality-focus-soft) !important;
}
#main-content:focus,
#editorWorkspace:focus { outline: none !important; }
::selection { background: color-mix(in srgb, var(--ui-accent, #0b8e89) 22%, transparent); }

/* Honest interaction states. */
:where(button, .button, summary)[disabled],
:where(button, .button)[aria-disabled="true"] { cursor: not-allowed; }
:where(button, .button, .nav-item, summary) { -webkit-tap-highlight-color: transparent; }
.field :where(input, select, textarea):user-invalid {
  border-color: var(--critical) !important;
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--critical) 12%, transparent) !important;
}
.field :where(input, select, textarea):user-valid:not(:placeholder-shown) {
  border-color: color-mix(in srgb, var(--success) 30%, var(--line-strong));
}

/* Prevent older transform-heavy rules from making everyday controls feel jumpy. */
body[data-ui-version] :where(.button, .nav-item, .data-table tbody tr, .card, .panel):hover {
  transform: none;
}

/* Working registers should preserve data, never crush it. */
body[data-ui-version] :where(.table-wrap, .ledger-wrap, [class*="-register"], [class*="-ledger"]) {
  max-width: 100%;
  overscroll-behavior-inline: contain;
  scrollbar-gutter: stable;
}
body[data-ui-version] .table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
body[data-ui-version] .data-table {
  width: max(100%, max-content);
  min-width: 100%;
}
body[data-ui-version] .data-table :where(th, td) {
  overflow-wrap: normal;
  word-break: normal;
}
body[data-ui-version] .data-table :where(code, .mono, .identifier, [data-identifier]) {
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

/* Search/filter empty result injected by quality-v442.js. */
.ledger-filter-empty td {
  padding: 0 !important;
  border-bottom: 0 !important;
}
.ledger-filter-empty-inner {
  min-height: 132px;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 6px;
  padding: 24px;
  color: var(--ink-muted);
  text-align: center;
}
.ledger-filter-empty-inner i { color: var(--ink-faint); font-size: 24px; }
.ledger-filter-empty-inner strong { color: var(--ink-secondary); font-size: var(--text-13); }
.ledger-filter-empty-inner span { max-width: 44ch; font-size: var(--text-12); line-height: 1.5; }

/* Mobile navigation is a real drawer, not a tiny dropdown floating under the bar. */
@media (max-width: 820px) {
  body.mobile-nav-open { overflow: hidden; }
  .mobile-menu[open]::before {
    content: "";
    position: fixed;
    inset: 0;
    z-index: calc(var(--z-dropdown) - 1);
    background: rgba(12, 23, 28, .46);
    backdrop-filter: blur(2px);
  }
  .mobile-nav-panel {
    position: fixed;
    top: 8px;
    bottom: 8px;
    left: 8px;
    width: min(390px, calc(100vw - 16px));
    max-height: none;
    z-index: var(--z-dropdown);
    border-radius: 14px;
    overscroll-behavior: contain;
  }
  .mobile-nav-heading {
    position: sticky;
    top: 0;
    z-index: 2;
    padding: 14px 14px 12px;
    background: var(--surface);
  }
  .mobile-routes { padding: 8px; }
  .mobile-routes .nav-item { min-height: 44px; padding-inline: 12px; }
  .mobile-logout {
    position: sticky;
    bottom: 0;
    padding: 10px;
    background: var(--surface);
  }
}

/* Compact phone shell: keep the current context useful without letting it crush the bar. */
@media (max-width: 620px) {
  .workspace-bar {
    gap: 8px;
    padding-inline: 10px;
  }
  .workspace-context { overflow: visible; }
  .workspace-context .context-switcher { max-width: calc(100vw - 122px); }
  .workspace-context .context-switcher select {
    width: 100%;
    min-width: 0;
    max-width: 100%;
  }
  .account-menu > summary { min-width: 40px; padding-inline: 4px; }
  .page-shell { width: calc(100% - 28px); }
  .page-header { margin-bottom: 18px; }
  .page-header h1 { font-size: clamp(1.55rem, 8vw, 1.9rem); line-height: 1.08; }
  .page-header p { margin-top: 7px; }
  .header-buttons { gap: 7px; }
}

/* Large user-selected UI scales should reflow before controls collide. */
body[data-font-size^="13"] :where(.header-buttons, .toolbar-actions, .filter-actions),
body[data-font-size="140"] :where(.header-buttons, .toolbar-actions, .filter-actions),
body[data-font-size="xlarge"] :where(.header-buttons, .toolbar-actions, .filter-actions) {
  flex-wrap: wrap;
}
body[data-font-size^="13"] .data-table,
body[data-font-size="140"] .data-table,
body[data-font-size="xlarge"] .data-table { width: max(100%, max-content); }

/* Coarse pointers get touch-sized controls without inflating desktop density. */
@media (pointer: coarse) {
  :where(.button, button, summary, .nav-item, .account-popover a, .account-popover button) {
    min-height: var(--quality-touch);
  }
  :where(input, select) { min-height: var(--quality-touch); }
}

/* Reduced motion must respect both OS and in-app preference. */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    scroll-behavior: auto !important;
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
}
body[data-motion="reduced"] *,
body[data-motion="reduced"] *::before,
body[data-motion="reduced"] *::after {
  scroll-behavior: auto !important;
  animation-duration: .01ms !important;
  animation-iteration-count: 1 !important;
  transition-duration: .01ms !important;
}
