:root {
  color-scheme: light;
  --background: #f4f4f5;
  --foreground: #18181b;
  --muted: #f4f4f5;
  --muted-foreground: #71717a;
  --border: #e4e4e7;
  --input: #a1a1aa;
  --ring: #18181b;
  --primary: #18181b;
  --primary-foreground: #fafafa;
  --secondary: #f4f4f5;
  --secondary-foreground: #18181b;
  --destructive: #dc2626;
  --destructive-foreground: #fafafa;
  --card: #ffffff;
  --card-foreground: #18181b;
  --radius: 0.5rem;
  --shadow: 0 1px 2px rgba(15, 23, 42, 0.04), 0 4px 14px rgba(15, 23, 42, 0.06);
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.05);
  /* Floating menus / combobox panels — strong enough to separate from page chrome */
  --shadow-dropdown:
    0 1px 2px rgba(15, 23, 42, 0.08),
    0 8px 24px rgba(15, 23, 42, 0.14),
    0 20px 48px rgba(15, 23, 42, 0.12);
  --font-sans: Inter, "Segoe UI", sans-serif;
  --font-display: Inter, "Segoe UI", sans-serif;
  --sidebar-width: 15rem;
  --app-min-width: 320px;
  /* Fixed UI scale — ignore OS/browser accessibility text inflation */
  --font-size-root: 16px;
  --font-size-body: 14px;
  --icon-size: 14px;
  --icon-size-sm: 12px;
  --control-height: 1.85rem;
  --control-font-size: 0.75rem;
  --ink: #0b1220;
  --paper: #eef1f4;
  --accent: #0f766e;
  --sidebar-bg: #ffffff;
  --control-bg: #ffffff;
  --control-hover: #e4e4e7;
  --btn-idle-bg: #ffffff;
  --btn-idle-border: #a1a1aa;
  --btn-idle-fg: #18181b;
  --btn-idle-hover: #e4e4e7;
}

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

html {
  /* Floor for usable layout (bottom nav, forms, padded cards); scroll if narrower */
  min-width: var(--app-min-width);
  overflow-x: auto;
  /*
   * Hard-lock type scale for this internal app.
   * Do not follow OS Dynamic Type / browser “larger text” / Chromium font boosting.
   */
  font-size: var(--font-size-root) !important;
  -webkit-text-size-adjust: none !important;
  text-size-adjust: none !important;
  -moz-text-size-adjust: none !important;
}

html,
body {
  margin: 0;
  padding: 0;
  min-height: 100%;
  font-family: var(--font-sans);
  background:
    radial-gradient(ellipse 70% 45% at 0% -10%, #ffffff 0%, transparent 55%),
    radial-gradient(ellipse 50% 35% at 100% 0%, #fafafa 0%, transparent 50%),
    var(--background);
  color: var(--foreground);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  min-width: var(--app-min-width);
  font-size: var(--font-size-body) !important;
  /* Reduce accidental double-tap / pinch zoom on controls */
  touch-action: manipulation;
  -webkit-text-size-adjust: none !important;
  text-size-adjust: none !important;
}

/* Keep controls/copy from inheriting system accessibility font scaling */
button,
input,
select,
textarea,
label,
a,
p,
span,
li,
td,
th,
h1,
h2,
h3,
h4,
h5,
h6,
.btn,
.card,
.nav,
.main {
  -webkit-text-size-adjust: none !important;
  text-size-adjust: none !important;
}

a {
  color: inherit;
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

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

.mobile-topbar {
  display: none;
}

.sidebar-backdrop {
  display: none;
}

.sidebar-header {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.sidebar-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.5rem;
}

.sidebar-nav-label {
  padding: 0.15rem 0.75rem 0.35rem;
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted-foreground);
  line-height: 1.2;
}

.icon-btn.mobile-nav-close {
  display: none;
}

.desktop-only {
  display: inline-flex;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  max-height: 100vh;
  overflow-y: auto;
  background: var(--sidebar-bg);
  border-right: 1px solid var(--border);
  padding: 1.25rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  box-sizing: border-box;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  min-width: 0;
  font-weight: 600;
  font-size: 1.05rem;
  letter-spacing: -0.02em;
  padding: 0.25rem 0.5rem;
}

.brand__icon {
  flex: 0 0 auto;
  width: 1.35rem;
  height: 1.35rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: #0a0a0a;
}

.brand__mark {
  width: 54%;
  height: 54%;
  display: block;
  object-fit: contain;
}

.brand__text {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.brand__product,
.brand__sep {
  font-weight: inherit;
}

.brand__org {
  color: var(--muted-foreground);
  font-weight: 500;
}

.sidebar-identity {
  display: flex;
  align-items: center;
  min-width: 0;
  flex: 1;
}

.sidebar-identity__user {
  display: none;
}

.sidebar-mobile-extra {
  display: none;
}

.brand--compact {
  padding: 0;
  font-size: inherit;
}

.brand--compact .brand__icon {
  width: 1.2rem;
  height: 1.2rem;
}

.nav {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.nav a {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.55rem 0.75rem;
  border-radius: var(--radius);
  color: var(--muted-foreground);
  text-decoration: none;
  font-size: 0.925rem;
  min-height: 2.5rem;
}

.nav a:hover,
.nav a.is-active {
  background: var(--muted);
  color: var(--foreground);
  text-decoration: none;
}

.nav .icon,
.btn .icon,
.icon {
  display: inline-flex;
  width: var(--icon-size);
  height: var(--icon-size);
  min-width: var(--icon-size);
  min-height: var(--icon-size);
  flex-shrink: 0;
}

.nav .icon svg,
.btn .icon svg,
.icon svg {
  width: 100%;
  height: 100%;
  max-width: 100%;
  max-height: 100%;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.75;
  stroke-linecap: round;
  stroke-linejoin: round;
  /* Keep SVG glyphs from picking up OS text metrics */
  vector-effect: non-scaling-stroke;
}

.icon-fill svg,
.btn .icon.icon-fill svg {
  fill: currentColor;
  stroke: none;
}

.sidebar-account {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.sidebar-footer {
  margin-top: auto;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  position: relative;
}

.sidebar-settings-link {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.5rem 0.75rem;
  border-radius: var(--radius);
  color: var(--muted-foreground);
  text-decoration: none;
  font-size: 0.875rem;
  font-weight: 500;
  line-height: 1;
  min-height: 2.35rem;
}

.sidebar-settings-link:hover,
.sidebar-settings-link.is-active {
  background: var(--muted);
  color: var(--foreground);
  text-decoration: none;
}

.sidebar-settings-link .icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1rem;
  height: 1rem;
  line-height: 0;
}

.sidebar-logout-link {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.5rem 0.75rem;
  border-radius: var(--radius);
  color: var(--muted-foreground);
  text-decoration: none;
  font-size: 0.875rem;
  font-weight: 500;
  line-height: 1;
  min-height: 2.35rem;
}

.sidebar-logout-link:hover {
  background: var(--muted);
  color: var(--foreground);
  text-decoration: none;
}

.sidebar-logout-link .icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1rem;
  height: 1rem;
  line-height: 0;
}

.mobile-bottom-nav {
  display: none;
}

.sidebar-user {
  position: relative;
  display: flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0;
  font-size: 0.875rem;
  color: var(--muted-foreground);
}

.sidebar-user-static {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  min-width: 0;
  flex: 1;
  margin: 0;
  padding: 0.5rem 0.75rem;
  border-radius: var(--radius);
  color: inherit;
  font: inherit;
  font-weight: 500;
  line-height: 1;
  min-height: 2.35rem;
}

.sidebar-user-trigger {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  min-width: 0;
  flex: 1;
  margin: 0;
  padding: 0.5rem 0.75rem;
  border: none;
  border-radius: var(--radius);
  background: transparent;
  color: inherit;
  font: inherit;
  font-weight: 500;
  line-height: 1;
  text-align: left;
  cursor: pointer;
  min-height: 2.35rem;
}

.sidebar-user-trigger:hover,
.sidebar-user[data-user-menu-open] .sidebar-user-trigger {
  background: var(--secondary);
}

.sidebar-user-trigger:focus-visible {
  outline: 2px solid var(--ring);
  outline-offset: 1px;
}

.sidebar-user-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1rem;
  height: 1rem;
  flex-shrink: 0;
  line-height: 0;
  color: var(--foreground);
}

.sidebar-user .name {
  flex: 0 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--foreground);
  font-weight: 500;
  line-height: 1;
  display: inline-flex;
  align-items: center;
}

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  border-radius: var(--radius);
  border: none;
  background: transparent;
  color: var(--btn-idle-fg);
  text-decoration: none;
  flex-shrink: 0;
}

.icon-btn.is-active,
.icon-btn:hover {
  background: var(--btn-idle-hover);
  text-decoration: none;
}

.role-crown {
  color: #fbbf24;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 0.95rem;
  height: 0.95rem;
  flex-shrink: 0;
  line-height: 0;
}

.role-crown svg {
  width: 100%;
  height: 100%;
  fill: currentColor;
}

.main {
  padding: 1.75rem 2rem 3rem;
  max-width: 1100px;
  width: 100%;
  min-width: 0;
  margin-inline: auto;
  justify-self: center;
}

.billing-shell {
  min-height: 100vh;
  min-height: 100dvh;
  background: var(--background);
}

.billing-topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  padding: 1rem 1.25rem;
  background: rgba(244, 244, 245, 0.96);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(10px);
}

.billing-topbar__brand {
  min-width: 0;
}

.billing-topbar__tagline {
  margin: 0.35rem 0 0;
  color: var(--muted-foreground);
  font-size: 0.875rem;
}

.billing-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  justify-content: flex-end;
}

.billing-nav a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  min-height: 2.25rem;
  padding: 0 0.55rem;
  border: none;
  border-radius: var(--radius);
  background: transparent;
  color: var(--btn-idle-fg);
  text-decoration: none;
  font-size: 0.875rem;
  font-weight: 500;
}

.billing-nav a:hover,
.billing-nav a.is-active {
  color: var(--btn-idle-fg);
  background: var(--btn-idle-hover);
  text-decoration: none;
}

.billing-nav-label {
  display: inline;
}

.billing-main {
  max-width: 1100px;
  margin: 0 auto;
  padding: 1.5rem 1.25rem 3rem;
}

.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
}

.page-header > div:first-child {
  min-width: 0;
  flex: 1 1 auto;
}

.page-header__lead {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  min-width: 0;
  flex: 1 1 auto;
}

.page-header__lead h1 {
  min-width: 0;
}

.page-back {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  flex-shrink: 0;
  margin: 0 0.35rem 0 0;
  padding: 0;
  border: none;
  background: none;
  box-shadow: none;
  color: var(--muted-foreground);
  font: inherit;
  font-weight: 500;
  line-height: 1;
  text-decoration: none;
  cursor: pointer;
}

.page-back:hover,
.page-back:focus-visible {
  color: var(--foreground);
  background: none;
  border: none;
  box-shadow: none;
  outline: none;
}

.page-back:focus-visible {
  outline: 2px solid var(--ring);
  outline-offset: 2px;
  border-radius: 2px;
}

.page-back__icon {
  width: 1.1rem;
  height: 1.1rem;
}

.page-back__label {
  text-transform: lowercase;
}

.settings-nav {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.settings-nav__group {
  padding: 0.25rem 0;
  overflow: hidden;
}

.settings-nav__link {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  width: 100%;
  margin: 0;
  padding: 0.95rem 1rem;
  border: none;
  background: none;
  box-shadow: none;
  color: var(--foreground);
  font: inherit;
  text-decoration: none;
  cursor: pointer;
}

.settings-nav__link + .settings-nav__link {
  border-top: 1px solid var(--border);
}

.settings-nav__link:hover,
.settings-nav__link:focus-visible {
  background: color-mix(in srgb, var(--muted) 55%, transparent);
  outline: none;
}

.settings-nav__icon {
  width: 1.15rem;
  height: 1.15rem;
  flex-shrink: 0;
  color: var(--muted-foreground);
}

.settings-nav__copy {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  min-width: 0;
  flex: 1 1 auto;
}

.settings-nav__title {
  font-weight: 550;
  line-height: 1.2;
}

.settings-nav__meta {
  margin: 0;
  font-size: 0.875rem;
  color: var(--muted-foreground);
}

.settings-nav__chevron {
  width: 1rem;
  height: 1rem;
  flex-shrink: 0;
  color: var(--muted-foreground);
}

.settings-nav__badge {
  flex-shrink: 0;
}

.page-header h1 {
  margin: 0;
  font-size: 1.5rem;
  letter-spacing: -0.03em;
  font-weight: 600;
}

.page-header p {
  margin: 0.35rem 0 0;
  color: var(--muted-foreground);
  font-size: 0.925rem;
}

.stack {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.stack[hidden],
.row[hidden] {
  display: none !important;
}

.row {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
  align-items: center;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.3rem;
  height: var(--control-height);
  min-height: var(--control-height);
  padding: 0 0.65rem;
  border-radius: var(--radius);
  border: 1px solid transparent;
  font: inherit;
  font-size: var(--control-font-size);
  font-weight: 550;
  cursor: pointer;
  text-decoration: none;
  box-shadow: none;
  transition: background 0.12s ease, border-color 0.12s ease, opacity 0.12s ease, box-shadow 0.12s ease;
}

.btn:hover {
  text-decoration: none;
  opacity: 0.94;
}

.btn:focus-visible {
  outline: 2px solid var(--ring);
  outline-offset: 2px;
}

.btn:disabled {
  opacity: 0.65;
  cursor: not-allowed;
  pointer-events: none;
}

.btn.is-submitting,
button.is-submitting {
  opacity: 0.65;
  cursor: wait;
  pointer-events: none;
}

/* Instant navigation / submit loading — YouTube/Reddit-style top progress line. */
.page-loading {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: auto;
  z-index: 2147483646;
  width: 100%;
  max-width: none;
  height: 4.5px;
  margin: 0;
  padding: 0;
  border: none;
  overflow: hidden;
  display: block;
  background: transparent;
  color: inherit;
  pointer-events: none;
  opacity: 0;
  visibility: hidden;
  transition: opacity 80ms ease, visibility 80ms ease;
}

.page-loading:popover-open,
.page-loading.is-visible {
  display: block !important;
  opacity: 1;
  visibility: visible;
}

.page-loading__track {
  position: relative;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: transparent;
}

.page-loading__bar {
  position: absolute;
  top: 0;
  left: 0;
  height: 100%;
  width: 40%;
  background: #0a0a0a;
  box-shadow: 0 0 8px rgba(10, 10, 10, 0.35);
  transform: translateX(-100%);
  animation: page-loading-bar 1.15s ease-in-out infinite;
  animation-play-state: paused;
}

.page-loading:popover-open .page-loading__bar,
.page-loading.is-visible .page-loading__bar {
  animation-play-state: running;
}

@keyframes page-loading-bar {
  0% {
    transform: translateX(-100%);
    width: 35%;
  }
  45% {
    width: 55%;
  }
  100% {
    transform: translateX(320%);
    width: 35%;
  }
}

@media (prefers-reduced-motion: reduce) {
  .page-loading__bar {
    animation: none;
    transform: none;
    width: 40%;
    left: 0;
  }
}

body.is-page-loading {
  cursor: progress;
}

.btn-primary {
  background: var(--primary);
  color: var(--primary-foreground);
  box-shadow: none;
}

.btn-secondary {
  background: transparent;
  color: var(--muted-foreground);
  border-color: var(--border);
  box-shadow: none;
}

.btn-secondary:hover {
  background: var(--muted);
  color: var(--foreground);
  border-color: var(--border);
  opacity: 1;
}

.btn-ghost {
  background: transparent;
  color: var(--muted-foreground);
  border-color: transparent;
  box-shadow: none;
}

.btn-ghost:hover {
  background: var(--muted);
  color: var(--foreground);
  opacity: 1;
}

.btn-tool {
  width: var(--control-height);
  min-width: var(--control-height);
  max-width: var(--control-height);
  padding: 0;
  color: var(--muted-foreground);
}

.btn-tool:hover {
  color: var(--foreground);
}

.page-header__actions {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  flex: 0 0 auto;
}

.page-header__action-group {
  display: inline-flex;
  align-items: center;
  gap: 0.2rem;
  padding: 0.15rem;
  border: 1px solid var(--border);
  border-radius: calc(var(--radius) + 2px);
  background: color-mix(in srgb, var(--card) 88%, var(--muted));
}

.page-header__action-group .btn-tool {
  border-radius: calc(var(--radius) - 1px);
}

.page-header__action-group .btn-split__main {
  border-top-left-radius: calc(var(--radius) - 1px);
  border-bottom-left-radius: calc(var(--radius) - 1px);
}

.page-header__action-group .btn-split__caret {
  border-top-right-radius: calc(var(--radius) - 1px);
  border-bottom-right-radius: calc(var(--radius) - 1px);
}

.btn-split {
  position: relative;
  display: inline-flex;
  align-items: stretch;
  flex: 0 0 auto;
}

.btn-split__main {
  border-top-right-radius: 0;
  border-bottom-right-radius: 0;
  padding-right: 0.5rem;
}

.btn-split__caret {
  width: 1.5rem;
  min-width: 1.5rem;
  max-width: 1.5rem;
  padding: 0;
  border-top-left-radius: 0;
  border-bottom-left-radius: 0;
  border-left: 1px solid rgba(255, 255, 255, 0.22);
}

.btn-split__caret.btn-secondary {
  border-left-color: var(--border);
}

.btn-split__caret .icon {
  width: 0.8rem;
  height: 0.8rem;
  transition: transform 0.12s ease;
}

.btn-split.is-open .btn-split__caret .icon {
  transform: rotate(180deg);
}

.btn-split__menu {
  position: absolute;
  top: calc(100% + 0.25rem);
  right: 0;
  z-index: 40;
  min-width: 100%;
  padding: 0.2rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--card);
  box-shadow: var(--shadow-dropdown);
}

.btn-split__menu[hidden] {
  display: none;
}

.btn-split__option {
  display: flex;
  width: 100%;
  margin: 0;
  padding: 0.4rem 0.55rem;
  border: none;
  border-radius: calc(var(--radius) - 2px);
  background: transparent;
  color: var(--foreground);
  font: inherit;
  font-size: 0.75rem;
  font-weight: 550;
  text-align: left;
  cursor: pointer;
  white-space: nowrap;
}

.btn-split__option--subtle {
  color: var(--muted-foreground);
  font-weight: 500;
}

.btn-split__option:hover,
.btn-split__option.is-selected {
  background: var(--muted);
  color: var(--foreground);
}

.btn-logout {
  background: var(--btn-idle-bg);
  color: var(--btn-idle-fg);
  border: 1px solid var(--btn-idle-border);
  width: 100%;
  box-shadow: var(--shadow-sm);
}

.btn-logout:hover {
  background: var(--btn-idle-hover);
}

.btn-destructive {
  background: var(--destructive);
  color: var(--destructive-foreground);
  box-shadow: var(--shadow-sm);
}

.card {
  background: var(--card);
  color: var(--card-foreground);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.25rem;
}

.card-title {
  margin: 0 0 0.25rem;
  font-size: 1rem;
  font-weight: 600;
}

.card-desc {
  margin: 0;
  color: var(--muted-foreground);
  font-size: 0.875rem;
}

.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 0.75rem;
}

.stat-value {
  font-size: 1.75rem;
  font-weight: 600;
  letter-spacing: -0.03em;
}

.stat-label {
  color: var(--muted-foreground);
  font-size: 0.8rem;
}

.period-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.period-tabs .btn {
  font-size: 0.8125rem;
  padding: 0.35rem 0.75rem;
}

.billing-period-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.9rem;
}

.billing-period-tabs a {
  min-height: 2rem;
  padding: 0 0.7rem;
}

.billing-template-picker__list {
  display: grid;
  gap: 0.75rem;
}

.billing-template-option {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.25rem;
  width: 100%;
  padding: 0.9rem 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--card);
  color: var(--foreground);
  text-align: left;
  cursor: pointer;
  transition: border-color 0.12s ease, background 0.12s ease;
}

.billing-template-option:hover,
.billing-template-option.is-active {
  border-color: var(--foreground);
  background: var(--muted);
}

.billing-template-option__title {
  font-weight: 600;
}

.billing-template-option__desc,
.billing-template-option__meta {
  color: var(--muted-foreground);
  font-size: 0.875rem;
}

.invoice-pdf-template-list {
  display: grid;
  gap: 0.45rem;
}

.invoice-pdf-template-option {
  display: flex;
  flex-direction: column;
  gap: 0;
  width: 100%;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--card);
  color: var(--foreground);
  text-align: left;
  overflow: hidden;
  transition: border-color 0.12s ease, background 0.12s ease;
}

.invoice-pdf-template-option:hover,
.invoice-pdf-template-option.is-selected,
.invoice-pdf-template-option:has(input:checked) {
  border-color: var(--foreground);
  background: var(--muted);
}

.invoice-pdf-template-option > input[type="radio"] {
  margin: 0;
  accent-color: var(--foreground);
  flex-shrink: 0;
}

.invoice-pdf-template-option__head {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.5rem 0.75rem;
  cursor: pointer;
}

