/* Orbita UI — stylesheet consolidato */

/* 1. Design tokens */
:root {
  --color-bg: #f7f8fa;
  --color-surface: #ffffff;
  --color-surface-soft: #f8fafc;
  --color-surface-muted: #f1f4f7;
  --color-text: #182230;
  --color-text-soft: #344054;
  --color-muted: #667085;
  --color-subtle: #7c8798;
  --color-placeholder: #98a2b3;
  --color-white: #ffffff;
  --color-surface-hover: #eef2f6;
  --color-divider-soft: #edf0f4;
  --color-text-emphasis: #253247;
  --color-ink: #101828;
  --color-chart-success: #18794e;
  --color-chart-warning: #c87500;
  --color-border: #e3e7ed;
  --color-border-strong: #d2d9e3;
  --color-primary: #172033;
  --color-primary-hover: #172033;
  --color-success: #067647;
  --color-success-bg: #edfdf4;
  --color-success-border: #b7ebcd;
  --color-warning: #a15c00;
  --color-warning-bg: #fff8eb;
  --color-warning-border: #f6d99c;
  --color-danger: #b42318;
  --color-danger-bg: #fff3f1;
  --color-danger-border: #f4c7c3;
  --color-focus: rgba(23, 32, 51, 0.11);
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 20px;
  --space-6: 24px;
  --space-8: 32px;
  --radius-sm: 8px;
  --radius-md: 10px;
  --radius-lg: 15px;
  --radius-xl: 18px;
  --radius-pill: 999px;
  --shadow-soft: 0 1px 2px rgba(16, 24, 40, 0.035), 0 7px 20px rgba(16, 24, 40, 0.025);
  --shadow-card: var(--shadow-soft);
  --shadow-overlay: 0 22px 60px rgba(15, 23, 42, 0.18);
  --topbar-height: 62px;
  --bottom-nav-height: 66px;
  --content-max: 1440px;
  --control-height: 40px;
  --page-gap: 15px;
  --card-padding: 16px;
  --card-padding-mobile: 12px;
  --scrollbar-inset: 6px;
  --workspace-gap: 14px;
  --transition-fast: 150ms ease;
  --list-title-size: 16.5px;
  --list-description-size: 15.25px;
  --list-meta-size: 14px;
  --list-value-size: 16px;
}

/* 2. Reset and base */
*,
*::before,
*::after {
  box-sizing: border-box;
}

[hidden],
.hidden {
  display: none !important;
}

html {
  width: 100%;
  height: 100%;
  overflow: hidden;
  scroll-behavior: smooth;
}

body {
  width: 100%;
  height: 100%;
  min-height: 100%;
  margin: 0;
  overflow: hidden;
  background: var(--color-bg);
  color: var(--color-text);
  font-family: "Segoe UI Variable Text", "Segoe UI Variable", "Segoe UI", -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
  font-size: 14px;
  font-weight: 400;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

a {
  color: inherit;
  text-decoration: none;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  color: inherit;
}

img,
svg {
  max-width: 100%;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

::selection {
  background: #dbe4ef;
  color: var(--color-text);
}

/* 3. Application shell */
.app-frame {
  width: 100%;
  height: 100dvh;
  min-height: 0;
  overflow: hidden;
}

/* Intro PWA: componente isolato, mostrato una sola volta per sessione applicativa. */
.app-intro {
  position: fixed;
  inset: 0;
  z-index: 2000;
  display: none;
  place-items: center;
  overflow: hidden;
  background: var(--color-white);
  color: var(--color-primary);
  isolation: isolate;
}

.orbita-intro-pending .app-intro {
  display: grid;
}

.orbita-intro-pending .app-frame {
  opacity: 0;
}

.orbita-intro-pending.orbita-intro-leaving .app-frame {
  opacity: 1;
  transition: opacity 260ms ease;
}

.app-intro::before,
.app-intro::after,
.app-intro-ambient {
  position: absolute;
  content: "";
  pointer-events: none;
}

.app-intro::before {
  width: min(780px, 110vw);
  aspect-ratio: 1;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(23, 32, 51, 0.07) 0, rgba(23, 32, 51, 0.02) 28%, transparent 66%);
  animation: app-intro-breathe 900ms ease-in-out both;
}

.app-intro::after {
  inset: -35%;
  background:
    radial-gradient(circle at 35% 38%, rgba(23, 32, 51, 0.08) 0 1px, transparent 2px),
    radial-gradient(circle at 66% 31%, rgba(23, 32, 51, 0.07) 0 1px, transparent 2px),
    radial-gradient(circle at 72% 67%, rgba(23, 32, 51, 0.06) 0 1px, transparent 2px),
    radial-gradient(circle at 29% 72%, rgba(23, 32, 51, 0.06) 0 1px, transparent 2px);
  background-size: 118px 118px, 151px 151px, 177px 177px, 203px 203px;
  opacity: 0;
  animation: app-intro-stars 850ms 40ms ease-out both;
}

.app-intro-ambient {
  width: 420px;
  height: 420px;
  border: 1px solid rgba(23, 32, 51, 0.055);
  border-radius: 50%;
  box-shadow:
    0 0 0 48px rgba(23, 32, 51, 0.025),
    0 0 0 96px rgba(23, 32, 51, 0.016);
  opacity: 0;
  animation: app-intro-ambient-in 820ms 20ms cubic-bezier(0.16, 1, 0.3, 1) both;
}

.app-intro-stage {
  position: relative;
  width: 280px;
  height: 330px;
}

.app-intro-orbit {
  position: absolute;
  left: 50%;
  top: 126px;
  border: 1px solid rgba(23, 32, 51, 0.18);
  border-radius: 50%;
  opacity: 0;
  transform-origin: center;
}

.app-intro-orbit i {
  position: absolute;
  top: 50%;
  right: -4px;
  width: 8px;
  height: 8px;
  margin-top: -4px;
  border-radius: 50%;
  background: var(--color-primary);
  box-shadow: 0 0 14px rgba(23, 32, 51, 0.28);
}

.app-intro-orbit-outer {
  width: 246px;
  height: 112px;
  margin: -56px 0 0 -123px;
  animation: app-intro-orbit-outer 820ms 20ms cubic-bezier(0.16, 1, 0.3, 1) both;
}

.app-intro-orbit-middle {
  width: 208px;
  height: 96px;
  margin: -48px 0 0 -104px;
  border-color: rgba(23, 32, 51, 0.12);
  animation: app-intro-orbit-middle 760ms 60ms cubic-bezier(0.16, 1, 0.3, 1) both;
}

.app-intro-orbit-middle i {
  right: auto;
  left: -3px;
  width: 6px;
  height: 6px;
  margin-top: -3px;
  opacity: 0.72;
}

.app-intro-orbit-inner {
  width: 170px;
  height: 78px;
  margin: -39px 0 0 -85px;
  border-color: rgba(23, 32, 51, 0.09);
  animation: app-intro-orbit-inner 700ms 100ms cubic-bezier(0.16, 1, 0.3, 1) both;
}

.app-intro-orbit-inner i {
  width: 5px;
  height: 5px;
  margin-top: -2.5px;
  opacity: 0.48;
}

.app-intro-mark {
  position: absolute;
  top: 76px;
  left: 90px;
  z-index: 3;
  display: grid;
  place-items: center;
  width: 100px;
  height: 100px;
  padding: 22px;
  border: 1px solid rgba(23, 32, 51, 0.06);
  border-radius: 28px;
  background: var(--color-primary);
  box-shadow:
    0 20px 48px rgba(23, 32, 51, 0.22),
    0 0 0 8px rgba(23, 32, 51, 0.025),
    inset 0 1px 0 rgba(255, 255, 255, 0.1);
  opacity: 0;
  animation: app-intro-mark-in 600ms 80ms cubic-bezier(0.16, 1, 0.3, 1) both;
}

.app-intro-mark::after {
  position: absolute;
  inset: -18px;
  border: 1px solid rgba(23, 32, 51, 0.12);
  border-radius: 38px;
  content: "";
  opacity: 0;
  animation: app-intro-pulse 650ms 420ms ease-out both;
}

.app-intro-mark img {
  display: block;
  width: 100%;
  height: 100%;
  filter: brightness(0) invert(1);
  animation: app-intro-logo-float 900ms 560ms ease-in-out infinite;
}

.app-intro-title {
  position: absolute;
  top: 222px;
  left: 0;
  width: 100%;
  color: var(--color-primary);
  font-size: 25px;
  font-weight: 700;
  letter-spacing: 0.18em;
  line-height: 1;
  text-align: center;
  text-indent: 0.18em;
  opacity: 0;
  animation: app-intro-title-in 420ms 400ms cubic-bezier(0.16, 1, 0.3, 1) both;
}

.app-intro-progress {
  position: absolute;
  top: 276px;
  left: 80px;
  width: 120px;
  height: 2px;
  overflow: hidden;
  border-radius: var(--radius-pill);
  background: rgba(23, 32, 51, 0.09);
  opacity: 0;
  animation: app-intro-progress-in 180ms 540ms ease-out both;
}

.app-intro-progress i {
  display: block;
  width: 100%;
  height: 100%;
  border-radius: inherit;
  background: var(--color-primary);
  transform: translateX(-100%);
  animation: app-intro-progress-run 430ms 570ms cubic-bezier(0.65, 0, 0.35, 1) both;
}

.app-intro-particle {
  position: absolute;
  z-index: 2;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: rgba(23, 32, 51, 0.72);
  box-shadow: 0 0 10px rgba(23, 32, 51, 0.2);
  opacity: 0;
}

.app-intro-particle-one {
  top: 52px;
  left: 48px;
  animation: app-intro-particle 600ms 170ms ease-out both;
}

.app-intro-particle-two {
  top: 74px;
  right: 40px;
  animation: app-intro-particle 650ms 220ms ease-out both;
}

.app-intro-particle-three {
  top: 174px;
  left: 33px;
  animation: app-intro-particle 620ms 260ms ease-out both;
}

.app-intro-particle-four {
  top: 188px;
  right: 47px;
  animation: app-intro-particle 580ms 300ms ease-out both;
}

.app-intro.is-leaving {
  animation: app-intro-out 260ms cubic-bezier(0.4, 0, 1, 1) both;
}

.app-intro.is-leaving .app-intro-stage {
  animation: app-intro-stage-out 260ms cubic-bezier(0.4, 0, 1, 1) both;
}

@keyframes app-intro-breathe {
  0% { opacity: 0; transform: scale(0.55); }
  55% { opacity: 1; transform: scale(1); }
  100% { opacity: 0.68; transform: scale(1.08); }
}

@keyframes app-intro-stars {
  from { opacity: 0; transform: rotate(-4deg) scale(0.92); }
  to { opacity: 1; transform: rotate(0) scale(1); }
}

@keyframes app-intro-ambient-in {
  from { opacity: 0; transform: scale(0.55); }
  to { opacity: 1; transform: scale(1); }
}

@keyframes app-intro-orbit-outer {
  0% { opacity: 0; transform: rotate(-70deg) scale(0.55); }
  55% { opacity: 1; }
  100% { opacity: 1; transform: rotate(24deg) scale(1); }
}

@keyframes app-intro-orbit-middle {
  0% { opacity: 0; transform: rotate(105deg) scale(0.5); }
  55% { opacity: 0.9; }
  100% { opacity: 1; transform: rotate(-22deg) scale(1); }
}

@keyframes app-intro-orbit-inner {
  0% { opacity: 0; transform: rotate(-125deg) scale(0.46); }
  60% { opacity: 0.75; }
  100% { opacity: 1; transform: rotate(52deg) scale(1); }
}

@keyframes app-intro-mark-in {
  0% { opacity: 0; transform: translateY(18px) scale(0.34) rotate(-14deg); }
  58% { opacity: 1; transform: translateY(-3px) scale(1.06) rotate(2deg); }
  100% { opacity: 1; transform: translateY(0) scale(1) rotate(0); }
}

@keyframes app-intro-pulse {
  0% { opacity: 0.8; transform: scale(0.78); }
  100% { opacity: 0; transform: scale(1.42); }
}

@keyframes app-intro-logo-float {
  0%, 100% { transform: translateY(0) rotate(0); }
  50% { transform: translateY(-2px) rotate(1.5deg); }
}

@keyframes app-intro-title-in {
  from { opacity: 0; transform: translateY(10px); letter-spacing: 0.34em; }
  to { opacity: 1; transform: translateY(0); letter-spacing: 0.18em; }
}

@keyframes app-intro-progress-in {
  from { opacity: 0; transform: scaleX(0.7); }
  to { opacity: 1; transform: scaleX(1); }
}

@keyframes app-intro-progress-run {
  from { transform: translateX(-100%); }
  to { transform: translateX(0); }
}

@keyframes app-intro-particle {
  0% { opacity: 0; transform: translateY(18px) scale(0.4); }
  45% { opacity: 1; }
  100% { opacity: 0.22; transform: translateY(-10px) scale(1); }
}

@keyframes app-intro-out {
  from { opacity: 1; }
  to { opacity: 0; visibility: hidden; }
}

@keyframes app-intro-stage-out {
  from { opacity: 1; transform: scale(1); filter: blur(0); }
  to { opacity: 0; transform: scale(1.08); filter: blur(5px); }
}

.topbar {
  position: fixed;
  inset: 0 0 auto;
  z-index: 300;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 18px;
  height: var(--topbar-height);
  padding: 0 18px;
  border-bottom: 1px solid var(--color-border);
  background: rgba(255, 255, 255, 0.98);
  box-shadow: 0 1px 0 rgba(15, 23, 42, 0.02);
  backdrop-filter: blur(14px);
}

.brand,
.login-brand-row {
  display: flex;
  align-items: center;
  min-width: 0;
}

.brand {
  gap: 10px;
}

.brand-mark {
  display: grid;
  place-items: center;
  flex: 0 0 34px;
  width: 34px;
  height: 34px;
  overflow: hidden;
  padding: 6px;
  border-radius: var(--radius-md);
  background: var(--color-primary);
  color: var(--color-white);
}

.brand-mark img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  filter: brightness(0) invert(1);
}

