/* Tecnoside Time — interfaccia "soft glass": pannelli traslucidi, angoli morbidi, sidebar a icone. */

:root {
  --ink: #1f2537;
  --ink-2: #4a5265;
  --muted: #7d8697;
  --faint: #aab3c2;
  --navy: #1d2140;
  --glass: rgba(255, 255, 255, 0.42);
  --glass-border: rgba(255, 255, 255, 0.72);
  --white: rgba(255, 255, 255, 0.8);
  --line: rgba(31, 37, 55, 0.08);
  --good: #1f9d66;
  --warn: #d9822b;
  --bad: #d64545;
  --info: #3b6fd6;
  --shadow: 0 12px 34px rgba(31, 37, 55, 0.08);
  --shadow-sm: 0 4px 14px rgba(31, 37, 55, 0.06);
  --r-xl: 26px;
  --r-lg: 18px;
  --r-md: 14px;
  --r-sm: 10px;
  color-scheme: light;
}

* {
  box-sizing: border-box;
}

html,
body,
#root {
  height: 100%;
  margin: 0;
}

body {
  font-family: 'Segoe UI Variable Text', 'Segoe UI', Inter, system-ui, -apple-system, sans-serif;
  font-size: 14px;
  color: var(--ink);
  background:
    radial-gradient(900px 600px at -10% -10%, rgba(255, 255, 255, 0.95), transparent 60%),
    radial-gradient(800px 600px at 110% 110%, rgba(190, 203, 218, 0.9), transparent 60%),
    linear-gradient(160deg, #eaeff5 0%, #dde4ec 55%, #e3e9f0 100%);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}

button {
  font: inherit;
}

::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
::-webkit-scrollbar-thumb {
  background: rgba(31, 37, 55, 0.14);
  border-radius: 8px;
}
::-webkit-scrollbar-track {
  background: transparent;
}

/* ---------- Layout ---------- */

.shell {
  display: grid;
  grid-template-columns: 76px minmax(0, 1fr);
  gap: 18px;
  height: 100%;
  padding: 12px 16px 16px 16px;
}

.sidebar {
  background: rgba(255, 255, 255, 0.5);
  border: 1px solid var(--glass-border);
  border-radius: var(--r-xl);
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 12px 0;
  gap: 6px;
  -webkit-app-region: no-drag;
}
.sidebar .tile {
  width: 54px;
  height: 54px;
  border-radius: 17px;
  background: var(--navy);
  color: #fff;
  display: grid;
  place-items: center;
  box-shadow: 0 10px 22px rgba(29, 33, 64, 0.32);
  margin-bottom: 12px;
  cursor: pointer;
  border: none;
}
.sidebar .nav {
  width: 48px;
  height: 48px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  color: var(--ink-2);
  cursor: pointer;
  border: none;
  background: transparent;
  position: relative;
}
.sidebar .nav:hover {
  background: rgba(255, 255, 255, 0.45);
}
.sidebar .nav.active {
  color: var(--ink);
}
.sidebar .nav.active:hover {
  background: transparent;
}
/* Contenitore delle voci: il selettore bianco è un unico elemento che scorre tra le voci. */
.sidebar .navs {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}
.sidebar .nav-indicator {
  position: absolute;
  left: 0;
  top: 0;
  width: 48px;
  height: 48px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.78);
  box-shadow: var(--shadow-sm);
  pointer-events: none;
  will-change: transform;
  transition:
    transform 0.38s cubic-bezier(0.32, 0.72, 0, 1),
    opacity 0.25s ease;
}
.sidebar .nav {
  z-index: 1;
}
.sidebar .nav .ping {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--bad);
  border: 2px solid #fff;
}
.sidebar .spacer {
  flex: 1;
}
.sidebar .avatar {
  margin-bottom: 4px;
}

.workspace {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
}
/* Cambio pagina: il contenuto entra con una dissolvenza leggera dal basso. */
.page {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  animation: page-in 0.28s cubic-bezier(0.2, 0, 0, 1) both;
}
@keyframes page-in {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}
@media (prefers-reduced-motion: reduce) {
  .page {
    animation: none;
  }
  .sidebar .nav-indicator {
    transition: none;
  }
}

.topbar {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 6px 150px 14px 6px;
  -webkit-app-region: drag;
}
.topbar .crumb {
  font-size: 19px;
  color: var(--ink-2);
  white-space: nowrap;
}
.topbar .crumb b {
  color: var(--ink);
  font-weight: 600;
}
.topbar .tools {
  display: flex;
  align-items: center;
  gap: 8px;
  -webkit-app-region: no-drag;
}
.topbar .tools .tool {
  width: 34px;
  height: 34px;
  border-radius: 11px;
  display: grid;
  place-items: center;
  color: var(--ink-2);
  border: none;
  background: transparent;
  cursor: default;
}
.topbar .tools .tool.live {
  color: var(--good);
}
.topbar .tools .tool.dead {
  color: var(--bad);
}
.topbar .right {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 12px;
  -webkit-app-region: no-drag;
  color: var(--ink-2);
  font-size: 14px;
}
.topbar .right b {
  color: var(--ink);
  font-weight: 600;
}

.panels {
  display: grid;
  grid-template-columns: minmax(360px, 0.95fr) minmax(0, 1.05fr);
  gap: 18px;
  flex: 1;
  min-height: 0;
}
.panels.single {
  grid-template-columns: minmax(0, 1fr);
}
@media (max-width: 980px) {
  .panels {
    grid-template-columns: 1fr;
    overflow: auto;
  }
}

.panel {
  background: var(--glass);
  border: 1px solid var(--glass-border);
  border-radius: var(--r-xl);
  box-shadow: var(--shadow);
  padding: 22px 22px 18px;
  display: flex;
  flex-direction: column;
  min-height: 0;
  min-width: 0;
  backdrop-filter: blur(18px);
}
.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 16px;
}
.panel-head h2 {
  font-size: 22px;
  font-weight: 500;
  margin: 0;
  letter-spacing: -0.01em;
}
.panel-head .subtitle {
  font-size: 13px;
  color: var(--muted);
  margin-top: 2px;
}
.panel-body {
  flex: 1;
  min-height: 0;
  overflow: auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 2px 2px 2px 0;
}

/* ---------- Voci di navigazione interne (stile "Unplanned / Planned / All") ---------- */

.seg {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border-radius: 16px;
  color: var(--ink-2);
  cursor: pointer;
  border: none;
  background: transparent;
  width: 100%;
  text-align: left;
  font-size: 15px;
}
.seg .lbl {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.seg.active {
  background: rgba(255, 255, 255, 0.74);
  box-shadow: var(--shadow-sm);
  color: var(--ink);
}
.seg:hover:not(.active) {
  background: rgba(255, 255, 255, 0.35);
}
.seg .chev {
  color: var(--muted);
}

.count {
  min-width: 26px;
  height: 24px;
  padding: 0 8px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.72);
  box-shadow: inset 0 0 0 1px rgba(31, 37, 55, 0.05);
  display: inline-grid;
  place-items: center;
  font-size: 13px;
  color: var(--ink-2);
  font-variant-numeric: tabular-nums;
}
.seg.active .count {
  background: #eef1f5;
}
.count.navy {
  background: var(--navy);
  color: #fff;
}
.count.good {
  background: rgba(31, 157, 102, 0.14);
  color: var(--good);
}

/* ---------- Sezioni richiudibili ("^ Unplanned 2") ---------- */

.section-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 6px;
  color: var(--ink-2);
  font-size: 15px;
  cursor: pointer;
  user-select: none;
  background: none;
  border: none;
  width: 100%;
  text-align: left;
}
.section-head .lbl {
  flex: 1;
}
.section-head .count {
  background: rgba(255, 255, 255, 0.55);
}
.section-body {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 2px 0 10px;
}

/* ---------- Righe a pillola ---------- */

