:root {
  --bg: #f4f6f3;
  --panel: #ffffff;
  --ink: #1f2933;
  --muted: #68737d;
  --line: #dbe3d8;
  --accent: #586f50;
  --accent-dark: #40543b;
  --danger: #a33a3a;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: Arial, sans-serif;
  line-height: 1.5;
}

a {
  color: var(--accent-dark);
}

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

.sidebar {
  padding: 24px;
  background: #202820;
  color: #fff;
}

.brand {
  display: inline-block;
  margin-bottom: 26px;
  color: #fff;
  font-size: 1.4rem;
  font-weight: 700;
  text-decoration: none;
}

.user-box {
  padding: 14px;
  border: 1px solid rgba(255,255,255,.14);
  border-radius: 14px;
  background: rgba(255,255,255,.08);
}

.user-box span {
  display: block;
  margin-top: 2px;
  color: rgba(255,255,255,.72);
  font-size: .9rem;
}

.nav {
  display: grid;
  gap: 8px;
  margin-top: 24px;
}

.nav a {
  padding: 11px 12px;
  border-radius: 10px;
  color: #fff;
  text-decoration: none;
}

.nav a:hover {
  background: rgba(255,255,255,.12);
}

.content {
  width: 100%;
  min-width: 0;
  padding: clamp(18px, 4vw, 42px);
}

.page-title {
  margin: 0 0 18px;
  font-size: clamp(1.7rem, 3vw, 2.4rem);
}

.admin-page-heading {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 22px;
}

.admin-page-heading .page-title {
  margin-bottom: 8px;
}

.admin-page-heading p {
  margin: 0;
}

.panel {
  margin-bottom: 22px;
  padding: clamp(16px, 3vw, 26px);
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--panel);
  box-shadow: 0 12px 35px rgba(31,41,51,.08);
}

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

.card-link {
  display: block;
  min-height: 130px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #fff;
  color: var(--ink);
  text-decoration: none;
}

.card-link span {
  display: block;
  margin-top: 8px;
  color: var(--muted);
}

.section-heading {
  display: flex;
  gap: 14px;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 16px;
}

.section-heading h2 {
  margin: 0 0 4px;
  font-size: 1.25rem;
}

.section-heading p {
  margin: 0;
}

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

.file-item {
  display: flex;
  gap: 14px;
  align-items: center;
  justify-content: space-between;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #f8faf7;
}

.file-item span {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: .92rem;
}

.empty-state {
  display: grid;
  gap: 4px;
  padding: 18px;
  border: 1px dashed #c9d5c5;
  border-radius: 14px;
  background: #fbfdf9;
  color: var(--muted);
}

.empty-state strong {
  color: var(--ink);
}

.profile-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin: 0;
}

.profile-grid div {
  min-width: 0;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #f8faf7;
}

.profile-grid dt {
  margin-bottom: 4px;
  color: var(--muted);
  font-size: .82rem;
  font-weight: 700;
  text-transform: uppercase;
}

.profile-grid dd {
  margin: 0;
  font-weight: 700;
  overflow-wrap: anywhere;
}

.profile-note {
  margin-top: 16px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #f8faf7;
}

.profile-note p {
  margin: 6px 0 0;
  color: var(--muted);
}

.badge-card {
  position: relative;
  display: grid;
  grid-template-columns: minmax(150px, 220px) minmax(0, 1fr) 70px;
  gap: clamp(18px, 4vw, 34px);
  width: min(760px, 100%);
  padding: clamp(22px, 4vw, 34px);
  border: 2px solid #15151b;
  border-radius: 18px;
  background: #c9c8ff;
  box-shadow: inset 0 0 0 12px rgba(255, 255, 255, .22), 0 16px 35px rgba(31, 41, 51, .12);
}

.badge-card::after {
  content: "";
  position: absolute;
  inset: 16px;
  border: 2px solid #15151b;
  pointer-events: none;
}