.brand-name,
.brand-text {
  overflow: hidden;
  color: var(--color-text);
  font-weight: 700;
  letter-spacing: -0.015em;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.top-nav {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 0;
  gap: var(--space-1);
  overflow: visible;
  scrollbar-width: none;
}

.top-nav::-webkit-scrollbar {
  display: none;
}

.top-nav a {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 38px;
  padding: 0 11px;
  border: 1px solid transparent;
  border-radius: var(--radius-md);
  color: #526176;
  font-size: 13.5px;
  font-weight: 600;
  white-space: nowrap;
}

.top-nav a.active {
  border-color: rgba(15, 23, 42, 0.055);
  background: var(--color-surface-hover);
  color: var(--color-primary);
}

.nav-icon {
  display: inline-grid;
  place-items: center;
  flex: 0 0 18px;
  width: 18px;
  height: 18px;
  color: currentColor;
}

.nav-icon svg,
.logout-link svg,
.mobile-settings-link svg {
  width: 100%;
  height: 100%;
  fill: currentColor;
}

.nav-badge {
  position: absolute;
  top: 0;
  right: 0;
  z-index: 2;
  display: grid;
  place-items: center;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: var(--radius-pill);
  background: var(--color-primary);
  box-shadow: 0 0 0 2px var(--color-white);
  color: var(--color-white);
  font-size: 10px;
  font-style: normal;
  line-height: 1;
}

.top-user {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: var(--space-2);
}

.user-name,
.logout-link,
.mobile-settings-link {
  height: 36px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-surface);
  color: var(--color-text-soft);
}

.user-name {
  display: inline-flex;
  align-items: center;
  max-width: 170px;
  overflow: hidden;
  padding: 0 10px;
  background: var(--color-surface-soft);
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.logout-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 0 10px;
  font-weight: 600;
}

.logout-link svg {
  width: 18px;
  height: 18px;
}

.mobile-settings-link {
  display: none;
  place-items: center;
  width: 36px;
  padding: 0;
}

.mobile-settings-link .nav-icon {
  width: 18px;
  height: 18px;
}

.app-main {
  display: flex;
  width: 100%;
  height: 100dvh;
  min-height: 0;
  overflow: hidden;
  flex-direction: column;
  padding: calc(var(--topbar-height) + 14px) 18px 18px;
}

body.is-page-loading::before {
  content: "";
  position: fixed;
  inset: 0 0 auto;
  z-index: 1000;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--color-primary), transparent);
  animation: loading-line 900ms ease-in-out infinite;
}

@keyframes loading-line {
  from { transform: translateX(-55%); }
  to { transform: translateX(55%); }
}

@media (prefers-reduced-motion: reduce) {
  html.orbita-intro-pending .app-intro {
    display: none;
  }

  .orbita-intro-pending .app-frame {
    opacity: 1;
  }
}

/* 4. Page structure */
.page-head {
  flex: 0 0 auto;
  margin-bottom: var(--page-gap);
  padding: 0 2px;
}

.page-head-sticky {
  position: relative;
  top: auto;
  z-index: auto;
  padding: 0 2px;
  border-bottom: 0;
  background: transparent;
  backdrop-filter: none;
}

.page-head h1 {
  margin-bottom: 5px;
  color: var(--color-ink);
  font-size: clamp(25px, 2.2vw, 29px);
  font-weight: 700;
  line-height: 1.15;
  letter-spacing: -0.025em;
}

.page-head p,
.pane-note {
  color: var(--color-muted);
}

.page-head p {
  margin-bottom: 0;
  color: var(--color-muted);
  font-size: 14px;
  line-height: 1.45;
}

.page-head.row,
.panel-title-row,
.form-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
}

.split-page,
.quote-layout {
  display: grid;
  align-items: stretch;
  gap: var(--workspace-gap);
  height: 100%;
  min-height: 0;
  overflow: hidden;
}

.split-page {
  grid-template-columns: minmax(300px, 350px) minmax(0, 1fr);
}

.split-page-wide {
  grid-template-columns: minmax(340px, 400px) minmax(0, 1fr);
}

.quote-layout {
  grid-template-columns: minmax(330px, 430px) minmax(0, 1fr);
  gap: 18px;
}



.page-workspace {
  flex: 1 1 auto;
  width: 100%;
  min-width: 0;
  min-height: 0;
}

.page-scroll {
  overflow: auto;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
}

.workspace-fixed {
  overflow: hidden;
}

.card-stack {
  display: flex;
  min-height: 0;
  flex-direction: column;
}

.scroll-panel {
  height: 100%;
  overflow: hidden;
}

.scroll-panel > :where(.section-heading, .toolbar, .bulk-bar, .card-actions) {
  flex: 0 0 auto;
}

.scroll-region {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
}

.card-scroll-region {
  min-width: 0;
  min-height: 0;
  overflow: auto;
  overscroll-behavior: contain;
  margin-right: var(--scrollbar-inset);
  padding-right: var(--space-2);
  padding-bottom: var(--space-2);
  scrollbar-gutter: stable;
  scrollbar-width: thin;
  scrollbar-color: #c5cedb transparent;
}

.card-grid,
.panel-grid,
.overview-grid {
  display: grid;
  gap: var(--workspace-gap);
}

.full-content {
  width: 100%;
  max-width: none;
}

/* 5. Surfaces */
.card,
.form-pane,
.content-pane,
.panel,
.toolbar,
.bulk-bar,
.login-card,
.install-card {
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  background: var(--color-surface);
  box-shadow: var(--shadow-soft);
}

.form-pane {
  position: relative;
  top: auto;
  height: 100%;
  min-height: 0;
  max-height: none;
  overflow: auto;
  padding: var(--card-padding);
  scrollbar-gutter: stable;
}

.card,
.content-pane,
.panel {
  min-width: 0;
  padding: var(--card-padding);
}

.content-pane {
  display: flex;
  height: 100%;
  min-height: 0;
  overflow: hidden;
  flex-direction: column;
}

.card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-3);
  flex: 0 0 auto;
  margin-bottom: 14px;
  padding-bottom: 13px;
  border-bottom: 1px solid var(--color-divider-soft);
}

.card-title {
  margin: 0;
  color: var(--color-text);
  font-size: 17px;
  font-weight: 700;
  line-height: 1.25;
  letter-spacing: -0.015em;
}

.card-subtitle {
  margin: 4px 0 0;
  color: var(--color-muted);
  font-size: var(--list-meta-size);
  line-height: 1.45;
}

.card-body {
  min-width: 0;
  min-height: 0;
}

.card-actions {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  flex-wrap: wrap;
  flex: 0 0 auto;
  margin-top: var(--space-3);
  padding-top: var(--space-3);
  border-top: 1px solid var(--color-border);
}

.card-link {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 0 10px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  background: var(--color-surface-soft);
  color: var(--color-text-soft);
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}

.form-pane h2,
.panel h2,
.card > h2,
.content-pane > h2,
.quote-summary-card h2,
.quote-tax-card h2 {
  margin-bottom: 13px;
  color: var(--color-text);
  font-size: 17px;
  font-weight: 700;
  line-height: 1.25;
  letter-spacing: -0.015em;
}

.form-pane > h2::after,
.panel > h2::after,
.card > h2::after,
.content-pane > h2::after,
.quote-summary-card > h2::after,
.quote-tax-card > h2::after {
  content: "";
  display: block;
  height: 1px;
  margin-top: var(--space-3);
  background: var(--color-border);
}

.form-title-row h2,
.panel-title-row h2 {
  margin: 0;
}

.pane-note {
  margin-bottom: 14px;
  font-size: 13px;
  line-height: 1.45;
}

.panel-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.panel.wide {
  grid-column: 1 / -1;
}

/* 6. Form controls */
:where(input:not([type="checkbox"]):not([type="radio"]):not([type="hidden"]), select, textarea, .input) {
  width: 100%;
  min-height: var(--control-height);
  border: 1px solid var(--color-border-strong);
  border-radius: 9px;
  outline: none;
  background: var(--color-surface);
  color: var(--color-text);
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast), background var(--transition-fast);
}

:where(input:not([type="checkbox"]):not([type="radio"]):not([type="hidden"]), textarea, .input) {
  padding: 8px 10px;
}

select {
  padding: 8px 34px 8px 10px;
}

textarea {
  min-height: 88px;
  resize: vertical;
}

:where(input:not([type="checkbox"]):not([type="radio"]):not([type="hidden"]), select, textarea, .input):focus {
  border-color: var(--color-placeholder);
  background: var(--color-white);
  box-shadow: 0 0 0 3px var(--color-focus);
}

:where(input, select, textarea):disabled {
  cursor: not-allowed;
  background: var(--color-surface-muted);
  color: var(--color-muted);
  opacity: 0.8;
}

input[readonly] {
  background: var(--color-surface-soft);
  color: var(--color-muted);
}

input::placeholder,
textarea::placeholder {
  color: var(--color-placeholder);
}

input[type="checkbox"],
input[type="radio"] {
  flex: 0 0 auto;
  accent-color: var(--color-primary);
}

label {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 6px;
  color: var(--color-text-soft);
  font-size: 12.5px;
  font-weight: 600;
  line-height: 1.35;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.form-grid .full,
.full {
  grid-column: 1 / -1;
}

.form-actions,
.modal-actions,
.bulk-actions {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  flex-wrap: wrap;
}

.form-actions {
  grid-column: 1 / -1;
  margin-top: 2px;
  padding-top: var(--space-3);
  border-top: 1px solid var(--color-border);
}

.form-actions .primary {
  min-width: 92px;
}

.modal-actions {
  justify-content: flex-end;
}

.mobile-form-close {
  display: none;
  place-items: center;
  width: 40px;
  height: 40px;
  padding: 0;
  border: 0;
  border-radius: 12px;
  background: var(--color-surface-hover);
  color: var(--color-text);
  font-size: 25px;
  line-height: 1;
  cursor: pointer;
}

/* 7. Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 38px;
  padding: 8px 12px;
  border: 1px solid transparent;
  border-radius: 9px;
  background: var(--color-surface-hover);
  color: var(--color-text);
  font-weight: 700;
  line-height: 1.2;
  cursor: pointer;
}.btn:focus-visible {
  outline: 3px solid var(--color-focus);
  outline-offset: 2px;
}

.btn:disabled,
.btn.is-loading {
  cursor: not-allowed;
  opacity: 0.65;
}

.btn.primary {
  border-color: var(--color-primary);
  background: var(--color-primary);
  color: var(--color-white);
}

.btn.ghost {
  border-color: var(--color-border-strong);
  background: var(--color-white);
}

.btn.danger {
  border-color: var(--color-danger);
  background: var(--color-danger);
  color: var(--color-white);
}

.btn.danger-soft {
  border-color: var(--color-danger-border);
  background: #fff7f6;
  color: var(--color-danger);
}

.btn.full {
  width: 100%;
}

.btn.small {
  min-height: 34px;
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  font-size: 12.5px;
}

.icon-btn {
  width: 36px;
  min-width: 36px;
  height: 36px;
  min-height: 36px;
  padding: 0;
}

.icon-btn svg {
  width: 18px;
  height: 18px;
}

.btn-clicking:not(:disabled) {
  filter: brightness(0.94);
}

.btn-spinner {
  display: inline-block;
  width: 14px;
  height: 14px;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: var(--radius-pill);
  animation: button-spin 650ms linear infinite;
}

@keyframes button-spin {
  to { transform: rotate(360deg); }
}

/* 8. Toolbars and filters */
.toolbar {
  position: relative;
  display: flex;
  align-items: center;
  gap: var(--space-2);
  flex-wrap: wrap;
  margin-bottom: var(--space-3);
  padding: 10px;
}

.toolbar-sticky,
.filter-toolbar {
  position: sticky;
  top: 0;
  z-index: 90;
  background: var(--color-surface);
}

.filter-toolbar.filters-open {
  z-index: 280;
}

.filter-toolbar {
  display: block;
  overflow: visible;
}

.filter-toolbar-row {
  display: grid;
  align-items: center;
  gap: var(--space-2);
  min-width: 0;
}

.filter-toolbar--search-3 .filter-toolbar-row {
  grid-template-columns: minmax(280px, 1fr) repeat(3, minmax(140px, 180px)) auto;
}

.filter-toolbar--search-2 .filter-toolbar-row {
  grid-template-columns: minmax(280px, 1fr) repeat(2, minmax(150px, 190px)) auto;
}

.filter-toolbar--search-1 .filter-toolbar-row {
  grid-template-columns: minmax(280px, 1fr) minmax(150px, 190px) auto;
}

.filter-toolbar--search-only .filter-toolbar-row {
  grid-template-columns: minmax(0, 1fr) auto;
}

.filter-toolbar--equal-3 .filter-toolbar-row {
  grid-template-columns: repeat(3, minmax(160px, 1fr)) auto;
}

.filter-toolbar-row :where(.toolbar-search, .toolbar-search-wrap, .input-search, select, .btn) {
  width: 100%;
  min-width: 0;
}

.toolbar-search,
.toolbar .input,
.input-search {
  min-width: 0;
}

.toolbar select {
  min-width: 0;
}

.filter-popover {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 200;
  display: grid;
  grid-template-columns: repeat(2, minmax(150px, 1fr));
  gap: var(--space-2);
  width: min(520px, calc(100vw - 48px));
  max-height: min(440px, calc(100dvh - 180px));
  overflow: auto;
  padding: 10px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  background: var(--color-white);
  box-shadow: var(--shadow-overlay);
  scrollbar-width: thin;
  scrollbar-color: #c5cedb transparent;
}

.filter-popover[hidden] {
  display: none;
}

.filter-popover :where(select, .btn) {
  width: 100%;
}

.mobile-only {
  display: none;
}

/* 9. Lists and rows */
.data-list {
  display: flex;
  min-width: 0;
  min-height: 0;
  overflow: auto;
  flex: 1 1 auto;
  flex-direction: column;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  background: var(--color-white);
}

.data-list:empty::before {
  content: "Nessun elemento.";
  display: block;
  padding: 14px;
  color: var(--color-muted);
}

.list-row {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr) auto;
  align-items: center;
  gap: var(--space-3);
  min-height: 58px;
  padding: 11px 13px;
  border-bottom: 1px solid var(--color-border);
  background: var(--color-white);
  cursor: pointer;
}