.row-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.5);
  border: 1px solid rgba(255, 255, 255, 0.72);
  box-shadow: 0 2px 10px rgba(31, 37, 55, 0.04);
  min-width: 0;
}
.row-item.clickable {
  cursor: pointer;
}
.row-item.clickable:hover {
  background: rgba(255, 255, 255, 0.72);
}
.row-item.active {
  background: rgba(255, 255, 255, 0.85);
  box-shadow: var(--shadow-sm);
}
.row-item.plain {
  background: transparent;
  border-color: transparent;
  box-shadow: none;
}
.row-item .grow {
  flex: 1;
  min-width: 0;
}
.row-item .title {
  font-size: 15px;
  color: var(--ink);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.row-item .sub {
  font-size: 12.5px;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.row-item .actions {
  display: flex;
  gap: 6px;
  align-items: center;
  flex-shrink: 0;
}
.row-detail {
  margin: -2px 0 6px 34px;
  padding: 12px 14px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.45);
  border: 1px solid rgba(255, 255, 255, 0.7);
  font-size: 13.5px;
}
.handle {
  color: var(--faint);
  display: grid;
  place-items: center;
  flex-shrink: 0;
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  border-radius: 11px;
  background: rgba(255, 255, 255, 0.86);
  border: 1px solid rgba(255, 255, 255, 0.95);
  box-shadow: 0 2px 6px rgba(31, 37, 55, 0.06);
  font-size: 13px;
  color: var(--ink-2);
  white-space: nowrap;
  flex-shrink: 0;
  font-variant-numeric: tabular-nums;
}
.pill.good {
  color: var(--good);
}
.pill.warn {
  color: var(--warn);
}
.pill.bad {
  color: var(--bad);
}
.pill.info {
  color: var(--info);
}
.pill.navy {
  background: var(--navy);
  color: #fff;
  border-color: var(--navy);
}
.pill.soft {
  background: rgba(31, 37, 55, 0.06);
  border-color: transparent;
  box-shadow: none;
}

.avatar {
  width: 36px;
  height: 36px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.85);
  color: var(--ink);
  display: grid;
  place-items: center;
  font-weight: 600;
  font-size: 13px;
  box-shadow: var(--shadow-sm);
  flex-shrink: 0;
  letter-spacing: 0.02em;
}
.avatar.navy {
  background: var(--navy);
  color: #fff;
}
.avatar.on {
  box-shadow:
    0 0 0 2px #fff,
    0 0 0 4px var(--good);
}

.status-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--faint);
  display: inline-block;
  flex-shrink: 0;
}
.status-dot.on {
  background: var(--good);
  box-shadow: 0 0 0 3px rgba(31, 157, 102, 0.2);
}

/* ---------- Campo "aggiungi" (stile "Add todo, press ↵ ENTER to save") ---------- */

.add-input {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.55);
  border: 1px solid rgba(255, 255, 255, 0.85);
  box-shadow:
    inset 0 1px 0 #fff,
    var(--shadow-sm);
  color: var(--muted);
  cursor: text;
}
.add-input:focus-within {
  background: rgba(255, 255, 255, 0.8);
}
.add-input input {
  flex: 1;
  min-width: 0;
  border: none;
  background: transparent;
  outline: none;
  font: inherit;
  font-size: 15px;
  color: var(--ink);
  padding: 0;
  box-shadow: none;
}
.add-input input::placeholder {
  color: var(--muted);
}
.add-input .key {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 26px;
  height: 22px;
  padding: 0 6px;
  border-radius: 6px;
  background: rgba(31, 37, 55, 0.07);
  color: var(--ink-2);
  font-size: 12px;
}
.add-input .hint {
  font-size: 14px;
  color: var(--muted);
  white-space: nowrap;
}

/* ---------- Orologio ---------- */

.clock-card {
  display: flex;
  align-items: center;
  gap: 22px;
  padding: 14px 22px;
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.78);
  border: 1px solid #fff;
  box-shadow: var(--shadow);
}
.clock-card.on {
  box-shadow:
    var(--shadow),
    0 0 0 1px rgba(31, 157, 102, 0.35);
}
.clock-card .big {
  font-size: 30px;
  font-weight: 500;
  color: var(--ink);
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.01em;
}
.clock-card .sub {
  font-size: 15px;
  color: var(--muted);
  margin-top: 4px;
}
.clock-card .sub b {
  color: var(--ink-2);
  font-weight: 500;
}
.clock-face {
  width: 112px;
  height: 112px;
  flex-shrink: 0;
}

/* ---------- Calendario ---------- */

.cal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 6px;
  margin: 4px 0 6px;
  font-size: 16px;
  color: var(--ink-2);
}
.cal-head.mt0 {
  margin: 0;
}
.cal-head .nav {
  display: flex;
  gap: 4px;
}
.cal-head .nav button {
  width: 30px;
  height: 30px;
  border-radius: 9px;
  border: none;
  background: transparent;
  color: var(--ink-2);
  display: grid;
  place-items: center;
  cursor: pointer;
}
.cal-head .nav button:hover {
  background: rgba(255, 255, 255, 0.6);
}
.cal {
  background: rgba(255, 255, 255, 0.55);
  border: 1px solid rgba(255, 255, 255, 0.85);
  border-radius: 22px;
  padding: 12px 12px 10px;
  box-shadow: var(--shadow-sm);
}
.cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 2px 2px;
}
.cal-grid .wd {
  text-align: center;
  font-size: 13px;
  color: var(--muted);
  padding: 0 0 6px;
}
.cal-day {
  position: relative;
  height: 33px;
  display: grid;
  place-items: center;
  border-radius: 10px;
  font-size: 15px;
  color: var(--ink);
  cursor: pointer;
  border: none;
  background: transparent;
  font-variant-numeric: tabular-nums;
}
.cal-day:hover {
  background: rgba(31, 37, 55, 0.06);
}
.cal-day.other {
  color: var(--faint);
}
.cal-day.selected {
  background: rgba(31, 37, 55, 0.1);
}
.cal-day.today {
  background: var(--navy);
  color: #fff;
}
.cal-day.has::after {
  content: '';
  position: absolute;
  bottom: 4px;
  left: 50%;
  transform: translateX(-50%);
  width: 16px;
  height: 3px;
  border-radius: 2px;
  background: var(--navy);
}
.cal-day.today.has::after {
  background: rgba(255, 255, 255, 0.9);
}

/* ---------- Pulsanti ---------- */

.btn {
  appearance: none;
  border: 1px solid rgba(255, 255, 255, 0.9);
  background: rgba(255, 255, 255, 0.82);
  color: var(--ink);
  padding: 9px 16px;
  border-radius: 14px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  box-shadow: var(--shadow-sm);
  white-space: nowrap;
  line-height: 1.2;
}
.btn:hover:not(:disabled) {
  background: #fff;
}
.btn:disabled {
  opacity: 0.45;
  cursor: default;
}
.btn.dark {
  background: var(--navy);
  color: #fff;
  border-color: var(--navy);
  box-shadow: 0 8px 18px rgba(29, 33, 64, 0.25);
}
.btn.dark:hover:not(:disabled) {
  background: #2a2f57;
}
.btn.danger {
  background: var(--bad);
  color: #fff;
  border-color: var(--bad);
  box-shadow: 0 8px 18px rgba(214, 69, 69, 0.22);
}
.btn.danger:hover:not(:disabled) {
  background: #c23b3b;
}
.btn.good {
  background: var(--good);
  color: #fff;
  border-color: var(--good);
}
.btn.good:hover:not(:disabled) {
  background: #1a8a59;
}
.btn.ghost {
  background: transparent;
  border-color: transparent;
  box-shadow: none;
  color: var(--ink-2);
}
.btn.ghost:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.6);
}
.btn.small {
  padding: 6px 11px;
  font-size: 13px;
  border-radius: 11px;
}
.btn.icon {
  padding: 7px;
  border-radius: 12px;
}
.btn.icon.small {
  padding: 5px;
  border-radius: 9px;
}
.btn.block {
  width: 100%;
}

/* ---------- Campi modulo ---------- */