.badge-photo {
  display: grid;
  place-items: center;
  aspect-ratio: 3 / 4;
  border: 1px solid #333;
  background: linear-gradient(135deg, #eef1ea, #d2d8cb);
  color: #4d5748;
  font-weight: 700;
  text-align: center;
  z-index: 1;
}

.badge-photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.badge-data {
  z-index: 1;
  align-self: center;
  color: #07070b;
}

.badge-data p {
  margin: 0 0 8px;
  font-size: clamp(1.08rem, 2.5vw, 1.55rem);
  line-height: 1.1;
}

.badge-data span {
  font-weight: 400;
}

.badge-data strong {
  font-weight: 800;
}

.badge-qualification {
  padding-top: 20px;
}

.badge-mark {
  z-index: 1;
  align-self: start;
  justify-self: end;
  width: 56px;
  height: 56px;
  object-fit: contain;
}

.upload-card {
  display: grid;
  grid-template-columns: minmax(240px, 1fr) auto;
  gap: 12px;
  align-items: end;
  margin-bottom: 18px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #f8faf7;
}

.upload-card p {
  grid-column: 1 / -1;
  margin: -4px 0 0;
}

.print-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  margin-top: 18px;
}

.database-search-form {
  grid-template-columns: minmax(220px, 1fr) minmax(180px, 260px) auto;
}

.code-filter-form {
  grid-template-columns: minmax(220px, 1fr) minmax(140px, 190px) minmax(220px, 280px) auto;
}

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

.employee-row {
  display: grid;
  grid-template-columns: minmax(180px, 1.2fr) minmax(180px, 1fr) auto;
  gap: 14px;
  align-items: center;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #f8faf7;
}

.employee-main,
.employee-meta {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.employee-main strong {
  font-size: 1.05rem;
}

.employee-main span,
.employee-meta span {
  color: var(--muted);
  overflow-wrap: anywhere;
}

.employee-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

.employee-actions .button {
  min-height: 36px;
  padding: 0 12px;
}

.pagination {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 18px;
}

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

.detail-grid {
  display: grid;
  gap: 18px;
}

.detail-section {
  padding: 0;
  overflow: hidden;
}

.detail-section summary {
  padding: 18px 22px;
  border-bottom: 1px solid var(--line);
  background: #eef3eb;
  list-style-position: inside;
}

.detail-section > :not(summary) {
  margin: 18px 22px 22px;
}

.full-field,
.form-actions {
  grid-column: 1 / -1;
}

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

.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  justify-content: space-between;
}

.table-wrap {
  width: 100%;
  max-width: calc(100vw - 360px);
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  padding-bottom: 8px;
}

.table-scroll-top {
  width: 100%;
  max-width: calc(100vw - 360px);
  height: 18px;
  margin-bottom: 8px;
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
}

.table-scroll-top > div {
  height: 1px;
}

table {
  width: 100%;
  min-width: 1180px;
  border-collapse: collapse;
  table-layout: auto;
}

.data-table-codici {
  min-width: 1380px;
}

.data-table-codici td:nth-child(6),
.data-table-codici th:nth-child(6) {
  min-width: 150px;
  white-space: normal;
}

.data-table-codici td:nth-child(7),
.data-table-codici th:nth-child(7) {
  min-width: 240px;
  white-space: normal;
}

.block-text {
  display: block;
  margin-top: 4px;
  font-size: .78rem;
  line-height: 1.35;
  white-space: normal;
}

.status-badge {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 3px 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #f5f7f4;
  color: var(--text);
  font-size: .78rem;
  font-weight: 800;
  line-height: 1;
  white-space: nowrap;
}

.status-badge.is-progress {
  border-color: #b8d1ec;
  background: #e9f3ff;
  color: #24527a;
}

.status-badge.is-done {
  border-color: #bfd7b8;
  background: #edf7ea;
  color: #315f2c;
}

.status-badge.is-warning {
  border-color: #f1d39a;
  background: #fff4d8;
  color: #79530d;
}

.status-badge.is-muted {
  color: var(--muted);
}

.leave-status {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: .78rem;
  font-weight: 800;
  line-height: 1;
  white-space: nowrap;
}

