/* officina.it Design System v2 — Calm */

/* ── Self-hosted fonts ───────────────────────── */

/* Inter — latin-ext */
@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url('../fonts/inter-latin-ext.woff2') format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

/* Inter — latin */
@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url('../fonts/inter-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

/* JetBrains Mono — latin-ext */
@font-face {
  font-family: 'JetBrains Mono';
  font-style: normal;
  font-weight: 400 500;
  font-display: swap;
  src: url('../fonts/jetbrains-mono-latin-ext.woff2') format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

/* JetBrains Mono — latin */
@font-face {
  font-family: 'JetBrains Mono';
  font-style: normal;
  font-weight: 400 500;
  font-display: swap;
  src: url('../fonts/jetbrains-mono-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
  /* Surfaces */
  --v2-bg: #ffffff;
  --v2-surface-2: #fafafa;
  /* Hover — neutral gray wash for interactive surfaces. */
  --v2-hover: #fafafa;
  --v2-hover-strong: #f0f0f0;

  /* Ink scale */
  --v2-ink: #0a0e1a;
  --v2-ink-2: #1f2937;
  --v2-ink-3: #6b7280;
  --v2-ink-4: #9ca3af;
  --v2-ink-5: #d1d5db;

  /* Hairlines */
  --v2-line: #ececec;
  --v2-line-2: #d1d5db;

  /* Brand — primary action only */
  --v2-brand: #2563eb;
  --v2-brand-2: #1d4ed8;

  /* State — used sparingly, semantic only */
  --v2-good: #15803d;
  --v2-warn: #b45309;
  --v2-danger: #b91c1c;

  /* Radius */
  --v2-r-sm: 4px;
  --v2-r-md: 6px;
  --v2-r-lg: 8px;
}

/* ── Base ────────────────────────────────────── */

.v2 {
  font-family: 'Inter', -apple-system, system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  color: var(--v2-ink);
  background: var(--v2-bg);
}

.v2 * { box-sizing: border-box; }

.v2 .mono,
.v2 span[style*="JetBrains Mono"] {
  white-space: nowrap;
}

.v2 .mono {
  font-family: 'JetBrains Mono', ui-monospace, monospace;
}

/* ── Typography ──────────────────────────────── */

.v2-display {
  font-size: 22px;
  line-height: 28px;
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--v2-ink);
}

.v2-page-title {
  font-size: 28px;
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--v2-ink);
  margin: 0;
}

.v2-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--v2-ink);
}

.v2-body {
  font-size: 13.5px;
  font-weight: 400;
  color: var(--v2-ink);
}

.v2-label {
  font-size: 12.5px;
  font-weight: 400;
  color: var(--v2-ink-3);
}

.v2-code {
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 12.5px;
  font-weight: 500;
}

.v2-eyebrow {
  font-size: 11px;
  font-weight: 600;
  color: var(--v2-ink-3);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  margin: 0;
}

.v2-muted {
  color: var(--v2-ink-4);
}

/* ── Layout ──────────────────────────────────── */

.v2-app {
  display: flex;
  width: 100%;
  min-height: 100vh;
  background: var(--v2-bg);
}

.v2-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.v2-content {
  flex: 1;
  overflow: auto;
  background: var(--v2-bg);
}

:root {
  --v2-container-max:        1240px;
  --v2-container-medium-max: 1080px;
  --v2-container-form-max:    880px;
}

.v2-container {
  max-width: var(--v2-container-max);
  margin: 0 auto;
  padding: 32px 32px 64px;
}

.v2-container-medium {
  max-width: var(--v2-container-medium-max);
  margin: 0 auto;
  padding: 32px 32px 64px;
}

.v2-container-form {
  max-width: var(--v2-container-form-max);
  margin: 0 auto;
  padding: 32px 32px 64px;
}

/* ── Sidebar ─────────────────────────────────── */

.v2-sidebar {
  width: 224px;
  background: var(--v2-bg);
  border-right: 1px solid var(--v2-line);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  height: 100vh;
  position: sticky;
  top: 0;
  transition: width 0.15s ease;
}

.v2-sidebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 14px;
  height: 52px;
  flex-shrink: 0;
  border-bottom: 1px solid var(--v2-line);
}

.v2-sidebar-brand img {
  width: 28px;
  height: 28px;
  object-fit: contain;
}

.v2-sidebar-brand-name {
  font-weight: 600;
  font-size: 14px;
  letter-spacing: -0.01em;
}

.v2-sidebar-brand-name span {
  color: var(--v2-ink-3);
  font-weight: 500;
}

.v2-sidebar-search {
  padding: 12px 12px 8px;
}

.v2-sidebar-search-inner {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 10px;
  background: var(--v2-surface-2);
  border-radius: 8px;
  border: 1px solid transparent;
  font-size: 12.5px;
  color: var(--v2-ink-3);
}

.v2-sidebar-search-kbd {
  margin-left: auto;
  font-size: 10.5px;
  color: var(--v2-ink-4);
  padding: 1px 5px;
  border: 1px solid var(--v2-line-2);
  border-radius: 4px;
  font-family: 'JetBrains Mono', monospace;
}

.v2-sidebar-nav {
  padding: 4px 8px;
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
}

.v2-sidebar-nav a,
.v2-sidebar-nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 10px;
  margin: 1px 0;
  border-radius: 7px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  color: var(--v2-ink-2);
  text-decoration: none;
  position: relative;
  background: transparent;
  border: none;
  width: 100%;
  text-align: left;
  font-family: inherit;
}

.v2-sidebar-nav a:hover,
.v2-sidebar-nav-item:hover {
  background: var(--v2-hover);
  color: var(--v2-brand-2);
}

.v2-sidebar-nav a:hover svg,
.v2-sidebar-nav-item:hover svg {
  color: var(--v2-brand);
  stroke: var(--v2-brand);
}

.v2-sidebar-nav a.active,
.v2-sidebar-nav-item.active {
  color: var(--v2-brand-2);
  font-weight: 600;
}

.v2-sidebar-nav a.active svg,
.v2-sidebar-nav-item.active svg {
  color: var(--v2-brand);
  stroke: var(--v2-brand);
}

.v2-sidebar-active-bar {
  position: absolute;
  left: 0;
  top: 6px;
  bottom: 6px;
  width: 2.5px;
  background: var(--v2-brand);
  border-radius: 2px;
}

.v2-submenu {
  position: relative;
  margin-left: 17px;
  padding-left: 0;
  border-left: 1px solid var(--v2-line);
}

.v2-submenu a,
.v2-submenu .v2-sidebar-nav-item {
  padding-left: 18px !important;
}

.v2-sidebar-nav a svg,
.v2-sidebar-nav-item svg {
  width: 15px;
  height: 15px;
  flex-shrink: 0;
  color: var(--v2-ink-3);
  stroke: var(--v2-ink-3);
}

.v2-sidebar-footer {
  padding: 10px 8px;
  border-top: 1px solid var(--v2-line);
}

/* ── Sidebar collapsed state ────────────────── */

.v2-sidebar.v2-sidebar-collapsed {
  width: 56px;
}

.v2-sidebar.v2-sidebar-collapsed .v2-sidebar-brand {
  justify-content: center;
  padding: 0;
}

.v2-sidebar.v2-sidebar-collapsed .v2-sidebar-brand-link {
  display: none !important;
}

.v2-sidebar.v2-sidebar-collapsed .v2-sidebar-brand-name,
.v2-sidebar.v2-sidebar-collapsed .v2-sidebar-search,
.v2-sidebar.v2-sidebar-collapsed .v2-submenu-chevron,
.v2-sidebar.v2-sidebar-collapsed .v2-sidebar-label {
  display: none;
}

.v2-sidebar.v2-sidebar-collapsed .v2-sidebar-nav a,
.v2-sidebar.v2-sidebar-collapsed .v2-sidebar-nav .v2-sidebar-nav-item {
  justify-content: center;
  padding: 8px 0;
}

.v2-sidebar.v2-sidebar-collapsed .v2-sidebar-nav a svg,
.v2-sidebar.v2-sidebar-collapsed .v2-sidebar-nav .v2-sidebar-nav-item svg {
  width: 18px;
  height: 18px;
}

.v2-sidebar.v2-sidebar-collapsed .v2-submenu {
  margin-left: 0;
  border-left: none;
}

.v2-sidebar.v2-sidebar-collapsed .v2-submenu a,
.v2-sidebar.v2-sidebar-collapsed .v2-submenu .v2-sidebar-nav-item {
  padding-left: 0 !important;
  justify-content: center;
  padding: 8px 0;
}

/* Submenu icons: hidden in expanded, shown in collapsed */
.v2-submenu-icon {
  display: none;
  width: 15px;
  height: 15px;
  flex-shrink: 0;
}

.v2-sidebar.v2-sidebar-collapsed .v2-sidebar-nav a svg.v2-submenu-icon,
.v2-sidebar.v2-sidebar-collapsed .v2-sidebar-nav .v2-sidebar-nav-item svg.v2-submenu-icon {
  display: block;
  width: 15px;
  height: 15px;
}