.list-row:last-child {
  border-bottom: 0;
}

.row-title {
  color: var(--color-text-emphasis);
  font-size: var(--list-title-size);
  font-weight: 700;
  line-height: 1.35;
}

.row-desc {
  margin-top: 2px;
  color: var(--color-text-soft);
  font-size: var(--list-description-size);
  font-weight: 550;
}

.row-meta {
  display: flex;
  align-items: center;
  gap: 4px 8px;
  flex-wrap: wrap;
  margin-top: 4px;
  color: var(--color-muted);
  font-size: var(--list-meta-size);
}

.row-meta span:not(:last-child)::after {
  content: "·";
  margin-left: 8px;
  color: #b0b7c3;
}

.row-check {
  width: 17px;
  height: 17px;
  margin: 0;
}

.badges {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 5px;
  flex-wrap: wrap;
}

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  padding: 3px 7px;
  border: 1px solid transparent;
  border-radius: 7px;
  background: var(--color-divider-soft);
  color: #334155;
  font-size: 10.5px;
  font-weight: 600;
  line-height: 1.15;
  white-space: nowrap;
}

.badge.ok {
  border-color: var(--color-success-border);
  background: var(--color-success-bg);
  color: var(--color-success);
}

.badge.warn {
  border-color: var(--color-warning-border);
  background: var(--color-warning-bg);
  color: var(--color-warning);
}

.badge.danger {
  border-color: var(--color-danger-border);
  background: var(--color-danger-bg);
  color: var(--color-danger);
}

.badge.dark {
  border-color: #d9e1ea;
  background: var(--color-surface-hover);
  color: #263445;
}

.mini-row {
  min-width: 0;
  padding: 9px 10px;
  border: 1px solid #e8edf3;
  border-radius: var(--radius-md);
  background: var(--color-white);
}

.mini-row b {
  display: block;
  color: var(--color-text-soft);
  font-size: 13.5px;
}

.mini-row span,
.mini-row small {
  color: var(--color-muted);
  font-size: 12.5px;
}

/* Shared summaries and compact information rows */
.summary-card {
  display: flex;
  min-width: 0;
  min-height: 0;
  flex-direction: column;
}

.summary-highlight {
  padding: 2px 0 var(--space-5);
}

.summary-label,
.summary-stat-label {
  display: block;
  color: var(--color-muted);
  font-size: 12.5px;
  font-weight: 600;
  line-height: 1.35;
}

.summary-value {
  display: block;
  margin-top: 6px;
  color: var(--color-text);
  font-size: clamp(31px, 3vw, 39px);
  font-weight: 700;
  line-height: 1.08;
  letter-spacing: -0.035em;
  font-variant-numeric: tabular-nums;
}

.summary-meta,
.summary-stat-meta {
  display: block;
  margin-top: 7px;
  color: var(--color-muted);
  font-size: 12px;
  line-height: 1.35;
}

.summary-stat-grid {
  display: grid;
  min-width: 0;
  gap: var(--space-3);
}

.summary-stat-grid-2 {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.summary-stat {
  min-width: 0;
  padding: 13px 14px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-surface-soft);
}

.summary-stat-value {
  display: block;
  margin-top: 6px;
  color: var(--color-text);
  font-size: clamp(20px, 2vw, 24px);
  font-weight: 700;
  line-height: 1.12;
  letter-spacing: -0.025em;
  font-variant-numeric: tabular-nums;
}

.summary-stat-warning {
  border-color: var(--color-warning-border);
  background: var(--color-warning-bg);
}

.summary-stat-warning .summary-stat-value {
  color: var(--color-warning);
}

.card.summary-stat {
  padding: var(--card-padding);
  background: var(--color-surface);
}

.card.summary-stat-warning {
  background: var(--color-warning-bg);
}

.insight-list {
  display: flex;
  min-width: 0;
  min-height: 0;
  flex-direction: column;
}

.insight-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: var(--space-4);
  min-width: 0;
  padding: 12px 2px;
  border-bottom: 1px solid var(--color-divider-soft);
}

.insight-row:first-child {
  padding-top: 2px;
}

.insight-row:last-child {
  padding-bottom: 2px;
  border-bottom: 0;
}

.insight-row.is-warning {
  border-bottom-color: #f6e5c8;
}

.insight-row-main,
.insight-row-side {
  min-width: 0;
}

.insight-row-title {
  display: block;
  overflow: hidden;
  color: var(--color-text-emphasis);
  font-size: 13.5px;
  font-weight: 600;
  line-height: 1.4;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.insight-row-title span {
  color: var(--color-placeholder);
  font-weight: 500;
}

.insight-row-meta {
  display: flex;
  align-items: center;
  gap: 4px 8px;
  flex-wrap: wrap;
  margin-top: 5px;
  color: var(--color-muted);
  font-size: 12.25px;
  line-height: 1.4;
}

.insight-row-meta span:not(:last-child)::after {
  content: "·";
  margin-left: 8px;
  color: #b0b7c3;
}

.insight-row-side {
  display: grid;
  justify-items: end;
  gap: 5px;
  text-align: right;
}

.insight-row-value {
  color: var(--color-text);
  font-size: var(--list-value-size);
  font-weight: 720;
  line-height: 1.25;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.insight-row-value.warning {
  color: var(--color-warning);
}

.date-chip {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 9px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-pill);
  background: var(--color-surface-soft);
  color: var(--color-text-soft);
  font-size: 11.5px;
  font-weight: 600;
  white-space: nowrap;
}

.date-chip.danger {
  border-color: var(--color-danger-border);
  background: var(--color-danger-bg);
  color: var(--color-danger);
}

.status-text {
  color: var(--color-muted);
  font-size: 11px;
  font-weight: 600;
}

.status-text.warning {
  color: var(--color-warning);
}

.status-text.danger {
  color: var(--color-danger);
}

.empty-state {
  display: grid;
  place-items: center;
  min-height: 92px;
  padding: var(--space-4);
  border: 1px dashed var(--color-border-strong);
  border-radius: var(--radius-md);
  background: var(--color-surface-soft);
  color: var(--color-muted);
  font-size: 13px;
  text-align: center;
}



.system-status-dot {
  width: 9px;
  height: 9px;
  margin-top: 4px;
  border-radius: 50%;
  background: var(--color-placeholder);
  box-shadow: 0 0 0 3px rgba(152, 162, 179, 0.14);
}

.system-status-copy strong,
.system-status-copy small {
  display: block;
}

.system-status-copy strong {
  color: var(--color-text-soft);
  font-size: 12.5px;
  font-weight: 700;
}

.system-status-copy small {
  margin-top: 3px;
  color: var(--color-muted);
  font-size: 11.5px;
  line-height: 1.35;
}

.system-status.success {
  border-color: var(--color-success-border);
  background: var(--color-success-bg);
}

.system-status.success .system-status-dot {
  background: var(--color-success);
  box-shadow: 0 0 0 3px rgba(6, 118, 71, 0.12);
}

.system-status.danger {
  border-color: var(--color-danger-border);
  background: var(--color-danger-bg);
}

.system-status.danger .system-status-dot {
  background: var(--color-danger);
  box-shadow: 0 0 0 3px rgba(180, 35, 24, 0.12);
}

.panel-scroll,
.fic-log-scroll,
.job-activity-list,
.settings-cat-list,
.data-list,
.page-scroll,
.form-pane,
.quote-output-pane {
  scrollbar-width: thin;
  scrollbar-color: #c5cedb transparent;
}

/* 10. Bulk actions */
.bulk-bar {
  position: relative;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
  min-height: 48px;
  margin-bottom: var(--space-3);
  padding: 8px 10px;
}

.bulk-select {
  display: inline-flex;
  align-items: center;
  flex-direction: row;
  gap: 9px;
  cursor: pointer;
}

.bulk-select span {
  display: grid;
  gap: 1px;
}

.bulk-select b {
  color: var(--color-text-soft);
  font-size: 13.5px;
}

.bulk-select small {
  color: var(--color-muted);
  font-size: 11.5px;
  font-weight: 500;
}

.bulk-paid-btn {
  border-color: #bfe8d1;
  background: #e8f7ef;
  color: #05603a;
}

/* Shared visual primitives */
.flat-icon {
  display: inline-grid;
  place-items: center;
  flex: 0 0 auto;
  width: 22px;
  height: 22px;
  color: currentColor;
}

.flat-icon svg {
  width: 100%;
  height: 100%;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.flat-icon-sm {
  width: 17px;
  height: 17px;
}

.flat-icon-outline {
  width: 34px;
  height: 34px;
  padding: 7px;
  border: 1px solid var(--color-border);
  border-radius: 10px;
  background: var(--color-surface-soft);
  color: #41526b;
}

.flat-icon-blue,
.flat-icon-green,
.flat-icon-warning {
  width: 34px;
  height: 34px;
  padding: 7px;
  border: 1px solid;
  border-radius: 10px;
}

.flat-icon-blue {
  border-color: #c9dcff;
  background: #edf4ff;
  color: #3578e5;
}

.flat-icon-green {
  border-color: #b9ecd0;
  background: #eafaf1;
  color: #138653;
}

.flat-icon-warning {
  border-color: #f6d99c;
  background: #fff7e7;
  color: #c87500;
}

.context-chip,
.context-select,
.button-soft,
.status-chip,
.state-label {
  display: inline-flex;
  align-items: center;
  white-space: nowrap;
}

.context-chip,
.context-select {
  gap: 7px;
  min-height: 38px;
  padding: 0 12px;
  border: 1px solid var(--color-border);
  border-radius: 11px;
  background: var(--color-surface);
  color: var(--color-text-soft);
  font-size: 12.5px;
  font-weight: 650;
  box-shadow: 0 1px 2px rgba(16, 24, 40, 0.025);
}

.context-select {
  flex: 0 0 auto;
  flex-direction: row;
  flex-wrap: nowrap;
}

.context-select .flat-icon {
  width: 17px;
  height: 17px;
}

.context-select select {
  flex: 0 0 auto;
  width: auto;
  min-width: 92px;
  min-height: 36px;
  padding: 0 24px 0 0;
  border: 0;
  background-color: transparent;
  color: inherit;
  font: inherit;
  box-shadow: none;
}

.button-soft {
  justify-content: center;
  min-height: 34px;
  padding: 0 12px;
  border: 1px solid var(--color-border);
  border-radius: 10px;
  background: var(--color-surface);
  color: var(--color-text-soft);
  font-size: 12px;
  font-weight: 650;
}

.button-compact {
  min-height: 32px;
  padding-inline: 11px;
}

.section-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-3);
  flex: 0 0 auto;
  margin-bottom: 14px;
  padding-bottom: 13px;
  border-bottom: 1px solid var(--color-divider-soft);
}

