
:root {
  --dark-1: #3b3d40;
  --dark-2: #242628;
  --dark-3: #2d2f33;
  --dark-4: #44474b;
  --accent: #f0a100;
  --green: #61b146;
  --red: #d34c4a;
  --blue: #6fa4d4;
  --panel-bg: #f5f5f5;
  --body-bg: #e7e7e7;
  --line: #cfcfcf;
  --line-soft: #e5e5e5;
  --title: #2c4668;
  --text: #343434;
  --muted: #767676;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body { font-family: Arial, Helvetica, sans-serif; color: var(--text); background: var(--body-bg); }
a { text-decoration: none; color: inherit; }

.app-header {
  background: linear-gradient(#3d3f42, #252729);
  box-shadow: inset 0 -1px 0 rgba(255,255,255,.05), inset 0 1px 0 rgba(255,255,255,.05);
  position: sticky;
  top: 0;
  z-index: 30;
}
.header-top {
  display: grid;
  grid-template-columns: 280px 1fr 220px;
  align-items: center;
  gap: 18px;
  padding: 12px 18px 8px;
  color: #ddd;
}
.logo-wrap, .login-brand-row { display: flex; align-items: center; gap: 12px; }
.logo-mark {
  width: 38px; height: 38px;
  background: linear-gradient(#6c9dcf, #4a77a6);
  color: #fff; display: inline-flex; align-items: center; justify-content: center;
  font-weight: 700;
  border-radius: 8px;
}
.logo-text strong { display: block; color: #fff; font-size: 20px; line-height: 1; }
.logo-text span { display: block; margin-top: 3px; color: #c7c7c7; font-size: 12px; }
.header-search-wrap { display: flex; justify-content: center; }
.header-search {
  width: min(100%, 800px); height: 38px; border-radius: 22px; border: 1px solid #151618;
  background: linear-gradient(#2c2d30, #1d1e20); color: #d9d9d9; padding: 0 16px;
  box-shadow: inset 0 1px 2px rgba(0,0,0,.45), 0 1px 0 rgba(255,255,255,.05);
}
.header-search::placeholder { color: #909090; }
.header-user { justify-self: end; display: flex; align-items: center; gap: 10px; }
.user-mail { color: #ededed; font-size: 14px; font-weight: 700; }
.header-link { color: #ffffff; font-weight: 700; }

.module-bar {
  display: grid;
  grid-template-columns: repeat(11, minmax(0, 1fr));
  border-top: 1px solid rgba(255,255,255,.06);
  border-bottom: 1px solid #111;
}
.module-tile {
  min-height: 88px;
  border-right: 1px solid rgba(255,255,255,.06);
  border-left: 1px solid rgba(0,0,0,.2);
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 8px;
  color: #d0d0d0;
  background: linear-gradient(#393b3f, #2a2c2f);
}
.module-tile:hover { color: #fff; background: linear-gradient(#43464a, #33353a); }
.module-tile.active {
  color: #f1b31f;
  background: linear-gradient(#3a3c40, #2c2e31);
  box-shadow: inset 0 -3px 0 #f1b31f;
}
.module-icon { font-size: 21px; line-height: 1; }
.module-label { font-size: 13px; text-align: center; }

.page-shell { max-width: none; margin: 0; padding: 16px 10px 22px; }
.page-shell.repairs-shell { max-width: none; }
.page-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; margin-bottom: 14px; }
h1 { margin: 0 0 4px; font-size: 24px; color: #22364e; }
.subtitle { margin: 0; color: #66788c; font-size: 14px; }
.top-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.status-chip {
  display: inline-flex; align-items: center; min-height: 30px; padding: 0 10px;
  font-size: 12px; font-weight: 700; border: 1px solid rgba(0,0,0,.08); background: #f1f1f1;
}
.status-chip.success { background: #76bf5e; color: #fff; }
.status-chip.warning { background: #4d5767; color: #fff; }

.cards-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 0;
  margin: 0 0 14px;
  border: 1px solid var(--line);
  overflow: hidden;
}
.metric-card {
  background: linear-gradient(#f8f8f8, #eeeeee);
  border-right: 1px solid #dadada;
  padding: 16px 14px;
  min-height: 84px;
}
.metric-card:last-child { border-right: 0; }
.metric-card span { display: block; font-size: 12px; text-transform: uppercase; color: #68798c; margin-bottom: 9px; }
.metric-card strong { font-size: 29px; color: #2a2a2a; }

.panel-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.panel {
  background: linear-gradient(#f9f9f9, #f1f1f1);
  border: 1px solid var(--line);
  margin-bottom: 16px;
  overflow: hidden;
}
.panel.narrow { max-width: 820px; }
.panel-title {
  min-height: 42px; display: flex; align-items: center; padding: 0 14px;
  font-size: 16px; color: var(--title); font-weight: 700;
  border-bottom: 1px solid #dcdcdc;
  background: linear-gradient(#fafafa, #ececec);
}
.panel > form,
.panel > .paragraph,
.panel > table,
.panel > .form-grid,
.panel > .cards-grid,
.panel > .panel-inner { padding: 12px 14px 14px; }

.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.form-grid.three { grid-template-columns: repeat(3, minmax(0,1fr)); }
.form-grid.single { grid-template-columns: 1fr; }
label { display: block; margin: 0 0 6px; color: #66788c; font-size: 13px; }
input, select, textarea {
  width: 100%; min-height: 37px; border: 1px solid #cbcbcb; background: #fff; color: #333;
  padding: 8px 10px; box-shadow: inset 0 1px 1px rgba(0,0,0,.03);
  border-radius: 0;
}
textarea { min-height: 90px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: none; border-color: #8db3d6; }

.btn {
  min-height: 37px; padding: 0 14px; border: 1px solid transparent;
  cursor: pointer; font-weight: 700; display: inline-flex; align-items: center; justify-content: center;
  border-radius: 0;
}
.btn-primary { background: linear-gradient(#79c661, #5ca846); color: #fff; border-color: #4f933d; }
.btn-danger { background: linear-gradient(#df6d6b, #cf4f4d); color: #fff; border-color: #b24442; }
.btn-outline { background: linear-gradient(#ffffff, #ececec); color: #444; border-color: #cccccc; }
.btn.full { width: 100%; }

.flash-wrap { margin-bottom: 15px; }
.flash { padding: 12px 14px; border: 1px solid #d4d4d4; margin-bottom: 10px; background: linear-gradient(#fcfcfc, #f2f2f2); }
.flash.success { background: #edf9e8; border-color: #bbe0b0; color: #3d7d2f; }
.flash.danger { background: #fff2f2; border-color: #e8c0c0; color: #b34747; }

table { width: 100%; border-collapse: collapse; min-width: 780px; background: #fff; }
th {
  background: linear-gradient(#fbfbfb, #efefef); color: #7ba5d3; font-size: 12px; text-transform: uppercase;
  border-bottom: 1px solid #dcdcdc; border-right: 1px solid #e7e7e7; padding: 12px 10px; text-align: left;
}
td { padding: 11px 10px; border-bottom: 1px solid #ececec; border-right: 1px solid #f1f1f1; color: #555; }
tr:hover td { background: #fafafa; }

td form { margin: 0; }
.paragraph { color: #5f5f5f; line-height: 1.65; }
.footer { text-align: center; padding: 0 0 24px; color: #7b7b7b; }

.login-body { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px; }
.rs-login-bg { background: radial-gradient(circle at top, #59616e, #262b31 58%, #1b1f24 100%); }
.login-card { width: 460px; padding: 26px; border: 1px solid rgba(255,255,255,.1); }
.rs-login-card { background: linear-gradient(#33363b, #23262b); box-shadow: 0 18px 50px rgba(0,0,0,.35), inset 0 1px 0 rgba(255,255,255,.08); }
.login-card h1 { color: #fff; margin: 16px 0 8px; }
.login-subtitle { color: #bcc3cb; margin: 0 0 18px; }
.login-card label { color: #d6dbe0; }
.login-card input { background: linear-gradient(#fafafa, #f0f0f0); border-color: #b9bec4; }
.hint { color: #cfd4da; margin-top: 12px; font-size: 13px; }

@media (max-width: 1250px) {
  .module-bar { grid-template-columns: repeat(6, minmax(0, 1fr)); }
  .cards-grid { grid-template-columns: repeat(3, minmax(0,1fr)); }
}
@media (max-width: 900px) {
  .header-top { grid-template-columns: 1fr; }
  .header-user { justify-self: start; }
  .panel-grid { grid-template-columns: 1fr; }
  .form-grid, .form-grid.three { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 700px) {
  .module-bar { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .cards-grid { grid-template-columns: 1fr; }
  .form-grid, .form-grid.three { grid-template-columns: 1fr; }
  .page-top { flex-direction: column; align-items: flex-start; }
}


.customer-name { color: #0c47a1; font-weight: 700; }
.muted { color: #66788c; }

.repair-kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin: 0 0 14px;
}
.repair-kpi-card {
  min-height: 108px;
  padding: 16px 18px;
  color: #fff;
  display: flex;
  flex-direction: column;
  justify-content: center;
}
.repair-kpi-card .label { font-size: 12px; text-transform: uppercase; font-weight: 700; margin-bottom: 8px; }
.repair-kpi-card .value { font-size: 24px; font-weight: 700; line-height: 1; margin-bottom: 10px; }
.repair-kpi-card .note { font-size: 13px; opacity: .95; }
.repair-kpi-card.sky { background: #5d95ca; }
.repair-kpi-card.green { background: #61b94a; }
.repair-kpi-card.orange { background: #e5a10a; }
.repair-kpi-card.slate { background: #55617d; }

.repairs-filter-panel .panel-inner { padding-bottom: 12px; }
.repairs-filter-grid {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr auto;
  gap: 12px;
  align-items: end;
}
.repairs-filter-grid .actions {
  display: flex;
  gap: 10px;
  align-items: end;
}
.repairs-filter-grid .actions .btn { min-width: 128px; }

.repairs-board-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}
.board-col { border: 1px solid var(--line); background: linear-gradient(#f9f9f9, #f1f1f1); }
.board-col-header {
  min-height: 44px;
  padding: 0 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid #dcdcdc;
}
.board-col-header h3 { margin: 0; font-size: 14px; text-transform: uppercase; letter-spacing: .02em; color: #1f3550; }
.board-col-header .count { font-weight: 700; color: #1f3550; }
.status-accettata .board-col-header { background: #e8eff8; }
.status-in-diagnosi .board-col-header { background: #d7e6fb; }
.status-in-attesa-ricambio .board-col-header { background: #f7e7bf; }
.status-pronta .board-col-header { background: #d8ead2; }
.board-body { padding: 12px; display: grid; gap: 12px; }
.ticket-card { background: #fff; border: 1px solid #dfdfdf; padding: 12px; }
.ticket-top { display:flex; align-items:center; justify-content:space-between; gap:8px; margin-bottom: 8px; }
.ticket-card .title { font-weight: 700; color: #203957; }
.ticket-card .meta { color: #697a8d; margin: 4px 0 12px; font-size: 13px; }
.ticket-actions { display:flex; gap:8px; flex-wrap:wrap; }
.ticket-actions form { margin: 0; }
.ticket-actions .btn { min-height: 34px; }
.badge {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 0 8px;
  font-size: 11px;
  font-weight: 700;
  border: 1px solid #d5d5d5;
  background: #f0f0f0;
  color: #444;
}
.badge.warn { background: #f8e6b8; border-color: #ebd391; color: #8a6512; }
.badge.danger { background: #f3c9c9; border-color: #e2a5a5; color: #9b3131; }
.empty-state { padding: 16px; background: #fff; border: 1px dashed #d5d5d5; color: #7a7a7a; }

@media (max-width: 1250px) {
  .repair-kpi-grid, .repairs-board-grid { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .repairs-filter-grid { grid-template-columns: 1fr 1fr 1fr 1fr; }
  .repairs-filter-grid .search { grid-column: span 2; }
  .repairs-filter-grid .actions { grid-column: span 2; }
}
@media (max-width: 700px) {
  .repair-kpi-grid, .repairs-board-grid, .repairs-filter-grid { grid-template-columns: 1fr; }
  .repairs-filter-grid .search, .repairs-filter-grid .actions { grid-column: auto; }
}


.board-col-header > * { position: relative; z-index: 1; }
.board-col-header::before { display: none; }
.board-body { padding: 12px; }
.ticket-card { background: #fff; border: 1px solid #d7d7d7; margin-bottom: 12px; padding: 12px; }
.ticket-actions-stack { display: grid; grid-template-columns: 82px 1fr; gap: 10px; align-items: start; margin-top: 12px; }
.quick-status-form { display: grid; grid-template-columns: 1fr auto; gap: 8px; }
.quick-status-select { min-height: 34px; font-size: 13px; }
.quick-status-form .btn { min-height: 34px; padding: 0 10px; }
.repair-form-page .panel { margin-bottom: 14px; }
.repair-form-grid { display: grid; gap: 12px; }
.repair-form-grid.two { grid-template-columns: repeat(2, minmax(0,1fr)); }
.repair-form-grid.four { grid-template-columns: repeat(4, minmax(0,1fr)); }
.repair-form-grid.five { grid-template-columns: repeat(5, minmax(0,1fr)); }
.repair-form-grid .span-2 { grid-column: span 2; }
.repair-form-grid .full { grid-column: 1 / -1; }
.repair-form-split { align-items: start; }
.repair-form-footer { display: flex; gap: 10px; justify-content: flex-start; margin-top: 14px; }
@media (max-width: 1100px) {
  .repair-form-grid.four, .repair-form-grid.five { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .repair-form-grid .span-2 { grid-column: span 1; }
  .ticket-actions-stack { grid-template-columns: 1fr; }
  .quick-status-form { grid-template-columns: 1fr; }
}
@media (max-width: 700px) {
  .repair-form-grid.two, .repair-form-grid.four, .repair-form-grid.five { grid-template-columns: 1fr; }
}


label { color: #4b5f78; font-weight: 700; }
.repair-modal-overlay { position: fixed; inset: 0; background: rgba(24,28,35,.45); display: none; align-items: center; justify-content: center; z-index: 9999; }
.repair-modal-overlay.open { display: flex; }
.repair-modal-window { width: min(940px, 94vw); max-height: 88vh; overflow: auto; background: #f6f6f6; border: 1px solid #bfc6cf; box-shadow: 0 12px 30px rgba(0,0,0,.25); }
.repair-modal-window.large { width: min(1080px, 95vw); }
.repair-modal-window.xl { width: min(1180px, 96vw); }
.repair-modal-head, .repair-modal-foot { display:flex; justify-content:space-between; align-items:center; padding:12px 14px; background: linear-gradient(#fafafa,#ececec); border-bottom:1px solid #d8d8d8; }
.repair-modal-foot { border-top:1px solid #d8d8d8; border-bottom:0; justify-content:flex-end; }
.repair-modal-head h3 { margin:0; font-size:20px; color:#243c5b; }
.modal-close { border:1px solid #c9c9c9; background:#fff; width:34px; height:34px; cursor:pointer; }
.repair-modal-body { padding:14px; }
.parts-modal-grid { display:grid; grid-template-columns: 1fr 1fr; gap:14px; align-items:start; }
.selected-parts-list { border:1px solid #d8d8d8; background:#fff; min-height:56px; padding:8px 10px; }
.selected-parts-list.empty { color:#6f7a86; display:flex; align-items:center; }
.part-row { display:flex; justify-content:space-between; gap:10px; align-items:center; padding:8px 0; border-bottom:1px solid #ececec; }
.part-row:last-child { border-bottom:0; }
.btn-small { min-height:30px; padding:0 10px; }
.inline-help-row { margin-top:8px; }
.inline-preview { margin-top:8px; color:#0a3fc7; font-weight:700; }
.money-field { position:relative; }
.money-field .currency-euro { position:absolute; left:10px; bottom:11px; color:#47596d; font-weight:700; }
.money-field input { padding-left:28px; }
.readonly-total input { background:#f7fafc; font-weight:700; color:#22364e; }
@media (max-width: 900px){ .parts-modal-grid { grid-template-columns:1fr; } }