input,
select,
textarea {
  width: 100%;
  font: inherit;
  font-size: 14px;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.74);
  border: 1px solid rgba(31, 37, 55, 0.11);
  border-radius: 12px;
  padding: 9px 13px;
  outline: none;
  box-shadow: none;
  transition:
    border-color 0.12s,
    box-shadow 0.12s,
    background 0.12s;
}
input::placeholder,
textarea::placeholder {
  color: var(--faint);
}
input:hover:not(:disabled):not(:focus),
select:hover:not(:disabled):not(:focus),
textarea:hover:not(:disabled):not(:focus) {
  border-color: rgba(31, 37, 55, 0.22);
}
input:focus,
select:focus,
textarea:focus {
  border-color: rgba(29, 33, 64, 0.5);
  background: #fff;
  box-shadow: 0 0 0 3px rgba(29, 33, 64, 0.09);
}
input:disabled,
select:disabled {
  opacity: 0.55;
}
textarea {
  min-height: 84px;
  resize: vertical;
  line-height: 1.45;
}
input[type='checkbox'] {
  width: 16px;
  height: 16px;
  padding: 0;
  box-shadow: none;
  accent-color: var(--navy);
}
.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 14px;
  min-width: 0;
}
.field label {
  font-size: 12px;
  font-weight: 600;
  color: var(--ink-2);
  letter-spacing: 0.01em;
}
.field .hint {
  font-size: 11.5px;
  color: var(--muted);
  line-height: 1.35;
}
.fields-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0 16px;
}
.fields-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0 16px;
}
@media (max-width: 640px) {
  .fields-2,
  .fields-3 {
    grid-template-columns: 1fr;
  }
}

/* Campi secondari, chiusi finché non servono */
.more {
  margin: 0 0 14px;
  border-top: 1px dashed var(--line);
}
.more-toggle {
  display: flex;
  align-items: center;
  gap: 6px;
  width: 100%;
  padding: 11px 0 0;
  background: none;
  border: 0;
  text-align: left;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-2);
  cursor: pointer;
}
.more-toggle:hover {
  color: var(--ink);
}
.more.open .more-toggle {
  padding-bottom: 12px;
}
.form-h {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 2px 0 10px;
}
.field + .form-h,
.fields-2 + .form-h,
.fields-3 + .form-h {
  margin-top: 6px;
}
.checks {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
.checks label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--ink);
  padding: 6px 10px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.5);
  cursor: pointer;
}
.checks label.on {
  background: var(--navy);
  color: #fff;
}
.checks label input {
  display: none;
}

.toggle {
  width: 44px;
  height: 26px;
  border-radius: 13px;
  background: rgba(31, 37, 55, 0.16);
  position: relative;
  border: none;
  cursor: pointer;
  transition: background 0.15s;
  flex-shrink: 0;
  padding: 0;
}
.toggle::after {
  content: '';
  position: absolute;
  top: 3px;
  left: 3px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
  transition: left 0.15s;
}
.toggle.on {
  background: var(--navy);
}
.toggle.on::after {
  left: 21px;
}
.toggle:disabled {
  opacity: 0.5;
  cursor: default;
}

/* ---------- Numeri e statistiche ---------- */

.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(112px, 1fr));
  gap: 10px;
}
.stat {
  padding: 12px 14px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.85);
  box-shadow: var(--shadow-sm);
  min-width: 0;
}
.stat .value {
  font-size: 22px;
  font-weight: 500;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.01em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.stat .label {
  font-size: 12.5px;
  color: var(--muted);
  margin-top: 2px;
}
.stat.navy {
  background: var(--navy);
  border-color: var(--navy);
}
.stat.navy .value {
  color: #fff;
}
.stat.navy .label {
  color: rgba(255, 255, 255, 0.7);
}

/* ---------- Tabella ---------- */

.table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 14px;
}
.table th,
.table td {
  padding: 9px 10px;
  text-align: left;
  vertical-align: middle;
  border-bottom: 1px solid var(--line);
}
.table th {
  font-size: 11.5px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  font-weight: 500;
}
.table tbody tr:last-child td {
  border-bottom: none;
}
.table tfoot th {
  text-transform: none;
  letter-spacing: 0;
  font-size: 14px;
  color: var(--ink);
  font-weight: 600;
  border-bottom: none;
  border-top: 1px solid var(--line);
}
.table tr.clickable {
  cursor: pointer;
}
.table tr.clickable:hover td {
  background: rgba(255, 255, 255, 0.5);
}
.table tr.active td {
  background: rgba(255, 255, 255, 0.7);
}
.num {
  text-align: right;
  font-variant-numeric: tabular-nums;
}
.table .num {
  text-align: right;
}

/* ---------- Avvisi ---------- */

.error {
  background: rgba(214, 69, 69, 0.1);
  border: 1px solid rgba(214, 69, 69, 0.3);
  color: var(--bad);
  padding: 9px 12px;
  border-radius: 12px;
  font-size: 13px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.notice-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 5px 6px 5px 12px;
  border-radius: 12px;
  background: rgba(59, 111, 214, 0.1);
  color: var(--info);
  font-size: 13px;
}

.empty {
  padding: 28px 12px;
  text-align: center;
  color: var(--muted);
  font-size: 14px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}
.empty .ico {
  color: var(--faint);
}

/* ---------- Finestra modale ---------- */

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(31, 37, 55, 0.3);
  backdrop-filter: blur(6px);
  display: grid;
  place-items: center;
  z-index: 50;
}
.modal {
  width: min(760px, calc(100vw - 48px));
  max-height: calc(100vh - 64px);
  overflow: auto;
  background: rgba(255, 255, 255, 0.93);
  border: 1px solid #fff;
  border-radius: 24px;
  padding: 18px 24px 20px;
  box-shadow: 0 30px 80px rgba(31, 37, 55, 0.25);
}
.modal.narrow {
  width: min(520px, calc(100vw - 48px));
}
.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin: 0 -24px 18px;
  padding: 0 24px 12px;
  border-bottom: 1px solid var(--line);
}
.modal-header h3 {
  margin: 0;
  font-size: 19px;
  font-weight: 600;
  letter-spacing: -0.01em;
}
.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin: 6px -24px -20px;
  padding: 12px 24px 16px;
  border-top: 1px solid var(--line);
}

/* ---------- Accesso ---------- */

.login {
  height: 100%;
  display: grid;
  place-items: center;
  -webkit-app-region: drag;
}
.login-card {
  width: min(400px, calc(100vw - 24px));
  background: var(--glass);
  border: 1px solid var(--glass-border);
  border-radius: 28px;
  box-shadow: var(--shadow);
  padding: 28px 28px 22px;
  backdrop-filter: blur(18px);
  -webkit-app-region: no-drag;
}
.login-card .brand {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 20px;
}
.login-card .brand .tile {
  width: 54px;
  height: 54px;
  border-radius: 17px;
  background: var(--navy);
  color: #fff;
  display: grid;
  place-items: center;
  box-shadow: 0 10px 22px rgba(29, 33, 64, 0.32);
}
.login-card h1 {
  margin: 0;
  font-size: 22px;
  font-weight: 500;
}

/* ---------- Note ---------- */

.note-text {
  font-size: 14px;
  color: var(--ink);
  white-space: pre-wrap;
  word-break: break-word;
}
.timer {
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.01em;
}
.pre {
  white-space: pre-wrap;
  margin: 0;
  font: inherit;
}

/* ---------- Utilità ---------- */

