:root {
  color-scheme: light;
  --bg: #f5f7f6;
  --panel: #ffffff;
  --panel-soft: #eef3f1;
  --text: #17211d;
  --muted: #60706a;
  --line: #dbe4e0;
  --brand: #146c5c;
  --brand-strong: #0d4f43;
  --blue: #235f9f;
  --amber: #9a6412;
  --red: #b42318;
  --shadow: 0 14px 40px rgba(24, 39, 33, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  color: var(--text);
  background: var(--bg);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  border: 0;
  cursor: pointer;
}

.app-shell {
  min-height: 100vh;
}

.login-view {
  display: grid;
  grid-template-columns: minmax(280px, 420px) minmax(0, 1fr);
  min-height: 100vh;
}

.login-view-clean {
  grid-template-columns: minmax(0, 1fr);
  place-items: center;
  padding: 28px;
  background:
    radial-gradient(circle at top left, rgba(35, 95, 159, 0.12), transparent 34%),
    radial-gradient(circle at bottom right, rgba(20, 108, 92, 0.14), transparent 38%),
    linear-gradient(135deg, #f4f8f6 0%, #edf4f1 50%, #f8faf8 100%);
}

.login-panel {
  padding: 32px;
  background: var(--panel);
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 22px;
}

.login-panel-clean {
  width: min(100%, 460px);
  padding: 34px;
  border: 1px solid rgba(20, 108, 92, 0.12);
  border-radius: 28px;
  border-right: 1px solid rgba(20, 108, 92, 0.12);
  box-shadow: 0 24px 60px rgba(23, 33, 29, 0.12);
}

.product-mark {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 800;
  font-size: 22px;
}

.auth-product-mark {
  align-items: center;
  gap: 14px;
}

.product-mark-copy {
  display: grid;
  gap: 2px;
}

.product-mark-copy small {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.product-mark-copy strong {
  font-size: 24px;
  line-height: 1;
}

.mark-dot {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  background: var(--brand);
  display: inline-grid;
  place-items: center;
  color: #fff;
  font-size: 16px;
}

.fiber-works-logo {
  width: 72px;
  height: 72px;
  border-radius: 24px;
  display: inline-grid;
  place-items: center;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(233, 243, 239, 0.92));
  box-shadow: inset 0 0 0 1px rgba(20, 108, 92, 0.08), 0 14px 32px rgba(20, 108, 92, 0.12);
}

.fiber-works-logo svg {
  width: 64px;
  height: 64px;
  display: block;
}

.login-form,
.form-grid,
.inline-form {
  display: grid;
  gap: 12px;
}

.login-form label {
  display: grid;
  gap: 7px;
  font-weight: 700;
}

.login-form input {
  min-height: 46px;
}

.login-art {
  padding: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.operation-board {
  width: min(760px, 100%);
  aspect-ratio: 4 / 3;
  border: 1px solid var(--line);
  background: linear-gradient(135deg, #ffffff 0%, #eef3f1 100%);
  box-shadow: var(--shadow);
  padding: 18px;
  display: grid;
  grid-template-rows: auto 1fr;
  gap: 14px;
}

.board-header,
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.board-grid {
  display: grid;
  grid-template-columns: 1.1fr 0.8fr 1fr;
  gap: 12px;
  min-height: 0;
}

.board-lane {
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.72);
  padding: 12px;
  display: grid;
  gap: 10px;
  align-content: start;
}

.lane-row,
.metric-row {
  min-height: 42px;
  border: 1px solid var(--line);
  background: #fff;
  padding: 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.view {
  min-height: 100vh;
  display: grid;
  grid-template-rows: auto 1fr;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  padding: 14px 22px;
  background: rgba(255, 255, 255, 0.94);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(10px);
}

.view.sheet-map-mode .topbar {
  position: static;
  padding-top: 10px;
  padding-bottom: 10px;
}

.view.sheet-map-mode .user-box {
  gap: 8px;
}

.user-box {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.language-picker {
  min-width: 132px;
  display: inline-flex;
  align-items: center;
}

.language-picker select {
  min-height: 34px;
  min-width: 160px;
  padding: 6px 10px;
}

.hamburger-menu {
  position: relative;
  margin-left: auto;
}

.hamburger-button {
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 8px 11px;
  background: #fff;
  color: var(--text);
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 800;
}

.hamburger-button:hover,
.hamburger-menu.open .hamburger-button {
  border-color: var(--brand);
  background: #f4faf7;
}

.hamburger-lines {
  width: 20px;
  display: grid;
  gap: 4px;
}

.hamburger-lines span {
  height: 2px;
  border-radius: 999px;
  background: var(--brand);
}

.hamburger-current {
  max-width: 260px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.hamburger-panel {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: min(360px, calc(100vw - 24px));
  max-height: min(70vh, 520px);
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: var(--shadow);
  padding: 8px;
  display: none;
  z-index: 30;
}

.hamburger-menu.open .hamburger-panel {
  display: grid;
  gap: 8px;
}

.nav-group {
  display: grid;
  gap: 4px;
}

.nav-group + .nav-group {
  border-top: 1px solid var(--line);
  padding-top: 8px;
}

.nav-group-title {
  padding: 6px 8px 2px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.nav-item {
  width: 100%;
  min-height: 42px;
  border-radius: 6px;
  padding: 9px 10px;
  background: #fff;
  color: var(--text);
  text-align: left;
  font-weight: 700;
}

.nav-item:hover,
.nav-item.active {
  background: #eef3f1;
  color: var(--brand-strong);
}

.nav-item.active {
  box-shadow: inset 4px 0 0 var(--brand);
}

.impersonation-pill {
  min-height: 28px;
  border-radius: 999px;
  padding: 5px 10px;
  background: #fff3df;
  color: var(--amber);
  font-size: 12px;
  font-weight: 800;
}

.impersonation-alert {
  border: 1px solid #e6b86f;
  background: #fff8ec;
  color: #6f470d;
  padding: 12px 14px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.danger-text {
  background: #fff3df;
  color: var(--amber);
}

.main-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  min-height: 0;
}

.sidebar {
  border-right: 1px solid var(--line);
  background: #fbfcfb;
  padding: 16px;
  display: grid;
  align-content: start;
  gap: 16px;
}

.content {
  width: min(100%, 1680px);
  margin: 0 auto;
  padding: 18px;
  display: grid;
  gap: 18px;
  align-content: start;
}

/* Full-page views (virtual assistant) break out of content constraints */
.view-va-full .content {
  width: 100%;
  max-width: none;
  padding: 0;
  gap: 0;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}

.narrow-panel {
  width: min(100%, 780px);
}

.panel-header {
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.panel-header > * {
  min-width: 0;
}

.panel-body {
  padding: 16px;
}

.panel-title {
  margin: 0;
  font-size: 17px;
  line-height: 1.3;
}

.active-detail-header {
  background: #edf6f2;
  border-left: 6px solid var(--brand);
  flex-wrap: wrap;
}

.active-label {
  color: var(--brand-strong);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0;
  text-transform: uppercase;
}

.active-sheet-hero {
  min-height: 104px;
  border: 2px solid var(--brand);
  border-left-width: 8px;
  background: #edf6f2;
  padding: 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.active-sheet-aside {
  display: grid;
  gap: 10px;
  justify-items: end;
  flex: 1 1 320px;
  min-width: 0;
}

.active-sheet-main {
  display: grid;
  gap: 5px;
  flex: 1 1 320px;
  min-width: 0;
}

.active-sheet-main strong {
  font-size: 22px;
  line-height: 1.2;
}

.active-sheet-main span,
.active-sheet-meta {
  color: var(--muted);
  font-size: 13px;
}

.active-sheet-main strong,
.active-sheet-main span,
.active-detail-header .muted {
  overflow-wrap: anywhere;
}

.active-sheet-meta {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: wrap;
  max-width: 100%;
  overflow-x: auto;
  overflow-y: visible;
  overscroll-behavior-x: contain;
  scrollbar-gutter: stable;
  padding-bottom: 2px;
}

.stack {
  display: grid;
  gap: 12px;
}

.split {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.profile-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(320px, 0.85fr);
  gap: 18px;
  align-items: start;
}

.profile-card {
  display: grid;
  gap: 16px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #f9fbfa;
  min-width: 0;
}

.profile-card-head {
  display: grid;
  gap: 4px;
}

.profile-card-head h2 {
  margin: 0;
  font-size: 18px;
}

.profile-meta-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.profile-card input[readonly] {
  background: #eef3f1;
  color: var(--text);
}

.profile-card .row-actions {
  justify-content: flex-start;
}

.profile-card .muted {
  overflow-wrap: anywhere;
}

.row-form-tools {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.form-wide {
  grid-column: 1 / -1;
}

.egon-verification {
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 10px 12px;
  display: grid;
  gap: 6px;
}

.egon-verification.ok {
  border-color: #b9ded1;
  background: #f0faf6;
  color: var(--brand-strong);
}

.egon-verification.warning {
  border-color: #f0d8ad;
  background: #fff8ed;
  color: #835f12;
}

.egon-verification.error {
  border-color: #f0c7c1;
  background: #fff5f3;
  color: var(--red);
}

.spreadsheet-list {
  display: grid;
  gap: 8px;
}

.sheet-button {
  width: 100%;
  min-height: 52px;
  padding: 10px 12px;
  text-align: left;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--text);
  display: grid;
  gap: 4px;
}

.sheet-button.active {
  border-color: var(--brand);
  box-shadow: inset 4px 0 0 var(--brand);
}

.active-sheet-row td {
  background: #f1f8f5;
  border-bottom-color: #b9ded1;
}

.deleted-sheet-row td {
  background: #fbf8fd;
  color: #5f5367;
}

.deleted-sheet-row .sheet-title-cell strong {
  text-decoration: line-through;
  text-decoration-thickness: 1px;
}

.soft-deleted-row td {
  background: #fbf8fd;
  color: #5f5367;
}

.soft-deleted-row strong,
.soft-deleted-row .soft-deleted-strike {
  text-decoration: line-through;
  text-decoration-thickness: 1px;
}

.soft-deleted-main {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.soft-deleted-meta {
  margin-top: 4px;
}

.sheet-title-cell {
  display: grid;
  gap: 5px;
}

.sheet-title-line {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
}

.sheet-title-badges {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.sheet-assignment-line {
  display: block;
  overflow-wrap: anywhere;
}

.sheet-totals-summary,
.sheet-totals-inline {
  display: grid;
  gap: 4px;
}

.sheet-totals-summary span,
.sheet-totals-inline span {
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
}

.sheet-archived-summary {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 12px;
  padding-top: 6px;
  border-top: 1px dashed var(--line);
}

.sheet-totals-summary .sheet-archived-summary {
  margin-top: 2px;
}

.sheet-totals-inline {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 12px;
  justify-content: flex-end;
}

.active-badge {
  width: fit-content;
  background: var(--brand);
  color: #fff;
}

.table-wrap {
  position: relative;
  overflow: auto;
  border: 1px solid var(--line);
  max-width: 100%;
  overscroll-behavior-x: contain;
  scrollbar-gutter: stable both-edges;
  -webkit-overflow-scrolling: touch;
}

.table-wrap.has-horizontal-overflow,
.original-sheet-scroll.has-horizontal-overflow {
  box-shadow: inset 0 0 0 1px rgba(20, 108, 92, 0.08);
}

.table-wrap.has-horizontal-overflow::after,
.original-sheet-scroll.has-horizontal-overflow::after {
  content: attr(data-overflow-hint);
  position: absolute;
  top: 10px;
  right: 12px;
  z-index: 5;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(20, 108, 92, 0.92);
  color: #fff;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.01em;
  box-shadow: 0 12px 24px rgba(13, 79, 67, 0.18);
  pointer-events: none;
  opacity: 0.96;
  transition: opacity 0.18s ease, transform 0.18s ease;
}

.table-wrap.can-scroll-left,
.original-sheet-scroll.can-scroll-left {
  box-shadow: inset 14px 0 18px -18px rgba(23, 33, 29, 0.4);
}

.table-wrap.can-scroll-right,
.original-sheet-scroll.can-scroll-right {
  box-shadow: inset -14px 0 18px -18px rgba(23, 33, 29, 0.4);
}

.table-wrap.can-scroll-left.can-scroll-right,
.original-sheet-scroll.can-scroll-left.can-scroll-right {
  box-shadow:
    inset 14px 0 18px -18px rgba(23, 33, 29, 0.4),
    inset -14px 0 18px -18px rgba(23, 33, 29, 0.4);
}

.table-wrap:not(.can-scroll-right).has-horizontal-overflow::after,
.original-sheet-scroll:not(.can-scroll-right).has-horizontal-overflow::after {
  opacity: 0.74;
}

.sticky-actions-wrap {
  position: relative;
}

table {
  width: 100%;
  min-width: 880px;
  border-collapse: collapse;
  background: #fff;
}

.pager {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  padding: 10px 2px 2px;
  font-size: 13px;
}

.pager-size {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.pager-size select {
  padding: 4px 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
}

.pager-info {
  color: var(--muted);
}

.pager-controls {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-left: auto;
}

.pager-controls .btn {
  padding: 4px 9px;
  min-width: 30px;
}

.pager-page {
  color: var(--muted);
  padding: 0 8px;
  white-space: nowrap;
}

.sheets-table {
  min-width: 1120px;
}

.work-table {
  min-width: 1120px;
}

.work-table tr.archived-row > td,
.original-unified-table tr.archived-row > td {
  background: #fbf8fd;
}

.work-table tr.inactive-row > td,
.original-unified-table tr.inactive-row > td {
  background: #fff8ef;
}

th,
td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
  font-size: 14px;
}

th {
  color: #40514b;
  background: #f7faf8;
  font-weight: 700;
  white-space: nowrap;
}

.table-sort-button {
  width: 100%;
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.table-sort-button:hover {
  color: var(--accent);
}

.table-sort-button:focus-visible {
  outline: 2px solid rgba(32, 125, 92, 0.38);
  outline-offset: 2px;
  border-radius: 8px;
}

.table-sort-button.active {
  color: var(--accent);
}

.table-sort-indicator {
  flex: 0 0 auto;
  font-size: 12px;
  opacity: 0.72;
}

.table-sort-button.active .table-sort-indicator {
  opacity: 1;
}

.row-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  max-width: 100%;
}

.report-sheet-cell {
  display: grid;
  gap: 8px;
  min-width: 220px;
}

.report-sheet-cell strong {
  display: block;
}

.report-sheet-export-btn {
  width: fit-content;
  white-space: nowrap;
}

.active-detail-header > :first-child {
  flex: 1 1 320px;
  min-width: 0;
}

.active-detail-header .row-actions {
  flex: 1 1 320px;
  justify-content: flex-end;
  max-width: 100%;
  overflow-x: auto;
  overflow-y: visible;
  overscroll-behavior-x: contain;
  scrollbar-gutter: stable;
  padding-bottom: 2px;
}

.sticky-actions-table thead th:last-child,
.sticky-actions-table tbody td:last-child {
  position: sticky;
  right: 0;
  box-shadow: -8px 0 12px rgba(24, 36, 32, 0.08);
}

.sticky-actions-table thead th:last-child {
  z-index: 3;
  background: #f7faf8;
}

.sticky-actions-table tbody td:last-child {
  z-index: 1;
  min-width: clamp(148px, 18vw, 220px);
  background: #fff;
}

.sticky-actions-table tbody td:last-child .row-actions {
  justify-content: flex-start;
}

.sheets-table tbody td:last-child {
  min-width: clamp(188px, 22vw, 260px);
}

.sheets-table tr.active-sheet-row > td:last-child {
  background: #f1f8f5;
}

.sheets-table tr.deleted-sheet-row > td:last-child {
  background: #fbf8fd;
  color: #5f5367;
}

.icon-action {
  position: relative;
  width: 40px;
  min-width: 40px;
  height: 40px;
  min-height: 40px;
  padding: 0;
  display: inline-grid;
  place-items: center;
}

[data-tooltip] {
  position: relative;
}

.app-tooltip {
  position: fixed;
  z-index: 120;
  max-width: min(240px, calc(100vw - 16px));
  padding: 7px 9px;
  border-radius: 6px;
  background: #1f2f2a;
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  line-height: 1.25;
  text-align: center;
  white-space: normal;
  overflow-wrap: anywhere;
  box-shadow: 0 8px 24px rgba(24, 36, 32, 0.18);
  pointer-events: none;
}

.app-tooltip[hidden] {
  display: none;
}

.app-tooltip::after {
  content: '';
  position: absolute;
  left: var(--tooltip-arrow-offset, 50%);
  width: 10px;
  height: 10px;
  background: #1f2f2a;
  transform: translateX(-50%) rotate(45deg);
}

.app-tooltip[data-side='top']::after {
  bottom: -5px;
}

.app-tooltip[data-side='bottom']::after {
  top: -5px;
}

.decorated-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.icon-only-action {
  width: 40px;
  min-width: 40px;
  height: 40px;
  min-height: 40px;
  padding: 0;
}

.icon-only-action > :not(.button-icon):not(.sr-only) {
  display: none !important;
}

.nav-item.decorated-action {
  justify-content: flex-start;
}

.sheet-button.decorated-action {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
}

.sheet-button.decorated-action > div {
  min-width: 0;
}

.button-icon {
  display: inline-grid;
  place-items: center;
  flex: 0 0 auto;
}

.action-svg {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.action-svg.colored {
  stroke: none;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.row-media td {
  background: #fbfcfb;
  padding: 0;
}

.section-log-form {
  display: grid;
  gap: 16px;
  border: 1px solid var(--line);
  background: linear-gradient(180deg, #ffffff 0%, #f7fbf9 100%);
  padding: 16px;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 2000;
  background: rgba(21, 31, 28, 0.48);
  display: grid;
  place-items: center;
  padding: 18px;
}

.file-upload-overlay {
  position: fixed;
  inset: 0;
  z-index: 2100;
  background: rgba(21, 31, 28, 0.42);
  backdrop-filter: blur(4px);
  display: grid;
  place-items: center;
  padding: 18px;
}

.file-upload-overlay-panel {
  min-width: 132px;
  min-height: 132px;
  padding: 24px 28px;
  border: 1px solid rgba(219, 228, 224, 0.9);
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 24px 70px rgba(24, 36, 32, 0.24);
  display: grid;
  justify-items: center;
  align-content: center;
  gap: 14px;
  text-align: center;
}

.file-upload-overlay-panel strong {
  font-size: 14px;
  line-height: 1.35;
  color: #1f3f37;
}

.operation-feedback-overlay {
  position: fixed;
  inset: 0;
  z-index: 2050;
  background: rgba(21, 31, 28, 0.42);
  backdrop-filter: blur(4px);
  display: grid;
  place-items: center;
  padding: 18px;
}

.operation-feedback-panel {
  width: min(100%, 420px);
  padding: 24px 28px;
  border: 1px solid rgba(219, 228, 224, 0.9);
  background: rgba(255, 255, 255, 0.98);
  box-shadow: 0 24px 70px rgba(24, 36, 32, 0.24);
  display: grid;
  justify-items: center;
  gap: 16px;
  text-align: center;
}

.operation-feedback-panel.success {
  border-color: #b9ded1;
}

.operation-feedback-panel.error {
  border-color: #f0c7c1;
}

.operation-feedback-status {
  width: 56px;
  height: 56px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  font-size: 28px;
  font-weight: 700;
}

.operation-feedback-panel.success .operation-feedback-status {
  background: #f0faf6;
  color: var(--brand-strong);
}

.operation-feedback-panel.error .operation-feedback-status {
  background: #fff5f3;
  color: var(--red);
}

.operation-feedback-copy {
  display: grid;
  gap: 8px;
}

.operation-feedback-title {
  margin: 0;
  font-size: 21px;
  color: #18352f;
}

.operation-feedback-message {
  margin: 0;
  color: #496158;
  line-height: 1.5;
}

.file-upload-spinner {
  width: 42px;
  height: 42px;
  border-radius: 999px;
  border: 3px solid rgba(20, 108, 92, 0.16);
  border-top-color: var(--brand);
  animation: file-upload-spin 0.8s linear infinite;
}

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

.modal-panel {
  width: min(100%, 680px);
  max-height: min(720px, calc(100vh - 36px));
  overflow: auto;
  position: relative;
  background: #fff;
  border: 1px solid var(--line);
  box-shadow: 0 24px 70px rgba(24, 36, 32, 0.28);
}

.operation-modal-panel {
  width: min(100%, 1120px);
  border-color: #e2c768;
  background: #fffbe6;
}

.operation-modal-panel .modal-header {
  background: #fff2a8;
  border-bottom-color: #e2c768;
}

.operation-modal-panel .modal-body {
  background: #fffbe6;
}

.wide-modal {
  width: min(100%, 980px);
}

.modal-header {
  padding: 16px;
  border-bottom: 1px solid var(--line);
  background: #edf6f2;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.modal-title {
  margin: 2px 0 4px;
  font-size: 20px;
  line-height: 1.2;
}

.modal-body {
  padding: 16px;
}

.modal-body .section-log-form {
  padding: 0;
}

.confirm-box {
  display: grid;
  gap: 12px;
}

.confirm-box p {
  margin: 0;
}

.confirm-box textarea {
  min-height: 108px;
}

.delete-authorization-block {
  display: grid;
  gap: 8px;
  border: 1px solid rgba(180, 35, 24, 0.28);
  background: #fff3f1;
  padding: 12px;
  border-radius: 10px;
}

.delete-authorization-block p {
  margin: 0;
}

.delete-authorization-details {
  margin: 0;
  padding-left: 18px;
  display: grid;
  gap: 4px;
}

.delete-authorization-input {
  display: grid;
  gap: 6px;
  font-weight: 700;
}

.price-list-details {
  grid-column: 1 / -1;
  border: 1px solid var(--line);
  padding: 10px;
  background: #f9fbfa;
}

.price-list-form,
.price-list-details {
  display: grid;
  gap: 12px;
}

.embedded-create-section {
  border: 1px solid var(--line);
  border-radius: 14px;
  background: linear-gradient(180deg, #fcfdfc 0%, #f4f8f6 100%);
  padding: 14px 16px;
}

.embedded-create-section summary {
  cursor: pointer;
  font-weight: 800;
}

.embedded-create-section summary::-webkit-details-marker {
  display: none;
}

.embedded-create-body {
  display: grid;
  gap: 12px;
  margin-top: 12px;
}

.compact-operation-form {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  align-items: end;
}

.price-group {
  display: grid;
  gap: 8px;
}

.price-group h3 {
  margin: 0;
  font-size: 14px;
}

.price-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(220px, 1fr));
  gap: 10px;
}

.price-grid label {
  border: 1px solid var(--line);
  background: #fff;
  padding: 10px;
}

.price-grid small {
  color: var(--muted);
  font-weight: 700;
}

.price-list-editor {
  display: grid;
  gap: 16px;
}

.price-list-modal {
  width: min(100%, 1280px);
}

.price-list-form {
  gap: 16px;
}

.price-list-form-hero {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(260px, 1fr);
  gap: 16px;
  align-items: start;
}

.price-list-form-fields,
.price-list-form-summary {
  display: grid;
  gap: 12px;
}

.price-list-form-summary-card {
  display: grid;
  gap: 4px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: linear-gradient(180deg, #ffffff 0%, #f8fbfa 100%);
}

.price-list-form-summary-card strong,
.price-list-form-summary-card span,
.price-list-form-summary-card small {
  display: block;
}

.price-list-form-summary-card span {
  font-size: 22px;
  font-weight: 800;
}

.price-list-form-summary-card small {
  color: var(--muted);
}

.price-list-form-summary-card-title {
  background: linear-gradient(180deg, #fbfcfa 0%, #f2f7f4 100%);
}

.price-list-editor-hero {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: linear-gradient(180deg, #fbfcfa 0%, #f2f7f4 100%);
}

.price-list-editor-hero-copy {
  display: grid;
  gap: 4px;
}

.price-list-editor-stats {
  display: inline-flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.price-list-editor-controls {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  align-items: center;
}

.price-list-editor-open-add {
  min-height: 44px;
  padding-inline: 18px;
  font-weight: 900;
}

.price-list-add-entry-backdrop {
  position: fixed;
  inset: 0;
  z-index: 2100;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(23, 33, 29, 0.38);
}

.price-list-add-entry-backdrop[hidden] {
  display: none;
}

.price-list-add-entry-modal {
  width: min(100%, 760px);
  max-height: min(760px, calc(100vh - 48px));
  overflow: auto;
  border: 1px solid var(--line);
  background: #fff;
  box-shadow: 0 24px 70px rgba(24, 36, 32, 0.28);
}

.price-list-add-entry-body {
  display: grid;
  gap: 14px;
}

.price-list-add-choices {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.price-list-add-choices .price-list-add-choice {
  min-width: min(100%, 260px);
}

.price-list-editor-control-card {
  display: grid;
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #fff;
  min-height: 100%;
}

.price-list-editor-control-head {
  display: grid;
  gap: 4px;
}

.price-list-editor-list-card {
  display: grid;
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: linear-gradient(180deg, #ffffff 0%, #f8fbfa 100%);
}

.price-list-editor-list-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: end;
  flex-wrap: wrap;
}

.price-list-editor-list-head > div {
  display: grid;
  gap: 4px;
}

.price-list-editor-filter {
  display: grid;
  gap: 6px;
  min-width: min(100%, 320px);
  font-weight: 700;
}

.price-list-editor-flat-list {
  display: grid;
  gap: 12px;
}

.price-list-editor-filter input {
  min-height: 40px;
}

.price-list-editor-add {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
}

.price-list-editor-add-button {
  width: 44px;
  min-width: 44px;
  height: 44px;
  padding: 0;
  font-size: 24px;
  line-height: 1;
  font-weight: 900;
}

.price-list-catalog-add-button {
  min-height: 44px;
  padding-inline: 14px;
  font-weight: 800;
}

.price-list-editor-grid {
  display: grid;
  gap: 12px;
}

.price-list-editor-grid-main {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.price-list-editor-card {
  display: grid;
  gap: 10px;
  padding: 12px 12px 10px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fff;
}

.price-list-editor-secondary {
  display: grid;
  gap: 12px;
}

.price-list-editor-column {
  display: grid;
  grid-template-rows: auto minmax(180px, 1fr) auto;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: linear-gradient(180deg, #ffffff 0%, #f6faf7 100%);
}

.price-list-editor-column[data-price-list-column=""] {
  background: linear-gradient(180deg, #fff9f1 0%, #fff3df 100%);
}

.price-list-editor-column-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
}

.price-list-editor-column-head strong,
.price-list-editor-column-head small {
  display: block;
}

.price-list-editor-column-head small {
  color: var(--muted);
}

.price-list-editor-column-items {
  display: grid;
  align-content: start;
  gap: 10px;
  min-height: 180px;
  padding: 6px;
}

.price-list-editor-card-head {
  display: grid;
  grid-template-columns: minmax(0, 1.3fr) minmax(140px, 180px) minmax(0, 1.5fr) auto;
  gap: 12px;
  align-items: center;
}

.price-list-editor-card-copy {
  min-width: 0;
}

.price-list-editor-card-copy strong,
.price-list-editor-card-copy small {
  display: block;
}

.price-list-editor-card-copy small {
  color: var(--muted);
}

.price-list-editor-price-inline {
  min-width: 140px;
}

.price-list-editor-price-inline input {
  min-width: 0;
}

.price-list-editor-card-head .price-list-editor-section-pills {
  align-self: center;
}

.price-list-editor-card-head .price-list-editor-section-pill span {
  min-height: 32px;
  padding: 0 12px;
}

.price-list-editor-card-actions {
  display: inline-flex;
  gap: 6px;
  align-items: center;
}

.price-list-editor-card-body {
  display: grid;
  gap: 10px;
  padding-top: 0;
  border-top: 1px solid var(--line);
}

.price-list-editor-column-items.drag-over {
  border-color: rgba(24, 114, 74, 0.36);
  background: rgba(24, 114, 74, 0.05);
}

.price-list-editor-empty {
  color: var(--muted);
  font-size: 13px;
}

.price-list-editor-card {
  display: grid;
  gap: 10px;
  padding: 10px;
  border: 1px solid rgba(20, 62, 41, 0.1);
  border-radius: 14px;
  background: #fff;
  box-shadow: 0 10px 18px rgba(18, 44, 31, 0.05);
}

.price-list-editor-row-fields {
  display: grid;
  grid-template-columns: minmax(180px, 220px) minmax(0, 1fr);
  gap: 12px;
  align-items: start;
}

.price-list-editor-card-head {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(150px, 190px) auto;
  gap: 12px;
  align-items: center;
}

.price-list-editor-card-copy {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.price-list-editor-card-copy strong,
.price-list-editor-card-copy small {
  display: block;
}

.price-list-editor-card-copy small,
.price-list-editor-card-meta {
  color: var(--muted);
}

.price-list-editor-card-actions {
  display: inline-flex;
  gap: 6px;
  align-items: center;
  justify-content: flex-end;
}

.price-list-editor-card-actions .icon-action {
  width: 34px;
  min-width: 34px;
  height: 34px;
}

.price-list-editor-action {
  width: 30px;
  height: 30px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  color: var(--text);
  font-weight: 800;
  line-height: 1;
}

.price-list-editor-action:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.price-list-editor-action.danger {
  color: #9d2432;
}

.price-list-editor-card-body {
  display: grid;
  gap: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
}

.price-list-editor-price {
  display: grid;
  gap: 6px;
  font-size: 13px;
  font-weight: 700;
}

.price-list-editor-price input {
  min-width: 0;
}

.price-list-editor-section-pills {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.price-list-editor-section-pill {
  position: relative;
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  padding: 0;
  cursor: pointer;
  transition: border-color 0.16s ease, background 0.16s ease, color 0.16s ease;
}

.price-list-editor-section-pill input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.price-list-editor-section-pill span {
  display: inline-flex;
  align-items: center;
  min-height: 36px;
  padding: 0 14px;
  font-size: 13px;
  font-weight: 700;
}

.price-list-editor-section-pill.active {
  border-color: rgba(24, 114, 74, 0.36);
  background: #edf6f2;
  color: var(--brand-dark);
}

.price-list-editor-card.is-excluded {
  background: linear-gradient(180deg, #fffdf9 0%, #fff8ec 100%);
  border-style: dashed;
}

.price-list-inline-edit {
  padding-top: 10px;
  border-top: 1px solid var(--line);
  display: grid;
  gap: 10px;
}

.price-list-inline-edit-fields {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 10px;
  align-items: end;
}

@media (max-width: 600px) {
  .price-list-inline-edit-fields {
    grid-template-columns: 1fr;
  }
}

.icon-button {
  width: 36px;
  height: 36px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--text);
  font-size: 18px;
  font-weight: 900;
  line-height: 1;
}

.operation-entry-header {
  display: grid;
  gap: 4px;
  padding-bottom: 2px;
}

.operation-edit-layout {
  display: grid;
  gap: 16px;
}

.operation-edit-summary,
.operation-edit-section {
  display: grid;
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fbfcfb;
}

.operation-edit-summary {
  background: linear-gradient(135deg, #f7faf8, #eef6f2);
}

.operation-edit-summary-head {
  display: grid;
  gap: 4px;
}

.operation-edit-summary-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.operation-edit-summary-card {
  display: grid;
  gap: 6px;
  padding: 12px;
  border: 1px solid rgba(42, 59, 52, 0.08);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.9);
}

.operation-edit-summary-card span,
.operation-edit-section-head span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

.operation-edit-summary-card strong {
  font-size: 14px;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.operation-edit-section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.operation-entry-fields-secondary .operation-entry-field {
  grid-column: span 6;
}

.operation-entry-fields {
  display: flex;
  flex-direction: column;
  gap: 12px;
  align-items: stretch;
}

.operation-entry-row {
  width: 100%;
  display: grid;
  gap: 12px;
  align-items: stretch;
}

.operation-entry-row > * {
  min-width: 0;
}

.operation-entry-row > .operation-entry-field {
  grid-column: auto;
}

.operation-entry-row-primary {
  grid-template-columns: minmax(96px, 1fr) minmax(0, 1.8fr) minmax(88px, 0.8fr);
}

.operation-entry-row-main {
  grid-template-columns: minmax(96px, 1fr) minmax(0, 1.8fr) minmax(88px, 0.8fr);
}

.operation-entry-row-note {
  grid-template-columns: minmax(0, 1fr);
}

.operation-entry-row-primary .operation-entry-field-section {
  grid-column: 1 / span 2;
  width: 100%;
}

.operation-entry-row-primary .operation-entry-field-date {
  grid-column: 3;
}

.operation-entry-row-primary .operation-entry-field-date,
.operation-entry-row-main .operation-entry-field-search,
.operation-entry-row-main .operation-entry-field-price,
.operation-entry-row-main .operation-entry-field-quantity,
.operation-entry-row-note .operation-entry-field-note {
  width: 100%;
}

.operation-entry-field {
  grid-column: span 4;
  border: 1px solid var(--line);
  background: #fbfcfb;
  border-radius: 8px;
  padding: 12px;
  min-width: 0;
  min-height: 100%;
  align-content: start;
  transition: border-color 0.16s ease, box-shadow 0.16s ease, background 0.16s ease;
}

.operation-entry-field-label {
  display: block;
  margin-bottom: 10px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.operation-entry-section-options {
  display: flex;
  flex-wrap: nowrap;
  gap: 8px;
  overflow-x: auto;
}

.operation-entry-section-option {
  min-height: 40px;
  white-space: nowrap;
}

.operation-entry-section-option.is-disabled {
  opacity: 0.48;
  cursor: not-allowed;
  background: #edf2ef;
  color: var(--muted);
}

.operation-entry-field:focus-within {
  border-color: rgba(32, 125, 92, 0.38);
  box-shadow: 0 0 0 3px rgba(32, 125, 92, 0.12);
  background: #fff;
}

.operation-entry-field-note {
  grid-column: 1 / -1;
}

.operation-entry-toggle {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 12px;
  align-items: start;
  min-height: 100%;
}

.operation-entry-check {
  width: 18px;
  height: 18px;
  margin-top: 1px;
  border-radius: 4px;
  border: 1.5px solid var(--brand);
  background: #fff;
  color: var(--brand);
  display: inline-grid;
  place-items: center;
}

.operation-entry-check::after {
  content: '';
  width: 8px;
  height: 8px;
  border-radius: 2px;
  background: currentColor;
  transform: scale(0);
  transition: transform 0.16s ease;
}

.operation-entry-toggle input[type="checkbox"]:checked + .operation-entry-check::after {
  transform: scale(1);
}

.operation-entry-toggle input[type="checkbox"]:focus-visible + .operation-entry-check {
  outline: 2px solid rgba(32, 125, 92, 0.28);
  outline-offset: 2px;
}

.operation-entry-toggle-copy {
  display: grid;
  gap: 3px;
}

.operation-entry-toggle-copy strong {
  font-size: 14px;
  line-height: 1.2;
}

.operation-entry-toggle-copy small {
  line-height: 1.45;
}

.operation-entry-actions {
  padding-top: 2px;
  border-top: 1px solid #e5ece8;
}

.operation-route-editor {
  border: 1px solid rgba(42, 59, 52, 0.12);
  background: linear-gradient(135deg, rgba(247, 251, 249, 0.98), rgba(239, 247, 243, 0.94));
  display: grid;
  gap: 10px;
  padding: 12px;
}

.operation-route-head,
.operation-route-actions {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 10px;
}

.operation-route-head small {
  display: block;
  margin-top: 3px;
  color: var(--muted);
}

.operation-route-chip {
  border: 1px solid color-mix(in srgb, var(--route-color) 48%, #ffffff);
  background: color-mix(in srgb, var(--route-color) 14%, #ffffff);
  color: #1c2f29;
  padding: 5px 8px;
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

.operation-route-map-shell {
  border: 1px solid var(--line);
  background: #dfe7e2;
  min-height: 280px;
}

.operation-route-map {
  min-height: 280px;
  height: min(42vh, 390px);
}

.operation-route-actions {
  align-items: center;
}

/* Route drawing: clickable segments and points */
.route-segment-clickable {
  cursor: pointer;
}
.route-point-clickable {
  cursor: pointer;
}
/* Visual feedback while drawing (pulsing cursor via map container) */
.operation-route-map-shell.drawing-active {
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--route-color) 50%, transparent);
}

/* Draw mode toggle button + editor feedback */
.operation-route-editor .btn.active {
  background: var(--route-color, #16a34a);
  border-color: var(--route-color, #16a34a);
  color: #fff;
}
.operation-route-editor.draw-mode-active .operation-route-map-shell {
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--route-color) 60%, transparent);
}
.operation-route-editor.draw-mode-active .operation-route-map {
  cursor: crosshair;
}

.row-position-editor {
  display: grid;
  gap: 8px;
  margin: 12px 0;
}

.row-position-head {
  display: flex;
  flex-direction: column;
}

.row-position-head strong {
  display: block;
}

.row-position-head small {
  color: var(--muted);
}

.row-position-map-shell {
  border: 1px solid var(--line);
  background: #dfe7e2;
  min-height: 240px;
}

.row-position-map {
  min-height: 240px;
  height: min(38vh, 340px);
}

.row-position-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.work-route-line {
  filter: drop-shadow(0 2px 4px rgba(20, 34, 28, 0.22));
}

.row-media-grid {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) minmax(220px, 1fr) minmax(260px, 1.2fr);
  gap: 12px;
  padding: 12px;
}

.sheet-attachments-panel {
  border: 1px solid var(--line);
  background: #fff;
  padding: 12px;
}

.sheet-attachment-form {
  border: 1px solid var(--line);
  background: var(--panel-soft);
  padding: 12px;
}

.sheet-attachment-dropzone {
  border: 2px dashed #b8ccc3;
  border-radius: 8px;
  background: #f7fbf9;
  min-height: 94px;
  padding: 12px;
  display: grid;
  align-content: center;
  justify-items: center;
  gap: 4px;
  text-align: center;
  cursor: pointer;
}

.sheet-attachment-dropzone.drag-over {
  border-color: var(--brand);
  background: #edf7f3;
}

.sheet-attachment-list {
  display: grid;
  gap: 8px;
}

.sheet-attachment-item {
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 8px;
  padding: 10px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
}

.sheet-attachment-main {
  min-width: 0;
  display: grid;
  gap: 4px;
}

.sheet-attachment-main strong,
.sheet-attachment-main small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sheet-attachment-main small {
  color: var(--muted);
}

.source-file-badge {
  margin-left: 8px;
  vertical-align: middle;
}

.section-note-modal-grid {
  display: grid;
  grid-template-columns: minmax(220px, 0.95fr) minmax(260px, 1.05fr);
  gap: 12px;
  align-items: start;
}

.section-note-modal-grid.readonly {
  grid-template-columns: minmax(0, 1fr);
}

.row-note-form,
.section-note-form,
.row-photo-form,
.media-list {
  border: 1px solid var(--line);
  background: #fff;
  padding: 12px;
  display: grid;
  gap: 10px;
  align-content: start;
}

.row-note-form textarea {
  min-height: 74px;
}

.section-note-form textarea {
  min-height: 96px;
}

.notes-list,
.photo-list {
  display: grid;
  gap: 8px;
}

.note-item {
  border-left: 3px solid var(--brand);
  padding-left: 8px;
  display: grid;
  gap: 3px;
}

.note-item small {
  color: var(--muted);
}

.row-title-inline {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.row-list-identity {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.row-list-identity .map-node-symbol.is-pdf img,
.row-list-identity .map-node-symbol.is-pdf svg {
  height: 18px;
  max-width: 34px;
}

.row-title-inline h3,
.row-title-inline strong {
  margin: 0;
}

.inline-icon-links {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 6px;
}

.icon-link-action {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--brand);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background 0.16s ease, border-color 0.16s ease, transform 0.16s ease;
}

.icon-link-action:hover {
  background: #edf5f1;
  border-color: rgba(20, 108, 92, 0.28);
  transform: translateY(-1px);
}

.icon-link-action .action-svg {
  width: 16px;
  height: 16px;
}

.archived-row-note {
  display: grid;
  gap: 6px;
  border: 1px solid #dbcfe9;
  background: #faf7fc;
  border-radius: 8px;
  padding: 9px 10px;
}

.archived-row-note.compact {
  margin-top: 6px;
  padding: 7px 8px;
}

.archived-row-note-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.archived-row-note-head small {
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}

.archived-row-note-body {
  display: grid;
  gap: 4px;
}

.archived-row-note-body strong {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
}

.inactive-row-note {
  display: grid;
  gap: 6px;
  border: 1px solid #f1d29a;
  background: #fff9ef;
  border-radius: 8px;
  padding: 9px 10px;
}

.inactive-row-note.compact {
  margin-top: 6px;
  padding: 7px 8px;
}

.inactive-row-note-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.inactive-row-note-head small {
  color: #8e6a22;
  font-size: 11px;
  font-weight: 700;
}

.inactive-row-note-body {
  display: grid;
  gap: 4px;
}

.inactive-row-note-body strong {
  color: #9a6400;
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
}

.photo-list {
  grid-template-columns: repeat(auto-fill, minmax(64px, 124px));
  align-items: start;
}

.photo-entry {
  display: grid;
  gap: 4px;
  max-width: 124px;
}

.photo-entry small,
.gps-meta-link {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.25;
  overflow-wrap: anywhere;
}

.gps-meta-link:hover {
  color: var(--brand);
}

.photo-list img {
  width: 64px;
  height: 64px;
  object-fit: cover;
  border: 1px solid var(--line);
  border-radius: 6px;
  display: block;
}

label {
  display: grid;
  gap: 6px;
  color: #394842;
  font-size: 13px;
  font-weight: 700;
}

input,
select,
textarea {
  width: 100%;
  min-height: 40px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--text);
  padding: 9px 10px;
  border-radius: 6px;
}

textarea {
  min-height: 84px;
  resize: vertical;
}

.btn {
  min-height: 40px;
  border-radius: 6px;
  padding: 9px 13px;
  background: var(--brand);
  color: #fff;
  font-weight: 800;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.btn:hover {
  background: var(--brand-strong);
}

.btn.secondary {
  background: #e8efec;
  color: var(--text);
}

.btn.secondary:hover {
  background: #dce8e3;
}

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

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  border-radius: 999px;
  padding: 4px 9px;
  background: #e8efec;
  color: #273832;
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.badge.admin { background: #e9eff8; color: var(--blue); }
.badge.committente { background: #eef3f1; color: var(--brand); }
.badge.appaltatore { background: #fff3df; color: var(--amber); }
.badge.manager { background: #eef3f1; color: var(--brand); }
.badge.giuntatore { background: #fff3df; color: var(--amber); }
.badge.scavatore { background: #f7e8e6; color: var(--red); }
.badge.posatore { background: #e9f5f8; color: #166175; }
.badge.danger-text { background: #fff3df; color: var(--amber); }
.badge.archived { background: #f2eafb; color: #775199; }
.badge.inactive { background: #fff2db; color: #9a6400; }
.badge.open-rows { background: #fff3df; color: var(--amber); }
.badge.compare-same { background: #e8efec; color: #41514b; }
.badge.compare-changed { background: #e9eff8; color: var(--blue); }
.badge.compare-added { background: #eef3f1; color: var(--brand); }
.badge.compare-removed { background: #f7e8e6; color: var(--red); }

.price-list-compare-section {
  display: grid;
  gap: 12px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: linear-gradient(180deg, #ffffff 0%, #f8fbfa 100%);
}

.price-list-compare-head {
  display: grid;
  gap: 4px;
}

.price-list-compare-head h3 {
  font-size: 18px;
}

.price-list-compare-filters {
  padding: 14px;
}

.price-list-compare-grid {
  grid-template-columns: repeat(3, minmax(220px, 1fr));
  align-items: end;
}

.price-list-compare-toggle {
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 9px 12px;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  cursor: pointer;
  transition: border-color 0.16s ease, background 0.16s ease, color 0.16s ease, transform 0.16s ease;
}

.price-list-compare-toggle:hover {
  border-color: rgba(20, 108, 92, 0.28);
  background: #f7faf8;
  transform: translateY(-1px);
}

.price-list-compare-toggle.active {
  border-color: rgba(20, 108, 92, 0.38);
  background: #edf6f2;
  color: var(--brand-dark);
}

.price-list-compare-toggle .filter-check-box {
  border-radius: 4px;
}

.price-list-compare-toggle-copy {
  min-width: 0;
  display: grid;
  gap: 2px;
  line-height: 1.15;
}

.price-list-compare-toggle-copy strong {
  font-size: 13px;
}

.price-list-compare-toggle-copy small {
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  overflow-wrap: anywhere;
}

.price-list-compare-toggle.active .price-list-compare-toggle-copy small {
  color: #235a4e;
}

.price-list-compare-summary {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.price-list-compare-summary strong {
  font-size: 13px;
  color: #31423b;
}

.price-list-compare-table td,
.price-list-compare-table th {
  vertical-align: top;
}

.price-list-compare-value {
  font-weight: 700;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.compare-row.compare-changed {
  background: rgba(35, 95, 159, 0.04);
}

.compare-row.compare-added {
  background: rgba(20, 108, 92, 0.05);
}

.compare-row.compare-removed {
  background: rgba(175, 68, 47, 0.05);
}

.compare-delta {
  font-weight: 700;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.compare-delta.positive {
  color: var(--brand);
}

.compare-delta.negative {
  color: var(--red);
}

.compare-delta.neutral {
  color: var(--muted);
}

/* ── Platform settings accordion sections ── */

.platform-settings-section {
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface, #fff);
  overflow: hidden;
}

.platform-settings-section[open] {
  box-shadow: 0 1px 4px rgba(0,0,0,.06);
}

.platform-settings-section summary {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 16px 20px;
  cursor: pointer;
  font-weight: 700;
  font-size: 15px;
  list-style: none;
  user-select: none;
  background: linear-gradient(180deg, #fcfdfc 0%, #f6f9f7 100%);
}

.platform-settings-section summary::-webkit-details-marker {
  display: none;
}

.platform-settings-section summary::marker {
  display: none;
  content: '';
}

.platform-section-icon {
  font-size: 20px;
  line-height: 1;
}

.platform-section-chevron {
  margin-left: auto;
  font-size: 12px;
  transition: transform 0.2s;
  opacity: 0.4;
}

.platform-section-chevron::after {
  content: '▼';
  display: inline-block;
}

.platform-settings-section[open] .platform-section-chevron {
  transform: rotate(180deg);
}

.platform-settings-body {
  padding: 0 20px 20px;
}

.platform-settings-summary-wrap {
  padding-bottom: 8px;
  margin-bottom: 12px;
  border-bottom: 1px solid var(--line);
}

.platform-settings-summary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 8px;
}

.platform-settings-summary > div {
  display: grid;
  gap: 2px;
}

.platform-settings-summary strong {
  font-size: 14px;
}

/* Old grid (kept for compatibility, now unused) */
.platform-settings-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.platform-settings-card {
  min-height: 100%;
}

.platform-settings-card-body {
  display: grid;
  gap: 10px;
}

.platform-settings-card-body > div {
  display: grid;
  gap: 4px;
}

.platform-settings-card-body strong {
  font-size: 14px;
}

.company-revenue-split {
  display: grid;
  gap: 4px;
  min-width: 120px;
}

.company-revenue-split span {
  white-space: nowrap;
}

.price-list-compare-empty {
  padding-top: 16px;
  padding-bottom: 16px;
}

@media (max-width: 900px) {
  .price-list-form-hero,
  .price-list-editor-controls,
  .price-list-compare-grid {
    grid-template-columns: 1fr;
  }

  .price-list-editor-grid-main {
    grid-template-columns: 1fr;
  }

  .price-list-editor-row-fields {
    grid-template-columns: 1fr;
  }

  .platform-settings-grid {
    grid-template-columns: 1fr;
  }

  .platform-settings-summary {
    grid-template-columns: 1fr;
  }
}

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

.stats-stack {
  display: grid;
  gap: 12px;
}

.report-statement {
  display: grid;
  gap: 14px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: linear-gradient(180deg, #fcfdfc 0%, #f5f8f7 100%);
}

.report-statement-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.report-statement-head-main {
  display: grid;
  gap: 4px;
}

.report-statement-head-side {
  display: grid;
  gap: 10px;
  justify-items: end;
  max-width: min(100%, 520px);
}

.report-statement-head-hint {
  text-align: right;
}

.report-statement-eyebrow {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.report-statement-meta {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 10px;
}

.report-statement-meta-card {
  display: grid;
  gap: 6px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.82);
}

.report-statement-meta-card span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.report-statement-meta-card strong {
  font-size: 14px;
  line-height: 1.35;
}

.report-statement-table .report-statement-group td {
  background: #eef3f1;
}

.report-statement-group-head {
  display: flex;
  gap: 12px;
  justify-content: space-between;
  align-items: flex-start;
  flex-wrap: wrap;
}

.report-statement-group-copy {
  display: grid;
  gap: 4px;
  min-width: 0;
  flex: 1 1 320px;
}

.report-statement-group-copy span {
  color: var(--muted);
  font-weight: 700;
}

.report-sheet-export-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
  align-items: center;
}

.report-sheet-export-btn {
  min-width: 88px;
  justify-content: center;
}

.report-statement-table .report-statement-sheet-total td,
.report-statement-table .report-statement-period-total td {
  background: #f8faf9;
}

.report-number {
  text-align: right;
  white-space: nowrap;
}

@media (max-width: 720px) {
  .report-statement-head-side {
    justify-items: stretch;
    max-width: 100%;
    width: 100%;
  }

  .report-statement-head-hint {
    text-align: left;
  }

  .report-statement-group-head {
    align-items: stretch;
  }

  .report-sheet-export-actions {
    justify-content: stretch;
    width: 100%;
  }

  .report-sheet-export-btn {
    flex: 1 1 120px;
  }

  .report-statement-actions {
    justify-content: stretch;
  }

  .report-statement-action {
    flex: 1 1 140px;
  }
}

.report-note {
  display: grid;
  gap: 6px;
  padding: 12px 14px;
  border: 1px dashed var(--line);
  border-radius: 12px;
  background: var(--panel-soft);
}

.report-note span {
  color: var(--muted);
}

.view-mode-toggle {
  display: inline-flex;
  gap: 6px;
  flex-wrap: wrap;
}

.view-mode-radios {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.report-graphs-panel {
  border: 1px solid var(--line);
}

.report-graphs-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.chart-card {
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
}

.chart-legend {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  color: var(--muted);
  font-size: 12px;
}

.chart-legend span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.chart-legend-dot {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  display: inline-block;
  background: var(--brand);
}

.chart-legend-dot.ricavi,
.chart-legend-dot.lordo,
.chart-legend-dot.distributore,
.line-chart-path.ricavi {
  background: #2f7cf6;
  stroke: #2f7cf6;
}

.chart-legend-dot.costi,
.chart-legend-dot.admin,
.line-chart-path.costi {
  background: #ef4b6f;
  stroke: #ef4b6f;
}

.chart-legend-dot.operazioni,
.chart-legend-dot.count,
.line-chart-path.operazioni {
  background: #16a34a;
  stroke: #16a34a;
}

.chart-legend-dot.committente {
  background: #f59e0b;
}

.chart-legend-dot.appaltatore,
.chart-legend-dot.spese,
.line-chart-path.spese {
  background: #7c3aed;
  stroke: #7c3aed;
}

.chart-rows {
  display: grid;
  gap: 10px;
}

.chart-row {
  display: grid;
  gap: 6px;
}

.chart-row-head strong {
  font-size: 13px;
}

.chart-bars {
  display: grid;
  gap: 6px;
}

.chart-bar {
  min-height: 24px;
  border-radius: 6px;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding: 0 8px;
  font-size: 12px;
  font-weight: 700;
  background: var(--brand);
  cursor: default;
  outline: none;
}

.chart-bar:focus-visible {
  box-shadow: 0 0 0 3px rgba(47, 124, 246, 0.22);
}

.chart-bar.ricavi,
.chart-bar.lordo,
.chart-bar.distributore {
  background: #2f7cf6;
}

.chart-bar.costi,
.chart-bar.admin {
  background: #ef4b6f;
}

.chart-bar.operazioni,
.chart-bar.count {
  background: #16a34a;
}

.chart-bar.committente {
  background: #f59e0b;
}

.chart-bar.appaltatore,
.chart-bar.spese {
  background: #7c3aed;
}

.line-chart {
  display: grid;
  gap: 8px;
}

.line-chart svg {
  width: 100%;
  height: 170px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: linear-gradient(180deg, #f9fbfa 0%, #ffffff 100%);
}

.line-chart-path {
  fill: none;
  stroke-width: 2.4;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.line-chart-labels {
  display: flex;
  justify-content: space-between;
  color: var(--muted);
  font-size: 12px;
}

.totals-scope-toolbar {
  border: 1px solid var(--line);
  background: #f9fbfa;
  padding: 12px;
  display: grid;
  gap: 10px;
}

.totals-scope-label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.totals-scope-toggle {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.totals-scope-option {
  flex: 1 1 180px;
  min-height: 56px;
  display: inline-flex;
  align-items: flex-start;
  justify-content: flex-start;
  gap: 8px;
  padding: 9px 13px;
  border-radius: 6px;
  background: #e8efec;
  color: var(--text);
  font-weight: 800;
  cursor: pointer;
  box-shadow: inset 0 0 0 1px rgba(64, 81, 75, 0.06);
  transition: background 0.16s ease, color 0.16s ease, box-shadow 0.16s ease;
}

.totals-scope-option:hover {
  background: #dce8e3;
}

.totals-scope-option:focus-within {
  outline: 2px solid rgba(32, 125, 92, 0.28);
  outline-offset: 2px;
}

.totals-scope-check {
  width: 16px;
  height: 16px;
  flex: 0 0 16px;
  border-radius: 4px;
  border: 1.5px solid currentColor;
  display: inline-grid;
  place-items: center;
}

.totals-scope-check::after {
  content: '';
  width: 8px;
  height: 8px;
  border-radius: 2px;
  background: currentColor;
  transform: scale(0);
  transition: transform 0.16s ease;
}

.totals-scope-text {
  font-size: 13px;
}

.totals-scope-copy {
  min-width: 0;
  display: grid;
  gap: 2px;
}

.totals-scope-meta {
  display: inline-flex;
  align-items: baseline;
  gap: 8px;
  flex-wrap: wrap;
  color: var(--muted);
}

.totals-scope-meta strong {
  font-size: 12px;
  line-height: 1.2;
}

.totals-scope-meta small {
  font-size: 12px;
  line-height: 1.2;
}

.totals-scope-option.active {
  background: var(--brand);
  color: #fff;
  box-shadow: none;
}

.totals-scope-option.active .totals-scope-meta {
  color: rgba(255, 255, 255, 0.9);
}

.totals-scope-option.active .totals-scope-check::after {
  transform: scale(1);
}

.stats-grid-subset {
  gap: 8px;
}

.original-sheet-panel {
  border: 1px solid var(--line);
  background: #fff;
  display: grid;
  gap: 12px;
  padding: 12px;
}

.sheet-display-toggle {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.sheet-default-stack {
  display: grid;
  gap: 14px;
}

.sheet-map-panel {
  border: 1px solid var(--line);
  background: #fff;
  display: grid;
  gap: 14px;
  padding: 14px;
}

.sheet-map-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
}

.sheet-map-header h2,
.sheet-map-selected h3 {
  margin: 0;
}

.sheet-map-header p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.sheet-map-header-tools {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  align-items: flex-start;
  gap: 10px;
}

.map-overlay-toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 40px;
  padding: 7px 12px;
  text-align: left;
}

.map-overlay-toggle.active {
  background: #e8f6f1;
  border-color: rgba(20, 108, 92, 0.42);
  color: var(--brand-dark);
}

.map-overlay-toggle.active .visibility-toggle-check::after {
  transform: scale(1);
}

.map-overlay-toggle-copy {
  display: grid;
  gap: 2px;
  line-height: 1.1;
}

.map-overlay-toggle-copy strong {
  font-size: 13px;
}

.map-overlay-toggle-copy small {
  color: var(--muted);
  font-size: 11px;
}

.map-overlay-toggle.active .map-overlay-toggle-copy small {
  color: #235a4e;
}

.map-symbol-legend {
  min-width: 240px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
  align-self: start;
}

.map-symbol-legend-head {
  min-height: 40px;
  padding: 8px 12px;
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
}

.map-symbol-legend-list {
  border-top: 1px solid var(--line);
  padding: 8px;
  display: grid;
  gap: 6px;
}

.map-symbol-legend-item {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 30px;
  font-size: 12px;
}

.map-symbol-legend .map-node-symbol.is-pdf {
  min-width: 54px;
  justify-content: center;
}

.map-symbol-legend .map-node-symbol.is-pdf img {
  height: 26px;
  max-width: 58px;
}

.map-symbol-legend .map-node-symbol.is-pdf svg {
  height: 26px;
  width: auto;
  max-width: 58px;
}

.sheet-map-sidebar-stack {
  min-width: 0;
  display: grid;
  gap: 14px;
  align-content: start;
}

.map-overlay-editor {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: linear-gradient(180deg, #ffffff, #f8fbfa);
  padding: 12px;
  gap: 12px;
}

.map-overlay-editor-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.map-overlay-editor-status,
.map-overlay-editor-collapsed-note {
  font-size: 12px;
}

.map-overlay-editor-body {
  display: grid;
  gap: 12px;
}

.map-overlay-editor-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.map-overlay-editor-tabs .btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.map-overlay-editor-layout {
  display: grid;
  grid-template-columns: minmax(0, 170px) minmax(0, 1fr);
  gap: 12px;
  min-height: 0;
}

.map-overlay-editor-list {
  display: grid;
  align-content: start;
  gap: 8px;
  max-height: 420px;
  overflow: auto;
  padding-right: 2px;
}

.map-overlay-entry {
  display: grid;
  gap: 4px;
  width: 100%;
  padding: 10px;
  border: 1px solid rgba(32, 51, 73, 0.16);
  border-radius: 10px;
  background: #fff;
  text-align: left;
}

.map-overlay-entry strong {
  font-size: 13px;
  line-height: 1.3;
  overflow-wrap: anywhere;
}

.map-overlay-entry small {
  color: var(--muted);
  font-size: 11px;
  overflow-wrap: anywhere;
}

.map-overlay-entry.active {
  border-color: rgba(20, 108, 92, 0.42);
  background: #eef8f4;
}

.map-overlay-entry.is-hidden {
  opacity: 0.62;
}

.map-overlay-editor-form {
  display: grid;
  gap: 12px;
  padding: 12px;
  border: 1px solid rgba(32, 51, 73, 0.12);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.94);
}

.map-overlay-editor-form-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 10px;
  flex-wrap: wrap;
}

.map-overlay-form-stack {
  display: grid;
  gap: 10px;
}

.map-overlay-form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.map-overlay-form-grid-coords input {
  font-variant-numeric: tabular-nums;
}

.map-overlay-checkbox {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-height: 44px;
}

.map-overlay-checkbox input {
  width: 18px;
  height: 18px;
}

.map-overlay-editor-actions {
  justify-content: flex-end;
}

.compact-alert {
  padding: 10px 12px;
  margin: 0;
}

.sheet-map-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(280px, 380px);
  gap: 14px;
  align-items: start;
  min-height: 0;
}

.sheet-map-stage {
  display: grid;
  gap: 12px;
  min-height: 0;
}

.sheet-map-frame-wrap {
  min-height: 520px;
  border: 1px solid var(--line);
  background: #f7faf8;
  overflow: hidden;
}

.sheet-map-sidebar {
  min-width: 0;
  display: grid;
  align-content: start;
}

.sheet-map-canvas,
.sheet-map-frame {
  width: 100%;
  min-height: 520px;
  border: 0;
}

.sheet-map-canvas {
  position: relative;
}

.sheet-map-sidebar {
  min-width: 0;
  display: grid;
  grid-template-rows: minmax(0, 1fr);
  align-content: stretch;
  gap: 10px;
  min-height: 0;
}

.map-viewport-note {
  margin-top: 6px;
}

.sheet-map-selected {
  border: 1px solid var(--line);
  background: #fbfcfb;
  padding: 12px;
  display: grid;
  gap: 10px;
}

.sheet-map-selected.status-not-started {
  border-left: 6px solid #c5ceca;
}

.sheet-map-selected.status-started {
  border-left: 6px solid #e0ac53;
}

.sheet-map-selected.status-completed {
  border-left: 6px solid var(--brand);
}

.sheet-map-selected.archived-row {
  background: #faf7fc;
  border-color: #dbcfe9;
}

.sheet-map-selected.inactive-row {
  background: #fffaf1;
  border-color: #f1d29a;
}

.sheet-map-selected .muted {
  line-height: 1.45;
}

.map-reverse-address {
  display: grid;
  gap: 2px;
  margin-top: 4px;
  color: #465651;
  font-size: 12px;
  line-height: 1.35;
}

.map-reverse-address strong {
  color: #1f3f37;
  font-size: 11px;
  text-transform: uppercase;
}

.leaflet-popup-content .map-reverse-address {
  margin-top: 8px;
}

.sheet-map-list {
  max-height: 672px;
  overflow: auto;
  display: grid;
  gap: 10px;
  min-height: 0;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  padding-right: 4px;
}

.sheet-map-list-empty {
  border: 1px dashed var(--line);
  border-radius: 8px;
  background: #fbfcfb;
  padding: 14px;
}

.map-popup-actions {
  margin-top: 10px;
}

.leaflet-container {
  width: 100%;
  height: 100%;
  font: inherit;
  background: #f7faf8;
}

.leaflet-popup-content {
  margin: 10px 12px;
  line-height: 1.45;
  max-width: min(260px, calc(100vw - 40px));
  overflow-wrap: anywhere;
}

.leaflet-popup-content-wrapper {
  max-width: min(280px, calc(100vw - 24px));
}

.map-node-div-icon {
  border: 0;
  background: transparent;
}

.map-node-marker {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-height: 26px;
  padding: 3px 7px 3px 4px;
  border: 2px solid #fff;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.94);
  color: #1f3f37;
  box-shadow: 0 2px 9px rgba(18, 34, 29, 0.24);
  font-size: 11px;
  font-weight: 800;
  line-height: 1;
  white-space: nowrap;
  transform: translate(-50%, -100%);
  transition: transform 0.16s ease, box-shadow 0.16s ease, border-color 0.16s ease, background 0.16s ease;
}

.map-node-marker::after {
  content: '';
  position: absolute;
  left: 50%;
  bottom: -8px;
  width: 0;
  height: 0;
  border-left: 6px solid transparent;
  border-right: 6px solid transparent;
  border-top: 8px solid #fff;
  transform: translateX(-50%);
}

.map-node-marker.status-completed {
  box-shadow: 0 0 0 3px rgba(20, 108, 92, 0.18), 0 2px 9px rgba(18, 34, 29, 0.24);
}

.map-node-marker.status-started {
  box-shadow: 0 0 0 3px rgba(213, 148, 46, 0.22), 0 2px 9px rgba(18, 34, 29, 0.24);
}

.map-node-marker.status-not-started {
  box-shadow: 0 0 0 3px rgba(111, 125, 119, 0.18), 0 2px 9px rgba(18, 34, 29, 0.24);
}

.map-node-marker.active {
  z-index: 2;
  border-color: var(--brand);
  background: #ffffff;
  box-shadow: 0 0 0 4px rgba(32, 125, 92, 0.24), 0 4px 14px rgba(18, 34, 29, 0.3);
  transform: translate(-50%, -100%) scale(1.05);
}

.map-node-marker-label {
  display: inline-block;
  max-width: 92px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.map-node-symbol {
  width: 20px;
  height: 20px;
  flex: 0 0 20px;
  border-radius: 999px;
  display: inline-grid;
  place-items: center;
  background: #eef3f1;
  color: #1f3f37;
}

.map-node-symbol svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.map-node-armadio .map-node-symbol,
.map-node-symbol-armadio {
  background: #e8f6f1;
  color: #146c5c;
}

.map-node-pte .map-node-symbol,
.map-node-symbol-pte {
  background: #fff2df;
  color: #8a4d20;
}

.map-node-giunzione .map-node-symbol,
.map-node-symbol-giunzione {
  background: #e8f2f7;
  color: #1d5b80;
}

.map-node-generico .map-node-symbol,
.map-node-symbol-generico {
  background: #eef3f1;
  color: #5c6864;
}

.map-node-symbol.is-pdf {
  width: auto;
  height: auto;
  min-width: 20px;
  min-height: 20px;
  flex: 0 0 auto;
  padding: 0;
  background: transparent;
  border-radius: 0;
}

.map-node-symbol.is-pdf img {
  display: block;
  width: auto;
  height: 20px;
  max-width: 44px;
  object-fit: contain;
}

.map-node-symbol.is-pdf svg {
  display: block;
  width: auto;
  height: 20px;
  max-width: 44px;
}

.planimetry-pdf-overlay {
  max-width: none;
  pointer-events: none;
  user-select: none;
  mix-blend-mode: normal;
}

.planimetry-label {
  pointer-events: none;
}

.planimetry-label .planimetry-label-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 3px;
  min-width: 30px;
  min-height: 18px;
  padding: 2px 5px 2px 3px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid rgba(31, 63, 55, 0.32);
  color: #1f3f37;
  font-size: 11px;
  font-weight: 700;
  line-height: 1;
  box-shadow: 0 1px 4px rgba(18, 34, 29, 0.18);
  white-space: nowrap;
  transform: translate(-50%, -50%);
}

.planimetry-label .map-node-symbol {
  width: 14px;
  height: 14px;
  flex-basis: 14px;
}

.planimetry-label .map-node-symbol.is-pdf {
  width: auto;
  height: auto;
  min-width: 14px;
  min-height: 14px;
  flex-basis: auto;
}

.planimetry-label .map-node-symbol svg {
  width: 11px;
  height: 11px;
}

.planimetry-label .map-node-symbol.is-pdf img {
  height: 14px;
  max-width: 32px;
}

.planimetry-label .map-node-symbol.is-pdf svg {
  height: 14px;
  width: auto;
  max-width: 32px;
}

.planimetry-label-arc .planimetry-label-pill {
  border-color: rgba(29, 91, 128, 0.38);
  color: #1d5b80;
}

.planimetry-label-point .planimetry-label-pill {
  border-color: rgba(159, 92, 35, 0.38);
  color: #8a4d20;
}

.planimetry-label-selected .planimetry-label-pill {
  border-color: rgba(20, 108, 92, 0.5);
  background: rgba(255, 255, 255, 0.98);
  box-shadow: 0 0 0 4px rgba(32, 125, 92, 0.18), 0 2px 8px rgba(18, 34, 29, 0.2);
}

.map-location-card {
  width: 100%;
  border: 1px solid var(--line);
  border-left: 5px solid transparent;
  border-radius: 8px;
  background: #fff;
  color: var(--text);
  padding: 12px;
  display: grid;
  gap: 8px;
  text-align: left;
}

.map-location-card:hover {
  border-color: #b9ded1;
  border-left-color: var(--brand);
  background: #f7fbf9;
}

.map-location-card.active {
  border-color: #e3c45e;
  border-left-color: #d49b12;
  background: #fff2a8;
  box-shadow: 0 10px 24px rgba(212, 155, 18, 0.16);
}

.map-location-card.status-not-started {
  border-left-color: #c5ceca;
}

.map-location-card.status-started {
  border-left-color: #e0ac53;
}

.map-location-card.status-completed {
  border-left-color: var(--brand);
}

.map-location-card.archived-row {
  background: #faf7fc;
  border-color: #dbcfe9;
}

.map-location-card.inactive-row {
  background: #fffaf1;
  border-color: #f1d29a;
}

.map-location-card.archived-row:hover,
.map-location-card.archived-row.active {
  background: #fff0b8;
  border-color: #dfbe63;
}

.map-location-card.inactive-row:hover,
.map-location-card.inactive-row.active {
  background: #ffe7b0;
  border-color: #d7a44b;
}

.work-table tr.map-linked-row > td,
.original-unified-table tr.map-linked-row > td {
  cursor: pointer;
  transition: background 0.16s ease, box-shadow 0.16s ease;
}

.work-table tr.map-linked-row:hover > td,
.original-unified-table tr.map-linked-row:hover > td {
  background: #f7fbf9;
}

.work-table tr.active:hover > td,
.original-unified-table tr.active:hover > td {
  background: #fff2a8;
}

.work-table tr.active > td,
.original-unified-table tr.active > td {
  background: #fff2a8;
}

.work-table tr.active > td:first-child,
.original-unified-table tr.active > td:first-child {
  box-shadow: inset 5px 0 0 #d49b12;
}

.map-location-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 10px;
}

.map-location-head strong {
  font-size: 15px;
  line-height: 1.3;
}

.map-location-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.map-location-meta span {
  border: 1px solid var(--line);
  background: #f7faf8;
  padding: 4px 8px;
  font-size: 12px;
  color: #40514b;
}

.map-status-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.map-overall-badge {
  min-width: 146px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f7faf8;
  padding: 6px 8px;
  display: grid;
  gap: 2px;
}

.map-overall-badge strong {
  font-size: 12px;
}

.map-overall-badge small {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
}

.map-overall-badge.status-not-started {
  background: #f6f7f7;
  border-color: #d9e0dd;
}

.map-overall-badge.status-started {
  background: #fff8ec;
  border-color: #f0d5ab;
}

.map-overall-badge.status-completed {
  background: #edf6f2;
  border-color: #b9ded1;
}

.operation-visibility-item {
  display: grid;
  gap: 4px;
}

.operation-visibility-table {
  table-layout: fixed;
}

.operation-visibility-table th:first-child,
.operation-visibility-table td:first-child {
  width: auto;
}

.operation-visibility-table th:nth-child(n + 2),
.operation-visibility-table td:nth-child(n + 2) {
  width: 108px;
}

.operation-visibility-table th:nth-child(n + 2),
.operation-visibility-table td:nth-child(n + 2),
.visibility-cell {
  text-align: center;
  vertical-align: middle;
}

.visibility-cell {
  padding: 10px 8px;
}

.visibility-toggle {
  min-width: 66px;
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #eef3f1;
  color: var(--muted);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.16s ease, border-color 0.16s ease, color 0.16s ease, transform 0.16s ease;
}

.visibility-toggle:hover {
  border-color: rgba(20, 108, 92, 0.28);
  transform: translateY(-1px);
}

.visibility-toggle.active {
  background: var(--brand);
  border-color: var(--brand);
  color: #fff;
}

.map-status-badge {
  min-width: 118px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f7faf8;
  padding: 6px 8px;
  display: grid;
  gap: 2px;
}

.map-status-badge strong {
  font-size: 12px;
}

.map-status-badge small {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
}

.map-status-badge.status-not-started {
  background: #f6f7f7;
  border-color: #d9e0dd;
}

.map-status-badge.status-started {
  background: #fff8ec;
  border-color: #f0d5ab;
}

.map-status-badge.status-completed {
  background: #edf6f2;
  border-color: #b9ded1;
}

.original-sheet-header {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
}

.original-sheet-header h2 {
  margin: 0 0 4px;
  font-size: 18px;
}

.original-sheet-header p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.original-sheet-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: flex-end;
}

.original-sheet-legend span {
  border: 1px solid var(--line);
  background: #f7faf8;
  padding: 4px 7px;
  font-size: 12px;
  font-weight: 800;
}

.original-sheet-sections {
  display: grid;
  gap: 10px;
}

.original-section {
  border: 1px solid var(--line);
  background: #fbfcfb;
}

.original-section summary {
  min-height: 44px;
  padding: 10px 12px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  font-weight: 900;
}

.original-section summary small {
  color: var(--muted);
  font-weight: 800;
}

.original-sheet-scroll {
  position: relative;
  overflow: auto;
  border-top: 1px solid var(--line);
}

.original-sheet-table {
  min-width: 980px;
  border-collapse: separate;
  border-spacing: 0;
}

.original-sheet-table th,
.original-sheet-table td {
  min-width: 128px;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  background: #fff;
  vertical-align: top;
}

.original-sheet-table thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: #eef3f1;
}

.original-sheet-table .sticky-col {
  position: sticky;
  left: 0;
  z-index: 3;
  min-width: 220px;
  background: #f7faf8;
}

.sheet-columns-row th {
  background: #dfece7;
  color: #1d3b34;
  text-align: center;
}

.original-price-head {
  display: grid;
  gap: 3px;
  max-width: 220px;
}

.original-price-head strong {
  font-size: 12px;
  line-height: 1.25;
}

.original-price-head span,
.original-price-head small,
.original-sheet-table td small,
.original-sheet-table .sticky-col small {
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}

.original-sheet-table td {
  font-size: 13px;
}

.original-sheet-table td strong {
  display: block;
}

.original-sheet-table .empty-cell {
  color: #9aa7a2;
  background: #fbfcfb;
  text-align: center;
}

.original-sheet-table .note-cell {
  min-width: 180px;
  color: #40514b;
}

.original-sheet-table tfoot th,
.original-sheet-table tfoot td {
  background: #f7faf8;
  font-weight: 900;
}

.stat {
  min-height: 78px;
  border: 1px solid var(--line);
  background: #f9fbfa;
  padding: 12px;
  display: grid;
  align-content: space-between;
  gap: 8px;
}

.stat span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.stat-pair {
  align-content: stretch;
}

.stat-pair-row {
  display: grid;
  gap: 8px;
}

.stat-pair-row + .stat-pair-row {
  padding-top: 10px;
  border-top: 1px solid var(--line);
}

.stats-subset {
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fbf8fd;
}

.stats-subset-head {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.stats-subset-head strong {
  font-size: 13px;
  color: #40514b;
}

.stats-subset .stat {
  background: rgba(255, 255, 255, 0.86);
}

.stat strong {
  font-size: 20px;
}

.filter-bar {
  border: 1px solid var(--line);
  background: #f9fbfa;
  border-radius: 8px;
  padding: 12px;
}

.filter-bar-layout {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
  align-items: end;
}

.report-filter-bar {
  display: grid;
  gap: 10px;
}

.report-filter-row {
  display: grid;
  gap: 12px;
  align-items: end;
}

.report-filter-row-time {
  grid-template-columns: repeat(3, minmax(180px, 1fr));
}

.report-filter-row-companies,
.report-filter-row-contract-sheet {
  grid-template-columns: repeat(2, minmax(220px, 1fr));
}

.filter-bar-layout > label,
.filter-dropdown {
  min-width: 0;
}

.filter-dropdown {
  position: relative;
}

.filter-dropdown summary {
  list-style: none;
  min-height: 40px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--text);
  padding: 9px 10px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  cursor: pointer;
}

.filter-dropdown summary::-webkit-details-marker {
  display: none;
}

.filter-dropdown[open] summary {
  border-color: rgba(20, 108, 92, 0.28);
  box-shadow: 0 0 0 3px rgba(20, 108, 92, 0.08);
}

.filter-dropdown-label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.required-mark {
  color: #dc2626;
  font-weight: 800;
}

.filter-dropdown-value {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 700;
}

.filter-dropdown-menu {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  z-index: 4;
  width: 100%;
  min-width: 220px;
  max-height: 260px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: var(--shadow);
  padding: 8px;
  display: grid;
  gap: 6px;
}

.filter-check-option {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 10px;
  border-radius: 6px;
  background: #e8efec;
  color: var(--text);
  font-weight: 700;
  cursor: pointer;
}

.filter-check-option:hover {
  background: #dce8e3;
}

.filter-check-option.active {
  background: var(--brand);
  color: #fff;
}

.row-type-picker .filter-dropdown-value {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
}

.row-type-current,
.row-type-option {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

.row-type-current span:last-child,
.row-type-option span:last-child {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.row-type-option {
  width: 100%;
  border: 0;
  font: inherit;
  text-align: left;
}

.row-type-current .map-node-symbol.is-pdf,
.row-type-option .map-node-symbol.is-pdf {
  min-width: 48px;
  justify-content: center;
}

.row-type-current .map-node-symbol.is-pdf img,
.row-type-option .map-node-symbol.is-pdf img {
  max-width: 52px;
  height: 22px;
}

.row-type-current .map-node-symbol.is-pdf svg,
.row-type-option .map-node-symbol.is-pdf svg {
  max-width: 52px;
  height: 22px;
  width: auto;
}

.filter-check-box,
.visibility-toggle-check {
  width: 16px;
  height: 16px;
  flex: 0 0 16px;
  border-radius: 4px;
  border: 1.5px solid currentColor;
  display: inline-grid;
  place-items: center;
}

.filter-check-box::after,
.visibility-toggle-check::after {
  content: '';
  width: 8px;
  height: 8px;
  border-radius: 2px;
  background: currentColor;
  transform: scale(0);
  transition: transform 0.16s ease;
}

.filter-check-option.active .filter-check-box::after,
.visibility-toggle.active .visibility-toggle-check::after {
  transform: scale(1);
}

.filter-check-text {
  min-width: 0;
}

.worker-profile-options {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.worker-profile-options .filter-check-option {
  min-height: 38px;
}

.worked-rows-mode-options {
  display: grid;
  gap: 8px;
  margin-top: 8px;
}

.worked-rows-mode-option {
  width: 100%;
  align-items: flex-start;
}

.worked-rows-mode-option .filter-check-box {
  margin-top: 1px;
  border-radius: 999px;
}

.worked-rows-mode-option .filter-check-box::after {
  border-radius: 999px;
}

.muted {
  color: var(--muted);
  font-size: 13px;
}

.section-log-list {
  display: grid;
  gap: 4px;
  margin-top: 6px;
}

.section-contest-block {
  border: 1px solid #ead8b5;
  background: #fff8ec;
  padding: 8px;
  display: grid;
  gap: 8px;
}

.section-contest-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.section-contest-head strong {
  font-size: 12px;
}

.contest-note-list {
  display: grid;
  gap: 6px;
}

.contest-note-panel {
  min-height: 0;
}

.contest-note-scroll {
  max-height: min(56vh, 480px);
  overflow-y: auto;
  padding-right: 4px;
}

.contest-note-item {
  border-left-color: #d39c44;
  background: rgba(255, 255, 255, 0.72);
  padding: 8px 0 8px 8px;
}

.badge.contest-indicator {
  min-height: 24px;
  padding: 4px 7px;
  background: #fff3df;
  color: var(--amber);
}

.badge.contest-indicator .action-svg {
  width: 14px;
  height: 14px;
}

.map-contest-summary,
.map-contest-section {
  display: grid;
  gap: 8px;
}

.map-contest-section strong {
  font-size: 12px;
}

.section-log-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: start;
  gap: 6px;
  font-size: 12px;
  color: var(--muted);
}

.section-log-main {
  display: grid;
  gap: 6px;
}

.section-log-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  justify-content: flex-end;
}

.section-log-item .icon-action {
  min-width: 28px;
  width: 28px;
  height: 28px;
  padding: 0;
}

.original-unified-table {
  min-width: 1180px;
  border-collapse: separate;
  border-spacing: 0;
}

.original-unified-table th,
.original-unified-table td {
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  background: #fff;
  vertical-align: top;
}

.original-unified-table thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: #eef3f1;
}

.original-unified-table .sticky-col {
  position: sticky;
  left: 0;
  z-index: 3;
  min-width: 220px;
  background: #f7faf8;
}

.original-unified-table thead th:last-child,
.original-unified-table tbody td:last-child {
  position: sticky;
  right: 0;
  background: #fff;
  box-shadow: -8px 0 12px rgba(24, 36, 32, 0.08);
}

.original-unified-table thead th:last-child {
  z-index: 4;
  background: #eef3f1;
}

.work-table thead th[aria-sort="ascending"],
.work-table thead th[aria-sort="descending"],
.original-unified-table thead th[aria-sort="ascending"],
.original-unified-table thead th[aria-sort="descending"] {
  background: #e3f0ea;
}

.original-unified-table tbody td:last-child {
  z-index: 2;
  min-width: clamp(148px, 18vw, 220px);
}

.original-unified-table tbody td:last-child .row-actions {
  justify-content: flex-start;
}

.row-section-card {
  border: 1px solid var(--line);
  background: #fbfcfb;
  min-width: 220px;
}

.row-section-card summary {
  list-style: none;
  cursor: pointer;
  padding: 0;
}

.row-section-card summary::-webkit-details-marker {
  display: none;
}

.row-section-summary-head {
  display: grid;
  gap: 8px;
  padding: 10px;
}

.row-section-summary-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.row-section-summary-badges {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.row-section-summary {
  display: grid;
  gap: 5px;
}

.row-section-summary-shell {
  display: grid;
  gap: 6px;
  min-width: 0;
}

.row-section-summary-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 6px;
  margin-left: auto;
}

.row-section-summary-actions .icon-action {
  width: 34px;
  height: 34px;
}

.row-section-summary strong {
  font-size: 14px;
  line-height: 1.2;
}

.row-section-summary small,
.row-section-empty small,
.row-section-item small,
.original-unified-table .sticky-col small {
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  line-height: 1.45;
}

.row-section-breakdown {
  border-top: 1px solid var(--line);
  display: grid;
  gap: 0;
}

.row-section-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  padding: 9px 10px;
  border-top: 1px solid #edf2ef;
}

.row-section-item:first-child {
  border-top: 0;
}

.row-section-item > div {
  display: grid;
  gap: 3px;
}

.row-section-summary-body {
  border-top: 1px solid var(--line);
  padding: 9px 10px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  line-height: 1.45;
}

.row-notes-card {
  min-width: 180px;
}

.row-section-item-values {
  text-align: right;
}

.row-section-empty {
  display: grid;
  gap: 3px;
  min-width: 180px;
}

.technical-fields-trigger {
  min-width: 150px;
  display: grid;
  gap: 8px;
  border: 1px solid var(--line);
  background: #fbfcfb;
  padding: 10px;
}

.technical-fields-trigger strong {
  font-size: 18px;
  line-height: 1;
}

.technical-fields-trigger small,
.technical-fields-card strong {
  font-size: 11px;
  color: var(--muted);
  font-weight: 800;
  text-transform: uppercase;
}

.technical-fields-modal-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(220px, 1fr));
  gap: 12px;
}

.technical-fields-card {
  display: grid;
  gap: 8px;
  border: 1px solid var(--line);
  background: #fbfcfb;
  padding: 12px;
}

.technical-fields-card > div {
  min-height: 24px;
}

.technical-fields-card .muted {
  line-height: 1.45;
}

.original-unified-table .note-cell {
  min-width: 190px;
  color: #40514b;
}

.assignment-form {
  display: grid;
  grid-template-columns: repeat(4, minmax(150px, 1fr)) auto;
  gap: 10px;
  align-items: end;
}

.assignment-planner-toolbar {
  display: grid;
  grid-template-columns: minmax(160px, 200px) minmax(140px, 180px) minmax(220px, 1fr) auto;
  gap: 12px;
  align-items: end;
  border: 1px solid var(--line);
  background: #f9fbfa;
  padding: 12px;
}

.assignment-bulk-hint {
  grid-column: 1 / -1;
}

.assignment-planner-table td {
  vertical-align: top;
}

.assignment-row-meta {
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
}

.assignment-slot {
  display: grid;
  gap: 6px;
  min-width: 180px;
}

.assignment-slot-select {
  width: 100%;
  min-height: 92px;
}

.assignment-slot-status {
  color: var(--muted);
  font-size: 12px;
}

.assignment-slot-select:disabled {
  background: #f3eef8;
  color: var(--muted);
  cursor: not-allowed;
}

.assignment-slot.is-archived .assignment-slot-status {
  font-weight: 700;
}

.worker-row-selector {
  border: 1px solid var(--line);
  background: #f9fbfa;
  border-radius: 6px;
  padding: 10px 12px;
  display: grid;
  gap: 10px;
}

.worker-row-selector-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.worker-row-selector label {
  min-width: 0;
}

.worker-row-selector select {
  max-width: 100%;
}

.alert {
  border: 1px solid #f0c7c1;
  background: #fff5f3;
  color: var(--red);
  padding: 10px 12px;
  border-radius: 6px;
}

.success {
  border: 1px solid #b9ded1;
  background: #f0faf6;
  color: var(--brand-strong);
  padding: 10px 12px;
  border-radius: 6px;
}

.hidden {
  display: none !important;
}

@media (max-width: 1180px) {
  .main-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .stats-grid {
    grid-template-columns: repeat(2, minmax(120px, 1fr));
  }

  .row-media-grid {
    grid-template-columns: 1fr;
  }

  .section-note-modal-grid {
    grid-template-columns: 1fr;
  }

  .operation-edit-summary-grid {
    grid-template-columns: 1fr;
  }

  .sheet-attachment-item {
    grid-template-columns: 1fr;
  }

  .operation-feedback-panel {
    padding: 22px 18px;
  }

  .operation-entry-field,
  .operation-entry-field-note {
    grid-column: auto;
  }

  .filter-bar-layout {
    grid-template-columns: repeat(2, minmax(220px, 1fr));
  }

  .sheet-map-layout {
    grid-template-columns: 1fr;
  }

  .map-overlay-editor-layout,
  .map-overlay-form-grid {
    grid-template-columns: 1fr;
  }

  .map-overlay-editor-list {
    max-height: 260px;
  }

  .sheet-map-list {
    max-height: none;
  }

  .assignment-form {
    grid-template-columns: 1fr 1fr;
  }

  .assignment-planner-toolbar {
    grid-template-columns: 1fr;
  }

  .price-grid {
    grid-template-columns: 1fr;
  }

  .technical-fields-modal-grid {
    grid-template-columns: 1fr;
  }

  .modal-backdrop {
    align-items: end;
    padding: 10px;
  }

  .modal-panel {
    max-height: calc(100vh - 20px);
    width: 100%;
  }

  .active-detail-header,
  .active-sheet-hero {
    align-items: flex-start;
  }

  .active-detail-header .row-actions,
  .active-sheet-meta {
    justify-content: flex-start;
    width: 100%;
  }

  .active-sheet-aside {
    width: 100%;
    justify-items: start;
  }

}

@media (max-width: 920px) {
  .login-view,
  .main-grid,
  .profile-grid,
  .profile-meta-grid,
  .split,
  .stats-grid {
    grid-template-columns: 1fr;
  }

  .login-art {
    display: none;
  }

  .sidebar {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .topbar {
    align-items: flex-start;
    flex-direction: column;
    position: static;
  }

  .user-box {
    justify-content: flex-start;
    width: 100%;
  }

  .hamburger-menu,
  .hamburger-button,
  .language-picker {
    width: 100%;
  }

  .hamburger-panel {
    left: 0;
    right: auto;
    width: 100%;
  }

  .price-list-editor-grid-main {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .compact-operation-form {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .filter-bar-layout {
    grid-template-columns: 1fr;
  }

  .report-filter-row-time,
  .report-filter-row-companies,
  .report-filter-row-contract-sheet {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 280px) {
  .topbar,
  .content,
  .sidebar,
  .login-panel {
    padding: 12px;
  }

  .login-view-clean {
    padding: 14px;
  }

  .login-panel-clean {
    padding: 22px;
    border-radius: 22px;
  }

  .operation-entry-fields {
    display: flex;
    flex-direction: column;
  }

  .operation-entry-row {
    grid-template-columns: 1fr;
  }

  .fiber-works-logo {
    width: 64px;
    height: 64px;
  }

  .fiber-works-logo svg {
    width: 56px;
    height: 56px;
  }

  .panel-header {
    align-items: flex-start;
    flex-direction: column;
  }

  .active-sheet-hero {
    align-items: flex-start;
    flex-direction: column;
  }

  .sheet-display-toggle,
  .sheet-map-header,
  .map-location-head {
    flex-direction: column;
  }

  .sheet-map-frame-wrap,
  .sheet-map-canvas,
  .sheet-map-frame {
    min-height: 320px;
  }

  .assignment-form {
    grid-template-columns: 1fr;
  }

  .assignment-slot {
    min-width: 140px;
  }

  .active-sheet-meta {
    justify-content: flex-start;
    width: 100%;
  }

  .sheets-table tbody td:last-child,
  .sticky-actions-table tbody td:last-child,
  .original-unified-table tbody td:last-child {
    min-width: 148px;
  }

  .totals-scope-option {
    flex-basis: 100%;
  }

  .btn {
    width: 100%;
  }

  .row-actions .btn {
    width: auto;
  }

  .row-actions .icon-action {
    width: 40px;
  }

  .photo-list {
    grid-template-columns: repeat(3, 64px);
  }

  .price-list-form-hero,
  .price-list-editor-add,
  .price-list-editor-controls,
  .price-list-editor-grid-main,
  .compact-operation-form {
    grid-template-columns: 1fr;
  }

  .price-list-editor-hero,
  .price-list-editor-card-head {
    flex-direction: column;
  }

  .price-list-editor-card-actions {
    justify-content: flex-end;
  }
}

/* ── iOS safe areas ───────────────────────────────────────── */
.topbar {
  padding-left: max(22px, env(safe-area-inset-left));
  padding-right: max(22px, env(safe-area-inset-right));
}

.content {
  padding-bottom: max(18px, env(safe-area-inset-bottom));
}

/* ── Touch targets ───────────────────────────────────────── */
input, select, textarea {
  min-height: 44px;
}

.btn {
  min-height: 44px;
}

.nav-item {
  min-height: 44px;
}

/* ── iOS zoom prevention (font < 16px triggers zoom) ──────── */
input, select, textarea {
  font-size: max(16px, 1em);
}

/* ── iOS tap highlight ────────────────────────────────────── */
* {
  -webkit-tap-highlight-color: transparent;
}

button, a {
  touch-action: manipulation;
}

/* ── Visual polish ───────────────────────────────────────── */
.panel {
  border-radius: 12px;
}

.btn {
  border-radius: 8px;
  transition: background 0.15s, color 0.15s, box-shadow 0.15s;
}

.nav-item {
  transition: background 0.15s, color 0.15s;
}

table tbody tr:hover {
  background: #f8faf9;
}

.modal-backdrop {
  backdrop-filter: blur(8px);
}

input:focus, select:focus, textarea:focus {
  outline: 2px solid var(--brand);
  outline-offset: 2px;
}

.panel:hover {
  box-shadow: 0 4px 16px rgba(24, 39, 33, 0.10);
  transition: box-shadow 0.18s;
}

.form-grid {
  gap: 16px;
}

label {
  gap: 6px;
}

/* ── Tablet layout (max-width: 768px) ───────────────────── */
@media (max-width: 768px) {
  .form-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .form-grid .form-wide {
    grid-column: 1 / -1;
  }

  .stats-grid {
    grid-template-columns: repeat(2, minmax(140px, 1fr));
  }

  .topbar {
    padding: 10px 16px;
  }

  .filter-bar {
    flex-direction: column;
    align-items: stretch;
  }

  .filter-bar select,
  .filter-bar input {
    width: 100%;
  }
}

/* ── Mobile layout (max-width: 640px) ───────────────────── */
@media (max-width: 640px) {
  .form-grid {
    grid-template-columns: 1fr;
  }

  .sheets-table {
    display: block;
  }

  .sheets-table thead {
    display: none;
  }

  .sheets-table tbody tr {
    display: grid;
    padding: 14px;
    border-bottom: 1px solid var(--line);
    border-left: 3px solid var(--brand);
    margin-bottom: 4px;
    background: var(--panel);
    border-radius: 8px;
  }
}

/* ── Mobile layout (max-width: 480px) ───────────────────── */
@media (max-width: 480px) {
  .content {
    padding: 12px;
  }

  .panel-header {
    flex-wrap: wrap;
    gap: 10px;
  }

  .panel-header .row-actions {
    width: 100%;
    flex-wrap: wrap;
  }

  .panel-header .row-actions .btn {
    flex: 1 1 120px;
  }

  .form-grid {
    grid-template-columns: 1fr;
  }

  .form-grid .form-wide {
    grid-column: 1;
  }

  .form-grid .btn[type="submit"],
  .form-grid button[type="submit"] {
    width: 100%;
  }

  .row-actions {
    flex-wrap: wrap;
    gap: 6px;
  }

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

  .filter-bar {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
  }

  .filter-bar select,
  .filter-bar input {
    width: 100%;
    min-height: 44px;
  }

  .stats-grid {
    grid-template-columns: 1fr;
  }

  .embedded-create-section {
    padding: 12px;
  }

  .topbar {
    padding: 10px 14px;
    padding-left: max(14px, env(safe-area-inset-left));
    padding-right: max(14px, env(safe-area-inset-right));
  }
}

/* ── Modal mobile sheet pattern ──────────────────────────── */
@media (max-width: 720px) {
  .modal-backdrop {
    align-items: flex-end;
    padding: 0;
  }

  .modal-panel {
    border-radius: 20px 20px 0 0;
    max-height: 92vh;
    width: 100%;
  }
}

/* ── Sticky table last column shadow on mobile ─────────────── */
@media (max-width: 640px) {
  .sticky-actions-table {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .sticky-actions-table th:last-child,
  .sticky-actions-table td:last-child {
    position: sticky;
    right: 0;
    background: var(--panel);
    box-shadow: -3px 0 8px rgba(0,0,0,0.08);
  }
}

/* ── Report contract banner ─────────────────────────────── */
.report-contract-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  padding: 12px 16px;
  background: linear-gradient(135deg, #f0f7f4 0%, #eaf2ef 100%);
  border: 1px solid var(--line);
  border-radius: 10px 10px 0 0;
  border-bottom: 2px solid var(--brand);
  margin-top: 20px;
}

.report-contract-banner:first-child {
  margin-top: 0;
}

.report-contract-banner-copy {
  display: grid;
  gap: 3px;
}

.report-contract-banner-copy strong {
  font-size: 15px;
  color: var(--brand-strong);
}

.report-contract-banner-copy span {
  font-size: 12px;
  color: var(--muted);
  font-weight: 700;
}

.report-contract-banner + .table-wrap table {
  border-top: none;
  border-radius: 0 0 8px 8px;
}

.report-grand-total {
  display: flex;
  gap: 20px;
  align-items: center;
  flex-wrap: wrap;
  padding: 12px 16px;
  background: var(--panel-soft);
  border: 1px solid var(--line);
  border-radius: 8px;
  font-weight: 700;
  margin-top: 8px;
}

.report-grand-total strong {
  margin-right: auto;
}

@media (max-width: 640px) {
  .report-contract-banner {
    flex-direction: column;
    align-items: flex-start;
  }

  .report-grand-total {
    flex-direction: column;
    gap: 8px;
    align-items: flex-start;
  }
}

/* ── Expense entry form ──────────────────────────────────── */
.expense-entry-form {
  display: grid;
  gap: 16px;
}

.expense-entry-head {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  align-items: flex-start;
  padding: 14px 16px;
  background: var(--panel-soft);
  border: 1px solid var(--line);
  border-radius: 10px;
}

.expense-entry-meta {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 100px;
}

.expense-entry-date-label {
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
}

.expense-entry-date {
  font-size: 18px;
  color: var(--brand-strong);
}

.expense-type-options {
  flex: 1 1 300px;
  display: grid;
  gap: 6px;
}

.expense-type-label {
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
}

.expense-type-radio-group {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.expense-type-option {
  flex: 1 1 100px;
  justify-content: center;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 8px;
  transition: background 0.12s, border-color 0.12s;
}

.expense-type-option.active {
  background: var(--brand);
  border-color: var(--brand);
  color: #fff;
}

.expense-type-option.active .filter-check-box {
  border-color: rgba(255,255,255,0.5);
  background: rgba(255,255,255,0.2);
}

.expense-type-option.active .filter-check-box::after {
  background: #fff;
}

.expense-entry-fields {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
  align-items: end;
}

.expense-entry-fields label {
  display: flex;
  flex-direction: column-reverse;
  gap: 4px;
}

.expense-entry-fields label span {
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
}

.expense-entry-fields label.form-wide {
  grid-column: 1 / -1;
}

.expense-entry-field-heading {
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
}

.expense-entry-photo {
  grid-column: 1 / -1;
}

.expense-photo-selector {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: end;
}

.expense-photo-selector .btn {
  min-height: 44px;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.expense-photo-selector .action-svg {
  width: 18px;
  height: 18px;
}

.expense-attachments-editor {
  display: grid;
  gap: 8px;
}

.expense-attachments-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.expense-attachment-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #f6faf8;
}

.expense-attachment-chip a {
  font-weight: 700;
}

@media (max-width: 640px) {
  .expense-entry-fields {
    grid-template-columns: 1fr;
  }

  .expense-type-option {
    flex-basis: calc(50% - 4px);
  }
}

/* ── Virtual Assistant Full-Page ─────────────────────────────────────── */

.va-fullpage {
  display: grid;
  grid-template-columns: 260px 1fr;
  height: calc(100vh - 120px);
  min-height: 500px;
  gap: 0;
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow: hidden;
  background: var(--panel);
}

.va-sidebar {
  background: #f8faf9;
  border-right: 1px solid var(--line);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  overflow-y: auto;
}

.va-sidebar-section {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.va-sidebar-section strong {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--muted);
}

.va-suggested-btn {
  display: block;
  width: 100%;
  text-align: left;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--panel);
  cursor: pointer;
  font: inherit;
  font-size: 0.82rem;
  color: var(--text);
  line-height: 1.4;
  transition: border-color .15s, background .15s;
}

.va-suggested-btn:hover {
  border-color: var(--brand);
  background: #f0f7f5;
}

.va-suggested-big {
  display: inline-block;
  width: auto;
  margin: 4px;
  padding: 10px 16px;
  font-size: 0.88rem;
  border-radius: 20px;
}

.va-main {
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.va-messages-full {
  flex: 1;
  overflow-y: auto;
  padding: 20px 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.va-empty-state {
  text-align: center;
  padding: 48px 24px;
  margin: auto;
  max-width: 500px;
}

.va-empty-icon {
  font-size: 3rem;
  margin-bottom: 12px;
}

.va-empty-state h2 {
  margin: 0 0 8px;
}

.va-input-row-full {
  display: flex;
  gap: 8px;
  padding: 12px 16px;
  border-top: 1px solid var(--line);
  background: #fcfdfc;
  align-items: flex-end;
}

.va-input-full {
  flex: 1;
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  font: inherit;
  resize: none;
  min-height: 42px;
  max-height: 200px;
  background: var(--panel);
}

.va-input-full:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 2px rgba(20,108,92,0.12);
}

.va-role-label {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--muted);
  margin-bottom: 2px;
  padding: 0 4px;
}

.va-message {
  max-width: 80%;
}

.va-user { align-self: flex-end; }
.va-assistant { align-self: flex-start; }

.va-bubble {
  padding: 10px 14px;
  border-radius: 14px;
  line-height: 1.55;
  font-size: 0.92rem;
}

.va-user .va-bubble {
  background: var(--brand);
  color: #fff;
  border-bottom-right-radius: 4px;
}

.va-assistant .va-bubble {
  background: #f0f4f2;
  color: var(--text);
  border-bottom-left-radius: 4px;
}

.va-cost {
  font-size: 0.68rem;
  margin-top: 2px;
  text-align: right;
  padding: 0 4px;
}

/* Tables inside AI responses */
.va-table-wrap {
  overflow-x: auto;
  margin: 8px 0;
}

.va-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}

.va-table th {
  background: var(--brand);
  color: #fff;
  padding: 6px 10px;
  text-align: left;
  font-weight: 600;
}

.va-table td {
  padding: 5px 10px;
  border-bottom: 1px solid var(--line);
}

.va-table tr:nth-child(even) td {
  background: #f9fbfa;
}

.va-bubble ul, .va-bubble ol {
  margin: 4px 0;
  padding-left: 20px;
}

.va-bubble li {
  margin: 2px 0;
}

.va-bubble code {
  background: rgba(0,0,0,0.06);
  padding: 1px 5px;
  border-radius: 3px;
  font-size: 0.85em;
}

.va-bubble a {
  color: var(--brand);
  text-decoration: underline;
}

.va-bubble strong {
  font-weight: 700;
}

.va-bubble .mermaid {
  margin: 12px 0;
  padding: 8px;
  background: var(--card);
  border-radius: 8px;
  overflow-x: auto;
  display: flex;
  justify-content: center;
}

.va-bubble .mermaid svg {
  max-width: 100%;
  height: auto;
}

.va-chart-error {
  padding: 12px;
  background: #fef2f2;
  border: 1px solid #fecaca;
  border-radius: 8px;
  color: #991b1b;
  font-size: 0.85rem;
  text-align: center;
}

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

@media (max-width: 768px) {
  .va-fullpage {
    grid-template-columns: 1fr;
    grid-template-rows: auto 1fr;
    height: calc(100vh - 100px);
  }

  .va-sidebar {
    border-right: none;
    border-bottom: 1px solid var(--line);
    flex-direction: row;
    flex-wrap: wrap;
    gap: 8px;
    padding: 10px;
    overflow-y: visible;
  }

  .va-sidebar-section {
    flex: 1;
    min-width: 120px;
  }

  .va-message {
    max-width: 90%;
  }
}

/* ── Virtual Assistant (legacy narrow) ────────────────────────────────── */

.va-messages {
  min-height: 300px;
  max-height: 500px;
  overflow-y: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
  background: #fcfdfc;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.va-input-row {
  display: flex;
  gap: 8px;
  align-items: center;
}

.va-input {
  flex: 1;
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  font: inherit;
  background: var(--panel);
}

.va-input:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 2px rgba(20,108,92,0.15);
}

.va-upload-btn {
  cursor: pointer;
  padding: 10px 12px;
}

.va-upload-btn input[type="file"] {
  display: none;
}

/* Voice input / output */
.va-mic-btn {
  padding: 10px 14px;
  font-size: 1.1rem;
  border-radius: 50%;
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background .2s, transform .15s;
  flex-shrink: 0;
}

.va-mic-btn .action-svg {
  width: 20px;
  height: 20px;
}

.va-mic-active {
  background: #e53e3e;
  color: #fff;
  animation: va-mic-pulse 1.5s infinite;
}

@keyframes va-mic-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(229,62,62,0.4); }
  50% { box-shadow: 0 0 0 8px rgba(229,62,62,0); }
}

.va-listening-indicator {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  background: #fff5f5;
  border-bottom: 2px solid #e53e3e;
  font-size: 0.88rem;
  color: #c53030;
  animation: fadeIn .2s;
}

.va-listening-pulse {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #e53e3e;
  animation: va-mic-pulse 1s infinite;
}

.va-speak-btn {
  background: none;
  border: 1px solid var(--line);
  border-radius: 50%;
  width: 28px;
  height: 28px;
  cursor: pointer;
  font-size: 0.8rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  opacity: 0.5;
  transition: opacity .15s, background .15s;
  padding: 0;
}

.va-speak-btn:hover {
  opacity: 1;
  background: var(--panel-soft);
}

.va-message-foot {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 2px;
  padding: 0 4px;
  min-height: 20px;
}

/* ── Notifiche in-app ─────────────────────────────────────────── */
.notifications-bell { position: relative; }
.notifications-bell .notification-badge {
  position: absolute; top: -6px; right: -6px; min-width: 18px; height: 18px;
  padding: 0 5px; border-radius: 999px; background: #94a3b8; color: #fff;
  font-size: 11px; font-weight: 700; display: flex; align-items: center; justify-content: center;
}
.notifications-bell .notification-badge.active { background: #dc2626; }
.notifications-panel {
  position: absolute; right: 0; top: calc(100% + 8px); width: 340px; max-width: 90vw;
  background: var(--panel-bg, #fff); border: 1px solid var(--border, #e2e8f0);
  border-radius: 10px; box-shadow: 0 12px 32px rgba(15, 23, 42, 0.18); z-index: 60;
  max-height: 420px; display: flex; flex-direction: column; overflow: hidden;
}
.notifications-panel-head { display: flex; align-items: center; justify-content: space-between; padding: 10px 12px; border-bottom: 1px solid var(--border, #e2e8f0); }
.notifications-list { overflow-y: auto; }
.notification-item {
  display: flex; flex-direction: column; gap: 2px; width: 100%; text-align: left;
  padding: 10px 12px; border: 0; border-bottom: 1px solid var(--border, #eef2f7);
  background: transparent; cursor: pointer; font: inherit; color: inherit;
}
.notification-item:hover { background: var(--surface-muted, #f8fafc); }
.notification-item.unread { background: #eff6ff; }
.notification-item small { color: #94a3b8; }
.notification-empty { padding: 16px 12px; }

/* ── Dashboard ────────────────────────────────────────────────── */
.dashboard-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 10px; }
.dashboard-card {
  display: flex; flex-direction: column; gap: 4px; padding: 14px; border-radius: 10px;
  border: 1px solid var(--border, #e2e8f0); background: var(--surface-muted, #f8fafc);
}
.dashboard-card strong { font-size: 22px; }
.dashboard-card.danger strong { color: #dc2626; }
.dashboard-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 12px; margin-top: 4px; }

/* ── Badge stati foglio ───────────────────────────────────────── */
.sheet-detail-badges { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 4px; }
.badge.approved { background: #dcfce7; color: #166534; }
.badge.pending { background: #fef9c3; color: #854d0e; }
.badge.overdue { background: #fee2e2; color: #991b1b; }
.badge.due { background: #e0e7ff; color: #3730a3; }

/* ── Selezione fogli per export batch ─────────────────────────── */
.batch-sheet-check { width: 16px; height: 16px; margin-right: 8px; flex: none; accent-color: #4f46e5; }
.sheet-title-line { display: flex; align-items: center; flex-wrap: wrap; }

/* ── TOTP / 2FA ──────────────────────────────────────────────── */
.totp-status-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.totp-secret-row { display: flex; gap: 8px; align-items: center; }
.totp-secret-row input { flex: 1; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; letter-spacing: 0.08em; }
.totp-backup-codes {
  background: #0f172a; color: #e2e8f0; padding: 12px 14px; border-radius: 8px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace; line-height: 1.7; overflow-x: auto;
}

/* ── Offline banner ──────────────────────────────────────────── */
.offline-banner {
  background: #f59e0b; color: #78350f; padding: 8px 16px;
  font-size: 13px; font-weight: 600; text-align: center;
}

/* ── Dashboard trend bars ────────────────────────────────────── */
.trend-bars { display: grid; gap: 8px; }
.trend-bar-row { display: grid; grid-template-columns: 64px 1fr 44px; align-items: center; gap: 8px; }
.trend-bar-label { font-size: 12px; color: #64748b; text-align: right; }
.trend-bar-track { height: 14px; background: #eef2f7; border-radius: 999px; overflow: hidden; }
.trend-bar-fill { height: 100%; background: #16a34a; border-radius: 999px; }
.trend-bar-value { font-size: 12px; font-weight: 700; }

/* ═══════════════════════════════════════════════════════════════════════════
   MOBILE REVISION — wide data tables become stacked cards + compact chrome.
   Desktop/tablet layout is untouched (these rules only apply under 820px).
   Tables are turned into cards by `decorateMobileTables()` in app.js, which
   adds the `.mobile-cards` class and a `data-label` on every cell.
   ═══════════════════════════════════════════════════════════════════════════ */

/* ── Compact topbar ─────────────────────────────────────────── */
@media (max-width: 820px) {
  .topbar {
    padding: 8px 12px;
    padding-left: max(12px, env(safe-area-inset-left));
    padding-right: max(12px, env(safe-area-inset-right));
    gap: 8px;
  }
  .product-mark { font-size: 18px; gap: 8px; }
  .mark-dot { width: 26px; height: 26px; font-size: 14px; border-radius: 7px; }
  .user-box { gap: 8px; }
  .user-box > .muted { display: none; }
  .user-box > strong { font-size: 13px; }
  .hamburger-current { max-width: 150px; }
  .language-picker { min-width: 0; }
  .language-picker select { min-width: 0; max-width: 116px; padding: 5px 6px; }
}

@media (max-width: 600px) {
  .product-mark { font-size: 0; gap: 0; }
  .product-mark .mark-dot { font-size: 16px; }
  .user-box > strong,
  .user-box > .badge { display: none; }
  .hamburger-current { max-width: 90px; }
  .language-picker select { max-width: 58px; }
  .topbar .btn.secondary { padding: 6px 10px; font-size: 13px; }
}

/* ── Table → stacked cards ──────────────────────────────────── */
@media (max-width: 820px) {
  table.mobile-cards {
    min-width: 0;
    width: 100%;
    display: block;
    background: transparent;
    border: 0;
  }
  table.mobile-cards thead {
    display: none;
  }
  table.mobile-cards tbody {
    display: grid;
    gap: 10px;
  }
  table.mobile-cards tbody tr {
    display: grid;
    gap: 9px;
    margin: 0;
    padding: 14px;
    background: var(--panel);
    border: 1px solid var(--line);
    border-left: 4px solid var(--brand);
    border-radius: 12px;
    box-shadow: 0 2px 10px rgba(24, 39, 33, 0.05);
  }
  table.mobile-cards tbody tr:hover {
    background: var(--panel);
  }
  table.mobile-cards tbody tr > td {
    display: grid;
    gap: 3px;
    padding: 0;
    border: 0;
    text-align: left;
    vertical-align: top;
    min-width: 0;
    position: static !important;
    box-shadow: none !important;
    background: transparent !important;
    font-size: 14px;
  }
  table.mobile-cards tbody tr > td::before {
    content: attr(data-label);
    color: var(--muted);
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    line-height: 1.3;
  }
  table.mobile-cards .report-number,
  table.mobile-cards td.report-number {
    text-align: left;
  }
  /* cells that span the full card width (actions, colspan rows, notes) */
  table.mobile-cards td.mobile-card-full,
  table.mobile-cards tbody tr > td:only-child {
    display: block;
    grid-column: 1 / -1;
    padding-top: 3px;
    border-top: 1px dashed var(--line);
  }
  table.mobile-cards td.mobile-card-full::before,
  table.mobile-cards tbody tr > td:only-child::before {
    content: none;
  }
  table.mobile-cards .row-actions {
    justify-content: flex-start;
    flex-wrap: wrap;
    gap: 8px;
    max-width: none;
    overflow: visible;
  }
  table.mobile-cards .row-actions .btn,
  table.mobile-cards .row-actions .icon-action {
    flex: 1 1 auto;
    min-width: 44px;
  }
  /* keep meaningful cell emphasis */
  table.mobile-cards tbody tr > td:first-child {
    font-weight: 700;
  }
  table.mobile-cards td .muted {
    font-weight: 400;
  }
}

/* ── Content & panels on phones ─────────────────────────────── */
@media (max-width: 600px) {
  .content {
    padding: 12px 10px;
    padding-bottom: max(12px, env(safe-area-inset-bottom));
    gap: 12px;
  }
  .panel-header {
    padding: 12px;
    gap: 10px;
  }
  .panel-body {
    padding: 12px;
  }
  .panel-title {
    font-size: 16px;
  }
  .stats-grid,
  .report-statement-meta {
    grid-template-columns: 1fr 1fr;
  }
  .stats-grid-subset {
    grid-template-columns: 1fr;
  }
  .table-wrap {
    border-radius: 10px;
  }
}

/* ── Bonus percentuali per utente ──────────────────────────── */
.bonus-rate-row {
  display: grid;
  grid-template-columns: minmax(120px, 1fr) minmax(150px, 1fr) minmax(150px, 1fr) auto;
  gap: 10px;
  align-items: end;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fbfcfb;
}
.bonus-rate-row label { display: grid; gap: 6px; font-weight: 700; }
.bonus-rate-row .btn.danger { background: #fff1f0; color: var(--red); border: 1px solid #f0c9c5; }
@media (max-width: 720px) {
  .bonus-rate-row { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 480px) {
  .bonus-rate-row { grid-template-columns: 1fr; }
}

/* Il classico [hidden] deve vincere su display impostati (es. .price-list-details { display:grid }):
   evita che sezioni come "Permessi assistente" restino visibili per ruoli non assistente (es. solo operatore). */
[hidden] {
  display: none !important;
}