.invoice-pdf-template-option__head input {
  margin: 0;
  accent-color: var(--foreground);
  flex-shrink: 0;
}

.invoice-pdf-template-option__name {
  font-weight: 600;
  font-size: 0.875rem;
  line-height: 1.2;
}

.invoice-pdf-template-settings {
  border-top: 1px solid var(--border);
  background: var(--card);
}

.invoice-pdf-template-settings__summary {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.4rem 0.75rem;
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--muted-foreground);
  cursor: pointer;
  list-style: none;
  user-select: none;
}

.invoice-pdf-template-settings__summary::-webkit-details-marker {
  display: none;
}

.invoice-pdf-template-settings__summary::before {
  content: "";
  display: inline-block;
  width: 0.35rem;
  height: 0.35rem;
  border-right: 1.5px solid var(--muted-foreground);
  border-bottom: 1.5px solid var(--muted-foreground);
  transform: rotate(-45deg);
  transition: transform 0.15s ease;
  flex-shrink: 0;
}

.invoice-pdf-template-settings[open] .invoice-pdf-template-settings__summary::before {
  transform: rotate(45deg);
}

.invoice-pdf-template-settings__body {
  display: grid;
  gap: 0.65rem;
  padding: 0 0.75rem 0.75rem;
}

.invoice-pdf-template-settings__empty {
  margin: 0;
  font-size: 0.8rem;
}

.invoice-pdf-bos-settings__row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.invoice-pdf-bos-settings__preview {
  width: 3.5rem;
  height: 3.5rem;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: #fff;
  overflow: hidden;
}

