/* Gestionale ATENA Design System - single global stylesheet. */
@import "./tokens/fonts.css";
@import "./tokens/colors.css";
@import "./tokens/typography.css";
@import "./tokens/spacing.css";

/* Application layer: Flask/vanilla integration over the official tokens. */
* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font-sans);
  background: var(--bg);
  color: var(--text);
}

body.modal-open {
  overflow: hidden;
  height: 100vh;
}

.auth-gate {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background: linear-gradient(135deg, var(--holiday), var(--surface-soft));
}

.auth-card {
  width: min(460px, 100%);
  background: var(--surface);
  border: var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  padding: 24px;
}

.auth-brand {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 22px;
}

.auth-brand img {
  width: 82px;
  height: 64px;
  object-fit: contain;
}

.auth-form {
  display: grid;
  gap: 12px;
}

.app-shell {
  display: grid;
  grid-template-columns: var(--sidebar-w) minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  background: linear-gradient(180deg, var(--sidebar), var(--sidebar-2));
  color: var(--sidebar-fg);
  padding: 22px 16px;
  position: sticky;
  top: 0;
  height: 100vh;
}

.brand {
  display: grid;
  gap: 10px;
  justify-items: center;
  text-align: center;
  margin-bottom: 26px;
  padding: 4px 4px 18px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.16);
}

.brand-mark {
  width: 96px;
  height: 78px;
  display: grid;
  place-items: center;
  background: transparent;
  overflow: visible;
}

.brand-mark img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

h1,
h2,
h3,
h4,
p {
  margin: 0;
}

h1 {
  font-size: var(--fs-h1);
  line-height: var(--lh-tight);
}

.nav {
  display: grid;
  gap: 6px;
}

.nav button {
  justify-content: flex-start;
  color: var(--sidebar-fg);
  border-color: transparent;
  background: transparent;
  width: 100%;
}

.nav button:hover,
.nav button.active {
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.12);
}

.nav button.active {
  background: rgba(255, 255, 255, 0.18);
  box-shadow: inset 3px 0 0 0 var(--sidebar-accent);
  font-weight: var(--fw-semibold);
}

.workspace {
  padding: 24px;
  min-width: 0;
}

.userbar {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}

.tab {
  display: none;
}

.tab.active {
  display: block;
}

.page-head {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--line);
}

.page-description {
  max-width: 720px;
  margin-top: 6px;
  color: var(--muted);
  line-height: 1.5;
}

.eyebrow {
  color: var(--muted);
  font-size: var(--fs-label);
  margin-bottom: 4px;
}

h2 {
  font-size: var(--fs-h2);
  font-weight: var(--fw-bold);
}

h3 {
  font-size: var(--fs-h3);
  font-weight: var(--fw-h3);
  margin-bottom: 14px;
}

h4 {
  font-size: var(--fs-h4);
  font-weight: var(--fw-h3);
}

button,
.button {
  appearance: none;
  border: var(--border);
  background: var(--surface);
  color: var(--text);
  border-radius: var(--radius-sm);
  padding: 8px 11px;
  font: inherit;
  cursor: pointer;
  text-decoration: none;
  line-height: var(--lh-snug);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: var(--control-h);
  transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

button:focus-visible,
.button:focus-visible {
  outline: 2px solid var(--blue);
  outline-offset: 2px;
}

button:hover,
.button:hover {
  border-color: var(--blue);
}

button.primary,
.segmented button.active {
  background: var(--blue);
  border-color: var(--blue);
  color: var(--surface);
}

button.primary:hover {
  background: var(--blue-dark);
}

button.danger {
  color: var(--red);
}

button:disabled,
input:disabled,
select:disabled {
  cursor: not-allowed;
  opacity: 0.62;
}

button.busy {
  position: relative;
}

button.busy::before {
  content: "";
  width: 13px;
  height: 13px;
  margin-right: 7px;
  border: 2px solid currentColor;
  border-top-color: transparent;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

.panel {
  background: var(--surface);
  border: var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  padding: 16px;
  min-width: 0;
}

.editor-panel {
  align-self: start;
  display: grid;
  align-content: start;
  gap: 12px;
  position: sticky;
  top: 16px;
  max-height: calc(100vh - 32px);
  overflow-y: auto;
}

.editor-panel h3 {
  margin-bottom: 0;
  padding-bottom: 10px;
  border-bottom: 2px solid var(--blue);
}

.editor-panel .hint {
  margin: 0;
  min-height: 0;
}

.editor-panel label.inline {
  padding: 2px 0;
}

.editor-panel .assignment-head,
.editor-panel .signature-box {
  margin: 0;
}

.editor-panel > .toolbar {
  margin: 2px 0 0;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.editor-panel > .toolbar .primary {
  flex: 1 1 auto;
}

.split {
  display: grid;
  grid-template-columns: minmax(0, 1fr) var(--editor-col);
  gap: 16px;
  align-items: start;
}

.grid2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.inline-create {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) auto;
  align-items: end;
  gap: 10px;
}

.cost-grid {
  display: grid;
  gap: 8px;
}

.employee-cost-row {
  grid-template-columns: minmax(120px, 0.4fr) minmax(160px, 0.6fr) auto;
}

.signature-box {
  display: grid;
  gap: 10px;
  margin: 12px 0;
  padding: 12px;
  border: var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface-soft);
}

.signature-preview-row {
  display: grid;
  grid-template-columns: 120px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
}

.signature-preview {
  width: 120px;
  height: 54px;
  object-fit: contain;
  border: var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  padding: 4px;
}

.admin-split {
  grid-template-columns: minmax(0, 1fr) minmax(380px, 520px);
}

.permissions-grid,
.scope-grid {
  max-height: 220px;
  overflow: auto;
}

.security-log {
  margin-top: 12px;
  max-height: min(360px, 42vh);
  overflow: auto;
  overscroll-behavior: contain;
}

.section-subtitle {
  margin-top: 18px;
}

.security-log-filters {
  margin: 12px 0 10px;
}

.change-log-panel {
  margin-top: 16px;
}

.compact-filters {
  margin: 8px 0 14px;
}

.change-log-detail {
  margin-top: 12px;
  padding: 12px;
  border: var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface-soft);
}

.change-log-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(340px, 420px);
  gap: 14px;
  align-items: start;
}

.change-log-layout .table-wrap {
  max-height: min(620px, calc(100vh - 260px));
}

.change-log-layout .change-log-detail {
  position: sticky;
  top: 16px;
  max-height: min(620px, calc(100vh - 120px));
  overflow: auto;
  margin-top: 0;
}

.change-log-detail pre {
  max-height: 360px;
  overflow: auto;
  padding: 10px;
  border: var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
  white-space: pre-wrap;
}

.change-log-detail .diff-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.change-log-detail .detail-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 10px 0;
}

.change-status-cell {
  min-width: 118px;
  white-space: nowrap;
}

.selected-row {
  outline: 2px solid color-mix(in srgb, var(--primary) 42%, transparent);
  outline-offset: -2px;
  background: var(--selected);
}

.error-text {
  color: var(--red);
  font-weight: var(--fw-bold);
}

.superadmin-only[hidden] {
  display: none !important;
}

.grid-panels {
  display: grid;
  grid-template-columns: 0.75fr 1.25fr;
  gap: 16px;
}

.toolbar,
.panel-head,
.assignment-head,
.quick-actions {
  display: flex;
  align-items: end;
  gap: 10px;
  flex-wrap: wrap;
}

.quick-actions {
  align-items: center;
  gap: 12px;
}

.quick-actions button {
  min-width: 150px;
}

.toolbar {
  margin-bottom: 14px;
}

.filters {
  margin-bottom: 16px;
}

.filter-bar {
  display: block;
  overflow: hidden;
  padding: 0;
  border: 1px solid color-mix(in srgb, var(--blue) 18%, var(--line));
  border-radius: var(--radius-xl);
  background: var(--surface);
  box-shadow: 0 7px 22px color-mix(in srgb, var(--brand-charcoal) 7%, transparent);
}

.filter-bar-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 11px 14px;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(90deg, color-mix(in srgb, var(--blue) 7%, var(--surface)) 0%, var(--surface-soft) 100%);
}

.filter-bar-copy {
  display: flex;
  align-items: baseline;
  gap: 8px 12px;
  min-width: 0;
  flex-wrap: wrap;
}

.filter-bar-kicker {
  padding: 3px 7px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--blue) 12%, var(--surface));
  color: var(--blue-dark);
  font-size: var(--fs-caption);
  font-weight: var(--fw-bold);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.filter-bar-title {
  color: var(--text);
  font-size: var(--fs-label);
  font-weight: var(--fw-bold);
}

.filter-bar-description {
  color: var(--muted);
  font-size: var(--fs-label);
}

.filter-controls {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  align-items: end;
  gap: 12px;
  padding: 14px;
}

.filter-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  min-height: var(--control-h);
  flex-wrap: wrap;
}

.filter-actions .primary {
  order: 2;
}

.table-search .filter-controls {
  grid-template-columns: minmax(240px, 1fr) auto;
}

.hours-filters .filter-controls,
.approvals-filters .filter-controls,
.export-filters .filter-controls {
  grid-template-columns: repeat(3, minmax(130px, 1fr)) minmax(210px, auto);
}

.summary-filters .filter-controls {
  grid-template-columns: repeat(4, minmax(145px, 1fr)) minmax(210px, auto);
}

.change-log-filters .filter-controls {
  grid-template-columns: repeat(6, minmax(120px, 1fr));
}

.filters input[type="number"] {
  width: 96px;
}

.panel-head,
.assignment-head {
  justify-content: space-between;
  margin-bottom: 12px;
}

label {
  display: grid;
  gap: 5px;
  font-size: var(--fs-label);
  color: var(--muted);
}

.field-group {
  display: grid;
  gap: 5px;
  font-size: var(--fs-label);
  color: var(--muted);
}

.project-select {
  min-width: 230px;
  position: relative;
}

.project-dropdown {
  position: relative;
}

.project-dropdown > button {
  width: 100%;
  justify-content: space-between;
  min-width: 230px;
}

.project-menu {
  display: none;
  position: absolute;
  z-index: 12;
  top: calc(100% + 6px);
  left: 0;
  min-width: 280px;
  max-width: min(420px, 90vw);
  background: var(--surface);
  border: var(--border-strong);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  padding: 10px;
}

.project-dropdown.open .project-menu {
  display: grid;
  gap: 8px;
}

.project-checks {
  display: grid;
  gap: 6px;
  max-height: 260px;
  overflow: auto;
  padding-right: 4px;
}

.mini-actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.mini-actions button {
  min-height: var(--control-h-sm);
  padding: 5px 8px;
}

label.inline {
  display: flex;
  align-items: center;
  gap: 7px;
  color: var(--text);
  padding: 8px 0;
}

input,
select,
textarea {
  border: var(--border);
  border-radius: var(--radius-sm);
  padding: 8px 9px;
  font: inherit;
  background: var(--surface);
  color: var(--text);
  min-width: 0;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--blue);
  box-shadow: var(--focus-ring);
}

input.invalid,
select.invalid,
textarea.invalid {
  border-color: var(--red);
  box-shadow: var(--invalid-ring);
}

.field-error {
  color: var(--red);
  font-size: var(--fs-caption);
  font-weight: var(--fw-h3);
  margin-top: 2px;
}

textarea {
  resize: vertical;
}

.metrics {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

.dashboard-role-context {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 16px;
  padding: 16px 18px;
  border: 1px solid color-mix(in srgb, var(--brand-tan) 38%, var(--line));
  border-radius: 11px;
  background: linear-gradient(110deg, color-mix(in srgb, var(--brand-tan-light) 28%, var(--surface)), var(--surface));
}

.dashboard-role-context > div {
  display: grid;
  gap: 3px;
}

.dashboard-role-context strong {
  font-size: 18px;
}

.dashboard-role-context p {
  max-width: 64ch;
  margin: 0;
  color: var(--muted);
  text-align: right;
}

.compact-metrics {
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
}

.metric {
  background: var(--surface);
  border: var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  padding: 15px;
}

.metric.clickable {
  cursor: pointer;
}

.metric.clickable:hover {
  border-color: var(--blue);
}

.metric strong {
  display: block;
  font-size: clamp(18px, 2vw, 26px);
  color: var(--blue-dark);
  overflow-wrap: anywhere;
}

.metric span {
  color: var(--muted);
  font-size: var(--fs-label);
}

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

.summary-item {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 9px 0;
  border-bottom: 1px solid var(--line);
}

.summary-item:last-child {
  border-bottom: 0;
}

.table-wrap {
  overflow: auto;
  border: var(--border);
  border-radius: var(--radius-md);
  background: var(--surface);
}

.empty-state {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 14px;
  color: var(--muted);
}

.skeleton-row {
  height: 38px;
  margin: 8px;
  border-radius: var(--radius-sm);
  background: linear-gradient(90deg, var(--badge-muted-bg), var(--surface-soft), var(--badge-muted-bg));
  background-size: 220% 100%;
  animation: skeleton 1.3s linear infinite;
}

@keyframes skeleton {
  to {
    background-position: -220% 0;
  }
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--fs-label);
}

th,
td {
  border-bottom: 1px solid var(--line);
  padding: 8px 9px;
  text-align: left;
  vertical-align: top;
}

th {
  background: var(--surface-header);
  font-weight: var(--fw-h3);
  position: sticky;
  top: 0;
  z-index: 1;
}

tr:last-child td {
  border-bottom: 0;
}

.table-wrap tbody tr:not(.nonworking):not(.has-anomaly):not(.selected-row):not(.anomaly-detail-row):hover td {
  background: var(--row-hover);
}

tr.nonworking {
  background: var(--holiday);
}

tr.has-anomaly {
  background: var(--row-error);
}

.badge {
  display: inline-block;
  border-radius: var(--radius-sm);
  padding: 2px 6px;
  font-size: var(--fs-caption);
  background: var(--badge-ok-bg);
  color: var(--green);
}

.badge.warn {
  background: var(--badge-warn-bg);
  color: var(--amber);
}

.badge.error {
  background: var(--badge-error-bg);
  color: var(--red);
}

.badge.muted {
  background: var(--badge-muted-bg);
  color: var(--muted);
}

.template-status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.template-status small {
  color: var(--muted);
  font-size: var(--fs-caption);
  white-space: nowrap;
}

.cell-error {
  color: var(--red);
  font-weight: var(--fw-bold);
}

.row-error {
  background: var(--row-error);
}

.hint {
  min-height: 22px;
  color: var(--muted);
  margin: 6px 0 12px;
}

.segmented {
  display: inline-flex;
  border: var(--border);
  border-radius: var(--radius-md);
  background: var(--surface);
  overflow: hidden;
}

.segmented button {
  border: 0;
  border-radius: 0;
}

.hours-view {
  display: none;
}

.hours-view.active {
  display: block;
}

.summary-check-block {
  background: linear-gradient(180deg, var(--surface-soft), var(--surface));
}

.summary-workspace {
  display: grid;
  gap: 16px;
}

.summary-context {
  display: flex;
  align-items: center;
  min-height: 38px;
  margin-top: -4px;
  padding: 8px 12px;
  border-left: 3px solid var(--blue);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  background: color-mix(in srgb, var(--blue) 5%, var(--surface));
  color: var(--muted);
  font-size: var(--fs-label);
}

.summary-context.pending {
  border-left-color: var(--orange);
  background: var(--badge-warn-bg);
  color: var(--text);
}

.summary-workspace .compact-metrics {
  grid-template-columns: repeat(6, minmax(130px, 1fr));
}

.summary-section {
  margin: 0;
  padding: 16px;
  border: var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
}

.summary-section .panel-head {
  align-items: flex-start;
}

.summary-section .panel-head h3,
.summary-section-head h3 {
  margin-bottom: 4px;
}

.summary-section .panel-head .hint {
  margin-bottom: 0;
}

.summary-section-head {
  margin-bottom: 12px;
}

.summary-section-head .eyebrow {
  margin-bottom: 3px;
}

.check-alerts {
  display: grid;
  gap: 8px;
  margin-bottom: 12px;
}

.check-alert {
  border: 1px solid var(--badge-error-bg);
  background: var(--row-error);
  color: var(--red);
  border-radius: var(--radius-sm);
  padding: 9px 11px;
  font-weight: var(--fw-h3);
}

.check-alert.ok {
  border-color: var(--badge-ok-bg);
  background: var(--badge-ok-bg);
  color: var(--green);
}

.calendar-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;
  gap: 16px;
}

.hours-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;
  gap: 16px;
}

.hours-main {
  min-width: 0;
}

.hours-side {
  display: grid;
  gap: 12px;
  align-self: start;
}

.hours-assigned-panel {
  background: var(--surface-soft);
  border: var(--border);
  border-radius: var(--radius-lg);
  padding: 14px;
}

.assigned-project-search {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: end;
  margin-bottom: 10px;
}

.assigned-project-search .badge {
  grid-column: 1 / -1;
  width: fit-content;
}

.assigned-project-list {
  display: grid;
  gap: 8px;
  max-height: 260px;
  overflow: auto;
}

.assigned-project-item {
  display: grid;
  gap: 5px;
  padding: 9px;
  background: var(--surface);
  border: var(--border);
  border-radius: var(--radius-md);
}

.assigned-project-item > div:first-child,
.assigned-project-types {
  display: flex;
  gap: 6px;
  align-items: center;
  flex-wrap: wrap;
}

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

.calendar-weekdays,
.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(92px, 1fr));
  gap: 8px;
}

.calendar-weekdays {
  margin-bottom: 8px;
}

.calendar-weekdays span {
  color: var(--muted);
  font-size: var(--fs-caption);
  font-weight: var(--fw-h3);
  text-align: center;
}

.calendar-day,
.calendar-empty {
  min-height: 118px;
  border-radius: var(--radius-lg);
}

.calendar-day {
  border: var(--border);
  background: var(--surface);
  padding: 10px;
  display: grid;
  align-content: start;
  gap: 7px;
  cursor: pointer;
  transition: border-color 0.12s ease, box-shadow 0.12s ease;
}

.calendar-day:hover {
  border-color: var(--blue);
  box-shadow: var(--shadow-pop);
}

.calendar-day.selected {
  background: var(--selected);
  border-color: var(--blue);
  box-shadow: inset 0 0 0 1px var(--blue);
}

.calendar-day.nonworking {
  background: var(--holiday);
  color: var(--muted);
}

.calendar-day.has-anomaly {
  border-color: var(--red);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--red) 52%, transparent);
}

.calendar-day .day-number {
  font-weight: var(--fw-bold);
}

.calendar-day .day-total {
  font-size: var(--fs-label);
  color: var(--muted);
}

.calendar-day .project-total {
  color: var(--blue-dark);
  font-weight: var(--fw-h3);
}

.day-editor {
  background: var(--surface-soft);
  border: var(--border);
  border-radius: var(--radius-lg);
  padding: 14px;
  min-height: 360px;
  position: sticky;
  top: 16px;
  align-self: start;
  max-height: calc(100vh - 32px);
  overflow: auto;
}

.day-editor h3 {
  padding-bottom: 8px;
  border-bottom: 2px solid var(--blue);
}

.day-anomaly {
  background: var(--row-error);
  border: 1px solid var(--badge-error-bg);
  border-radius: var(--radius-md);
  color: var(--red);
  margin-bottom: 12px;
  padding: 9px;
  font-size: var(--fs-label);
}

tr.has-anomaly td {
  background: var(--row-error);
}

.entry-row {
  display: grid;
  grid-template-columns: minmax(140px, 1fr) 90px minmax(78px, auto);
  gap: 6px;
  margin-bottom: 6px;
}

.entry-row input,
.entry-row select,
.daily-input {
  width: 100%;
}

.daily-input {
  max-width: 90px;
}

.check-grid,
.month-checks {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 8px;
  max-height: 360px;
  overflow: auto;
  border: var(--border);
  border-radius: var(--radius-md);
  padding: 10px;
  background: var(--surface-soft);
}

.check-option {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px;
  border: var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
  transition: border-color 0.12s ease;
}

.check-option:hover {
  border-color: var(--blue);
}

.anomalies-panel {
  grid-column: 1 / -1;
}

.dashboard-chart-panel {
  grid-column: 1 / -1;
}

.anomaly-list {
  max-height: 360px;
}

.anomaly-list tr {
  cursor: pointer;
}

.anomaly-detail-row td {
  background: var(--surface-soft);
  cursor: default;
}

.anomaly-detail {
  background: var(--surface-soft);
  border: var(--border);
  border-radius: var(--radius-md);
  padding: 10px;
}