.leave-status.is-approved {
  background: #e7f3df;
  color: #315f2c;
}

.leave-status.is-pending {
  background: #fff4d8;
  color: #79530d;
}

.leave-status.is-rejected,
.leave-status.is-cancelled {
  background: #f6e3e3;
  color: #873030;
}

.leave-decision-form {
  min-width: 260px;
  gap: 8px;
}

.leave-decision-form input {
  min-height: 36px;
  padding: 8px 10px;
  font-size: .86rem;
}

.leave-admin-table,
.leave-my-table {
  min-width: 980px;
}

.leave-calendar-wrap {
  max-width: 100%;
}

.leave-calendar-table {
  min-width: 980px;
  table-layout: fixed;
}

.leave-calendar-table th,
.leave-calendar-table td {
  padding: 5px 4px;
  text-align: center;
  vertical-align: middle;
}

.leave-calendar-table th:first-child {
  position: sticky;
  left: 0;
  z-index: 2;
  min-width: 170px;
  width: 170px;
  text-align: left;
}

.leave-calendar-table tbody th:first-child {
  background: #eef3eb;
  font-size: .78rem;
  line-height: 1.15;
  text-transform: none;
}

.leave-day-cell {
  height: 34px;
  min-width: 30px;
  border: 1px solid #d8e2d4;
  color: transparent;
  font-size: .78rem;
  font-weight: 900;
}

.leave-day-cell.is-approvata {
  color: #203026;
}

.leave-day-cell.is-in_attesa {
  color: #79530d;
  background: repeating-linear-gradient(45deg, #fff7df, #fff7df 5px, #f4e4b7 5px, #f4e4b7 10px);
}

.leave-day-cell.is-ferie.is-approvata {
  background: #cfe9bf;
}

.leave-day-cell.is-permesso.is-approvata {
  background: #bee3f8;
}

.leave-day-cell.is-altro.is-approvata {
  background: #e8d8f0;
}

.leave-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 16px;
  align-items: center;
  margin: 16px 0 12px;
  color: var(--muted);
  font-size: .9rem;
}

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

.leave-dot {
  display: inline-block;
  width: 14px;
  height: 14px;
  border: 1px solid #b7c4b3;
  border-radius: 4px;
}

.leave-ferie {
  background: #cfe9bf;
}

.leave-permesso {
  background: #bee3f8;
}