.invoice-pdf-bos-settings__preview img {
  display: block;
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

.invoice-pdf-bos-settings__empty {
  font-size: 0.7rem;
  color: var(--muted-foreground);
}

.invoice-pdf-bos-settings__upload {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  flex-wrap: wrap;
  min-width: 0;
}

.invoice-pdf-bos-settings__upload input[type="file"] {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.invoice-pdf-bos-settings__clear {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.8rem;
  color: var(--muted-foreground);
  cursor: pointer;
}

.invoice-pdf-bos-settings__opacity {
  display: grid;
  gap: 0.25rem;
  max-width: 16rem;
}

.invoice-pdf-bos-settings__opacity label {
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--muted-foreground);
}

.invoice-pdf-bos-settings__opacity input[type="range"] {
  width: 100%;
  accent-color: var(--foreground);
}

.invoice-pdf-bos-settings [data-opacity-value] {
  margin-left: 0.25rem;
  font-weight: 600;
  color: var(--foreground);
}

.invoice-pdf-bos-settings .error {
  font-size: 0.8rem;
  color: var(--destructive);
  width: 100%;
}

.analytics-chart-wrap {
  position: relative;
  height: 280px;
  margin-top: 0.75rem;
}

.analytics-chart-header {
  display: block;
}

.analytics-chart-totals {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-start;
  gap: 0.75rem 1.15rem;
  margin-top: 0.65rem;
  color: var(--muted-foreground);
  font-size: 0.875rem;
  font-weight: 500;
  line-height: 1.3;
  white-space: nowrap;
}

.analytics-chart-total {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  cursor: default;
}

.analytics-chart-total .icon {
  display: inline-flex;
  width: 1rem;
  height: 1rem;
  flex-shrink: 0;
  color: var(--muted-foreground);
}

.operations-activity-card .card-desc {
  margin-bottom: 0;
}

.operations-chart-wrap {
  position: relative;
  height: 9.5rem;
  margin-top: 0.55rem;
}

.profit-positive {
  color: var(--success, #15803d);
}

.profit-negative {
  color: var(--destructive, #b91c1c);
}

.public-page {
  min-height: 100vh;
  padding: 2rem 1rem 3rem;
  background: var(--background);
}

.public-page-inner {
  max-width: 720px;
  margin: 0 auto;
}

.public-intake {
  --public-ink: var(--foreground, #18181b);
  --public-muted: var(--muted-foreground, #71717a);
  --public-surface: var(--card, #ffffff);
  --public-border: var(--border, #e4e4e7);
  position: relative;
  min-height: 100vh;
  padding: 2.25rem 1.1rem 3.5rem;
  overflow-x: hidden;
  background:
    radial-gradient(ellipse 80% 50% at 10% -10%, color-mix(in srgb, #0f766e 12%, transparent), transparent 55%),
    radial-gradient(ellipse 70% 45% at 100% 0%, color-mix(in srgb, #1e3a5f 10%, transparent), transparent 50%),
    linear-gradient(180deg, #f7f8fa 0%, #eef1f4 100%);
}

.public-intake__glow {
  pointer-events: none;
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(color-mix(in srgb, var(--public-ink) 4%, transparent) 1px, transparent 1px),
    linear-gradient(90deg, color-mix(in srgb, var(--public-ink) 4%, transparent) 1px, transparent 1px);
  background-size: 28px 28px;
  mask-image: linear-gradient(180deg, rgba(0, 0, 0, 0.35), transparent 70%);
  opacity: 0.55;
}

.public-intake__inner {
  position: relative;
  z-index: 1;
  max-width: 40rem;
  margin: 0 auto;
}

.public-intake__hero {
  margin-bottom: 1.35rem;
  animation: public-intake-rise 0.55s ease-out both;
}

.public-intake__brand {
  margin: 0 0 0.55rem;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(1.65rem, 4vw, 2.15rem);
  letter-spacing: -0.03em;
  color: var(--public-ink);
  line-height: 1.1;
}

.public-intake__title {
  margin: 0 0 0.45rem;
  font-family: var(--font-sans);
  font-size: 1.15rem;
  font-weight: 600;
  color: var(--public-ink);
  letter-spacing: -0.01em;
}

.public-intake__lede {
  margin: 0;
  max-width: 36rem;
  color: var(--public-muted);
  font-size: 0.98rem;
  line-height: 1.5;
}

.public-intake__card {
  background: var(--public-surface);
  border: 1px solid color-mix(in srgb, var(--public-border) 80%, transparent);
  border-radius: 14px;
  box-shadow:
    0 1px 2px color-mix(in srgb, var(--public-ink) 4%, transparent),
    0 18px 40px -28px color-mix(in srgb, var(--public-ink) 28%, transparent);
  animation: public-intake-rise 0.6s ease-out 0.06s both;
}

.public-intake__form {
  padding: 1.25rem 1.2rem 1.35rem;
}

.public-intake__card--notice,
.public-intake__card--success {
  padding: 1.75rem 1.35rem;
  text-align: left;
}

.public-intake__card--success .public-intake__brand {
  font-size: 1.1rem;
  margin-bottom: 0.75rem;
}

.public-intake__notice-title {
  margin: 0 0 0.4rem;
  font-size: 1.1rem;
}

.public-intake__notice-body {
  margin: 0;
  color: var(--public-muted);
  line-height: 1.5;
}

.public-intake__alert {
  margin: 0 0 1rem;
  padding: 0.7rem 0.85rem;
  border-radius: 8px;
  background: color-mix(in srgb, #b91c1c 8%, transparent);
  border: 1px solid color-mix(in srgb, #b91c1c 22%, transparent);
  color: #991b1b;
  font-size: 0.9rem;
}

.public-intake__fields {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.public-intake__section-label {
  margin: 1.15rem 0 0.55rem;
  padding-top: 0.85rem;
  border-top: 1px solid var(--public-border);
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--public-muted);
}

.public-intake__section-label:first-child {
  margin-top: 0;
  padding-top: 0;
  border-top: none;
}

.public-intake__supplier {
  margin-top: 0.35rem;
}

.public-intake__supplier-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.85rem;
  margin: 1rem 0 0.25rem;
  padding: 0.9rem 1rem;
  border: 1px solid color-mix(in srgb, #0f766e 28%, var(--public-border));
  border-radius: 12px;
  background: color-mix(in srgb, #0f766e 8%, var(--public-surface));
}

.public-intake__supplier-banner[hidden] {
  display: none !important;
}

.public-intake__supplier-banner-title {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--public-ink);
}

.public-intake__supplier-banner-meta {
  margin: 0.2rem 0 0;
  font-size: 0.88rem;
  color: var(--public-muted);
  line-height: 1.35;
}

.public-intake__supplier-body[hidden] {
  display: none !important;
}

.public-intake__supplier.is-collapsed .public-intake__section-label {
  display: none;
}

.public-intake__imei {
  margin-bottom: 0.15rem;
}

.public-intake__form .form-field {
  margin-bottom: 1rem;
}

.public-intake__form .form-field label {
  font-size: 0.9rem;
  font-weight: 600;
}

.public-intake__form .help {
  font-size: 0.8rem;
  line-height: 1.4;
}

.public-intake__form .input,
.public-intake__form .select,
.public-intake__form .textarea,
.public-intake__form input[type="text"],
.public-intake__form input[type="email"],
.public-intake__form input[type="number"],
.public-intake__form input[type="tel"],
.public-intake__form input[type="url"],
.public-intake__form select,
.public-intake__form textarea {
  height: 2.65rem;
  font-size: 1rem;
  border-radius: 10px;
  padding: 0 0.85rem;
}

.public-intake__form input[type="file"] {
  height: 2.65rem;
  font-size: 0.95rem;
  border-radius: 10px;
  padding: 0 0.55rem;
  display: inline-flex;
  align-items: center;
  box-sizing: border-box;
}

.public-intake__form input[type="file"]::file-selector-button,
.public-intake__form input[type="file"]::-webkit-file-upload-button {
  height: 1.9rem;
  margin: 0 0.65rem 0 0;
  padding: 0 0.75rem;
  border: 1px solid var(--public-border);
  border-radius: 8px;
  background: color-mix(in srgb, var(--public-ink) 5%, var(--public-surface));
  color: var(--public-ink);
  font: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  line-height: 1;
  cursor: pointer;
}

.public-intake__form textarea {
  height: auto;
  min-height: 5.5rem;
  padding: 0.7rem 0.85rem;
}

.public-intake__form .imei-field__control input {
  height: 2.65rem;
  border-radius: 10px;
}

.public-intake__form .imei-field__camera {
  width: 2rem;
  height: 2rem;
}

.public-intake__form .imei-field__camera .icon {
  width: 1.05rem;
  height: 1.05rem;
}

.public-intake__actions {
  margin-top: 1.35rem;
  padding-top: 1rem;
  border-top: 1px solid var(--public-border);
  position: sticky;
  bottom: 0;
  background: linear-gradient(180deg, transparent, var(--public-surface) 18%);
  padding-bottom: 0.15rem;
}

.public-intake__actions .btn-lg {
  width: 100%;
  min-height: 2.85rem;
  font-size: 1.05rem;
  border-radius: 10px;
}

.public-intake__footnote {
  margin: 0.65rem 0 0;
  font-size: 0.82rem;
  text-align: center;
  line-height: 1.4;
}

.public-intake__product-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem 0.75rem;
  margin: 0 0 1.1rem;
  color: var(--public-muted);
  font-size: 0.9rem;
}

.public-intake__product-meta code {
  font-size: 0.85em;
}

.public-intake__detail-list {
  display: grid;
  gap: 0.95rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.public-intake__detail-list dt {
  margin: 0;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--public-muted);
}

.public-intake__detail-list dd {
  margin: 0.3rem 0 0;
  font-size: 1rem;
  line-height: 1.45;
  color: var(--public-ink);
  word-break: break-word;
}

.public-intake__detail-list img,
.public-intake__detail-list video {
  display: block;
  max-width: 100%;
  max-height: 280px;
  margin-top: 0.25rem;
  border-radius: 10px;
  border: 1px solid var(--public-border);
}

.public-intake__buy-intro {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  align-items: flex-start;
}

.public-pdp__inner {
  position: relative;
  z-index: 1;
  max-width: 64rem;
  margin: 0 auto;
}

.public-pdp__top {
  margin-bottom: 1.5rem;
  animation: public-intake-rise 0.55s ease-out both;
}

.public-pdp__layout {
  display: grid;
  gap: 1.5rem;
  margin-bottom: 1.75rem;
  animation: public-intake-rise 0.6s ease-out 0.05s both;
}

.public-pdp__gallery {
  display: grid;
  gap: 0.75rem;
}

.public-pdp__media {
  margin: 0;
  overflow: hidden;
  border-radius: 16px;
  background: color-mix(in srgb, var(--public-surface) 70%, #dbe3ea);
  border: 1px solid color-mix(in srgb, var(--public-border) 70%, transparent);
  box-shadow:
    0 1px 2px color-mix(in srgb, var(--public-ink) 4%, transparent),
    0 22px 48px -30px color-mix(in srgb, var(--public-ink) 30%, transparent);
  aspect-ratio: 1 / 1;
}

.public-pdp__media.is-primary {
  aspect-ratio: 4 / 5;
}

.public-pdp__media img,
.public-pdp__media video {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.public-pdp__media--placeholder {
  display: grid;
  place-items: center;
  min-height: 16rem;
  background:
    linear-gradient(145deg, color-mix(in srgb, #0f766e 10%, #eef2f5), #e8eef3 55%, color-mix(in srgb, #1e3a5f 8%, #eef2f5));
}

.public-pdp__placeholder-mark {
  font-family: var(--font-display);
  font-size: clamp(4rem, 18vw, 7rem);
  font-weight: 800;
  letter-spacing: -0.06em;
  color: color-mix(in srgb, var(--public-ink) 18%, transparent);
  text-transform: uppercase;
  user-select: none;
}

.public-pdp__summary {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.55rem;
}

.public-pdp__eyebrow {
  margin: 0;
  font-size: 0.82rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--public-muted);
}

.public-pdp__title {
  margin: 0;
  font-family: var(--font-sans);
  font-size: clamp(1.45rem, 3.5vw, 1.85rem);
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1.2;
  color: var(--public-ink);
}

.public-pdp__price {
  margin: 0.15rem 0 0;
  font-family: var(--font-display);
  font-size: clamp(1.65rem, 4vw, 2.1rem);
  font-weight: 700;
  letter-spacing: -0.03em;
  color: var(--public-ink);
  line-height: 1.1;
}

.public-pdp__meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 0.85rem;
  margin: 0.25rem 0 0;
  padding: 0;
  list-style: none;
  color: var(--public-muted);
  font-size: 0.9rem;
}

.public-pdp__meta code {
  font-size: 0.85em;
}

.public-pdp__stock {
  color: #0f766e;
  font-weight: 600;
}

.public-pdp__cta {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  align-items: flex-start;
  margin-top: 0.65rem;
  width: 100%;
}

.public-pdp__cta .btn-lg {
  min-height: 2.85rem;
  padding-inline: 1.35rem;
  border-radius: 10px;
  font-size: 1.05rem;
}

.public-pdp__cta-note {
  margin: 0;
  max-width: 28rem;
  color: var(--public-muted);
  font-size: 0.88rem;
  line-height: 1.45;
}

.public-pdp__notice {
  margin-top: 0.75rem;
  width: 100%;
}

.public-pdp__section-title {
  margin: 0 0 0.85rem;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--public-muted);
}

.public-pdp__specs {
  margin-bottom: 1.5rem;
  padding: 1.15rem 1.2rem 1.25rem;
  background: var(--public-surface);
  border: 1px solid color-mix(in srgb, var(--public-border) 80%, transparent);
  border-radius: 14px;
  box-shadow:
    0 1px 2px color-mix(in srgb, var(--public-ink) 4%, transparent),
    0 18px 40px -28px color-mix(in srgb, var(--public-ink) 22%, transparent);
  animation: public-intake-rise 0.6s ease-out 0.1s both;
}

.public-pdp__spec-grid {
  display: grid;
  gap: 0.9rem 1.25rem;
  margin: 0;
  padding: 0;
}

.public-pdp__spec dt {
  margin: 0;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--public-muted);
}

.public-pdp__spec dd {
  margin: 0.28rem 0 0;
  font-size: 1rem;
  line-height: 1.45;
  color: var(--public-ink);
  word-break: break-word;
}

.public-pdp__buy-panel {
  padding: 1.25rem 1.2rem 1.35rem;
  margin-bottom: 1rem;
  animation: public-intake-rise 0.45s ease-out both;
}

.public-pdp__buy-panel[hidden] {
  display: none !important;
}

.public-pdp__buy-form {
  padding: 0;
}

.public-pdp__buy-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.35rem;
}

@keyframes public-intake-rise {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (min-width: 640px) {
  .public-intake {
    padding: 3rem 1.5rem 4rem;
  }

  .public-intake__form {
    padding: 1.5rem 1.5rem 1.6rem;
  }

  .public-intake__actions .btn-lg {
    width: auto;
    min-width: 12rem;
  }

  .public-intake__footnote {
    text-align: left;
  }

  .public-pdp__spec-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (min-width: 860px) {
  .public-pdp__layout {
    grid-template-columns: minmax(0, 1.05fr) minmax(0, 0.95fr);
    gap: 2.25rem;
    align-items: start;
  }

  .public-pdp__summary {
    position: sticky;
    top: 1.5rem;
    padding-top: 0.35rem;
  }

  .public-pdp__cta .btn-lg {
    width: auto;
    min-width: 14rem;
  }

  .public-pdp__media.is-primary {
    aspect-ratio: 1 / 1;
  }
}

.notification-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.notification-list li {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--border);
}

.notification-list li.is-unread a {
  font-weight: 600;
}

.share-link-url {
  min-width: 0;
  max-width: 100%;
}

.share-links-section {
  padding: 0;
  overflow: hidden;
}

.share-links-summary {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 1rem 1.15rem;
  cursor: pointer;
  list-style: none;
  user-select: none;
}

.share-links-summary::-webkit-details-marker {
  display: none;
}

.capabilities-panel {
  padding: 0;
  overflow: hidden;
}

.capabilities-panel__summary {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 1rem 1.15rem;
  cursor: pointer;
  list-style: none;
  user-select: none;
}

.capabilities-panel__summary::-webkit-details-marker {
  display: none;
}

.capabilities-panel__summary::before {
  content: "";
  display: inline-block;
  width: 0.45rem;
  height: 0.45rem;
  border-right: 2px solid var(--muted-foreground);
  border-bottom: 2px solid var(--muted-foreground);
  transform: rotate(-45deg);
  transition: transform 0.15s ease;
  flex-shrink: 0;
}

.capabilities-panel[open] > .capabilities-panel__summary::before {
  transform: rotate(45deg);
}

.capabilities-panel__body {
  padding: 0 1.15rem 1.15rem;
}

.checkbox-row.is-disabled,
.checkbox-row.is-locked {
  opacity: 0.72;
  cursor: default;
}

.checkbox-row.is-disabled input,
.checkbox-row.is-locked input[type="checkbox"] {
  cursor: not-allowed;
}

.share-links-summary::before {
  content: "";
  display: inline-block;
  width: 0.45rem;
  height: 0.45rem;
  border-right: 2px solid var(--muted-foreground);
  border-bottom: 2px solid var(--muted-foreground);
  transform: rotate(-45deg);
  transition: transform 0.15s ease;
  flex-shrink: 0;
}

.share-links-section[open] .share-links-summary::before {
  transform: rotate(45deg);
}

.share-links-summary-title {
  font-weight: 600;
  font-size: 1rem;
}

.share-links-body {
  padding: 0 1.15rem 1.15rem;
  border-top: 1px solid var(--border);
}

.share-links-body .card-desc {
  margin-top: 0.75rem;
}

.share-links-create {
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
}

.share-link-create-panel[hidden] {
  display: none;
}

.share-link-copy-btn {
  white-space: nowrap;
}

.share-link-copy-btn .icon svg {
  width: 0.9rem;
  height: 0.9rem;
}

table.data tr.is-disabled td {
  opacity: 0.58;
}

table.data tr.is-disabled {
  color: var(--muted-foreground);
}

.table-wrap-share-links {
  overflow-x: hidden;
  margin-top: 0.75rem;
  border: none;
  background: transparent;
  padding: 0;
}

table.data.table-share-links {
  table-layout: fixed;
  width: 100%;
}

table.data.table-share-links th,
table.data.table-share-links td {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  vertical-align: middle;
}

table.data.table-share-links-4 th,
table.data.table-share-links-4 td {
  width: 25%;
}

table.data.table-share-links-5 th,
table.data.table-share-links-5 td {
  width: 20%;
}

table.data.table-share-links th.col-copy,
table.data.table-share-links td.col-copy {
  text-align: center;
}

table.data.table-share-links th.col-actions,
table.data.table-share-links td.col-actions {
  text-align: right;
  overflow: visible;
}

table.data.table-share-links td.col-copy {
  overflow: visible;
}

.buy-request-panel[hidden],
.buy-request-intro[hidden] {
  display: none !important;
}

.buy-request-actions {
  justify-content: space-between;
  align-items: center;
  margin-top: 0.25rem;
}

.icon-btn-sm.is-copied,
.share-link-copy-btn.is-copied {
  color: var(--accent);
  border-color: var(--accent);
}

.external-links-create-card {
  padding: 1.25rem 1.35rem 1.35rem;
}

.external-links-create-form {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.external-links-type-fieldset {
  border: none;
  padding: 0 0 1.1rem;
  margin: 0;
}

.external-links-type-fieldset .stock-toggle {
  width: fit-content;
  max-width: 100%;
}

.external-links-section {
  padding: 1.1rem 0;
  border-top: 1px solid var(--border);
}

.external-links-access-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(11rem, 1fr));
  gap: 0.85rem 1rem;
  align-items: start;
}

.external-links-access-grid .form-field label,
.external-links-section .form-field label {
  font-size: 0.8125rem;
  font-weight: 500;
}

.external-links-access-grid .input,
.external-links-access-grid .select,
.external-links-access-grid .dd-dropdown,
.external-links-access-grid select {
  width: 100%;
  max-width: none;
}

.external-links-access-grid input[type="number"] {
  width: 100%;
  max-width: none;
  min-width: 0;
}

.external-links-create-actions {
  display: flex;
  justify-content: flex-end;
  padding-top: 1.1rem;
  border-top: 1px solid var(--border);
}

.external-links-target[data-single-template="1"] {
  display: block;
}

@media (max-width: 720px) {
  .external-links-access-grid {
    grid-template-columns: 1fr;
  }
}

table.data.table-external-links th.col-copy,
table.data.table-external-links td.col-copy {
  width: 6.5rem;
}

table.data.table-external-links th.col-actions,
table.data.table-external-links td.col-actions {
  width: 5.5rem;
  text-align: right;
}

.dashboard-inbox-search {
  flex: 1 1 12rem;
  min-width: 0;
  margin: 0;
}

.dashboard-inbox-search .input {
  width: 100%;
}

.dashboard-inbox-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}

.form-field {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  margin-bottom: 1rem;
}

.form-field label {
  font-size: 0.875rem;
  font-weight: 500;
}

.form-field .help {
  font-size: 0.8rem;
  color: var(--muted-foreground);
}

.form-field .error {
  font-size: 0.8rem;
  color: var(--destructive);
}

.form-field.is-attention > input,
.form-field.is-attention > select,
.form-field.is-attention > textarea,
.form-field.is-attention .input,
.form-field.is-attention .money-input,
.form-field.is-attention .money-input input {
  border-color: var(--destructive);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--destructive) 22%, transparent);
  animation: field-attention-pulse 1.1s ease-out 2;
}

.form-field--owner-hidden {
  border-left: 3px solid var(--accent);
  padding-left: 0.75rem;
}

.form-field--owner-hidden.is-attention {
  border-left-color: var(--destructive);
}

@keyframes field-attention-pulse {
  0% {
    box-shadow: 0 0 0 0 color-mix(in srgb, var(--destructive) 35%, transparent);
  }
  70% {
    box-shadow: 0 0 0 4px color-mix(in srgb, var(--destructive) 0%, transparent);
  }
  100% {
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--destructive) 22%, transparent);
  }
}

.form-field.external-links-expires,
.form-field.external-links-max-products {
  margin-bottom: 0;
}

.address-fields {
  margin: 0 0 1rem;
  padding: 0.85rem 0.9rem 0.35rem;
  border: 1px solid var(--border);
  border-radius: var(--radius, 6px);
  background: color-mix(in srgb, var(--muted, #f4f4f5) 55%, transparent);
}

.address-fields__label {
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: var(--muted-foreground);
  margin: 0;
}

.address-fields__label-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin: 0 0 0.65rem;
}

.address-fields__locate {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  margin: 0;
  padding: 0;
  border: none;
  background: none;
  box-shadow: none;
  color: var(--foreground);
  font: inherit;
  font-size: 0.8rem;
  font-weight: 550;
  line-height: 1.2;
  text-decoration: none;
  cursor: pointer;
  white-space: nowrap;
}

.address-fields__locate:hover {
  text-decoration: underline;
  text-underline-offset: 2px;
}

.address-fields__locate:disabled {
  opacity: 0.55;
  cursor: wait;
  text-decoration: none;
}

.address-fields__locate .icon {
  width: 0.9rem;
  height: 0.9rem;
  color: var(--muted-foreground);
}

.address-fields__locate:hover .icon {
  color: var(--foreground);
}

.address-fields__pin-line {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0 0.75rem;
}

@media (min-width: 640px) {
  .address-fields__pin-line {
    grid-template-columns: 7.5rem minmax(0, 1fr);
    align-items: start;
  }
}

.address-fields__row {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0 0.75rem;
}

@media (min-width: 640px) {
  .address-fields__row {
    grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr);
  }
}

.address-fields .form-field {
  margin-bottom: 0.75rem;
}

.address-fields__status {
  margin: -0.25rem 0 0.65rem;
}

.address-fields__control {
  position: relative;
}

.address-fields__control input {
  width: 100%;
  padding-right: 2rem;
}

.address-fields__control--with-toggle input {
  padding-right: 2.35rem;
}

.address-fields.has-locality .address-fields__control--with-toggle input {
  padding-right: 4.1rem;
}

.address-fields__spinner {
  position: absolute;
  top: 50%;
  right: 0.65rem;
  width: 0.9rem;
  height: 0.9rem;
  margin-top: -0.45rem;
  border: 2px solid var(--border);
  border-top-color: var(--foreground, currentColor);
  border-radius: 50%;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s ease;
  z-index: 1;
}

.address-fields.is-loading .address-fields__spinner {
  opacity: 1;
  animation: address-spin 0.7s linear infinite;
}

.address-fields.has-locality.is-loading .address-fields__control--with-toggle .address-fields__spinner {
  right: 2.35rem;
}

.address-fields__line1-shell {
  position: relative;
}

.address-fields__locality-toggle {
  position: absolute;
  top: 50%;
  right: 0.35rem;
  transform: translateY(-50%);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.75rem;
  height: 1.75rem;
  margin: 0;
  padding: 0;
  border: none;
  border-radius: 4px;
  background: transparent;
  color: var(--muted-foreground);
  cursor: pointer;
  z-index: 2;
}

.address-fields__locality-toggle:hover {
  color: var(--foreground);
  background: color-mix(in srgb, var(--foreground) 6%, transparent);
}

.address-fields__locality-toggle[aria-expanded="true"] svg {
  transform: rotate(180deg);
}

.address-fields__locality-toggle[hidden] {
  display: none;
}

.address-fields__locality-menu {
  position: absolute;
  left: 0;
  right: 0;
  top: calc(100% + 0.25rem);
  z-index: 20;
  max-height: 12rem;
  overflow: auto;
  margin: 0;
  padding: 0.25rem;
  border: 1px solid var(--border);
  border-radius: var(--radius, 6px);
  background: var(--background, #fff);
  box-shadow: var(--shadow-dropdown);
}

.address-fields__locality-menu[hidden] {
  display: none;
}

.address-fields__locality-option {
  display: block;
  width: 100%;
  margin: 0;
  padding: 0.45rem 0.6rem;
  border: none;
  border-radius: 4px;
  background: transparent;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.address-fields__locality-option:hover,
.address-fields__locality-option.is-selected {
  background: color-mix(in srgb, var(--foreground) 8%, transparent);
}

@keyframes address-spin {
  to {
    transform: rotate(360deg);
  }
}

.input,
.select,
.textarea,
input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
input[type="date"],
input[type="datetime-local"],
input[type="url"],
input[type="search"],
input[type="file"],
select,
textarea {
  width: 100%;
  height: var(--control-height);
  min-height: var(--control-height);
  padding: 0 0.65rem;
  border: 1px solid var(--input);
  border-radius: var(--radius);
  background-color: var(--control-bg);
  color: var(--foreground);
  font: inherit;
  font-size: var(--control-font-size);
  box-shadow: none;
}

/* Native select chevron inset — avoids flush-right arrows on narrow dropdowns */
select:not([multiple]),
.select:not([multiple]) {
  -webkit-appearance: none;
  appearance: none;
  padding-right: 1.85rem;
  background-color: var(--control-bg);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2371717a' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.55rem center;
  background-size: 0.9rem 0.9rem;
}

select:not([multiple]):disabled,
.select:not([multiple]):disabled {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23a1a1aa' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
}

/* Custom single-select dropdown (replaces native system menus) */
.dd-dropdown {
  position: relative;
  width: 100%;
  display: block;
}

.dd-native {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
  opacity: 0 !important;
  pointer-events: none !important;
  appearance: none !important;
  background: none !important;
  box-shadow: none !important;
}

.dd-trigger {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  width: 100%;
  height: var(--control-height);
  min-height: var(--control-height);
  padding: 0 0.65rem;
  border: 1px solid var(--input);
  border-radius: var(--radius);
  background: var(--control-bg);
  color: var(--foreground);
  font: inherit;
  font-size: var(--control-font-size);
  cursor: pointer;
  text-align: left;
  box-shadow: none;
}

.dd-trigger:hover {
  border-color: var(--border);
}

.dd-trigger:focus-visible {
  outline: 2px solid var(--ring);
  outline-offset: 1px;
  border-color: var(--ring);
}

.dd-dropdown.is-disabled .dd-trigger {
  opacity: 0.55;
  cursor: not-allowed;
}

.dd-label {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dd-label.is-placeholder {
  color: var(--muted-foreground);
}

.dd-caret {
  width: 0.9rem;
  height: 0.9rem;
  flex-shrink: 0;
  stroke: var(--muted-foreground);
  stroke-width: 2;
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
  transition: transform 140ms ease;
}

.dd-dropdown[data-dd-open] .dd-caret {
  transform: rotate(180deg);
}

.dd-leading-icon {
  width: 1rem;
  height: 1rem;
  flex-shrink: 0;
  stroke: currentColor;
  stroke-width: 1.75;
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
  color: var(--muted-foreground);
}

.dd-panel {
  position: absolute;
  z-index: 40;
  top: calc(100% + 0.3rem);
  left: 0;
  right: 0;
  max-height: 14rem;
  overflow-y: auto;
  padding: 0.3rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--card);
  box-shadow: var(--shadow-dropdown);
}

.dd-panel[hidden] {
  display: none;
}

.dd-option {
  display: block;
  width: 100%;
  margin: 0;
  padding: 0.45rem 0.55rem;
  border: none;
  border-radius: calc(var(--radius) - 2px);
  background: transparent;
  color: var(--foreground);
  font: inherit;
  font-size: 0.8125rem;
  text-align: left;
  cursor: pointer;
}

.dd-option:hover:not(:disabled),
.dd-option:focus-visible {
  background: var(--secondary);
  outline: none;
}

.dd-option.is-selected {
  background: var(--secondary);
  font-weight: 550;
}

.dd-option:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.dd-dropdown--sm .dd-trigger {
  height: var(--control-height);
  min-height: var(--control-height);
  min-width: 4.5rem;
  width: auto;
  padding: 0 0.55rem;
  font-size: var(--control-font-size);
}

.dd-dropdown--sm {
  width: auto;
  display: inline-block;
}

/* Sidebar org switcher — borderless trigger */
.org-switch {
  margin: 0;
  width: 100%;
}

.org-switch .dd-dropdown--org {
  width: 100%;
  max-width: 100%;
}

.org-switch .dd-dropdown--org .dd-trigger {
  display: flex;
  align-items: center;
  width: 100%;
  max-width: 100%;
  height: auto;
  min-height: 2.35rem;
  padding: 0.5rem 0.75rem;
  border: none;
  border-radius: var(--radius);
  background: transparent;
  box-shadow: none;
  font-size: 0.875rem;
  font-weight: 500;
  line-height: 1;
  gap: 0.55rem;
}

.org-switch .dd-dropdown--org .dd-trigger:hover {
  background: var(--secondary);
}

.org-switch .dd-dropdown--org .dd-trigger:focus-visible {
  outline: 2px solid var(--ring);
  outline-offset: 1px;
}

.org-switch .dd-dropdown--org .dd-leading-icon {
  display: block;
  width: 1rem;
  height: 1rem;
  flex-shrink: 0;
  margin: 0;
  color: var(--foreground);
}

.org-switch .dd-dropdown--org .dd-label {
  flex: 1 1 auto;
  min-width: 0;
  margin: 0;
  line-height: 1;
  display: inline-flex;
  align-items: center;
}

.org-switch .dd-dropdown--org .dd-caret {
  display: block;
  width: 0.9rem;
  height: 0.9rem;
  margin: 0;
  flex-shrink: 0;
}

.org-switch .dd-dropdown--org .dd-panel {
  left: 0;
  right: auto;
  min-width: 100%;
  width: max-content;
  max-width: min(18rem, 80vw);
}

.pagination-row__size .dd-dropdown {
  width: auto;
}

table.data.table-org-members .member-role-form .dd-dropdown {
  width: auto;
  min-width: 6.5rem;
  max-width: 8rem;
}

input[type="file"] {
  height: 2.35rem;
  padding: 0 0.45rem;
  display: inline-flex;
  align-items: center;
  box-sizing: border-box;
}

input[type="file"]::file-selector-button,
input[type="file"]::-webkit-file-upload-button {
  height: 1.65rem;
  margin: 0 0.55rem 0 0;
  padding: 0 0.65rem;
  border: 1px solid var(--border);
  border-radius: calc(var(--radius) - 1px);
  background: var(--muted);
  color: var(--foreground);
  font: inherit;
  font-size: 0.8125rem;
  font-weight: 500;
  line-height: 1;
  cursor: pointer;
}

textarea,
.textarea {
  height: auto;
  min-height: 5rem;
  padding: 0.6rem 0.75rem;
  resize: vertical;
}

input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 2px solid var(--ring);
  outline-offset: 1px;
  border-color: var(--ring);
}

select[multiple],
.select[multiple] {
  height: auto;
  min-height: 8rem;
  padding: 0.4rem 0.5rem;
  overflow-y: auto;
}

select[multiple] option,
.select[multiple] option {
  padding: 0.35rem 0.45rem;
  border-radius: var(--radius);
}

/* Dropdown multi-select */
.ms-dropdown {
  position: relative;
  width: 100%;
}

.ms-trigger {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  width: 100%;
  height: var(--control-height);
  min-height: var(--control-height);
  padding: 0 0.65rem;
  border: 1px solid var(--input);
  border-radius: var(--radius);
  background: var(--control-bg);
  color: var(--foreground);
  font: inherit;
  font-size: var(--control-font-size);
  cursor: pointer;
  text-align: left;
  box-shadow: none;
}

.ms-trigger:hover {
  border-color: var(--border);
}

.ms-trigger:focus-visible {
  outline: 2px solid var(--ring);
  outline-offset: 1px;
  border-color: var(--ring);
}

.ms-summary {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ms-summary.is-placeholder {
  color: var(--muted-foreground);
}

.ms-caret {
  width: 0.45rem;
  height: 0.45rem;
  border-right: 1.5px solid var(--muted-foreground);
  border-bottom: 1.5px solid var(--muted-foreground);
  transform: rotate(45deg);
  margin-top: -0.2rem;
  flex-shrink: 0;
}

.ms-panel {
  position: absolute;
  z-index: 35;
  top: calc(100% + 0.3rem);
  left: 0;
  right: 0;
  max-height: 14rem;
  overflow-y: auto;
  padding: 0.35rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--card);
  box-shadow: var(--shadow-dropdown);
}

.ms-panel[hidden] {
  display: none;
}

.ms-option {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.45rem 0.5rem;
  border-radius: var(--radius);
  font-size: 0.875rem;
  cursor: pointer;
  color: var(--foreground);
}

.ms-option:hover {
  background: var(--muted);
}

.ms-option input {
  width: auto;
  height: auto;
  margin: 0;
  accent-color: var(--foreground);
}

.supplier-combo__control {
  position: relative;
}

.supplier-combo__panel {
  position: absolute;
  z-index: 35;
  top: calc(100% + 0.3rem);
  left: 0;
  right: 0;
  max-height: 16rem;
  overflow-y: auto;
  padding: 0.35rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--card);
  box-shadow: var(--shadow-dropdown);
}

.supplier-combo__panel[hidden] {
  display: none;
}

.supplier-combo__option {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.1rem;
  width: 100%;
  margin: 0;
  padding: 0.5rem 0.55rem;
  border: none;
  border-radius: var(--radius);
  background: transparent;
  color: var(--foreground);
  font: inherit;
  font-size: 0.875rem;
  text-align: left;
  cursor: pointer;
}

.supplier-combo__option:hover,
.supplier-combo__option:focus-visible {
  background: var(--muted);
  outline: none;
}

.supplier-combo__option[hidden] {
  display: none;
}

.supplier-combo__option-title {
  font-weight: 550;
}

.supplier-combo__option-meta {
  color: var(--muted-foreground);
  font-size: 0.8rem;
}

a.supplier-combo__option {
  text-decoration: none;
  color: inherit;
  box-sizing: border-box;
}

.supplier-combo__option--create {
  border-top: 1px solid var(--border);
  border-radius: 0 0 var(--radius) var(--radius);
  margin-top: 0.15rem;
}

.template-picker-row {
  align-items: flex-end;
}

.template-picker-row__select {
  flex: 1;
  min-width: 200px;
}

.supplier-combo__empty {
  margin: 0;
  padding: 0.55rem 0.5rem;
  font-size: 0.85rem;
}

.product-field-pair {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.product-field-pair__item {
  min-width: 0;
}

.product-field-pair__item .form-field {
  margin-bottom: 1rem;
}

@media (min-width: 720px) {
  .product-field-pair {
    flex-direction: row;
    align-items: flex-start;
    gap: 0.85rem;
  }

  .product-field-pair__item {
    flex: 1 1 0;
  }
}

.product-form-sections {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.product-form-section {
  border: none;
  border-radius: 0;
  background: transparent;
  overflow: visible;
}

.product-form-section__summary {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.15rem 0;
  cursor: pointer;
  list-style: none;
  user-select: none;
}

.product-form-section__summary::-webkit-details-marker {
  display: none;
}

.product-form-section__chevron {
  display: inline-block;
  width: 0.35rem;
  height: 0.35rem;
  border-right: 1.5px solid var(--muted-foreground);
  border-bottom: 1.5px solid var(--muted-foreground);
  transform: rotate(-45deg);
  transition: transform 0.15s ease;
  flex-shrink: 0;
  opacity: 0.75;
}

.product-form-section[open] > .product-form-section__summary .product-form-section__chevron {
  transform: rotate(45deg);
}

.product-form-section__title {
  font-size: 0.875rem;
  font-weight: 500;
  line-height: 1.3;
  color: inherit;
}

.product-form-section__incomplete {
  margin-left: 0.15rem;
  font-size: 0.7rem;
  font-weight: 500;
  height: 1.2rem;
  padding: 0 0.4rem;
  text-transform: lowercase;
}

/* .badge { display: inline-flex } wins over the UA [hidden] rule. */
.badge.product-form-section__incomplete[hidden] {
  display: none !important;
}

.product-form-section__body {
  padding: 0.45rem 0 0.1rem;
  border-top: none;
  background: transparent;
}

.product-form-section__body > .form-field:first-child,
.product-form-section__body > .product-field-pair:first-child,
.product-form-section__body > [data-imei-fields]:first-child,
.product-form-section__body > .seller-field:first-child,
.product-form-section__body > .gov-id-pair:first-child {
  margin-top: 0.35rem;
}

.imei-field__control {
  position: relative;
  display: block;
  width: 100%;
}

.imei-field__control input {
  width: 100%;
  padding-right: 2.5rem;
}

.imei-field__camera {
  position: absolute;
  top: 50%;
  right: 0.25rem;
  z-index: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.75rem;
  height: 1.75rem;
  margin: 0;
  padding: 0;
  border: none;
  border-radius: 6px;
  background: transparent;
  box-shadow: none;
  color: var(--muted-foreground);
  cursor: pointer;
  transform: translateY(-50%);
}

.imei-field__camera:hover {
  background: color-mix(in srgb, var(--foreground) 6%, transparent);
  color: var(--foreground);
}

.imei-field__camera .icon {
  width: 1rem;
  height: 1rem;
}

/* Legacy row wrapper (kept for older markup) */
.imei-field__row {
  display: block;
}

.imei-field__input {
  min-width: 0;
}

.imei-field__add {
  display: inline-flex;
  align-items: center;
  margin: 0 0 0.75rem;
  padding: 0;
  border: none;
  background: transparent;
  color: var(--primary);
  font: inherit;
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  box-shadow: none;
}

.imei-field__add:hover {
  text-decoration: underline;
}

.form-field[hidden],
.imei-field__add[hidden] {
  display: none !important;
}

.photo-capture-modal {
  width: min(100%, 520px);
  padding: 1rem;
}

.photo-capture-modal__video-wrap {
  position: relative;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: #0a0a0a;
  aspect-ratio: 4 / 3;
  min-height: 220px;
}

.photo-capture-modal__video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  background: #0a0a0a;
}

.photo-capture-modal__video[hidden] {
  display: none !important;
}

.photo-capture-modal__video.is-live {
  display: block !important;
}

.photo-capture-modal__status {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 3;
  margin: 0;
  padding: 0.55rem 0.65rem;
  font-size: 0.8125rem;
  line-height: 1.35;
  color: #fff;
  background: linear-gradient(transparent, rgba(0, 0, 0, 0.72));
  pointer-events: none;
}

.photo-capture-modal__actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  align-items: center;
  gap: 0.5rem;
}

.imei-scan-modal {
  width: min(100%, 520px);
  padding: 1rem;
}

.imei-scan-modal__video-wrap {
  position: relative;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: #0a0a0a;
  aspect-ratio: 4 / 3;
  min-height: 220px;
}

.imei-scan-modal__video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  background: #0a0a0a;
}

.imei-scan-modal__video[hidden] {
  display: none !important;
}

.imei-scan-modal__guide {
  position: absolute;
  left: 4%;
  right: 4%;
  top: 50%;
  height: 28%;
  transform: translateY(-50%);
  border: 2px solid rgba(255, 255, 255, 0.75);
  border-radius: 6px;
  box-shadow: 0 0 0 999px rgba(0, 0, 0, 0.25);
  pointer-events: none;
  z-index: 2;
}

.imei-scan-modal__hint {
  display: none;
}

.imei-scan-modal__status {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 3;
  margin: 0;
  padding: 0.55rem 0.65rem;
  font-size: 0.8125rem;
  line-height: 1.35;
  color: #fff;
  background: linear-gradient(transparent, rgba(0, 0, 0, 0.72));
  pointer-events: none;
}

.imei-scan-modal__list {
  display: grid;
  gap: 0.4rem;
  max-height: 10rem;
  overflow: auto;
  margin: 0.65rem 0 0;
  padding: 0;
  list-style: none;
}

.imei-scan-modal__list > li {
  margin: 0;
  padding: 0;
  border: none;
}

.imei-scan-modal__item {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  width: 100%;
  margin: 0;
  padding: 0.6rem 0.75rem;
  border: none;
  border-radius: var(--radius);
  background: var(--muted);
  color: var(--foreground);
  cursor: pointer;
  outline: none;
  box-shadow: none;
  transition: background 0.15s ease;
}

.imei-scan-modal__item:hover {
  background: color-mix(in srgb, var(--muted) 82%, var(--foreground));
}

.imei-scan-modal__item:focus,
.imei-scan-modal__item:focus-within {
  outline: none;
  box-shadow: none;
}

.imei-scan-modal__item.is-selected {
  background: var(--muted);
  box-shadow: none;
}

.imei-scan-modal__item input {
  appearance: none;
  -webkit-appearance: none;
  flex: 0 0 1.05rem;
  width: 1.05rem;
  height: 1.05rem;
  margin: 0;
  padding: 0;
  border: none;
  border-radius: 999px;
  background: #fff;
  box-shadow: inset 0 0 0 1px var(--border);
  accent-color: var(--accent);
  outline: none !important;
}

.imei-scan-modal__item input:checked {
  background-color: var(--accent);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none' stroke='%23fff' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m3.5 8.5 3 3 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: center;
  background-size: 0.72rem 0.72rem;
  box-shadow: none;
}

.imei-scan-modal__item input:focus,
.imei-scan-modal__item input:focus-visible {
  outline: none !important;
  border: none;
  box-shadow: inset 0 0 0 1px var(--border);
}

.imei-scan-modal__item input:checked:focus,
.imei-scan-modal__item input:checked:focus-visible {
  box-shadow: none;
}

.imei-scan-modal__code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.9rem;
  letter-spacing: 0.02em;
}

.imei-scan-modal__actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  align-items: center;
  gap: 0.5rem;
  margin-top: 0.85rem;
}

.imei-scan-modal__photo {
  cursor: pointer;
  margin: 0;
}

.imei-scan-modal__photo input[type="file"] {
  display: none;
}

.imei-scan-modal__video.is-live {
  display: block !important;
}

.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--card);
  box-shadow: var(--shadow);
}

.billing-doc-list {
  display: none;
}

.billing-doc-card {
  display: grid;
  gap: 0.75rem;
}

.billing-doc-card__top,
.billing-doc-card__bottom {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  align-items: flex-start;
}

.billing-doc-card__meta {
  min-width: 0;
}

.billing-doc-card__meta p,
.billing-doc-card__amount p {
  margin: 0.2rem 0 0;
}

.pagination-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-top: 1rem;
}

.pagination-row__meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem 1.25rem;
  font-size: 0.7rem; /* 80% of prior 0.875rem */
  line-height: 1.35;
}