.anomaly-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 10px;
}

.template-panel {
  border-top: 1px solid var(--line);
  margin-top: 4px;
  padding-top: 14px;
  display: grid;
  gap: 10px;
}

.template-panel .toolbar {
  margin-bottom: 0;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 300;
  display: none;
  grid-template-columns: minmax(0, 1fr);
  place-items: center;
  background: rgba(31, 30, 29, 0.6);
  padding: 22px;
  overflow: auto;
  overscroll-behavior: contain;
}

.modal-backdrop.open {
  display: grid;
}

.modal {
  width: min(1480px, 100%);
  max-height: min(920px, calc(100dvh - 44px));
  margin: auto;
  overflow: hidden;
  background: var(--surface);
  border: var(--border-strong);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-modal);
}

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

.user-modal {
  width: min(1180px, 100%);
}

.modal-body {
  max-height: calc(100vh - 124px);
  overflow: auto;
  padding: 16px;
}

.modal-form {
  display: grid;
  align-content: start;
  gap: 12px;
  position: static;
  max-height: none;
  overflow: visible;
}

.modal-form > .toolbar {
  margin: 2px 0 0;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.modal-form-actions {
  justify-content: flex-end;
}

.modal-form-actions .primary {
  min-width: 150px;
}

.pdf-preview-backdrop {
  z-index: 330;
  background: rgba(31, 30, 29, 0.74);
}

.pdf-preview-modal {
  width: min(1120px, 100%);
  height: min(860px, calc(100vh - 44px));
  display: flex;
  flex-direction: column;
}

.pdf-preview-body {
  flex: 1 1 auto;
  min-height: 0;
  padding: 12px;
  background: var(--surface-soft);
}

.pdf-preview-frame {
  display: block;
  width: 100%;
  height: 100%;
  border: var(--border);
  border-radius: var(--radius-md);
  background: var(--surface);
}

.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--line);
  background: var(--surface-soft);
}

.template-mapper {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  height: min(720px, calc(100vh - 130px));
  min-height: 0;
  max-height: calc(100vh - 130px);
}

.template-preview-panel {
  min-width: 0;
  overflow: auto;
  padding: 14px;
}

.template-preview-panel {
  border-right: 1px solid var(--line);
}

.template-fields-panel {
  min-width: 0;
  min-height: 0;
  height: 100%;
  overflow-y: auto;
  overflow-x: hidden;
  display: flex;
  flex-direction: column;
  background: var(--surface-soft);
}

.template-fields-scroll {
  flex: 0 0 auto;
  min-height: 0;
  overflow: visible;
  padding: 14px;
  display: grid;
  align-content: start;
  gap: 10px;
}

.template-fields-footer {
  flex: 0 0 auto;
  position: sticky;
  bottom: 0;
  display: grid;
  gap: 8px;
  padding: 12px 14px;
  border-top: 1px solid var(--line);
  background: color-mix(in srgb, var(--surface) 98%, transparent);
  box-shadow: 0 -8px 18px color-mix(in srgb, var(--brand-charcoal) 9%, transparent);
}

.footer-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.preview-result {
  margin: 0;
  overflow-wrap: anywhere;
}

.template-step-tabs {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 6px;
}

.template-step-tabs button {
  min-height: var(--control-h-sm);
  padding: 6px 8px;
}

.template-step-tabs button.active {
  background: var(--blue);
  border-color: var(--blue);
  color: var(--surface);
}

.template-common-controls,
.template-step {
  display: grid;
  gap: 10px;
}

.template-step {
  display: none;
}

.template-step.active {
  display: grid;
}

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

.mapping-button-grid button {
  min-height: var(--control-h-sm);
  justify-content: center;
  padding: 7px 8px;
}

.project-type-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.project-type-suggestions {
  display: grid;
  gap: 6px;
}

.project-type-chip-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.project-type-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-height: var(--control-h-sm);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 5px 8px;
  background: var(--surface);
  color: var(--text);
  font: inherit;
}

button.project-type-chip {
  cursor: pointer;
}

button.project-type-chip:hover {
  border-color: var(--blue);
  background: var(--selected);
}

.project-type-chip.mapped {
  background: var(--surface-soft);
  color: var(--muted);
}

.project-type-chip small {
  color: var(--muted);
  font-size: var(--fs-caption);
}

.excel-preview {
  overflow: auto;
  border: var(--border);
  border-radius: var(--radius-md);
  background: var(--surface-soft);
  max-height: calc(100vh - 238px);
}

.excel-grid {
  width: max-content;
  min-width: max-content;
  border-collapse: separate;
  border-spacing: 0;
  table-layout: fixed;
  font-size: var(--fs-caption);
}

.excel-grid .row-header-col {
  width: 44px;
  min-width: 44px;
  max-width: 44px;
}

.excel-grid th,
.excel-grid td {
  border: 0;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  padding: 0 4px;
  height: 28px;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  vertical-align: middle;
}

.excel-grid th {
  background: var(--surface-header);
  color: var(--muted);
  text-align: center;
  font-weight: var(--fw-h3);
}

.excel-grid thead th {
  position: sticky;
  top: 0;
  z-index: 3;
}

.excel-grid tbody th {
  position: sticky;
  left: 0;
  z-index: 2;
  width: 44px;
  min-width: 44px;
  max-width: 44px;
}

.excel-grid thead th:first-child {
  left: 0;
  z-index: 4;
}

.excel-cell {
  position: relative;
  background: var(--surface);
  cursor: crosshair;
}

.zoom-controls {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex-wrap: nowrap;
}

.zoom-controls button {
  min-height: var(--control-h-sm);
  padding: 5px 8px;
}

.range-input {
  width: 132px;
  font-family: var(--font-mono);
  text-transform: uppercase;
}

.excel-cell:hover {
  outline: 2px solid color-mix(in srgb, var(--primary) 40%, transparent);
  outline-offset: -2px;
}

.excel-cell.formula-cell {
  color: var(--blue-dark);
}

.excel-cell.merged-cell {
  font-weight: var(--fw-semibold);
}

.excel-cell.mapped-cell {
  background: var(--badge-ok-bg) !important;
  box-shadow: inset 0 0 0 2px color-mix(in srgb, var(--green) 52%, transparent);
}

.excel-cell.selected-cell {
  background: var(--selected) !important;
  box-shadow: inset 0 0 0 2px var(--blue);
}

.excel-cell.mapped-cell.selected-cell {
  background: var(--badge-ok-bg) !important;
  box-shadow: inset 0 0 0 2px var(--blue), inset 0 0 0 4px color-mix(in srgb, var(--green) 52%, transparent);
}

.cell-map-label {
  position: absolute;
  right: 3px;
  bottom: 2px;
  max-width: calc(100% - 6px);
  border-radius: var(--radius-sm);
  padding: 1px 4px;
  background: color-mix(in srgb, var(--green) 90%, transparent);
  color: var(--surface);
  font-size: var(--fs-caption);
  line-height: var(--lh-tight);
  overflow: hidden;
  text-overflow: ellipsis;
}

.mapped-list {
  display: grid;
  gap: 8px;
  max-height: none;
  overflow: visible;
  margin-top: 4px;
}

.additional-wizard {
  display: grid;
  gap: 9px;
  border: var(--border);
  border-radius: var(--radius-md);
  padding: 10px;
  background: var(--surface);
}

.additional-row-list {
  display: grid;
  gap: 8px;
  max-height: none;
  overflow: visible;
}

.mapping-table-wrap {
  overflow-x: auto;
  border: var(--border);
  border-radius: var(--radius-md);
  background: var(--surface);
}

.mapping-table {
  width: 100%;
  min-width: 760px;
  border-collapse: collapse;
  font-size: var(--fs-caption);
}

.mapping-table th,
.mapping-table td {
  border-bottom: 1px solid var(--line);
  padding: 7px 8px;
  text-align: left;
  vertical-align: top;
}

.mapping-table th {
  background: var(--surface-header);
  color: var(--muted);
  font-weight: var(--fw-h3);
}

.mapping-table tr.active td {
  background: var(--selected);
}

.mapping-table td:last-child {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.mapping-table button {
  min-height: var(--control-h-sm);
  padding: 5px 7px;
}

.mapping-table small {
  display: block;
  color: var(--red);
  overflow-wrap: anywhere;
}

.additional-row {
  display: grid;
  gap: 6px;
  padding: 9px;
  border: var(--border);
  border-radius: var(--radius-md);
  background: var(--surface-soft);
}

.additional-row.active {
  border-color: var(--blue);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--primary) 30%, transparent);
}

.additional-row-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: start;
  gap: 8px;
}

.additional-row-head strong {
  overflow-wrap: anywhere;
}

.additional-row-status {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.additional-row-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.additional-row-actions button {
  min-height: var(--control-h-sm);
  padding: 5px 8px;
}

.advanced-mapping {
  border-top: 1px solid var(--line);
  padding-top: 8px;
}

.advanced-mapping summary {
  cursor: pointer;
  color: var(--muted);
  font-weight: var(--fw-semibold);
}

.mapping-checklist {
  display: grid;
  gap: 10px;
  max-height: none;
  overflow: visible;
  border: var(--border);
  border-radius: var(--radius-md);
  padding: 10px;
  background: var(--surface);
}

.mapping-checklist section {
  display: grid;
  gap: 6px;
}

.mapping-checklist h4 {
  color: var(--text);
}

.checklist-hint {
  color: var(--muted);
  font-size: var(--fs-caption);
  margin: -2px 0 2px;
}

.mapping-check-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
  padding: 7px 8px;
  border: var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-soft);
}

.mapping-check-item.done {
  background: var(--badge-ok-bg);
  border-color: var(--badge-ok-bg);
}

.mapping-check-item span:first-child {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.mapping-check-item small {
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: var(--fs-caption);
}

.mapped-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 4px 8px;
  align-items: center;
  padding: 9px;
  border: var(--border);
  border-radius: var(--radius-md);
  background: var(--surface);
}

.mapped-item strong,
.mapped-item span {
  min-width: 0;
  overflow-wrap: anywhere;
}

.mapped-item span {
  color: var(--muted);
  font-size: var(--fs-caption);
}

.mapped-item button {
  grid-row: span 2;
  min-height: var(--control-h-sm);
  padding: 5px 8px;
}

.months-panel {
  margin-bottom: 14px;
}

.loading-row {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  min-height: 34px;
  margin: 0 0 10px;
  color: var(--blue-dark);
  font-weight: var(--fw-h3);
}

.loading-row[hidden] {
  display: none;
}

.spinner {
  width: 18px;
  height: 18px;
  border: 3px solid var(--line);
  border-top-color: var(--blue);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

.print-preview-list {
  display: grid;
  gap: 10px;
}

.print-month {
  border: var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
  overflow: hidden;
}

.print-month-toggle {
  width: 100%;
  border: 0;
  border-radius: 0;
  justify-content: space-between;
  padding: 12px 14px;
  background: var(--surface-header);
  text-align: left;
}

.print-month-toggle:hover {
  background: var(--row-hover);
}

.print-month-summary {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.print-month-summary strong {
  font-size: var(--fs-body);
}

.print-month-details {
  display: none;
  padding: 0;
}

.print-month.open .print-month-details {
  display: block;
}

.print-month-empty {
  padding: 12px 14px;
  color: var(--muted);
}

.chart-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 14px;
  margin-top: 14px;
  padding-bottom: 2px;
}

.chart-box {
  min-height: 280px;
  border: var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
  padding: 12px;
}

.chart-box.wide {
  grid-column: 1 / -1;
}

.chart-box canvas {
  width: 100%;
  height: 320px !important;
  max-height: 330px;
}

#statsFallback {
  margin-top: 8px;
}

.chart-filter-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin: 10px 0 2px;
  padding: 10px;
  border: var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface-soft);
}

.chart-filter-bar:empty {
  display: none;
}

.chart-filter-bar button {
  min-height: var(--control-h-sm);
  padding: 5px 9px;
  font-size: var(--fs-label);
}

.chart-filter-bar button.active {
  font-weight: var(--fw-semibold);
}

#monthInfo {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.approvals-actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.toast-stack {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 90;
  display: grid;
  gap: 8px;
  width: min(420px, calc(100vw - 36px));
  pointer-events: none;
}

.toast-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  border: 1px solid color-mix(in srgb, var(--brand-charcoal) 22%, transparent);
  border-radius: var(--radius-lg);
  padding: 10px 12px;
  background: var(--text);
  color: var(--surface);
  box-shadow: var(--shadow-card);
  pointer-events: auto;
}

.toast-item.error {
  background: var(--red);
}

.toast-item.warn {
  background: var(--amber);
}

.toast-item button {
  min-height: 28px;
  padding: 4px 7px;
  color: inherit;
  border-color: rgba(255, 255, 255, 0.28);
  background: transparent;
}

.confirm-backdrop {
  z-index: 360;
}

.confirm-modal {
  width: min(440px, 100%);
  padding: 16px;
}

.confirm-modal .modal-head {
  margin: -16px -16px 14px;
}

#toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  background: var(--text);
  color: var(--surface);
  padding: 10px 14px;
  border-radius: var(--radius-md);
  max-width: 440px;
  opacity: 0;
  transform: translateY(8px);
  pointer-events: none;
  transition: opacity 0.18s, transform 0.18s;
  z-index: 20;
}

#toast.show {
  opacity: 1;
  transform: translateY(0);
}

@media (max-width: 1100px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
    height: auto;
  }

  .nav {
    grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
  }

  .calendar-layout,
  .hours-layout,
  .split,
  .grid-panels,
  .template-mapper,
  .change-log-layout {
    grid-template-columns: 1fr;
  }

  .split .editor-panel {
    order: -1;
    position: static;
    max-height: none;
    overflow: visible;
  }

  .day-editor {
    position: static;
    max-height: none;
  }

  .change-log-layout .change-log-detail {
    position: static;
    max-height: none;
  }

  .template-preview-panel {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .hours-filters .filter-controls,
  .summary-filters .filter-controls,
  .approvals-filters .filter-controls,
  .export-filters .filter-controls,
  .change-log-filters .filter-controls {
    grid-template-columns: repeat(2, minmax(160px, 1fr));
  }

  .summary-workspace .compact-metrics {
    grid-template-columns: repeat(3, minmax(150px, 1fr));
  }
}