.section-heading-main {
  display: flex;
  align-items: center;
  gap: 11px;
  min-width: 0;
}

.section-heading h2 {
  margin: 0;
  color: #162033;
  font-size: 16.5px;
  font-weight: 700;
  line-height: 1.25;
  letter-spacing: -0.02em;
}

.section-heading p {
  margin: 3px 0 0;
  color: #718096;
  font-size: 12.25px;
  line-height: 1.4;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--workspace-gap);
  min-width: 0;
}

.metric-card {
  position: relative;
  display: flex;
  min-width: 0;
  min-height: 205px;
  overflow: hidden;
  flex-direction: column;
  padding: 18px;
  border: 1px solid var(--color-border);
  border-radius: 17px;
  background: var(--color-surface);
  box-shadow: var(--shadow-soft);
}

.metric-card-icon {
  width: 43px;
  height: 43px;
  padding: 10px;
  border: 1px solid currentColor;
  border-radius: 50%;
}

.metric-card-copy {
  position: relative;
  z-index: 1;
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  margin-top: 18px;
}

.metric-card-label {
  color: #586780;
  font-size: 12.5px;
  font-weight: 650;
  line-height: 1.3;
}

.metric-card-value {
  margin-top: 6px;
  color: #111b2e;
  font-size: clamp(24px, 2.25vw, 31px);
  font-weight: 720;
  line-height: 1.08;
  letter-spacing: -0.035em;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.metric-card-comparison {
  display: inline-flex;
  align-items: center;
  align-self: flex-start;
  margin-top: auto;
  padding-top: 17px;
  color: #718096;
  font-size: 11.5px;
  font-weight: 650;
}

.metric-card-comparison-up { color: #12804c; }
.metric-card-comparison-down { color: #c24137; }
.metric-card-comparison-neutral { color: #7a8799; }


.metric-card-success .metric-card-icon {
  border-color: #b9ecd0;
  background: #eafaf1;
  color: #13a05f;
}


.metric-card-info .metric-card-icon {
  border-color: #c9dcff;
  background: #edf4ff;
  color: #3578e5;
}


.metric-card-warning .metric-card-icon {
  border-color: #f6d99c;
  background: #fff7e7;
  color: #df8700;
}


















.compact-list {
  display: flex;
  min-width: 0;
  min-height: 0;
  flex-direction: column;
}

.compact-list-row {
  display: grid;
  grid-template-columns: 36px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  flex: 0 0 auto;
  min-width: 0;
  min-height: 70px;
  padding: 11px 2px;
  border-bottom: 1px solid var(--color-divider-soft);
}

.compact-list-row:last-child {
  border-bottom: 0;
}

.compact-list-main {
  min-width: 0;
}

.entity-title {
  display: flex;
  align-items: baseline;
  gap: 6px;
  min-width: 0;
  overflow: hidden;
  white-space: nowrap;
}

.entity-title strong {
  flex: 0 0 auto;
  color: #122039;
  font-size: var(--list-title-size);
  font-weight: 720;
  letter-spacing: -0.012em;
}

.entity-title span {
  min-width: 0;
  overflow: hidden;
  color: #33435d;
  font-size: var(--list-description-size);
  font-weight: 560;
  text-overflow: ellipsis;
}

.entity-title span::before {
  content: "—";
  margin-right: 6px;
  color: #a4adbb;
  font-weight: 400;
}

.meta-line {
  display: flex;
  align-items: center;
  gap: 4px 7px;
  min-width: 0;
  margin-top: 5px;
  overflow: hidden;
  color: #77849a;
  font-size: var(--list-meta-size);
  line-height: 1.45;
  white-space: nowrap;
}

.meta-line span:not(:last-child)::after {
  content: "·";
  margin-left: 7px;
  color: #b6bfcb;
}

.compact-list-side {
  display: flex;
  align-items: flex-end;
  gap: 5px;
  flex-direction: column;
  min-width: 105px;
}

.compact-list-payment {
  min-width: 112px;
}

.row-leading-icon,
.avatar-badge {
  width: 34px;
  height: 34px;
  border-radius: 11px;
}

.row-leading-icon {
  padding: 8px;
}

.avatar-badge {
  display: grid;
  place-items: center;
  font-size: 11.5px;
  font-weight: 750;
  letter-spacing: -0.02em;
}

.row-leading-icon-lavender,
.avatar-badge-lavender {
  background: #f1edff;
  color: #6941c6;
}

.row-leading-icon-blue,
.avatar-badge-blue {
  background: #edf4ff;
  color: #2e6fd4;
}

.row-leading-icon-cyan,
.avatar-badge-cyan {
  background: #eaf9ff;
  color: #147a9c;
}

.row-leading-icon-green,
.avatar-badge-green {
  background: #eafaf1;
  color: #138a54;
}

.status-chip {
  justify-content: center;
  min-height: 26px;
  padding: 0 9px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-pill);
  background: var(--color-surface-soft);
  color: #4d5b70;
  font-size: 11.25px;
  font-weight: 700;
  line-height: 1;
}

.status-chip-info {
  border-color: #d5e4ff;
  background: #f1f6ff;
  color: #2563b8;
}

.status-chip-warning {
  border-color: #f3ddb4;
  background: #fff8eb;
  color: #a56004;
}

.status-chip-danger {
  border-color: #f3cbc7;
  background: #fff2f1;
  color: #c12f25;
}

.state-label {
  gap: 5px;
  color: #7b8798;
  font-size: 9.75px;
  font-weight: 650;
}

.state-label i {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}

.state-label-warning {
  color: #c97600;
}

.state-label-danger {
  color: #c52e24;
}

.money-value {
  color: #162033;
  font-size: var(--list-value-size);
  font-weight: 720;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.row-chevron {
  width: 16px;
  height: 16px;
  color: #92a0b3;
}

/* 11. Dashboard */
.dashboard-page-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-4);
}

.dashboard-page-head h1 {
  font-size: clamp(24px, 2vw, 29px);
}

.dashboard-page-head p {
  margin-top: 2px;
}

.dashboard-workspace {
  display: grid;
  align-content: start;
  gap: var(--workspace-gap);
  overflow: auto;
  padding-bottom: 2px;
}

.dashboard-content-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.55fr) minmax(340px, 0.85fr);
  gap: var(--workspace-gap);
  min-width: 0;
}

.dashboard-chart-card,
.dashboard-attention-card {
  min-height: 360px;
  overflow: hidden;
}

.dashboard-chart-legend {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  color: var(--color-muted);
  font-size: 11.5px;
  font-weight: 650;
}

.dashboard-chart-legend span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}

.dashboard-chart-key {
  width: 8px;
  height: 8px;
  border-radius: 3px;
}

.dashboard-chart-key-registered,
.dashboard-chart-bar-registered {
  background: #3578e5;
}

.dashboard-chart-key-paid,
.dashboard-chart-bar-paid {
  background: #13a05f;
}

.dashboard-chart-wrap {
  display: flex;
  flex: 1 1 auto;
  min-height: 0;
  padding-top: var(--space-4);
}

.dashboard-chart-wrap > .empty-state {
  width: 100%;
}

.dashboard-chart-grid {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  align-items: stretch;
  gap: 6px;
  width: 100%;
  min-height: 245px;
  padding: 12px 2px 0;
  border-bottom: 1px solid var(--color-border-strong);
  background: repeating-linear-gradient(
    to bottom,
    transparent 0,
    transparent calc(25% - 1px),
    var(--color-divider-soft) calc(25% - 1px),
    var(--color-divider-soft) 25%
  );
}

.dashboard-chart-month {
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  gap: 8px;
  min-width: 0;
  color: var(--color-muted);
  font-size: 10.5px;
  font-weight: 650;
  text-align: center;
}

.dashboard-chart-bars {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 4px;
  min-height: 0;
}

.dashboard-chart-bar {
  display: block;
  width: min(13px, 38%);
  border-radius: 5px 5px 2px 2px;
  transition: height var(--transition-fast);
}

.dashboard-tabs {
  display: flex;
  gap: 7px;
  padding: 13px 0 10px;
  border-bottom: 1px solid var(--color-divider-soft);
}

.dashboard-tabs .btn {
  flex: 1 1 0;
  min-width: 0;
  padding-inline: 7px;
  white-space: nowrap;
}

.dashboard-attention-list {
  flex: 1 1 auto;
  padding-top: 2px;
}

.dashboard-item-row {
  color: inherit;
  border-radius: var(--radius-sm);
  transition: background var(--transition-fast);
}

.dashboard-item-row:hover {
  background: var(--color-surface-soft);
}

.dashboard-item-side {
  display: flex;
  align-items: flex-end;
  gap: 6px;
  flex-direction: column;
}

/* 12. Jobs */
body[data-page="jobs"] #jobsToolbar {
  z-index: 140;
  flex-wrap: nowrap;
  overflow: visible;
}

body[data-page="jobs"] #jobsToolbar.filters-open {
  z-index: 260;
}

body[data-page="jobs"] #jobsMoreFilters {
  z-index: 320;
}

.jobs-workspace {
  grid-template-columns: minmax(330px, 390px) minmax(0, 1fr);
}

.jobs-form-card,
.jobs-list-card {
  padding: 16px;
}

.jobs-form-card {
  gap: 14px;
}

.jobs-form-loading {
  display: grid;
  place-items: center;
  flex: 1 1 auto;
  color: var(--color-muted);
  font-size: 13px;
}

.jobs-form-heading,
.jobs-list-heading {
  flex: 0 0 auto;
}

.jobs-form-grid {
  padding-top: 2px;
}

.jobs-list-card .toolbar {
  margin-top: 12px;
}

.jobs-data-list {
  border: 0;
  border-radius: 0;
  background: transparent;
}

.job-list-row {
  grid-template-columns: 24px 36px minmax(0, 1fr) auto;
  min-height: 72px;
  padding: 11px 4px;
  cursor: pointer;
}

.job-list-row .avatar-badge {
  width: 34px;
  height: 34px;
}

.job-main {
  min-width: 0;
}

.job-amount {
  font-size: 13.5px;
}

.job-status-line {
  display: flex;
  justify-content: flex-end;
  gap: 5px;
  flex-wrap: wrap;
}

.status-chip-success {
  border-color: #ccebd8;
  background: #effaf3;
  color: #138653;
}

.status-chip-neutral {
  border-color: #dde4ec;
  background: #f5f7fa;
  color: #5f6e83;
}

.job-meta span:not(:last-child)::after {
  content: "·";
  margin-left: 8px;
  color: #a9b3c1;
}

.job-notes {
  margin-top: 4px;
  overflow: hidden;
  color: var(--color-muted);
  font-size: 13.5px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.job-side {
  display: flex;
  min-width: 132px;
  flex-direction: column;
  align-items: flex-end;
  gap: 5px;
  text-align: right;
}

.job-side > strong {
  color: var(--color-text);
  font-size: var(--list-value-size);
  font-weight: 720;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.job-badges {
  margin-top: 0;
}

.jobs-filtered-total {
  display: flex;
  justify-content: flex-end;
  padding-top: 8px;
}

.jobs-total-inner {
  display: inline-flex;
  align-items: baseline;
  gap: 8px;
  min-width: 240px;
  padding: 9px 12px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-white);
}

.jobs-total-inner span,
.jobs-total-inner small {
  color: var(--color-muted);
}

.jobs-total-inner span {
  font-size: 12px;
  font-weight: 600;
}

.jobs-total-inner strong {
  margin-left: auto;
  color: var(--color-text);
  font-size: 16px;
  font-variant-numeric: tabular-nums;
}

.jobs-total-inner small {
  font-size: 11.5px;
}


.recurrence-series-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-surface-soft);
}

.recurrence-series-summary strong {
  color: var(--color-text);
  font-size: 13px;
}

.recurrence-series-summary span {
  color: var(--color-muted);
  font-size: 12.5px;
  text-align: right;
}

.job-activity-card {
  grid-column: 1 / -1;
  max-height: 154px;
  overflow: hidden;
  padding: 9px 10px;
  border: 1px solid var(--color-border);
  border-radius: 12px;
  background: var(--color-surface-soft);
}

.job-activity-card h3 {
  margin-bottom: 6px;
  font-size: 13px;
  line-height: 1.15;
}

.job-activity-list {
  display: flex;
  max-height: 108px;
  overflow-y: auto;
  flex-direction: column;
  gap: 4px;
  padding-right: 4px;
}

.job-activity-list > span {
  color: var(--color-muted);
  font-size: 12px;
}

.job-activity-row {
  display: grid;
  grid-template-columns: minmax(76px, 88px) minmax(0, 1fr);
  align-items: start;
  gap: 2px 8px;
  padding: 6px 8px;
  border: 1px solid var(--color-border);
  border-radius: 9px;
  background: var(--color-white);
}

.job-activity-row b {
  color: #172033;
  font-size: 12px;
  line-height: 1.15;
}