.stack {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.hstack {
  display: flex;
  align-items: center;
  gap: 10px;
}
.hstack.between {
  justify-content: space-between;
}
.hstack.wrap {
  flex-wrap: wrap;
}
.hstack.top {
  align-items: flex-start;
}
.grow {
  flex: 1;
  min-width: 0;
}
.muted {
  color: var(--muted);
}
.small {
  font-size: 12.5px;
}
.tiny {
  font-size: 11.5px;
}
.strong {
  font-weight: 600;
  color: var(--ink);
}
.eyebrow {
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 600;
}
.mt {
  margin-top: 10px;
}
.mb {
  margin-bottom: 10px;
}
.good-text {
  color: var(--good);
}
.bad-text {
  color: var(--bad);
}
.capitalize {
  text-transform: capitalize;
}
.divider {
  height: 1px;
  background: var(--line);
  margin: 6px 0;
}
.card {
  background: rgba(255, 255, 255, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.85);
  border-radius: 18px;
  padding: 14px 16px;
  box-shadow: var(--shadow-sm);
}
.card.navy {
  background: var(--navy);
  border-color: var(--navy);
  color: #fff;
}
.card.navy .muted {
  color: rgba(255, 255, 255, 0.65);
}
.boot {
  height: 100%;
  display: grid;
  place-items: center;
  color: var(--muted);
}

/* Schermata di sblocco (impronta/viso) e attesa del server. */
.lock-overlay {
  position: fixed;
  inset: 0;
  z-index: 50;
  /* Copre l'interfaccia (che resta collegata) con lo stesso sfondo dell'app. */
  background:
    radial-gradient(900px 600px at -10% -10%, rgba(255, 255, 255, 0.95), transparent 60%),
    radial-gradient(800px 600px at 110% 110%, rgba(190, 203, 218, 0.9), transparent 60%),
    linear-gradient(160deg, #eaeff5 0%, #dde4ec 55%, #e3e9f0 100%);
}
.lock-card {
  text-align: center;
  align-items: center;
}
.lock-card h1 {
  font-size: 22px;
  font-weight: 500;
}
.lock-ring {
  width: 92px;
  height: 92px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  margin: 4px auto 14px;
  color: var(--navy);
  background: rgba(255, 255, 255, 0.7);
  box-shadow:
    0 10px 26px rgba(29, 33, 64, 0.12),
    0 0 0 8px rgba(255, 255, 255, 0.45);
  animation: lock-pulse 2.4s ease-in-out infinite;
}
.lock-ring.warn {
  color: var(--bad);
  animation: none;
}
@keyframes lock-pulse {
  0%,
  100% {
    box-shadow:
      0 10px 26px rgba(29, 33, 64, 0.12),
      0 0 0 8px rgba(255, 255, 255, 0.45);
  }
  50% {
    box-shadow:
      0 10px 26px rgba(29, 33, 64, 0.16),
      0 0 0 16px rgba(255, 255, 255, 0.28);
  }
}
@media (prefers-reduced-motion: reduce) {
  .lock-ring {
    animation: none;
  }
}

/* Pulsantino di modifica sopra la scheda scura della sessione in corso. */
.btn.icon.ghost.on-navy {
  color: rgba(255, 255, 255, 0.65);
}
.btn.icon.ghost.on-navy:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.14);
}

/* Pillole di azione dentro la scheda scura della sessione in corso. */
.chip {
  appearance: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 12px;
  font-size: 13px;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  border: 1px solid rgba(255, 255, 255, 0.9);
  background: rgba(255, 255, 255, 0.82);
  color: var(--ink);
  transition: background 0.15s ease, border-color 0.15s ease;
}
.chip.on-navy {
  background: rgba(255, 255, 255, 0.16);
  border-color: rgba(255, 255, 255, 0.34);
  color: #fff;
}
.chip.on-navy:hover {
  background: rgba(255, 255, 255, 0.28);
  border-color: rgba(255, 255, 255, 0.55);
}

/* Menu contestuale (tasto destro). */
.ctx-layer {
  position: fixed;
  inset: 0;
  z-index: 60;
}
.ctx-menu {
  position: fixed;
  min-width: 230px;
  padding: 6px;
  border-radius: var(--r-md);
  background: rgba(255, 255, 255, 0.96);
  border: 1px solid var(--glass-border);
  box-shadow: 0 18px 44px rgba(31, 37, 55, 0.22);
  animation: ctx-in 0.12s ease;
}
@keyframes ctx-in {
  from {
    transform: translateY(-5px) scale(0.985);
  }
}
.ctx-title {
  padding: 6px 10px 8px;
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}
.ctx-item {
  appearance: none;
  width: 100%;
  border: 0;
  background: transparent;
  color: var(--ink);
  font: inherit;
  font-size: 13.5px;
  text-align: left;
  padding: 9px 10px;
  border-radius: var(--r-sm);
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
}
.ctx-item:hover {
  background: rgba(31, 37, 55, 0.07);
}
.ctx-item.danger {
  color: var(--bad);
}
.ctx-sep {
  height: 1px;
  margin: 5px 8px;
  background: var(--line);
}
@media (prefers-reduced-motion: reduce) {
  .ctx-menu {
    animation: none;
  }
}