@media (max-width: 720px) {
  .workspace {
    padding: 16px;
  }

  .calendar-weekdays,
  .calendar-grid {
    grid-template-columns: repeat(7, minmax(42px, 1fr));
    gap: 4px;
  }

  .calendar-day {
    min-height: 92px;
    padding: 7px;
  }

  .grid2 {
    grid-template-columns: 1fr;
  }

  .inline-create,
  .employee-cost-row {
    grid-template-columns: 1fr;
  }

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

  .modal-backdrop {
    padding: 10px;
  }

  .modal {
    max-height: calc(100vh - 20px);
  }

  .template-mapper {
    min-height: 0;
  }

  .day-editor {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 30;
    max-height: 70vh;
    overflow: auto;
    border-radius: var(--radius-xl) var(--radius-xl) 0 0;
    border-left: 0;
    border-right: 0;
    border-bottom: 0;
    box-shadow: var(--shadow-sheet);
  }

  .day-editor:empty {
    display: none;
  }

  .chart-box {
    min-height: 240px;
  }

  .filter-bar-copy {
    display: grid;
    gap: 4px;
  }

  .filter-controls,
  .table-search .filter-controls,
  .hours-filters .filter-controls,
  .summary-filters .filter-controls,
  .approvals-filters .filter-controls,
  .export-filters .filter-controls,
  .change-log-filters .filter-controls {
    grid-template-columns: 1fr;
  }

  .filter-actions {
    justify-content: stretch;
  }

  .filter-actions > * {
    flex: 1 1 auto;
  }

  .summary-workspace .compact-metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.reconciliation-mappings {
  display: grid;
  gap: 1rem;
}

.mapping-source {
  padding: 1rem;
  border: var(--border);
  border-radius: 0.75rem;
}

.mapping-line {
  display: grid;
  grid-template-columns: minmax(10rem, 1fr) minmax(13rem, 2fr) minmax(7rem, 0.6fr);
  gap: 0.75rem;
  align-items: center;
  margin-top: 0.5rem;
}

/* ========================================================================== *
   ATENA 2026 — application shell and experience refresh
   UI UX Pro Max: data-dense enterprise, accessible, responsive, low motion.
 * ========================================================================== */

html {
  background: var(--bg);
  scroll-behavior: smooth;
}

body {
  min-width: 320px;
  overflow-x: hidden;
  font-size: var(--fs-body);
  line-height: var(--lh-normal);
  background:
    radial-gradient(circle at 82% -20%, color-mix(in srgb, var(--brand-tan) 13%, transparent), transparent 36rem),
    var(--bg);
  transition: background-color var(--dur-slow) var(--ease), color var(--dur-slow) var(--ease);
}

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

button,
a,
select,
input[type="checkbox"] {
  touch-action: manipulation;
}

:focus-visible {
  outline: 3px solid var(--blue);
  outline-offset: 2px;
}

::selection {
  color: var(--brand-charcoal-ink);
  background: var(--brand-tan-light);
}

.skip-link {
  position: fixed;
  top: 8px;
  left: 50%;
  z-index: 1100;
  padding: 10px 16px;
  border-radius: var(--radius-md);
  color: var(--surface);
  background: var(--text);
  transform: translate(-50%, -160%);
  transition: transform var(--dur) var(--ease);
}

.skip-link:focus {
  transform: translate(-50%, 0);
}

/* Authentication */
.auth-gate {
  min-height: 100dvh;
  padding: clamp(20px, 4vw, 56px);
  background:
    linear-gradient(135deg, rgba(42, 40, 38, 0.98), rgba(75, 69, 64, 0.95)),
    var(--sidebar);
}

.auth-layout {
  display: grid;
  grid-template-columns: minmax(320px, 1.05fr) minmax(390px, 0.8fr);
  width: min(1080px, 100%);
  min-height: min(680px, calc(100dvh - 80px));
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 24px;
  box-shadow: 0 30px 90px rgba(31, 30, 29, 0.44);
  background: var(--surface);
}

.auth-story {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  min-width: 0;
  padding: clamp(36px, 6vw, 72px);
  overflow: hidden;
  color: var(--sidebar-fg);
  background:
    radial-gradient(circle at 30% 22%, color-mix(in srgb, var(--brand-tan) 28%, transparent), transparent 22rem),
    linear-gradient(155deg, #514c48 0%, #2c2a28 72%);
}

.auth-story::before {
  content: "";
  position: absolute;
  inset: 18% -25% auto auto;
  width: 360px;
  aspect-ratio: 1;
  border: 1px solid color-mix(in srgb, var(--brand-tan) 22%, transparent);
  border-radius: 50%;
  box-shadow: 0 0 0 70px color-mix(in srgb, var(--brand-tan) 5%, transparent), 0 0 0 140px color-mix(in srgb, var(--brand-tan) 3%, transparent);
  pointer-events: none;
}

.auth-story img {
  position: absolute;
  top: clamp(34px, 6vw, 68px);
  left: clamp(34px, 6vw, 68px);
  width: clamp(104px, 14vw, 154px);
  height: auto;
  filter: drop-shadow(0 16px 26px rgba(0, 0, 0, 0.22));
}

.auth-story-kicker {
  margin: 0 0 12px;
  color: var(--brand-tan-light);
  font-size: 12px;
  font-weight: var(--fw-bold);
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.auth-story h1 {
  max-width: 12ch;
  margin: 0;
  font-size: clamp(34px, 4.2vw, 54px);
  line-height: 1.08;
  letter-spacing: -0.035em;
}

.auth-story > p:not(.auth-story-kicker) {
  max-width: 52ch;
  margin: 20px 0 0;
  color: color-mix(in srgb, var(--sidebar-fg) 76%, transparent);
}

.auth-trust {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 28px;
}

.auth-trust span {
  padding: 6px 10px;
  border: 1px solid color-mix(in srgb, var(--sidebar-fg) 17%, transparent);
  border-radius: var(--radius-pill);
  color: color-mix(in srgb, var(--sidebar-fg) 84%, transparent);
  font-size: var(--fs-caption);
  background: color-mix(in srgb, var(--sidebar-fg) 7%, transparent);
}

.auth-layout .auth-card {
  align-self: center;
  width: min(450px, calc(100% - 64px));
  margin: 32px auto;
  padding: clamp(26px, 4vw, 42px);
  border: 0;
  box-shadow: none;
}

.auth-brand {
  align-items: center;
  margin-bottom: 42px;
}

.auth-brand img {
  width: 112px;
  height: auto;
  max-height: 46px;
}

.auth-brand strong {
  display: block;
  color: var(--text);
  font-size: 18px;
}

.auth-form {
  gap: 18px;
}

.auth-form-head {
  display: grid;
  gap: 4px;
  margin-bottom: 4px;
}

.auth-form-head h2 {
  margin: 0;
  font-size: clamp(26px, 3vw, 34px);
  letter-spacing: -0.025em;
}

.password-control {
  position: relative;
}

.password-control .atena-control {
  width: 100%;
  padding-right: 92px;
}

.password-control .password-toggle {
  position: absolute;
  top: 50%;
  right: 4px;
  min-height: 34px;
  padding: 5px 9px;
  border-color: transparent;
  transform: translateY(-50%);
}

.auth-submit {
  width: 100%;
  min-height: 46px;
  margin-top: 4px;
}

.auth-error:not(:empty) {
  padding: 10px 12px;
  border: 1px solid color-mix(in srgb, var(--red) 45%, var(--line));
  border-radius: var(--radius-md);
  color: var(--red);
  background: var(--row-error);
}

/* Global shell */
.app-shell {
  grid-template-columns: var(--sidebar-w) minmax(0, 1fr);
  min-height: 100dvh;
  background: transparent;
  transition: grid-template-columns var(--dur-slow) var(--ease);
}

.sidebar {
  z-index: 70;
  display: flex;
  flex-direction: column;
  gap: 22px;
  height: 100dvh;
  padding: 18px 14px 14px;
  overflow: hidden;
  border-right: 1px solid rgba(255, 255, 255, 0.08);
  background:
    radial-gradient(circle at 30% 0%, color-mix(in srgb, var(--brand-tan) 12%, transparent), transparent 15rem),
    linear-gradient(180deg, var(--sidebar), var(--sidebar-2));
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 91px;
  padding: 4px 4px 18px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 88px;
  min-width: 88px;
  height: 69px;
  padding: 0;
  background: transparent;
}

.brand-mark img {
  display: block;
  width: 100%;
  max-width: 100%;
  height: auto;
  max-height: 100%;
  object-fit: contain;
}

.brand-copy {
  display: grid;
  min-width: 0;
  line-height: 1.2;
}

.brand-copy strong {
  color: #fff;
  font-size: 16px;
  letter-spacing: -0.015em;
}

.brand-copy span {
  margin-top: 3px;
  color: rgba(255, 255, 255, 0.58);
  font-size: 11px;
  white-space: nowrap;
}

.nav {
  display: grid;
  flex: 1 1 auto;
  grid-template-columns: 1fr;
  gap: 20px;
  align-content: start;
  min-height: 0;
  padding-right: 3px;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.nav::-webkit-scrollbar {
  width: 0;
  height: 0;
}

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

.nav-group-label {
  padding: 0 12px 5px;
  color: rgba(255, 255, 255, 0.46);
  font-size: 11px;
  font-weight: var(--fw-bold);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  white-space: nowrap;
}

.sidebar .nav .atena-btn {
  position: relative;
  justify-content: flex-start;
  width: 100%;
  min-height: 44px;
  padding: 9px 11px;
  overflow: hidden;
  border: 1px solid transparent;
  border-radius: 9px;
  color: rgba(255, 255, 255, 0.76);
  white-space: nowrap;
  background: transparent;
}

.sidebar .nav .atena-btn:hover {
  color: #fff;
  border-color: rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.08);
}

.sidebar .nav .atena-btn.active {
  color: #fff;
  border-color: color-mix(in srgb, var(--brand-tan) 22%, transparent);
  background: linear-gradient(90deg, color-mix(in srgb, var(--brand-tan) 20%, transparent), rgba(255, 255, 255, 0.06));
  box-shadow: inset 3px 0 0 var(--brand-tan);
}

.nav-icon {
  display: grid;
  flex: 0 0 22px;
  place-items: center;
  width: 22px;
  color: rgba(255, 255, 255, 0.6);
}

.nav .active .nav-icon {
  color: var(--brand-tan-light);
}

.nav-label {
  overflow: hidden;
  text-overflow: ellipsis;
}

.nav-backdrop,
.mobile-nav-toggle {
  display: none;
}

.userbar .mobile-nav-toggle.atena-btn {
  display: none;
}

.workspace {
  min-width: 0;
  padding: 0;
  outline: 0;
}

.userbar {
  position: sticky;
  top: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  min-height: 72px;
  padding: 10px clamp(18px, 2.6vw, 36px);
  border-bottom: 1px solid color-mix(in srgb, var(--line) 88%, transparent);
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  box-shadow: 0 6px 22px color-mix(in srgb, var(--brand-charcoal) 5%, transparent);
  backdrop-filter: blur(14px);
}

.route-context {
  display: grid;
  gap: 1px;
  margin-right: auto;
}

.breadcrumbs {
  display: flex;
  gap: 6px;
  color: var(--muted);
  font-size: var(--fs-caption);
}

.breadcrumbs strong {
  color: var(--text);
  font-weight: var(--fw-medium);
}

.route-title {
  font-size: 17px;
  line-height: 1.2;
}

.userbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.theme-switch {
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 3px;
  border: var(--border);
  border-radius: 10px;
  background: var(--surface-soft);
}

.theme-switch .theme-option.atena-btn {
  min-width: 44px;
  min-height: 40px;
  padding: 7px 10px;
  border: 0;
  color: var(--muted);
  background: transparent;
  box-shadow: none;
}

.theme-switch .theme-option.atena-btn:hover {
  color: var(--text);
  background: color-mix(in srgb, var(--surface) 72%, transparent);
}

.theme-switch .theme-option.atena-btn.active {
  color: var(--text);
  background: var(--surface);
  box-shadow: 0 1px 4px color-mix(in srgb, var(--brand-charcoal) 16%, transparent);
}

.theme-option-label {
  white-space: nowrap;
}

.current-user {
  max-width: 260px;
  overflow: hidden;
  padding: 7px 10px;
  text-overflow: ellipsis;
}

.logout-button {
  min-height: 40px;
}

.workspace-content {
  width: min(1680px, 100%);
  margin: 0 auto;
  padding: clamp(20px, 2.6vw, 38px);
}

.tab {
  animation: atena-view-in var(--dur-slow) ease-out;
}

@keyframes atena-view-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

.page-head {
  align-items: end;
  margin: 0 0 24px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--line);
}

.page-head h1 {
  margin: 2px 0 0;
  font-size: clamp(28px, 3vw, var(--fs-h2));
  line-height: 1.15;
  letter-spacing: -0.035em;
}

.page-description {
  max-width: 72ch;
  margin-top: 8px;
  font-size: 15px;
  line-height: 1.55;
}

.eyebrow,
.filter-bar-kicker {
  color: color-mix(in srgb, var(--brand-tan-deep) 70%, var(--text));
  font-weight: var(--fw-bold);
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

/* Surfaces and controls */
.workspace .atena-panel,
.workspace .panel,
.workspace .metric {
  border-color: color-mix(in srgb, var(--line) 86%, transparent);
  border-radius: 12px;
  background: var(--surface);
  box-shadow: 0 8px 30px color-mix(in srgb, var(--brand-charcoal) 6%, transparent);
}

.workspace .atena-panel,
.workspace .panel {
  padding: clamp(16px, 1.6vw, 22px);
}

.workspace .atena-panel__head {
  align-items: flex-start;
  margin-bottom: 16px;
}

.workspace .atena-panel__title,
.panel h3 {
  letter-spacing: -0.015em;
}

.atena-control,
input,
select,
textarea {
  color: var(--text);
  background: var(--surface);
}

/* The bundled design-system styles are injected after this stylesheet.
   Compound selectors keep form surfaces aligned with the active theme. */
input.atena-control,
select.atena-control,
textarea.atena-control {
  color: var(--text);
  background: var(--surface);
  border-color: var(--line);
}

select {
  max-width: 100%;
  color: var(--text);
  color-scheme: light;
  background-color: var(--surface);
  border-color: var(--line);
}

select option,
select optgroup {
  color: var(--text);
  background-color: var(--surface);
}

:root[data-theme="dark"] select {
  color-scheme: dark;
}

select:focus {
  position: relative;
  z-index: 2;
}

.atena-control::placeholder,
input::placeholder,
textarea::placeholder {
  color: color-mix(in srgb, var(--muted) 72%, transparent);
}

.atena-btn,
.button {
  border-radius: 8px;
  font-weight: var(--fw-semibold);
}

.atena-btn--primary,
.button.primary {
  box-shadow: 0 5px 14px color-mix(in srgb, var(--blue) 22%, transparent);
}

/* Il bundle dei componenti usa ancora il nome storico --blue. Questo
   selettore mantiene il testo della CTA accessibile con entrambe le
   declinazioni Atena: antracite su chiaro, sabbia su scuro. */
.atena-btn.atena-btn--primary,
button.primary,
.button.primary {
  color: var(--on-primary);
}

body .atena-seg button.is-active {
  color: var(--on-primary);
  background: var(--primary);
}

body .atena-loading {
  color: var(--primary-strong);
}

body .atena-spinner {
  border-color: var(--line);
  border-top-color: var(--primary);
}

.atena-check--option {
  color: var(--text);
  background: var(--surface);
}

.filters.filter-bar {
  gap: 16px;
  margin-bottom: 18px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: linear-gradient(135deg, var(--surface-soft), color-mix(in srgb, var(--surface) 88%, var(--brand-tan-light)));
  box-shadow: none;
}

/* Etichetta di sezione, non un comando: il segno ATENA dà orientamento senza
   introdurre l'affordance di una pillola o di un pulsante. */
.filters.filter-bar .filter-bar-kicker {
  display: inline-flex;
  align-items: center;
  justify-self: start;
  gap: 8px;
  width: fit-content;
  padding: 0;
  border-radius: 0;
  color: color-mix(in srgb, var(--brand-tan-deep) 82%, var(--text));
  background: transparent;
  font-size: 11px;
  line-height: 1;
  letter-spacing: 0.12em;
}

.filters.filter-bar .filter-bar-kicker::before {
  content: "";
  width: 3px;
  height: 14px;
  flex: 0 0 3px;
  border-radius: var(--radius-pill);
  background: var(--brand-tan);
}

/* Tutte le barre filtro restano disponibili durante lo scorrimento. Sono
   ancorate subito sotto l'header e sotto i livelli di modali/dialoghi. */
.workspace .filters.filter-bar {
  position: sticky;
  top: 72px;
  z-index: 30;
  margin-top: 0;
  background: color-mix(in srgb, var(--surface-soft) 97%, transparent);
  box-shadow: 0 12px 22px color-mix(in srgb, var(--brand-charcoal) 9%, transparent);
  backdrop-filter: blur(14px);
}

.filter-bar-head {
  min-width: 180px;
  cursor: default;
}

.filter-bar-title {
  font-size: 16px;
}

.filter-bar-description {
  max-width: 62ch;
  line-height: 1.45;
}

.filter-controls {
  align-items: end;
}

.filter-actions {
  align-items: end;
}

.filter-actions .primary {
  min-width: 118px;
}

.metrics {
  gap: 12px;
  margin-bottom: 18px;
}

.metric {
  position: relative;
  min-height: 112px;
  padding: 18px;
  overflow: hidden;
}

.metric::after {
  content: "";
  position: absolute;
  right: -22px;
  bottom: -32px;
  width: 92px;
  height: 92px;
  border: 16px solid color-mix(in srgb, var(--brand-tan) 10%, transparent);
  border-radius: 50%;
  pointer-events: none;
}

.metric strong,
.atena-metric__value {
  font-variant-numeric: tabular-nums;
}

.grid-panels {
  gap: 18px;
}

.subview-tabs {
  display: flex;
  gap: 4px;
  width: fit-content;
  max-width: 100%;
  margin: -6px 0 18px;
  padding: 4px;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface-soft);
  scrollbar-width: none;
}

.subview-tabs::-webkit-scrollbar {
  display: none;
}

.subview-tabs .atena-btn {
  min-height: 36px;
  padding: 7px 12px;
  border-color: transparent;
  white-space: nowrap;
  background: transparent;
  box-shadow: none;
}

.subview-tabs .atena-btn.active {
  color: var(--text);
  border-color: var(--line);
  background: var(--surface);
  box-shadow: 0 3px 10px color-mix(in srgb, var(--brand-charcoal) 7%, transparent);
}

[data-subview-panel] {
  min-width: 0;
  animation: atena-view-in var(--dur) ease-out both;
}

[data-subview-panel][hidden] {
  display: none !important;
}

.management-layout {
  display: grid;
  grid-template-columns: 250px minmax(0, 1fr);
  gap: 20px;
  align-items: start;
}

.management-nav {
  position: sticky;
  top: 92px;
  display: grid;
  gap: 7px;
  padding: 7px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  box-shadow: 0 8px 24px color-mix(in srgb, var(--brand-charcoal) 6%, transparent);
}

.management-nav .management-nav-item.atena-btn {
  justify-content: flex-start;
  min-height: 74px;
  padding: 10px;
  overflow: hidden;
  border-color: transparent;
  color: var(--muted);
  text-align: left;
  background: transparent;
  box-shadow: none;
}

.management-nav .management-nav-item.atena-btn:hover {
  color: var(--text);
  border-color: var(--line);
  background: var(--surface-soft);
}

.management-nav .management-nav-item.atena-btn.active {
  color: var(--text);
  border-color: color-mix(in srgb, var(--blue) 36%, var(--line));
  background: var(--selected);
  box-shadow: inset 3px 0 0 var(--blue);
}

.management-nav-icon {
  display: grid;
  flex: 0 0 36px;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 9px;
  color: var(--blue);
  background: color-mix(in srgb, var(--blue) 10%, var(--surface));
}

.management-nav-copy {
  display: grid;
  min-width: 0;
  gap: 2px;
}

.management-nav-copy strong {
  overflow: hidden;
  font-size: 14px;
  text-overflow: ellipsis;
}

.management-nav-copy small {
  overflow: hidden;
  color: var(--muted);
  font-size: 12px;
  font-weight: var(--fw-regular);
  line-height: 1.3;
  text-overflow: ellipsis;
  white-space: normal;
}

.management-content {
  min-width: 0;
}

.management-panel.atena-panel {
  padding: clamp(16px, 2vw, 22px);
}

.management-section-head {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 18px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--line);
}

.management-section-head h2 {
  margin: 1px 0 0;
  font-size: clamp(21px, 2vw, 25px);
  line-height: 1.2;
}

.management-section-description {
  max-width: 720px;
  margin: 5px 0 0;
  color: var(--muted);
  line-height: 1.5;
}

.management-section-action {
  flex: 0 0 auto;
}

.management-section-action .toolbar {
  margin: 0;
}

.project-management-panel.atena-panel {
  overflow: visible;
}

.project-list-toolbar {
  position: sticky;
  top: 72px;
  z-index: 30;
  display: grid;
  gap: 12px;
  margin-bottom: 16px;
  padding: 2px 0 14px;
  border-bottom: 1px solid var(--line);
  background: color-mix(in srgb, var(--surface) 97%, transparent);
  box-shadow: 0 12px 22px color-mix(in srgb, var(--brand-charcoal) 8%, transparent);
  backdrop-filter: blur(12px);
}

.project-list-toolbar .filters.filter-bar {
  position: static;
  top: auto;
  z-index: auto;
  box-shadow: none;
  backdrop-filter: none;
}

.project-command-row {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 20px;
}

.project-command-copy h2 {
  margin: 1px 0 0;
  font-size: clamp(21px, 2vw, 25px);
  line-height: 1.2;
}

.project-command-actions {
  flex: 0 0 auto;
  margin: 0;
}

.project-filter-bar.filters.filter-bar {
  margin-bottom: 0;
  background: color-mix(in srgb, var(--surface-soft) 88%, var(--brand-tan-light));
}

.project-results {
  margin-top: 0;
}

.modal-description {
  max-width: 680px;
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.structured-modal {
  width: min(1040px, 100%);
}

.project-modal .editor-section-tabs,
.user-editor-form .editor-section-tabs {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.user-admin-workspace {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  align-items: start;
  gap: 18px;
}

.user-admin-workspace.editing {
  grid-template-columns: minmax(360px, 0.82fr) minmax(560px, 1.18fr);
}

.user-list-panel,
.user-editor-panel {
  min-width: 0;
}

.user-editor-panel {
  position: sticky;
  top: 88px;
  height: calc(100dvh - 104px);
  overflow: clip;
  padding: 0;
}

.user-editor-form {
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr) auto;
  height: 100%;
  min-width: 0;
  gap: 0;
  overflow: hidden;
}

.user-editor-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 20px 16px;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}

.user-editor-head h2,
.user-editor-head p {
  margin-top: 0;
}

.user-editor-form .editor-section-tabs {
  position: static;
  margin: 0;
  padding-inline: 20px;
}

.user-editor-form .editor-section-panel {
  min-height: 0;
  overflow: auto;
  padding: 20px;
}

.user-editor-panel .permissions-grid,
.user-editor-panel .scope-grid {
  max-height: none;
  overflow: visible;
}

.user-editor-actions,
.cost-editor-actions {
  position: sticky;
  bottom: 0;
  z-index: 5;
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 14px 20px;
  border-top: 1px solid var(--line);
  background: color-mix(in srgb, var(--surface) 96%, transparent);
  backdrop-filter: blur(12px);
}

.user-editor-actions .primary,
.cost-editor-actions .primary {
  min-width: 160px;
}

.context-notice {
  display: grid;
  gap: 3px;
  padding: 14px 16px;
  border: 1px solid color-mix(in srgb, var(--brand-tan) 62%, var(--line));
  border-radius: 10px;
  background: color-mix(in srgb, var(--brand-tan-light) 44%, var(--surface));
}

.context-notice[hidden] {
  display: none;
}

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

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

.scope-editor-block {
  display: grid;
  min-width: 0;
  align-content: start;
  gap: 10px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface-soft);
}

.scope-editor-block .scope-grid {
  display: grid;
  max-height: 360px;
  overflow: auto;
  padding-right: 4px;
}

.check-option[hidden] {
  display: none;
}

.cost-management-layout {
  display: grid;
  grid-template-columns: minmax(250px, 320px) minmax(0, 1fr);
  align-items: start;
  gap: 18px;
}

.cost-person-list,
.cost-editor {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
}

.cost-person-list {
  display: grid;
  align-content: start;
  gap: 12px;
  padding: 14px;
}

.cost-person-options {
  display: grid;
  gap: 7px;
  max-height: 620px;
  overflow: auto;
  padding-right: 3px;
}

.cost-person-option {
  display: flex;
  min-height: 58px;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  width: 100%;
  padding: 9px 11px;
  border: 1px solid transparent;
  border-radius: 9px;
  color: var(--text);
  text-align: left;
  background: transparent;
}

.cost-person-option:hover {
  border-color: var(--line);
  background: var(--surface-soft);
}

.cost-person-option.active {
  border-color: color-mix(in srgb, var(--brand-tan) 70%, var(--line));
  background: var(--selected);
  box-shadow: inset 3px 0 0 var(--brand-tan);
}

.cost-person-option > span:first-child {
  display: grid;
  min-width: 0;
  gap: 2px;
}

.cost-person-option strong,
.cost-person-option small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.cost-person-option small {
  color: var(--muted);
  font-size: 12px;
}

.cost-editor {
  position: relative;
  overflow: clip;
}

.cost-editor-head {
  padding: 18px 20px 14px;
  border-bottom: 1px solid var(--line);
}

.cost-editor-head h3 {
  margin: 1px 0 4px;
}

.cost-rate-grid {
  display: grid;
  gap: 10px;
  min-height: 220px;
  padding: 16px 20px 24px;
}

.cost-rate-row {
  display: grid;
  grid-template-columns: 100px repeat(3, minmax(120px, 1fr)) minmax(150px, auto);
  align-items: end;
  gap: 10px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface-soft);
}

.cost-rate-row .field-group {
  min-width: 0;
}

.cost-rate-row .field-group small {
  color: var(--muted);
  font-weight: var(--fw-regular);
}

.cost-rate-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.employee-cost-link {
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
}

.employee-cost-link p {
  margin-bottom: 0;
}

.cost-policy-fieldset {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin: 0;
  padding: 0;
  border: 0;
}

.cost-policy-fieldset legend {
  grid-column: 1 / -1;
  margin-bottom: 2px;
  font-weight: var(--fw-semibold);
}