.leave-pending {
  background: repeating-linear-gradient(45deg, #fff7df, #fff7df 4px, #f4e4b7 4px, #f4e4b7 8px);
}

.leave-critical-table {
  min-width: 760px;
}

.leave-critical-table tr.is-critical td {
  background: #fff0f0;
  color: #7d2626;
  font-weight: 800;
}

.inline-status-form {
  margin-top: 6px;
}

.mini-button {
  min-height: 28px;
  padding: 0 8px;
  font-size: .76rem;
}

.data-table-personale {
  min-width: 1500px;
}

.data-table-account {
  min-width: 1460px;
}

th,
td {
  padding: 12px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
  overflow-wrap: anywhere;
}

th:nth-last-child(-n+3),
td:nth-last-child(-n+3) {
  white-space: nowrap;
}

th:last-child,
td:last-child {
  min-width: 150px;
  width: 150px;
}

td:last-child {
  overflow: visible;
}

.is-hidden {
  display: none !important;
}

[hidden] {
  display: none !important;
}

body:not(.edit-mode) .edit-only {
  display: none !important;
}

.edit-mode-banner {
  display: none;
  margin-bottom: 14px;
  padding: 10px 12px;
  border-radius: 12px;
  background: #fff7e0;
  color: #6f4e00;
}

body.edit-mode .edit-mode-banner {
  display: block;
}

.inline-edit-row {
  background: #f8faf7;
}

.inline-edit-row td {
  background: #f8faf7;
  vertical-align: middle;
}

.inline-edit-row input,
.inline-edit-row select,
.inline-edit-row textarea {
  min-width: 150px;
  max-width: 260px;
}

.inline-edit-row input[type="password"] {
  min-width: 180px;
}

.inline-edit-row select[name="personal_record_id"] {
  min-width: 320px;
  max-width: 420px;
}

.inline-edit-row select[name="role"] {
  min-width: 160px;
}

.inline-edit-row textarea {
  min-height: 42px;
  resize: vertical;
}

.timesheet-cantiere-list {
  display: grid;
  gap: 10px;
}

.timesheet-header-panel {
  background: #fdfefb;
}

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

.timesheet-meta-grid div {
  min-width: 0;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #f8faf7;
}

.timesheet-meta-grid span {
  display: block;
  margin-bottom: 4px;
  color: var(--muted);
  font-size: .78rem;
  font-weight: 700;
  text-transform: uppercase;
}

.timesheet-meta-grid strong {
  overflow-wrap: anywhere;
}

.timesheet-settings-form {
  margin-top: 16px;
}

.timesheet-responsabili-field {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px 14px;
  margin: 0;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
}

.timesheet-responsabili-field legend {
  padding: 0 8px;
  font-weight: 700;
}

.assigned-worker-list {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 16px;
}

.assigned-worker-pill {
  display: flex;
  gap: 8px;
  align-items: center;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #f8faf7;
}

.assigned-worker-pill button {
  min-height: 30px;
  padding: 0 10px;
}

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

.timesheet-panel .empty-state,
.timesheet-panel .form-actions {
  margin: 18px;
}

.timesheet-table-wrap {
  max-width: 100%;
  padding-bottom: 0;
}

.timesheet-table {
  min-width: 860px;
  font-size: .78rem;
  table-layout: fixed;
}

.timesheet-table th,
.timesheet-table td {
  min-width: 62px;
  width: auto;
  padding: 4px;
  border: 1px solid #cbd7c8;
  text-align: center;
  vertical-align: middle;
  overflow: visible;
}

.timesheet-table thead th,
.timesheet-table tfoot th {
  background: #dfe8dc;
  font-weight: 800;
  text-transform: uppercase;
}

.timesheet-worker-name {
  display: block;
  max-width: 104px;
  margin: 0 auto;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: .5rem;
  line-height: 1.05;
  letter-spacing: 0;
}

.timesheet-table tbody th {
  position: sticky;
  left: 0;
  z-index: 1;
  width: 46px;
  min-width: 46px;
  background: #eef3eb;
}

.timesheet-row-total,
.timesheet-table tfoot th:last-child {
  background: #f6f3dd;
  font-weight: 800;
}

.timesheet-cell {
  position: relative;
  display: grid;
  grid-template-columns: minmax(38px, 1fr) 16px;
  gap: 2px;
  align-items: center;
}

.timesheet-cell input[type="number"] {
  width: 100%;
  min-width: 0;
  min-height: 28px;
  padding: 4px 2px;
  font-size: .82rem;
  text-align: center;
}

.timesheet-cell.category-post_scavo input[type="number"],
.print-timesheet-table td.category-post_scavo {
  background: #fff1cf;
  color: #76510a;
  font-weight: 800;
}

.timesheet-cell.category-disegno_elaborazione input[type="number"],
.print-timesheet-table td.category-disegno_elaborazione {
  background: #dff1ff;
  color: #15567a;
  font-weight: 800;
}

.timesheet-cell-options {
  min-height: 20px;
  width: 16px;
  padding: 0;
  border: 1px solid #b7c4b3;
  border-radius: 50%;
  background: #eef3eb;
  color: #40543b;
  font-size: .68rem;
  font-weight: 800;
  line-height: 1;
}

.timesheet-cell-options:hover {
  background: #dfe8dc;
}

.timesheet-cell-popover {
  position: absolute;
  top: calc(100% + 4px);
  right: 0;
  z-index: 10;
  display: grid;
  gap: 8px;
  width: 230px;
  padding: 9px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  box-shadow: 0 12px 30px rgba(31,41,51,.16);
  text-align: left;
}

.timesheet-cell-popover label {
  display: grid;
  gap: 4px;
  font-size: .78rem;
  font-weight: 700;
}

.timesheet-cell-popover textarea,
.timesheet-cell-popover select {
  width: 100%;
  font-size: .82rem;
}

.timesheet-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 16px;
  align-items: center;
  padding: 12px 18px 0;
  color: var(--muted);
  font-size: .86rem;
}

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