.job-activity-row span {
  overflow: hidden;
  color: var(--color-muted);
  font-size: 11.8px;
  line-height: 1.2;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.job-activity-row small {
  grid-column: 2;
  color: var(--color-placeholder);
  font-size: 11px;
  line-height: 1.15;
}

/* 13. Clients */
.clients-workspace {
  grid-template-columns: minmax(330px, 390px) minmax(0, 1fr);
}

.clients-form-card,
.clients-list-card {
  padding: 16px;
}

.clients-form-card {
  gap: 14px;
}

.clients-form-loading {
  display: grid;
  place-items: center;
  flex: 1 1 auto;
  color: var(--color-muted);
  font-size: 13px;
}

.clients-form-heading,
.clients-list-heading {
  flex: 0 0 auto;
}

.clients-form-grid {
  padding-top: 2px;
}

.clients-list-card .toolbar {
  margin-top: 12px;
}

.clients-toolbar {
  padding: 9px;
}

.toolbar-search-wrap {
  position: relative;
  display: flex;
  align-items: center;
  width: 100%;
}

.toolbar-search-wrap .flat-icon {
  position: absolute;
  left: 12px;
  z-index: 1;
  color: var(--color-muted);
  pointer-events: none;
}

.toolbar-search-wrap .input-search {
  padding-left: 38px;
}

.clients-count {
  min-height: 32px;
  padding-inline: 10px;
  font-size: 11.5px;
}

.clients-data-list {
  border: 0;
  border-radius: 0;
  background: transparent;
}

.client-list-row {
  grid-template-columns: 38px minmax(0, 1fr) auto;
  min-height: 68px;
  padding: 10px 4px;
  cursor: pointer;
}

.client-list-row .avatar-badge {
  width: 36px;
  height: 36px;
}

.client-main {
  min-width: 0;
}


.client-side {
  min-width: 112px;
  justify-content: center;
  text-align: right;
}

.client-total {
  color: var(--color-text);
  font-size: var(--list-value-size);
  font-weight: 720;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.client-total-label {
  color: var(--color-muted);
  font-size: 12.5px;
  font-weight: 600;
}

/* 14. Recurrences */
.recurrences-list {
  overflow-x: hidden;
  border-width: 1px 0 0;
  border-radius: 0;
}

.month-group-title {
  position: sticky;
  flex: 0 0 auto;
  top: 0;
  z-index: 3;
  display: flex;
  align-items: center;
  min-height: 40px;
  padding: 10px 16px;
  border-bottom: 1px solid var(--color-border);
  background: var(--color-surface-soft);
  color: var(--color-text-soft);
  font-size: 13.5px;
  font-weight: 750;
  letter-spacing: .025em;
  text-transform: uppercase;
}

.recurrence-row {
  grid-template-columns: 42px minmax(0, 1fr) auto;
  min-height: 82px;
  padding: 13px 16px;
  cursor: default;
}

.recurrence-side {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  min-width: 190px;
}

.recurrence-side .btn {
  min-width: 88px;
}

/* 15. Statistics */
.statistics-workspace {
  display: flex;
  min-height: 0;
  flex-direction: column;
  gap: var(--workspace-gap);
  padding-right: 2px;
}

.stats-filter-card {
  flex: 0 0 auto;
  min-height: 0;
}

.stats-filter-card .toolbar {
  margin-top: 12px;
  margin-bottom: 0;
}

.stats-content {
  display: grid;
  flex: 1 1 auto;
  align-content: start;
  gap: var(--workspace-gap);
}

.stats-kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: var(--workspace-gap);
}

.metric-card-summary {
  min-height: 150px;
  padding: 16px;
}

.metric-card-summary .metric-card-icon {
  width: 38px;
  height: 38px;
  padding: 9px;
}

.metric-card-summary .metric-card-copy {
  margin-top: 12px;
}

.metric-card-summary .metric-card-value {
  margin-top: 5px;
  font-size: clamp(23px, 2vw, 29px);
}

.metric-card-note {
  display: block;
  margin-top: auto;
  padding-top: 10px;
  color: var(--color-muted);
  font-size: 13.5px;
  font-weight: 550;
  line-height: 1.4;
}

.metric-card-purple .metric-card-icon {
  border-color: #ded5ff;
  background: #f3efff;
  color: #6941c6;
}


.stats-monthly-card,
.stats-ranking-card {
  min-height: auto;
}

.stats-table-wrap {
  min-width: 0;
  min-height: 0;
  padding-top: 4px;
}

.stats-table {
  min-width: 0;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.stats-table-head,
.stats-table-row {
  display: grid;
  grid-template-columns: minmax(110px, .75fr) repeat(3, minmax(145px, 1fr)) minmax(90px, .55fr);
  align-items: center;
  gap: 16px;
}

.stats-table-head {
  min-height: 44px;
  padding: 0 14px;
  background: var(--color-surface-soft);
  color: var(--color-text-soft);
  font-size: 13px;
  font-weight: 700;
}

.stats-table-row {
  min-height: 58px;
  padding: 10px 14px;
  border-top: 1px solid var(--color-divider-soft);
  background: var(--color-white);
}

.stats-table-row strong {
  color: var(--color-text-emphasis);
  font-size: 15.5px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.stats-table-row span {
  color: var(--color-muted);
  font-size: 13.5px;
}

.stats-count-cell {
  display: flex;
  align-items: baseline;
  gap: 5px;
}

.stats-ranking-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--workspace-gap);
}

.stats-ranking-list {
  display: flex;
  flex-direction: column;
  overflow: visible;
}

.stats-ranking-row {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  min-height: 68px;
  padding: 10px 2px;
  border-bottom: 1px solid var(--color-divider-soft);
}

.stats-ranking-row:last-child {
  border-bottom: 0;
}

.rank-number {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 10px;
  background: var(--color-surface-soft);
  color: var(--color-text-soft);
  font-size: 13px;
  font-weight: 750;
}

.stats-ranking-main {
  min-width: 0;
}

.stats-ranking-main strong {
  display: block;
  overflow: hidden;
  color: var(--color-text-emphasis);
  font-size: var(--list-title-size);
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.stats-ranking-main span {
  display: block;
  margin-top: 3px;
  color: var(--color-muted);
  font-size: var(--list-meta-size);
}

.stats-ranking-value {
  color: var(--color-text-emphasis);
  font-size: var(--list-value-size);
  font-weight: 700;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

/* 16. Quote */
.quote-input-pane {
  position: relative;
  top: auto;
  gap: var(--space-3);
}

.quote-input-body {
  min-height: 0;
}

.quote-output-pane {
  gap: var(--workspace-gap);
  align-content: start;
}

.quote-summary-card,
.quote-tax-card {
  flex: 0 0 auto;
}

.quote-lines-editor {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  margin-bottom: 10px;
}

.quote-line-input {
  display: grid;
  grid-template-columns: minmax(0, 1.7fr) minmax(120px, 0.8fr) 34px;
  align-items: end;
  gap: var(--space-2);
  padding: var(--space-2);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-white);
}

.quote-line-input label {
  margin: 0;
}

.quote-remove-line,
.quote-line-spacer {
  width: 34px;
  height: 34px;
}

.quote-remove-line {
  min-height: 34px;
  padding: 0;
  font-size: 18px;
}

.quote-line-spacer {
  display: block;
}

.auto-rule-box {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  margin-top: 14px;
  padding: 10px 12px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-surface-soft);
}

.auto-rule-box span {
  color: var(--color-muted);
  font-size: 12.5px;
  font-weight: 600;
  line-height: 1.35;
}

.auto-rule-box strong {
  color: var(--color-text-soft);
  font-size: 13px;
  text-align: right;
}

.quote-settings-note {
  margin-top: 10px;
  margin-bottom: 0;
}

.quote-summary-empty,
.quote-tax-empty {
  padding: 14px;
  border: 1px dashed var(--color-border-strong);
  border-radius: var(--radius-md);
  background: var(--color-surface-soft);
  color: var(--color-muted);
}

.quote-summary-lines {
  display: grid;
}

.quote-line {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: var(--space-3);
  padding: 10px 0;
  border-top: 1px solid var(--color-border);
}

.quote-line:first-child {
  border-top: 0;
}

.quote-line span,
.quote-tax-item span {
  color: var(--color-text-soft);
  font-weight: 600;
}

.quote-line em {
  display: block;
  margin-top: 2px;
  color: var(--color-muted);
  font-size: 12px;
  font-style: normal;
  font-weight: 600;
}

.quote-line strong {
  color: #1d2939;
  font-size: 15px;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.quote-value-actions {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  min-width: 0;
}

.copy-value-btn {
  display: inline-grid;
  place-items: center;
  flex: 0 0 30px;
  width: 30px;
  height: 30px;
  padding: 0;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  background: var(--color-surface-soft);
  color: var(--color-text-soft);
  cursor: pointer;
}

.copy-value-btn:focus-visible {
  outline: 3px solid var(--color-focus);
  outline-offset: 2px;
}

.copy-value-btn svg {
  width: 15px;
  height: 15px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.quote-total-line {
  margin-top: 2px;
  padding: 13px 12px;
  border: 1px solid var(--color-border-strong);
  border-radius: var(--radius-md);
  background: var(--color-surface-soft);
}

.quote-total-line strong {
  color: var(--color-text);
  font-size: 19px;
}

.quote-bollo-on-line {
  border-radius: var(--radius-sm);
  background: #fafafa;
}

.quote-competence-detail {
  padding: 7px 0;
}

.quote-tax-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  column-gap: 18px;
}

.quote-tax-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  padding: 10px 0;
  border-top: 1px solid var(--color-divider-soft);
}

.quote-tax-item:nth-child(-n + 2) {
  border-top: 0;
}

.quote-tax-item strong {
  color: var(--color-text);
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.quote-disclaimer {
  grid-column: 1 / -1;
  margin: 8px 0 0;
  padding-top: 10px;
  border-top: 1px solid var(--color-divider-soft);
  color: var(--color-muted);
  font-size: 12px;
}

/* 17. Settings */


.settings-shell {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  gap: var(--workspace-gap);
  height: 100%;
  min-height: 0;
  overflow: hidden;
}

.settings-nav {
  display: flex;
  min-height: 0;
  flex-direction: column;
  gap: 5px;
  padding: 10px;
  overflow: auto;
}

.settings-nav-item {
  display: flex;
  width: 100%;
  min-height: 44px;
  align-items: center;
  gap: 11px;
  padding: 10px 12px;
  border: 0;
  border-radius: var(--radius-md);
  background: transparent;
  color: var(--color-text-soft);
  font: inherit;
  font-weight: 650;
  text-align: left;
  cursor: pointer;
}

.settings-nav-item svg {
  width: 20px;
  height: 20px;
  flex: 0 0 auto;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.settings-nav-item.active {
  background: var(--color-surface-muted);
  color: var(--color-ink);
}

.settings-content {
  min-width: 0;
  min-height: 0;
  overflow: auto;
  padding-right: var(--scrollbar-inset);
  scrollbar-gutter: stable;
}

.settings-section-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--workspace-gap);
  align-items: start;
}

.settings-card {
  display: flex;
  min-height: 0;
  max-height: min(720px, calc(100dvh - var(--topbar-height) - 72px));
  overflow: hidden;
  flex-direction: column;
}

.settings-card-balanced {
  min-height: 0;
}

.settings-span-2 {
  grid-column: 1 / -1;
}

.settings-card-body {
  min-width: 0;
  min-height: 0;
  flex: 1 1 auto;
  overflow: auto;
  padding-right: var(--scrollbar-inset);
  scrollbar-gutter: stable;
  scrollbar-width: thin;
  scrollbar-color: #c5cedb transparent;
}

.settings-loading {
  grid-column: 1 / -1;
}

.settings-actions,
.row-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2);
  margin-top: var(--space-4);
}

.settings-form {
  margin: 0;
}

.settings-form input[readonly] {
  background: var(--color-surface-soft);
  color: var(--color-text-soft);
}














.settings-log-card {
  height: min(720px, calc(100dvh - var(--topbar-height) - 72px));
}

.settings-log-card .settings-card-body {
  display: flex;
  overflow: hidden;
  flex-direction: column;
}

.settings-log-card :where(.settings-log-actions, .filter-toolbar) {
  flex: 0 0 auto;
}

.settings-log-card .settings-table-wrap {
  flex: 1 1 auto;
  max-height: none;
}

.device-session-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--color-divider-soft);
}