.pagination-row__meta .muted {
  font-size: inherit;
}

.pagination-row__size {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  font-size: inherit;
}

.pagination-row__size .select,
.select.select-sm {
  width: auto;
  min-width: 4.5rem;
  padding: 0.3rem 1.75rem 0.3rem 0.55rem;
  font-size: 0.875rem;
}

/* Underline page-size control — no button chrome */
.pagination-row__size .select.select-sm,
.pagination-row__size .dd-dropdown--page-size .dd-trigger,
.pagination-row__size .dd-dropdown--sm.dd-dropdown--page-size .dd-trigger {
  min-width: 0;
  width: auto;
  height: auto;
  min-height: 0;
  padding: 0;
  border: none;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  font-size: inherit;
  font-weight: 400;
  gap: 0.15rem;
}

.pagination-row__size .dd-dropdown {
  width: auto;
}

.pagination-row__size .dd-dropdown--page-size .dd-label {
  flex: 0 0 auto;
  font-size: inherit;
  font-weight: 400;
  text-decoration: underline;
  text-underline-offset: 0.15em;
  text-decoration-thickness: 1px;
}

.pagination-row__size .dd-dropdown--page-size .dd-caret {
  width: 0.7rem;
  height: 0.7rem;
  opacity: 0.7;
}

.pagination-row__size .dd-dropdown--page-size .dd-trigger:hover,
.pagination-row__size .dd-dropdown--page-size .dd-trigger:focus-visible {
  background: transparent;
  box-shadow: none;
}

.pagination-row__size .dd-dropdown--page-size .dd-trigger:focus-visible {
  outline: 2px solid var(--ring);
  outline-offset: 2px;
  border-radius: 2px;
}

.pagination-row__size .dd-dropdown--page-size .dd-panel {
  min-width: 4.5rem;
  width: max-content;
}

.pagination-row__nav {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.pagination-row__due {
  font-size: 0.875rem;
  margin-right: 0.25rem;
  white-space: nowrap;
}

.table-summary {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  margin: 0 0 0.65rem;
}

.table-summary__due {
  font-size: 0.875rem;
  white-space: nowrap;
}

.export-history-section {
  padding: 0;
  overflow: hidden;
}

.card.export-history-section {
  padding: 0;
}

.export-history-section__summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.45rem 0.75rem;
  min-height: 2.35rem;
  cursor: pointer;
  list-style: none;
  user-select: none;
}

.export-history-section__summary::-webkit-details-marker {
  display: none;
}

.export-history-section__label {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  min-width: 0;
}

.export-history-section__label::before {
  content: "";
  display: inline-block;
  width: 0.4rem;
  height: 0.4rem;
  border-right: 2px solid var(--muted-foreground);
  border-bottom: 2px solid var(--muted-foreground);
  transform: rotate(-45deg);
  transition: transform 0.15s ease;
  flex-shrink: 0;
}

.export-history-section[open] > .export-history-section__summary .export-history-section__label::before {
  transform: rotate(45deg);
}

.export-history-section__title {
  font-weight: 600;
  font-size: 0.925rem;
  line-height: 1.2;
}

.export-history-section__summary .btn {
  flex-shrink: 0;
  white-space: nowrap;
}

.export-history-section__body {
  padding: 0.65rem 0.75rem 0.75rem;
  border-top: 1px solid var(--border);
}

.export-history-section__body .card-desc {
  margin: 0 0 0.65rem;
  font-size: 0.8125rem;
}

.pagination-row__page {
  font-size: 0.875rem;
  white-space: nowrap;
}

/* Shared image upload (logo, gov ID, etc.) */
.image-picker {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  align-items: stretch;
  text-align: left;
  padding: 0;
}

.image-picker > label:not(.image-picker__action) {
  font-size: 0.875rem;
  font-weight: 500;
}

.image-picker .error {
  font-size: 0.8rem;
  color: var(--destructive);
}

.image-picker__frame {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  width: 100%;
  min-height: 5.25rem;
  padding: 0.65rem 0.75rem;
  border: 1px dashed var(--border);
  border-radius: var(--radius, 6px);
  background: color-mix(in srgb, var(--muted, #f4f4f5) 40%, transparent);
  text-align: center;
  box-sizing: border-box;
}

.image-picker__frame.has-image {
  min-height: 6.5rem;
}

.image-picker__preview {
  display: block;
  max-width: 100%;
  max-height: 5.5rem;
  object-fit: contain;
  cursor: zoom-in;
}

.image-picker__meta {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: center;
  gap: 0.2rem 0.55rem;
  max-width: 100%;
}

.image-picker__actions {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 0.35rem 0.45rem;
  max-width: 100%;
}

.image-picker__sep {
  color: var(--muted-foreground);
  opacity: 0.55;
  user-select: none;
}

.image-picker__action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.28rem;
  max-width: 100%;
  min-height: 0;
  margin: 0;
  padding: 0;
  border: none;
  background: transparent;
  color: var(--muted-foreground);
  font: inherit;
  font-size: 0.8rem;
  font-weight: 500;
  cursor: pointer;
  appearance: none;
  text-decoration: underline;
  text-underline-offset: 2px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 0 1 auto;
}

.image-picker__action .icon {
  width: 0.85rem;
  height: 0.85rem;
  flex: 0 0 auto;
}

.image-picker__action:hover {
  color: var(--foreground);
}

.image-picker__meta .help {
  margin: 0;
  font-size: 0.75rem;
  line-height: 1.3;
  color: var(--muted-foreground);
  white-space: nowrap;
}

.image-picker--compact .image-picker__frame {
  min-height: 4.25rem;
  padding: 0.5rem;
}

.image-picker--compact .image-picker__frame.has-image {
  min-height: 5.25rem;
}

.image-picker--compact .image-picker__preview {
  max-height: 3.25rem;
}

.image-picker--compact > label:not(.image-picker__action) {
  font-size: 0.8rem;
}

/* Fullscreen zoomable image viewer */
.image-viewer {
  width: 100vw;
  max-width: 100vw;
  height: 100vh;
  max-height: 100vh;
  margin: 0;
  padding: 0;
  border: none;
  border-radius: 0;
  background: #0a0a0a;
  color: #fafafa;
}

.image-viewer::backdrop {
  background: #000;
}

.image-viewer__bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.7rem 0.85rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
}