/* Campo password con occhio per mostrarla */
.pw { position: relative; display: flex; min-width: 0; }
.pw input { width: 100%; padding-right: 42px; }
.pw-eye {
  position: absolute; right: 6px; top: 50%; transform: translateY(-50%);
  display: grid; place-items: center; width: 32px; height: 32px;
  border: 0; border-radius: 8px; background: transparent; color: var(--muted, #6b7280); cursor: pointer;
}
.pw-eye:hover { background: rgba(120, 130, 150, 0.16); color: inherit; }
.pw-eye[aria-pressed='true'] { color: inherit; }

/* ---------- Versione web: nessun controllo finestra da riservare ---------- */
.is-web .topbar,
.is-mac .topbar {
  padding-right: 6px;
}

/* ---------- Telefono e tablet stretto: barra di navigazione in basso ---------- */
@media (max-width: 760px) {
  body {
    overflow: auto;
  }
  .shell {
    display: flex;
    flex-direction: column-reverse;
    gap: 10px;
    height: 100dvh;
    padding: max(8px, env(safe-area-inset-top)) 10px calc(8px + env(safe-area-inset-bottom)) 10px;
  }
  .sidebar {
    flex-direction: row;
    justify-content: space-around;
    padding: 6px 8px;
    gap: 2px;
    border-radius: 22px;
    flex: none;
    overflow-x: auto;
  }
  .sidebar .tile {
    width: 42px;
    height: 42px;
    border-radius: 14px;
    margin: 0;
    flex: none;
  }
  .sidebar .navs {
    flex-direction: row;
    gap: 2px;
    flex: 1;
    justify-content: space-around;
  }
  .sidebar .nav-indicator {
    display: none;
  }
  .sidebar .nav {
    width: 44px;
    height: 44px;
    flex: none;
  }
  .sidebar .nav.active {
    background: rgba(255, 255, 255, 0.85);
    box-shadow: var(--shadow-sm);
  }
  .sidebar .spacer,
  .sidebar .avatar {
    display: none;
  }
  .workspace {
    flex: 1;
  }
  .topbar {
    padding: 2px 4px 10px;
    gap: 8px;
    flex-wrap: wrap;
  }
  .topbar .crumb {
    font-size: 16px;
  }
  .topbar .right .muted {
    display: none;
  }
  .topbar .right {
    font-size: 13px;
    gap: 6px;
  }
  .page {
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
  }
  .panels {
    grid-template-columns: minmax(0, 1fr);
    overflow: visible;
    gap: 12px;
  }
  .panel {
    padding: 16px 14px 14px;
    min-height: auto;
  }
  .panel-head h2 {
    font-size: 19px;
  }
  /* Tabelle larghe: scorrono in orizzontale invece di rompere il layout. */
  .panel-body,
  .section-body {
    overflow-x: auto;
  }
  button,
  input,
  select,
  textarea {
    font-size: 16px; /* evita lo zoom automatico di iOS sui campi */
  }
}

/* ---------- Posta ---------- */
.mail {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: 190px minmax(280px, 360px) minmax(0, 1fr);
  gap: 14px;
}
.mail > aside,
.mail > section {
  background: var(--glass);
  border: 1px solid var(--glass-border);
  border-radius: var(--r-xl);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
  min-height: 0;
  min-width: 0;
  display: flex;
  flex-direction: column;
}
.mail-folders {
  padding: 14px 10px;
  gap: 10px;
}
.mail-folders nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.mail-folder {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border: none;
  background: transparent;
  padding: 9px 12px;
  border-radius: 12px;
  font-size: 14px;
  color: var(--ink-2);
  cursor: pointer;
  text-align: left;
}
.mail-folder:hover {
  background: rgba(255, 255, 255, 0.5);
}
.mail-folder.active {
  background: rgba(255, 255, 255, 0.85);
  color: var(--ink);
  font-weight: 600;
  box-shadow: var(--shadow-sm);
}
.mail-folder b {
  font-size: 11.5px;
  background: var(--navy);
  color: #fff;
  border-radius: 20px;
  padding: 1px 8px;
}
.mail-account {
  padding: 0 6px;
  word-break: break-all;
}
.mail-list-head {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 14px 14px 6px 18px;
}
.mail-list-head h2 {
  flex: 1;
  margin: 0;
  font-size: 19px;
  font-weight: 500;
}
.mail-search {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 4px 14px 8px;
  color: var(--muted);
}
.mail-search input {
  padding: 7px 12px;
}
.mail-items {
  flex: 1;
  overflow-y: auto;
  padding: 0 8px 8px;
}
.mail-item {
  display: block;
  width: 100%;
  text-align: left;
  border: none;
  background: transparent;
  padding: 10px 12px;
  border-radius: 14px;
  cursor: pointer;
  color: var(--ink-2);
}
.mail-item:hover {
  background: rgba(255, 255, 255, 0.5);
}
.mail-item.active {
  background: rgba(255, 255, 255, 0.85);
  box-shadow: var(--shadow-sm);
}
.mail-item-top {
  display: flex;
  justify-content: space-between;
  gap: 10px;
}
.mail-from {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 13.5px;
}
.mail-date {
  font-size: 11.5px;
  color: var(--muted);
  white-space: nowrap;
}
.mail-subject {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 13px;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  margin-top: 2px;
}
.mail-item.unread .mail-from,
.mail-item.unread .mail-subject {
  color: var(--ink);
  font-weight: 700;
}
.mail-pager {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 12px;
  padding: 8px;
  border-top: 1px solid var(--line);
}
.mail-read-head {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  flex-wrap: wrap;
}
.mail-read-body {
  flex: 1;
  overflow: auto;
  padding: 16px 22px 22px;
}
.mail-read-body h3 {
  margin: 0 0 10px;
  font-size: 19px;
  font-weight: 600;
}
.mail-meta {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding-bottom: 12px;
  margin-bottom: 12px;
  border-bottom: 1px solid var(--line);
}
.mail-note {
  font-size: 12px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.55);
  border-radius: 10px;
  padding: 6px 10px;
  margin-bottom: 10px;
}
.mail-atts {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin-bottom: 12px;
}
.mail-crm {
  width: auto;
  max-width: 300px;
  padding: 6px 10px;
  font-size: 12.5px;
  border-radius: 10px;
}
.doc-tabs {
  display: inline-flex;
  gap: 4px;
  padding: 3px;
  border-radius: 12px;
  background: rgba(31, 37, 55, 0.06);
}
.pill-file {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12.5px;
  background: rgba(255, 255, 255, 0.7);
  border-radius: 20px;
  padding: 3px 4px 3px 10px;
}
.mail-body {
  font-size: 14px;
  line-height: 1.5;
  overflow-wrap: anywhere;
  color: #111;
  background: #fff;
  border-radius: 14px;
  padding: 14px 16px;
}
.mail-body img {
  max-width: 100%;
  height: auto;
}
.mail-body table {
  max-width: 100%;
}
.mail-body a {
  color: var(--info);
}
.mail-body.plain {
  white-space: pre-wrap;
  font-family: inherit;
  margin: 0;
}
.mail-setup {
  max-width: 520px;
  margin: 0 auto;
  align-self: flex-start;
  width: 100%;
}
.mail-setup-form h2 {
  margin: 0 0 6px;
  font-weight: 500;
}
.row-actions {
  display: flex;
  gap: 10px;
  margin-top: 16px;
  flex-wrap: wrap;
}
.row-actions select {
  width: auto;
  min-width: 130px;
}
.mail-back,
.mail-compose-fab {
  display: none !important;
}

@media (max-width: 1100px) and (min-width: 761px) {
  .mail {
    grid-template-columns: 150px minmax(240px, 300px) minmax(0, 1fr);
    gap: 10px;
  }
}

/* Telefono: un pannello alla volta (cartelle -> elenco -> messaggio). */
@media (max-width: 760px) {
  .mail {
    grid-template-columns: minmax(0, 1fr);
    gap: 0;
  }
  .mail > * {
    display: none !important;
  }
  .mail[data-pane='folders'] > .mail-folders,
  .mail[data-pane='list'] > .mail-list,
  .mail[data-pane='read'] > .mail-read {
    display: flex !important;
  }
  .mail-back,
  .mail-compose-fab {
    display: inline-flex !important;
  }
  .mail-list-head {
    padding-left: 10px;
  }
  .mail-read-body {
    padding: 12px;
  }
  .mail-body {
    padding: 10px;
  }
}

/* ---------- Preventivi ---------- */
.quote-tabs {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}
.quote-tab {
  border: none;
  background: rgba(255, 255, 255, 0.5);
  border-radius: 20px;
  padding: 6px 12px;
  font-size: 13px;
  color: var(--ink-2);
  cursor: pointer;
  display: inline-flex;
  gap: 8px;
  align-items: center;
}
.quote-tab b {
  font-size: 11.5px;
  color: var(--muted);
}
.quote-tab.active {
  background: var(--navy);
  color: #fff;
}
.quote-tab.active b {
  color: rgba(255, 255, 255, 0.75);
}
.quote-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  overflow-y: auto;
  min-height: 0;
}
.quote-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
  text-align: left;
  width: 100%;
  border: 1px solid rgba(255, 255, 255, 0.9);
  background: rgba(255, 255, 255, 0.6);
  border-radius: 16px;
  padding: 12px 16px;
  cursor: pointer;
  color: var(--ink);
}
.quote-row:hover {
  background: #fff;
}
.quote-main {
  min-width: 0;
}
.quote-num {
  font-size: 12px;
  color: var(--muted);
  letter-spacing: 0.04em;
}
.quote-subj {
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.quote-subj.big {
  font-size: 18px;
  white-space: normal;
}
.quote-side {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 6px;
  flex: none;
}
.quote-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
  width: 100%;
}
.quote-doc-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
  margin-bottom: 14px;
}
.quote-to {
  background: rgba(255, 255, 255, 0.6);
  border-radius: 14px;
  padding: 10px 14px;
  margin-bottom: 12px;
}
.quote-text {
  white-space: pre-wrap;
  margin: 6px 0 12px;
  line-height: 1.5;
}
.quote-totals {
  margin: 12px 0 0 auto;
  width: min(320px, 100%);
}
.quote-totals > div {
  display: flex;
  justify-content: space-between;
  padding: 4px 0;
  font-size: 14px;
}
.quote-totals .grand {
  font-size: 17px;
  font-weight: 700;
  border-top: 1px solid var(--line);
  margin-top: 4px;
  padding-top: 8px;
}
.quote-notes {
  margin-top: 14px;
}
.quote-edit-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 96px 74px 96px 88px 30px;
  gap: 6px;
  align-items: center;
  margin-bottom: 6px;
}
.quote-edit-row input,
.quote-edit-row select {
  padding: 8px 10px;
}
.qe-tot {
  text-align: right;
  font-size: 13px;
  font-weight: 600;
}
@media (max-width: 760px) {
  .quote-edit-row {
    grid-template-columns: 1fr 1fr 1fr;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--line);
  }
  .quote-edit-row .qe-desc {
    grid-column: 1 / -1;
  }
  .quote-side {
    align-items: flex-end;
  }
}