.cost-policy-option {
  position: relative;
  display: flex;
  min-height: 112px;
  align-items: flex-start;
  gap: 10px;
  padding: 15px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: var(--surface);
  cursor: pointer;
}

.cost-policy-option:hover {
  border-color: var(--line-strong);
  background: var(--surface-soft);
}

.cost-policy-option:has(input:checked) {
  border-color: color-mix(in srgb, var(--brand-tan) 76%, var(--line));
  background: var(--selected);
  box-shadow: inset 0 -3px 0 var(--brand-tan);
}

.cost-policy-option:has(input:focus-visible) {
  box-shadow: var(--focus-ring);
}

.cost-policy-option input {
  flex: 0 0 auto;
  width: 20px;
  height: 20px;
  margin-top: 1px;
  accent-color: var(--brand-tan);
}

.cost-policy-copy {
  display: grid;
  gap: 5px;
}

.cost-policy-copy small {
  color: var(--muted);
  line-height: 1.45;
}

.cost-coverage-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.cost-coverage-head p {
  margin-bottom: 0;
}

.cost-missing-list {
  display: grid;
  gap: 7px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.cost-missing-list li {
  display: grid;
  grid-template-columns: minmax(160px, 1fr) auto minmax(190px, auto);
  align-items: center;
  gap: 10px;
  padding: 9px 11px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.cost-missing-list small {
  color: var(--warning-text, var(--text));
}

.editor-section-tabs {
  position: sticky;
  top: -16px;
  z-index: 4;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 7px;
  margin: -16px -16px 16px;
  padding: 9px 16px;
  border-bottom: 1px solid var(--line);
  background: color-mix(in srgb, var(--surface) 96%, transparent);
  backdrop-filter: blur(12px);
}

.editor-section-tabs .editor-section-tab.atena-btn {
  justify-content: flex-start;
  min-height: 64px;
  padding: 8px 10px;
  border-color: transparent;
  color: var(--muted);
  text-align: left;
  background: transparent;
  box-shadow: none;
}

.editor-section-tabs .editor-section-tab.atena-btn:hover {
  color: var(--text);
  border-color: var(--line);
  background: var(--surface-soft);
}

.editor-section-tabs .editor-section-tab.atena-btn.active {
  color: var(--text);
  border-color: color-mix(in srgb, var(--blue) 38%, var(--line));
  background: var(--selected);
  box-shadow: inset 0 -3px 0 var(--blue);
}

.editor-section-index {
  display: grid;
  flex: 0 0 28px;
  place-items: center;
  width: 28px;
  height: 28px;
  border: 1px solid var(--line);
  border-radius: 50%;
  color: var(--muted);
  background: var(--surface);
  font-size: 12px;
  font-weight: var(--fw-bold);
}

.editor-section-tab.active .editor-section-index {
  color: var(--blue-dark);
  border-color: color-mix(in srgb, var(--blue) 42%, var(--line));
}

.editor-section-copy {
  display: grid;
  min-width: 0;
  gap: 1px;
}

.editor-section-copy strong {
  font-size: 13px;
}

.editor-section-copy small {
  overflow: hidden;
  color: var(--muted);
  font-size: 11px;
  font-weight: var(--fw-regular);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.editor-section-panel {
  display: grid;
  gap: 14px;
  min-width: 0;
  min-height: 300px;
  align-content: start;
}

.editor-section-intro {
  margin-bottom: 2px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--line);
}

.editor-section-intro h3 {
  margin: 1px 0 3px;
  padding: 0;
  border: 0;
  font-size: 19px;
}

.section-block {
  display: grid;
  gap: 12px;
  margin-top: 4px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface-soft);
}

.section-block h4 {
  margin: 0;
}

.section-status {
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--surface-soft);
}

.structured-modal .modal-form-actions {
  position: sticky;
  bottom: -16px;
  z-index: 3;
  margin: 4px -16px -16px;
  padding: 14px 16px 16px;
  border-top: 1px solid var(--line);
  background: color-mix(in srgb, var(--surface) 96%, transparent);
  backdrop-filter: blur(12px);
}

.quick-actions {
  align-items: stretch;
}

.quick-actions .atena-btn {
  justify-content: flex-start;
  min-height: 44px;
}

.table-wrap,
.atena-tablewrap {
  border-color: var(--line) !important;
  border-radius: 10px;
  background: var(--surface) !important;
  scrollbar-color: var(--line-strong) transparent;
}

table,
.atena-table {
  color: var(--text) !important;
  font-variant-numeric: tabular-nums;
}

th,
.atena-table th {
  color: color-mix(in srgb, var(--text) 88%, var(--muted));
  background: var(--surface-header) !important;
}

tbody tr:hover td {
  background: var(--row-hover);
}

.badge,
.atena-badge {
  border: 1px solid color-mix(in srgb, currentColor 18%, transparent);
  font-weight: var(--fw-semibold);
}

.empty-state {
  min-height: 120px;
  place-content: center;
  text-align: center;
}

.skeleton-row {
  background: linear-gradient(90deg, var(--surface-soft), var(--surface-header), var(--surface-soft));
  background-size: 200% 100%;
}

/* Dense operational views */
.hours-layout {
  grid-template-columns: minmax(0, 1fr) minmax(330px, 390px);
  gap: 18px;
}

.calendar-weekdays,
.calendar-grid {
  gap: 7px;
}

.calendar-weekdays {
  color: var(--muted);
  font-size: 12px;
  font-weight: var(--fw-bold);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.calendar-day {
  min-height: 108px;
  padding: 10px;
  border-radius: 9px;
  box-shadow: none;
}

.calendar-day:hover {
  border-color: var(--blue);
  box-shadow: 0 6px 18px color-mix(in srgb, var(--brand-charcoal) 9%, transparent);
  transform: translateY(-1px);
}

.calendar-day.selected {
  border-color: var(--blue);
  box-shadow: inset 0 0 0 1px var(--blue), 0 5px 16px color-mix(in srgb, var(--blue) 12%, transparent);
}

.day-editor {
  top: 90px;
  border-radius: 12px;
  background: var(--surface);
  box-shadow: 0 12px 34px color-mix(in srgb, var(--brand-charcoal) 12%, transparent);
}

.summary-multi-field {
  display: grid;
  min-width: 0;
  align-content: start;
  gap: 6px;
}

.summary-filters.filters.filter-bar,
.export-filters.filters.filter-bar {
  overflow: visible;
}

.export-filters .filter-controls {
  grid-template-columns: minmax(220px, 1.2fr) minmax(220px, 1.2fr) minmax(110px, 0.6fr);
}

.export-filters .summary-multi-field:nth-of-type(2) .summary-multi-panel {
  right: 0;
  left: auto;
}

.summary-multi-label {
  color: var(--text);
  font-size: 12px;
  font-weight: var(--fw-semibold);
  line-height: 1.25;
}

.summary-multi-control {
  position: relative;
  min-width: 0;
}

.summary-multi-native[hidden] {
  display: none !important;
}

.summary-multi-trigger.atena-btn {
  width: 100%;
  min-width: 0;
  min-height: 44px;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 11px;
  border: 1px solid var(--line-strong);
  color: var(--text);
  text-align: left;
  background: var(--surface);
  box-shadow: none;
}

.summary-multi-trigger.atena-btn:hover {
  border-color: color-mix(in srgb, var(--brand-tan-deep) 64%, var(--line-strong));
  color: var(--text);
  background: color-mix(in srgb, var(--brand-tan-light) 20%, var(--surface));
}

.summary-multi-trigger.atena-btn:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
  box-shadow: var(--focus-ring);
}

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

.summary-multi-leading-icon {
  display: grid;
  flex: 0 0 auto;
  place-items: center;
  color: var(--brand-tan-deep);
}

.summary-multi-chevron {
  display: grid;
  flex: 0 0 auto;
  place-items: center;
  color: var(--muted);
  transition: transform 160ms ease-out;
}

.summary-multi-control.is-open .summary-multi-chevron {
  transform: rotate(180deg);
}

.summary-multi-panel {
  position: absolute;
  z-index: 90;
  top: calc(100% + 8px);
  left: 0;
  display: grid;
  width: min(400px, calc(100vw - 40px));
  max-height: min(520px, 66dvh);
  gap: 10px;
  padding: 12px;
  overflow: hidden;
  border: 1px solid color-mix(in srgb, var(--brand-tan-deep) 48%, var(--line));
  border-radius: 12px;
  color: var(--text);
  background: var(--surface);
  box-shadow: 0 18px 42px color-mix(in srgb, var(--brand-charcoal) 20%, transparent);
}

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

.summary-multi-field:nth-of-type(4) .summary-multi-panel {
  right: 0;
  left: auto;
}

.summary-multi-panel-head,
.summary-multi-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.summary-multi-panel-head strong {
  font-size: 15px;
}

.summary-multi-close.atena-btn {
  min-width: 44px;
  min-height: 44px;
  padding-inline: 9px;
}

.summary-multi-search-field {
  display: grid;
  gap: 5px;
}

.summary-multi-search-field > span {
  color: var(--text);
  font-size: 12px;
  font-weight: var(--fw-semibold);
}

.summary-multi-search-box {
  position: relative;
  display: block;
  color: var(--muted);
}

.summary-multi-search-icon {
  position: absolute;
  z-index: 1;
  top: 50%;
  left: 12px;
  display: grid;
  place-items: center;
  pointer-events: none;
  transform: translateY(-50%);
}

.summary-multi-search-box input.atena-control {
  width: 100%;
  min-height: 44px;
  padding-left: 40px;
  border-color: color-mix(in srgb, var(--brand-tan-deep) 46%, var(--line));
  color: var(--text);
  background: var(--surface);
}

.summary-multi-search-box input.atena-control::placeholder {
  color: var(--muted);
  opacity: 1;
}

.summary-multi-search-box:focus-within {
  color: var(--text);
}

.summary-multi-search-box:focus-within input.atena-control {
  border-color: var(--primary);
  outline: 2px solid color-mix(in srgb, var(--primary) 28%, transparent);
  outline-offset: 1px;
}

.summary-multi-actions {
  justify-content: flex-start;
  flex-wrap: wrap;
}

.summary-multi-actions .atena-btn {
  min-height: 44px;
}

.summary-multi-options {
  display: grid;
  min-height: 44px;
  max-height: 280px;
  gap: 3px;
  padding-right: 3px;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-color: var(--line-strong) transparent;
}

.summary-multi-option {
  display: grid;
  grid-template-columns: 20px minmax(0, 1fr);
  min-height: 44px;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border: 1px solid transparent;
  border-radius: 8px;
  color: var(--text);
  cursor: pointer;
}

.summary-multi-option:hover {
  border-color: var(--line);
  background: var(--surface-soft);
}

.summary-multi-option.is-selected {
  border-color: color-mix(in srgb, var(--brand-tan-deep) 40%, var(--line));
  background: color-mix(in srgb, var(--brand-tan-light) 30%, var(--surface));
}

.summary-multi-option input {
  width: 18px;
  height: 18px;
  margin: 0;
  accent-color: var(--brand-tan-deep);
}

.summary-multi-option input:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 3px;
}

.summary-multi-option span {
  min-width: 0;
  overflow-wrap: anywhere;
  font-size: 13px;
}

.summary-multi-empty {
  display: grid;
  min-height: 72px;
  place-items: center;
  padding: 12px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  color: var(--muted);
  text-align: center;
  background: var(--surface-soft);
}

.summary-multi-status {
  padding-top: 8px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 11px;
}

.summary-context {
  border-left: 3px solid var(--brand-tan-deep);
  background: color-mix(in srgb, var(--brand-tan-light) 22%, var(--surface-soft));
}

.summary-section {
  min-width: 0;
  max-width: 100%;
  padding-top: 22px;
}

.summary-view-tabs {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface-soft);
}

.summary-view-tabs .summary-view-tab.atena-btn {
  justify-content: flex-start;
  min-width: 0;
  min-height: 68px;
  padding: 10px 12px;
  overflow: hidden;
  border-color: transparent;
  color: var(--muted);
  text-align: left;
  background: transparent;
  box-shadow: none;
}

.summary-view-tabs .summary-view-tab.atena-btn:hover {
  color: var(--text);
  border-color: var(--line);
  background: color-mix(in srgb, var(--surface) 65%, transparent);
}

.summary-view-tabs .summary-view-tab.atena-btn.active {
  color: var(--text);
  border-color: color-mix(in srgb, var(--brand-tan-deep) 38%, var(--line));
  background: var(--surface);
  box-shadow: inset 3px 0 0 var(--brand-tan), 0 4px 14px color-mix(in srgb, var(--brand-charcoal) 7%, transparent);
}

.summary-view-tab-icon {
  display: grid;
  flex: 0 0 38px;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 9px;
  color: var(--primary-strong);
  background: color-mix(in srgb, var(--brand-tan) 18%, var(--surface));
}

.summary-view-tab-copy {
  display: grid;
  min-width: 0;
  gap: 2px;
}

.summary-view-tab-copy strong {
  font-size: 15px;
}