.image-viewer__title {
  min-width: 0;
  font-size: 0.9rem;
  font-weight: 550;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.image-viewer__tools {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  flex-shrink: 0;
}

.image-viewer__tool {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 2rem;
  min-height: 2rem;
  padding: 0 0.45rem;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 6px;
  background: transparent;
  color: #fafafa;
  font: inherit;
  font-size: 0.85rem;
  cursor: pointer;
}

.image-viewer__tool:hover {
  background: rgba(255, 255, 255, 0.1);
}

.image-viewer__close {
  font-size: 1.15rem;
  line-height: 1;
}

.image-viewer__stage {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  height: calc(100vh - 3.35rem);
  overflow: hidden;
  touch-action: none;
  cursor: zoom-in;
  user-select: none;
}

.image-viewer__stage.is-zoomed {
  cursor: grab;
}

.image-viewer__stage.is-zoomed:active {
  cursor: grabbing;
}

.image-viewer__img {
  max-width: min(100%, 1200px);
  max-height: calc(100vh - 5rem);
  width: auto;
  height: auto;
  object-fit: contain;
  transform-origin: center center;
  will-change: transform;
  pointer-events: none;
}

/* Legacy aliases */
.logo-picker-card {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  align-items: stretch;
  text-align: left;
  padding: 0;
}

.logo-picker-card > label:not(.logo-picker-action) {
  font-size: 0.875rem;
  font-weight: 500;
}

.logo-picker-card .error {
  font-size: 0.8rem;
  color: var(--destructive);
}

.logo-picker-card__preview,
.logo-picker-card .image-picker__frame {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.3rem;
  width: 100%;
  min-height: 6.5rem;
  padding: 0.65rem 0.75rem;
  border: 1px dashed var(--border);
  border-radius: var(--radius, 6px);
  background: color-mix(in srgb, var(--muted, #f4f4f5) 40%, transparent);
  text-align: center;
  box-sizing: border-box;
}

.logo-picker-card__preview img {
  display: block;
  max-width: 100%;
  max-height: 5.5rem;
  object-fit: contain;
}

.logo-picker-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  max-width: 100%;
  padding: 0;
  border: none;
  background: transparent;
  color: var(--muted-foreground);
  font: inherit;
  font-size: 0.8rem;
  font-weight: 500;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.logo-picker-action:hover {
  color: var(--foreground);
}

/* Organization information — calm grouped layout */
.org-info-form {
  gap: 0;
}

.settings-form-group {
  padding: 0.9rem 0;
  border-top: 1px solid color-mix(in srgb, var(--border, #e4e4e7) 85%, transparent);
}

.settings-form-group:first-of-type {
  border-top: none;
  padding-top: 0.15rem;
}

.settings-form-group .address-fields {
  margin-bottom: 0;
}

.org-info-basics {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.85rem;
  align-items: start;
}

@media (min-width: 640px) {
  .org-info-basics {
    grid-template-columns: minmax(0, 1fr) minmax(9.5rem, 11rem);
    gap: 1rem;
  }
}

.org-info-basics__fields .form-field {
  margin-bottom: 0;
}

.org-info-contact-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0 0.75rem;
}

@media (min-width: 640px) {
  .org-info-contact-grid {
    grid-template-columns: 1fr 1fr;
  }
}

.org-info-contact-grid .form-field {
  margin-bottom: 0.75rem;
}

.org-info-form__actions {
  margin-top: 0.35rem;
  padding-top: 0.75rem;
  border-top: 1px solid color-mix(in srgb, var(--border, #e4e4e7) 85%, transparent);
}

table.data {
  width: 100%;
  min-width: 52rem;
  table-layout: fixed;
  border-collapse: collapse;
  font-size: 0.875rem;
}

table.data th,
table.data td {
  text-align: left;
  padding: 0.4rem 0.75rem;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  line-height: 1.25;
}

/* Prefer showing the end of IMEI when the column is narrow. */
table.data td.col-imei {
  direction: rtl;
  text-align: left;
}

table.data td.col-imei .col-imei__value {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  direction: rtl;
  text-align: left;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

/*
 * Auto layout so Name shrink-wraps to the IMEI line (no leftover gap).
 * Other columns take the remaining width of the 100% table.
 */
table.data.table-products {
  table-layout: auto;
  min-width: 40rem;
}

table.data.table-products .table-products__col-sku {
  width: 8.5rem;
}

table.data.table-products .table-products__col-stock {
  width: 5.5rem;
}

table.data.table-products .table-products__col-invoice {
  width: 2.75rem;
}

table.data.table-products .table-products__col-created {
  width: 7.5rem;
}

table.data.table-products th.col-product-name,
table.data.table-products td.col-product-name {
  /* width:1% + nowrap child → column only as wide as content needs */
  width: 1%;
  white-space: normal;
  overflow: hidden;
  vertical-align: middle;
}

.product-list-name {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.product-list-imei {
  display: block;
  width: max-content;
  max-width: 100%;
  font-size: 0.7rem;
  line-height: 1.3;
  margin-top: 0.1rem;
  white-space: nowrap;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

table.data.table-products th.col-product-invoice,
table.data.table-products td.col-product-invoice {
  width: 2.75rem;
  text-align: center;
  overflow: visible;
}

.product-invoice-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.85rem;
  height: 1.85rem;
  margin: 0;
  padding: 0;
  border: none;
  border-radius: var(--radius);
  background: transparent;
  color: var(--muted-foreground);
  text-decoration: none;
  cursor: pointer;
  appearance: none;
  vertical-align: middle;
}

.product-invoice-icon .icon {
  width: 1.05rem;
  height: 1.05rem;
}

.product-invoice-icon:hover {
  color: var(--foreground);
  background: var(--muted);
}

.product-invoices-modal {
  width: min(100%, 420px);
  padding: 1rem;
}

.product-invoices-modal__subtitle {
  margin: 0 0 0.75rem;
  font-size: 0.85rem;
}

.product-invoices-modal__list {
  display: grid;
  gap: 0.4rem;
  max-height: min(50dvh, 20rem);
  overflow: auto;
  margin: 0;
  padding: 0;
  list-style: none;
}

.product-invoices-modal__item {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.15rem;
  width: 100%;
  padding: 0.65rem 0.75rem;
  border-radius: var(--radius);
  background: var(--muted);
  color: var(--foreground);
  text-decoration: none;
}

.product-invoices-modal__item:hover {
  background: color-mix(in srgb, var(--muted) 82%, var(--foreground));
}

.product-invoices-modal__number {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.9rem;
  font-weight: 500;
}

.product-invoices-modal__meta {
  font-size: 0.78rem;
}

.product-invoices-modal__empty {
  margin: 0.5rem 0 0;
  font-size: 0.85rem;
}

table.data th {
  font-weight: 550;
  color: var(--muted-foreground);
  background: var(--muted);
}

table.data tr:last-child td {
  border-bottom: none;
}

table.data tr.is-clickable {
  cursor: pointer;
}

table.data tr.is-clickable:hover td {
  background: var(--muted);
}

table.data tr.is-clickable:focus-visible {
  outline: 2px solid var(--ring);
  outline-offset: -2px;
}

table.data th.col-actions,
table.data td.col-actions {
  width: 4.75rem;
  text-align: right;
  white-space: nowrap;
  overflow: visible;
  padding-top: 0.25rem;
  padding-bottom: 0.25rem;
}

/* Form templates list (Settings + templates page) */
table.data.table-templates th.col-actions,
table.data.table-templates td.col-actions {
  width: 7.25rem;
  min-width: 7.25rem;
  padding-right: 0.85rem;
  overflow: visible;
}

table.data.table-templates td.col-actions .btn {
  margin: 0;
}

/* Org members / invites (Settings → Members) */
table.data.table-org-invites {
  table-layout: fixed;
}

table.data.table-org-invites th:nth-child(1),
table.data.table-org-invites td:nth-child(1) {
  width: 28%;
}

table.data.table-org-invites th:nth-child(2),
table.data.table-org-invites td:nth-child(2) {
  width: 14%;
}

table.data.table-org-invites th:nth-child(3),
table.data.table-org-invites td:nth-child(3) {
  width: 16%;
}

table.data.table-org-invites th.col-copy,
table.data.table-org-invites td.col-copy {
  width: 6.5rem;
  overflow: visible;
}

table.data.table-org-invites th.col-actions,
table.data.table-org-invites td.col-actions {
  width: 5.5rem;
}

table.data.table-org-members th:nth-child(1),
table.data.table-org-members td:nth-child(1) {
  width: 22%;
}

table.data.table-org-members th:nth-child(2),
table.data.table-org-members td:nth-child(2) {
  width: 32%;
}

table.data.table-org-members td.col-role {
  overflow: visible;
  white-space: nowrap;
}

table.data.table-org-members .member-role-form {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  margin: 0;
}

table.data.table-org-members .member-role-form .select,
table.data.table-org-members .member-role-form select,
table.data.table-org-members .member-role-form .dd-dropdown {
  width: auto;
  min-width: 6.5rem;
  max-width: 8rem;
  margin: 0;
}

table.data.table-org-members th.col-actions,
table.data.table-org-members td.col-actions {
  width: 5.5rem;
}

/* Invoice detail lines: widen with content — don't ellipsize Name/IMEI. */
table.data.table-invoice-lines {
  width: max-content;
  min-width: 100%;
  table-layout: auto;
}

table.data.table-invoice-lines col.col-return {
  width: 4.2rem;
}

table.data.table-invoice-lines th.col-return,
table.data.table-invoice-lines td.col-return {
  width: 4.2rem;
  padding-left: 0.2rem;
  padding-right: 0.1rem;
  text-align: center;
  vertical-align: middle;
  white-space: nowrap;
}

.invoice-line-actions {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.05rem;
}

.invoice-line-return {
  display: inline-flex;
  margin: 0;
}

.invoice-line-return__btn {
  border: none;
  background: transparent;
  box-shadow: none;
  color: var(--muted-foreground);
}

.invoice-line-return__btn:hover {
  border: none;
  background: transparent;
  color: var(--foreground);
}

table.data.table-invoice-lines col.col-sku {
  width: 8.5rem;
}

table.data.table-invoice-lines col.col-qty {
  width: 4.75rem;
}

table.data.table-invoice-lines tr.is-returned td {
  color: var(--muted-foreground);
  background: color-mix(in srgb, var(--muted, #f4f4f5) 70%, transparent);
}

table.data.table-invoice-lines tr.is-returned a {
  color: var(--muted-foreground);
}

.invoice-line-qty {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
}

.invoice-line-qty__mark {
  width: 0.95rem;
  height: 0.95rem;
  color: var(--muted-foreground);
}

.modal.modal-confirm {
  width: min(100%, 26rem);
  height: fit-content;
  max-height: none;
}

.modal.modal-confirm[open] {
  display: block;
}

.modal.modal-confirm .modal__shell {
  flex: none;
  max-height: none;
  height: auto;
  overflow: visible;
}

.modal.modal-confirm .modal__body {
  flex: none;
  overflow: visible;
}

.modal.modal-confirm .modal__footer {
  justify-content: flex-end;
}

table.data.table-invoice-lines col.col-list,
table.data.table-invoice-lines col.col-total {
  width: 8.5rem;
}

table.data.table-invoice-lines col.col-sell {
  width: 8.5rem;
}

table.data.table-invoice-lines th,
table.data.table-invoice-lines td {
  overflow: visible;
  text-overflow: clip;
}

table.data.table-invoice-lines th.col-sku,
table.data.table-invoice-lines td.col-sku {
  white-space: nowrap;
}

table.data.table-invoice-lines th.col-product,
table.data.table-invoice-lines td.col-product {
  width: 1%;
  white-space: normal;
  overflow: visible;
  text-overflow: clip;
  vertical-align: middle;
}

table.data.table-invoice-lines th.col-qty,
table.data.table-invoice-lines td.col-qty {
  white-space: nowrap;
  text-align: left;
}

table.data.table-invoice-lines th.col-list,
table.data.table-invoice-lines td.col-list,
table.data.table-invoice-lines th.col-sell,
table.data.table-invoice-lines td.col-sell,
table.data.table-invoice-lines th.col-total,
table.data.table-invoice-lines td.col-total {
  white-space: nowrap;
}

.invoice-line-imei {
  display: block;
  width: max-content;
  font-size: 0.7rem;
  line-height: 1.3;
  margin-top: 0.1rem;
  white-space: nowrap;
  overflow: visible;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

/* Invoice list: show full invoice numbers — widen table instead of trimming. */
table.data.table-invoices {
  width: max-content;
  min-width: 100%;
  table-layout: auto;
}

table.data.table-invoices th,
table.data.table-invoices td {
  overflow: visible;
  text-overflow: clip;
}

table.data.table-invoices th:first-child,
table.data.table-invoices td:first-child {
  width: 1%;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

table.data.table-invoice-payments {
  width: 100%;
  min-width: 32rem;
  table-layout: fixed;
}

table.data.table-invoice-payments .col-when {
  width: 9.5rem;
  white-space: nowrap;
}

table.data.table-invoice-payments .col-amount {
  width: 9rem;
  white-space: nowrap;
}

table.data.table-invoice-payments .col-note {
  width: auto;
  min-width: 10rem;
}

table.data.table-invoice-payments .table-empty-row td {
  text-align: center;
  padding: 1rem 0.75rem;
  font-size: 0.875rem;
}

table.data.table-invoice-payments tfoot td {
  padding: 0.65rem 0.75rem;
  border-top: 1px solid var(--border);
  background: color-mix(in srgb, var(--muted) 65%, transparent);
}

.payment-balance {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: flex-start;
  gap: 1rem 1.5rem;
}

.payment-balance__item {
  display: inline-flex;
  align-items: baseline;
  gap: 0.4rem;
  min-width: 0;
}

.payment-balance__label {
  color: var(--muted-foreground);
  font-size: 0.75rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

.payment-balance__value {
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  color: var(--foreground);
}

.payment-amount__control {
  position: relative;
}

.payment-amount__control .input {
  width: 100%;
  padding-right: 4.75rem;
  appearance: textfield;
  -moz-appearance: textfield;
}

.payment-amount__control .input::-webkit-outer-spin-button,
.payment-amount__control .input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.payment-amount__due {
  position: absolute;
  top: 50%;
  right: 0.3rem;
  transform: translateY(-50%);
  height: 1.45rem;
  padding: 0 0.5rem;
  border: none;
  border-radius: calc(var(--radius) - 2px);
  background: var(--muted);
  color: var(--foreground);
  font: inherit;
  font-size: 0.7rem;
  font-weight: 600;
  line-height: 1;
  white-space: nowrap;
  cursor: pointer;
}

.payment-amount__due:hover {
  background: color-mix(in srgb, var(--muted) 70%, var(--foreground) 8%);
}

.payment-add-section {
  margin-top: 1.85rem;
  max-width: 28rem;
  border: none;
  background: transparent;
  overflow: visible;
}

.payment-add-section__summary {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.15rem 0;
  min-height: 0;
  cursor: pointer;
  list-style: none;
  user-select: none;
}

.payment-add-section__summary::-webkit-details-marker {
  display: none;
}

.payment-add-section__label {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  font-weight: 600;
  font-size: 0.925rem;
  line-height: 1.2;
  color: var(--foreground);
}

.payment-add-section__label::before {
  content: "";
  display: inline-block;
  width: 0.4rem;
  height: 0.4rem;
  border-right: 2px solid var(--muted-foreground);
  border-bottom: 2px solid var(--muted-foreground);
  transform: rotate(-45deg);
  transition: transform 0.15s ease;
  flex-shrink: 0;
}

.payment-add-section[open] > .payment-add-section__summary .payment-add-section__label::before {
  transform: rotate(45deg);
}

.payment-add-section__body {
  padding: 0.75rem 0 0;
  max-width: none;
}

#invoice-payment-form.stack {
  gap: 0.65rem;
}

#invoice-payment-form > .form-field {
  margin-bottom: 0;
}

#payment-add-note {
  margin: 0;
  align-self: flex-start;
}

#payment-add-note[hidden],
#payment-note-field[hidden] {
  display: none !important;
}

table.data .row-actions {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.35rem;
  width: 100%;
}

.badge {
  display: inline-flex;
  align-items: center;
  height: 1.35rem;
  padding: 0 0.45rem;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--muted);
  font-size: 0.7rem;
  font-weight: 550;
  color: var(--muted-foreground);
  text-transform: lowercase;
}

.toast-region {
  position: fixed;
  right: max(1rem, env(safe-area-inset-right, 0px));
  bottom: max(1rem, env(safe-area-inset-bottom, 0px));
  z-index: 80;
  display: flex;
  flex-direction: column-reverse;
  align-items: flex-end;
  gap: 0.6rem;
  width: min(22.5rem, calc(100vw - 2rem));
  pointer-events: none;
}

.toast {
  pointer-events: auto;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.65rem;
  align-items: start;
  width: 100%;
  padding: 0.85rem 0.85rem 0.85rem 1rem;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--card-foreground);
  box-shadow: var(--shadow);
  font-size: 0.875rem;
  line-height: 1.4;
  opacity: 0;
  transform: translateY(0.75rem);
  transition: opacity 180ms ease, transform 180ms ease;
}

.toast.is-visible {
  opacity: 1;
  transform: translateY(0);
}

.toast.is-leaving {
  opacity: 0;
  transform: translateY(0.5rem);
}

.toast__body {
  margin: 0;
  padding-top: 0.1rem;
  word-break: break-word;
}

.toast__meta {
  display: flex;
  align-items: center;
}

.toast__close {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.75rem;
  height: 1.75rem;
  padding: 0;
  border: none;
  border-radius: 999px;
  background: transparent;
  color: inherit;
  cursor: pointer;
  flex-shrink: 0;
}

.toast__close:hover {
  background: rgba(0, 0, 0, 0.05);
}

.toast__close:focus-visible {
  outline: 2px solid var(--ring);
  outline-offset: 1px;
}

.toast__timer-svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  transform: rotate(-90deg);
  pointer-events: none;
}

.toast__timer-track {
  stroke: currentColor;
  stroke-opacity: 0.22;
  stroke-width: 2.5;
}

.toast__timer-progress {
  stroke: currentColor;
  stroke-opacity: 0.85;
  stroke-width: 2.5;
  stroke-linecap: round;
  transition: none;
}

.toast__close-icon {
  position: relative;
  z-index: 1;
  display: grid;
  place-items: center;
  width: 0.75rem;
  height: 0.75rem;
  color: inherit;
  opacity: 0.75;
}

.toast__close:hover .toast__close-icon {
  opacity: 1;
}

.toast__close-icon svg {
  width: 100%;
  height: 100%;
  stroke: currentColor;
  stroke-width: 2.5;
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.toast--success {
  border-color: #bbf7d0;
  background: #f0fdf4;
  color: #166534;
}

.toast--error {
  border-color: #fecaca;
  background: #fef2f2;
  color: #991b1b;
}

.toast--warning {
  border-color: #fde68a;
  background: #fffbeb;
  color: #92400e;
}

.toast--info {
  border-color: var(--border);
  background: var(--card);
  color: var(--card-foreground);
}

.btn-lg {
  height: 2.4rem;
  padding: 0 1.1rem;
  font-size: 0.9rem;
}

.auth-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 1.5rem;
}

.auth-card {
  width: min(100%, 420px);
}

.auth-card h1 {
  margin: 0 0 0.25rem;
  font-size: 1.4rem;
  letter-spacing: -0.03em;
}

.auth-card .sub {
  margin: 0 0 1.25rem;
  color: var(--muted-foreground);
  font-size: 0.9rem;
}

/* ——— Landing (marketing) ——— */
.landing {
  --landing-bg: #f7f7f7;
  --landing-card: #fff;
  --landing-text: #111;
  --landing-muted: #6b6b6b;
  --landing-line: #e3e3e3;
  --landing-btn: #111;
  --landing-btn-text: #fff;
  --landing-chip: #f0f0f0;
  --landing-shadow: 0 1px 2px rgba(0, 0, 0, 0.06), 0 8px 24px -8px rgba(0, 0, 0, 0.18);
  min-height: 100vh;
  min-height: 100dvh;
  margin: 0;
  padding: env(safe-area-inset-top, 0) 0 env(safe-area-inset-bottom, 0);
  background: var(--landing-bg);
  color: var(--landing-text);
  font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
  font-size: 14px;
  font-weight: 400;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

.landing h1,
.landing h2,
.landing p {
  margin: 0;
}

.landing__wrap {
  max-width: 480px;
  margin: 0 auto;
  padding: 0 20px;
}

.landing__nav {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 20px 0;
  font-weight: 700;
  font-size: 15px;
}

.landing__nav .brand {
  padding: 0;
  font-weight: 700;
  font-size: inherit;
  letter-spacing: -0.01em;
}

.landing__nav .brand__icon {
  width: 1.5rem;
  height: 1.5rem;
}

.landing__hero {
  padding: 20px 0 8px;
}

.landing__title {
  font-size: 30px;
  line-height: 1.12;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.landing__sub {
  color: var(--landing-muted);
  margin-top: 10px;
  max-width: 32ch;
}

.landing__btn {
  display: inline-block;
  margin-top: 20px;
  background: var(--landing-btn);
  color: var(--landing-btn-text);
  text-decoration: none;
  font-weight: 600;
  font-size: 14px;
  padding: 11px 20px;
  border-radius: 10px;
  box-shadow: var(--landing-shadow);
}

.landing__btn:hover {
  color: var(--landing-btn-text);
  text-decoration: none;
  opacity: 0.94;
}

.landing__art {
  position: relative;
  height: 210px;
  margin: 28px 0 0;
}

.landing__sheet {
  position: absolute;
  background: var(--landing-card);
  border: 1px solid var(--landing-line);
  border-radius: 12px;
  box-shadow: var(--landing-shadow);
  padding: 14px;
}

.landing__sheet i {
  display: block;
  height: 5px;
  border-radius: 3px;
  background: var(--landing-line);
  margin-bottom: 7px;
  font-style: normal;
}

.landing__sheet--a {
  left: 0;
  top: 6px;
  width: 58%;
  height: 120px;
  transform: rotate(-6deg);
}

.landing__sheet--b {
  right: 0;
  top: 44px;
  width: 54%;
  height: 130px;
  transform: rotate(5deg);
}

.landing__sheet--c {
  left: 15%;
  top: 34px;
  width: 64%;
  transform: rotate(-1deg);
  z-index: 2;
  padding: 16px;
}

.landing__sheet--c b {
  display: block;
  font-size: 13px;
  font-weight: 700;
}

.landing__sheet--c span {
  display: block;
  font-size: 11px;
  color: var(--landing-muted);
  margin: 1px 0 14px;
}

.landing__sheet-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
}

.landing__amt {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.landing__tag {
  font-size: 10px;
  font-weight: 700;
  font-style: normal;
  background: var(--landing-btn);
  color: var(--landing-btn-text);
  border-radius: 99px;
  padding: 3px 9px;
}

.landing__section {
  padding: 36px 0 0;
}

.landing__h2 {
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.015em;
}

.landing__lead {
  color: var(--landing-muted);
  margin-top: 6px;
}

.landing__card {
  background: var(--landing-card);
  border: 1px solid var(--landing-line);
  border-radius: 14px;
  box-shadow: var(--landing-shadow);
  padding: 16px;
  margin-top: 16px;
}

.landing__item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
  padding: 10px 0;
  border-bottom: 1px solid var(--landing-line);
}

.landing__item:first-child {
  padding-top: 0;
}

.landing__item:last-child {
  border: 0;
  padding-bottom: 0;
}

.landing__item b {
  display: block;
  font-weight: 600;
}

.landing__item small {
  color: var(--landing-muted);
  font-size: 12px;
}

.landing__pill {
  flex: 0 0 auto;
  font-size: 11px;
  font-weight: 600;
  background: var(--landing-chip);
  border-radius: 99px;
  padding: 3px 10px;
  white-space: nowrap;
}

.landing__pill--dark {
  background: var(--landing-btn);
  color: var(--landing-btn-text);
}

.landing__bill-head {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: var(--landing-muted);
  padding-bottom: 10px;
  border-bottom: 1px dashed var(--landing-line);
}

.landing__bill-line {
  display: flex;
  justify-content: space-between;
  padding: 10px 0 0;
}

.landing__bill-total {
  display: flex;
  justify-content: space-between;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--landing-line);
  font-weight: 700;
  font-size: 16px;
}

.landing__footer {
  margin-top: 44px;
  padding: 28px 0 32px;
  border-top: 1px solid var(--landing-line);
  font-size: 12px;
  color: var(--landing-muted);
}

.landing__footer a {
  color: inherit;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.landing__footer-sep {
  margin: 0 0.35rem;
}

@media (min-width: 860px) {
  .landing {
    font-size: 15px;
  }

  .landing__wrap {
    max-width: 1080px;
    padding: 0 40px;
  }

  .landing__nav {
    padding: 28px 0;
    font-size: 16px;
  }

  .landing__hero {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 48px;
    align-items: center;
    padding: 56px 0 24px;
  }

  .landing__title {
    font-size: 46px;
    line-height: 1.08;
  }

  .landing__sub {
    font-size: 16px;
    max-width: 36ch;
    margin-top: 14px;
  }

  .landing__btn {
    font-size: 15px;
    padding: 13px 24px;
    margin-top: 26px;
  }

  .landing__art {
    height: 320px;
    margin: 0;
  }

  .landing__sheet {
    padding: 18px;
  }

  .landing__sheet--a {
    height: 170px;
  }

  .landing__sheet--b {
    height: 180px;
  }

  .landing__sheet--c {
    top: 60px;
    padding: 22px;
  }

  .landing__sheet--c b {
    font-size: 15px;
  }

  .landing__sheet--c span {
    font-size: 12px;
  }

  .landing__amt {
    font-size: 30px;
  }

  .landing__features {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 32px;
    margin-top: 24px;
  }

  .landing__section {
    padding-top: 40px;
  }

  .landing__h2 {
    font-size: 24px;
  }

  .landing__card {
    padding: 20px;
  }

  .landing__bill-line,
  .landing__bill-total {
    font-size: 15px;
  }

  .landing__footer {
    margin-top: 64px;
    display: flex;
    justify-content: space-between;
    align-items: center;
  }

  .landing__footer-sep {
    display: none;
  }
}

@keyframes landing-rise {
  from {
    opacity: 0;
    transform: translateY(0.85rem);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes landing-float {
  0%,
  100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-0.55rem);
  }
}

/* ——— Auth split layout ——— */
.auth-layout {
  min-height: 100vh;
  min-height: 100dvh;
  display: grid;
  grid-template-columns: minmax(0, 0.95fr) minmax(0, 1.05fr);
}

.auth-visual {
  position: relative;
  background:
    radial-gradient(ellipse 70% 55% at 20% 15%, rgba(15, 118, 110, 0.35) 0%, transparent 55%),
    linear-gradient(160deg, #0b1220 0%, #152238 55%, #0f3d3a 100%);
  color: #f4f4f5;
  overflow: hidden;
  display: flex;
  align-items: flex-end;
  padding: clamp(1.75rem, 4vw, 3rem);
}

.auth-visual-inner {
  position: relative;
  z-index: 1;
  max-width: 22rem;
  animation: landing-rise 0.65s ease-out both;
}

.auth-visual-brand {
  color: #fff;
  font-size: clamp(1.75rem, 3vw, 2.4rem);
  margin-bottom: 0.85rem;
}

.auth-visual-brand .brand {
  padding: 0;
  font-size: inherit;
  font-weight: 700;
  color: inherit;
  letter-spacing: inherit;
}

.auth-visual-brand .brand__icon {
  width: 1.15em;
  height: 1.15em;
}

.auth-visual-line {
  margin: 0;
  font-size: 1.05rem;
  line-height: 1.5;
  color: rgba(244, 244, 245, 0.78);
}

.auth-orbit {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.auth-orb {
  position: absolute;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.03);
}

.auth-orb-1 {
  width: 18rem;
  height: 18rem;
  top: -4rem;
  right: -3rem;
  animation: landing-float 9s ease-in-out infinite;
}

.auth-orb-2 {
  width: 10rem;
  height: 10rem;
  bottom: 18%;
  right: 18%;
  background: rgba(15, 118, 110, 0.25);
  animation: landing-float 7s ease-in-out 0.5s infinite;
}

.auth-orb-3 {
  width: 4.5rem;
  height: 4.5rem;
  top: 35%;
  left: 12%;
  background: rgba(255, 255, 255, 0.06);
  animation: landing-float 6s ease-in-out 0.2s infinite;
}

.auth-panel {
  display: grid;
  place-items: center;
  padding: 1.5rem;
  background:
    radial-gradient(ellipse 60% 40% at 100% 0%, rgba(15, 118, 110, 0.06) 0%, transparent 50%),
    var(--paper);
}

.auth-panel-inner {
  width: min(100%, 24rem);
  padding: 1.75rem;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  animation: landing-rise 0.55s ease-out 0.05s both;
}

.auth-panel-inner h1 {
  margin: 0 0 0.25rem;
  font-family: var(--font-display);
  font-size: 1.55rem;
  letter-spacing: -0.03em;
  font-weight: 700;
}

.auth-panel-inner .sub {
  margin: 0 0 1.25rem;
  color: var(--muted-foreground);
  font-size: 0.9rem;
}

.auth-mobile-brand {
  display: none;
  margin-bottom: 1rem;
  font-family: var(--font-display);
  font-weight: 700;
}

.auth-mobile-brand .brand {
  padding: 0;
  font-size: inherit;
  font-weight: inherit;
}

.auth-footer {
  margin-top: 1rem;
  font-size: 0.875rem;
}

.auth-footer a {
  text-decoration: underline;
  text-underline-offset: 2px;
}

@media (max-width: 860px) {
  .auth-layout {
    grid-template-columns: 1fr;
  }

  .auth-visual {
    display: none;
  }

  .auth-mobile-brand {
    display: block;
  }

  .auth-panel {
    min-height: 100vh;
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
    justify-content: safe center;
    align-items: center;
    overflow-y: auto;
    padding: 1.25rem;
    padding-top: calc(1.25rem + env(safe-area-inset-top, 0));
    padding-bottom: calc(1.25rem + env(safe-area-inset-bottom, 0));
  }

  .auth-panel-inner {
    margin-block: auto;
  }
}

.muted {
  color: var(--muted-foreground);
}

.field-grid {
  display: grid;
  gap: 0.75rem;
}

.gov-id-pair {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.75rem;
}

@media (min-width: 640px) {
  .gov-id-pair {
    grid-template-columns: 1fr 1fr;
    align-items: start;
  }
}

.field-row-card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem;
  background: var(--card);
}

.field-row-fields {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: start;
}

.field-row-fields > .form-field {
  margin-bottom: 0;
}

.field-row-fields > .form-field--grow {
  flex: 1 1 11rem;
  min-width: 10rem;
}

.field-row-fields > .form-field--compact {
  flex: 0 0 auto;
}

.field-row-fields > .form-field--compact select,
.field-row-fields > .form-field--compact .select {
  width: auto;
  min-width: 7.5rem;
  max-width: 11rem;
  field-sizing: content;
  padding-right: 1.85rem;
}

.field-row-fields > .form-field--compact input[type="number"] {
  width: 4.5rem;
  min-width: 4.5rem;
  max-width: 5.5rem;
  field-sizing: content;
}

.field-row-fields > .form-field--checkbox {
  flex: 0 0 auto;
  /* Skip sibling label row, then center beside the control height */
  padding-top: calc(0.875rem * 1.25 + 0.35rem);
}

.field-row-fields > .form-field--checkbox .checkbox-row {
  height: 2rem;
}

/* Legacy grid checkbox alignment (other forms) */
.field-row-card .field-grid > .form-field:has(.checkbox-row) {
  padding-top: calc(0.875rem * 1.25 + 0.35rem);
}

.field-row-card .field-grid > .form-field:has(.checkbox-row) .checkbox-row {
  height: 2rem;
}

.empty {
  padding: 2rem 1rem;
  text-align: center;
  color: var(--muted-foreground);
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  background: rgba(244, 244, 245, 0.8);
  font-size: 0.875rem;
  line-height: 1.4;
}

.checkbox-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.checkbox-row input {
  width: auto;
  height: auto;
}

.modal {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0;
  width: min(100%, 440px);
  max-height: min(92vh, 760px);
  overflow: hidden;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.12);
  background: var(--card);
  color: var(--card-foreground);
}

.modal[open],
.modal:popover-open {
  display: flex;
  flex-direction: column;
}

/* Stack IMEI scan above an already-open sell dialog (Popover top layer). */
.modal.imei-scan-modal:popover-open {
  position: fixed;
  inset: 50% auto auto 50%;
  margin: 0;
  transform: translate(-50%, -50%);
}

.modal.imei-scan-modal:popover-open::backdrop {
  background: rgba(24, 24, 27, 0.45);
}

.modal__shell {
  display: flex;
  flex-direction: column;
  min-height: 0;
  flex: 1 1 auto;
  max-height: inherit;
  overflow: hidden;
}

.modal__header {
  flex: 0 0 auto;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.9rem 1.1rem;
  border-bottom: 1px solid var(--border);
  background: var(--card);
  z-index: 2;
}

.modal__header .card-title,
.modal__header h2 {
  margin: 0;
}

.modal__header .card-desc {
  margin-top: 0.3rem;
}

.modal__close {
  flex-shrink: 0;
  margin: -0.15rem -0.2rem 0 0;
  border: none;
  background: transparent;
  box-shadow: none;
}

.modal__close:hover {
  border: none;
  background: var(--muted);
}

.modal__body {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  padding: 1rem 1.1rem;
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.modal__body.stack {
  gap: 0.85rem;
}

.modal__footer {
  flex: 0 0 auto;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.65rem;
  padding: 0.85rem 1.1rem;
  border-top: 1px solid var(--border);
  background: var(--card);
  z-index: 2;
}

.modal-sell {
  width: min(100%, 520px);
  height: min(92vh, 760px);
  max-height: min(92vh, 760px);
  position: relative;
}

.sell-inline-scan {
  position: absolute;
  inset: 0;
  z-index: 30;
  display: flex;
  flex-direction: column;
  background: var(--card);
  color: var(--card-foreground);
}

.sell-inline-scan[hidden] {
  display: none !important;
}

.sell-inline-scan__header {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.9rem 1.1rem;
  border-bottom: 1px solid var(--border);
}

.sell-inline-scan__title {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 600;
}

.sell-inline-scan__body {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
  padding: 1rem 1.1rem;
}

@media (min-width: 768px) {
  .modal-sell {
    width: min(820px, 94vw);
  }
}

.modal-sell .modal__shell {
  height: 100%;
  max-height: 100%;
  min-height: 0;
}

.modal-sell .modal__body {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-y;
}

.modal-sell #buyer-manual-fields[open] {
  min-height: 0;
}

.modal-sell #buyer-manual-fields[open] .product-form-section__body {
  max-height: min(52dvh, 26rem);
  overflow: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-y;
}

.sell-modal__footer {
  flex-wrap: nowrap;
  justify-content: space-between;
  gap: 0.75rem;
}

.sell-received {
  flex: 1 1 auto;
  min-width: 0;
  max-width: 14rem;
  margin-left: auto;
}

.sell-received__control {
  position: relative;
}

.sell-product-lines .table-wrap {
  overflow: hidden;
}

.sell-received__control .input {
  width: 100%;
  padding-right: 3.1rem;
  appearance: textfield;
  -moz-appearance: textfield;
}

.sell-received__control .input::-webkit-outer-spin-button,
.sell-received__control .input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.sell-received__full {
  position: absolute;
  top: 50%;
  right: 0.3rem;
  transform: translateY(-50%);
  height: 1.45rem;
  padding: 0 0.45rem;
  border: none;
  border-radius: calc(var(--radius) - 2px);
  background: var(--muted);
  color: var(--foreground);
  font: inherit;
  font-size: 0.7rem;
  font-weight: 600;
  line-height: 1;
  cursor: pointer;
}

.sell-received__full:hover {
  background: color-mix(in srgb, var(--muted) 70%, var(--foreground) 8%);
}

#sell-lines-table {
  min-width: 0 !important;
  width: 100%;
  table-layout: fixed;
}

#sell-lines-table th,
#sell-lines-table td {
  white-space: nowrap;
}

#sell-lines-table .sell-lines__col-remove {
  width: 2rem;
  min-width: 2rem;
  max-width: 2rem;
  padding-left: 0.2rem;
  padding-right: 0.1rem;
  text-align: center;
  vertical-align: middle;
}

#sell-lines-table .sell-lines__col-product {
  width: auto;
  min-width: 0;
  white-space: nowrap;
}

#sell-lines-table .sell-lines__col-qty {
  width: 3.15rem;
  min-width: 3.15rem;
  max-width: 3.15rem;
  padding-left: 0.25rem;
  padding-right: 0.25rem;
}

