/* =========================================================================
   Susanna Tasks — design system (dark · viola / blu / azzurro)
   ispirato a Taskify / Aligno
   ========================================================================= */
:root {
  /* superfici */
  --bg:        #0b0913;
  --sidebar:   #100c1c;
  --panel:     #110d1e;
  --surface:   #17132a;
  --surface-2: #1f1838;
  --hover:     #241c40;
  --border:    #2a2342;
  --border-soft: rgba(255,255,255,.06);

  /* testo */
  --text:  #ece9f7;
  --text-2:#b8b1d0;
  --muted: #8b84a6;

  /* accenti */
  --violet:    #a78bfa;   /* PRIMARIO — viola chiaro / lilla */
  --violet-2:  #c4b5fd;
  --violet-deep:#7c5cff;  /* secondario (shade precedente) */
  --indigo:    #5b6cff;   /* secondario */
  --sky:       #38bdf8;   /* secondario */
  --butter:    #f2d98c;   /* TERZIARIO — giallo burro */
  --grad:    linear-gradient(135deg, #a78bfa 0%, #7c5cff 100%);
  --grad-sky:linear-gradient(135deg, #a78bfa 0%, #38bdf8 100%);

  /* stati */
  --st-backlog:#8089a3; --st-da_fare:#5b8bff; --st-in_corso:#f5a623;
  --st-in_pausa:#b06ff0; --st-in_analisi:#2fd0c4; --st-fatto:#34d27f;
  /* priorità */
  --pr-alta:#ff5a6a; --pr-media:#f5a623; --pr-bassa:#8089a3;

  /* forma */
  --r:   10px;
  --r-sm:8px;
  --r-lg:12px;
  --shadow:  0 1px 2px rgba(0,0,0,.25), 0 8px 24px rgba(0,0,0,.22);
  --glow:    0 4px 14px rgba(167,139,250,.30);

  /* tipografia */
  --font:   "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --display:"Space Grotesk", var(--font);
  --gap: 16px;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font-family: var(--font);
  color: var(--text);
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  background:
    radial-gradient(1100px 620px at 88% -16%, rgba(124,92,255,.07), transparent 62%),
    var(--bg);
}
a { cursor: pointer; text-decoration: none; color: inherit; }
button { font-family: inherit; cursor: pointer; }
.hidden { display: none !important; }
.spacer { flex: 1; }
::selection { background: rgba(124,92,255,.35); }
.view::-webkit-scrollbar, .column-body::-webkit-scrollbar { width: 9px; height: 9px; }
.view::-webkit-scrollbar-thumb, .column-body::-webkit-scrollbar-thumb { background: var(--border); border-radius: 20px; }

#app { display: flex; height: 100vh; }

/* ============================ SIDEBAR ============================ */
.sidebar {
  width: 250px; background: var(--sidebar); border-right: 1px solid var(--border-soft);
  display: flex; flex-direction: column; padding: 22px 16px; gap: 6px;
}
.brand { display: flex; align-items: center; gap: 12px; padding: 4px 8px 22px; }
.brand-mark {
  width: 40px; height: 40px; border-radius: var(--r-sm); overflow: hidden;
  display: flex; align-items: center; justify-content: center; flex: 0 0 40px;
}
.brand-mark img { width: 100%; height: 100%; object-fit: cover; display: block; }
.brand-text { display: flex; flex-direction: column; line-height: 1.15; }
.brand-text b { font-family: var(--display); font-size: 18px; font-weight: 700; letter-spacing: .2px; }
.brand-text small { color: var(--muted); font-size: 12px; }

.nav-group-title { color: var(--muted); font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .08em; padding: 8px 12px 6px; }
.nav-item {
  display: flex; align-items: center; gap: 12px; padding: 11px 13px; border-radius: 12px;
  color: var(--text-2); font-weight: 500; font-size: 14.5px; transition: .15s; position: relative;
}
.nav-item .nav-ico { font-size: 18px; width: 22px; text-align: center; opacity: .9; }
.nav-item:hover { background: rgba(255,255,255,.04); color: var(--text); }
.nav-item.active { background: var(--grad); color: #fff; box-shadow: var(--glow); }
.nav-item.active .nav-ico { opacity: 1; }

.profile {
  margin-top: auto; display: flex; align-items: center; gap: 11px; padding: 12px;
  background: var(--surface); border: 1px solid var(--border-soft); border-radius: 14px;
}
.profile .avatar { width: 36px; height: 36px; border-radius: 50%; background: var(--grad); color: #fff; display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 13px; }
.profile-text { display: flex; flex-direction: column; line-height: 1.2; }
.profile-text b { font-size: 14px; }
.profile-text small { color: var(--muted); font-size: 12px; }

/* ============================ MAIN ============================ */
.main { flex: 1; display: flex; flex-direction: column; overflow: hidden; }
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 22px 30px 18px;
}
.topbar-left { display: flex; flex-direction: column; gap: 2px; }
.topbar h1 { font-family: var(--display); font-size: 26px; margin: 0; font-weight: 700; letter-spacing: .2px; }
.view-sub { color: var(--muted); font-size: 13.5px; }
.topbar-right { display: flex; align-items: center; gap: 12px; }

.search-wrap { position: relative; display: flex; align-items: center; }
.search-ico { position: absolute; left: 13px; color: var(--muted); font-size: 16px; pointer-events: none; }
#search {
  border: 1px solid var(--border); border-radius: 12px; padding: 11px 14px 11px 36px; width: 240px;
  background: var(--surface); color: var(--text); outline: none; font-size: 14px; transition: .15s;
}
#search::placeholder { color: var(--muted); }
#search:focus { border-color: var(--violet); box-shadow: 0 0 0 4px rgba(124,92,255,.15); }

.btn {
  border: 1px solid var(--border); background: var(--surface); padding: 11px 16px; border-radius: 12px;
  font-weight: 600; color: var(--text); transition: .14s; font-size: 14px; display: inline-flex; align-items: center; gap: 7px;
}
.btn:hover { background: var(--hover); }
.btn-primary { background: var(--grad); border-color: transparent; color: #fff; box-shadow: var(--glow); }
.btn-primary:hover { filter: brightness(1.08); background: var(--grad); }
.btn-primary span { font-size: 17px; line-height: 1; }
.btn-danger { background: transparent; border-color: rgba(255,90,106,.5); color: var(--pr-alta); }
.btn-danger:hover { background: rgba(255,90,106,.12); }
.icon-btn { border: none; background: transparent; font-size: 18px; color: var(--muted); border-radius: 8px; padding: 4px 8px; }
.icon-btn:hover { background: var(--hover); color: var(--text); }

/* ============================ FILTRI ============================ */
.filters { display: flex; gap: 10px; padding: 4px 30px 14px; flex-wrap: wrap; align-items: center; }
.filters select, .filters button.chip {
  border: 1px solid var(--border); border-radius: 11px; padding: 9px 13px; background: var(--surface);
  font-family: inherit; font-size: 13.5px; color: var(--text-2); transition: .14s;
}
.filters select:hover, .filters button.chip:hover { border-color: var(--violet); color: var(--text); }

.view { flex: 1; overflow: auto; padding: 6px 30px 30px; }

/* ============================ KPI ROW ============================ */
.kpi-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: var(--gap); margin-bottom: 24px; }
.kpi-card {
  background: var(--surface); border: 1px solid var(--border-soft); border-radius: var(--r);
  padding: 18px 20px; display: flex; align-items: center; gap: 15px; box-shadow: var(--shadow);
}
.kpi-card .kpi-ico { width: 42px; height: 42px; border-radius: var(--r-sm); display: flex; align-items: center; justify-content: center; font-size: 19px; flex: 0 0 42px; }
.kpi-card .kpi-meta { display: flex; flex-direction: column; }
.kpi-card .kpi-num { font-family: var(--display); font-size: 26px; font-weight: 700; line-height: 1.1; }
.kpi-card .kpi-lbl { color: var(--muted); font-size: 13px; }

/* ============================ KANBAN ============================ */
.board { display: flex; gap: var(--gap); align-items: flex-start; min-height: 100%; padding-bottom: 8px; }
.column {
  background: rgba(255,255,255,.022); border: 1px solid var(--border-soft); border-radius: var(--r-lg);
  width: 312px; flex: 0 0 312px; display: flex; flex-direction: column; max-height: 100%;
}
.column-head { display: flex; align-items: center; gap: 10px; padding: 16px 18px 12px; font-weight: 600; font-size: 14.5px; color: var(--text); }
.column-head .ico { font-size: 16px; }
.column-head .dot { width: 9px; height: 9px; border-radius: 50%; box-shadow: 0 0 10px currentColor; }
.column-head .count {
  margin-left: auto; background: rgba(255,255,255,.07); color: var(--text-2); border-radius: 20px;
  padding: 2px 11px; font-size: 12.5px; font-weight: 700;
}
.column-body { padding: 4px 12px 16px; overflow-y: auto; display: flex; flex-direction: column; gap: 12px; min-height: 48px; }
.column-body.drag-over { background: rgba(124,92,255,.10); border-radius: 14px; }

.card {
  background: var(--surface); border: 1px solid var(--border-soft); border-radius: var(--r);
  padding: 15px 16px; cursor: grab; position: relative; overflow: hidden;
  transition: transform .14s, border-color .14s, box-shadow .14s;
}
.card::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: var(--card-accent, var(--border)); }
.card:hover { border-color: #3a3357; background: var(--surface-2); }
.card:active { cursor: grabbing; }
.card.dragging { opacity: .4; }
.card .card-title { font-weight: 600; line-height: 1.4; margin-bottom: 6px; font-size: 15px; }
.card .card-desc { color: var(--muted); font-size: 13px; line-height: 1.5; margin-bottom: 11px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.card .meta { display: flex; flex-wrap: wrap; gap: 7px; align-items: center; }

.tag {
  font-size: 11.5px; padding: 3px 9px; border-radius: var(--r-sm); font-weight: 500;
  display: inline-flex; gap: 5px; align-items: center;
  background: transparent; border: 1px solid var(--border); color: var(--text-2);
}
.tag.phase  { color: #a6b0e6; }
.tag.client { color: #7fcfa3; }
.tag.due    { color: #d8ab6e; }
.tag.due.overdue { color: #f08896; border-color: rgba(255,90,106,.4); }
.tag.owner { color: var(--violet); border-color: rgba(167,139,250,.45); font-weight: 600; }
.filters button.chip.on { background: var(--violet); border-color: var(--violet); color: #fff; }
.pr, .pill {
  font-size: 11.5px; font-weight: 600; padding: 3px 9px 3px 8px; border-radius: var(--r-sm);
  color: var(--text-2); background: transparent; border: 1px solid var(--border);
  display: inline-flex; gap: 6px; align-items: center;
}
.pr::before, .pill::before {
  content: ""; width: 7px; height: 7px; border-radius: 50%;
  background: var(--dot, var(--muted)); flex: 0 0 7px;
}

/* ============================ LISTA ============================ */
table { width: 100%; border-collapse: separate; border-spacing: 0; background: var(--surface); border: 1px solid var(--border-soft); border-radius: var(--r); overflow: hidden; box-shadow: var(--shadow); }
th, td { text-align: left; padding: 14px 18px; border-bottom: 1px solid var(--border-soft); }
th { font-size: 11.5px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); cursor: pointer; font-weight: 600; background: rgba(255,255,255,.02); }
tbody tr { transition: background .12s; }
tbody tr:hover { background: rgba(124,92,255,.07); cursor: pointer; }
tbody tr:last-child td { border-bottom: none; }

/* ============================ CLIENTI ============================ */
.client-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: var(--gap); }
.client-card { background: var(--surface); border: 1px solid var(--border-soft); border-radius: var(--r); box-shadow: var(--shadow); padding: 20px; transition: border-color .14s; position: relative; overflow: hidden; }
.client-card:hover { border-color: #3a3357; }
.client-card h3 { margin: 6px 0 4px; font-size: 17px; font-weight: 600; }
.client-card .sub { color: var(--muted); font-size: 12.5px; margin-bottom: 12px; }
.client-card .desc { font-size: 13.5px; color: var(--text-2); margin-bottom: 16px; }
.progress { height: 7px; border-radius: 20px; background: rgba(255,255,255,.07); overflow: hidden; margin-bottom: 14px; }
.progress > span { display: block; height: 100%; background: var(--grad); border-radius: 20px; }
.mini-stats { display: flex; gap: 8px; flex-wrap: wrap; }
.mini-stat { font-size: 12px; background: rgba(255,255,255,.05); border-radius: 9px; padding: 5px 10px; font-weight: 600; color: var(--text-2); }

/* ============================ NOTE ============================ */
.notes-toolbar { display: flex; gap: 12px; align-items: center; margin-bottom: 20px; flex-wrap: wrap; }
.notes-toolbar select { border: 1px solid var(--border); border-radius: 11px; padding: 9px 13px; background: var(--surface); color: var(--text-2); font-family: inherit; font-size: 13.5px; }
.notes-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: var(--gap); }
.note-card { background: var(--surface); border: 1px solid var(--border-soft); border-radius: var(--r); box-shadow: var(--shadow); padding: 20px; transition: border-color .14s; }
.note-card:hover { border-color: #3a3357; }
.note-card h3 { margin: 4px 0 8px; font-size: 16px; font-weight: 600; }
.note-card .cat { font-size: 10.5px; color: var(--butter); font-weight: 700; text-transform: uppercase; letter-spacing: .06em; }
.note-card .content { font-size: 13.5px; color: var(--text-2); white-space: pre-wrap; line-height: 1.6; }

/* board libera (post-it) */
.board-hint { color: var(--muted); font-size: 12px; }
.note-board { position: relative; }
.board-note {
  position: absolute; border-radius: 4px; padding: 12px 14px 16px; color: #2b2740;
  box-shadow: 0 6px 16px rgba(0,0,0,.35); display: flex; flex-direction: column; gap: 4px;
  cursor: grab; overflow: hidden; user-select: none;
}
.board-note.dragging { box-shadow: 0 16px 34px rgba(0,0,0,.5); z-index: 10; cursor: grabbing; }
.board-note .bn-cat { font-size: 10px; font-weight: 800; text-transform: uppercase; letter-spacing: .04em; color: rgba(0,0,0,.45); }
.board-note .bn-title { font-weight: 700; font-size: 14px; line-height: 1.25; }
.board-note .bn-content { font-size: 12.5px; line-height: 1.45; white-space: pre-wrap; overflow: hidden; flex: 1; }
.board-note .bn-palette { position: absolute; top: 6px; right: 8px; display: flex; gap: 3px; opacity: 0; transition: opacity .12s; }
.board-note:hover .bn-palette { opacity: 1; }
.bn-swatch { width: 13px; height: 13px; border-radius: 50%; border: 1px solid rgba(0,0,0,.25); cursor: pointer; padding: 0; }
.bn-resize { position: absolute; right: 0; bottom: 0; width: 16px; height: 16px; cursor: nwse-resize; }
.bn-resize::after { content: ""; position: absolute; right: 3px; bottom: 3px; width: 7px; height: 7px; border-right: 2px solid rgba(0,0,0,.3); border-bottom: 2px solid rgba(0,0,0,.3); }
/* zona archivio note (fissa in alto a destra) */
.note-archive-zone {
  position: fixed; top: 96px; right: 40px; z-index: 30; display: flex; align-items: center; gap: 8px;
  padding: 12px 16px; border-radius: 12px; cursor: pointer;
  background: var(--surface); border: 1.5px dashed var(--border); color: var(--text-2);
  font-weight: 600; font-size: 13px; transition: .14s;
}
.note-archive-zone:hover { border-color: var(--violet); color: var(--text); }
.note-archive-zone.over { border-color: var(--violet); border-style: solid; background: rgba(124,92,255,.18); color: var(--text); transform: scale(1.05); }
.note-archive-zone .naz-ico { font-size: 16px; }
.note-archive-zone .naz-count { background: rgba(255,255,255,.1); border-radius: 20px; padding: 1px 9px; font-size: 12px; }
.note-card-foot { margin-top: 12px; display: flex; justify-content: flex-end; }
.note-card-foot .btn { padding: 6px 12px; font-size: 12.5px; }

/* Granola */
.gr-section { margin-bottom: 28px; }
.gr-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(330px, 1fr)); gap: var(--gap); }
.gr-card { display: flex; align-items: flex-start; gap: 12px; background: var(--surface); border: 1px solid var(--border-soft); border-radius: var(--r); padding: 16px; box-shadow: var(--shadow); }
.gr-ico { font-size: 22px; flex: 0 0 auto; line-height: 1.2; }
.gr-body { flex: 1; min-width: 0; }
.gr-title { font-weight: 600; font-size: 14.5px; word-break: break-word; }
.gr-meta { color: var(--muted); font-size: 12px; margin-top: 3px; }
.gr-actions { display: flex; flex-direction: column; gap: 6px; flex: 0 0 auto; }
.gr-btn { padding: 6px 12px; font-size: 12px; text-align: center; }
.gr-empty { color: var(--muted); font-size: 13px; opacity: .6; padding: 4px 2px; }

/* ============================ SCADENZE ============================ */
.scadenze-list { display: flex; flex-direction: column; gap: 28px; }
.scad-group-head { display: flex; align-items: center; gap: 11px; margin: 0 0 14px; font-size: 16px; font-weight: 700; font-family: var(--display); }
.scad-group-head .count { background: rgba(255,255,255,.07); color: var(--muted); border-radius: 20px; padding: 2px 11px; font-size: 12.5px; font-weight: 700; }
.scad-group .column-body { padding: 0; max-width: 600px; gap: 12px; }
.scad-overdue .scad-group-head { color: var(--pr-alta); }

/* calendario settimanale */
.week-head { font-family: var(--display); font-weight: 700; font-size: 15px; margin-bottom: 16px; color: var(--text-2); }
.week-grid { display: grid; grid-template-columns: repeat(7, minmax(150px, 1fr)); gap: 10px; align-items: start; }
.day-col { background: rgba(124,92,255,.05); border: 1px solid var(--border-soft); border-radius: var(--r); min-height: 240px; display: flex; flex-direction: column; }
.day-col.today { border-color: var(--violet); box-shadow: 0 0 0 1px var(--violet); }
.day-head { display: flex; align-items: baseline; justify-content: space-between; padding: 10px 12px; border-bottom: 1px solid var(--border-soft); }
.day-head .dow { font-size: 11.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.day-head .dnum { font-family: var(--display); font-weight: 700; font-size: 16px; }
.day-col.today .day-head .dnum, .day-col.today .day-head .dow { color: var(--violet); }
.day-body { padding: 8px; display: flex; flex-direction: column; gap: 7px; }
.day-task { background: var(--surface); border: 1px solid var(--border-soft); border-left: 3px solid var(--card-accent, var(--border)); border-radius: 8px; padding: 7px 9px; cursor: pointer; transition: border-color .12s; }
.day-task:hover { border-color: var(--violet); }
.day-task .dt-title { display: block; font-size: 12.5px; font-weight: 600; line-height: 1.35; }
.day-task .dt-client { display: block; font-size: 11px; color: var(--muted); margin-top: 2px; }
.day-task.done { opacity: .5; }
.day-task.done .dt-title { text-decoration: line-through; }
.day-empty { color: var(--muted); font-size: 12px; text-align: center; padding: 10px 0; opacity: .45; }
/* calendari per-utente (admin) */
.user-cal { margin-bottom: 28px; }
.user-cal-head { display: flex; align-items: center; gap: 9px; margin: 0 0 12px; font-family: var(--display); font-weight: 700; font-size: 15px; }
.user-cal-head .udot { width: 11px; height: 11px; border-radius: 50%; background: var(--user-accent); box-shadow: 0 0 10px var(--user-accent); }
.user-cal-head .count { background: rgba(255,255,255,.07); color: var(--muted); border-radius: 20px; padding: 2px 11px; font-size: 12.5px; font-weight: 700; }
.user-cal .day-col { background: var(--user-tint); }
.user-cal .day-col.today { border-color: var(--user-accent); box-shadow: 0 0 0 1px var(--user-accent); }
.user-cal .day-col.today .day-head .dnum, .user-cal .day-col.today .day-head .dow { color: var(--user-accent); }

/* ============================ EMPTY ============================ */
.empty { text-align: center; color: var(--muted); padding: 70px 20px; }
.empty button { margin-top: 16px; }

/* ============================ MODALE ============================ */
.modal-overlay { position: fixed; inset: 0; background: rgba(6,4,14,.62); backdrop-filter: blur(6px); display: flex; align-items: center; justify-content: center; z-index: 50; }
.modal { background: var(--surface); border: 1px solid var(--border); border-radius: 20px; width: 560px; max-width: 92vw; max-height: 90vh; overflow: auto; box-shadow: 0 30px 80px rgba(0,0,0,.55); }
.modal-lg { width: 680px; }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 20px 24px; border-bottom: 1px solid var(--border-soft); }
.modal-head h2 { margin: 0; font-size: 19px; font-family: var(--display); font-weight: 600; }
.modal-body { padding: 22px 24px; display: flex; flex-direction: column; gap: 16px; }
.modal-body label { display: flex; flex-direction: column; gap: 7px; font-size: 12px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.modal-body input, .modal-body textarea, .modal-body select {
  border: 1px solid var(--border); border-radius: 11px; padding: 11px 13px; font-size: 14.5px;
  color: var(--text); background: var(--surface-2); font-family: inherit; transition: .14s;
  width: 100%; min-width: 0;
}
.modal-body .grid2 > label { min-width: 0; }
.modal-body input:focus, .modal-body textarea:focus, .modal-body select:focus { outline: none; border-color: var(--violet); box-shadow: 0 0 0 4px rgba(124,92,255,.15); }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.modal-foot { display: flex; align-items: center; gap: 10px; padding-top: 8px; }

/* ============================ PROJECT DETAIL ============================ */
.pd-section { margin-bottom: 22px; }
.pd-section h4 { margin: 0 0 11px; font-size: 12px; text-transform: uppercase; color: var(--muted); font-weight: 700; letter-spacing: .05em; }
.member-row { display: flex; align-items: center; gap: 12px; padding: 11px 0; border-bottom: 1px solid var(--border-soft); }
.member-row .avatar { width: 34px; height: 34px; border-radius: 50%; background: var(--grad); color: #fff; display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 13px; flex: 0 0 34px; }
.member-row .hrs { margin-left: auto; font-weight: 700; }
.badge-source { font-size: 10px; padding: 2px 7px; border-radius: 7px; background: rgba(255,255,255,.07); color: var(--muted); }
.note-banner { background: rgba(124,92,255,.1); border: 1px solid rgba(124,92,255,.3); color: #c9b8ff; padding: 12px 14px; border-radius: 12px; font-size: 13px; }

/* ============================ ARCHIVIO ============================ */
.arch-summary { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 24px; padding: 16px 20px; background: var(--surface); border: 1px solid var(--border-soft); border-radius: var(--r); }
.arch-count { color: var(--text-2); font-size: 14px; }
.arch-count b { font-family: var(--display); font-size: 22px; color: var(--text); margin-right: 4px; }
.arch-card { background: var(--surface); border: 1px solid var(--border-soft); border-radius: var(--r); padding: 16px; display: flex; flex-direction: column; gap: 8px; align-items: flex-start; transition: border-color .14s; }
.arch-card:hover { border-color: #3a3357; }
.arch-card .arch-title { font-weight: 600; font-size: 14.5px; line-height: 1.4; }
.arch-card .arch-desc { color: var(--muted); font-size: 13px; line-height: 1.5; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.arch-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; width: 100%; margin-top: 4px; }
.arch-date { color: var(--muted); font-size: 12px; }
.btn.arch-restore { padding: 6px 12px; font-size: 12.5px; }

/* ============================ CLIENTI: dashboard ============================ */
.seg-toggle { display: inline-flex; background: var(--surface); border: 1px solid var(--border-soft); border-radius: 11px; padding: 4px; gap: 4px; margin-bottom: 22px; }
.seg { border: none; background: transparent; color: var(--text-2); padding: 8px 16px; border-radius: 8px; font-weight: 600; font-size: 13.5px; transition: .14s; }
.seg:hover { color: var(--text); }
.seg.active { background: var(--grad); color: #fff; box-shadow: var(--glow); }

.dash-groups { display: flex; flex-direction: column; gap: 26px; }
.dash-group-head { display: flex; align-items: center; gap: 11px; margin: 0 0 14px; font-size: 15px; font-weight: 700; font-family: var(--display); text-transform: capitalize; }
.dash-group-head .count { background: rgba(255,255,255,.07); color: var(--muted); border-radius: 20px; padding: 2px 11px; font-size: 12.5px; font-weight: 700; }

.client-card.has-accent::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: var(--card-accent); }
.cc-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.cc-head h3 { margin: 0; }
.cc-foot { color: var(--muted); font-size: 12.5px; margin-top: 4px; }
.subprojects { margin-top: 12px; padding-top: 10px; border-top: 1px solid var(--border-soft); display: flex; flex-direction: column; gap: 3px; }
.subproject-row { display: flex; align-items: center; gap: 8px; padding: 7px 10px; border-radius: 8px; border-left: 2px solid var(--card-accent, var(--border)); cursor: pointer; transition: background .12s; }
.subproject-row:hover { background: var(--surface-2); }
.subproject-row .sp-name { font-size: 13.5px; color: var(--text-2); }
.subproject-row .sp-meta { margin-left: auto; font-size: 12px; color: var(--muted); }
.client-card h3 { font-weight: 700; }

/* barra azioni + filtri a chip (Tutti i clienti) */
.cc-actions { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.cc-filters { display: flex; flex-direction: column; gap: 8px; margin-bottom: 22px; }
.chip-group { display: flex; align-items: center; gap: 7px; flex-wrap: wrap; }
.chip-label { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); width: 96px; flex: 0 0 96px; }
.fchip {
  border: 1px solid var(--border); background: var(--surface); color: var(--text-2);
  border-radius: 8px; padding: 5px 11px; font-size: 12.5px; font-weight: 500;
  display: inline-flex; align-items: center; gap: 7px; transition: .12s;
}
.fchip:hover { border-color: var(--violet); color: var(--text); }
.fchip.has-dot::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--chip-dot, var(--muted)); }
.fchip.on { background: var(--violet); border-color: var(--violet); color: #fff; }
.fchip.on.has-dot::before { box-shadow: 0 0 0 2px rgba(255,255,255,.5); }

/* pulsante "escludi" sul KPI Sospesi */
.kpi-card { position: relative; }
.kpi-action {
  position: absolute; top: 10px; right: 12px; border: 1px solid var(--border-soft);
  background: transparent; color: var(--muted); opacity: .5; border-radius: 7px;
  padding: 3px 9px; font-size: 11px; font-weight: 600; transition: .12s;
}
.kpi-action:hover { opacity: 1; border-color: var(--border); color: var(--text); }
.kpi-action.on { opacity: 1; background: var(--violet); border-color: var(--violet); color: #fff; }

/* header ordinabili + nome in grassetto */
.sheet th.sortable { cursor: pointer; user-select: none; }
.sheet th.sortable:hover { color: var(--text); }
.cell-name { font-weight: 700; font-size: 14.5px; }
.client-card .meta { display: flex; flex-wrap: wrap; gap: 7px; align-items: center; margin: 4px 0 2px; }

/* pallino colore + mini-palette */
.color-dot { position: relative; flex: 0 0 auto; }
.color-dot-btn { width: 20px; height: 20px; border-radius: 50%; border: 2px solid var(--border); padding: 0; cursor: pointer; }
.color-dot-btn:hover { border-color: var(--text-2); }
.swatches { position: absolute; right: 0; top: 26px; z-index: 20; display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; background: var(--surface-2); border: 1px solid var(--border); border-radius: 12px; padding: 8px; box-shadow: var(--shadow); }
.swatch { width: 26px; height: 26px; border-radius: 7px; border: 2px solid transparent; cursor: pointer; padding: 0; }
.swatch:hover { transform: scale(1.08); }
.swatch.sel { border-color: #fff; box-shadow: 0 0 0 2px var(--violet); }
.swatch.none { background: var(--surface); color: var(--muted); display: flex; align-items: center; justify-content: center; font-size: 14px; border: 1px dashed var(--border); }

.color-row { display: flex; flex-wrap: wrap; gap: 8px; }
.pd-edit { border-bottom: 1px solid var(--border-soft); padding-bottom: 18px; margin-bottom: 18px; }
.pd-edit .grid2 { margin-bottom: 14px; }
.pd-edit label { display: flex; flex-direction: column; gap: 7px; font-size: 12px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; margin-bottom: 14px; }
.pd-edit input, .pd-edit textarea, .pd-edit select { border: 1px solid var(--border); border-radius: 11px; padding: 10px 12px; font-size: 14.5px; color: var(--text); background: var(--surface-2); font-family: inherit; }
.pd-edit input:focus, .pd-edit textarea:focus, .pd-edit select:focus { outline: none; border-color: var(--violet); }

/* sub-toggle piccolo (Cards / Lista) */
.seg-toggle.small { margin-bottom: 0; padding: 3px; }
.seg-toggle.small .seg { padding: 6px 13px; font-size: 12.5px; }

/* ============================ LISTA STILE FOGLIO ============================ */
.sheet { table-layout: auto; }
.sheet th { cursor: default; white-space: nowrap; }
.sheet td { padding: 3px 5px; border-bottom: 1px solid var(--border-soft); }
.sheet tbody tr:nth-child(odd)  { background: var(--surface); }
.sheet tbody tr:nth-child(even) { background: var(--surface-2); }
.sheet tbody tr:hover { background: rgba(167,139,250,.09); }
.sheet tbody tr.dragging { opacity: .5; }
.cell-edit {
  width: 100%; min-width: 84px; background: transparent; border: 1px solid transparent;
  border-radius: 7px; padding: 7px 8px; color: var(--text); font-family: inherit; font-size: 13.5px;
}
.cell-edit:hover { border-color: var(--border); }
.cell-edit:focus { outline: none; border-color: var(--violet); background: var(--bg);
  box-shadow: 0 0 0 3px rgba(167,139,250,.15); }
select.cell-edit { cursor: pointer; }
.drag-col { width: 28px; text-align: center; color: var(--muted); cursor: grab; user-select: none; }
td.drag-col { font-size: 15px; }
/* separatori di cella tenui + colonne ridimensionabili */
.sheet th, .sheet td { border-right: 1px solid var(--border-soft); }
.sheet th:last-child, .sheet td:last-child { border-right: none; }
.sheet th { position: relative; }
.col-resizer { position: absolute; top: 0; right: -1px; width: 8px; height: 100%; cursor: col-resize; }
.col-resizer:hover { background: var(--violet); opacity: .5; }

/* ============================ TEMA GIORNO ============================ */
.mode-toggle { font-size: 17px; }
/* login */
.login-overlay { position: fixed; inset: 0; z-index: 100; display: flex; align-items: center; justify-content: center;
  background: radial-gradient(1100px 620px at 50% -10%, rgba(124,92,255,.18), transparent 60%), var(--bg); }
.login-card { background: var(--surface); border: 1px solid var(--border); border-radius: 18px; padding: 30px 28px; width: 340px; display: flex; flex-direction: column; gap: 14px; box-shadow: var(--shadow); }
.login-brand { display: flex; align-items: center; gap: 12px; margin-bottom: 6px; }
.login-brand img { width: 40px; height: 40px; border-radius: var(--r-sm); }
.login-brand span { font-family: var(--display); font-weight: 700; font-size: 22px; }
.login-card label { display: flex; flex-direction: column; gap: 6px; font-size: 12px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.login-card input { border: 1px solid var(--border); border-radius: 11px; padding: 11px 13px; font-size: 14.5px; background: var(--surface-2); color: var(--text); }
.login-card input:focus { outline: none; border-color: var(--violet); box-shadow: 0 0 0 4px rgba(124,92,255,.15); }
.login-card .btn-primary { margin-top: 6px; justify-content: center; }
.login-error { color: var(--pr-alta); font-size: 13px; min-height: 16px; }
.logout-btn { margin-left: auto; background: transparent; border: 1px solid var(--border-soft); color: var(--muted); border-radius: 8px; padding: 5px 10px; font-size: 12px; font-weight: 600; cursor: pointer; }
.logout-btn:hover { color: var(--text); border-color: var(--border); }

.admin-toggle { background: var(--surface); border: 1px solid var(--border); color: var(--text-2); border-radius: 10px; padding: 9px 14px; font-family: inherit; font-weight: 600; font-size: 13px; cursor: pointer; transition: .14s; }
.admin-toggle:hover { border-color: var(--violet); color: var(--text); }
.admin-toggle.on { background: var(--grad); border-color: transparent; color: #fff; box-shadow: var(--glow); }
.sheet .row-add { width: 34px; text-align: center; }
.sheet .row-add button { width: 24px; height: 24px; border-radius: 7px; border: 1px solid var(--border); background: transparent; color: var(--violet); font-size: 15px; line-height: 1; cursor: pointer; }
.sheet .row-add button:hover { background: var(--violet); color: #fff; border-color: var(--violet); }
body[data-mode="day"] {
  --bg: #f1ecfa;
  --sidebar: #ebe4f7;
  --panel: #ede7f8;
  --surface: #faf8fe;
  --surface-2: #f3eefb;
  --hover: #ece4f8;
  --border: #ddd3ef;
  --border-soft: rgba(20,12,40,.08);
  --text: #1c1730;
  --text-2: #4a4266;
  --muted: #6f6790;
  --shadow: 0 1px 2px rgba(20,12,40,.06), 0 8px 22px rgba(20,12,40,.09);
  --glow: 0 4px 14px rgba(124,92,255,.22);
  --butter-ink: #8a6d1f;
}
body[data-mode="day"] {
  background:
    radial-gradient(1100px 620px at 88% -16%, rgba(124,92,255,.10), transparent 62%),
    var(--bg);
}
/* tinte pensate per fondo scuro → versione per fondo chiaro */
body[data-mode="day"] .column { background: rgba(20,12,40,.03); }
body[data-mode="day"] .count { background: rgba(20,12,40,.06) !important; color: var(--muted); }
body[data-mode="day"] .mini-stat,
body[data-mode="day"] .badge-source { background: rgba(20,12,40,.06); }
body[data-mode="day"] .nav-item:hover { background: rgba(20,12,40,.05); }
body[data-mode="day"] th { background: rgba(20,12,40,.03); }
body[data-mode="day"] .card:hover,
body[data-mode="day"] .client-card:hover,
body[data-mode="day"] .note-card:hover,
body[data-mode="day"] .arch-card:hover { border-color: #c7bce6; }
body[data-mode="day"] tbody tr:hover,
body[data-mode="day"] .sheet tbody tr:hover { background: rgba(124,92,255,.12); }
/* testo accento leggibile su chiaro */
body[data-mode="day"] .note-card .cat { color: var(--butter-ink); }
body[data-mode="day"] .tag.phase  { color: #4a4dc4; }
body[data-mode="day"] .tag.client { color: #1f8a55; }
body[data-mode="day"] .tag.due    { color: #9a6a12; }
body[data-mode="day"] .tag.due.overdue { color: #c0303f; }
body[data-mode="day"] .kpi-num { color: var(--text) !important; }
body[data-mode="day"] .swatch.sel { border-color: #1c1730; }
body[data-mode="day"] .note-banner { background: rgba(124,92,255,.1); border-color: rgba(124,92,255,.3); color: #5b3fc0; }