.device-session-row:last-child { border-bottom: 0; }
.device-session-title { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.device-session-copy strong,
.device-session-copy small { display: block; }
.device-session-copy small { margin-top: 4px; color: var(--color-muted); }

.big-version {
  margin-bottom: var(--space-3);
  color: var(--color-ink);
  font-size: clamp(27px, 3vw, 34px);
  font-weight: 700;
  line-height: 1.05;
  letter-spacing: -0.035em;
}

.info-list {
  display: grid;
}

.info-row {
  display: flex;
  min-width: 0;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  padding: 10px 0;
  border-top: 1px solid var(--color-divider-soft);
}

.info-row:first-child { border-top: 0; }
.info-row > span { color: var(--color-text-soft); text-transform: capitalize; }
.info-row > strong { color: var(--color-ink); text-align: right; }





















.settings-table-wrap {
  min-width: 0;
  min-height: 0;
  max-height: 430px;
  overflow: auto;
  padding-right: var(--scrollbar-inset);
  scrollbar-gutter: stable;
  scrollbar-width: thin;
  scrollbar-color: #c5cedb transparent;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-white);
}

.settings-pagination {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: var(--space-2);
  margin-top: var(--space-3);
  color: var(--color-muted);
  font-size: 13px;
  font-weight: 650;
}







































.backup-list,
.passkey-list,
.device-session-list,
.category-editor-list,
.mapping-list {
  display: grid;
  gap: var(--space-2);
}

.backup-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 14px;
  padding: 12px 0;
  border-bottom: 1px solid var(--color-divider-soft);
}

.backup-item:last-child { border-bottom: 0; }

.backup-item-copy {
  min-width: 0;
}

.backup-item-title {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 9px;
}

.backup-item-title strong {
  min-width: 0;
  overflow: hidden;
  color: var(--color-ink);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.backup-item-copy small {
  display: block;
  margin-top: 4px;
  color: var(--color-muted);
}

.backup-item-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: var(--space-2);
}

.backup-state-dot {
  width: 9px;
  height: 9px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: var(--color-muted);
}

.backup-state-dot.success { background: var(--color-success); }
.backup-state-dot.warning { background: var(--color-warning); }
.backup-state-dot.error { background: var(--color-danger); }

.backup-item-error .backup-item-title strong {
  color: var(--color-danger);
}

.passkey-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--color-divider-soft);
}

.passkey-row:last-child { border-bottom: 0; }
.passkey-row strong,
.passkey-row small { display: block; }
.passkey-row small { margin-top: 4px; color: var(--color-muted); }

.category-editor-row {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) 90px 120px 100px auto;
  gap: 10px;
  align-items: center;
}
.category-usage { color: var(--color-muted); font-size: 13px; }
.mapping-row {
  display: grid;
  grid-template-columns: minmax(220px, .85fr) minmax(260px, 1.2fr) auto;
  gap: 12px;
  align-items: center;
  padding: 10px 0;
  border-bottom: 1px solid var(--color-divider-soft);
}

.mapping-row:last-child { border-bottom: 0; }
.mapping-row strong,
.mapping-row small { display: block; }
.mapping-row strong { color: var(--color-ink); }
.mapping-row small { margin-top: 3px; color: var(--color-muted); }

.settings-help {
  margin: var(--space-3) 0 0;
  color: var(--color-muted);
  font-size: 12.5px;
  line-height: 1.5;
}











































.settings-explainer {
  margin-bottom: var(--space-3);
  padding: 13px 14px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-surface-soft);
}

.settings-explainer strong {
  color: var(--color-ink);
}

.settings-explainer p {
  margin: 4px 0 0;
  color: var(--color-text-soft);
  line-height: 1.5;
}

.login-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 16px 0;
  color: var(--color-muted);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: .08em;
}
.login-divider::before,
.login-divider::after { content: ""; height: 1px; flex: 1; background: var(--color-divider-soft); }
.login-passkey-error { margin-top: 12px; color: var(--color-danger); font-size: 13px; }

@media (max-width: 1100px) {
  .settings-shell { grid-template-columns: 180px minmax(0, 1fr); }
  
}

@media (max-width: 760px) {
  .settings-shell {
    display: flex;
    flex-direction: column;
    gap: 10px;
    overflow: hidden;
  }
  .settings-nav {
    flex: 0 0 auto;
    min-height: auto;
    flex-direction: row;
    overflow-x: auto;
    padding: 6px;
    scrollbar-width: none;
  }
  .settings-nav::-webkit-scrollbar { display: none; }
  .settings-nav-item {
    width: auto;
    min-width: max-content;
    min-height: 40px;
    padding: 8px 10px;
  }
  .settings-nav-item svg { width: 18px; height: 18px; }
  .settings-content { flex: 1 1 auto; padding-right: 0; }
  .settings-section-grid { grid-template-columns: 1fr; }
  .settings-card,
  .settings-log-card { max-height: min(68dvh, 620px); height: auto; }
  .settings-card-balanced { min-height: 0; }
  .settings-span-2 { grid-column: auto; }
  
  .filter-toolbar--search-2 .filter-toolbar-row {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .filter-toolbar--search-2 .toolbar-search-wrap {
    grid-column: 1 / -1;
  }
  
  
  .backup-item,
  .passkey-row {
    grid-template-columns: 1fr;
  }
  .backup-item-actions {
    justify-content: flex-start;
  }
  .category-editor-row {
    grid-template-columns: minmax(0, 1fr) 86px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--color-divider-soft);
  }
  .category-editor-row .category-active,
  .category-editor-row .category-usage { grid-column: 1; }
  .category-editor-row .btn { grid-column: 2; grid-row: 2; }
  .mapping-row { grid-template-columns: 1fr; padding-bottom: 12px; }
  .mapping-row > span { justify-self: start; }
  
  
}

/* 18. Alerts, modal and toast */
.alert {
  padding: 11px 13px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-surface-soft);
  color: var(--color-text-soft);
}

.alert.success {
  border-color: var(--color-success-border);
  background: var(--color-success-bg);
  color: var(--color-success);
}

.alert.danger {
  border-color: var(--color-danger-border);
  background: var(--color-danger-bg);
  color: var(--color-danger);
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 500;
  display: grid;
  place-items: center;
  padding: var(--space-4);
  background: rgba(17, 24, 39, 0.42);
}

.modal-card {
  width: min(430px, 100%);
  padding: var(--space-5);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-xl);
  background: var(--color-white);
  box-shadow: var(--shadow-overlay);
}

.modal-card h3 {
  margin-bottom: var(--space-2);
  font-size: 18px;
}

.modal-card p {
  margin-bottom: var(--space-4);
  color: var(--color-muted);
}

.toast {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 600;
  display: flex;
  align-items: flex-start;
  gap: 9px;
  max-width: min(420px, calc(100vw - 30px));
  padding: 12px 14px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-lg);
  background: var(--color-ink);
  box-shadow: 0 18px 42px rgba(15, 23, 42, 0.22);
  color: var(--color-white);
  font-weight: 600;
  animation: toast-in 180ms ease both;
}

.toast-error {
  background: #991b1b;
}

.toast-icon {
  display: grid;
  place-items: center;
  flex: 0 0 20px;
  width: 20px;
  height: 20px;
  border-radius: var(--radius-pill);
  background: rgba(255, 255, 255, 0.14);
  font-size: 12px;
  font-weight: 700;
}

.toast-leaving {
  animation: toast-out 180ms ease both;
}

@keyframes toast-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes toast-out {
  from { opacity: 1; }
  to { opacity: 0; }
}

/* 19. Skeletons */
.skeleton {
  min-height: 90px;
  border-radius: var(--radius-md);
  background: linear-gradient(90deg, var(--color-surface-hover), var(--color-surface-soft), var(--color-surface-hover));
  background-size: 220% 100%;
  animation: skeleton-shimmer 1.6s ease-in-out infinite;
}

.skeleton-row,
.skeleton-list-row,
.skeleton-panel {
  position: relative;
  overflow: hidden;
  border-color: var(--color-divider-soft);
  background: var(--color-white);
}

.skeleton-row *,
.skeleton-list-row *,
.skeleton-summary *,
.skeleton-summary-stat *,
.skeleton-insight-row *,
.skeleton-status *,
.skeleton-line,
.skeleton-grid-mini::before,
.skeleton-grid-mini::after {
  border-color: transparent;
  border-radius: var(--radius-sm);
  background: linear-gradient(90deg, var(--color-surface-hover) 0%, var(--color-surface-soft) 48%, var(--color-surface-hover) 100%);
  background-size: 220% 100%;
  color: transparent;
  animation: skeleton-shimmer 1.6s ease-in-out infinite;
}

.skeleton-row b {
  width: 45%;
  height: 14px;
  margin-bottom: 8px;
}

.skeleton-row span {
  display: block;
  width: 70%;
  height: 12px;
}

.skeleton-list-row > div:first-child {
  width: 16px;
  height: 16px;
  border-radius: 5px;
}

.skeleton-list-row b {
  display: block;
  width: 42%;
  height: 14px;
  margin-bottom: 8px;
}

.skeleton-list-row span {
  display: block;
  width: 68%;
  height: 12px;
}

.skeleton-list-row strong {
  display: block;
  width: 62px;
  height: 18px;
}

.skeleton-summary > span,
.skeleton-summary > strong,
.skeleton-summary > small,
.skeleton-summary-stat > span,
.skeleton-summary-stat > strong,
.skeleton-summary-stat > small,
.skeleton-insight-row strong,
.skeleton-insight-row span,
.skeleton-insight-row b,
.skeleton-status > span,
.skeleton-status b,
.skeleton-status small {
  display: block;
}

.skeleton-summary > span,
.skeleton-summary-stat > span {
  width: 42%;
  height: 12px;
}

.skeleton-summary > strong {
  width: 58%;
  height: 34px;
  margin-top: 10px;
}

.skeleton-summary > small {
  width: 66%;
  height: 11px;
  margin-top: 10px;
}

.skeleton-summary-stat > strong {
  width: 68%;
  height: 22px;
  margin-top: 9px;
}

.skeleton-summary-stat > small {
  width: 86%;
  height: 11px;
  margin-top: 9px;
}

.skeleton-insight-row strong {
  width: min(280px, 70%);
  height: 13px;
}

.skeleton-insight-row span {
  width: min(360px, 88%);
  height: 11px;
  margin-top: 9px;
}

.skeleton-insight-row b {
  width: 72px;
  height: 24px;
}

.skeleton-status > span {
  width: 9px;
  height: 9px;
  border-radius: 50%;
}

.skeleton-status b {
  width: 48%;
  height: 12px;
}

.skeleton-status small {
  width: 78%;
  height: 10px;
  margin-top: 7px;
}

.skeleton-line {
  display: block;
  width: 100%;
  height: 14px;
  margin: 10px 0;
}

.skeleton-line.w40 { width: 40%; }
.skeleton-line.w50 { width: 50%; }
.skeleton-line.w60 { width: 60%; }
.skeleton-line.w70 { width: 70%; }

.skeleton-grid-mini {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 12px;
}

.skeleton-grid-mini::before,
.skeleton-grid-mini::after {
  content: "";
  display: block;
  height: 72px;
}

@keyframes skeleton-shimmer {
  from { background-position: 120% 0; }
  to { background-position: -120% 0; }
}