#sell-lines-table .sell-lines__col-price {
  width: 5.35rem;
  min-width: 5.35rem;
  max-width: 5.35rem;
  padding-left: 0.25rem;
  padding-right: 0.35rem;
}

#sell-lines-table .sell-lines__qty,
#sell-lines-table .sell-lines__price {
  width: 100%;
  min-width: 0;
  padding-left: 0.3rem;
  padding-right: 0.3rem;
  appearance: textfield;
  -moz-appearance: textfield;
}

#sell-lines-table .sell-lines__qty::-webkit-outer-spin-button,
#sell-lines-table .sell-lines__qty::-webkit-inner-spin-button,
#sell-lines-table .sell-lines__price::-webkit-outer-spin-button,
#sell-lines-table .sell-lines__price::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

#sell-lines-table .sell-lines__remove {
  border: none;
  background: transparent;
  box-shadow: none;
  color: var(--muted-foreground);
}

#sell-lines-table .sell-lines__remove:hover {
  border: none;
  background: transparent;
  color: var(--destructive, #b91c1c);
}

.sell-product-picker {
  position: relative;
}

.sell-product-picker__search {
  width: 100%;
}

.sell-product-picker__search .input {
  padding-right: 5.4rem;
}

.sell-product-picker__search .filter-search__actions {
  gap: 0;
}

.sell-product-picker__search .input-affix-btn {
  width: 1.55rem;
  min-width: 1.55rem;
  max-width: 1.55rem;
  height: 1.55rem;
  min-height: 1.55rem;
}

.sell-product-picker__search .input-affix-btn .icon {
  width: 0.9rem;
  height: 0.9rem;
}

.sell-product-picker__search .input-affix-btn.is-active {
  color: var(--foreground);
  background: color-mix(in srgb, var(--foreground) 8%, transparent);
}

.sell-product-picker__panel {
  position: relative;
  top: auto;
  left: auto;
  z-index: 2;
  width: 100%;
  min-width: 0;
  max-width: 100%;
  margin-top: 0.45rem;
  box-sizing: border-box;
}

.sell-product-picker__months {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.35rem;
  padding: 0.15rem 0 0.35rem;
}

.sell-product-picker__month-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 2rem;
  margin: 0;
  padding: 0.35rem 0.4rem;
  border: 1px solid transparent;
  border-radius: var(--radius);
  background: transparent;
  color: var(--foreground);
  font: inherit;
  font-size: 0.8rem;
  cursor: pointer;
}

.sell-product-picker__month-btn:hover {
  background: var(--muted);
}

.sell-product-picker__month-btn.is-selected {
  background: var(--foreground);
  color: var(--primary-foreground);
}

.sell-product-picker__tray {
  display: none;
  margin-top: 0.45rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--card);
  overflow: hidden;
}

.sell-product-picker__tray.is-open {
  display: block;
}

.sell-product-picker__tray-inner {
  min-height: 0;
}

.sell-product-picker__list {
  max-height: 12rem;
  height: auto;
  overflow-x: hidden;
  overflow-y: auto;
  padding: 0.35rem;
  overscroll-behavior: contain;
}

.sell-product-picker__footer {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 0.5rem;
  padding: 0.45rem 0.55rem;
  border-top: 1px solid var(--border);
  background: color-mix(in srgb, var(--muted) 55%, var(--card));
}

.sell-product-lines {
  margin-top: 0.75rem;
}

.sell-lines-empty {
  margin: 0;
  text-align: center;
}

.gov-id-line {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  flex-wrap: wrap;
}

.gov-id-view-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.75rem;
  height: 1.75rem;
  border-radius: var(--radius);
  color: var(--muted-foreground);
  background: transparent;
  border: none;
  padding: 0;
  cursor: pointer;
  flex-shrink: 0;
}

.gov-id-view-btn:hover {
  background: var(--muted);
  color: var(--foreground);
}

.gov-id-view-btn .icon svg {
  width: 1rem;
  height: 1rem;
}

.modal-image {
  width: min(100%, 520px);
  max-height: min(92vh, 760px);
}

@media (min-width: 768px) {
  .modal-image {
    width: min(640px, 92vw);
  }
}

.modal-invoice-ready {
  width: min(92vw, 42rem);
  max-width: min(92vw, 42rem);
  height: min(88dvh, 88vh);
  max-height: min(88dvh, 88vh);
  margin: auto;
  border-radius: var(--radius);
  overflow: hidden;
}

.modal-invoice-ready .modal__shell {
  height: 100%;
  min-height: 0;
}

.modal-invoice-ready .modal__body {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
  padding: 0.6rem;
  background: var(--muted);
  align-items: center;
}

.modal-invoice-ready .modal__body img {
  display: block;
  width: 100%;
  height: auto;
  background: #fff;
}

.modal-invoice-ready .modal__body img[hidden] {
  display: none;
}

.invoice-ready-preview__status {
  margin: 0;
  padding: 0.75rem 0.5rem;
  text-align: center;
}

.invoice-ready-skeleton {
  width: 100%;
  padding: 0.35rem;
}

.invoice-ready-skeleton[hidden] {
  display: none;
}

.invoice-ready-skeleton__page {
  background: #fff;
  border-radius: calc(var(--radius) - 2px);
  padding: 1.25rem 1.1rem 1.5rem;
  min-height: min(52vh, 28rem);
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.06);
}

.invoice-ready-skeleton__brand {
  height: 1.1rem;
}

.invoice-ready-skeleton__rule {
  height: 1px;
  margin: 1.15rem 0;
  background: color-mix(in srgb, var(--border) 85%, transparent);
}

.invoice-ready-skeleton__row {
  height: 2.35rem;
  margin-top: 0.55rem;
}

.invoice-ready-skeleton__row:first-of-type {
  margin-top: 0;
}

.invoice-ready-actions {
  justify-content: stretch;
  flex-wrap: nowrap;
  gap: 0.5rem;
}

.invoice-ready-actions .btn {
  flex: 1 1 0;
  justify-content: center;
}

.invoice-ready-actions .icon {
  width: 0.95rem;
  height: 0.95rem;
}

@media (min-width: 768px) {
  .invoice-ready-actions {
    justify-content: flex-end;
  }

  .invoice-ready-actions .btn {
    flex: 0 0 auto;
  }
}

.form-actions-bar {
  position: sticky;
  bottom: 0;
  z-index: 8;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.65rem;
  margin-top: 0.75rem;
  padding: 0.85rem 0 0.1rem;
  background: var(--card);
  border-top: 1px solid var(--border);
  box-shadow: 0 -10px 18px -14px rgba(0, 0, 0, 0.18);
}

.card > .form-actions-bar,
.card.stack > .form-actions-bar {
  margin-left: -1.25rem;
  margin-right: -1.25rem;
  margin-bottom: -1.25rem;
  padding: 0.85rem 1.25rem;
  border-radius: 0 0 var(--radius) var(--radius);
}

.form-sticky-actions > .form-actions-bar {
  margin-left: -0.05rem;
  margin-right: -0.05rem;
  padding: 0.85rem 0.15rem 0.25rem;
  background: var(--background);
}

.gov-id-image-frame {
  display: flex;
  justify-content: center;
  align-items: center;
  max-height: min(70vh, 520px);
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--muted);
}

.gov-id-image-frame img {
  display: block;
  max-width: 100%;
  max-height: min(70vh, 520px);
  width: auto;
  height: auto;
  object-fit: contain;
}

.modal::backdrop {
  background: rgba(24, 24, 27, 0.4);
}

.icon-btn-sm {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  min-width: 2rem;
  padding: 0 0.35rem;
  border-radius: var(--radius);
  border: 1px solid var(--btn-idle-border);
  background: var(--btn-idle-bg);
  color: var(--btn-idle-fg);
  text-decoration: none;
  cursor: pointer;
  box-sizing: border-box;
}

.icon-btn-sm:hover {
  background: var(--btn-idle-hover);
  text-decoration: none;
}

.icon-btn-sm .icon {
  width: 0.95rem;
  height: 0.95rem;
}

.icon-btn-sm.modal__close {
  border: none;
  background: transparent;
  box-shadow: none;
}

.icon-btn-sm.modal__close:hover {
  border: none;
  background: var(--muted);
}

.icon-btn-sm.invoice-line-return__btn {
  border: none;
  background: transparent;
  box-shadow: none;
  color: var(--muted-foreground);
}

.icon-btn-sm.invoice-line-return__btn:hover {
  border: none;
  background: transparent;
  color: var(--foreground);
}

.label-hint {
  cursor: help;
  border-bottom: 1px dotted var(--muted-foreground);
}

.settings-section {
  margin-bottom: 1.5rem;
}

.settings-section--compact {
  padding: 0.65rem 1rem;
  margin-bottom: 1rem;
}

.settings-section-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 0.85rem;
}

.settings-section-header--inline {
  align-items: center;
  flex-wrap: nowrap;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}

.settings-section-header--inline .card-title {
  margin: 0;
  min-width: 0;
  flex: 1 1 auto;
}

.settings-section-header--inline .btn {
  flex: 0 0 auto;
}

.settings-text-link {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  margin: 0;
  padding: 0;
  border: none;
  background: none;
  box-shadow: none;
  color: var(--foreground);
  font: inherit;
  font-size: 0.925rem;
  font-weight: 550;
  line-height: 1.2;
  text-decoration: none;
  cursor: pointer;
}

.settings-text-link:hover {
  text-decoration: underline;
  text-underline-offset: 2px;
}

.settings-text-link .icon {
  width: 0.95rem;
  height: 0.95rem;
  color: var(--muted-foreground);
}

.settings-text-link:hover .icon {
  color: var(--foreground);
}

.settings-collapsible {
  padding: 0;
  overflow: hidden;
}

.settings-collapsible__summary {
  display: flex;
  flex-direction: column;
  gap: 0;
  padding: 0.65rem 1rem;
  cursor: pointer;
  list-style: none;
  user-select: none;
}

.settings-collapsible__summary::-webkit-details-marker {
  display: none;
}

.settings-collapsible__summary-top {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
  min-height: 1.5rem;
}

.settings-collapsible__summary-top::before {
  content: "";
  display: inline-block;
  width: 0.45rem;
  height: 0.45rem;
  border-right: 2px solid var(--muted-foreground);
  border-bottom: 2px solid var(--muted-foreground);
  transform: rotate(-45deg);
  transition: transform 0.15s ease;
  flex-shrink: 0;
}

.settings-collapsible[open] > .settings-collapsible__summary .settings-collapsible__summary-top::before {
  transform: rotate(45deg);
}

.settings-collapsible__icon {
  width: 1rem;
  height: 1rem;
  color: var(--foreground);
  flex-shrink: 0;
}

.settings-collapsible__summary .card-title {
  margin: 0;
  font-size: 0.95rem;
  line-height: 1.2;
}

.settings-collapsible__meta {
  margin: 0;
  padding-left: 1rem;
  font-size: 0.875rem;
}

.settings-collapsible__body {
  padding: 0 1rem 1rem;
  border-top: 1px solid var(--border, rgba(0, 0, 0, 0.08));
  padding-top: 0.75rem;
}

.badge-warn {
  background: color-mix(in srgb, #b45309 14%, transparent);
  color: #92400e;
  border: 1px solid color-mix(in srgb, #b45309 28%, transparent);
}

.party-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
}

@media (max-width: 700px) {
  .party-grid {
    grid-template-columns: 1fr;
  }
}

.party-grid .card,
.party-grid .party-section {
  margin: 0;
}

.party-section .product-form-section__summary {
  gap: 0.55rem;
}

.party-section__name {
  font-weight: 400;
  font-size: 0.95rem;
  color: var(--foreground);
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.invoice-detail-total {
  margin: 0.75rem 0 0;
  text-align: right;
  font-weight: 400;
  color: inherit;
}

.invoice-sheet__meta {
  margin-bottom: 1rem;
}

.invoice-sheet__number {
  margin: 0;
  font-size: 1.2rem;
  font-weight: 650;
  letter-spacing: -0.02em;
  color: var(--foreground);
}

.invoice-sheet__date {
  margin: 0.2rem 0 0;
  color: var(--foreground);
  font-size: 0.92rem;
  opacity: 0.72;
}

.invoice-sheet__parties {
  display: flex;
  align-items: flex-start;
  gap: 0.85rem;
  margin-bottom: 1.25rem;
}

.invoice-sheet__parties-main {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(10rem, 0.9fr);
  gap: 1.25rem;
  align-items: start;
  flex: 1;
  min-width: 0;
}

.invoice-sheet__logo {
  width: 4.5rem;
  height: 4.5rem;
  object-fit: contain;
  flex-shrink: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--card);
}

.invoice-sheet__shop-copy {
  min-width: 0;
}

.invoice-sheet__shop-name {
  margin: 0 0 0.35rem;
  font-size: 1.05rem;
  font-weight: 650;
}

.invoice-sheet__bill-to {
  min-width: 0;
  text-align: left;
  justify-self: end;
  width: min(100%, 18rem);
}

.invoice-sheet__label {
  margin: 0 0 0.35rem;
  font-size: 0.8rem;
  font-weight: 650;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--foreground);
}

.invoice-sheet__kv {
  display: grid;
  grid-template-columns: max-content minmax(0, 1fr);
  column-gap: 0.4rem;
  row-gap: 0.2rem;
  align-items: start;
}

.invoice-sheet__field-label {
  font-weight: 550;
  color: var(--foreground);
  white-space: nowrap;
}

.invoice-sheet__field-label::after {
  content: ":";
}

.invoice-sheet__kv > span:nth-child(even) {
  color: var(--foreground);
  font-weight: 400;
  min-width: 0;
}

.invoice-line-desc {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.invoice-line-desc__model {
  color: var(--foreground);
  font-weight: 550;
}

.invoice-line-desc__imei {
  color: var(--muted-foreground);
  font-size: 0.9em;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}

.invoice-sheet__line {
  margin: 0.2rem 0 0;
}

.invoice-sheet__pre {
  white-space: pre-wrap;
}

.invoice-sheet__table {
  margin-top: 1rem;
  border: none;
  box-shadow: none;
}

.invoice-sheet__section {
  margin-top: 1rem;
}

.invoice-sheet__section .invoice-sheet__label {
  margin-bottom: 0.35rem;
}

.invoice-sheet__section .invoice-sheet__pre,
.invoice-sheet__footer {
  color: var(--foreground);
  opacity: 0.78;
}

.invoice-sheet__total {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  margin-top: 1rem;
  text-align: right;
}

.invoice-sheet__total-value {
  margin: 0.15rem 0 0;
  font-size: 1.35rem;
  font-weight: 700;
}

.invoice-sheet__footer {
  margin: 1rem 0 0;
}

@media (max-width: 700px) {
  .invoice-sheet__parties {
    flex-direction: column;
  }

  .invoice-sheet__parties-main {
    grid-template-columns: 1fr;
  }

  .invoice-sheet__bill-to {
    justify-self: start;
    width: 100%;
  }
}

/* Product filter bar */
.filters-bar {
  display: grid;
  grid-template-columns: minmax(10rem, 1.4fr) repeat(3, minmax(8.5rem, 1fr)) auto;
  gap: 0.75rem;
  align-items: end;
}

.filters-card {
  margin-bottom: 1rem;
  padding: 0.65rem 0.85rem;
}

.filters-bar-products,
.filters-bar-invoice {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: nowrap;
}

.filters-bar-products .filter-search,
.filters-bar-invoice .filter-search {
  flex: 1 1 auto;
  min-width: 0;
}

.filters-bar-products .filter-search .input,
.filters-bar-invoice .filter-search .input {
  width: 100%;
}

.filters-bar-products .date-range,
.filters-bar-invoice .date-range,
.filters-bar-products .product-date-filters {
  flex: 0 0 auto;
}

.product-date-filters {
  display: inline-flex;
  align-items: center;
  gap: 0.15rem;
  position: relative;
}

.product-date-filters .date-range {
  position: relative;
}

.filters-bar-products .filter-actions,
.filters-bar-invoice .filter-actions {
  display: inline-flex;
  align-items: center;
  gap: 0.1rem;
  flex: 0 0 auto;
  margin-left: auto;
}

/* Quiet icon tools in filter bars — not full bordered chicklets */
.filters-bar .filter-actions .btn-icon,
.filters-bar .date-range-trigger--icon:not(.is-active) {
  width: 1.75rem;
  min-width: 1.75rem;
  max-width: 1.75rem;
  height: 1.75rem;
  min-height: 1.75rem;
  padding: 0;
  border-color: transparent;
  background: transparent;
  box-shadow: none;
  color: var(--muted-foreground);
}

.filters-bar .filter-actions .btn-icon .icon,
.filters-bar .date-range-trigger--icon:not(.is-active) .icon {
  width: 0.95rem;
  height: 0.95rem;
  color: inherit;
}

.filters-bar .filter-actions .btn-icon:hover,
.filters-bar .date-range-trigger--icon:not(.is-active):hover {
  border-color: transparent;
  background: var(--muted);
  color: var(--foreground);
  opacity: 1;
}

.filters-bar .date-range-trigger--icon.is-active {
  height: var(--control-height);
  min-height: var(--control-height);
  min-width: var(--control-height);
  padding: 0 0.55rem;
  font-size: var(--control-font-size);
  box-shadow: none;
}

.filters-bar-directory {
  display: flex;
  align-items: center;
  flex-wrap: nowrap;
  gap: 0.5rem;
}

.filters-bar-directory .filter-search {
  flex: 1 1 auto;
  min-width: 0;
  width: 100%;
}

.filters-bar-directory .filter-actions {
  flex: 0 0 auto;
}

.filter-search--inline-actions {
  position: relative;
  display: block;
  width: 100%;
}

.filter-search--inline-actions .input {
  width: 100%;
  padding-right: 0.75rem;
}

.filter-search--inline-actions input[type="search"]::-webkit-search-cancel-button {
  -webkit-appearance: none;
  appearance: none;
}

.filter-search--inline-actions:has([data-product-imei-scan-open]) .input,
.filter-search--inline-actions:has([data-invoice-scan-open]) .input,
.filter-search--inline-actions:has([data-clear-search]:not([hidden])) .input,
.filter-search--inline-actions.has-value .input {
  padding-right: 2.4rem;
}

.filter-search--inline-actions:has([data-product-imei-scan-open]):has([data-clear-search]:not([hidden])) .input,
.filter-search--inline-actions:has([data-invoice-scan-open]):has([data-clear-search]:not([hidden])) .input,
.filter-search--inline-actions.has-value:has([data-product-imei-scan-open]) .input,
.filter-search--inline-actions.has-value:has([data-invoice-scan-open]) .input {
  padding-right: 4rem;
}

.filter-search__actions {
  position: absolute;
  top: 50%;
  right: 0.2rem;
  z-index: 1;
  display: inline-flex;
  align-items: center;
  gap: 0.05rem;
  transform: translateY(-50%);
}

.filter-search__actions .btn-tool,
.filter-search__actions .input-affix-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.65rem;
  min-width: 1.65rem;
  max-width: 1.65rem;
  height: 1.65rem;
  min-height: 1.65rem;
  padding: 0;
  border: none;
  border-radius: 6px;
  background: transparent;
  box-shadow: none;
  color: var(--muted-foreground);
  text-decoration: none;
  cursor: pointer;
}