.v2-sidebar.v2-sidebar-collapsed .v2-sidebar-footer a,
.v2-sidebar.v2-sidebar-collapsed .v2-sidebar-footer .v2-sidebar-nav-item {
  justify-content: center;
  padding: 8px 0;
}

.v2-sidebar.v2-sidebar-collapsed .v2-sidebar-footer a svg,
.v2-sidebar.v2-sidebar-collapsed .v2-sidebar-footer .v2-sidebar-nav-item svg {
  width: 18px;
  height: 18px;
}

.v2-sidebar-tooltip {
  position: fixed;
  left: 62px;
  padding: 5px 10px;
  background: var(--v2-ink);
  color: #fff;
  font-size: 12px;
  font-weight: 500;
  border-radius: 6px;
  white-space: nowrap;
  pointer-events: none;
  z-index: 60;
  opacity: 0;
  transition: opacity 0.12s;
}

.v2-sidebar-tooltip.visible {
  opacity: 1;
}

/* ── Topbar ──────────────────────────────────── */

.v2-topbar {
  height: 52px;
  background: var(--v2-bg);
  border-bottom: 1px solid var(--v2-line);
  display: flex;
  align-items: center;
  padding: 0 18px;
  gap: 14px;
  flex-shrink: 0;
}

.v2-topbar-hamburger {
  width: 28px;
  height: 28px;
  border-radius: 7px;
  border: none;
  background: transparent;
  cursor: pointer;
  display: grid;
  place-items: center;
  color: var(--v2-ink-3);
  flex-shrink: 0;
}

.v2-topbar-hamburger:hover {
  background: var(--v2-hover);
  color: var(--v2-ink);
}

@media (min-width: 1024px) {
  .v2-topbar-hamburger {
    display: none;
  }
}

.v2-topbar-breadcrumb {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--v2-ink-3);
}

.v2-topbar-breadcrumb a {
  color: var(--v2-ink-3);
  text-decoration: none;
}

.v2-topbar-breadcrumb a:hover {
  color: var(--v2-ink);
}

.v2-topbar-breadcrumb-current {
  color: var(--v2-ink);
  font-weight: 500;
}

.v2-topbar-actions {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 10px;
}

.v2-topbar-icon-btn {
  width: 28px;
  height: 28px;
  border-radius: 7px;
  border: none;
  background: transparent;
  display: grid;
  place-items: center;
  cursor: pointer;
  color: var(--v2-ink-3);
  position: relative;
}

.v2-topbar-icon-btn:hover {
  color: var(--v2-ink);
}

.v2-topbar-notification-dot {
  position: absolute;
  top: 1px;
  right: 1px;
  width: 11px;
  height: 11px;
  background: var(--v2-brand);
  border-radius: 99px;
  border: 2px solid var(--v2-bg);
}

.v2-topbar-divider {
  width: 1px;
  height: 22px;
  background: var(--v2-line);
}

.v2-topbar-avatar {
  width: 30px;
  height: 30px;
  border-radius: 99px;
  background: var(--v2-brand);
  color: #fff;
  display: grid;
  place-items: center;
  font-weight: 600;
  font-size: 12px;
  font-family: 'JetBrains Mono', monospace;
}

/* ── Dialog / modal ─────────────────────────────── */

.v2-dialog-backdrop {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  justify-content: center;
  align-items: flex-start;
}

.v2-dialog-overlay {
  position: absolute;
  inset: 0;
  background: rgba(10, 14, 26, 0.45);
}

.v2-dialog-card {
  position: relative;
  background: var(--v2-bg);
  border: 1px solid var(--v2-line);
  border-radius: 12px;
  box-shadow: 0 24px 48px -16px rgba(10,14,26,0.24),
              0 4px 12px -4px rgba(10,14,26,0.08);
  display: flex;
  flex-direction: column;
  width: min(480px, calc(100% - 32px));
  max-height: calc(100vh - 100px);
}

.v2-dialog-card-md {
  width: min(600px, calc(100% - 32px));
}

/* Mobile fullscreen variant for dialogs that wrap workflows
   (status pickers, etc.). Applied via `.v2-dialog-card-fullscreen-mobile`. */
@media (max-width: 639px) {
  .v2-dialog-card.v2-dialog-card-fullscreen-mobile {
    width: 100%;
    height: 100vh;
    height: 100dvh;
    max-height: none;
    margin: 0 !important;
    border-radius: 0;
    border: none;
    box-shadow: none;
  }
  .v2-dialog-card-fullscreen-mobile-wrap .v2-dialog-backdrop {
    align-items: stretch;
  }
  .v2-dialog-card-fullscreen-mobile-wrap .v2-dialog-overlay {
    display: none;
  }

  /* Hide the "Stato attuale" / "Da X → Y" hint label on mobile — cleaner UI */
  .v2-dialog-card-fullscreen-mobile #v2-stato-footer-left,
  .v2-dialog-card-fullscreen-mobile #v2-status-footer-hint {
    display: none !important;
  }

  /* Full-width primary + secondary CTAs on mobile, stacked with primary on top */
  .v2-dialog-card-fullscreen-mobile .v2-btn {
    width: 100%;
    justify-content: center;
  }
  .v2-dialog-card-fullscreen-mobile > div:last-child {
    flex-direction: column-reverse !important;
    align-items: stretch !important;
    gap: 10px !important;
    padding: 16px 20px calc(16px + env(safe-area-inset-bottom, 0px)) !important;
  }
  .v2-dialog-card-fullscreen-mobile > div:last-child > div:not([id]) {
    margin: 0 !important;
    display: flex !important;
    flex-direction: column-reverse !important;
    gap: 10px !important;
    width: 100%;
  }

  /* Same fullscreen-mobile treatment auto-applied to delete confirm dialogs
     so we don't need to tag the class onto every detail-v2 page. Scoped by
     id prefix; same column-reverse / full-width-CTA behavior. */
  #v2-delete-dialog .v2-dialog-backdrop,
  #v2-delete-modal .v2-dialog-backdrop {
    align-items: stretch;
  }
  #v2-delete-dialog .v2-dialog-overlay,
  #v2-delete-modal .v2-dialog-overlay {
    display: none;
  }
  #v2-delete-dialog .v2-dialog-card,
  #v2-delete-modal .v2-dialog-card {
    width: 100% !important;
    height: 100vh !important;
    height: 100dvh !important;
    max-height: none !important;
    margin: 0 !important;
    border-radius: 0 !important;
    border: none !important;
    box-shadow: none !important;
  }
  #v2-delete-dialog .v2-btn,
  #v2-delete-modal .v2-btn {
    width: 100%;
    justify-content: center;
  }
  #v2-delete-dialog .v2-dialog-card > div:last-child,
  #v2-delete-modal .v2-dialog-card > div:last-child {
    flex-direction: column-reverse !important;
    align-items: stretch !important;
    gap: 10px !important;
    padding: 16px 20px calc(16px + env(safe-area-inset-bottom, 0px)) !important;
  }
  #v2-delete-dialog .v2-dialog-card > div:last-child > div:not([id]),
  #v2-delete-modal .v2-dialog-card > div:last-child > div:not([id]) {
    margin: 0 !important;
    display: flex !important;
    flex-direction: column-reverse !important;
    gap: 10px !important;
    width: 100%;
  }

  /* Sticky footer: keep CTA row pinned to the bottom of the viewport when the
     content overflows, and push it to the bottom even when content is short.
     Card scrolls internally; footer rides the bottom edge as the user scrolls. */
  .v2-dialog-card-fullscreen-mobile,
  #v2-delete-dialog .v2-dialog-card,
  #v2-delete-modal .v2-dialog-card {
    overflow-y: auto !important;
    overflow-x: hidden !important;
    -webkit-overflow-scrolling: touch;
  }
  .v2-dialog-card-fullscreen-mobile > div:last-child,
  #v2-delete-dialog .v2-dialog-card > div:last-child,
  #v2-delete-modal .v2-dialog-card > div:last-child {
    position: sticky !important;
    bottom: 0;
    margin-top: auto !important;
    background: var(--v2-bg);
    border-top: 1px solid var(--v2-line);
    z-index: 1;
  }
}

/* ── Tooltip / popover ───────────────────────── */

.v2-tooltip-trigger { position: relative; }
.v2-tooltip-trigger .v2-tooltip {
  position: absolute;
  z-index: 50;
  opacity: 0;
  visibility: hidden;
  transition: opacity .15s, visibility .15s;
  pointer-events: none;
}
.v2-tooltip-trigger:hover .v2-tooltip {
  opacity: 1;
  visibility: visible;
}

.v2-tooltip {
  background: var(--v2-ink);
  color: #fff;
  border-radius: 8px;
  padding: 8px 12px;
  font-size: 12px;
  line-height: 1.4;
  box-shadow: 0 8px 24px rgba(10,14,26,0.2);
  white-space: nowrap;
  max-width: 320px;
}