/* 20. Login and installer */
.login-body {
  display: grid;
  place-items: center;
  min-height: 100dvh;
  overflow: auto;
  padding: clamp(22px, 4vw, 52px);
  background: linear-gradient(135deg, var(--color-surface-soft) 0%, #eef2f7 100%);
}

.login-body.orbita-login {
  position: relative;
  overflow: hidden;
  background: radial-gradient(circle at 22% 18%, rgba(255, 255, 255, 0.95), transparent 30%), radial-gradient(circle at 78% 82%, rgba(226, 232, 240, 0.55), transparent 34%), linear-gradient(135deg, var(--color-surface-soft) 0%, #eef2f7 100%);
}

.login-body.orbita-login::before,
.login-body.orbita-login::after {
  content: "";
  position: fixed;
  z-index: 0;
  pointer-events: none;
  border: 2px solid rgba(148, 163, 184, 0.14);
  border-radius: 50%;
}

.login-body.orbita-login::before {
  top: 34%;
  left: -150px;
  width: 520px;
  height: 160px;
  transform: rotate(-24deg);
}

.login-body.orbita-login::after {
  right: -260px;
  bottom: -260px;
  width: 760px;
  height: 760px;
}

.login-orbit {
  position: fixed;
  z-index: 0;
  pointer-events: none;
}

.login-orbit-left {
  top: 31%;
  left: 16%;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: rgba(148, 163, 184, 0.12);
  box-shadow: 118px 70px 0 -8px rgba(148, 163, 184, 0.08);
}

.login-orbit-right {
  top: 18%;
  right: 10%;
  width: 34px;
  height: 34px;
  border: 12px solid rgba(148, 163, 184, 0.08);
  border-radius: 50%;
}

.login-card {
  position: relative;
  z-index: 1;
  width: min(560px, calc(100vw - 32px));
  padding: 38px 42px 34px;
  border-color: rgba(203, 213, 225, 0.82);
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: 0 26px 70px rgba(15, 23, 42, 0.1), inset 0 1px 0 rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(10px);
}

.login-brand-row {
  gap: 14px;
  margin-bottom: 28px;
}

.login-brand-mark {
  flex-basis: 44px;
  width: 44px;
  height: 44px;
  padding: 8px;
  border-radius: 13px;
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.16);
}

.login-card .brand-text {
  font-size: 20px;
}

.login-title-block {
  margin-bottom: 28px;
}

.login-title-block h1 {
  margin-bottom: 0;
  color: var(--color-ink);
  font-size: clamp(34px, 4vw, 46px);
  font-weight: 700;
  line-height: 1.02;
  letter-spacing: -0.055em;
}

.login-title-block p {
  margin: 12px 0 0;
  color: var(--color-muted);
  font-size: 16px;
  line-height: 1.45;
}

.login-error {
  margin-bottom: 20px;
}

.login-fields {
  display: grid;
  gap: 18px;
}

.login-field {
  display: block;
  color: var(--color-text-soft);
  font-size: 13px;
  font-weight: 700;
}

.login-field > span {
  display: block;
  margin-bottom: 8px;
}

.login-input-wrap {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  height: 54px;
  padding: 0 14px;
  border: 1px solid var(--color-border-strong);
  border-radius: 12px;
  background: var(--color-white);
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.login-input-wrap:focus-within {
  border-color: #9aa7bb;
  box-shadow: 0 0 0 4px rgba(15, 23, 42, 0.06);
}

.login-input-wrap > svg {
  flex: 0 0 20px;
  width: 20px;
  height: 20px;
  fill: var(--color-muted);
}

.login-input-wrap input {
  flex: 1 1 auto;
  min-width: 0;
  height: 100%;
  min-height: 0;
  padding: 0;
  border: 0;
  background: transparent;
  box-shadow: none;
  color: var(--color-text);
  font-size: 15px;
}

.login-input-wrap input:focus {
  box-shadow: none;
}

.login-eye {
  display: grid;
  place-items: center;
  flex: 0 0 34px;
  width: 34px;
  height: 34px;
  padding: 0;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: var(--color-muted);
  cursor: pointer;
}.login-eye svg {
  width: 20px;
  height: 20px;
  fill: currentColor;
}

.login-remember {
  display: flex;
  align-items: center;
  flex-direction: row;
  gap: 10px;
  margin: 18px 0 28px;
  color: var(--color-text-soft);
  font-size: 14px;
  font-weight: 700;
}

.login-remember input {
  width: 21px;
  height: 21px;
  margin: 0;
}

.login-submit {
  height: 54px;
  min-height: 54px;
  border-radius: 12px;
  background: linear-gradient(180deg, #172033 0%, var(--color-text) 100%);
  box-shadow: 0 14px 28px rgba(16, 24, 40, 0.18);
  font-size: 16px;
}

.install-card {
  width: min(620px, 100%);
  padding: var(--space-6);
}

.install-card h1 {
  margin-bottom: var(--space-4);
  font-size: 28px;
  letter-spacing: -0.035em;
}

.install-card h2 {
  margin: var(--space-5) 0 var(--space-3);
  font-size: 17px;
}

.install-form {
  display: grid;
  gap: var(--space-3);
}

.reqs {
  display: grid;
  gap: 6px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.reqs li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  padding: 8px 10px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
}

.reqs .ok {
  color: var(--color-success);
}

.reqs .bad {
  color: var(--color-danger);
}

/* 21. Desktop-only layout refinements */
@media (min-width: 901px) {
  body[data-page="jobs"] #jobPanel {
    padding-bottom: 0;
    background: var(--color-white);
  }

  body[data-page="jobs"] #jobPanel .form-actions {
    position: sticky;
    bottom: 0;
    z-index: 60;
    margin: 6px -15px 0;
    padding: 10px 15px;
    border-radius: 0 0 var(--radius-lg) var(--radius-lg);
    background: var(--color-white);
    box-shadow: 0 -8px 18px rgba(15, 23, 42, 0.06);
  }
}

/* 22. Tablet */
@media (max-width: 1150px) {
  .topbar {
    gap: 10px;
  }

  .top-nav a {
    padding-inline: 8px;
  }

  .nav-label {
    font-size: 13px;
  }

  .user-name {
    display: none;
  }

  .split-page,
  .split-page-wide {
    grid-template-columns: minmax(300px, 350px) minmax(0, 1fr);
  }

  .jobs-workspace {
    grid-template-columns: minmax(310px, 350px) minmax(0, 1fr);
  }

}

/* 23. Mobile */
@media (max-width: 900px) {
  :root {
    --topbar-height: 56px;
    --card-padding: var(--card-padding-mobile);
    --workspace-gap: 10px;
    --page-gap: 10px;
    --scrollbar-inset: 3px;
  }

  html.has-mobile-form-html,
  body.has-mobile-form {
    height: 100%;
    overflow: hidden;
    overscroll-behavior: none;
    touch-action: none;
  }

  .topbar {
    grid-template-columns: auto 1fr auto;
    gap: var(--space-2);
    height: var(--topbar-height);
    padding: 0 12px;
    backdrop-filter: none;
  }

  .brand-name {
    display: none;
  }

  .brand-mark {
    flex-basis: 38px;
    width: 38px;
    height: 38px;
    padding: 7px;
    border-radius: 11px;
  }

  .top-nav {
    position: fixed;
    inset: auto 0 0;
    z-index: 300;
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: 5px;
    height: var(--bottom-nav-height);
    padding: 7px 9px calc(7px + env(safe-area-inset-bottom, 0px));
    overflow: visible;
    border-top: 1px solid var(--color-border);
    background: rgba(255, 255, 255, 0.97);
    box-shadow: 0 -8px 22px rgba(15, 23, 42, 0.07);
    backdrop-filter: blur(18px);
  }

  .top-nav a {
    display: grid;
    place-items: center;
    min-width: 0;
    min-height: 50px;
    padding: 0;
    border-radius: 13px;
  }

  .top-nav a[data-nav="settings"] {
    display: none;
  }

  .top-nav .nav-label {
    display: none;
  }

  .top-nav .nav-icon {
    width: 23px;
    height: 23px;
  }

  .nav-badge {
    top: 2px;
    right: 2px;
  }

  .mobile-settings-link {
    display: grid;
    width: 40px;
    height: 40px;
    border-radius: 12px;
  }

  .mobile-settings-link.active {
    background: var(--color-surface-hover);
    color: var(--color-primary);
  }

  .logout-link {
    width: 40px;
    height: 40px;
    padding: 0;
    justify-content: center;
    border-radius: 12px;
  }

  .logout-link span {
    display: none;
  }

  .app-main {
    padding: calc(var(--topbar-height) + 10px) 12px calc(var(--bottom-nav-height) + 12px + env(safe-area-inset-bottom, 0px));
  }

  .page-head-sticky {
    top: auto;
    padding: 0 2px;
  }

  .page-head {
    margin-bottom: var(--page-gap);
  }

  .page-head h1 {
    margin-bottom: 3px;
    font-size: 23px;
  }

  .page-head p {
    font-size: 13px;
  }

  .split-page,
  .split-page-wide {
    grid-template-columns: 1fr;
  }


  .form-pane,
  .quote-input-pane {
    position: relative;
    top: auto;
    max-height: none;
  }

  body[data-page="jobs"] .split-page > .form-pane,
  body[data-page="clients"] .split-page > .form-pane {
    display: none;
  }

  .toolbar-sticky {
    top: auto;
  }

  .mobile-only {
    display: inline-flex;
  }

  .panel-grid {
    grid-template-columns: 1fr;
  }

  .form-grid {
    grid-template-columns: 1fr;
  }

  .form-actions,
  .modal-actions {
    justify-content: flex-start;
  }

  .filter-toolbar {
    z-index: 90;
    padding: 8px;
  }

  .filter-toolbar.filters-open {
    z-index: 280;
  }

  .filter-toolbar-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 8px;
    min-width: 0;
    overflow: visible;
    padding: 0;
  }

  .filter-toolbar-row > :where(.toolbar-search, .toolbar-search-wrap, select, .btn) {
    width: 100%;
    min-width: 0;
  }

  body[data-page="jobs"] .filter-toolbar-row {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  body[data-page="jobs"] .filter-toolbar-row > :where(.toolbar-search, .toolbar-search-wrap) {
    grid-column: 1 / -1;
  }

  body[data-page="clients"] .filter-toolbar-row {
    grid-template-columns: minmax(0, 1fr) minmax(96px, auto);
  }

  body[data-page="recurrences"] .filter-toolbar-row,
  body[data-page="statistics"] .filter-toolbar-row {
    grid-template-columns: minmax(0, 1fr) minmax(112px, auto);
  }

  .filter-popover {
    top: calc(100% + 6px);
    right: 0;
    left: 0;
    grid-template-columns: 1fr;
    width: auto;
    max-height: min(54dvh, 420px);
    padding: 10px;
  }

  .bulk-bar {
    position: relative;
    justify-content: space-between;
    min-height: 46px;
    margin-bottom: 8px;
    padding: 6px 8px;
    background: var(--color-surface-soft);
    box-shadow: none;
  }

  .bulk-bar .bulk-select {
    display: none;
  }

  .bulk-mobile-count {
    display: inline-flex;
    align-items: baseline;
    gap: 5px;
    min-width: 0;
    color: var(--color-muted);
    font-size: 11.5px;
    font-weight: 600;
    white-space: nowrap;
  }

  .bulk-mobile-count b {
    color: var(--color-text);
    font-size: 15px;
    font-variant-numeric: tabular-nums;
  }

  .bulk-bar .bulk-actions {
    width: auto;
    margin-left: auto;
    justify-content: flex-end;
    gap: 6px;
    flex-wrap: nowrap;
  }

  .bulk-bar .icon-btn {
    width: 36px;
    min-width: 36px;
    height: 36px;
    min-height: 36px;
    padding: 0;
    border-color: var(--color-border);
    background: var(--color-white);
    color: var(--color-text-soft);
  }

  .bulk-bar .bulk-paid-btn {
    border-color: var(--color-success-border);
    background: var(--color-success-bg);
    color: var(--color-success);
  }

  .bulk-bar .btn.danger {
    border-color: var(--color-danger-border);
    background: var(--color-danger-bg);
    color: var(--color-danger);
  }

  .compact-list-row {
    align-items: start;
    min-height: 0;
    padding: 12px 4px;
  }

  .entity-title {
    align-items: flex-start;
    flex-wrap: wrap;
    overflow: visible;
    white-space: normal;
  }

  .entity-title strong,
  .entity-title span {
    overflow: visible;
    white-space: normal;
  }

  .entity-title span {
    flex: 1 0 100%;
    margin-top: 2px;
    text-overflow: clip;
  }

  .entity-title span::before {
    display: none;
  }

  .meta-line {
    flex-wrap: wrap;
    overflow: visible;
    white-space: normal;
  }

  .job-list-row {
    grid-template-columns: 24px minmax(0, 1fr);
    grid-template-areas:
      "check main"
      ". side";
    gap: 8px 10px;
  }

  .job-list-row > .job-select {
    grid-area: check;
    margin-top: 8px;
  }

  .job-list-row > .avatar-badge,
  .client-list-row > .avatar-badge,
  .recurrence-row > .avatar-badge {
    display: none;
  }

  .job-main {
    grid-area: main;
  }

  .job-side {
    grid-area: side;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    width: 100%;
    min-width: 0;
    flex-direction: row;
    gap: 8px 10px;
    flex-wrap: wrap;
    padding-top: 7px;
    border-top: 1px solid var(--color-divider-soft);
    text-align: left;
  }

  .job-status-line,
  .badges {
    justify-content: flex-start;
  }

  .client-list-row {
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas: "main side";
    align-items: start;
    gap: 10px;
  }

  .client-main {
    grid-area: main;
  }

  .client-side {
    grid-area: side;
    display: flex;
    align-items: flex-end;
    justify-content: flex-start;
    width: auto;
    min-width: 84px;
    flex-direction: column;
    gap: 1px;
    padding: 1px 0 0;
    border-top: 0;
    text-align: right;
  }

  .client-total-label {
    color: var(--color-muted);
    font-size: 11.5px;
    line-height: 1.2;
  }

  .recurrence-row {
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas:
      "main"
      "side";
    gap: 8px;
    margin-bottom: 10px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    background: var(--color-white);
    box-shadow: var(--shadow-soft);
  }

  .recurrence-row > .compact-list-main {
    grid-area: main;
  }

  .recurrence-side {
    grid-area: side;
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    min-width: 0;
    flex-direction: row;
    gap: 10px;
    padding-top: 7px;
    border-top: 1px solid var(--color-divider-soft);
    text-align: left;
  }

  .jobs-filtered-total {
    padding-top: var(--space-2);
  }

  .jobs-total-inner {
    width: 100%;
    min-width: 0;
  }

  .compact-generate {
    min-width: 104px;
    height: 36px;
    min-height: 36px;
  }


  .panel-scroll {
    max-height: 330px;
  }

  .quote-line-input {
    grid-template-columns: minmax(0, 1fr) 120px 34px;
  }

  .cat-row,
  .new-cat {
    grid-template-columns: minmax(0, 1fr) 74px;
  }

  .cat-row select,
  .new-cat select {
    grid-column: 1;
  }

  .cat-row .btn,
  .new-cat .btn {
    grid-column: 2;
    grid-row: 2;
  }

  .fic-sync-counters {
    grid-template-columns: 1fr;
  }


  .toast {
    right: 10px;
    bottom: calc(var(--bottom-nav-height) + 12px);
  }

  body.has-mobile-form .topbar,
  body.has-mobile-form .top-nav {
    z-index: 21000;
  }

  body > #jobPanel.mobile-job-popup,
  body > #clientPanel.mobile-client-popup,
  body > .form-pane.mobile-open {
    display: block;
    overflow-y: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
  }

  body > #jobPanel.mobile-job-popup .form-title-row,
  body > #clientPanel.mobile-client-popup .form-title-row,
  body > .form-pane.mobile-open .form-title-row {
    min-height: 46px;
    margin-bottom: 12px;
    padding: 4px 0 12px;
    border-bottom: 1px solid var(--color-border);
  }

  body > #jobPanel.mobile-job-popup .mobile-form-close,
  body > #clientPanel.mobile-client-popup .mobile-form-close,
  body > .form-pane.mobile-open .mobile-form-close {
    display: grid;
    flex: 0 0 42px;
    width: 42px;
    height: 42px;
  }

  body > #jobPanel.mobile-job-popup .form-grid,
  body > #clientPanel.mobile-client-popup .form-grid,
  body > .form-pane.mobile-open .form-grid {
    grid-template-columns: 1fr;
    padding-bottom: 24px;
  }

  body > #jobPanel.mobile-job-popup .form-actions,
  body > #clientPanel.mobile-client-popup .form-actions,
  body > .form-pane.mobile-open .form-actions {
    position: static;
    margin-top: 14px;
    padding-top: 14px;
    background: var(--color-white);
    box-shadow: none;
  }


  .recurrence-series-summary {
    align-items: flex-start;
    flex-direction: column;
    gap: 3px;
  }

  .recurrence-series-summary span {
    text-align: left;
  }

  .job-activity-card {
    max-height: 170px;
  }

  .job-activity-list {
    max-height: 124px;
  }

  .job-activity-row {
    grid-template-columns: 1fr;
  }

  .job-activity-row small {
    grid-column: auto;
  }
}

/* 24. Small mobile */
@media (max-width: 560px) {
  .summary-stat-grid-2 {
    grid-template-columns: 1fr;
  }

  .summary-value {
    font-size: 31px;
  }

  .insight-row {
    align-items: start;
    gap: var(--space-3);
  }

  .quote-tax-grid {
    grid-template-columns: 1fr;
  }

  .quote-tax-item:nth-child(2) {
    border-top: 1px solid var(--color-divider-soft);
  }

  .quote-line-input {
    grid-template-columns: minmax(0, 1fr) 34px;
  }

  .quote-line {
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 10px;
  }

  .quote-value-actions {
    gap: 6px;
  }

  .quote-line strong {
    font-size: 14px;
  }

  .quote-total-line strong {
    font-size: 17px;
  }

  .quote-line-amount {
    grid-column: 1;
  }

  .quote-remove-line,
  .quote-line-spacer {
    grid-column: 2;
    grid-row: 2;
  }

  .login-card {
    padding: 28px 22px 24px;
    border-radius: 18px;
  }

  .login-brand-row,
  .login-title-block {
    margin-bottom: 22px;
  }

  .login-input-wrap {
    height: 52px;
  }

  .login-body.orbita-login::before {
    top: 26%;
    left: -260px;
  }

  .login-body.orbita-login::after {
    right: -430px;
  }
}

/* Dashboard responsive composition */
@media (max-width: 1100px) {
  .dashboard-content-grid {
    grid-template-columns: 1fr;
  }

  .dashboard-chart-card,
  .dashboard-attention-card {
    min-height: 340px;
  }
}

@media (max-width: 900px) {
  .page-head:not(.dashboard-page-head) {
    display: none;
  }

  .dashboard-page-head {
    align-items: center;
    justify-content: flex-end;
    margin-bottom: 8px;
  }

  .dashboard-page-head > div {
    display: none;
  }

  .dashboard-page-head .context-select {
    min-height: 38px;
  }

  .dashboard-workspace {
    display: grid;
    overflow: auto;
  }

  .metric-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .metric-card {
    min-height: 158px;
    padding: 14px;
  }

  .metric-card:last-child {
    grid-column: 1 / -1;
  }

  .metric-card-icon {
    width: 38px;
    height: 38px;
    padding: 9px;
  }

  .metric-card-copy {
    margin-top: 12px;
  }

  .metric-card-value {
    font-size: clamp(20px, 5.4vw, 25px);
  }

  .metric-card-comparison {
    padding-top: 11px;
    font-size: 11px;
    line-height: 1.3;
    white-space: normal;
  }

  .dashboard-attention-card {
    order: -1;
  }

  .dashboard-chart-legend {
    gap: 9px;
  }

  .dashboard-item-row {
    grid-template-columns: 34px minmax(0, 1fr);
  }

  .dashboard-item-side {
    grid-column: 2;
    align-items: center;
    flex-direction: row;
    justify-content: space-between;
  }

  .section-heading p,
  .card-subtitle,
  .quote-settings-note {
    display: none;
  }
}

@media (max-width: 560px) {
  .dashboard-page-head .context-select {
    width: auto;
    padding-inline: 10px;
  }

  .dashboard-page-head .context-select select {
    min-width: 88px;
  }

  .metric-card {
    min-height: 150px;
    border-radius: 15px;
  }

  .dashboard-chart-card,
  .dashboard-attention-card {
    min-height: 320px;
  }

  .dashboard-chart-grid {
    min-height: 205px;
    gap: 3px;
  }

  .dashboard-chart-bars {
    gap: 2px;
  }

  .dashboard-chart-month {
    font-size: 9px;
  }

  .dashboard-tabs {
    gap: 5px;
  }

  .dashboard-tabs .btn {
    min-height: 32px;
    padding-inline: 5px;
    font-size: 11px;
  }

  .section-heading {
    align-items: center;
  }
}

/* 25. Shared responsive data presentation */
@media (max-width: 900px) {
  .stats-kpi-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .stats-ranking-grid {
    grid-template-columns: 1fr;
  }

  .stats-table {
    border: 0;
    border-radius: 0;
    overflow: visible;
  }

  .stats-table-head {
    display: none;
  }

  .stats-table-body {
    display: grid;
    gap: 10px;
  }

  .stats-table-row {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px 14px;
    min-height: 0;
    padding: 14px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    background: var(--color-white);
    box-shadow: var(--shadow-soft);
  }

  .stats-table-row > [data-label]::before {
    content: attr(data-label);
    display: block;
    margin-bottom: 3px;
    color: var(--color-muted);
    font-size: 12px;
    font-weight: 650;
  }

  .stats-month-cell {
    grid-column: 1 / -1;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--color-divider-soft);
    font-size: 17px;
  }

  .stats-count-cell {
    display: block;
  }

  .stats-count-cell strong {
    margin-right: 4px;
  }

  .stats-ranking-row {
    min-height: 72px;
    padding-inline: 0;
  }

  .month-group-title {
    display: none;
  }

  .quote-layout {
    display: flex;
    height: 100%;
    min-height: 0;
    overflow-x: hidden;
    overflow-y: auto;
    flex-direction: column;
    gap: var(--workspace-gap);
    padding-bottom: var(--space-2);
  }

  .quote-input-pane,
  .quote-output-pane {
    flex: 0 0 auto;
    height: auto;
    min-height: 0;
    overflow: visible;
  }

  .quote-output-pane {
    margin-right: 0;
    padding-right: 0;
    padding-bottom: 0;
  }

  .quote-summary-card,
  .quote-tax-card {
    min-height: 0;
  }
}