.filter-search__actions .btn-tool:hover,
.filter-search__actions .input-affix-btn:hover {
  background: color-mix(in srgb, var(--foreground) 6%, transparent);
  color: var(--foreground);
  border: none;
  opacity: 1;
}

.filter-search__actions .input-affix-btn .icon {
  width: 0.95rem;
  height: 0.95rem;
}

.filter-search__actions .input-affix-btn[hidden] {
  display: none !important;
}

.date-range__control {
  display: inline-flex;
  align-items: center;
  gap: 0.1rem;
  max-width: 100%;
}

.date-range__clear {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.5rem;
  min-width: 1.5rem;
  height: 1.5rem;
  margin: 0;
  padding: 0;
  border: none;
  border-radius: 6px;
  background: transparent;
  box-shadow: none;
  color: var(--muted-foreground);
  cursor: pointer;
  flex-shrink: 0;
}

.date-range__clear:hover {
  background: color-mix(in srgb, var(--foreground) 6%, transparent);
  color: var(--foreground);
}

.date-range__clear .icon {
  width: 0.9rem;
  height: 0.9rem;
}

.date-range__clear[hidden] {
  display: none !important;
}

.analytics-filters {
  margin-bottom: 1rem;
}

.filters-bar.filters-bar-analytics {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.5rem;
  flex-wrap: nowrap;
  grid-template-columns: none;
}

.filters-bar-analytics__label {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--muted-foreground);
  white-space: nowrap;
}

.filters-bar-analytics .filter-period {
  flex: 0 0 auto;
  width: auto;
}

.filters-bar-analytics .filter-period .select,
.filters-bar-analytics .filter-period .dd-dropdown {
  width: auto;
  min-width: 9rem;
  max-width: none;
}

.filters-bar-analytics .filter-period .select,
.filters-bar-analytics .filter-period .dd-trigger,
.filters-bar-analytics .date-range-trigger,
.filters-bar-analytics .date-range-trigger--icon,
.filters-bar-analytics .date-range-trigger--icon.is-active {
  height: var(--control-height);
  min-height: var(--control-height);
  font-size: var(--control-font-size);
  box-shadow: none;
}

.filters-bar-analytics .filter-period .dd-trigger {
  width: auto;
  padding: 0 0.55rem;
}

.filters-bar-analytics .date-range {
  flex: 0 0 auto;
  width: auto;
}

.filters-bar-analytics .date-range-trigger--icon {
  width: var(--control-height);
  min-width: var(--control-height);
  max-width: var(--control-height);
}

.filters-bar-analytics .date-range-trigger--icon.is-active {
  width: auto;
  min-width: var(--control-height);
  max-width: min(100%, 18rem);
  padding: 0 0.55rem;
}

.btn-icon {
  width: var(--control-height);
  min-width: var(--control-height);
  max-width: var(--control-height);
  height: var(--control-height);
  min-height: var(--control-height);
  padding: 0;
}

.stock-toggle {
  display: inline-flex;
  align-items: center;
  flex: 0 0 auto;
  gap: 0.1rem;
  padding: 0.12rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: color-mix(in srgb, var(--muted) 70%, transparent);
  box-shadow: none;
  overflow: hidden;
}

.stock-toggle__option {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin: 0;
  padding: 0.2rem 0.55rem;
  min-height: 1.45rem;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 550;
  line-height: 1.1;
  color: var(--muted-foreground);
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
  border-right: none;
}

.stock-toggle__option:last-child {
  border-right: none;
}

.stock-toggle__option input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
  width: 0;
  height: 0;
}

.stock-toggle__option.is-active,
.stock-toggle__option:has(input:checked) {
  background: var(--foreground);
  color: var(--primary-foreground);
}

.date-range-trigger--icon {
  width: var(--control-height);
  min-width: var(--control-height);
  max-width: var(--control-height);
  padding: 0;
  justify-content: center;
  gap: 0;
}

.date-range-trigger--icon .value {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.date-range-trigger--icon.is-active {
  width: auto;
  max-width: min(100%, 18rem);
  min-width: var(--control-height);
  height: var(--control-height);
  min-height: var(--control-height);
  padding: 0 0.55rem;
  justify-content: flex-start;
  gap: 0.35rem;
  border-color: var(--input);
  background: var(--control-bg);
  color: var(--foreground);
  box-shadow: none;
  font-weight: inherit;
  font-size: var(--control-font-size);
}

.date-range-trigger--icon.is-active:hover {
  border-color: var(--border);
  background: var(--control-bg);
}

.date-range-trigger--icon.is-active .icon {
  color: var(--muted-foreground);
  opacity: 1;
}

.date-range-trigger--icon.is-active .value {
  position: static;
  width: auto;
  height: auto;
  margin: 0;
  padding: 0;
  overflow: hidden;
  clip: auto;
  white-space: nowrap;
  text-overflow: ellipsis;
  font-weight: 400;
  font-variant-numeric: tabular-nums;
  color: var(--foreground);
}

@media (max-width: 900px) {
  .filters-bar {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 720px) {
  .filters-bar-products {
    flex-wrap: wrap;
  }

  .filters-bar-products .filter-search {
    flex: 1 1 100%;
  }

  .filters-bar-directory {
    flex-wrap: nowrap;
  }

  .filters-bar-directory .filter-search {
    flex: 1 1 auto;
    min-width: 0;
    width: 100%;
  }

  .filters-bar-invoice,
  .filters-bar-products:not(.filters-bar-directory) {
    flex-wrap: wrap;
    row-gap: 0.4rem;
  }

  .filters-bar-invoice .filter-search,
  .filters-bar-products:not(.filters-bar-directory) .filter-search {
    flex: 1 1 100%;
  }

  .filters-bar-invoice .date-range,
  .filters-bar-invoice .stock-toggle,
  .filters-bar-invoice .filter-actions,
  .filters-bar-products .date-range,
  .filters-bar-products .product-date-filters,
  .filters-bar-products .stock-toggle,
  .filters-bar-products .filter-actions {
    flex: 0 0 auto;
  }

  .stock-toggle {
    flex: 0 1 auto;
    max-width: 100%;
  }

  .stock-toggle__option {
    flex: 0 0 auto;
    padding: 0.15rem 0.45rem;
    min-height: 1.35rem;
    font-size: 0.65rem;
  }

  .dashboard-inbox-toolbar .stock-toggle {
    flex: 0 1 auto;
    max-width: 100%;
  }

  .dashboard-inbox-toolbar .stock-toggle__option {
    padding: 0.15rem 0.4rem;
    font-size: 0.65rem;
  }

  .dashboard-inbox-search {
    flex: 1 1 100%;
  }

  .filters-bar .filter-actions .btn-icon,
  .filters-bar .date-range-trigger--icon:not(.is-active) {
    width: 1.65rem;
    min-width: 1.65rem;
    max-width: 1.65rem;
    height: 1.65rem;
    min-height: 1.65rem;
  }
}

@media (max-width: 520px) {
  .filters-bar {
    grid-template-columns: 1fr;
  }
}

.date-range {
  position: relative;
  overflow: visible;
}

.date-range-trigger {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  width: 100%;
  height: var(--control-height);
  min-height: var(--control-height);
  padding: 0 0.65rem;
  border: 1px solid var(--input);
  border-radius: var(--radius);
  background: var(--control-bg);
  color: var(--foreground);
  font: inherit;
  font-size: var(--control-font-size);
  cursor: pointer;
  text-align: left;
  box-shadow: none;
}

.date-range-trigger:hover {
  border-color: var(--border);
}

.date-range-trigger:focus-visible {
  outline: 2px solid var(--ring);
  outline-offset: 1px;
  border-color: var(--ring);
}

.date-range-trigger .icon {
  width: 1rem;
  height: 1rem;
  color: var(--muted-foreground);
  flex-shrink: 0;
}

.date-range-trigger .value {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.date-range-trigger .value.is-placeholder {
  color: var(--muted-foreground);
}

.date-range-panel {
  position: absolute;
  z-index: 40;
  top: calc(100% + 0.35rem);
  left: 0;
  min-width: 17.5rem;
  padding: 0.75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--card);
  box-shadow: var(--shadow-dropdown);
}

.date-range-panel[hidden] {
  display: none;
}

.date-range-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.65rem;
}

.date-range-nav .month-label {
  font-size: 0.875rem;
  font-weight: 600;
}

.date-range-hint {
  margin: 0 0 0.5rem;
  font-size: 0.75rem;
  color: var(--muted-foreground);
}

.date-range-weekdays,
.date-range-days {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 0.15rem;
}

.date-range-weekdays span {
  text-align: center;
  font-size: 0.7rem;
  color: var(--muted-foreground);
  padding: 0.2rem 0;
}

.date-range-days button {
  height: 1.85rem;
  border: none;
  border-radius: var(--radius);
  background: transparent;
  color: var(--foreground);
  font: inherit;
  font-size: 0.8rem;
  cursor: pointer;
  padding: 0;
}

.date-range-days button:hover:not(:disabled) {
  background: var(--muted);
}

.date-range-days button:disabled {
  color: transparent;
  cursor: default;
}

.date-range-days button.in-range {
  background: rgba(24, 24, 27, 0.06);
  border-radius: 0;
}

.date-range-days button.range-start,
.date-range-days button.range-end,
.date-range-days button.selected {
  background: var(--primary);
  color: var(--primary-foreground);
  border-radius: var(--radius);
}

.date-range-days button.range-start.range-end {
  border-radius: var(--radius);
}

.date-range-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.4rem;
  margin-top: 0.65rem;
  padding-top: 0.55rem;
  border-top: 1px solid var(--border);
}

.field-row-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}

.btn-sm {
  height: 1.5rem;
  padding: 0 0.45rem;
  font-size: 0.7rem;
}