.v2-tooltip-rich {
  padding: 14px 16px;
  border-radius: 10px;
  white-space: normal;
}

.v2-tooltip-bottom { top: 100%; margin-top: 6px; }
.v2-tooltip-top { bottom: 100%; margin-bottom: 6px; }
.v2-tooltip-left { right: 0; }

.v2-tooltip-kbd {
  padding: 2px 8px;
  background: rgba(255,255,255,0.12);
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: 4px;
  font-size: 11px;
  font-family: 'JetBrains Mono', ui-monospace, monospace;
}

@media (max-width: 640px) {
  .v2-tooltip-trigger .v2-tooltip { display: none; }
}

.v2-cursor-tooltip {
  position: fixed;
  z-index: 50;
  pointer-events: none;
  background: var(--v2-ink);
  color: #fff;
  font-size: 12px;
  line-height: 1.4;
  border-radius: 6px;
  padding: 5px 10px;
  box-shadow: 0 4px 12px rgba(10,14,26,0.15);
  max-width: 320px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  display: none;
}

/* ── Empty state ─────────────────────────────── */

.v2-empty-state {
  text-align: center;
  padding: 48px 24px;
  border: 1.5px dashed var(--v2-line-2);
  border-radius: var(--v2-r-lg);
  background: #fff;
}
.v2-empty-state svg.v2-empty-icon {
  width: 40px;
  height: 40px;
  color: var(--v2-ink-4);
  margin: 0 auto 12px;
}
.v2-empty-state h3 {
  font-size: 14px;
  font-weight: 600;
  color: var(--v2-ink);
  margin: 0 0 4px;
}
.v2-empty-state p {
  font-size: 13px;
  color: var(--v2-ink-3);
  margin: 0 0 20px;
}
.v2-empty-state .v2-btn {
  margin-top: 0;
}

/* ── Buttons ─────────────────────────────────── */

.v2-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 7px 12px;
  font-family: inherit;
  font-size: 13px;
  font-weight: 500;
  border-radius: var(--v2-r-md);
  cursor: pointer;
  border: 1px solid transparent;
  transition: background .12s, border-color .12s;
  text-decoration: none;
  white-space: nowrap;
}

.v2-btn svg {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
}

.v2-btn-primary {
  background: var(--v2-brand);
  color: #fff;
}

.v2-btn-primary:hover {
  background: var(--v2-brand-2);
}

.v2-btn-secondary {
  background: var(--v2-bg);
  color: var(--v2-ink);
  border-color: var(--v2-line-2);
}

.v2-btn-secondary:hover {
  background: var(--v2-surface-2);
}

.v2-btn-ghost {
  background: transparent;
  color: var(--v2-ink-2);
}

.v2-btn-ghost:hover {
  background: var(--v2-surface-2);
}

.v2-btn-danger {
  background: var(--v2-bg);
  color: #991b1b;
  border-color: var(--v2-line-2);
}

.v2-btn-danger:hover {
  background: var(--v2-hover);
}

/* Danger menu item — dropdown/flyout delete/logout actions */
.v2-menu-danger {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 8px 10px;
  font-size: 13px;
  color: #991b1b;
  background: transparent;
  border: none;
  border-radius: var(--v2-r-sm);
  cursor: pointer;
  text-align: left;
  font-family: inherit;
}

.v2-menu-danger:hover {
  background: var(--v2-hover);
}

/* Tertiary / link-style button – subtle inline action (e.g. "Vedi cliente →") */
.v2-btn-tertiary {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 8px;
  margin: -4px -8px;
  font-family: inherit;
  font-size: 12.5px;
  font-weight: 500;
  color: var(--v2-ink-3);
  background: transparent;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.12s, color 0.12s;
}

.v2-btn-tertiary:hover {
  background: var(--v2-surface-2);
  color: var(--v2-ink);
}

.v2-btn-tertiary svg {
  width: 13px;
  height: 13px;
  flex-shrink: 0;
}

.v2-btn:disabled,
.v2-btn[disabled] {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Icon-only button variant */
.v2-btn-icon {
  padding: 9px;
}

/* Inline icon-only button (table rows, tight spaces) */
.v2-btn-icon-inline {
  padding: 4px;
  border-color: transparent;
  gap: 0;
}
.v2-btn-icon-inline:hover {
  border-color: transparent;
}

/* Action group: CTA + overflow icon button, matched heights */
.v2-action-group {
  display: inline-flex;
  align-items: stretch;
  gap: 8px;
}
.v2-action-group .v2-btn {
  align-self: stretch;
}

/* ── Input ───────────────────────────────────── */

.v2-input {
  width: 100%;
  padding: 7px 10px;
  font-family: inherit;
  font-size: 13px;
  background: var(--v2-bg);
  color: var(--v2-ink);
  border: 1px solid var(--v2-line-2);
  border-radius: var(--v2-r-md);
  transition: border-color .12s;
}

.v2-input::placeholder {
  color: var(--v2-ink-4);
}

.v2-input:focus {
  outline: none;
  border-color: var(--v2-ink);
}

/* ── Search bar ──────────────────────────────── */

.v2-search {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 10px;
  background: var(--v2-bg);
  border: 1px solid var(--v2-line-2);
  border-radius: var(--v2-r-md);
  transition: border-color .12s;
}

.v2-search:focus-within {
  border-color: var(--v2-ink);
}

.v2-search svg {
  flex-shrink: 0;
  width: 14px;
  height: 14px;
  color: var(--v2-ink-3);
  stroke: var(--v2-ink-3);
}

.v2-search input {
  flex: 1;
  width: 100%;
  border: none;
  outline: none;
  background: transparent;
  font-family: inherit;
  font-size: 13px;
  color: var(--v2-ink);
  padding: 0;
}

.v2-search input::placeholder {
  color: var(--v2-ink-4);
}

/* ── Filter button ───────────────────────────── */

.v2-filter-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--v2-bg);
  border: 1px solid var(--v2-line-2);
  border-radius: var(--v2-r-md);
  padding: 7px 12px;
  cursor: pointer;
  font-family: inherit;
  font-size: 13px;
  font-weight: 500;
  color: var(--v2-ink);
  white-space: nowrap;
}

.v2-filter-btn:hover {
  background: var(--v2-surface-2);
}

.v2-filter-label {
  color: var(--v2-ink-3);
  font-weight: 400;
}

.v2-filter-caret {
  font-size: 10px;
  color: var(--v2-ink-4);
}

/* ── Toolbar ─────────────────────────────────── */

.v2-toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding-bottom: 16px;
}

/* ── List surface (CalmListSurface) ──────────── */

.v2-list-surface {
  border: 1px solid var(--v2-line);
  border-radius: 10px;
  background: #fff;
  overflow: hidden;
}

.v2-list-surface-toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 14px;
  background: var(--v2-surface-2);
  border-bottom: 1px solid var(--v2-line);
}

.v2-list-surface .v2-table {
  min-width: 0;
}

.v2-list-surface .v2-table-wrap {
  overflow-x: auto;
}

/* ── KPI strip ───────────────────────────────── */

.v2-kpi-strip {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 0;
  margin-bottom: 36px;
}

.v2-kpi-cell {
  padding: 4px 24px;
  border-right: 1px solid var(--v2-line);
}

.v2-kpi-cell:first-child {
  padding-left: 0;
}

.v2-kpi-cell:last-child {
  border-right: none;
}

.v2-kpi-label {
  font-size: 12px;
  color: var(--v2-ink-3);
  font-weight: 500;
  margin-bottom: 8px;
}

.v2-kpi-value {
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 24px;
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--v2-ink);
  line-height: 1.1;
  white-space: nowrap;
}

/* ── Table ───────────────────────────────────── */

.v2-table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.v2-table {
  width: 100%;
  min-width: 800px;
  border-collapse: collapse;
}

.v2-table th {
  text-align: left;
  padding: 12px 12px 10px;
  font-size: 11px;
  font-weight: 500;
  color: var(--v2-ink-3);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  border-bottom: 1px solid var(--v2-line);
  white-space: nowrap;
  user-select: none;
}

.v2-sort-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: transparent;
  border: none;
  padding: 0;
  margin: 0;
  font: inherit;
  font-size: 11px;
  font-weight: 500;
  color: var(--v2-ink-3);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  cursor: pointer;
  width: 100%;
}

.v2-sort-btn:hover {
  color: var(--v2-ink-2);
}

.v2-sort-btn.active {
  color: var(--v2-ink-2);
}

.v2-table th.text-right {
  text-align: right;
}

.v2-table td {
  padding: 14px 12px;
  font-size: 13px;
  color: var(--v2-ink);
  vertical-align: middle;
  border-bottom: 1px solid var(--v2-line);
}

.v2-table td.text-right {
  text-align: right;
}

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

.v2-table tbody tr {
  cursor: pointer;
  transition: background .08s;
}

.v2-table tbody tr:hover {
  background: var(--v2-hover);
}