@media (max-width: 560px) {
  .metric-card-summary {
    min-height: 132px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* Impostazioni: stato, versione e log unificato */
.system-status-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: var(--space-2);
}

.system-status-item {
  display: flex;
  min-width: 0;
  align-items: flex-start;
  gap: 10px;
  padding: 13px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-surface-soft);
  color: var(--color-text);
  font: inherit;
  text-align: left;
}

button.system-status-item {
  width: 100%;
  cursor: pointer;
}

.system-status-item > div,
.system-status-item strong,
.system-status-item small,
.system-status-item time {
  display: block;
  min-width: 0;
}

.system-status-item strong {
  color: var(--color-ink);
}

.system-status-item small {
  margin-top: 4px;
  color: var(--color-text-soft);
  line-height: 1.35;
}

.system-status-item time {
  margin-top: 7px;
  color: var(--color-muted);
  font-size: 12px;
  line-height: 1.3;
}

.system-status-success { border-color: var(--color-success-border); }
.system-status-warning { border-color: var(--color-warning-border); }
.system-status-danger { border-color: var(--color-danger-border); }
.system-status-clickable { background: var(--color-danger-bg); }

.changelog-accordions {
  display: grid;
  gap: 8px;
  margin-top: var(--space-4);
  padding-top: var(--space-3);
  border-top: 1px solid var(--color-divider-soft);
}

.changelog-accordion {
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-surface-soft);
}

.changelog-accordion summary {
  padding: 11px 13px;
  color: var(--color-ink);
  font-weight: 700;
  cursor: pointer;
}

.changelog-content {
  max-height: 360px;
  overflow: auto;
  padding: 0 13px 13px;
  scrollbar-gutter: stable;
}

.changelog-version {
  padding: 12px 0;
  border-top: 1px solid var(--color-divider-soft);
}

.changelog-version h3 {
  margin: 0 0 8px;
  color: var(--color-ink);
  font-size: 14px;
}

.changelog-version ul {
  margin: 0;
  padding: 0 15px 0 20px;
  color: var(--color-text-soft);
}

.changelog-version li + li { margin-top: 5px; }

.settings-log-actions {
  margin-top: 0;
  margin-bottom: var(--space-3);
}

.log-entry {
  padding: 13px 14px;
  border-bottom: 1px solid var(--color-divider-soft);
}

.log-entry:last-child { border-bottom: 0; }

.log-entry-main {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-3);
}

.log-entry-main strong,
.log-entry-main small {
  display: block;
}

.log-entry-main small {
  margin-top: 4px;
  color: var(--color-muted);
}

.log-entry > p {
  margin: 8px 0 0;
  color: var(--color-text-soft);
  line-height: 1.45;
}

.log-entry-actions {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-3);
  margin-top: 9px;
}

.log-details summary {
  color: var(--color-text-soft);
  font-size: 13px;
  font-weight: 650;
  cursor: pointer;
}

.log-context {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 7px;
  margin-top: 9px;
}

.log-context > div {
  padding: 8px 9px;
  border-radius: var(--radius-sm);
  background: var(--color-surface-soft);
}

.log-context span,
.log-context strong {
  display: block;
}

.log-context span {
  color: var(--color-muted);
  font-size: 11px;
  text-transform: capitalize;
}

.log-context strong {
  margin-top: 2px;
  color: var(--color-text);
  font-size: 12px;
  overflow-wrap: anywhere;
}

.log-entry-silenced { opacity: .65; }

.category-editor-row-signal {
  grid-template-columns: minmax(190px, 1fr) 82px 112px minmax(190px, 1fr) 92px auto;
}

@media (max-width: 1100px) {
  .system-status-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .log-context { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 760px) {
  .system-status-grid { grid-template-columns: 1fr; }
  .log-entry-main,
  .log-entry-actions { align-items: flex-start; }
  .log-entry-actions { flex-direction: column; }
  .log-context { grid-template-columns: 1fr; }
  .category-editor-row-signal { grid-template-columns: minmax(0, 1fr) 84px; }
  .category-editor-row-signal .mapping-name { grid-column: 1 / -1; }
  .device-session-row { grid-template-columns: 1fr; }
  .device-session-row .btn { justify-self: start; }
}

.system-status-item .health-dot {
  width: 10px;
  height: 10px;
  flex: 0 0 auto;
  margin-top: 5px;
  border-radius: 50%;
  background: var(--color-warning);
}
.system-status-item .health-dot.ok { background: var(--color-success); }
.system-status-item .health-dot.error { background: var(--color-danger); }

.field-optional {
  color: var(--color-muted);
  font-size: 12px;
  font-weight: 500;
}

.backup-error-copy {
  max-width: 760px;
  color: var(--color-danger);
  overflow-wrap: anywhere;
}

.restore-upload-form {
  margin: 0;
}

/* 19. Rinnovi ricorrenti manuali */
.recurrence-status-link {
  text-decoration: none;
}

.row-highlight {
  outline: 2px solid #d5e4ff;
  outline-offset: -2px;
}

.renewal-modal-card {
  width: min(680px, 100%);
  max-height: min(760px, calc(100vh - 32px));
  overflow-y: auto;
}

.renewal-modal-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-4);
  margin-bottom: var(--space-4);
}

.renewal-modal-header h3,
.renewal-modal-header p {
  margin: 0;
}

.renewal-modal-header p {
  margin-top: 4px;
  color: var(--color-muted);
  font-size: 13px;
}

.renewal-form {
  margin: 0;
}

@media (max-width: 700px) {
  .renewal-modal-card {
    max-height: calc(100vh - 20px);
    padding: 16px;
  }
}