.visually-hidden {
  position: absolute !important;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ——— Smartphone / small screens ——— */
@media (max-width: 860px) {
  :root {
    --mobile-bottom-nav-height: 3.75rem;
    --mobile-sidebar-inset: 1.15rem;
  }

  /* Slightly denser rem base — locked; ignore system text size */
  :root {
    --font-size-root: 15px;
    --font-size-body: 13px;
    --icon-size: 13px;
    --icon-size-sm: 11px;
    --control-height: 1.7rem;
    --control-font-size: 0.7rem;
  }

  html {
    font-size: var(--font-size-root) !important;
    -webkit-text-size-adjust: none !important;
    text-size-adjust: none !important;
  }

  body {
    font-size: var(--font-size-body) !important;
    line-height: 1.45;
  }

  body.nav-locked {
    overflow: hidden;
  }

  .app-shell {
    grid-template-columns: 1fr;
    grid-template-rows: auto 1fr;
  }

  .mobile-topbar {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    position: relative;
    z-index: 30;
    height: 3.25rem;
    padding: 0 0.75rem;
    padding-top: env(safe-area-inset-top, 0);
    background: var(--sidebar-bg);
    border-bottom: 1px solid var(--border);
  }

  .mobile-brand {
    flex: 1;
    min-width: 0;
    font-weight: 600;
    font-size: 0.95rem;
    letter-spacing: -0.02em;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .mobile-account-toggle {
    margin-left: auto;
  }

  .desktop-only {
    display: none !important;
  }

  .icon-btn.mobile-nav-close {
    display: inline-flex;
  }

  /* Invoice create lives in the bottom nav Sell control on mobile. */
  .page-header__actions--desktop-create {
    display: none !important;
  }

  /* Mobile drawer: icon + org name, username stacked under org. */
  .sidebar-identity {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    grid-template-rows: auto auto;
    column-gap: 0.45rem;
    row-gap: 0.08rem;
    align-items: center;
  }

  .sidebar-identity .brand {
    display: contents;
    padding: 0;
  }

  .sidebar-identity .brand__icon {
    grid-column: 1;
    grid-row: 1;
  }

  .sidebar-identity .brand__text {
    grid-column: 2;
    grid-row: 1;
  }

  .sidebar-identity .brand__product,
  .sidebar-identity .brand__sep {
    display: none;
  }

  .sidebar-identity .brand__org {
    color: var(--foreground);
    font-weight: 600;
  }

  .sidebar-identity__user {
    display: inline-flex;
    align-items: center;
    gap: 0.28rem;
    grid-column: 2;
    grid-row: 2;
    min-width: 0;
    font-size: 0.72rem;
    font-weight: 500;
    line-height: 1.15;
    color: var(--muted-foreground);
  }

  .sidebar-identity__user-icon {
    flex: 0 0 auto;
    width: 0.85rem;
    height: 0.85rem;
    color: var(--muted-foreground);
  }

  .sidebar-identity__user .name {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: var(--muted-foreground);
    font-weight: 500;
  }

  .sidebar-identity__user .role-crown {
    flex: 0 0 auto;
    width: 0.85rem;
    height: 0.85rem;
  }

  .sidebar-identity__user .badge {
    font-size: 0.62rem;
    height: 1.05rem;
    padding: 0 0.35rem;
  }

  .sidebar-account .sidebar-user {
    display: none;
  }

  .sidebar-mobile-extra {
    display: flex;
  }

  .sidebar-backdrop {
    display: block;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    right: auto;
    z-index: 40;
    width: max(100vw, var(--app-min-width));
    min-width: var(--app-min-width);
    background: rgba(24, 24, 27, 0.35);
  }

  .sidebar-backdrop[hidden] {
    display: none;
  }

  /* Account / org drawer — inset sheet (Chrome-style), not edge-to-edge */
  .sidebar {
    position: fixed;
    top: max(0.65rem, env(safe-area-inset-top, 0px));
    right: var(--mobile-sidebar-inset);
    left: auto;
    bottom: max(0.65rem, env(safe-area-inset-bottom, 0px));
    z-index: 50;
    width: min(18rem, calc(100vw - (var(--mobile-sidebar-inset) * 2) - 2.5rem));
    min-width: 15rem;
    height: auto;
    max-height: none;
    padding-top: 1rem;
    padding-bottom: 1rem;
    border: 1px solid var(--border);
    border-radius: 1rem;
    transform: translateX(calc(100% + var(--mobile-sidebar-inset) + 0.5rem));
    transition: transform 0.22s ease;
    box-shadow: none;
    overflow-x: hidden;
    overflow-y: auto;
  }

  .app-shell.nav-open .sidebar {
    transform: translateX(0);
    box-shadow: -10px 8px 36px rgba(0, 0, 0, 0.16);
  }

  .sidebar-primary-nav {
    display: none;
  }

  .sidebar-footer {
    margin-top: auto;
  }

  .mobile-bottom-nav {
    display: flex;
    align-items: stretch;
    justify-content: space-around;
    gap: 0.35rem;
    position: fixed;
    left: 0;
    right: auto;
    bottom: 0;
    z-index: 35;
    width: max(100vw, var(--app-min-width));
    min-width: var(--app-min-width);
    height: calc(var(--mobile-bottom-nav-height) + env(safe-area-inset-bottom, 0px));
    padding: 0.35rem 0.4rem calc(0.35rem + env(safe-area-inset-bottom, 0px));
    background: var(--sidebar-bg);
    border-top: 1px solid var(--border);
    box-shadow: 0 -8px 24px rgba(15, 23, 42, 0.06);
    transform: translateY(0);
    transition: transform 0.22s ease;
    box-sizing: border-box;
  }

  .mobile-bottom-nav.is-collapsed {
    transform: translateY(100%);
    pointer-events: none;
  }

  .mobile-bottom-nav a,
  .mobile-bottom-nav__sell {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.2rem;
    min-width: 0;
    padding: 0.25rem 0.2rem;
    border-radius: var(--radius);
    color: var(--muted-foreground);
    text-decoration: none;
    font-size: 0.65rem;
    font-weight: 500;
    line-height: 1.15;
    text-align: center;
    background: transparent;
    border: none;
    font-family: inherit;
    cursor: pointer;
    -webkit-appearance: none;
    appearance: none;
  }

  .mobile-bottom-nav a .icon {
    width: 1.2rem;
    height: 1.2rem;
  }

  .mobile-bottom-nav__label {
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .mobile-bottom-nav a:hover {
    color: var(--foreground);
    background: var(--muted);
    text-decoration: none;
  }

  .mobile-bottom-nav a.is-active {
    color: #ffffff;
    background: #0a0a0a;
    text-decoration: none;
  }

  .mobile-bottom-nav a.is-active .icon {
    color: #ffffff;
  }

  /* Beat `.mobile-bottom-nav a { flex: 1 }` so the Sell control never stretches. */
  .mobile-bottom-nav a.mobile-bottom-nav__sell,
  .mobile-bottom-nav button.mobile-bottom-nav__sell,
  .mobile-bottom-nav__sell {
    position: relative;
    z-index: 1;
    flex: 0 0 4.25rem;
    flex-grow: 0;
    flex-shrink: 0;
    width: 4.25rem;
    min-width: 4.25rem;
    max-width: 4.25rem;
    margin-top: -1.15rem;
    padding: 0 0.2rem;
    padding-top: 0;
    gap: 0.15rem;
    border: none;
    background: transparent;
    box-shadow: none;
    color: var(--foreground);
    font: inherit;
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
  }

  .mobile-bottom-nav__sell-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 3.1rem;
    width: 3.1rem;
    height: 3.1rem;
    min-width: 3.1rem;
    min-height: 3.1rem;
    max-width: 3.1rem;
    max-height: 3.1rem;
    aspect-ratio: 1 / 1;
    border-radius: 999px;
    background: var(--primary);
    color: var(--primary-foreground);
    box-shadow: 0 8px 20px rgba(15, 23, 42, 0.22);
    border: 3px solid var(--sidebar-bg);
    box-sizing: border-box;
  }

  .mobile-bottom-nav__sell-icon .icon,
  .mobile-bottom-nav a.mobile-bottom-nav__sell .mobile-bottom-nav__sell-icon .icon {
    width: 1.35rem;
    height: 1.35rem;
  }

  .mobile-bottom-nav__sell:hover .mobile-bottom-nav__sell-icon,
  .mobile-bottom-nav__sell:focus-visible .mobile-bottom-nav__sell-icon {
    background: var(--accent);
  }

  .mobile-bottom-nav__sell:focus-visible {
    outline: none;
  }

  .mobile-bottom-nav__sell .mobile-bottom-nav__label {
    color: var(--foreground);
    font-weight: 600;
  }

  .main {
    padding: 1rem 0.85rem;
    padding-bottom: calc(1.25rem + var(--mobile-bottom-nav-height) + env(safe-area-inset-bottom, 0px));
    max-width: none;
  }

  .billing-topbar {
    padding: calc(0.85rem + env(safe-area-inset-top, 0)) 0.85rem 0.85rem;
    flex-direction: row;
    align-items: center;
  }

  .billing-topbar__brand {
    flex: 1;
  }

  .billing-nav {
    justify-content: flex-end;
    flex-wrap: nowrap;
  }

  .billing-nav a {
    width: 2.5rem;
    min-width: 2.5rem;
    height: 2.5rem;
    min-height: 2.5rem;
    padding: 0;
  }

  .billing-nav-label {
    display: none;
  }

  .billing-main {
    padding: 1rem 0.85rem 2.5rem;
    padding-bottom: calc(2.5rem + env(safe-area-inset-bottom, 0));
  }

  .page-header {
    margin-bottom: 1rem;
    gap: 0.75rem;
    flex-wrap: nowrap;
    align-items: center;
  }

  .page-header h1 {
    font-size: 1.1rem;
  }

  .page-header p,
  .card-desc {
    font-size: 0.8rem;
  }

  .card-title {
    font-size: 0.95rem;
  }

  .form-field label {
    font-size: 0.8rem;
  }

  .form-field .help,
  .help {
    font-size: 0.72rem;
  }

  .page-header .row,
  .page-header > .btn,
  .page-header > a.btn,
  .page-header__actions {
    width: auto;
    flex: 0 0 auto;
  }

  .page-header .row .btn,
  .page-header > a.btn,
  .page-header__actions .btn {
    flex: 0 0 auto;
    min-width: 0;
    width: auto;
  }

  .page-header .row .btn.btn-icon,
  .page-header__actions .btn-icon,
  .page-header__actions .btn-tool {
    flex: 0 0 1.65rem;
    width: 1.65rem;
    min-width: 1.65rem;
    max-width: 1.65rem;
    height: 1.65rem;
    padding: 0;
  }

  .btn-split__caret {
    width: 1.35rem;
    min-width: 1.35rem;
    max-width: 1.35rem;
  }

  .page-header--inline-actions {
    flex-wrap: nowrap;
    align-items: center;
  }

  .page-header--inline-actions > div:first-child {
    min-width: 0;
    flex: 1 1 auto;
  }

  .page-header--inline-actions > .btn,
  .page-header--inline-actions > a.btn {
    width: auto;
    flex: 0 0 auto;
  }

  .card {
    padding: 1rem;
  }

  .card.export-history-section {
    padding: 0;
  }

  .card.settings-collapsible {
    padding: 0;
  }

  .card.settings-section--compact {
    padding: 0.55rem 0.85rem;
  }

  .settings-collapsible__summary {
    padding: 0.5rem 0.85rem;
  }

  .stats {
    grid-template-columns: 1fr 1fr;
  }

  .billing-doc-list {
    display: grid;
    gap: 0.75rem;
  }

  .billing-doc-list + .table-wrap {
    display: none;
  }

  .filters-bar {
    grid-template-columns: 1fr;
  }

  .filters-bar-products {
    display: flex;
  }

  .filters-bar .row {
    width: 100%;
  }

  .filters-bar .row .btn {
    flex: 1;
  }

  .filters-bar-products .filter-actions .btn,
  .filters-bar-invoice .filter-actions .btn {
    flex: 0 0 auto;
  }

  .filters-bar .filter-actions .btn-icon,
  .filters-bar .date-range-trigger--icon:not(.is-active) {
    width: 1.65rem;
    min-width: 1.65rem;
    max-width: 1.65rem;
    height: 1.65rem;
    min-height: 1.65rem;
    padding: 0;
    border-color: transparent;
    background: transparent;
    box-shadow: none;
  }

  .filters-bar .date-range-trigger--icon.is-active {
    height: 1.65rem;
    min-height: 1.65rem;
  }

  .table-wrap,
  .table-wrap-share-links {
    -webkit-overflow-scrolling: touch;
    margin-left: -0.15rem;
    margin-right: -0.15rem;
    /* Keep swipe scroll; never reserve/show a horizontal scrollbar that covers rows. */
    scrollbar-width: none;
    -ms-overflow-style: none;
  }

  .table-wrap::-webkit-scrollbar,
  .table-wrap-share-links::-webkit-scrollbar {
    display: none;
    width: 0;
    height: 0;
  }

  table.data {
    min-width: 36rem;
    font-size: 0.8rem;
  }

  table.data th,
  table.data td {
    padding: 0.95rem 0.75rem;
    white-space: nowrap;
    line-height: 1.35;
  }

  table.data th.col-actions,
  table.data td.col-actions {
    padding-top: 0.7rem;
    padding-bottom: 0.7rem;
  }

  .btn {
    height: 1.7rem;
    min-height: 1.7rem;
    padding: 0 0.55rem;
    gap: 0.25rem;
    font-size: 0.7rem;
    font-weight: 550;
  }

  .btn .icon {
    width: 0.8rem;
    height: 0.8rem;
  }

  .btn-icon,
  .btn-tool {
    width: 1.7rem;
    min-width: 1.7rem;
    max-width: 1.7rem;
    height: 1.7rem;
    min-height: 1.7rem;
  }

  .btn-sm {
    height: 1.4rem;
    min-height: 1.4rem;
    padding: 0 0.4rem;
    font-size: 0.65rem;
  }

  .btn-lg,
  .public-intake__actions .btn-lg,
  .public-pdp__cta .btn-lg {
    height: 2.15rem;
    min-height: 2.15rem;
    font-size: 0.85rem;
  }

  .icon-btn,
  .mobile-nav-toggle {
    width: 2.15rem;
    height: 2.15rem;
  }

  .icon-btn-sm {
    width: 1.75rem;
    height: 1.75rem;
    min-width: 1.75rem;
  }

  .input,
  .select,
  input[type="text"],
  input[type="email"],
  input[type="password"],
  input[type="number"],
  input[type="date"],
  input[type="datetime-local"],
  input[type="url"],
  input[type="search"],
  input[type="file"],
  select,
  .ms-trigger,
  .dd-trigger,
  .date-range-trigger,
  .date-range-trigger--icon,
  .date-range-trigger--icon.is-active,
  .filters-bar-analytics .filter-period .dd-trigger {
    height: var(--control-height);
    min-height: var(--control-height);
    font-size: var(--control-font-size);
  }

  .textarea,
  textarea {
    min-height: 4.5rem;
    height: auto;
    font-size: 0.75rem;
  }

  .input::placeholder,
  input::placeholder,
  textarea::placeholder {
    font-size: 0.75rem;
  }

  .select:not([multiple]),
  select:not([multiple]) {
    font-size: 0.75rem;
  }

  .period-tabs .btn,
  .supplier-combo__option,
  .address-fields__locate,
  .settings-text-link {
    font-size: 0.75rem;
  }

  .stock-toggle__option {
    font-size: 0.65rem;
  }

  .filters-bar-products .filter-actions .btn,
  .filters-bar-invoice .filter-actions .btn {
    flex: 0 0 auto;
  }

  .pagination-row__size .dd-dropdown--page-size .dd-trigger {
    min-height: 0;
    height: auto;
    font-size: inherit;
    font-weight: 400;
    padding: 0;
    border: none;
    background: transparent;
    box-shadow: none;
  }

  .sidebar-nav-label,
  .mobile-bottom-nav__label,
  label,
  .stat-label,
  .card-desc,
  .field label {
    -webkit-text-size-adjust: none !important;
    text-size-adjust: none !important;
  }

  .org-switch .dd-dropdown--org {
    max-width: 100%;
    width: 100%;
  }

  .modal {
    width: calc(100vw - 1.5rem);
    max-width: none;
    max-height: calc(100dvh - 1.25rem);
    margin: auto;
    overflow: hidden;
  }

  .card > .form-actions-bar,
  .card.stack > .form-actions-bar {
    margin-left: -1rem;
    margin-right: -1rem;
    margin-bottom: -1rem;
    padding: 0.85rem 1rem;
  }

  .form-actions-bar {
    bottom: calc(var(--mobile-bottom-nav-height) + env(safe-area-inset-bottom, 0px));
  }

  .date-range-panel {
    /* Parent is only ~2.1rem wide (icon trigger); don't bind panel width to it */
    position: fixed;
    top: 50%;
    left: 50%;
    right: auto;
    transform: translate(-50%, -50%);
    width: min(19rem, calc(100vw - 1.5rem));
    min-width: min(17.5rem, calc(100vw - 1.5rem));
    max-height: calc(100dvh - 2rem);
    overflow-y: auto;
    z-index: 70;
  }

  .date-range-days button {
    height: 2rem;
    font-size: 0.75rem;
  }

  .pagination-row .row {
    width: 100%;
  }

  .pagination-row .row .btn {
    flex: 1;
  }

  .field-grid {
    grid-template-columns: 1fr !important;
  }

  .auth-shell {
    padding: 1rem;
    padding-bottom: calc(1rem + env(safe-area-inset-bottom, 0));
  }

  .auth-card {
    width: 100%;
  }

  .toast-region {
    right: max(0.75rem, env(safe-area-inset-right, 0px));
    bottom: calc(var(--mobile-bottom-nav-height) + env(safe-area-inset-bottom, 0px) + 0.75rem);
    width: min(22.5rem, calc(100vw - 1.5rem));
  }

  .toast {
    font-size: 0.8125rem;
  }
}

@media (max-width: 420px) {
  :root {
    --font-size-root: 14px;
    --font-size-body: 12px;
    --icon-size: 12px;
    --icon-size-sm: 10px;
    --control-height: 1.6rem;
    --control-font-size: 0.68rem;
  }

  html {
    font-size: var(--font-size-root) !important;
  }

  body {
    font-size: var(--font-size-body) !important;
  }

  .stats {
    grid-template-columns: 1fr;
  }

  .page-header h1 {
    font-size: 1.05rem;
  }

  .btn {
    height: 1.6rem;
    min-height: 1.6rem;
    padding: 0 0.5rem;
    font-size: 0.68rem;
  }

  .btn-icon,
  .btn-tool {
    width: 1.6rem;
    min-width: 1.6rem;
    max-width: 1.6rem;
    height: 1.6rem;
    min-height: 1.6rem;
  }

  .btn-split__caret {
    width: 1.25rem;
    min-width: 1.25rem;
    max-width: 1.25rem;
  }

  .input,
  .select,
  input[type="text"],
  input[type="email"],
  input[type="password"],
  input[type="number"],
  input[type="date"],
  input[type="datetime-local"],
  input[type="url"],
  input[type="search"],
  input[type="file"],
  select,
  .ms-trigger,
  .dd-trigger,
  .date-range-trigger,
  .date-range-trigger--icon,
  .date-range-trigger--icon.is-active,
  .filters-bar-analytics .filter-period .dd-trigger {
    height: var(--control-height);
    min-height: var(--control-height);
    font-size: var(--control-font-size);
  }

  .billing-topbar__brand {
    min-width: 0;
  }
}

@media print {
  @page {
    margin: 12mm;
  }

  html,
  body {
    background: #fff !important;
    color: #000 !important;
  }

  .billing-topbar,
  .billing-nav,
  .app-shell > .sidebar,
  .app-shell > .mobile-topbar,
  .app-shell > .mobile-bottom-nav,
  .sidebar-backdrop,
  .toast-region,
  .page-loading,
  .no-print {
    display: none !important;
  }

  .billing-shell,
  .billing-main,
  .main,
  .app-shell {
    display: block !important;
    padding: 0 !important;
    margin: 0 !important;
    max-width: none !important;
    min-height: 0 !important;
    background: #fff !important;
  }

  .invoice-sheet-wrap {
    margin: 0 !important;
  }

  .invoice-sheet,
  .invoice-sheet .card {
    border: none !important;
    box-shadow: none !important;
    background: #fff !important;
  }

  .invoice-sheet {
    padding: 0 !important;
  }

  table.data {
    min-width: 0 !important;
  }
}

.product-detail-toolbar {
  display: flex;
  justify-content: flex-start;
  margin: 0 0 1rem;
}

.product-detail-toolbar .stock-toggle {
  flex: 0 0 auto;
  width: auto;
  max-width: 100%;
}

.product-detail-toolbar .stock-toggle__option {
  flex: 0 0 auto;
}

.product-detail-subtitle {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 0.75rem;
  margin: 0.35rem 0 0;
}

.badge-stock {
  font-size: 0.75rem;
  font-weight: 600;
  height: auto;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  border: 1px solid transparent;
  text-transform: none;
}

.badge-stock--in {
  background: #ecfdf5;
  color: #047857;
  border-color: #a7f3d0;
}

.badge-stock--out {
  background: #fef2f2;
  color: #b91c1c;
  border-color: #fecaca;
}

.product-detail-panel[hidden] {
  display: none !important;
}

.product-detail-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr);
  gap: 1rem;
  align-items: start;
}

.product-detail-layout--no-media {
  grid-template-columns: 1fr;
}

.product-detail-media.card {
  padding: 0.85rem;
}

.product-detail-facts .card-title {
  margin-bottom: 0.85rem;
}

.product-carousel {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.product-carousel__stage {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 16rem;
  aspect-ratio: 4 / 3;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--muted);
  overflow: hidden;
}

.product-carousel__slide {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.product-carousel__slide[hidden] {
  display: none !important;
}

.product-carousel__slide img,
.product-carousel__slide video {
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  object-fit: contain;
  display: block;
}

.product-carousel__file {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  max-width: 80%;
  padding: 0.85rem 1rem;
  border-radius: var(--radius);
  border: 1px dashed var(--border);
  background: var(--card);
  color: var(--foreground);
  text-align: center;
  word-break: break-word;
}

.product-carousel__fullscreen {
  position: absolute;
  top: 0.65rem;
  right: 0.65rem;
  z-index: 2;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.25rem;
  height: 2.25rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: color-mix(in srgb, var(--card) 92%, transparent);
  color: var(--foreground);
  cursor: pointer;
  box-shadow: var(--shadow-sm);
}

.product-carousel__fullscreen:hover {
  background: var(--card);
}

.product-carousel__nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 2;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.25rem;
  height: 2.25rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: color-mix(in srgb, var(--card) 92%, transparent);
  color: var(--foreground);
  cursor: pointer;
  box-shadow: var(--shadow-sm);
}

.product-carousel__nav:hover {
  background: var(--card);
}

.product-carousel__nav--prev {
  left: 0.65rem;
}

.product-carousel__nav--next {
  right: 0.65rem;
}

.product-carousel__meta {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0 0.15rem;
  font-size: 0.875rem;
}

.product-lightbox {
  width: 100vw;
  max-width: 100vw;
  height: 100vh;
  max-height: 100vh;
  margin: 0;
  padding: 0;
  border: none;
  border-radius: 0;
  background: #0a0a0a;
  color: #fafafa;
}

.product-lightbox::backdrop {
  background: #000;
}

.product-lightbox__bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.85rem 1rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
}

.product-lightbox__bar .muted {
  margin-left: 0.5rem;
  color: rgba(255, 255, 255, 0.65);
}

.product-lightbox__bar .modal__close {
  color: #fafafa;
  border: none;
  background: transparent;
}

.product-lightbox__bar .modal__close:hover {
  background: rgba(255, 255, 255, 0.1);
}

.product-lightbox__stage {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  height: calc(100vh - 3.5rem);
  padding: 1.25rem 4rem;
  box-sizing: border-box;
}

.product-lightbox__stage img,
.product-lightbox__stage video {
  max-width: min(100%, 1200px);
  max-height: 100%;
  width: auto;
  height: auto;
  object-fit: contain;
}

.product-lightbox__stage .product-carousel__nav {
  background: rgba(24, 24, 27, 0.85);
  border-color: rgba(255, 255, 255, 0.18);
  color: #fafafa;
}

.product-lightbox__stage .product-carousel__nav--prev {
  left: 1rem;
}

.product-lightbox__stage .product-carousel__nav--next {
  right: 1rem;
}

.detail-list {
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 0;
}

.detail-list__row {
  display: grid;
  grid-template-columns: minmax(7rem, 38%) 1fr;
  gap: 0.75rem 1rem;
  padding: 0.7rem 0;
  border-top: 1px solid var(--border);
}

.detail-list__row:first-child {
  border-top: none;
  padding-top: 0;
}

.detail-list__row:last-child {
  padding-bottom: 0;
}

.detail-list__row dt {
  margin: 0;
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--muted-foreground);
}

.detail-list__row dd {
  margin: 0;
  font-size: 0.925rem;
  color: var(--foreground);
  word-break: break-word;
}

.detail-list__value {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.55rem;
}

.detail-list__text {
  flex: 1 1 auto;
  min-width: 0;
}

.detail-list__edit {
  flex: 0 0 auto;
  width: 1.75rem;
  min-width: 1.75rem;
  height: 1.75rem;
  margin: -0.15rem 0 0;
  border: none;
  background: transparent;
  box-shadow: none;
  color: var(--muted-foreground);
}

.detail-list__edit:hover {
  border: none;
  background: transparent;
  color: var(--foreground);
}

.detail-list__edit .icon {
  width: 0.9rem;
  height: 0.9rem;
}

.product-field-edit-modal {
  width: min(100%, 420px);
}

.product-field-edit-form__actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 1rem;
}

@media (max-width: 860px) {
  .product-detail-layout {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 520px) {
  .detail-list__row {
    grid-template-columns: 1fr;
    gap: 0.2rem;
  }

  .detail-list__value {
    align-items: center;
  }

  .detail-list__edit {
    margin-top: 0;
  }

  .product-lightbox__stage {
    padding: 1rem 3rem;
  }
}




.legal-page {
  max-width: 42rem;
  margin: 0 auto;
  padding: 2rem 1.25rem 3rem;
}

.legal-page__header {
  margin-bottom: 1.75rem;
}

.legal-page__brand {
  margin: 0 0 0.75rem;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.95rem;
}

.legal-page__brand a {
  color: inherit;
  text-decoration: none;
  display: inline-flex;
}

.legal-page__brand .brand {
  padding: 0;
  font-size: inherit;
  font-weight: inherit;
}

.legal-page__header h1 {
  margin: 0 0 0.35rem;
  font-size: 1.75rem;
  line-height: 1.2;
}

.legal-page__meta {
  margin: 0;
  font-size: 0.85rem;
}

.legal-page__body {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  font-size: 0.95rem;
  line-height: 1.55;
}

.legal-page__body h2 {
  margin: 1.1rem 0 0;
  font-size: 1.05rem;
}

.legal-page__body p,
.legal-page__body ul {
  margin: 0;
}

.legal-page__body ul {
  padding-left: 1.2rem;
}

.legal-page__body li + li {
  margin-top: 0.35rem;
}

.legal-page__body a {
  color: inherit;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.legal-page__footer {
  margin-top: 2.5rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
  font-size: 0.85rem;
}

.legal-page__footer a {
  color: var(--muted-foreground);
}

.legal-consent {
  margin: 0.35rem 0 0.75rem;
}

.legal-consent__row {
  align-items: flex-start;
}

.legal-consent__text {
  font-size: 0.875rem;
  line-height: 1.45;
  color: var(--foreground);
}

.legal-consent__text a {
  color: inherit;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.legal-consent.has-error .legal-consent__row {
  outline: 1px solid color-mix(in srgb, var(--destructive, #b91c1c) 55%, transparent);
  outline-offset: 4px;
  border-radius: var(--radius);
}

/* —— Shell soft-nav skeletons (HTMX primary tabs) —— */
.shell-skeleton {
  padding-bottom: 1rem;
}

.shell-skeleton__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.25rem;
}

.shell-skeleton__card {
  margin-bottom: 1rem;
}

.shell-skeleton__filters {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
}

.skel {
  display: block;
  border-radius: calc(var(--radius) - 2px);
  background: linear-gradient(
    90deg,
    color-mix(in srgb, var(--border) 70%, var(--card)) 0%,
    color-mix(in srgb, var(--border) 35%, var(--card)) 45%,
    color-mix(in srgb, var(--border) 70%, var(--card)) 100%
  );
  background-size: 200% 100%;
  animation: shell-skel-shimmer 1.15s ease-in-out infinite;
}

.skel--title {
  height: 1.75rem;
  width: 9rem;
}

.skel--btn {
  height: 2.25rem;
  width: 6.5rem;
  border-radius: var(--radius);
}

.skel--input {
  height: 2.5rem;
  flex: 1 1 12rem;
  min-width: 10rem;
  border-radius: var(--radius);
}

.skel--chip {
  height: 2.25rem;
  width: 5.5rem;
  border-radius: var(--radius);
}

.skel--line {
  height: 0.85rem;
}

.skel--w-24 { width: 24%; }
.skel--w-32 { width: 32%; }
.skel--w-40 { width: 40%; }

.skel--chart {
  height: 11rem;
  width: 100%;
  border-radius: var(--radius);
}

.skel--row {
  height: 3rem;
  width: 100%;
  margin-top: 0.65rem;
  border-radius: var(--radius);
}

.skel--row:first-child {
  margin-top: 0;
}

#app-main.is-shell-loading {
  min-height: 60vh;
}

@keyframes shell-skel-shimmer {
  0% { background-position: 100% 0; }
  100% { background-position: -100% 0; }
}

@media (prefers-reduced-motion: reduce) {
  .skel {
    animation: none;
  }
}