.legend-swatch {
  display: inline-block;
  width: 14px;
  height: 14px;
  border: 1px solid #b7c4b3;
  border-radius: 4px;
}

.legend-swatch.category-scavo_assistenza {
  background: #fff;
}

.legend-swatch.category-post_scavo {
  background: #fff1cf;
}

.legend-swatch.category-disegno_elaborazione {
  background: #dff1ff;
}

.sticky-actions {
  position: sticky;
  right: 0;
  bottom: 0;
  justify-content: flex-end;
  padding: 14px 18px;
  border-top: 1px solid var(--line);
  background: rgba(255,255,255,.95);
}

.print-page {
  background: #fff;
}

.print-sheet {
  width: min(1180px, 100%);
  margin: 0 auto;
  padding: 22px;
}

.timesheet-print-header {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin-bottom: 14px;
  border: 2px solid #111;
}

.timesheet-print-header div {
  min-height: 58px;
  padding: 8px;
  border: 1px solid #111;
}

.timesheet-print-header span {
  display: block;
  font-size: .72rem;
  font-weight: 800;
  text-transform: uppercase;
}

.print-timesheet-table,
.print-summary-table {
  min-width: 0;
  font-size: .8rem;
}

.print-timesheet-table .timesheet-worker-name {
  max-width: 48px;
  font-size: .42rem;
  line-height: 1;
  white-space: normal;
  overflow-wrap: anywhere;
  text-overflow: clip;
}

.print-timesheet-table thead th,
.print-timesheet-table tbody th,
.print-timesheet-table tfoot th,
.print-timesheet-table td:last-child {
  font-size: .58rem;
  line-height: 1;
}

.print-timesheet-table tfoot th {
  padding: 3px 2px;
}

.timesheet-log-table {
  min-width: 980px;
}

.print-timesheet-table th,
.print-timesheet-table td,
.print-summary-table th,
.print-summary-table td {
  border: 1px solid #111;
}

@media print {
  body {
    background: #fff;
  }

  .print-actions,
  .sidebar,
  .nav,
  .user-box {
    display: none !important;
  }

  .print-sheet {
    width: 100%;
    padding: 0;
  }

  .timesheet-print-header {
    break-inside: avoid;
  }

  .timesheet-table th,
  .timesheet-table td {
    padding: 4px;
  }

  .print-timesheet-table .timesheet-worker-name {
    max-width: 42px;
    font-size: .38rem;
  }

  .print-timesheet-table thead th,
  .print-timesheet-table tbody th,
  .print-timesheet-table tfoot th,
  .print-timesheet-table td:last-child {
    font-size: .5rem;
  }
}

.inline-edit-row .is-dirty {
  border-color: var(--accent) !important;
  background: #f1f7ee;
  box-shadow: inset 0 0 0 1px rgba(88, 111, 80, .22);
}

.row-actions {
  display: flex;
  flex-wrap: nowrap;
  gap: 8px;
  align-items: center;
  min-width: 132px;
  white-space: normal;
}

.row-actions .button,
.row-actions button {
  min-height: 34px;
  padding: 0 10px;
  font-size: .88rem;
}

.icon-button {
  width: 34px;
  min-width: 34px;
  height: 34px;
  padding: 0 !important;
  border-radius: 50%;
  font-size: 1rem !important;
  line-height: 1;
}

.status-dot {
  display: inline-flex;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  vertical-align: middle;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .08);
}

.status-dot.is-on {
  background: #2f8f46;
}

.status-dot.is-off {
  background: #c74343;
}

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

th {
  background: #eef3eb;
  font-size: .86rem;
  text-transform: uppercase;
}