.v2-table tbody tr:hover .v2-row-title {
  color: var(--v2-brand-2) !important;
}

.v2-table tbody tr:hover .v2-row-icon {
  color: var(--v2-brand) !important;
  background: #fff !important;
}

.v2-table tbody tr:hover > td:last-child {
  color: var(--v2-brand) !important;
}

/* ── Supplier avatar (rounded-square + badge) ── */

.v2-row-icon-supplier {
  position: relative;
}

.v2-row-icon-supplier .v2-supplier-badge {
  position: absolute;
  bottom: -5px;
  right: -5px;
  width: 16px;
  height: 16px;
  display: grid;
  place-items: center;
  color: var(--v2-ink-3);
  transition: color .12s;
}

.v2-row-icon-supplier .v2-supplier-badge svg {
  width: 11px;
  height: 11px;
}

.v2-table tbody tr:hover .v2-supplier-badge {
  color: var(--v2-brand);
}

/* Static (non-clickable) variant — no hover, no pointer, no brand-color shifts */
.v2-table.v2-table-static tbody tr {
  cursor: default;
}

.v2-table.v2-table-static tbody tr:hover {
  background: transparent;
}

.v2-table.v2-table-static tbody tr:hover .v2-row-title,
.v2-table.v2-table-static tbody tr:hover > td:last-child {
  color: inherit !important;
}

.v2-table.v2-table-static tbody tr:hover .v2-row-icon {
  color: var(--v2-ink-3) !important;
  background: transparent !important;
}

.v2-table.v2-table-static tbody tr:hover .v2-supplier-badge {
  color: var(--v2-ink-3);
}

.v2-table tfoot td {
  padding: 14px 12px;
  font-size: 12.5px;
  border-top: 1px solid var(--v2-line);
  border-bottom: none;
}

/* ── Item table (create/edit line items) ──────── */

.v2-item-table-wrap {
  border: 1px solid var(--v2-line);
  border-radius: 10px;
  overflow: hidden;
  background: var(--v2-bg);
}

.v2-item-table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
}

.v2-item-table th {
  padding: 10px 12px;
  font-size: 12px;
  font-weight: 500;
  color: var(--v2-ink-3);
  letter-spacing: 0.02em;
  text-align: left;
  background: var(--v2-surface-2);
  border-bottom: 1px solid var(--v2-line);
}

.v2-item-table th:first-child { padding-left: 16px; }
.v2-item-table th:last-child { padding-right: 16px; }
.v2-item-table th.text-right { text-align: right; }

.v2-item-table td {
  padding: 10px 12px;
  font-size: 13px;
  color: var(--v2-ink);
  vertical-align: middle;
  border-bottom: 1px solid var(--v2-line);
}

.v2-item-table td:first-child { padding-left: 16px; }
.v2-item-table td:last-child { padding-right: 16px; }
.v2-item-table td.text-right { text-align: right; }
.v2-item-table tbody tr:last-child td { border-bottom: none; }

.v2-item-table tfoot td {
  padding: 8px 12px;
  font-size: 13px;
  color: var(--v2-ink-3);
  background: var(--v2-surface-2);
  border-top: 1px solid var(--v2-line);
  border-bottom: none;
}

.v2-item-table tfoot td:first-child { padding-left: 16px; }
.v2-item-table tfoot td:last-child { padding-right: 16px; }
.v2-item-table tfoot td.text-right { text-align: right; }

.v2-item-table tfoot tr:last-child td {
  font-size: 14px;
  font-weight: 600;
  color: var(--v2-ink);
  padding-top: 10px;
  padding-bottom: 10px;
}

/* ── Detail table (read-only line items in detail pages) ── */

.v2-detail-table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.v2-detail-table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
}

@media (max-width: 639px) {
  .v2-detail-table-wrap .v2-detail-table,
  .v2-detail-table-wrap > table {
    min-width: 560px;
  }
}

.v2-detail-table th {
  padding: 12px 12px 10px;
  font-size: 11px;
  font-weight: 500;
  color: var(--v2-ink-3);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  text-align: left;
  border-bottom: 1px solid var(--v2-line);
  white-space: nowrap;
}

.v2-detail-table th.text-right { text-align: right; }

.v2-detail-table td {
  padding: 12px;
  font-size: 13px;
  color: var(--v2-ink);
  vertical-align: middle;
  border-bottom: 1px solid var(--v2-line);
}

.v2-detail-table td.text-right { text-align: right; }
.v2-detail-table tbody tr:last-child td { border-bottom: none; }

.v2-detail-table tfoot td {
  padding: 11px 12px;
  font-size: 13px;
  color: var(--v2-ink-3);
  border-top: 1px solid var(--v2-line-2);
}

.v2-detail-table tfoot td.text-right { text-align: right; }

.v2-detail-table tfoot tr:last-child td {
  padding-top: 16px;
  font-size: 15px;
  font-weight: 600;
  color: var(--v2-ink);
}

/* ── Settings grid ────────────────────────────── */

.v2-settings-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--v2-line);
  cursor: pointer;
  transition: background .12s;
}

.v2-settings-item > div:first-child {
  transition: color .12s, background .12s;
}

.v2-settings-item > svg {
  transition: transform .12s, color .12s;
}

.v2-settings-item:hover {
  background: var(--v2-hover);
}

.v2-settings-item:hover > div:first-child {
  color: var(--v2-brand) !important;
  background: #fff !important;
}

.v2-settings-item:hover > div:nth-child(2) > div:first-child {
  color: var(--v2-brand-2) !important;
}

.v2-settings-item:hover > svg {
  color: var(--v2-brand) !important;
  transform: translateX(2px);
}

.v2-settings-item:nth-child(odd) {
  border-right: 1px solid var(--v2-line);
}

.v2-settings-group[hidden] {
  display: none;
}

.v2-settings-item[hidden] {
  display: none;
}

/* ── Appointment indicator ────────────────────── */

.v2-appt {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  font-weight: 500;
  white-space: nowrap;
  vertical-align: baseline;
  color: var(--v2-ink-3);
}

.v2-appt svg {
  flex-shrink: 0;
  transform: translateY(0.5px);
}

.v2-appt-soon {
  color: var(--v2-warn);
}

.v2-appt-today {
  color: var(--v2-brand);
}

/* ── SDI label (invoice table, mirrors v2-appt) ── */

.v2-sdi {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  font-weight: 500;
  white-space: nowrap;
  margin-top: 2px;
}

.v2-sdi .v2-status-dot { flex-shrink: 0; }

.v2-sdi-sent { color: var(--v2-good); }
.v2-sdi-sent .v2-status-dot { background: var(--v2-good); }

.v2-sdi-pending { color: var(--v2-warn); }
.v2-sdi-pending .v2-status-dot { background: var(--v2-warn); }

.v2-sdi-warning { color: var(--v2-danger); }
.v2-sdi-warning .v2-status-dot { background: var(--v2-danger); }

.v2-sdi-rejected { color: var(--v2-danger); }
.v2-sdi-rejected .v2-status-dot { background: var(--v2-danger); }

/* ── Status ──────────────────────────────────── */

.v2-status {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 12.5px;
  font-weight: 500;
}

.v2-status-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  display: inline-block;
}

.v2-status-bozza, .v2-status-draft { color: var(--v2-warn); }
.v2-status-bozza .v2-status-dot, .v2-status-draft .v2-status-dot { background: var(--v2-warn); }

.v2-status-lavorazione, .v2-status-started { color: var(--v2-brand); }
.v2-status-lavorazione .v2-status-dot, .v2-status-started .v2-status-dot { background: var(--v2-brand); }

.v2-status-completata, .v2-status-completed { color: var(--v2-good); }
.v2-status-completata .v2-status-dot, .v2-status-completed .v2-status-dot { background: var(--v2-good); }