/* ---------- Trattative (kanban) ---------- */
.deal-search {
  width: 160px;
  padding: 8px 12px;
}
.kanban {
  display: grid;
  grid-template-columns: repeat(5, minmax(210px, 1fr));
  gap: 12px;
  overflow-x: auto;
  flex: 1;
  min-height: 0;
  padding-bottom: 6px;
}
.kan-col {
  background: rgba(255, 255, 255, 0.35);
  border-radius: 18px;
  padding: 10px;
  display: flex;
  flex-direction: column;
  min-height: 0;
  border: 2px solid transparent;
}
.kan-col.over {
  border-color: rgba(29, 33, 64, 0.35);
  background: rgba(255, 255, 255, 0.6);
}
.kan-head {
  display: flex;
  flex-direction: column;
  gap: 1px;
  padding: 2px 4px 10px;
}
.kan-cards {
  display: flex;
  flex-direction: column;
  gap: 8px;
  overflow-y: auto;
  min-height: 0;
}
.kan-card {
  background: #fff;
  border-radius: 14px;
  padding: 10px 12px;
  box-shadow: var(--shadow-sm);
  cursor: grab;
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.kan-name {
  font-weight: 600;
}
.kan-foot {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 4px;
  font-size: 13px;
}
.kan-due {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  color: var(--muted);
}
.kan-due.late {
  color: var(--bad);
  font-weight: 600;
}
.kan-move {
  display: none;
  margin-top: 6px;
  padding: 6px 10px;
  font-size: 13px;
}
.kan-empty {
  text-align: center;
  padding: 14px 4px;
}
.deal-log-item {
  background: rgba(255, 255, 255, 0.6);
  border-radius: 12px;
  padding: 8px 12px;
  margin-bottom: 6px;
}
@media (max-width: 760px) {
  .kanban {
    grid-template-columns: minmax(0, 1fr);
    overflow: visible;
  }
  .kan-move {
    display: block;
  }
  .deal-search {
    width: 100px;
  }
}

/* ---------- Agenda e provvigioni ---------- */
.stats-row .stat {
  flex: 1;
  min-width: 120px;
}
.ag-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.ag-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.85);
  cursor: pointer;
  font-size: 14px;
}
.ag-row:hover {
  background: rgba(255, 255, 255, 0.85);
}
.ag-row.deal {
  border-left: 3px solid var(--navy);
}
.ag-row.done .ag-title {
  text-decoration: line-through;
  color: var(--muted);
}
.ag-time {
  color: var(--muted);
  font-size: 12.5px;
  white-space: nowrap;
  min-width: 78px;
}
.ag-day {
  font-size: 12.5px;
  white-space: nowrap;
  min-width: 130px;
}
.ag-title {
  flex: 1;
  min-width: 0;
}
.ag-check {
  border: none;
  background: none;
  padding: 0;
  color: var(--muted);
  cursor: pointer;
  display: flex;
}
.ag-allday {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 38px;
}
.ag-steps {
  padding-left: 18px;
  margin: 10px 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
@media (max-width: 760px) {
  .ag-day {
    display: none;
  }
}

/* ---------- Prenotazione slot ---------- */
.bk-slots {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.bk-slot {
  padding: 8px 14px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.7);
  font: inherit;
  font-variant-numeric: tabular-nums;
  cursor: pointer;
}
.bk-slot:hover {
  background: #fff;
}
.bk-slot.on {
  background: var(--navy);
  border-color: var(--navy);
  color: #fff;
}
.bk-cart {
  margin-top: 16px;
  padding: 14px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.85);
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.bk-cart ul {
  margin: 0;
  padding-left: 18px;
  font-size: 14px;
}
.bk-day {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 8px 0;
  border-bottom: 1px solid var(--line);
}
.bk-dayname {
  width: 96px;
  padding-top: 8px;
  font-weight: 500;
}
.bk-ranges {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.bk-range {
  display: flex;
  align-items: center;
  gap: 8px;
}
.bk-ranges > .muted {
  padding-top: 8px;
}

/* ---------- Ticket, pagamenti, incassi, scadenze ---------- */
.tk-prio { width: 10px; height: 10px; border-radius: 50%; background: var(--muted); flex: none; }
.tk-prio.high { background: #d9534f; }
.tk-prio.low { opacity: 0.4; }
.tk-files { margin: 8px 0; padding-left: 18px; font-size: 13.5px; }
.tk-thread { display: flex; flex-direction: column; gap: 10px; margin-bottom: 14px; max-height: 46vh; overflow-y: auto; }
.tk-msg { padding: 10px 12px; border-radius: 14px; background: rgba(255, 255, 255, 0.6); border: 1px solid rgba(255, 255, 255, 0.85); display: flex; flex-direction: column; gap: 6px; align-items: flex-start; }
.tk-msg.staff { background: rgba(30, 42, 74, 0.08); }
.tk-body { white-space: pre-wrap; font-size: 14px; }
.pay-card { padding: 12px 14px; border-radius: 16px; background: rgba(255, 255, 255, 0.6); border: 1px solid rgba(255, 255, 255, 0.85); display: flex; flex-direction: column; gap: 6px; font-size: 14px; }
.pay-card.off { opacity: 0.55; }
.pay-bank { padding: 8px 10px; border-radius: 12px; background: rgba(255, 255, 255, 0.7); display: flex; flex-direction: column; gap: 4px; }
.pay-line { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.kan-due.soon { color: #b7791f; }
.sidebar .navs { overflow-y: auto; scrollbar-width: none; }
.sidebar .navs::-webkit-scrollbar { display: none; }
.sidebar { min-height: 0; }
.sidebar .navs { min-height: 0; flex: 0 1 auto; }
@media (max-width: 760px) {
  .sidebar .navs { flex: 1; overflow-x: auto; overflow-y: hidden; justify-content: flex-start; }
}

/* ---------- Barra laterale allargabile ---------- */
.shell {
  transition: grid-template-columns 0.28s cubic-bezier(0.32, 0.72, 0, 1);
}
.shell.wide {
  grid-template-columns: 224px minmax(0, 1fr);
}
.sidebar {
  position: relative;
}
.sidebar .navs {
  align-self: stretch;
  align-items: center;
  padding: 0 14px;
}
/* Le voci non si schiacciano: se non entrano, la colonna scorre (barra sottile al passaggio del mouse) */
.sidebar .navs > .nav {
  flex: none;
  height: 40px;
}
.sidebar .navs {
  gap: 2px;
  scrollbar-width: thin;
  scrollbar-color: transparent transparent;
}
.sidebar .navs:hover {
  scrollbar-color: rgba(29, 33, 64, 0.18) transparent;
}
.sidebar .tile {
  margin-bottom: 8px;
}
.sidebar .nav-indicator {
  transition:
    transform 0.38s cubic-bezier(0.32, 0.72, 0, 1),
    width 0.28s ease,
    height 0.28s ease,
    opacity 0.25s ease;
}
.side-toggle {
  position: absolute;
  top: 26px;
  right: -11px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 1px solid var(--glass-border);
  background: #fff;
  color: var(--ink-2);
  display: grid;
  place-items: center;
  cursor: pointer;
  z-index: 3;
  box-shadow: var(--shadow-sm);
  padding: 0;
}
.side-toggle:hover {
  color: var(--ink);
}
.side-head {
  display: flex;
  align-items: center;
  gap: 12px;
  align-self: stretch;
  justify-content: center;
  padding: 0 11px;
}
.side-brand,
.sidebar .nav-label,
.nav-group {
  display: none;
}
.nav-group {
  width: 32px;
  height: 1px;
  background: rgba(29, 33, 64, 0.1);
  margin: 4px 0;
  flex: none;
}
.nav-group.first {
  display: none !important;
}
.shell:not(.wide) .nav-group {
  display: block;
  font-size: 0;
}
.side-user {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 4px;
}

.shell.wide .sidebar {
  align-items: stretch;
}
.shell.wide .side-head {
  justify-content: flex-start;
  padding: 0 14px;
}
.shell.wide .side-head .tile {
  margin-bottom: 0;
}
.shell.wide .side-head {
  margin-bottom: 4px;
}
.shell.wide .side-brand {
  display: inline;
  font-size: 15px;
  color: var(--ink-2);
  white-space: nowrap;
}
.shell.wide .side-brand b {
  color: var(--ink);
}
.shell.wide .sidebar .navs {
  align-items: stretch;
  gap: 2px;
}
.shell.wide .sidebar .nav {
  width: auto;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 12px;
  padding: 0 12px;
  font-size: 14px;
  border-radius: 12px;
}
.shell.wide .sidebar .nav .ping {
  top: 8px;
  left: 26px;
  right: auto;
}
.shell.wide .sidebar .nav-label {
  display: inline;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.shell.wide .sidebar .nav.active .nav-label {
  font-weight: 600;
}
.shell.wide .nav-group {
  display: block;
  width: auto;
  height: auto;
  background: none;
  margin: 10px 12px 2px;
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}
.shell.wide .sidebar > .nav,
.shell.wide .side-user {
  margin-left: 14px;
  margin-right: 14px;
}
.shell.wide .side-user .nav-label {
  font-size: 13px;
  color: var(--ink-2);
}

@media (max-width: 760px) {
  .side-toggle,
  .nav-group,
  .side-brand,
  .shell .sidebar .nav-label {
    display: none !important;
  }
  .side-head {
    padding: 0;
    align-self: auto;
  }
  .sidebar .navs {
    padding: 0;
  }
  .side-user {
    display: none;
  }
}
@media (max-width: 760px) {
  .shell.wide .sidebar {
    align-items: center;
  }
  .shell.wide .sidebar .navs {
    align-items: center;
  }
  .shell.wide .sidebar .nav {
    width: 44px;
    height: 44px;
    padding: 0;
    justify-content: center;
  }
  .shell.wide .sidebar > .nav {
    margin: 0;
  }
}

/* ---------- Barra in alto: tema e campanella delle notifiche ---------- */
.topbar .top-btn {
  position: relative;
  width: 36px;
  height: 36px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  border: 1px solid transparent;
  background: transparent;
  color: var(--ink-2);
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.topbar .top-btn:hover {
  background: var(--top-btn-hover);
  color: var(--ink);
}
.topbar .top-btn.on {
  background: var(--top-btn-on);
  border-color: var(--glass-border);
  color: var(--ink);
  box-shadow: var(--shadow-sm);
}
.topbar .top-badge {
  position: absolute;
  top: 2px;
  right: 1px;
  min-width: 17px;
  height: 17px;
  padding: 0 4px;
  border-radius: 9px;
  background: var(--bad);
  color: #fff;
  font-size: 10.5px;
  font-weight: 600;
  line-height: 17px;
  text-align: center;
  box-shadow: 0 0 0 2px var(--badge-ring);
}
.topbar .right .top-btn + .top-btn {
  margin-left: -6px;
}

:root {
  --top-btn-hover: rgba(255, 255, 255, 0.55);
  --top-btn-on: rgba(255, 255, 255, 0.85);
  --badge-ring: #e7ecf2;
  --clock-face: #fff;
  --clock-ink: #1f2537;
  --clock-tick: rgba(31, 37, 55, 0.28);
  --clock-ring: rgba(31, 37, 55, 0.08);
}

/* ---------- Tema scuro ---------- */
html[data-theme='dark'] {
  --ink: #e6e9f2;
  --ink-2: #b6bdcc;
  --muted: #8e97aa;
  --faint: #5f687c;
  --navy: #4450a8;
  --glass: rgba(34, 40, 60, 0.55);
  --glass-border: rgba(255, 255, 255, 0.07);
  --white: rgba(48, 55, 80, 0.8);
  --line: rgba(255, 255, 255, 0.08);
  --good: #3cc58a;
  --warn: #eba24f;
  --bad: #ef6464;
  --info: #6f9cf0;
  --shadow: 0 12px 34px rgba(0, 0, 0, 0.35);
  --shadow-sm: 0 4px 14px rgba(0, 0, 0, 0.25);
  --top-btn-hover: rgba(255, 255, 255, 0.07);
  --top-btn-on: rgba(62, 70, 100, 0.85);
  --badge-ring: #151a28;
  --clock-face: #2c3350;
  --clock-ink: #e6e9f2;
  --clock-tick: rgba(230, 233, 242, 0.3);
  --clock-ring: rgba(255, 255, 255, 0.08);
  --s0: rgba(44, 51, 75, 0.55);
  --s1: rgba(58, 66, 94, 0.78);
  --s2: rgba(72, 81, 114, 0.9);
  --hov: rgba(255, 255, 255, 0.06);
  --edge: rgba(255, 255, 255, 0.07);
  color-scheme: dark;
}

html[data-theme='dark'] body,
html[data-theme='dark'] .lock-overlay {
  background:
    radial-gradient(900px 600px at -10% -10%, rgba(70, 82, 140, 0.28), transparent 60%),
    radial-gradient(800px 600px at 110% 110%, rgba(40, 48, 80, 0.55), transparent 60%),
    linear-gradient(160deg, #161a28 0%, #111420 55%, #141826 100%);
  background-attachment: fixed;
}
html[data-theme='dark'] ::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.14);
}

/* Superfici di base */
html[data-theme='dark'] .sidebar,
html[data-theme='dark'] .row-item,
html[data-theme='dark'] .row-detail,
html[data-theme='dark'] .add-input,
html[data-theme='dark'] .cal,
html[data-theme='dark'] .checks label:not(.on),
html[data-theme='dark'] .stat:not(.navy),
html[data-theme='dark'] .card:not(.navy),
html[data-theme='dark'] .mail-note,
html[data-theme='dark'] .kan-col,
html[data-theme='dark'] .deal-log-item,
html[data-theme='dark'] .ag-row,
html[data-theme='dark'] .bk-cart,
html[data-theme='dark'] .tk-msg,
html[data-theme='dark'] .pay-card,
html[data-theme='dark'] .quote-tab:not(.active),
html[data-theme='dark'] .quote-to,
html[data-theme='dark'] .quote-row,
html[data-theme='dark'] .count:not(.navy):not(.good),
html[data-theme='dark'] .lock-ring {
  background: var(--s0);
  border-color: var(--edge);
  box-shadow: none;
}
html[data-theme='dark'] .sidebar {
  box-shadow: var(--shadow);
}

/* Elementi in rilievo */
html[data-theme='dark'] .pill:not(.navy):not(.soft),
html[data-theme='dark'] .avatar:not(.navy),
html[data-theme='dark'] .btn:not(.dark):not(.danger):not(.good):not(.ghost),
html[data-theme='dark'] .chip:not(.on-navy),
html[data-theme='dark'] input,
html[data-theme='dark'] select,
html[data-theme='dark'] textarea,
html[data-theme='dark'] .clock-card,
html[data-theme='dark'] .pill-file,
html[data-theme='dark'] .pay-bank,
html[data-theme='dark'] .bk-slot:not(.on),
html[data-theme='dark'] .kan-card,
html[data-theme='dark'] .seg.active,
html[data-theme='dark'] .seg.active .count,
html[data-theme='dark'] .sidebar .nav-indicator,
html[data-theme='dark'] .sidebar .nav.active,
html[data-theme='dark'] .mail-folder.active,
html[data-theme='dark'] .mail-item.active,
html[data-theme='dark'] .row-item.active,
html[data-theme='dark'] .table tr.active td,
html[data-theme='dark'] .row-item.clickable:hover,
html[data-theme='dark'] .ag-row:hover,
html[data-theme='dark'] .side-toggle {
  background: var(--s1);
  border-color: var(--edge);
}
html[data-theme='dark'] input,
html[data-theme='dark'] select,
html[data-theme='dark'] textarea,
html[data-theme='dark'] .add-input,
html[data-theme='dark'] .pill:not(.navy),
html[data-theme='dark'] .clock-card {
  box-shadow: none;
  color: var(--ink);
}
html[data-theme='dark'] .side-toggle {
  color: var(--ink-2);
}
html[data-theme='dark'] .btn:not(.dark):not(.danger):not(.good):not(.ghost) {
  color: var(--ink);
}

/* Passaggio del mouse e fuoco */
html[data-theme='dark'] .btn:not(.dark):not(.danger):not(.good):not(.ghost):hover:not(:disabled),
html[data-theme='dark'] .quote-row:hover,
html[data-theme='dark'] .bk-slot:not(.on):hover,
html[data-theme='dark'] input:focus,
html[data-theme='dark'] select:focus,
html[data-theme='dark'] textarea:focus,
html[data-theme='dark'] .add-input:focus-within {
  background: var(--s2);
}
html[data-theme='dark'] input:focus,
html[data-theme='dark'] select:focus,
html[data-theme='dark'] textarea:focus {
  border-color: rgba(140, 155, 230, 0.55);
}
html[data-theme='dark'] .sidebar .nav:hover,
html[data-theme='dark'] .seg:hover:not(.active),
html[data-theme='dark'] .cal-head .nav button:hover,
html[data-theme='dark'] .btn.ghost:hover:not(:disabled),
html[data-theme='dark'] .table tr.clickable:hover td,
html[data-theme='dark'] .mail-folder:hover,
html[data-theme='dark'] .mail-item:hover,
html[data-theme='dark'] .cal-day:hover,
html[data-theme='dark'] .ctx-item:hover {
  background: var(--hov);
}

/* Riempimenti tenui (in chiaro erano grigi scuri trasparenti) */
html[data-theme='dark'] .pill.soft,
html[data-theme='dark'] .add-input .key {
  background: rgba(255, 255, 255, 0.08);
}
html[data-theme='dark'] .cal-day.selected {
  background: rgba(255, 255, 255, 0.12);
}
html[data-theme='dark'] .toggle {
  background: rgba(255, 255, 255, 0.18);
}
html[data-theme='dark'] .tk-msg.staff {
  background: rgba(111, 156, 240, 0.12);
}
html[data-theme='dark'] .nav-group {
  background: rgba(255, 255, 255, 0.1);
}
html[data-theme='dark'] .sidebar .navs:hover {
  scrollbar-color: rgba(255, 255, 255, 0.18) transparent;
}
html[data-theme='dark'] .sidebar .nav .ping {
  border-color: #232941;
}
html[data-theme='dark'] .avatar.on {
  box-shadow: 0 0 0 2px #151a28, 0 0 0 4px var(--good);
}
html[data-theme='dark'] .kan-due.soon {
  color: var(--warn);
}

/* Finestre e menu */
html[data-theme='dark'] .modal-backdrop {
  background: rgba(0, 0, 0, 0.5);
}
html[data-theme='dark'] .modal {
  background: rgba(30, 35, 53, 0.97);
  border-color: var(--edge);
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.55);
}
html[data-theme='dark'] input:focus,
html[data-theme='dark'] select:focus,
html[data-theme='dark'] textarea:focus {
  border-color: rgba(255, 255, 255, 0.35);
  box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.08);
}
html[data-theme='dark'] .more {
  border-top-color: var(--edge);
}
html[data-theme='dark'] .ctx-menu {
  background: rgba(36, 42, 63, 0.98);
  box-shadow: 0 18px 44px rgba(0, 0, 0, 0.5);
}
html[data-theme='dark'] .lock-ring {
  color: var(--ink);
  box-shadow: 0 10px 26px rgba(0, 0, 0, 0.3), 0 0 0 8px rgba(255, 255, 255, 0.05);
}
html[data-theme='dark'] .notice-pill {
  background: rgba(111, 156, 240, 0.14);
}
html[data-theme='dark'] .error {
  background: rgba(239, 100, 100, 0.12);
  border-color: rgba(239, 100, 100, 0.35);
}

/* Elementi blu (pulsante principale, riquadro della sessione): più chiari per staccare dallo sfondo scuro */
html[data-theme='dark'] .btn.dark:hover:not(:disabled) {
  background: #525fc0;
}
html[data-theme='dark'] .card.navy,
html[data-theme='dark'] .stat.navy {
  background: linear-gradient(160deg, #3a4598, #2a3272);
  border-color: rgba(255, 255, 255, 0.08);
}

html[data-theme='dark'] .add-input input {
  background: transparent;
  border: none;
}

/* ---------- Visite ---------- */
.ag-row.visit {
  border-left: 3px solid var(--info);
}
.vs-search {
  position: relative;
}
.vs-results {
  display: flex;
  flex-direction: column;
  margin-top: 6px;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid rgba(31, 37, 55, 0.1);
  background: rgba(255, 255, 255, 0.95);
}
.vs-results button {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  padding: 8px 12px;
  border: none;
  background: none;
  text-align: left;
  cursor: pointer;
  font: inherit;
  color: inherit;
}
.vs-results button:hover {
  background: rgba(31, 37, 55, 0.06);
}
.vs-people {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.vs-kv {
  display: grid;
  grid-template-columns: 70px 1fr;
  gap: 6px 12px;
  margin: 0 0 8px;
  font-size: 14px;
}
.vs-kv dt {
  color: var(--muted);
}
.vs-kv dd {
  margin: 0;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}
.vs-h {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 18px 0 6px;
}
.vs-label {
  font-size: 11.5px;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--muted);
  margin: 12px 0 4px;
}
.vs-summary {
  white-space: pre-wrap;
  line-height: 1.5;
  margin: 0;
}
.vs-ul {
  margin: 0;
  padding-left: 18px;
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.vs-warn {
  color: var(--warn);
}
.vs-ok {
  color: var(--good);
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 8px;
}
.vs-transcript {
  white-space: pre-wrap;
  max-height: 260px;
  overflow: auto;
  padding: 10px 12px;
  border-radius: 12px;
  background: rgba(31, 37, 55, 0.05);
  margin-top: 8px;
}
.vs-actions {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.vs-action {
  display: grid;
  grid-template-columns: auto 110px 1fr 140px auto;
  gap: 6px;
  align-items: center;
}
.vs-action.off {
  opacity: 0.5;
}
.vs-action input,
.vs-action select {
  min-width: 0;
}
.vs-who {
  display: flex;
  gap: 4px;
}
.vs-who .btn {
  width: 30px;
  justify-content: center;
}
@media (max-width: 760px) {
  .vs-action {
    grid-template-columns: auto 1fr;
  }
}

/* Avviso "cose da sistemare": sempre visibile sopra la pagina finché non è tutto a posto */
.setup-bar {
  flex: none;
  margin-bottom: 16px;
  border-radius: var(--r-lg);
  background: var(--white);
  border: 1px solid var(--line);
  border-left: 4px solid var(--warn);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}
.setup-bar.block {
  border-left-color: var(--bad);
}
.setup-head {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 11px 16px;
  border: 0;
  background: transparent;
  color: var(--ink);
  font: inherit;
  font-size: 13px;
  text-align: left;
  cursor: pointer;
}
.setup-head:hover {
  background: var(--hov, rgba(31, 37, 55, 0.04));
}
.setup-bar.block .setup-head > svg:first-child {
  color: var(--bad);
}
.setup-bar.warn .setup-head > svg:first-child {
  color: var(--warn);
}
.setup-title {
  flex: 1;
  min-width: 0;
}
.setup-list {
  border-top: 1px solid var(--line);
  padding: 6px 16px 10px;
  display: grid;
  gap: 4px;
}
.setup-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 7px 0;
}
.setup-item + .setup-item {
  border-top: 1px solid var(--line);
}
.setup-item .dot {
  flex: none;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--warn);
}
.setup-item .dot.bad {
  background: var(--bad);
}
.setup-text {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 1px;
  font-size: 13px;
}
.setup-text .small {
  font-size: 12px;
}
.setup-item .btn {
  flex: none;
}
@media (max-width: 640px) {
  .setup-item {
    flex-wrap: wrap;
  }
  .setup-item .btn {
    margin-left: 21px;
  }
}