.summary-view-tab-copy small {
  overflow: hidden;
  color: var(--muted);
  font-size: 12px;
  font-weight: var(--fw-regular);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.summary-view-tab .badge {
  flex: 0 0 auto;
  margin-left: auto;
}

.summary-view-panel {
  display: grid;
  min-width: 0;
  gap: 16px;
}

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

.summary-context {
  display: grid;
  grid-template-columns: 1.1fr 1fr 1fr 0.7fr;
  min-height: 0;
  margin: 0;
  padding: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-left: 3px solid var(--brand-tan-deep);
  border-radius: 10px;
  color: var(--text);
}

.summary-context.pending {
  display: flex;
  min-height: 46px;
  padding: 11px 14px;
}

.summary-scope-item {
  display: grid;
  min-width: 0;
  gap: 2px;
  padding: 11px 14px;
  border-right: 1px solid var(--line);
}

.summary-scope-item:last-child {
  border-right: 0;
}

.summary-scope-item small {
  color: var(--muted);
  font-size: 11px;
  font-weight: var(--fw-bold);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.summary-scope-item strong {
  overflow: hidden;
  font-size: 14px;
  line-height: 1.35;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.summary-overview-hero {
  display: grid;
  gap: 16px;
  padding: 20px;
  border: 1px solid color-mix(in srgb, var(--brand-tan) 46%, var(--line));
  border-radius: 12px;
  background: linear-gradient(125deg, color-mix(in srgb, var(--brand-tan-light) 26%, var(--surface)), var(--surface) 58%);
}

.summary-overview-head,
.summary-section-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.summary-overview-head h2,
.summary-check-block h2 {
  margin: 2px 0 0;
  font-size: 20px;
  letter-spacing: -0.015em;
}

.summary-overview-head .eyebrow,
.summary-section-head .eyebrow {
  margin-bottom: 2px;
}

.summary-workspace .summary-overview-metrics {
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  margin: 0;
}

.summary-overview-metrics .summary-metric {
  display: grid;
  align-content: center;
  min-height: 94px;
  gap: 4px;
  padding: 15px 16px;
  box-shadow: none;
}

.summary-overview-metrics .summary-metric span {
  order: 0;
  font-size: 12px;
  font-weight: var(--fw-semibold);
  letter-spacing: 0.02em;
}

.summary-overview-metrics .summary-metric strong {
  order: 1;
  font-size: clamp(22px, 2vw, 30px);
}

.summary-overview-metrics .summary-metric--difference {
  border-color: color-mix(in srgb, var(--amber) 42%, var(--line));
  background: color-mix(in srgb, var(--badge-warn-bg) 48%, var(--surface));
}

.summary-overview-metrics .summary-metric--difference strong {
  color: var(--amber);
}

.summary-overview-metrics .summary-metric--difference.is-aligned {
  border-color: color-mix(in srgb, var(--green) 34%, var(--line));
  background: color-mix(in srgb, var(--badge-ok-bg) 42%, var(--surface));
}

.summary-overview-metrics .summary-metric--difference.is-aligned strong {
  color: var(--green);
}

.summary-section-description {
  max-width: 68ch;
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.summary-section-badges {
  display: flex;
  flex: 0 0 auto;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.summary-type-analysis-section {
  border-color: color-mix(in srgb, var(--brand-tan) 46%, var(--line));
  background: linear-gradient(150deg, color-mix(in srgb, var(--brand-tan-light) 16%, var(--surface)), var(--surface) 46%);
}

.summary-type-analysis {
  min-width: 0;
}

.summary-analysis-empty {
  padding: 22px;
  border: 1px dashed var(--line-strong);
  border-radius: 10px;
  color: var(--muted);
  text-align: center;
  background: var(--surface-soft);
}

.summary-type-list {
  display: grid;
  min-width: 0;
  gap: 8px;
}

.summary-type-row {
  display: grid;
  grid-template-columns: minmax(150px, 0.7fr) minmax(390px, 1.5fr) minmax(220px, 0.9fr);
  align-items: center;
  min-width: 0;
  gap: 14px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
}

.summary-type-row-head {
  display: grid;
  min-width: 0;
  justify-items: start;
  gap: 4px;
}

.summary-type-row-head small {
  color: var(--muted);
  font-size: 11px;
}

.summary-type-row-metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(92px, 1fr));
  min-width: 0;
  gap: 6px;
}

.summary-type-list:not(.summary-type-list--with-costs) .summary-type-row-metrics {
  grid-template-columns: repeat(3, minmax(92px, 1fr));
}

.summary-type-metric,
.summary-type-row .summary-difference,
.summary-type-row .summary-type-cost {
  display: grid;
  align-content: center;
  min-width: 0;
  min-height: 50px;
  gap: 2px;
  padding: 7px 9px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
  font-variant-numeric: tabular-nums;
}

.summary-type-metric small,
.summary-type-row .summary-difference small,
.summary-type-row .summary-type-cost small {
  overflow: hidden;
  color: var(--muted);
  font-size: 10px;
  font-weight: var(--fw-semibold);
  line-height: 1.25;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.summary-type-metric strong,
.summary-type-row .summary-difference strong,
.summary-type-row .summary-type-cost strong {
  overflow: hidden;
  color: var(--text);
  font-size: 14px;
  line-height: 1.25;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.summary-type-row .summary-difference--positive {
  border-color: color-mix(in srgb, var(--amber) 40%, var(--line));
  background: var(--badge-warn-bg);
}

.summary-type-row .summary-difference--negative {
  border-color: color-mix(in srgb, var(--red) 38%, var(--line));
  background: var(--badge-error-bg);
}

.summary-type-row .summary-difference--aligned {
  border-color: color-mix(in srgb, var(--green) 36%, var(--line));
  background: var(--badge-ok-bg);
}

.summary-type-row .summary-difference--positive strong,
.summary-type-row .summary-difference--negative strong,
.summary-type-row .summary-difference--aligned strong {
  color: currentColor;
}

.summary-type-row .summary-type-cost {
  border-color: color-mix(in srgb, var(--brand-tan-deep) 38%, var(--line));
  background: color-mix(in srgb, var(--brand-tan-light) 28%, var(--surface));
}

.summary-type-table-wrap {
  max-height: min(540px, calc(100vh - 250px));
}

.summary-type-table {
  min-width: 860px;
}

.summary-type-table--with-costs {
  min-width: 1020px;
}

.summary-type-table th:first-child {
  min-width: 170px;
}

.summary-type-table th:last-child {
  min-width: 240px;
}

.summary-type-table tbody th {
  color: var(--text);
  text-align: left;
  background: var(--surface);
}

.summary-type-table tbody th small {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 11px;
  font-weight: var(--fw-regular);
}

.summary-type-code {
  display: inline-flex;
  align-items: center;
  min-height: 27px;
  padding: 3px 9px;
  border: 1px solid color-mix(in srgb, var(--brand-tan-deep) 36%, var(--line));
  border-radius: var(--radius-pill);
  color: var(--text);
  font-size: 13px;
  font-weight: var(--fw-bold);
  background: color-mix(in srgb, var(--brand-tan-light) 34%, var(--surface));
}

.summary-hours-value {
  color: var(--text);
  font-weight: var(--fw-semibold);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.summary-cost-badge {
  border-color: color-mix(in srgb, var(--brand-tan-deep) 42%, var(--line));
  color: var(--text);
  background: color-mix(in srgb, var(--brand-tan-light) 38%, var(--surface));
  font-variant-numeric: tabular-nums;
}

.summary-type-cost-cell {
  min-width: 150px;
}

.summary-type-cost {
  display: grid;
  min-width: 138px;
  gap: 1px;
  padding: 6px 9px;
  border: 1px solid color-mix(in srgb, var(--brand-tan-deep) 38%, var(--line));
  border-radius: 8px;
  color: var(--text);
  font-variant-numeric: tabular-nums;
  background: color-mix(in srgb, var(--brand-tan-light) 30%, var(--surface));
}

.summary-type-cost strong {
  font-size: 15px;
}

.summary-type-cost small {
  color: var(--muted);
  font-size: 11px;
}

.summary-difference {
  display: grid;
  min-width: 112px;
  gap: 1px;
  padding: 6px 9px;
  border: 1px solid var(--line);
  border-radius: 8px;
  font-variant-numeric: tabular-nums;
  background: var(--surface-soft);
}

.summary-difference strong {
  font-size: 15px;
}

.summary-difference small {
  color: currentColor;
  font-size: 11px;
}

.summary-difference--positive {
  border-color: color-mix(in srgb, var(--amber) 42%, var(--line));
  color: var(--amber);
  background: var(--badge-warn-bg);
}

.summary-difference--negative {
  border-color: color-mix(in srgb, var(--red) 36%, var(--line));
  color: var(--red);
  background: var(--badge-error-bg);
}

.summary-difference--aligned {
  border-color: color-mix(in srgb, var(--green) 34%, var(--line));
  color: var(--green);
  background: var(--badge-ok-bg);
}

.summary-type-bars {
  display: grid;
  min-width: 0;
  gap: 7px;
}

.summary-type-bar-row {
  display: grid;
  grid-template-columns: 78px minmax(80px, 1fr) auto;
  align-items: center;
  gap: 8px;
}

.summary-type-bar-row small {
  color: var(--muted);
  font-size: 11px;
}

.summary-type-bar-row > strong {
  min-width: 56px;
  color: var(--text);
  font-size: 11px;
  font-variant-numeric: tabular-nums;
  text-align: right;
}

.summary-type-track {
  height: 8px;
  overflow: hidden;
  border-radius: var(--radius-pill);
  background: var(--surface-soft);
}

.summary-type-bar {
  display: block;
  height: 100%;
  border-radius: inherit;
}

.summary-type-bar--inserted {
  background: var(--brand-tan);
}

.summary-type-bar--reported {
  background: var(--primary);
}

.summary-detail-section {
  border-color: color-mix(in srgb, var(--brand-tan) 40%, var(--line));
}

.summary-detail {
  display: grid;
  min-width: 0;
  gap: 22px;
}

.summary-disclosure {
  min-width: 0;
  overflow: clip;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
}

.summary-disclosure[open] {
  border-color: color-mix(in srgb, var(--brand-tan-deep) 48%, var(--line));
}

.summary-disclosure-summary {
  min-height: 64px;
  list-style: none;
  cursor: pointer;
  touch-action: manipulation;
  transition: background-color 180ms ease-out;
}

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

.summary-disclosure-summary:hover {
  background: color-mix(in srgb, var(--brand-tan-light) 25%, var(--surface));
}

.summary-disclosure-summary:focus-visible {
  position: relative;
  z-index: 1;
  outline: 2px solid var(--primary);
  outline-offset: -3px;
  box-shadow: var(--focus-ring);
}

.summary-disclosure-icon {
  width: 10px;
  height: 10px;
  border-right: 2px solid var(--muted);
  border-bottom: 2px solid var(--muted);
  transform: rotate(-45deg);
  transform-origin: center;
  transition: transform 180ms ease-out, border-color 180ms ease-out;
}

.summary-disclosure[open] > .summary-disclosure-summary .summary-disclosure-icon {
  border-color: var(--text);
  transform: rotate(45deg) translate(-2px, -2px);
}

.summary-project-list {
  display: grid;
  min-width: 0;
  gap: 10px;
}

.summary-project-card {
  border-radius: 11px;
  box-shadow: 0 4px 14px color-mix(in srgb, var(--brand-charcoal) 5%, transparent);
}

.summary-project-card[open] {
  border-color: color-mix(in srgb, var(--brand-tan-deep) 44%, var(--line));
  box-shadow: inset 3px 0 0 var(--brand-tan), 0 8px 20px color-mix(in srgb, var(--brand-charcoal) 7%, transparent);
}

.summary-project-summary {
  display: grid;
  grid-template-columns: 18px minmax(190px, 0.8fr) minmax(520px, 1.8fr);
  min-height: 76px;
  align-items: center;
  gap: 14px;
  padding: 13px 16px;
  list-style: none;
  cursor: pointer;
  touch-action: manipulation;
  background: linear-gradient(105deg, color-mix(in srgb, var(--brand-tan-light) 16%, var(--surface)), var(--surface) 52%);
}

.summary-project-summary:hover {
  background: linear-gradient(105deg, color-mix(in srgb, var(--brand-tan-light) 30%, var(--surface)), var(--surface) 58%);
}

.summary-project-copy {
  display: grid;
  min-width: 0;
  gap: 2px;
}

.summary-project-copy > small,
.summary-hour-type-copy > small,
.summary-non-project-section > header small {
  color: color-mix(in srgb, var(--brand-tan-deep) 78%, var(--text));
  font-size: 10px;
  font-weight: var(--fw-bold);
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

.summary-project-copy > strong,
.summary-hour-type-copy > strong {
  overflow-wrap: anywhere;
  font-size: 17px;
  line-height: 1.25;
}

.summary-project-copy > span,
.summary-hour-type-copy > span {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.summary-detail-totals {
  display: grid;
  grid-template-columns: repeat(4, minmax(94px, 1fr));
  min-width: 0;
  gap: 6px;
}

.summary-detail-totals--without-costs {
  grid-template-columns: repeat(3, minmax(94px, 1fr));
}

.summary-detail-stat {
  display: grid;
  align-content: center;
  min-width: 0;
  min-height: 49px;
  gap: 1px;
  padding: 6px 9px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: color-mix(in srgb, var(--surface-soft) 66%, var(--surface));
}

.summary-detail-stat small {
  overflow: hidden;
  color: var(--muted);
  font-size: 10px;
  font-weight: var(--fw-semibold);
  line-height: 1.2;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.summary-detail-stat strong {
  overflow: hidden;
  color: var(--text);
  font-size: 13px;
  font-variant-numeric: tabular-nums;
  line-height: 1.25;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.summary-detail-stat em {
  overflow: hidden;
  color: currentColor;
  font-size: 9px;
  font-style: normal;
  line-height: 1.2;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.summary-detail-stat--positive {
  border-color: color-mix(in srgb, var(--amber) 40%, var(--line));
  color: var(--badge-warn-fg);
  background: var(--badge-warn-bg);
}

.summary-detail-stat--negative {
  border-color: color-mix(in srgb, var(--red) 38%, var(--line));
  color: var(--badge-error-fg);
  background: var(--badge-error-bg);
}

.summary-detail-stat--aligned {
  border-color: color-mix(in srgb, var(--green) 36%, var(--line));
  color: var(--badge-ok-fg);
  background: var(--badge-ok-bg);
}

.summary-detail-stat--positive strong,
.summary-detail-stat--negative strong,
.summary-detail-stat--aligned strong {
  color: currentColor;
}

.summary-detail-stat--cost {
  border-color: color-mix(in srgb, var(--brand-tan-deep) 38%, var(--line));
  background: color-mix(in srgb, var(--brand-tan-light) 28%, var(--surface));
}

.summary-project-body {
  min-width: 0;
  padding: 14px;
  border-top: 1px solid var(--line);
  background: color-mix(in srgb, var(--surface-soft) 50%, var(--surface));
}

.summary-hour-type-group {
  min-width: 0;
  border-left: 3px solid var(--brand-tan-deep);
  border-radius: 9px;
}

.summary-hour-type-group + .summary-hour-type-group {
  margin-top: 14px;
}

.summary-hour-type-group--untyped {
  border-left-color: var(--line-strong);
}

.summary-hour-type-summary,
.summary-month-head {
  display: grid;
  align-items: flex-start;
  min-width: 0;
  gap: 16px;
}

.summary-hour-type-summary {
  grid-template-columns: 18px minmax(140px, 0.6fr) minmax(460px, 1.8fr);
  align-items: center;
  padding: 10px 12px;
}

.summary-hour-type-copy,
.summary-month-copy {
  display: grid;
  min-width: 0;
  gap: 2px;
}

.summary-month-copy h5,
.summary-month-copy h6,
.summary-non-project-section h4 {
  margin: 0;
  color: var(--text);
}

.summary-hour-type-copy > strong {
  font-size: 16px;
}

.summary-hour-type-body {
  padding: 10px;
  border-top: 1px solid var(--line);
  background: color-mix(in srgb, var(--surface-soft) 52%, var(--surface));
}

.summary-detail-totals--compact {
  flex: 0 1 620px;
  grid-template-columns: repeat(4, minmax(90px, 1fr));
}

.summary-detail-totals--compact .summary-detail-stat {
  min-height: 44px;
  padding-block: 5px;
}

.summary-detail-months {
  display: grid;
  min-width: 0;
  gap: 10px;
}

.summary-detail-years {
  display: grid;
  min-width: 0;
  gap: 10px;
}

.summary-year-group {
  border: 1px solid color-mix(in srgb, var(--brand-tan-deep) 34%, var(--line));
  border-radius: 9px;
}

.summary-year-group[open] {
  border-color: color-mix(in srgb, var(--brand-tan-deep) 52%, var(--line));
}

.summary-year-summary {
  display: grid;
  grid-template-columns: 18px minmax(130px, 0.55fr) minmax(460px, 1.8fr);
  min-height: 68px;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  list-style: none;
  cursor: pointer;
  background: color-mix(in srgb, var(--brand-tan-light) 18%, var(--surface-soft));
}

.summary-year-summary:hover {
  background: color-mix(in srgb, var(--brand-tan-light) 30%, var(--surface));
}

.summary-year-copy {
  display: grid;
  min-width: 0;
  gap: 2px;
}

.summary-year-copy small {
  color: color-mix(in srgb, var(--brand-tan-deep) 78%, var(--text));
  font-size: 10px;
  font-weight: var(--fw-bold);
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

.summary-year-copy strong {
  font-size: 17px;
}

.summary-year-copy span {
  color: var(--muted);
  font-size: 12px;
}

.summary-year-body {
  padding: 10px;
  border-top: 1px solid var(--line);
  background: color-mix(in srgb, var(--surface-soft) 52%, var(--surface));
}

.summary-trend {
  min-width: 0;
}

.summary-trend-years {
  display: grid;
  min-width: 0;
  gap: 10px;
}

.summary-trend-year {
  border-color: color-mix(in srgb, var(--brand-tan-deep) 36%, var(--line));
}

.summary-trend-year-summary {
  display: grid;
  grid-template-columns: 18px minmax(130px, 0.5fr) minmax(460px, 1.8fr);
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  background: color-mix(in srgb, var(--brand-tan-light) 18%, var(--surface-soft));
}

.summary-trend-year-body {
  min-width: 0;
  padding: 10px;
  border-top: 1px solid var(--line);
  background: color-mix(in srgb, var(--surface-soft) 52%, var(--surface));
}

.summary-trend-table-wrap {
  max-width: 100%;
  overflow-x: auto;
  overscroll-behavior-inline: contain;
}

.summary-trend-table {
  width: 100%;
  min-width: 930px;
}

.summary-trend-table--with-costs {
  min-width: 1040px;
}

.summary-trend-table caption {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
}

.summary-trend-table th:first-child {
  min-width: 120px;
  text-align: left;
}

.summary-trend-table th:not(:first-child),
.summary-trend-table td {
  text-align: right;
}

.summary-trend-table tbody th {
  color: var(--text);
  font-weight: var(--fw-semibold);
  background: var(--surface);
}

.summary-trend-table td {
  color: var(--text);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.summary-month-group {
  min-width: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--surface);
}

.summary-month-head {
  align-items: center;
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  background: color-mix(in srgb, var(--surface-soft) 72%, var(--surface));
}

.summary-month-copy h5,
.summary-month-copy h6 {
  font-size: 14px;
  line-height: 1.3;
}

.summary-month-copy small {
  color: var(--muted);
  font-size: 11px;
}

.summary-detail-table-wrap {
  max-width: 100%;
  overflow-x: auto;
  overscroll-behavior-inline: contain;
  scrollbar-color: var(--line-strong) transparent;
}

.summary-detail-table {
  width: 100%;
  min-width: 650px;
}

.summary-detail-table--with-costs {
  min-width: 790px;
}

.summary-detail-caption {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
}

.summary-detail-table th:first-child {
  min-width: 190px;
  text-align: left;
}

.summary-detail-table th:not(:first-child),
.summary-detail-table td {
  text-align: right;
}

.summary-detail-table tbody th {
  color: var(--text);
  font-weight: var(--fw-semibold);
  background: var(--surface);
}

.summary-detail-table td {
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

.summary-detail-difference {
  display: inline-grid;
  min-width: 104px;
  gap: 1px;
  justify-items: end;
}

.summary-detail-difference strong {
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}

.summary-detail-difference small {
  color: currentColor;
  font-size: 10px;
}

.summary-detail-difference--positive {
  color: var(--badge-warn-fg);
}

.summary-detail-difference--negative {
  color: var(--badge-error-fg);
}

.summary-detail-difference--aligned {
  color: var(--badge-ok-fg);
}

.summary-detail-cost {
  font-weight: var(--fw-semibold);
}

.summary-non-project-section {
  display: grid;
  min-width: 0;
  gap: 12px;
  padding-top: 20px;
  border-top: 1px solid var(--line);
}

.summary-non-project-section > header {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 16px;
}

.summary-non-project-section > header > span {
  display: grid;
  gap: 2px;
}

.summary-non-project-section h4 {
  font-size: 17px;
}

.summary-non-project-section > header p {
  max-width: 58ch;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
  text-align: right;
}

.summary-project-card--non-project[open] {
  box-shadow: inset 3px 0 0 var(--line-strong), 0 8px 20px color-mix(in srgb, var(--brand-charcoal) 7%, transparent);
}

.summary-detail-empty {
  display: grid;
  justify-items: center;
  gap: 4px;
  padding: 28px 20px;
  border: 1px dashed var(--line-strong);
  border-radius: 10px;
  color: var(--muted);
  text-align: center;
  background: var(--surface-soft);
}

.summary-detail-empty strong {
  color: var(--text);
}

.summary-check-block {
  background: linear-gradient(180deg, color-mix(in srgb, var(--surface-soft) 74%, var(--surface)), var(--surface));
}

.summary-check-block .panel-head {
  margin-bottom: 18px;
}

.summary-check-block .table-wrap,
.summary-section .table-wrap {
  max-height: min(620px, calc(100vh - 230px));
}

.chart-box {
  background: var(--surface);
}

.modal-backdrop,
.confirm-backdrop {
  background: rgba(31, 30, 29, 0.68);
  backdrop-filter: blur(5px);
}

.modal {
  color: var(--text);
  background: var(--surface);
}

.modal-head,
.template-fields-footer {
  background: color-mix(in srgb, var(--surface) 94%, transparent);
}

.excel-preview {
  background: var(--surface-soft);
}

#toast,
.toast-item {
  color: var(--sidebar-fg);
  background: var(--brand-charcoal-ink);
}

:root[data-theme="dark"] .auth-layout {
  background: var(--surface);
}

:root[data-theme="dark"] .auth-story {
  background: radial-gradient(circle at 30% 22%, color-mix(in srgb, var(--brand-tan) 18%, transparent), transparent 22rem), linear-gradient(155deg, #3d3935, #1d1c1b 75%);
}

:root[data-theme="dark"] .userbar {
  box-shadow: 0 6px 22px rgba(0, 0, 0, 0.18);
}

:root[data-theme="dark"] .workspace .atena-panel,
:root[data-theme="dark"] .workspace .panel,
:root[data-theme="dark"] .workspace .metric {
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.16);
}

:root[data-theme="dark"] canvas {
  filter: saturate(0.9) brightness(1.08);
}

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

  .sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    width: min(292px, calc(100vw - 54px));
    height: 100dvh;
    transform: translateX(-105%);
    transition: transform var(--dur-slow) ease-out;
  }

  body.nav-open {
    overflow: hidden;
  }

  body.nav-open .sidebar {
    transform: translateX(0);
  }

  .nav-backdrop {
    position: fixed;
    inset: 0;
    z-index: 60;
    display: block;
    visibility: hidden;
    border: 0;
    opacity: 0;
    background: rgba(25, 24, 23, 0.64);
    transition: opacity var(--dur) var(--ease), visibility var(--dur) var(--ease);
  }

  body.nav-open .nav-backdrop {
    visibility: visible;
    opacity: 1;
  }

  .userbar .mobile-nav-toggle.atena-btn {
    display: inline-flex;
    flex: 0 0 auto;
    min-width: 44px;
    padding-inline: 9px;
    margin-right: 12px;
  }

  .userbar {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    padding-inline: 18px;
  }

  .route-context {
    min-width: 0;
  }

  .userbar-actions {
    min-width: 0;
    flex-shrink: 1;
  }

  .management-layout {
    grid-template-columns: minmax(0, 1fr);
  }

  .management-nav {
    position: static;
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .management-nav .management-nav-item.atena-btn {
    min-height: 68px;
  }

  .hours-layout,
  .calendar-layout,
  .split,
  .grid-panels,
  .template-mapper,
  .change-log-layout {
    grid-template-columns: minmax(0, 1fr);
  }

  .hours-side {
    order: -1;
  }

  .day-editor {
    position: static;
  }

  .summary-project-summary {
    grid-template-columns: 18px minmax(180px, 1fr);
  }

  .summary-project-summary > .summary-detail-totals {
    grid-column: 2;
  }

  .summary-type-row {
    grid-template-columns: minmax(150px, 0.55fr) minmax(0, 1.45fr);
  }

  .summary-type-row > .summary-type-bars {
    grid-column: 1 / -1;
  }

  .summary-hour-type-summary,
  .summary-year-summary,
  .summary-trend-year-summary {
    grid-template-columns: 18px minmax(180px, 1fr);
  }

  .summary-hour-type-summary > .summary-detail-totals,
  .summary-year-summary > .summary-detail-totals,
  .summary-trend-year-summary > .summary-detail-totals {
    grid-column: 2;
  }
}

@media (max-width: 760px) {
  :root {
    --control-h: 44px;
    --fs-body: 16px;
  }

  body.summary-multi-open {
    overflow: hidden;
  }

  .workspace .summary-filters.filters.filter-bar {
    backdrop-filter: none;
  }

  .summary-multi-panel,
  .summary-multi-field:nth-of-type(4) .summary-multi-panel {
    position: fixed;
    z-index: 260;
    inset: auto 12px 12px;
    width: auto;
    max-height: min(620px, 74dvh);
    border-radius: 15px;
    box-shadow: 0 -18px 48px color-mix(in srgb, var(--brand-charcoal) 28%, transparent);
  }

  .summary-multi-options {
    max-height: min(330px, 42dvh);
  }

  .auth-gate {
    align-items: start;
    padding: 0;
    background: var(--surface);
  }

  .auth-layout {
    display: block;
    width: 100%;
    min-height: 100dvh;
    border: 0;
    border-radius: 0;
    box-shadow: none;
  }

  .auth-story {
    min-height: 188px;
    justify-content: flex-end;
    padding: 26px 24px;
  }

  .auth-story img {
    top: 22px;
    left: 24px;
    width: 72px;
  }

  .auth-story-kicker,
  .auth-story > p:not(.auth-story-kicker),
  .auth-trust {
    display: none;
  }

  .auth-story h1 {
    max-width: 16ch;
    font-size: 28px;
  }

  .auth-layout .auth-card {
    width: 100%;
    margin: 0;
    padding: 28px 22px 40px;
  }

  .auth-brand {
    margin-bottom: 28px;
  }

  .userbar {
    grid-template-columns: 44px minmax(0, 1fr) auto;
    min-height: 64px;
    padding: 8px 12px;
  }

  .breadcrumbs,
  .route-title,
  .theme-option-label,
  .current-user,
  .logout-button span {
    display: none;
  }

  .userbar .current-user.atena-badge {
    display: none;
  }

  .route-context {
    overflow: hidden;
  }

  .route-context::after {
    content: "Gestionale";
    display: block;
    overflow: hidden;
    color: var(--text);
    font-size: 16px;
    font-weight: var(--fw-bold);
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .theme-switch .theme-option.atena-btn {
    min-height: 44px;
    padding-inline: 11px;
  }

  .logout-button {
    min-width: 44px;
    padding-inline: 11px;
  }

  .userbar-actions {
    gap: 6px;
  }

  .workspace-content {
    padding: 20px 14px 34px;
  }

  input:not([type="checkbox"]):not([type="radio"]),
  select {
    min-height: 44px;
  }

  .summary-workspace.atena-panel {
    padding: 0;
    border: 0;
    background: transparent;
    box-shadow: none;
  }

  .page-head {
    align-items: start;
    gap: 14px;
    margin-bottom: 18px;
  }

  .dashboard-role-context {
    display: grid;
    gap: 8px;
  }

  .dashboard-role-context p {
    text-align: left;
  }

  .subview-tabs {
    width: 100%;
  }

  .page-head > div:last-child {
    width: 100%;
  }

  .page-head > div:last-child .atena-btn,
  .page-head > div:last-child .button {
    width: 100%;
  }

  .management-layout {
    gap: 14px;
  }

  .management-nav {
    display: flex;
    width: 100%;
    gap: 6px;
    padding: 6px;
    overflow-x: auto;
    overscroll-behavior-inline: contain;
    scrollbar-width: none;
    scroll-snap-type: x proximity;
  }

  .management-nav::-webkit-scrollbar,
  .editor-section-tabs::-webkit-scrollbar {
    display: none;
  }

  .management-nav .management-nav-item.atena-btn {
    flex: 0 0 min(220px, 78vw);
    min-height: 64px;
    scroll-snap-align: start;
  }

  .management-section-head {
    display: grid;
    align-items: start;
    gap: 12px;
  }

  .management-section-action,
  .management-section-action .toolbar,
  .management-section-action .atena-btn,
  .management-section-action .button {
    width: 100%;
  }

  .management-section-action .toolbar {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
  }

  .project-list-toolbar {
    top: 64px;
    gap: 10px;
    padding-top: 8px;
  }

  .workspace .filters.filter-bar {
    top: 64px;
  }

  .project-command-row {
    display: grid;
    align-items: start;
    gap: 10px;
  }

  .project-command-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    width: 100%;
  }

  .project-command-actions .atena-btn,
  .project-command-actions .button {
    width: 100%;
  }

  .editor-section-tabs {
    display: flex;
    padding-inline: 14px;
    overflow-x: auto;
    overscroll-behavior-inline: contain;
    scrollbar-width: none;
    scroll-snap-type: x proximity;
  }

  .editor-section-tabs .editor-section-tab.atena-btn {
    flex: 0 0 180px;
    min-height: 60px;
    scroll-snap-align: start;
  }

  .structured-modal .modal-form-actions {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
  }

  .structured-modal .modal-form-actions .atena-btn,
  .structured-modal .modal-form-actions .button {
    width: 100%;
  }

  .filters.filter-bar {
    padding: 14px;
  }

  .filter-controls,
  .table-search .filter-controls,
  .hours-filters .filter-controls,
  .summary-filters .filter-controls,
  .approvals-filters .filter-controls,
  .export-filters .filter-controls,
  .change-log-filters .filter-controls {
    grid-template-columns: minmax(0, 1fr);
  }

  .filter-actions,
  .filter-actions > * {
    width: 100%;
  }

  .project-filter-bar .filter-actions {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
  }

  .project-filter-bar .filter-actions > * {
    width: auto;
  }

  .project-filter-bar #clearProjectSearch {
    width: 100%;
  }

  .summary-workspace .compact-metrics,
  .metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .summary-view-tabs .summary-view-tab.atena-btn {
    min-height: 58px;
    padding: 8px 10px;
  }

  .summary-view-tabs {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .summary-view-tab-icon {
    flex-basis: 34px;
    width: 34px;
    height: 34px;
  }

  .summary-view-tab-copy small {
    display: none;
  }

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

  .summary-scope-item:nth-child(2) {
    border-right: 0;
  }

  .summary-scope-item:nth-child(-n + 2) {
    border-bottom: 1px solid var(--line);
  }

  .summary-overview-hero,
  .summary-section {
    padding: 14px;
  }

  .summary-overview-head,
  .summary-section-head,
  .summary-check-block .panel-head {
    display: grid;
    gap: 10px;
  }

  .summary-section-badges {
    justify-content: flex-start;
  }

  .summary-detail {
    gap: 18px;
  }

  .summary-project-summary {
    grid-template-columns: 16px minmax(0, 1fr);
    gap: 10px;
    padding: 12px;
  }

  .summary-project-summary > .summary-detail-totals {
    grid-column: 1 / -1;
  }

  .summary-hour-type-summary,
  .summary-year-summary,
  .summary-trend-year-summary {
    grid-template-columns: 16px minmax(0, 1fr);
    gap: 10px;
    padding: 12px;
  }

  .summary-hour-type-summary > .summary-detail-totals,
  .summary-year-summary > .summary-detail-totals {
    grid-column: 1 / -1;
  }

  .summary-trend-year-summary > .summary-detail-totals {
    grid-column: 1 / -1;
  }

  .summary-detail-totals,
  .summary-detail-totals--compact {
    width: 100%;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .summary-detail-stat small,
  .summary-detail-stat strong,
  .summary-detail-stat em {
    overflow: visible;
    text-overflow: clip;
    white-space: normal;
  }

  .summary-project-body,
  .summary-hour-type-body,
  .summary-trend-year-body {
    padding: 10px;
  }

  .summary-month-head,
  .summary-non-project-section > header {
    display: grid;
    gap: 10px;
  }

  .summary-non-project-section > header {
    align-items: start;
  }

  .summary-non-project-section > header p {
    text-align: left;
  }

  .summary-detail-table-wrap {
    max-width: 100%;
  }

  .summary-type-row {
    grid-template-columns: minmax(0, 1fr);
    gap: 10px;
    padding: 11px;
  }

  .summary-type-row-metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .summary-type-list:not(.summary-type-list--with-costs) .summary-type-row-metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .summary-type-row .summary-type-bars {
    grid-column: auto;
    padding-top: 2px;
  }

  .summary-type-metric small,
  .summary-type-row .summary-difference small,
  .summary-type-row .summary-type-cost small,
  .summary-type-metric strong,
  .summary-type-row .summary-difference strong,
  .summary-type-row .summary-type-cost strong {
    overflow: visible;
    text-overflow: clip;
    white-space: normal;
  }

  .summary-trend-table-wrap {
    overflow: visible;
  }

  .summary-trend-table,
  .summary-trend-table--with-costs {
    display: block;
    width: 100%;
    min-width: 0;
    border-collapse: separate;
  }

  .summary-trend-table thead {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    overflow: hidden;
    clip: rect(0 0 0 0);
    clip-path: inset(50%);
    white-space: nowrap;
  }

  .summary-trend-table tbody {
    display: grid;
    gap: 8px;
  }

  .summary-trend-table tbody tr {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: 9px;
    background: var(--surface);
  }

  .summary-trend-table tbody th {
    grid-column: 1 / -1;
    padding: 10px 12px;
    border-bottom: 1px solid var(--line);
    text-align: left;
    background: color-mix(in srgb, var(--brand-tan-light) 20%, var(--surface-soft));
  }

  .summary-trend-table tbody td {
    display: grid;
    min-width: 0;
    gap: 3px;
    padding: 9px 12px;
    border: 0;
    text-align: left;
    white-space: normal;
    background: var(--surface);
  }

  .summary-trend-table tbody td::before {
    content: attr(data-label);
    color: var(--muted);
    font-size: 10px;
    font-weight: var(--fw-bold);
    letter-spacing: 0.06em;
    text-transform: uppercase;
  }

  .summary-type-table {
    width: 100%;
    min-width: 0;
    border-collapse: separate;
    border-spacing: 0;
  }

  .summary-type-table thead {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    overflow: hidden;
    clip: rect(0 0 0 0);
    clip-path: inset(50%);
    white-space: nowrap;
  }

  .summary-type-table tbody {
    display: grid;
    gap: 10px;
    padding: 10px;
  }

  .summary-type-table tbody tr {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: var(--surface);
  }

  .summary-type-table tbody th {
    grid-column: 1 / -1;
    padding: 11px 12px;
    border-bottom: 1px solid var(--line);
    background: color-mix(in srgb, var(--brand-tan-light) 20%, var(--surface-soft));
  }

  .summary-type-table tbody td {
    display: grid;
    min-width: 0;
    gap: 4px;
    padding: 10px 12px;
    border: 0;
    background: var(--surface);
  }

  .summary-type-table tbody td::before {
    content: attr(data-label);
    color: var(--muted);
    font-size: 10px;
    font-weight: var(--fw-bold);
    letter-spacing: 0.07em;
    text-transform: uppercase;
  }

  .summary-type-table tbody td:nth-of-type(3) {
    grid-column: 1 / -1;
    border-top: 1px solid var(--line);
  }

  .summary-type-table--with-costs tbody td:nth-of-type(4) {
    grid-column: 1 / -1;
    border-top: 1px solid var(--line);
  }

  .summary-type-table .summary-difference {
    min-width: 0;
  }

  .summary-type-table .summary-type-cost {
    min-width: 0;
  }

  .summary-type-table tbody .summary-type-visual-cell {
    display: none;
  }

  .summary-filters .filter-controls {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .summary-filters .filter-controls > *,
  .summary-filters input,
  .summary-filters select {
    min-width: 0;
  }

  .summary-filters .filter-actions {
    display: grid;
    grid-column: 1 / -1;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .metric {
    min-height: 100px;
    padding: 14px;
  }

  .calendar-weekdays,
  .calendar-grid {
    grid-template-columns: repeat(7, minmax(36px, 1fr));
    gap: 4px;
  }

  .calendar-day {
    min-height: 82px;
    padding: 6px;
  }

  .day-editor {
    position: fixed;
    inset: auto 0 0;
    z-index: 80;
    max-height: 76dvh;
    overflow: auto;
    border-radius: 18px 18px 0 0;
    box-shadow: 0 -18px 50px rgba(31, 30, 29, 0.32);
  }

  .modal-backdrop {
    place-items: center;
    padding: 10px;
  }

  .modal {
    width: min(100%, calc(100vw - 20px));
    max-height: calc(100dvh - 20px);
    border-radius: 18px;
  }

  .modal-head {
    position: sticky;
    top: 0;
    z-index: 2;
  }

  .table-wrap {
    max-width: calc(100vw - 28px);
  }
}

@media (max-width: 420px) {
  .summary-workspace .compact-metrics,
  .metrics {
    grid-template-columns: minmax(0, 1fr);
  }

  .summary-view-tab .badge {
    display: none;
  }

  .summary-context {
    grid-template-columns: minmax(0, 1fr);
  }

  .summary-scope-item,
  .summary-scope-item:nth-child(2) {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .summary-scope-item:last-child {
    border-bottom: 0;
  }

  .calendar-weekdays {
    font-size: 10px;
  }

  .management-nav-copy small,
  .editor-section-copy small {
    display: none;
  }

  .management-nav .management-nav-item.atena-btn {
    flex-basis: 150px;
    min-height: 52px;
  }

  .editor-section-tabs .editor-section-tab.atena-btn {
    flex-basis: 145px;
  }

  .project-command-copy .eyebrow,
  .project-filter-bar .filter-bar-description {
    display: none;
  }

  .project-command-copy h2 {
    font-size: 19px;
  }
}

@media (max-width: 1180px) {
  .user-admin-workspace.editing {
    grid-template-columns: minmax(300px, 0.72fr) minmax(500px, 1.28fr);
  }

  .cost-management-layout {
    grid-template-columns: minmax(220px, 280px) minmax(0, 1fr);
  }

  .cost-rate-row {
    grid-template-columns: 90px repeat(2, minmax(130px, 1fr));
  }

  .cost-rate-row .field-group:nth-of-type(4),
  .cost-rate-actions {
    grid-column: span 1;
  }
}

@media (max-width: 900px) {
  .user-admin-workspace {
    display: block;
  }

  .user-admin-workspace:not(.editing) .user-editor-panel {
    display: none;
  }

  .user-admin-workspace.editing .user-list-panel {
    display: none;
  }

  .cost-management-layout {
    grid-template-columns: minmax(0, 1fr);
  }

  .cost-person-options {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    max-height: 320px;
  }

  .cost-rate-row {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    align-items: start;
  }

  .cost-rate-actions {
    grid-column: 1 / -1;
    justify-content: flex-end;
  }
}

@media (max-width: 640px) {
  .user-editor-head {
    display: grid;
    padding: 16px;
  }

  .user-editor-head .atena-btn {
    width: 100%;
  }

  .user-editor-form .editor-section-panel {
    min-height: 0;
    padding: 16px;
  }

  .user-editor-form .editor-section-tabs {
    padding-inline: 12px;
  }

  .scope-editor-grid,
  .cost-policy-fieldset,
  .cost-person-options,
  .cost-rate-row,
  .employee-cost-link {
    grid-template-columns: minmax(0, 1fr);
  }

  .user-editor-actions,
  .cost-editor-actions {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    padding: 12px 16px calc(12px + env(safe-area-inset-bottom));
  }

  .user-editor-actions .atena-btn,
  .cost-editor-actions .atena-btn {
    width: 100%;
  }

  .cost-rate-grid,
  .cost-editor-head {
    padding-inline: 14px;
  }

  .cost-rate-actions {
    display: grid;
    grid-column: auto;
    grid-template-columns: minmax(0, 1fr);
  }

  .cost-missing-list li {
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .cost-missing-list small {
    grid-column: 1 / -1;
  }
}

/* Approvazioni — coda decisionale mensile. */
.approvals-workspace {
  container-type: inline-size;
}

.approvals-workspace .page-head h1,
.approval-queue-head h2 {
  text-wrap: balance;
}

.approvals-workspace button,
.approvals-workspace input,
.approvals-workspace select,
.approval-decision-modal button {
  touch-action: manipulation;
}

.approvals-filters .filter-controls {
  grid-template-columns: minmax(230px, 1.5fr) 110px minmax(140px, 0.8fr) minmax(180px, 1fr) auto;
}

.approval-status-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: var(--space-5);
  margin-bottom: var(--space-7);
}

.approval-status-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: var(--space-1) var(--space-5);
  min-height: 96px;
  padding: var(--space-6) var(--space-7);
  text-align: left;
  background: var(--surface);
  border-color: var(--line);
}

.approval-status-card:hover,
.approval-status-card.active {
  border-color: var(--brand-tan-deep);
  background: color-mix(in srgb, var(--brand-tan) 12%, var(--surface));
}

.approval-status-card.active {
  box-shadow: inset 3px 0 0 var(--brand-tan-deep);
}

.approval-status-card > span {
  color: var(--text);
  font-weight: var(--fw-semibold);
}

.approval-status-card > strong {
  grid-row: 1 / span 2;
  grid-column: 2;
  color: var(--text);
  font-size: clamp(22px, 3cqi, 30px);
}

.approval-status-card > small {
  color: var(--muted);
  line-height: 1.35;
}

.approval-status-card.is-pending > strong {
  color: var(--amber);
}

.approval-status-card.is-attention > strong {
  color: var(--red);
}

.approval-queue-panel {
  padding: 0;
  overflow: hidden;
}

.approval-queue-head {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: var(--space-7);
  padding: var(--space-7) var(--space-8);
  border-bottom: 1px solid var(--line);
}

.approval-queue-head h2 {
  margin-bottom: var(--space-1);
  font-size: clamp(20px, 2vw, 24px);
}

.approval-queue-guidance {
  max-width: 70ch;
  margin: var(--space-2) 0 0;
  color: var(--muted);
  font-size: var(--fs-caption);
  text-wrap: pretty;
}

.approval-legend {
  display: grid;
  justify-items: end;
  gap: 2px;
  color: var(--muted);
  font-size: var(--fs-caption);
}

.approval-legend strong {
  color: var(--text);
  font-size: var(--fs-label);
}

.approval-bulk-bar {
  display: grid;
  border-bottom: 1px solid var(--line);
  background: color-mix(in srgb, var(--brand-tan) 16%, var(--surface-soft));
}

.approval-bulk-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-7);
  min-height: 64px;
  padding: var(--space-4) var(--space-8);
}

.approval-bulk-summary > div:first-child {
  display: grid;
  gap: 2px;
}

.approval-bulk-bar span {
  color: var(--muted);
  font-size: var(--fs-caption);
}

.approval-bulk-actions {
  display: flex;
  gap: var(--space-3);
}

.approval-bulk-scope-editor {
  border-top: 1px solid color-mix(in srgb, var(--brand-tan) 32%, var(--line));
}

.approval-bulk-scope-editor[hidden] {
  display: none;
}

.approvals-table {
  border: 0;
  border-radius: 0;
}

.approvals-table table {
  min-width: 860px;
}

.approvals-table th,
.approvals-table td {
  padding: var(--space-4) var(--space-5);
  vertical-align: middle;
}

.approvals-table tbody tr {
  position: relative;
}

.approvals-table .approval-scope-editor-row > td {
  padding: 0;
  background: color-mix(in srgb, var(--selected) 48%, var(--surface));
}

.approvals-table tbody tr.approval-row-attention td:first-child {
  box-shadow: inset 3px 0 0 var(--amber);
}

.approval-select-head,
.approval-select-cell {
  width: 48px;
  min-width: 48px;
  padding: 2px !important;
  text-align: center;
}

.approval-checkbox-hit {
  display: inline-grid;
  place-items: center;
  width: 44px;
  height: 44px;
  margin: auto;
  cursor: pointer;
}

.approval-select-head input,
.approval-select-cell input {
  width: 20px;
  height: 20px;
  margin: 0;
  accent-color: var(--primary);
}

.approval-person-cell {
  min-width: 170px;
  max-width: 240px;
}

.approval-person-cell > strong,
.approval-person-cell > span,
.approval-cell-meta {
  display: block;
}

.approval-person-cell > strong {
  margin-bottom: 3px;
  color: var(--text);
  font-size: var(--fs-label);
}

.approval-projects,
.approval-person-note,
.approval-cell-meta {
  color: var(--muted);
  font-size: var(--fs-caption);
  line-height: 1.4;
}

.approval-projects {
  overflow-wrap: anywhere;
}

.approval-projects.is-empty {
  font-style: italic;
}

.approval-person-note {
  margin-top: var(--space-1);
  color: var(--text);
}

.approvals-table .badge {
  margin-bottom: var(--space-1);
  white-space: nowrap;
}

.approval-hours-cell {
  min-width: 240px;
}

.approval-hours-check {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--space-3);
}

.approval-hours-check > div {
  display: grid;
  align-content: start;
  gap: 2px;
  min-width: 0;
  padding-left: var(--space-3);
  border-left: 1px solid var(--line);
}

.approval-hours-check > div:first-child {
  padding-left: 0;
  border-left: 0;
}

.approval-hours-check span,
.approval-hours-check small {
  color: var(--muted);
  font-size: var(--fs-caption);
  line-height: 1.3;
}

.approval-hours-check strong {
  color: var(--text);
  font-size: var(--fs-label);
}

.approval-hours-check .is-attention strong {
  color: var(--red);
}

.approval-hours-check .is-aligned strong {
  color: var(--green);
}

.approvals-table .table-actions-head,
.approvals-table .table-actions-cell {
  min-width: 250px;
}

.approvals-table .approvals-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-2);
}

.approvals-actions button {
  min-height: 44px;
  width: 100%;
  padding-inline: var(--space-3);
}

.approval-empty,
.approval-load-error {
  min-height: 180px;
  padding: var(--space-8);
}

.approval-empty > div {
  display: grid;
  gap: var(--space-1);
}

.approval-empty strong {
  color: var(--text);
}

.approval-empty span {
  display: block;
}

.approval-decision-modal {
  width: min(680px, 100%);
}

.approval-decision-context {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--space-3);
  padding: var(--space-5);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--surface-soft);
}

.approval-decision-context > div {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.approval-decision-context span {
  color: var(--muted);
  font-size: var(--fs-caption);
}

.approval-decision-context strong {
  overflow-wrap: anywhere;
}

#approvalDecisionNote {
  min-height: 132px;
  resize: vertical;
}

@media (max-width: 1100px) {
  .approvals-filters .filter-controls {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .approvals-filters .filter-actions {
    grid-column: 1 / -1;
  }

  .approval-status-strip {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

/* La coda vive accanto alla sidebar: si adatta allo spazio reale del pannello,
   non soltanto alla larghezza della finestra. */
@container (max-width: 980px) {
  .approvals-table table {
    min-width: 0;
    table-layout: fixed;
  }

  .approvals-table th,
  .approvals-table td {
    padding-inline: var(--space-3);
  }

  .approvals-table .approval-person-cell,
  .approvals-table .approval-hours-cell,
  .approvals-table .table-actions-head,
  .approvals-table .table-actions-cell {
    min-width: 0;
    max-width: none;
  }

  .approvals-table .approval-person-cell {
    width: 19%;
  }

  .approvals-table .approval-hours-cell {
    width: 27%;
  }

  .approvals-table .table-actions-head,
  .approvals-table .table-actions-cell {
    width: 25%;
  }

  .approvals-actions button {
    padding-inline: var(--space-2);
    line-height: 1.2;
    white-space: normal;
  }
}

@media (max-width: 760px) {
  .approvals-filters .filter-controls {
    grid-template-columns: minmax(0, 0.78fr) minmax(0, 1.22fr);
  }

  .approvals-filters .filter-controls > :first-child,
  .approvals-filters .filter-controls > :nth-child(4),
  .approvals-filters .filter-actions {
    grid-column: 1 / -1;
  }

  .approval-queue-head,
  .approval-bulk-summary {
    display: grid;
    align-items: start;
  }

  .approval-legend {
    justify-items: start;
  }

  .approval-bulk-actions,
  .approval-bulk-actions .atena-btn {
    width: 100%;
  }

  .approval-bulk-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .approvals-table {
    max-width: none;
    overflow: visible;
    background: var(--surface-soft);
  }

  .approvals-table table,
  .approvals-table tbody,
  .approvals-table tr,
  .approvals-table td {
    display: block;
    width: 100%;
    min-width: 0;
    max-width: none;
  }

  .approvals-table table {
    min-width: 0;
  }

  .approvals-table thead {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
  }

  .approvals-table tbody {
    display: grid;
    gap: var(--space-5);
    padding: var(--space-5);
  }

  .approvals-table tbody tr {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    background: var(--surface);
  }

  .approvals-table tbody tr:has(+ .approval-scope-editor-row) {
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  }

  .approvals-table tbody .approval-scope-editor-row {
    margin-top: calc(-1 * var(--space-5));
    border-top: 0;
    border-radius: 0 0 var(--radius-lg) var(--radius-lg);
  }

  .approvals-table .approval-scope-editor-row > td {
    display: block;
    grid-column: 1 / -1;
    padding: 0;
    border-bottom: 0;
  }

  .approvals-table .approval-scope-editor-row > td::before {
    display: none;
  }

  .approvals-table tbody tr.approval-row-attention {
    border-color: color-mix(in srgb, var(--amber) 54%, var(--line));
  }

  .approvals-table tbody tr.approval-row-attention td:first-child {
    box-shadow: none;
  }

  .approvals-table td {
    display: grid;
    grid-template-columns: minmax(92px, 0.7fr) minmax(0, 1fr);
    gap: var(--space-3);
    min-height: 44px;
    padding: var(--space-4) var(--space-5);
    border-bottom: 1px solid var(--line);
  }

  .approvals-table td::before {
    content: attr(data-label);
    color: var(--muted);
    font-size: var(--fs-caption);
    font-weight: var(--fw-semibold);
  }

  .approvals-table .approval-select-cell,
  .approvals-table .approval-person-cell,
  .approvals-table .approval-hours-cell,
  .approvals-table .table-actions-cell {
    grid-column: 1 / -1;
  }

  .approvals-table .approval-select-cell {
    display: flex;
    align-items: center;
    justify-content: space-between;
    text-align: left;
  }

  .approvals-table .approval-select-cell::before {
    content: "Seleziona per approvare";
  }

  .approvals-table .approval-person-cell {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 2px;
  }

  .approvals-table .approval-person-cell::before {
    margin-bottom: var(--space-1);
  }

  .approvals-table .approval-hours-cell {
    display: block;
  }

  .approvals-table .approval-hours-cell::before {
    display: block;
    margin-bottom: var(--space-3);
  }

  .approvals-table .numeric-cell {
    text-align: left;
  }

  .approvals-table .table-actions-cell {
    position: static;
    min-width: 0;
    max-width: 100%;
    background: var(--surface-soft);
    box-shadow: none;
  }

  .approvals-table .table-row-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    width: 100%;
  }

  .approvals-table .table-row-actions button {
    width: 100%;
  }

  .approval-decision-context {
    grid-template-columns: minmax(0, 1fr);
  }

  .approval-empty,
  .approval-load-error {
    display: grid;
    justify-items: stretch;
  }

  .approval-empty button,
  .approval-load-error button {
    width: 100%;
  }
}

@media (max-width: 460px) {
  .approval-status-strip {
    gap: var(--space-3);
  }

  .approval-status-card {
    min-height: 88px;
    padding: var(--space-5);
  }

  .approval-status-card > small {
    grid-column: 1 / -1;
  }

  .approval-bulk-actions {
    grid-template-columns: minmax(0, 1fr);
  }

  .approvals-table tbody tr {
    grid-template-columns: minmax(0, 1fr);
  }

  .approvals-table td,
  .approvals-table .approval-select-cell,
  .approvals-table .approval-person-cell,
  .approvals-table .approval-hours-cell,
  .approvals-table .table-actions-cell {
    grid-column: 1;
  }

  .approval-hours-check {
    grid-template-columns: minmax(0, 1fr);
  }

  .approval-hours-check > div,
  .approval-hours-check > div:first-child {
    padding: var(--space-2) 0 0;
    border-top: 1px solid var(--line);
    border-left: 0;
  }

  .approval-hours-check > div:first-child {
    padding-top: 0;
    border-top: 0;
  }
}

@media (max-width: 350px) {
  .summary-filters .filter-controls,
  .summary-filters .filter-actions {
    grid-template-columns: minmax(0, 1fr);
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* Rifiniture sistemiche: azioni persistenti, navigazione contestuale e numeri. */
.brand-copy strong {
  color: var(--brand-charcoal);
}

.table-actions-head,
.table-actions-cell {
  position: sticky;
  right: 0;
  width: 1%;
  min-width: 132px;
  white-space: nowrap;
  background: var(--surface);
  box-shadow: -10px 0 14px -14px color-mix(in srgb, var(--brand-charcoal) 48%, transparent);
}

.table-actions-head {
  z-index: 4;
  color: var(--text);
  background: var(--surface-header);
}

.table-actions-cell {
  z-index: 2;
}

.table-wrap tbody tr:not(.nonworking):not(.has-anomaly):not(.selected-row):not(.anomaly-detail-row):hover .table-actions-cell {
  background: var(--row-hover);
}

tr.nonworking .table-actions-cell {
  background: var(--holiday);
}

tr.has-anomaly .table-actions-cell,
tr.row-error .table-actions-cell {
  background: var(--row-error);
}

.table-row-actions,
.table-actions-cell .mini-actions {
  display: flex;
  align-items: center;
  flex-wrap: nowrap;
  gap: 8px;
}

.table-row-actions:empty {
  min-height: 44px;
}

.table-row-actions button,
.table-actions-cell .mini-actions button,
.additional-row-actions button {
  min-height: 44px;
  padding: 8px 12px;
  white-space: nowrap;
}

.numeric-value,
.numeric-cell,
.numeric-cell > * {
  font-variant-numeric: tabular-nums;
  overflow-wrap: normal;
  word-break: normal;
  white-space: nowrap;
}

.numeric-cell {
  text-align: right;
}

.metric,
.summary-detail-stat,
.summary-type-metric,
.summary-type-row .summary-difference,
.summary-type-row .summary-type-cost {
  container-type: inline-size;
}

.metric .numeric-value {
  max-width: 100%;
  overflow: visible;
  font-size: clamp(16px, 11cqi, 26px);
  letter-spacing: -0.025em;
  text-overflow: clip;
}

.summary-overview-metrics .summary-metric .numeric-value {
  font-size: clamp(16px, 12cqi, 30px);
}

.summary-detail-stat strong.numeric-value,
.summary-type-metric strong.numeric-value,
.summary-type-row .summary-difference strong.numeric-value,
.summary-type-row .summary-type-cost strong.numeric-value {
  max-width: 100%;
  overflow: visible;
  font-size: clamp(11px, 12cqi, 14px);
  letter-spacing: -0.02em;
  text-overflow: clip;
  white-space: nowrap;
}

.summary-detail-difference .numeric-value,
.summary-type-bar-row .numeric-value {
  overflow: visible;
  text-overflow: clip;
  white-space: nowrap;
}

@media (min-width: 1101px) {
  .management-layout.context-compact {
    grid-template-columns: 76px minmax(0, 1fr);
    gap: 16px;
  }

  .management-layout.context-compact .management-nav {
    padding: 6px;
  }

  .management-layout.context-compact .management-nav-item.atena-btn {
    min-height: 56px;
    justify-content: center;
    padding: 8px;
  }

  .management-layout.context-compact .management-nav-icon {
    flex-basis: 40px;
    width: 40px;
    height: 40px;
  }

  .management-layout.context-compact .management-nav-copy {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    clip-path: inset(50%);
    white-space: nowrap;
  }
}

@media (max-width: 1100px) {
  .management-layout.context-compact .management-nav-copy small {
    display: none;
  }

  .management-layout.context-compact .management-nav-item.atena-btn {
    min-height: 52px;
  }
}

@media (max-width: 640px) {
  .table-actions-head,
  .table-actions-cell {
    min-width: 116px;
  }

  .table-row-actions,
  .table-actions-cell .mini-actions {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
  }

  .table-row-actions button,
  .table-actions-cell .mini-actions button {
    width: 100%;
  }

  .management-layout.context-compact .management-nav .management-nav-item.atena-btn {
    flex-basis: 148px;
  }

  .summary-detail-stat strong.numeric-value,
  .summary-type-metric strong.numeric-value,
  .summary-type-row .summary-difference strong.numeric-value,
  .summary-type-row .summary-type-cost strong.numeric-value {
    overflow: visible;
    font-size: clamp(11px, 8cqi, 14px);
    text-overflow: clip;
    white-space: nowrap;
  }
}

/* Personale — directory e dossier contestuale */
.sr-only {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  clip-path: inset(50%) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

.personnel-management-panel.atena-panel {
  overflow: visible;
}

.personnel-command-bar {
  position: sticky;
  top: 72px;
  z-index: 8;
  display: grid;
  grid-template-columns: minmax(260px, 1fr) minmax(180px, 220px) auto auto;
  align-items: end;
  gap: 12px;
  margin: 18px 0;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: color-mix(in srgb, var(--surface) 96%, transparent);
  box-shadow: 0 8px 18px color-mix(in srgb, var(--brand-charcoal) 6%, transparent);
  backdrop-filter: blur(12px);
}

.personnel-search-field {
  position: relative;
  display: grid;
  min-width: 0;
  gap: 6px;
}

.personnel-search-field label {
  color: var(--muted);
  font-size: 13px;
  font-weight: var(--fw-semibold);
}

.personnel-search-field .atena-control {
  padding-left: 38px;
}

.personnel-search-icon {
  position: absolute;
  bottom: 11px;
  left: 12px;
  z-index: 1;
  display: grid;
  color: var(--muted);
  pointer-events: none;
}

.personnel-command-bar .badge {
  align-self: center;
  min-width: 86px;
  justify-content: center;
}

.personnel-workspace {
  display: grid;
  grid-template-columns: minmax(270px, 330px) minmax(0, 1fr);
  align-items: start;
  gap: 18px;
  min-width: 0;
}

.personnel-directory,
.personnel-profile {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
}

.personnel-directory {
  position: sticky;
  top: 158px;
  overflow: hidden;
}

.personnel-directory-head {
  display: grid;
  gap: 4px;
  padding: 14px 15px 12px;
  border-bottom: 1px solid var(--line);
  background: var(--surface-soft);
}

.personnel-directory-head > div {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}

.personnel-directory-head strong {
  font-size: 15px;
}

.personnel-directory-head span {
  color: var(--muted);
  font-size: 12px;
}

.personnel-directory-hint {
  line-height: 1.4;
}

.personnel-directory-list {
  display: grid;
  gap: 2px;
  max-height: calc(100dvh - 232px);
  min-height: 240px;
  overflow-y: auto;
  padding: 6px;
  scrollbar-color: var(--line-strong) transparent;
  scrollbar-width: thin;
}

.personnel-directory-item {
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 74px;
  padding: 9px 10px;
  border: 1px solid transparent;
  border-radius: 8px;
  color: var(--text);
  font: inherit;
  text-align: left;
  background: transparent;
  cursor: pointer;
  transition: var(--transition-control);
}

.personnel-directory-item:hover {
  border-color: var(--line);
  background: var(--surface-soft);
}

.personnel-directory-item.active {
  border-color: color-mix(in srgb, var(--brand-tan-deep) 48%, var(--line));
  background: var(--selected);
  box-shadow: inset 3px 0 0 var(--brand-tan-deep);
}

.personnel-directory-avatar,
.personnel-avatar {
  display: grid;
  place-items: center;
  color: var(--brand-charcoal-ink);
  font-weight: var(--fw-bold);
  background: var(--brand-tan-light);
  border: 1px solid color-mix(in srgb, var(--brand-tan-deep) 34%, var(--line));
}

:root[data-theme="dark"] .personnel-directory-avatar,
:root[data-theme="dark"] .personnel-avatar {
  color: #302f2e;
}

.personnel-directory-avatar {
  width: 38px;
  height: 38px;
  border-radius: 9px;
  font-size: 13px;
}

.personnel-directory-copy {
  display: grid;
  min-width: 0;
  gap: 2px;
}

.personnel-directory-copy strong,
.personnel-directory-copy span,
.personnel-directory-copy small {
  overflow: visible;
  overflow-wrap: anywhere;
  text-overflow: clip;
  white-space: normal;
}

.personnel-directory-copy strong {
  font-size: 14px;
  line-height: 1.3;
}

.personnel-directory-copy span {
  color: var(--text);
  font-size: 12px;
  line-height: 1.35;
}

.personnel-directory-copy small {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.35;
}

.personnel-directory-state,
.personnel-state-badge,
.personnel-document-status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  width: fit-content;
  color: var(--muted);
  font-size: 11px;
  font-weight: var(--fw-semibold);
  white-space: nowrap;
}

.personnel-directory-state > span,
.personnel-state-badge > span,
.personnel-document-status > span {
  width: 7px;
  height: 7px;
  flex: 0 0 7px;
  border-radius: 50%;
  background: var(--muted);
}

.personnel-directory-state.is-active > span,
.personnel-state-badge.is-active > span,
.personnel-document-status > span {
  background: var(--green);
}

.personnel-directory-state.is-inactive,
.personnel-state-badge.is-inactive {
  color: var(--muted);
}

.personnel-directory-empty {
  min-height: 220px;
}

.personnel-profile {
  overflow: visible;
}

.personnel-profile-empty {
  display: grid;
  min-height: 420px;
  place-items: center;
  align-content: center;
  gap: 8px;
  padding: 32px;
  color: var(--muted);
  text-align: center;
  background: var(--surface-soft);
}

.personnel-profile-empty h3 {
  color: var(--text);
}

.personnel-profile-empty p {
  max-width: 380px;
  line-height: 1.5;
}

.personnel-empty-mark {
  display: grid;
  width: 56px;
  height: 56px;
  margin-bottom: 4px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 12px;
  color: var(--brand-tan-deep);
  background: var(--surface);
}

.personnel-profile-content {
  min-width: 0;
}

.personnel-mobile-back {
  display: none !important;
}

.personnel-identity-head {
  display: grid;
  grid-template-columns: 68px minmax(0, 1fr) auto;
  align-items: center;
  gap: 16px;
  padding: 20px 22px;
  border-bottom: 3px solid var(--brand-tan);
  background: var(--surface);
}

.personnel-avatar {
  width: 68px;
  height: 68px;
  border-radius: 14px;
  font-size: 21px;
  letter-spacing: 0.02em;
}

.personnel-identity-copy {
  display: grid;
  min-width: 0;
  gap: 4px;
}

.personnel-identity-copy h2 {
  overflow-wrap: anywhere;
  font-size: clamp(22px, 2.4vw, 30px);
  line-height: 1.12;
}

.personnel-identity-copy > p {
  color: var(--muted);
  font-size: 14px;
}

.personnel-status-line {
  min-height: 18px;
}

.personnel-affiliation-list {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 3px;
}

.personnel-affiliation-list > span {
  max-width: 100%;
  padding: 3px 7px;
  overflow: visible;
  overflow-wrap: anywhere;
  border: 1px solid var(--line);
  border-radius: 5px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.35;
  text-overflow: clip;
  white-space: normal;
  background: var(--surface-soft);
}

.personnel-profile-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.personnel-profile-actions .atena-btn {
  min-height: 44px;
}

.personnel-profile-nav {
  position: sticky;
  top: 158px;
  z-index: 5;
  display: flex;
  gap: 3px;
  padding: 6px 10px;
  overflow-x: auto;
  border-bottom: 1px solid var(--line);
  background: color-mix(in srgb, var(--surface) 96%, transparent);
  backdrop-filter: blur(12px);
  scrollbar-width: none;
}

.personnel-profile-nav::-webkit-scrollbar {
  display: none;
}

.personnel-profile-nav .atena-btn {
  min-height: 40px;
  flex: 0 0 auto;
  border-color: transparent;
  color: var(--muted);
  background: transparent;
}

.personnel-profile-nav .atena-btn:hover {
  color: var(--text);
  border-color: var(--line);
  background: var(--surface-soft);
}

.personnel-profile-nav .atena-btn.active {
  color: var(--text);
  border-color: color-mix(in srgb, var(--brand-tan-deep) 45%, var(--line));
  background: var(--selected);
}

.personnel-dossier {
  display: grid;
  gap: 0;
}

.personnel-dossier-section {
  scroll-margin-top: 218px;
  padding: 22px;
  border-bottom: 1px solid var(--line);
}

.personnel-dossier-section:last-child {
  border-bottom: 0;
}

.personnel-section-head {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
}

.personnel-section-head .eyebrow {
  margin-bottom: 3px;
}

.personnel-section-head h3 {
  font-size: 18px;
}

.personnel-section-head .hint {
  max-width: 620px;
  margin-top: 5px;
}

.personnel-metadata-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  border-top: 1px solid var(--line);
  border-left: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
}

.personnel-metadata-item {
  display: grid;
  align-content: start;
  gap: 5px;
  min-height: 76px;
  padding: 12px 14px;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  background: var(--surface-soft);
}

.personnel-metadata-item span {
  color: var(--muted);
  font-size: 11px;
  font-weight: var(--fw-semibold);
}

.personnel-metadata-item strong {
  min-width: 0;
  overflow-wrap: anywhere;
  font-size: 14px;
  line-height: 1.35;
}

.personnel-metadata-item .mono {
  font-family: var(--font-mono, ui-monospace, monospace);
  letter-spacing: 0.02em;
}

.personnel-project-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.personnel-project-item {
  display: grid;
  grid-template-columns: minmax(74px, auto) minmax(0, 1fr);
  align-items: center;
  gap: 12px;
  min-height: 66px;
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.personnel-project-code {
  min-width: 74px;
  padding: 5px 7px;
  overflow: hidden;
  border-radius: 5px;
  color: var(--brand-charcoal-ink);
  font-size: 12px;
  font-weight: var(--fw-bold);
  text-align: center;
  text-overflow: ellipsis;
  white-space: nowrap;
  background: var(--brand-tan-light);
}

.personnel-project-item > div {
  display: grid;
  min-width: 0;
  gap: 3px;
}

.personnel-project-item strong,
.personnel-project-item span {
  overflow: visible;
  overflow-wrap: anywhere;
  text-overflow: clip;
  white-space: normal;
}

.personnel-project-item strong {
  font-size: 13px;
}

.personnel-project-item > div > span {
  color: var(--muted);
  font-size: 11px;
}

.personnel-section-empty {
  grid-column: 1 / -1;
  min-height: 120px;
}

.personnel-section-empty strong,
.personnel-section-empty span {
  display: block;
}

.personnel-section-empty span {
  margin-top: 4px;
  color: var(--muted);
}

.personnel-loading-state {
  grid-column: 1 / -1;
  display: grid;
  gap: 8px;
  padding: 18px;
  color: var(--muted);
  font-size: 13px;
}

.personnel-loading-bar {
  display: block;
  width: min(100%, 420px);
  height: 10px;
  border-radius: 4px;
  background: var(--surface-soft);
  animation: personnel-loading 1.4s ease-in-out infinite alternate;
}

.personnel-loading-bar:nth-child(2) {
  width: min(72%, 300px);
  animation-delay: 0.15s;
}

@keyframes personnel-loading {
  to {
    opacity: 0.45;
  }
}

.personnel-document-state,
.personnel-signature-card {
  display: flex;
  align-items: center;
  gap: 14px;
  min-height: 88px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
}

.personnel-document-icon {
  display: grid;
  width: 46px;
  height: 46px;
  flex: 0 0 46px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 9px;
  color: var(--muted);
  font-size: 22px;
  background: var(--surface);
}

.personnel-document-state > div,
.personnel-signature-card > div {
  display: grid;
  min-width: 0;
  gap: 4px;
}

.personnel-document-state p,
.personnel-signature-card small {
  color: var(--muted);
  font-size: 12px;
}

.personnel-signature-card img {
  width: 150px;
  height: 64px;
  object-fit: contain;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #ffffff;
}

.personnel-cost-summary {
  display: grid;
  gap: 8px;
}

.personnel-cost-year {
  display: grid;
  grid-template-columns: 86px minmax(0, 1fr);
  align-items: stretch;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.personnel-cost-year-head {
  display: grid;
  place-content: center;
  gap: 2px;
  padding: 12px;
  text-align: center;
  background: var(--surface-header);
}

.personnel-cost-year-head span,
.personnel-cost-year dt {
  color: var(--muted);
  font-size: 11px;
}

.personnel-cost-year-head strong {
  font-size: 18px;
}

.personnel-cost-year dl {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin: 0;
}

.personnel-cost-year dl > div {
  display: grid;
  align-content: center;
  gap: 4px;
  min-width: 0;
  padding: 12px 14px;
  border-left: 1px solid var(--line);
}

.personnel-cost-year dd {
  min-width: 0;
  margin: 0;
  overflow-x: auto;
  font-size: 14px;
  font-weight: var(--fw-semibold);
  white-space: nowrap;
  scrollbar-width: none;
}

.personnel-cost-year dd::-webkit-scrollbar {
  display: none;
}

.personnel-inline-cost-editor {
  container-type: inline-size;
  margin-top: 14px;
  overflow: visible;
  scroll-margin-top: 218px;
  border-color: var(--line-strong);
  border-radius: 9px;
  box-shadow: none;
  background: var(--surface-soft);
}

.personnel-inline-cost-editor .cost-editor-head {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 14px;
  background: var(--surface);
}

.personnel-inline-cost-editor .cost-rate-grid {
  min-height: 0;
  padding: 14px;
}

.personnel-inline-cost-editor .empty-state {
  min-height: 112px;
  padding: 18px;
}

.personnel-inline-cost-editor .cost-rate-row {
  background: var(--surface);
}

.personnel-inline-cost-editor .cost-editor-actions {
  position: static;
  border-radius: 0 0 9px 9px;
}

@container (max-width: 760px) {
  .personnel-inline-cost-editor .cost-rate-row {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    align-items: start;
  }

  .personnel-inline-cost-editor .cost-rate-actions {
    grid-column: 1 / -1;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .personnel-inline-cost-editor .cost-rate-actions .atena-btn,
  .personnel-inline-cost-editor .cost-rate-actions button {
    width: 100%;
  }
}

@container (max-width: 400px) {
  .personnel-inline-cost-editor .cost-editor-head,
  .personnel-inline-cost-editor .cost-rate-row,
  .personnel-inline-cost-editor .cost-rate-actions,
  .personnel-inline-cost-editor .cost-editor-actions {
    grid-template-columns: minmax(0, 1fr);
  }

  .personnel-inline-cost-editor .cost-editor-head {
    display: grid;
  }

  .personnel-inline-cost-editor .cost-editor-head .atena-btn,
  .personnel-inline-cost-editor .cost-editor-actions .atena-btn {
    width: 100%;
  }
}

@media (max-width: 1320px) {
  .personnel-workspace {
    grid-template-columns: minmax(250px, 290px) minmax(0, 1fr);
  }

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

  .personnel-project-list {
    grid-template-columns: minmax(0, 1fr);
  }

  .personnel-directory-state {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
  }

  .personnel-identity-head {
    grid-template-columns: 68px minmax(0, 1fr);
  }

  .personnel-profile-actions {
    grid-column: 1 / -1;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    width: 100%;
  }

  .personnel-profile-actions .atena-btn {
    width: 100%;
  }
}

@media (min-width: 1101px) and (max-width: 1320px) {
  .management-layout:not(.context-compact) {
    grid-template-columns: minmax(0, 1fr);
  }

  .management-layout:not(.context-compact) > .management-nav {
    position: static;
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  #personnel .management-layout:not(.context-compact) > .management-nav {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .management-layout:not(.context-compact) > .management-nav .management-nav-item.atena-btn {
    min-height: 68px;
  }
}

@media (max-width: 1100px) {
  #personnel .management-nav {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 900px) {
  #personnel .management-nav {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .personnel-command-bar {
    top: 72px;
    grid-template-columns: minmax(220px, 1fr) minmax(170px, 210px) auto;
  }

  .personnel-command-bar .badge {
    display: none;
  }

  .personnel-workspace {
    display: block;
  }

  .personnel-directory {
    position: static;
  }

  .personnel-profile {
    display: none;
  }

  .personnel-workspace.detail-open .personnel-directory {
    display: none;
  }

  .personnel-workspace.detail-open .personnel-profile {
    display: block;
  }

  .personnel-mobile-back {
    display: inline-flex !important;
    margin: 10px 12px 0;
    min-height: 44px;
  }

  .personnel-profile-nav {
    top: 72px;
  }

  .personnel-dossier-section {
    scroll-margin-top: 132px;
  }

  .personnel-directory-list {
    max-height: none;
  }
}

@media (max-width: 700px) {
  .personnel-command-bar {
    position: static;
    grid-template-columns: minmax(0, 1fr);
  }

  .personnel-command-bar .atena-btn {
    width: 100%;
  }

  .personnel-identity-head {
    grid-template-columns: 56px minmax(0, 1fr);
    padding: 16px;
  }

  .personnel-avatar {
    width: 56px;
    height: 56px;
    border-radius: 12px;
    font-size: 18px;
  }

  .personnel-profile-actions {
    grid-column: 1 / -1;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    width: 100%;
  }

  .personnel-profile-actions .atena-btn {
    width: 100%;
  }

  .personnel-profile-nav {
    top: 72px;
  }

  .personnel-dossier-section {
    padding: 18px 16px;
  }

  .personnel-metadata-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .personnel-cost-year {
    grid-template-columns: minmax(0, 1fr);
  }

  .personnel-cost-year-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    text-align: left;
  }

  .personnel-cost-year dl {
    grid-template-columns: minmax(0, 1fr);
  }

  .personnel-cost-year dl > div {
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: baseline;
    border-top: 1px solid var(--line);
    border-left: 0;
  }

  .personnel-section-head {
    display: grid;
    align-items: start;
  }

  .personnel-section-head > .atena-btn {
    width: 100%;
  }

  .personnel-signature-card {
    align-items: flex-start;
    flex-direction: column;
  }

  .personnel-signature-card img {
    width: 100%;
  }
}

@media (max-width: 430px) {
  #personnel .management-nav {
    display: flex;
    grid-template-columns: none;
  }

  .personnel-directory-item {
    grid-template-columns: 38px minmax(0, 1fr);
  }

  .personnel-profile-actions {
    grid-template-columns: minmax(0, 1fr);
  }

  .personnel-project-item {
    grid-template-columns: minmax(0, 1fr);
  }

  .personnel-project-code {
    width: fit-content;
    max-width: 100%;
  }
}

@media (prefers-reduced-motion: reduce) {
  .personnel-loading-bar {
    animation: none;
  }

  .personnel-directory-item {
    transition: none;
  }
}

/* Approvazioni: decisione contestuale dentro la lista. */
.approval-inline-scope {
  display: grid;
  grid-template-columns: minmax(190px, 0.9fr) minmax(210px, 0.9fr) minmax(260px, 1.35fr) auto;
  align-items: end;
  gap: var(--space-4);
  padding: var(--space-5) var(--space-6);
}

.approval-inline-scope-intro {
  display: flex;
  grid-column: 1 / -1;
  align-items: baseline;
  gap: var(--space-3);
  min-width: 0;
}

.approval-inline-scope-intro strong {
  color: var(--text);
  font-size: var(--fs-label);
}

.approval-inline-scope-intro span,
.approval-inline-scope-result span {
  color: var(--muted);
  font-size: var(--fs-caption);
  line-height: 1.4;
  text-wrap: pretty;
}

.approval-inline-scope-result {
  display: grid;
  align-content: center;
  gap: 2px;
  min-width: 0;
  min-height: 44px;
}

.approval-inline-scope-result strong {
  color: var(--text);
  white-space: nowrap;
}

.approval-inline-scope-actions {
  display: flex;
  gap: var(--space-2);
}

.approval-inline-scope-actions button {
  min-height: 44px;
  white-space: nowrap;
}

.approval-scope-locks {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  margin-top: var(--space-2);
}

.approval-scope-lock {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  min-width: 0;
  max-width: 100%;
  padding: var(--space-2) var(--space-3);
  border: 1px solid color-mix(in srgb, var(--green) 38%, var(--line));
  border-radius: var(--radius-sm);
  background: color-mix(in srgb, var(--badge-ok-bg) 72%, var(--surface));
  color: var(--text);
  font-size: var(--fs-caption);
}

.approval-scope-lock > span {
  min-width: 0;
  overflow-wrap: anywhere;
}

.approval-scope-lock button {
  flex: 0 0 auto;
  min-height: 44px;
  padding: var(--space-1) var(--space-2);
}

.badge.approval-hour-lock {
  border-color: color-mix(in srgb, var(--green) 38%, var(--line));
  background: var(--badge-ok-bg);
  color: var(--badge-ok-fg);
  white-space: normal;
}

.entry-row.is-approval-locked {
  padding: var(--space-2);
  border: 1px solid color-mix(in srgb, var(--green) 30%, var(--line));
  border-radius: var(--radius-sm);
  background: color-mix(in srgb, var(--badge-ok-bg) 55%, var(--surface));
}

.entry-row.is-approval-locked select:disabled,
.entry-row.is-approval-locked input:disabled {
  color: var(--text);
  opacity: 1;
}

/* Editor progetto: le destinazioni restano visibili, scorre soltanto il contenuto. */
.project-modal.entity-modal {
  display: flex;
  width: min(1180px, 100%);
  height: min(860px, calc(100dvh - 44px));
  flex-direction: column;
}

.project-modal > .modal-body {
  flex: 1 1 auto;
  min-height: 0;
  padding: 0;
  overflow: hidden;
}

.project-editor-layout {
  display: grid;
  grid-template-columns: 244px minmax(0, 1fr);
  grid-template-rows: minmax(0, 1fr) auto;
  height: 100%;
  min-height: 0;
  gap: 0;
  overflow: hidden;
}

.project-editor-layout > .editor-section-tabs {
  position: static;
  grid-column: 1;
  grid-row: 1 / 3;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: var(--space-2);
  margin: 0;
  padding: var(--space-4);
  border-right: 1px solid var(--line);
  border-bottom: 0;
  overflow: auto;
  background: var(--surface-soft);
  backdrop-filter: none;
}

.project-editor-layout > .editor-section-tabs .editor-section-tab.atena-btn {
  flex: 0 0 auto;
  width: 100%;
  min-height: 72px;
  padding: var(--space-3);
}

.project-editor-layout > .editor-section-tabs .editor-section-tab.atena-btn.active {
  box-shadow: inset 3px 0 0 var(--blue);
}

.project-editor-layout > .editor-section-panel {
  grid-column: 2;
  grid-row: 1;
  min-height: 0;
  padding: var(--space-6);
  overflow: auto;
  overscroll-behavior: contain;
}

.project-editor-layout > .modal-form-actions {
  grid-column: 2;
  grid-row: 2;
  margin: 0;
  padding: var(--space-3) var(--space-6);
  border-top: 1px solid var(--line);
  background: var(--surface);
}

.project-governance-block {
  display: grid;
  gap: var(--space-3);
  padding: var(--space-4);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--surface-soft);
}

.section-block-head h4,
.section-block-head p {
  margin: 0;
}

.summary-multi-panel.is-portaled {
  z-index: 360;
  margin: 0;
  overflow: auto;
  overscroll-behavior: contain;
  box-shadow: var(--shadow-modal);
}

.hours-filters.filters.filter-bar {
  overflow: visible;
}

.summary-overview-metrics .summary-metric small,
.summary-type-metric em {
  display: block;
  overflow: hidden;
  color: var(--muted);
  font-size: 10px;
  font-style: normal;
  font-weight: var(--fw-regular);
  line-height: 1.25;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.summary-trend-value {
  display: grid;
  justify-items: end;
  gap: 1px;
}

.summary-trend-value strong {
  color: var(--text);
  font-weight: var(--fw-semibold);
}

.summary-trend-value small {
  color: var(--muted);
  font-size: 10px;
  font-weight: var(--fw-regular);
}

@media (min-width: 761px) {
  .filters.filter-bar.hours-filters,
  .filters.filter-bar.summary-filters {
    gap: 0;
    padding: 0;
  }

  .hours-filters .filter-bar-head,
  .summary-filters .filter-bar-head {
    padding: var(--space-2) var(--space-3);
  }

  .hours-filters .filter-controls,
  .summary-filters .filter-controls {
    gap: var(--space-2);
    padding: var(--space-3);
  }

  .summary-workspace,
  .summary-view-panel {
    gap: var(--space-3);
  }

  .summary-view-tabs .summary-view-tab.atena-btn {
    min-height: 56px;
    padding: var(--space-2) var(--space-3);
  }

  .summary-view-tab-icon {
    flex-basis: 32px;
    width: 32px;
    height: 32px;
  }

  .summary-overview-hero {
    gap: var(--space-3);
    padding: var(--space-3) var(--space-4);
  }

  .summary-section {
    padding: var(--space-4);
  }

  .summary-overview-metrics .summary-metric {
    min-height: 76px;
    gap: 2px;
    padding: var(--space-2) var(--space-3);
  }

  .summary-overview-metrics .summary-metric::after {
    display: none;
  }

  .summary-trend-table {
    min-width: 780px;
  }

  .summary-trend-table--with-costs {
    min-width: 900px;
  }
}

.summary-workspace .summary-overview-metrics {
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: var(--space-2);
}

@media (max-width: 1100px) {
  .summary-workspace .summary-overview-metrics {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 760px) {
  .summary-workspace .summary-overview-metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

/* Inserimento ore: progetto, ordinarie e straordinario costituiscono una riga verificabile. */
.entry-row {
  grid-template-columns: minmax(190px, 1.6fr) repeat(2, minmax(104px, 0.6fr)) minmax(96px, 0.5fr) auto;
  align-items: end;
  gap: var(--space-2);
  margin-bottom: var(--space-3);
}

.entry-control {
  display: grid;
  min-width: 0;
  gap: var(--space-1);
  color: var(--text);
  font-size: var(--fs-caption);
  font-weight: var(--fw-semibold);
}

.entry-control input,
.entry-control select {
  min-width: 0;
  min-height: 44px;
}

.entry-control--overtime > span,
.day-overtime {
  color: var(--red);
}

.entry-total {
  display: grid;
  min-height: 44px;
  align-content: center;
  padding: var(--space-1) var(--space-3);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface-soft);
  white-space: nowrap;
}

.entry-total span {
  color: var(--muted);
  font-size: var(--fs-caption);
}

.entry-total strong {
  font-size: var(--fs-body);
}

.entry-row > .danger,
.entry-row > .approval-hour-lock {
  min-height: 44px;
}

.calendar-day .day-metric {
  display: flex;
  min-width: 0;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--space-1);
  font-size: 11px;
  line-height: 1.25;
  white-space: normal;
}

.calendar-day .day-metric-label {
  min-width: 0;
}

.calendar-day .day-metric strong {
  flex: 0 0 auto;
  font-size: inherit;
}

/* Il pannello laterale è più stretto della pagina anche su desktop. */
.day-editor .entry-row {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.day-editor .entry-control--project {
  grid-column: 1 / -1;
}

.day-editor .entry-total {
  grid-column: 1;
}

.day-editor .entry-row > .danger,
.day-editor .entry-row > .approval-hour-lock {
  grid-column: 2;
}

.hours-work-suggestion {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  margin: var(--space-3) 0;
  padding: var(--space-3);
  border: 1px solid color-mix(in srgb, var(--blue) 34%, var(--line));
  border-radius: var(--radius-md);
  background: var(--selected);
  color: var(--text);
}

.hours-work-suggestion[hidden],
.entry-control[hidden] {
  display: none;
}

.hours-work-suggestion button {
  flex: 0 0 auto;
  min-height: 44px;
}

#monthGrid .hours-work-suggestion {
  min-width: 220px;
  align-items: flex-start;
  flex-direction: column;
}

.summary-detail-stat--overtime,
.summary-type-metric--overtime {
  color: var(--red);
}

.summary-detail-cost {
  white-space: nowrap;
}

.summary-detail-cost strong,
.summary-detail-cost small,
.summary-type-cost em,
.summary-detail-stat--cost em {
  display: block;
}

.summary-type-cost em,
.summary-detail-stat--cost em,
.summary-detail-cost small {
  color: var(--muted);
  font-size: var(--fs-caption);
  font-style: normal;
  font-weight: var(--fw-regular);
}

@media (max-width: 900px) {
  .project-editor-layout {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: auto minmax(0, 1fr) auto;
  }

  .project-editor-layout > .editor-section-tabs {
    grid-column: 1;
    grid-row: 1;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    padding: var(--space-3);
    border-right: 0;
    border-bottom: 1px solid var(--line);
    overflow: visible;
  }

  .project-editor-layout > .editor-section-tabs .editor-section-tab.atena-btn {
    min-height: 60px;
  }

  .project-editor-layout > .editor-section-tabs .editor-section-tab.atena-btn.active {
    box-shadow: inset 0 -3px 0 var(--blue);
  }

  .project-editor-layout > .editor-section-panel {
    grid-column: 1;
    grid-row: 2;
    padding: var(--space-4);
  }

  .project-editor-layout > .modal-form-actions {
    grid-column: 1;
    grid-row: 3;
    padding: var(--space-3) var(--space-4);
  }

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

  .entry-control--project {
    grid-column: 1 / -1;
  }
}

@media (max-width: 560px) {
  .project-modal.entity-modal {
    width: 100%;
    height: calc(100dvh - 16px);
    max-height: calc(100dvh - 16px);
  }

  .project-editor-layout > .editor-section-tabs {
    gap: var(--space-1);
    padding: var(--space-2);
  }

  .project-editor-layout > .editor-section-tabs .editor-section-tab.atena-btn {
    min-height: 52px;
  }

  .project-editor-layout > .editor-section-tabs .editor-section-copy small {
    display: none;
  }

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

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

  .entry-control--project,
  .entry-row > * {
    grid-column: 1;
  }

  .day-editor .entry-row > .danger,
  .day-editor .entry-row > .approval-hour-lock {
    grid-column: 1;
  }

  .hours-work-suggestion {
    align-items: stretch;
    flex-direction: column;
  }

  .summary-type-metric em {
    overflow: visible;
    text-overflow: clip;
    white-space: normal;
  }
}

@media (max-width: 720px) {
  .calendar-day .day-metric-label {
    font-size: 0;
  }

  .calendar-day .day-metric-label::after {
    content: attr(data-short);
    font-size: 10px;
  }

  .calendar-day .day-metric {
    font-size: 10px;
  }
}

@media (max-width: 1080px) {
  .approval-inline-scope {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .approval-inline-scope-result {
    grid-column: 1 / -1;
  }

  .approval-inline-scope-actions {
    grid-column: 1 / -1;
    justify-content: end;
  }
}

@media (max-width: 760px) {
  .approval-inline-scope {
    grid-template-columns: minmax(0, 1fr);
    padding: var(--space-5);
  }

  .approval-inline-scope-intro {
    align-items: stretch;
    flex-direction: column;
    gap: 2px;
  }

  .approval-inline-scope-intro,
  .approval-inline-scope-result,
  .approval-inline-scope-actions {
    grid-column: 1;
  }

  .approval-inline-scope-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .approval-inline-scope-actions button {
    width: 100%;
  }

  .approval-scope-lock {
    width: 100%;
    justify-content: space-between;
  }
}

@media (max-width: 460px) {
  .approval-inline-scope-actions {
    grid-template-columns: minmax(0, 1fr);
  }
}