.v2-status-waiting { color: #a16207; }
.v2-status-waiting .v2-status-dot { background: #a16207; }

.v2-status-delivered { color: var(--v2-ink-3); }
.v2-status-delivered .v2-status-dot { background: var(--v2-ink-3); }

.v2-status-accepted { color: var(--v2-good); }
.v2-status-accepted .v2-status-dot { background: var(--v2-good); }

.v2-status-rejected { color: var(--v2-danger); }
.v2-status-rejected .v2-status-dot { background: var(--v2-danger); }

.v2-status-annullata, .v2-status-archived { color: var(--v2-ink-4); }
.v2-status-annullata .v2-status-dot, .v2-status-archived .v2-status-dot { background: var(--v2-ink-4); }

/* Channel variants */
.v2-status-email { color: var(--v2-brand); }
.v2-status-email .v2-status-dot { background: var(--v2-brand); }

.v2-status-sms { color: var(--v2-good); }
.v2-status-sms .v2-status-dot { background: var(--v2-good); }

.v2-status-whatsapp { color: #16a34a; }
.v2-status-whatsapp .v2-status-dot { background: #16a34a; }

/* Entity type variants */
.v2-status-worksheet { color: var(--v2-brand); }
.v2-status-worksheet .v2-status-dot { background: var(--v2-brand); }

.v2-status-quote { color: var(--v2-warn); }
.v2-status-quote .v2-status-dot { background: var(--v2-warn); }

.v2-status-invoice { color: var(--v2-good); }
.v2-status-invoice .v2-status-dot { background: var(--v2-good); }

.v2-status-calendar, .v2-status-appointment { color: #7c3aed; }
.v2-status-calendar .v2-status-dot, .v2-status-appointment .v2-status-dot { background: #7c3aed; }

.v2-status-inspection { color: var(--v2-danger); }
.v2-status-inspection .v2-status-dot { background: var(--v2-danger); }

.v2-status-generic { color: var(--v2-ink-3); }
.v2-status-generic .v2-status-dot { background: var(--v2-ink-3); }

/* Stock status variants (inventory) */
.v2-status-outofstock { color: var(--v2-danger); }
.v2-status-outofstock .v2-status-dot { background: var(--v2-danger); }

.v2-status-lowstock { color: var(--v2-warn); }
.v2-status-lowstock .v2-status-dot { background: var(--v2-warn); }

/* Tyreset status variants */
.v2-status-deposited { color: var(--v2-good); }
.v2-status-deposited .v2-status-dot { background: var(--v2-good); }

.v2-status-mounted { color: var(--v2-brand); }
.v2-status-mounted .v2-status-dot { background: var(--v2-brand); }

.v2-status-collected { color: var(--v2-ink-3); }
.v2-status-collected .v2-status-dot { background: var(--v2-ink-3); }

.v2-status-disposed { color: var(--v2-warn); }
.v2-status-disposed .v2-status-dot { background: var(--v2-warn); }

/* Season type variants (tyre storage) */
.v2-status-winter { color: #0369a1; }
.v2-status-winter .v2-status-dot { background: #0369a1; }

.v2-status-summer { color: #b45309; }
.v2-status-summer .v2-status-dot { background: #b45309; }

.v2-status-allseason { color: #15803d; }
.v2-status-allseason .v2-status-dot { background: #15803d; }

/* ── Amount ──────────────────────────────────── */

.v2-amount {
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 12.5px;
  font-weight: 500;
  white-space: nowrap;
}

.v2-amount-strong {
  font-weight: 600;
}

.v2-amount-zero {
  color: var(--v2-good);
}

/* ── Pagination ──────────────────────────────── */

.v2-pagination {
  display: flex;
  align-items: center;
  gap: 12px;
}

.v2-pagination-info {
  font-size: 12.5px;
  color: var(--v2-ink-3);
}

.v2-pagination-buttons {
  margin-left: auto;
  display: flex;
  gap: 8px;
}

.v2-pager-btn {
  padding: 6px 12px;
  font-family: inherit;
  font-size: 12.5px;
  font-weight: 500;
  background: #fff;
  color: var(--v2-ink);
  border: 1px solid var(--v2-line-2);
  border-radius: 6px;
  cursor: pointer;
  transition: background .12s;
}

.v2-pager-btn:hover:not(:disabled) {
  background: var(--v2-surface-2);
}

.v2-pager-btn:disabled {
  color: var(--v2-ink-4);
  border-color: var(--v2-line);
  opacity: 0.6;
  cursor: default;
}

/* ── Page header ─────────────────────────────── */

.v2-page-header {
  display: flex;
  align-items: flex-start;
  gap: 24px;
  margin-bottom: 28px;
}

.v2-page-header-content {
  flex: 1;
  min-width: 0;
}

.v2-page-header-subtitle {
  margin: 6px 0 0;
  font-size: 13.5px;
  color: var(--v2-ink-3);
  line-height: 1.55;
}

.v2-page-header-actions {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}

/* ── Data row ────────────────────────────────── */

.v2-data-row {
  display: grid;
  grid-template-columns: 200px 1fr;
  align-items: baseline;
  gap: 16px;
  padding: 10px 0;
  border-top: 1px solid var(--v2-line);
}

.v2-data-row-label {
  font-size: 12.5px;
  color: var(--v2-ink-3);
  font-weight: 400;
}

.v2-data-row-value {
  font-size: 13.5px;
  color: var(--v2-ink);
}

.v2-data-row-empty {
  color: var(--v2-ink-4);
}

/* ── Section ─────────────────────────────────── */

.v2-section {
  padding-top: 32px;
}

.v2-section-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
  min-height: 24px;
}

.v2-section-count {
  font-size: 11px;
  color: var(--v2-ink-4);
  font-weight: 500;
  letter-spacing: 0.02em;
}

.v2-section-link {
  margin-left: auto;
  background: transparent;
  border: none;
  padding: 0;
  cursor: pointer;
  font-size: 12.5px;
  color: var(--v2-ink-3);
  font-family: inherit;
  text-decoration: none;
}

.v2-section-link:hover {
  color: var(--v2-ink);
}

/* ── Tabs ────────────────────────────────────── */

.v2-tabs {
  display: flex;
  gap: 24px;
  border-bottom: 1px solid var(--v2-line);
}

.v2-tab {
  background: transparent;
  border: none;
  padding: 12px 0;
  margin-bottom: -1px;
  cursor: pointer;
  font-size: 13.5px;
  font-family: inherit;
  font-weight: 500;
  color: var(--v2-ink-3);
  border-bottom: 2px solid transparent;
  display: inline-flex;
  align-items: baseline;
  gap: 6px;
  text-decoration: none;
  white-space: nowrap;
}

.v2-tab:hover {
  color: var(--v2-ink-2);
}

.v2-tab.active {
  font-weight: 600;
  color: var(--v2-ink);
  border-bottom-color: var(--v2-brand);
}

.v2-tab-count {
  font-size: 12px;
  color: var(--v2-ink-4);
  font-weight: 400;
}

/* ── Two-column layout for detail pages ──────── */

.v2-two-col {
  display: grid;
  grid-template-columns: 1.5fr 1fr;
  gap: 64px;
}

.v2-report-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 32px;
  padding-top: 40px;
}

@media (max-width: 639px) {
  .v2-report-row {
    grid-template-columns: 1fr;
    gap: 24px;
  }

  /* Customer + vehicle row on detail pages — stack on mobile.
     !important needed because the host markup sets grid-template-columns via inline style. */
  .v2-cv-row {
    grid-template-columns: 1fr !important;
    gap: 24px !important;
  }

  /* Create/edit form grids — collapse any multi-column grid to a single column on mobile.
     Targets inline-styled grids inside form containers; !important beats inline grid-template-columns. */
  .v2-container-form [style*="grid-template-columns:1fr 1fr"],
  .v2-container-form [style*="grid-template-columns: 1fr 1fr"],
  .v2-container-form [style*="grid-template-columns:repeat(2"],
  .v2-container-form [style*="grid-template-columns: repeat(2"],
  .v2-container-form [style*="grid-template-columns:360px"],
  .v2-container-form [style*="grid-template-columns: 360px"] {
    grid-template-columns: 1fr !important;
  }

  /* Settings landing — stack the item cards single-column on mobile */
  .v2-container-medium [style*="grid-template-columns:repeat(2, 1fr)"],
  .v2-container-medium [style*="grid-template-columns: repeat(2, 1fr)"] {
    grid-template-columns: 1fr !important;
  }
}

/* ── Vehicle line ────────────────────────────── */

.v2-vehicle-line {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 8px;
  border-top: 1px solid var(--v2-line);
  text-decoration: none;
  color: inherit;
  cursor: pointer;
  transition: background .08s;
}

.v2-vehicle-line:last-child {
  border-bottom: 1px solid var(--v2-line);
}

.v2-vehicle-line:hover {
  background: var(--v2-hover);
}
.v2-vehicle-line:hover > span:first-child,
.v2-vehicle-line:hover > div:first-child > div:first-child {
  color: var(--v2-brand-2) !important;
}
.v2-vehicle-line:hover .v2-vehicle-line-chevron {
  color: var(--v2-brand) !important;
}

.v2-vehicle-line-chevron {
  color: var(--v2-ink-4);
  flex-shrink: 0;
  margin-left: auto;
}

/* ── Topbar mobile/desktop avatar toggle ─────── */

/* Mobile avatar: show only below lg */
@media (max-width: 1023px) {
  .v2-topbar-mobile-avatar {
    display: flex !important;
  }
}

/* ── Accordion ───────────────────────────────── */

.v2-accordion {
  background: var(--v2-bg);
  border: 1px solid var(--v2-line);
  border-radius: var(--v2-r-lg);
  overflow: hidden;
}

.v2-accordion-header {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 14px 18px;
  border: none;
  background: transparent;
  cursor: pointer;
  font-family: inherit;
  font-size: 13.5px;
  font-weight: 500;
  color: var(--v2-ink);
  text-align: left;
  transition: background 0.08s;
}

.v2-accordion-header:hover {
  background: var(--v2-hover);
}

.v2-accordion-body {
  border-top: 1px solid var(--v2-line);
}

/* ── Spinner ─────────────────────────────────── */

.v2-spinner {
  width: 24px;
  height: 24px;
  border: 3px solid var(--v2-line);
  border-top-color: var(--v2-brand);
  border-radius: 50%;
  animation: v2spin 0.6s linear infinite;
}

@keyframes v2spin {
  to { transform: rotate(360deg); }
}

/* ── Responsive ──────────────────────────────── */

@media (max-width: 1023px) {
  .v2-sidebar {
    display: none;
  }

  .v2-topbar-breadcrumb {
    display: none;
  }

  .v2-topbar-icon-btn {
    display: none;
  }

  .v2-topbar-divider {
    display: none;
  }

  .v2-container,
  .v2-container-medium,
  .v2-container-form {
    padding: 24px 16px 48px;
  }

  .v2-two-col {
    grid-template-columns: 1fr;
    gap: 0;
  }

  .v2-kpi-strip {
    gap: 32px;
  }

  .v2-page-header {
    flex-direction: column;
    gap: 16px;
  }

  .v2-toolbar {
    flex-wrap: wrap;
  }

  /* Bigger touch targets for mobile nav items */
  .v2-sidebar-nav a,
  .v2-sidebar-nav-item {
    padding: 10px 12px;
    font-size: 14px;
    gap: 12px;
  }

  .v2-sidebar-nav a svg,
  .v2-sidebar-nav-item svg {
    width: 18px;
    height: 18px;
  }
}

/* Mobile-only selects that replace UI patterns built for desktop:
   - `.v2-tabs-mobile`  → replaces `.v2-tabs` tab bar  (built by v2-mobile-tabs.js)
   - `.v2-kebab-mobile` → replaces the `...` overflow kebab + flyout
                          (built by v2-mobile-kebab.js)
   Both are hidden on desktop; the original markup stays so JS can read it. */
.v2-tabs-mobile,
.v2-kebab-mobile { display: none; }

@media (max-width: 639px) {
  .v2-tabs { display: none !important; }

  /* Hide the desktop kebab button on mobile; the script inserts a native
     <select> next to it that opens the same actions. */
  .v2-page-header-actions .v2-btn-icon[onclick*="classList.toggle"] {
    display: none !important;
  }

  .v2-tabs-mobile,
  .v2-kebab-mobile {
    display: block;
    width: 100%;
    padding: 9px 36px 9px 12px;
    font-family: inherit;
    font-size: 13.5px;
    font-weight: 500;
    color: var(--v2-ink);
    background-color: var(--v2-bg);
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%231f2937' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'><polyline points='6 9 12 15 18 9'></polyline></svg>");
    background-repeat: no-repeat;
    background-position: right 10px center;
    border: 1px solid var(--v2-line-2);
    border-radius: var(--v2-r-md);
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    cursor: pointer;
    transition: border-color .12s, box-shadow .12s;
  }
  .v2-tabs-mobile { margin-bottom: 16px; }
  .v2-kebab-mobile {
    text-align: center;
    text-align-last: center;
    padding-left: 36px;
  }
  .v2-tabs-mobile:focus,
  .v2-kebab-mobile:focus {
    outline: none;
    border-color: var(--v2-brand);
    box-shadow: 0 0 0 3px rgba(37,99,235,0.1);
  }

  /* Page header — full-width action buttons, stacked vertically */
  .v2-page-header-actions {
    width: 100%;
    flex-direction: column;
    align-items: stretch;
  }

  .v2-page-header-actions .v2-btn {
    width: 100%;
    justify-content: center;
  }

  /* Overflow kebab (`...`) in detail-view headers: stretch to full width on
     its own row, matching the other header buttons. Overrides inline
     `width:34px; height:34px;` set for desktop sizing. Scoped to
     `.v2-page-header-actions` so kebab-shaped buttons inside body tables
     (document rows, etc.) keep their compact size. */
  .v2-page-header-actions .v2-btn-icon {
    width: 100% !important;
    height: auto !important;
  }

  /* Unwrap any `.v2-action-group` (CTA + kebab pair) so its children stack
     individually instead of staying inline-flex on the same row. */
  .v2-page-header-actions .v2-action-group {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    width: 100%;
    gap: 6px;
  }
  .v2-page-header-actions .v2-action-group > div {
    width: 100%;
  }

  /* List toolbar — every control stacks full-width on its own row */
  .v2-list-surface-toolbar {
    flex-direction: column;
    align-items: stretch;
  }

  .v2-list-surface-toolbar > * {
    width: 100%;
    flex: none;
  }

  .v2-list-surface-toolbar .v2-search {
    width: 100%;
  }

  /* Triggers inside toolbar wrappers (filter, export dropdown) — full-width too */
  .v2-list-surface-toolbar .v2-btn,
  .v2-list-surface-toolbar .v2-filter-btn,
  .v2-list-surface-toolbar select {
    width: 100%;
    justify-content: center;
  }

  /* Lists — let tables overflow horizontally so all columns stay reachable */
  .v2-list-surface {
    overflow: visible;
  }

  /* Settings → Abbonamento billing strip: stack the 3 columns (Il tuo piano /
     Crediti / Utilizzo) so they no longer overflow on narrow screens. Swap
     the inline border-right column dividers for border-bottom row dividers. */
  .v2-billing-strip {
    grid-template-columns: 1fr !important;
  }
  .v2-billing-strip > div {
    padding: 20px !important;
    border-right: none !important;
    border-bottom: 1px solid var(--v2-line);
  }
  .v2-billing-strip > div:last-child {
    border-bottom: none;
  }

  /* Plan picker rows: stack info + price/CTA column, full-width "Passa a …"
     button, single-column feature list. */
  .v2-plan-row {
    grid-template-columns: 1fr !important;
    gap: 16px !important;
    padding: 18px !important;
  }
  .v2-plan-row > div:last-child {
    align-items: stretch !important;
    min-width: 0 !important;
    flex-direction: column;
    gap: 12px;
  }
  .v2-plan-row > div:last-child > div:first-child {
    text-align: left !important;
  }
  .v2-plan-row .v2-plan-btn,
  .v2-plan-row .v2-btn {
    width: 100%;
    justify-content: center;
  }
  .v2-plan-row ul {
    grid-template-columns: 1fr !important;
  }

  /* Settings → Abbonamento modals (Cambia piano / Acquista crediti) follow
     the same fullscreen-mobile pattern as the delete confirm dialogs. The
     outer `#<id>` element IS the backdrop on these two modals (no wrap div),
     so the selector targets the id directly instead of `… .v2-dialog-backdrop`. */
  #plan-change-modal,
  #credits-purchase-modal {
    align-items: stretch !important;
    padding-top: 0 !important;
  }
  #plan-change-modal .v2-dialog-overlay,
  #credits-purchase-modal .v2-dialog-overlay {
    display: none;
  }
  #plan-change-modal .v2-dialog-card,
  #credits-purchase-modal .v2-dialog-card {
    width: 100% !important;
    height: 100vh !important;
    height: 100dvh !important;
    max-height: none !important;
    margin: 0 !important;
    border-radius: 0 !important;
    border: none !important;
    box-shadow: none !important;
    overflow-y: auto !important;
    overflow-x: hidden !important;
    -webkit-overflow-scrolling: touch;
  }
  #plan-change-modal .v2-btn,
  #credits-purchase-modal .v2-btn {
    width: 100%;
    justify-content: center;
  }
  #plan-change-modal .v2-dialog-card > div:last-child,
  #credits-purchase-modal .v2-dialog-card > div:last-child {
    position: sticky !important;
    bottom: 0;
    margin-top: auto !important;
    background: var(--v2-bg);
    border-top: 1px solid var(--v2-line);
    z-index: 1;
    flex-direction: column-reverse !important;
    align-items: stretch !important;
    gap: 10px !important;
    padding: 16px 20px calc(16px + env(safe-area-inset-bottom, 0px)) !important;
  }
  #plan-change-modal .v2-dialog-card > div:last-child > div:not([id]),
  #credits-purchase-modal .v2-dialog-card > div:last-child > div:not([id]) {
    margin: 0 !important;
    display: flex !important;
    flex-direction: column-reverse !important;
    gap: 10px !important;
    width: 100%;
  }

  /* KPI strips: on mobile, stack each metric on its own row, left-aligned.
     Same pattern report-list uses via `.v2-kpi-strip` — just applied to the
     inline-flex KPI rows on other detail/list pages via the `v2-kpi-row` tag. */
  .v2-kpi-row {
    flex-direction: column !important;
    align-items: flex-start !important;
    gap: 12px !important;
  }

  /* Key/value data rows on detail-v2 pages: stack label above value, full-width.
     Covers both `.v2-data-row` (class) and the inline-grid 200px+1fr variant
     used in a couple of pages (checkin-detail). */
  .v2-data-row,
  [style*="grid-template-columns:200px 1fr"],
  [style*="grid-template-columns: 200px 1fr"] {
    grid-template-columns: 1fr !important;
    gap: 4px !important;
  }
  .v2-data-row-label { font-size: 12px; }

  .v2-list-surface .v2-table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border-bottom-left-radius: 10px;
    border-bottom-right-radius: 10px;
  }

  .v2-list-surface .v2-table {
    min-width: 720px;
  }

  /* KPI strip — drop dividers and tight padding when cells wrap onto multiple rows.
     !important needed because some pages set divider/padding via inline styles. */
  .v2-kpi-strip {
    row-gap: 20px;
  }

  .v2-kpi-cell {
    border-right: none !important;
    padding: 4px 0 !important;
  }
}

/* ── Calendar ───────────────────────────────── */

.v2-cal-period {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 20px 0 14px;
  border-bottom: 1px solid var(--v2-line);
  margin-bottom: 0;
}

.v2-cal-period-left {
  flex: 1;
  min-width: 0;
}

.v2-cal-period-right {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.v2-cal-nav-btn {
  width: 28px;
  height: 28px;
  background: #fff;
  border: 1px solid var(--v2-line-2);
  border-radius: 6px;
  display: grid;
  place-items: center;
  cursor: pointer;
  color: var(--v2-ink-2);
}

.v2-cal-nav-btn:hover {
  background: var(--v2-surface-2);
}

.v2-cal-container {
  border: 1px solid var(--v2-line);
  border-radius: 10px;
  background: #fff;
  overflow: hidden;
  margin-top: 16px;
}

.v2-cal-header {
  display: grid;
  grid-template-columns: 60px repeat(7, 1fr);
  height: 44px;
  border-bottom: 1px solid var(--v2-line);
}

.v2-cal-header-day {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 500;
  color: var(--v2-ink-3);
  border-left: 1px solid var(--v2-line);
}

.v2-cal-header-day.today {
  font-weight: 600;
  color: var(--v2-ink);
}

.v2-cal-header-day.today .v2-cal-day-num {
  color: var(--v2-brand);
}

.v2-cal-day-num {
  color: var(--v2-ink-2);
  font-weight: 600;
}

.v2-cal-body {
  display: grid;
  grid-template-columns: 60px repeat(7, 1fr);
  position: relative;
}

.v2-cal-time-col {
  position: relative;
}

.v2-cal-hour-label {
  position: absolute;
  right: 12px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 11.5px;
  color: var(--v2-ink-3);
  line-height: 1;
}

.v2-cal-grid-area {
  grid-column: 2 / -1;
  position: relative;
  min-height: 0;
}

.v2-cal-day-col {
  position: absolute;
  top: 0;
  bottom: 0;
  border-left: 1px solid var(--v2-line);
}

.v2-cal-day-col.today {
  background: rgba(37, 99, 235, 0.025);
}

.v2-cal-gridline {
  position: absolute;
  left: 0;
  right: 0;
  border-bottom: 1px solid var(--v2-line);
}

.v2-cal-gridline-half {
  position: absolute;
  left: 0;
  right: 0;
  border-bottom: 1px dashed var(--v2-line);
  opacity: 0.5;
}

.v2-cal-now-line {
  position: absolute;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--v2-brand);
  z-index: 30;
}

.v2-cal-now-dot {
  position: absolute;
  left: 0;
  width: 8px;
  height: 8px;
  margin-top: -3px;
  border-radius: 50%;
  background: var(--v2-brand);
  z-index: 30;
}

.v2-cal-event {
  position: absolute;
  border-radius: 3px;
  cursor: pointer;
  overflow: hidden;
  padding: 6px 10px 6px 12px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  z-index: 20;
  transition: filter 0.12s;
}

.v2-cal-event:hover {
  filter: brightness(0.96);
}

.v2-cal-event-time {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  font-weight: 600;
  opacity: 0.75;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.v2-cal-event-title {
  font-size: 12.5px;
  font-weight: 600;
  line-height: 1.25;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.v2-cal-event-subtitle {
  font-size: 11.5px;
  opacity: 0.78;
  line-height: 1.25;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.v2-cal-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 18px;
  padding: 16px 0;
  font-size: 12px;
  color: var(--v2-ink-3);
}

.v2-cal-legend-swatch {
  width: 10px;
  height: 10px;
  border-radius: 2px;
  display: inline-block;
  vertical-align: middle;
  margin-right: 6px;
}

/* ── Form inputs (create / edit pages) ────────── */

.v2-form-input {
  width: 100%;
  height: 36px;
  padding: 0 12px;
  font-family: inherit;
  font-size: 13.5px;
  background: var(--v2-bg);
  color: var(--v2-ink);
  border: 1px solid var(--v2-line-2);
  border-radius: 8px;
  transition: border-color .12s, box-shadow .12s;
  box-sizing: border-box;
}

.v2-form-input::placeholder {
  color: var(--v2-ink-4);
}

.v2-form-input:focus {
  outline: none;
  border-color: var(--v2-brand);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.v2-form-mono {
  font-family: 'JetBrains Mono', ui-monospace, monospace;
}

select.v2-form-input {
  appearance: none;
  -webkit-appearance: none;
  padding-right: 36px;
  cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%236b7280' stroke-width='2' stroke-linecap='round' stroke-linejoin='round' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
}

textarea.v2-form-input {
  height: auto;
  padding: 10px 12px;
  resize: vertical;
  line-height: 1.5;
}

.v2-form-label {
  display: inline-flex;
  align-items: baseline;
  gap: 6px;
  font-size: 11px;
  font-weight: 500;
  color: var(--v2-ink-3);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  margin-bottom: 6px;
}

.v2-form-required {
  color: var(--v2-brand);
  font-size: 12px;
  line-height: 1;
}

.v2-form-hint {
  font-size: 11.5px;
  color: var(--v2-ink-3);
  line-height: 1.4;
  margin-top: 4px;
}

/* ── Rich text editor (Quill v2 overrides) ──────── */

.v2 .ql-toolbar.ql-snow {
  border: 1px solid var(--v2-line-2);
  border-bottom: none;
  border-radius: 8px 8px 0 0;
  padding: 6px 8px;
  background: var(--v2-surface-2);
  font-family: inherit;
}

.v2 .ql-container.ql-snow {
  border: 1px solid var(--v2-line-2);
  border-radius: 0 0 8px 8px;
  font-family: inherit;
  font-size: 13.5px;
  color: var(--v2-ink);
  background: var(--v2-bg);
}

.v2 .ql-editor {
  min-height: 120px;
  padding: 10px 12px;
  line-height: 1.5;
}

.v2 .ql-editor.ql-blank::before {
  color: var(--v2-ink-4);
  font-style: normal;
  left: 12px;
  right: 12px;
}

.v2 .ql-snow .ql-stroke {
  stroke: var(--v2-ink-3);
}

.v2 .ql-snow .ql-fill,
.v2 .ql-snow .ql-stroke.ql-fill {
  fill: var(--v2-ink-3);
}

.v2 .ql-snow.ql-toolbar button:hover .ql-stroke,
.v2 .ql-snow.ql-toolbar button.ql-active .ql-stroke {
  stroke: var(--v2-brand);
}

.v2 .ql-snow.ql-toolbar button:hover .ql-fill,
.v2 .ql-snow.ql-toolbar button.ql-active .ql-fill,
.v2 .ql-snow.ql-toolbar button:hover .ql-stroke.ql-fill,
.v2 .ql-snow.ql-toolbar button.ql-active .ql-stroke.ql-fill {
  fill: var(--v2-brand);
}

.v2 .ql-snow.ql-toolbar button:hover,
.v2 .ql-snow.ql-toolbar button.ql-active {
  color: var(--v2-brand);
}

/* Focus ring on the wrapper only – inner borders stay unchanged */
.v2 .v2-quill-wrap {
  border-radius: 8px;
}

.v2 .v2-quill-wrap:focus-within {
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
  border-radius: 8px;
}

/* ── Action bar (sticky bottom bar for forms) ──── */

.v2-action-bar {
  background: var(--v2-bg);
  border-top: 1px solid var(--v2-line);
  flex-shrink: 0;
}

.v2-action-bar-inner {
  display: flex;
  align-items: center;
  gap: 12px;
  height: 54px;
  padding: 0 32px;
  margin: 0 auto;
}

.v2-action-bar-hint {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12.5px;
  color: var(--v2-ink-3);
}

.v2-action-bar-actions {
  margin-left: auto;
  display: flex;
  gap: 8px;
}

/* ── Suffix input (kW, cm³, kg fields) ──────────── */

.v2-suffix-input {
  display: flex;
  align-items: center;
  height: 36px;
  background: var(--v2-bg);
  border: 1px solid var(--v2-line-2);
  border-radius: 8px;
  transition: border-color .12s, box-shadow .12s;
  overflow: hidden;
}

.v2-suffix-input:focus-within {
  border-color: var(--v2-brand);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.v2-suffix-input input {
  flex: 1;
  height: 100%;
  padding: 0 12px;
  border: none;
  outline: none;
  background: transparent;
  font-size: 13.5px;
  color: var(--v2-ink);
  font-family: 'JetBrains Mono', ui-monospace, monospace;
}

.v2-suffix-input input::placeholder {
  color: var(--v2-ink-4);
}

.v2-suffix-input-tag {
  padding: 0 12px;
  height: 100%;
  display: inline-flex;
  align-items: center;
  font-size: 12px;
  color: var(--v2-ink-3);
  border-left: 1px solid var(--v2-line);
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  flex-shrink: 0;
}

/* ── Segmented control ──────────────────────────── */

.v2-segmented {
  display: inline-flex;
  padding: 3px;
  background: var(--v2-surface-2);
  border: 1px solid var(--v2-line);
  border-radius: 8px;
}

.v2-segmented input[type="radio"] {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.v2-segmented-option {
  padding: 7px 16px;
  font-size: 13px;
  font-weight: 500;
  font-family: inherit;
  color: var(--v2-ink-3);
  background: transparent;
  border: 1px solid transparent;
  border-radius: 6px;
  cursor: pointer;
  transition: background .12s, color .12s;
  white-space: nowrap;
}

.v2-segmented input[type="radio"]:checked + .v2-segmented-option {
  font-weight: 600;
  color: var(--v2-ink);
  background: var(--v2-bg);
  border-color: var(--v2-line-2);
  box-shadow: 0 1px 2px rgba(10, 14, 26, 0.04);
}

/* Calendar list group title */
.v2-cal-group {
  padding-top: 32px;
}

.v2-cal-group:first-child {
  padding-top: 20px;
}

.v2-cal-group-title {
  font-size: 11px;
  font-weight: 600;
  color: var(--v2-ink-3);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  margin-bottom: 12px;
}

/* ── Choice card (multi-select radio cards) ──────── */

.v2-choice-card {
  text-align: left;
  padding: 14px 16px;
  border: 1px solid var(--v2-line-2);
  border-radius: 10px;
  background: #fff;
  cursor: pointer;
  font-family: inherit;
  transition: all .12s;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
}

.v2-choice-card.active {
  border-color: var(--v2-brand);
  background: var(--v2-brand-50, #eff6ff);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.v2-choice-card.active .v2-choice-title {
  color: var(--v2-brand-2, #1d4ed8);
}

.v2-choice-card.disabled {
  cursor: default;
  opacity: 0.65;
}

.v2-choice-radio {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 2px solid var(--v2-line-2);
  background: #fff;
  position: relative;
  flex-shrink: 0;
  display: inline-block;
  box-sizing: border-box;
}

.v2-choice-card.active .v2-choice-radio {
  border-color: var(--v2-brand);
}

.v2-choice-card.active .v2-choice-radio::after {
  content: '';
  position: absolute;
  inset: 2px;
  border-radius: 50%;
  background: var(--v2-brand);
}

.v2-choice-title {
  font-size: 13.5px;
  font-weight: 600;
}

.v2-choice-desc {
  font-size: 12.5px;
  color: var(--v2-ink-3);
  line-height: 1.5;
  padding-left: 24px;
}

/* ── Roadmap board ────────────────────────────── */

.v2-roadmap-col-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--v2-line);
}

.v2-roadmap-card {
  background: var(--v2-bg);
  border: 1px solid var(--v2-line);
  border-radius: 10px;
  padding: 14px 16px;
  transition: border-color .12s;
}

.v2-roadmap-card:hover {
  border-color: var(--v2-line-2);
}

.v2-roadmap-board {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 28px;
  align-items: start;
}

@media (max-width: 768px) {
  .v2-roadmap-board {
    grid-template-columns: 1fr;
  }
}

/* ── Support pages ────────────────────────────── */

.v2-support-surface {
  border: 1px solid var(--v2-line);
  border-radius: 10px;
  background: #fff;
  overflow: hidden;
}

.v2-support-channel {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 20px;
  border-bottom: 1px solid var(--v2-line);
  cursor: pointer;
  transition: background .12s;
  text-decoration: none;
  color: inherit;
}

.v2-support-channel:last-child {
  border-bottom: none;
}

.v2-support-channel:hover {
  background: var(--v2-hover);
}

.v2-support-channel:hover .v2-support-channel-icon {
  color: var(--v2-brand);
  background: #fff;
}

.v2-support-channel:hover .v2-support-channel-title {
  color: var(--v2-brand-2);
}

.v2-support-channel:hover .v2-support-channel-chevron {
  color: var(--v2-brand);
  transform: translateX(2px);
}

.v2-support-channel-icon {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  border: 1px solid var(--v2-line);
  background: var(--v2-surface-2);
  display: grid;
  place-items: center;
  flex-shrink: 0;
  color: var(--v2-ink-2);
  transition: color .12s, background .12s;
}

.v2-support-channel-title {
  font-size: 14.5px;
  font-weight: 600;
  color: var(--v2-ink);
  letter-spacing: -0.005em;
  transition: color .12s;
}

.v2-support-channel-chevron {
  color: var(--v2-ink-4);
  flex-shrink: 0;
  transition: transform .12s, color .12s;
}

.v2-support-def-row {
  padding: 18px 20px;
  border-bottom: 1px solid var(--v2-line);
}

.v2-support-def-row:last-of-type {
  border-bottom: none;
}

.v2-support-def-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--v2-ink-3);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 6px;
}

.v2-support-def-value {
  font-size: 15.5px;
  color: var(--v2-ink);
  font-weight: 500;
}

.v2-support-footer {
  padding: 14px 20px;
  border-top: 1px solid var(--v2-line);
  background: #fafafa;
  display: flex;
  align-items: center;
  gap: 10px;
}

.v2-support-header-row {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 18px 20px;
  border-bottom: 1px solid var(--v2-line);
  background: #fafafa;
}

/* AI suggest buttons (sparkle): swap an .v2-ai-btn-idle / .v2-ai-btn-loading
   child based on the .htmx-request class htmx auto-applies during requests. */
.v2-ai-suggest-menu.htmx-request .v2-ai-btn-idle,
.v2-ai-suggest-inline.htmx-request .v2-ai-btn-idle,
.ai-suggest-btn.htmx-request .v2-ai-btn-idle { display: none !important; }
.v2-ai-suggest-menu.htmx-request .v2-ai-btn-loading,
.v2-ai-suggest-inline.htmx-request .v2-ai-btn-loading,
.ai-suggest-btn.htmx-request .v2-ai-btn-loading { display: inline-flex !important; }
.v2-ai-suggest-menu.htmx-request,
.v2-ai-suggest-inline.htmx-request,
.ai-suggest-btn.htmx-request { cursor: wait; opacity: 0.9; }
.v2-ai-spinner { animation: v2-ai-spin 0.9s linear infinite; transform-origin: center; }
@keyframes v2-ai-spin { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }

/* When the AI returned no match, the response template is rendered inside a
   target placed within the button. JS toggles .v2-ai-has-msg on the button so
   we can hide idle/loading and show the muted "no match" text in their place. */
.v2-ai-suggest-menu.v2-ai-has-msg .v2-ai-btn-idle,
.v2-ai-suggest-inline.v2-ai-has-msg .v2-ai-btn-idle,
.ai-suggest-btn.v2-ai-has-msg .v2-ai-btn-idle,
.v2-ai-suggest-menu.v2-ai-has-msg .v2-ai-btn-loading,
.v2-ai-suggest-inline.v2-ai-has-msg .v2-ai-btn-loading,
.ai-suggest-btn.v2-ai-has-msg .v2-ai-btn-loading { display: none !important; }

/* Inline muted feedback for "no match" — sized to drop in for the Generando text. */
.v2-ai-suggest-empty {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--v2-ink-4);
  font-style: italic;
}

/* ── Table of contents (used by generateTableOfContents) ── */

.v2-toc {
  background: var(--v2-surface-2);
  border: 1px solid var(--v2-line);
  border-radius: 12px;
  padding: 6px 18px;
  margin-bottom: 40px;
}
.v2-toc .toc-trigger {
  display: flex;
  width: 100%;
  align-items: center;
  justify-content: space-between;
  padding: 14px 0;
  background: transparent;
  border: none;
  cursor: pointer;
  font-family: inherit;
}
.v2-toc .toc-trigger-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--v2-ink-3);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.v2-toc .toc-chevron {
  width: 16px;
  height: 16px;
  color: var(--v2-ink-4);
  transition: transform .2s;
}
.v2-toc .toc-content {
  padding: 0 0 16px;
}
.v2-toc ul,
.v2-toc ol {
  margin: 0;
  padding-left: 20px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  list-style: decimal;
}
.v2-toc ul {
  list-style: disc;
}
.v2-toc li {
  font-size: 13.5px;
  line-height: 1.55;
}
.v2-toc a {
  color: var(--v2-ink-2);
  text-decoration: none;
}
.v2-toc a:hover {
  color: var(--v2-brand);
  text-decoration: underline;
}
.v2-toc.toc-collapsed .toc-content {
  display: none;
}