.sort-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  margin-left: 6px;
  border-radius: 50%;
  background: #dfe8db;
  color: var(--accent-dark);
  font-size: .8rem;
  line-height: 1;
  text-decoration: none;
}

.sort-link:hover,
.sort-link.is-active {
  background: var(--accent);
  color: #fff;
}

form {
  display: grid;
  gap: 14px;
}

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

label {
  display: grid;
  gap: 6px;
  font-weight: 700;
}

.checkbox-label {
  display: flex;
  gap: 8px;
  align-items: center;
}

.checkbox-label input {
  width: auto;
}

input,
select,
textarea {
  width: 100%;
  padding: 11px 12px;
  border: 1px solid #cfd8cc;
  border-radius: 10px;
  background: #fff;
  color: var(--ink);
  font: inherit;
}

.button,
button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: 0 16px;
  border: 0;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
}

.button.secondary {
  background: #e8eee5;
  color: var(--accent-dark);
}

.button.danger,
button.danger {
  background: var(--danger);
}

.notice {
  margin-bottom: 18px;
  padding: 12px 14px;
  border-radius: 12px;
  background: #e8f0e5;
  color: var(--accent-dark);
}

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

details {
  min-width: 240px;
}

summary {
  cursor: pointer;
  font-weight: 700;
  color: var(--accent-dark);
}

.inline-edit-form {
  width: min(520px, 82vw);
  margin-top: 12px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #f8faf7;
}

.inline-edit-form label {
  font-size: .9rem;
}

.inline-edit-form input {
  min-width: 0;
}

.inline-edit-form button {
  justify-self: start;
}

.table-wrap details[open] {
  white-space: normal;
}

.search-form {
  grid-template-columns: minmax(220px, 1fr) auto;
  align-items: end;
}

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

.inline-action-form {
  display: inline-flex;
  gap: 0;
}

.login-page {
  display: grid;
  place-items: center;
  min-height: 100vh;
  padding: 22px;
}

.login-card {
  width: min(430px, 100%);
}

.news-editor textarea {
  width: 100%;
  min-height: 220px;
  resize: vertical;
}

.checkbox-line {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
}

.checkbox-line input {
  width: auto;
}

.current-news-image {
  display: flex;
  align-items: center;
  gap: 14px;
  color: var(--muted);
}

.current-news-image img {
  width: 160px;
  height: 96px;
  object-fit: cover;
  border: 1px solid var(--line);
  border-radius: 10px;
}

.news-links-editor {
  display: grid;
  gap: 10px;
}

.news-links-editor h3 {
  margin: 4px 0 0;
}

.link-row {
  display: grid;
  grid-template-columns: minmax(160px, .5fr) minmax(240px, 1fr);
  gap: 10px;
}

.news-admin-list {
  display: grid;
  gap: 12px;
}

.news-admin-item {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fbfcfa;
}

.news-admin-item h3 {
  margin: 0 0 4px;
}

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

  .sidebar {
    position: static;
  }

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

  .grid,
  .form-grid,
  .profile-grid {
    grid-template-columns: 1fr;
  }

  .table-wrap {
    max-width: calc(100vw - 36px);
  }

  .table-scroll-top {
    max-width: calc(100vw - 36px);
  }

  .search-form,
  .database-search-form,
  .code-filter-form {
    grid-template-columns: 1fr;
  }

  .employee-row {
    grid-template-columns: 1fr;
    align-items: stretch;
  }

  .employee-actions {
    justify-content: flex-start;
  }

  .file-item {
    align-items: stretch;
    flex-direction: column;
  }

  .badge-card {
    grid-template-columns: 1fr;
  }

  .upload-card {
    grid-template-columns: 1fr;
  }

  .badge-card::after {
    inset: 10px;
  }

  .badge-photo {
    width: min(180px, 100%);
  }

  .badge-mark {
    position: absolute;
    right: 24px;
    top: 24px;
  }

  .link-row,
  .news-admin-item {
    grid-template-columns: 1fr;
  }

  .news-admin-item {
    display: grid;
  }
}
