/* fastERA CRM — interfaccia ordinata in stile ERP, colori fastERA */
:root {
  --brand: #0e3a73;          /* blu fastERA (modificabile da Configurazione › Marchio) */
  --accent: #f39200;         /* arancio fastERA */
  --brand-ink: #ffffff;
  --bg: #f4f5f7;
  --surface: #ffffff;
  --surface-2: #f9fafb;
  --border: #d8dadd;
  --border-soft: #e7e9ec;
  --text: #1f2933;
  --text-2: #4b5563;
  --muted: #8a94a3;
  --link: color-mix(in srgb, var(--brand) 85%, #2a7fff);
  --hover: #f1f3f5;
  --success: #28a745;
  --warning: #e99d00;
  --danger: #d44c59;
  --info: #17a2b8;
  --radius: 4px;
  --shadow: 0 2px 10px rgba(15, 23, 42, .12);
  --shadow-lg: 0 10px 30px rgba(15, 23, 42, .22);
  --nav-h: 46px;
  font-size: 13.5px;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font-family: "Roboto", "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
  color: var(--text); background: var(--bg); line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; }
button, input, select, textarea { font: inherit; color: inherit; }
.ic { flex: none; vertical-align: middle; }
.muted { color: var(--muted); }
.hidden { display: none !important; }
h1, h2, h3, h4 { margin: 0; font-weight: 600; }

/* ---------- Pulsanti ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 6px; height: 31px; padding: 0 12px;
  border: 1px solid transparent; border-radius: var(--radius); cursor: pointer;
  font-weight: 500; white-space: nowrap; background: none; line-height: 1;
}
.btn-primary { background: var(--brand); color: var(--brand-ink); border-color: var(--brand); }
.btn-primary:hover { background: color-mix(in srgb, var(--brand) 85%, #000); }
.btn-secondary { background: #e7e9ed; color: var(--text); border-color: #e7e9ed; }
.btn-secondary:hover { background: #dadde2; }
.btn-light { background: var(--surface); border-color: var(--border); color: var(--text); }
.btn-light:hover { background: var(--hover); }
.btn-success { background: var(--success); color: #fff; }
.btn-success:hover { filter: brightness(.93); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { filter: brightness(.93); }
.btn-link { color: var(--link); padding: 0 6px; }
.btn-link:hover { text-decoration: underline; }
.btn-sm { height: 26px; padding: 0 9px; font-size: .92rem; }
.btn:disabled { opacity: .55; cursor: default; }
.btn-icon {
  display: inline-flex; align-items: center; justify-content: center; width: 30px; height: 30px;
  border: 0; background: none; border-radius: var(--radius); cursor: pointer; color: var(--text-2);
}
.btn-icon:hover { background: var(--hover); color: var(--text); }

/* ---------- Barra di navigazione ---------- */
.navbar {
  position: sticky; top: 0; z-index: 50; height: var(--nav-h); display: flex; align-items: center;
  background: var(--brand); color: var(--brand-ink); padding: 0 8px 0 4px; gap: 2px;
  border-bottom: 3px solid var(--accent);
}
.navbar a, .navbar button { color: inherit; }
.nav-apps { width: 40px; height: 40px; display: flex; align-items: center; justify-content: center; border-radius: var(--radius); }
.nav-brand { display: flex; align-items: center; gap: 10px; padding: 0 10px 0 4px; height: 100%; text-decoration: none !important; }
.nav-brand .app-name { font-size: 1.08rem; font-weight: 600; opacity: .95; padding-left: 10px; border-left: 1px solid rgba(255,255,255,.35); }
.nav-menu { display: flex; align-items: stretch; height: 100%; }
.nav-item { position: relative; display: flex; align-items: center; }
.nav-item > a, .nav-item > button {
  display: flex; align-items: center; gap: 4px; height: 100%; padding: 0 11px; border: 0; background: none;
  cursor: pointer; font-weight: 400; text-decoration: none !important; opacity: .92;
}
.nav-item > a:hover, .nav-item > button:hover, .nav-item.open > button, .nav-apps:hover, .nav-user:hover { background: rgba(255,255,255,.12); opacity: 1; }
.nav-item > a.active { box-shadow: inset 0 -3px 0 var(--accent); opacity: 1; font-weight: 500; }
.nav-right { margin-left: auto; display: flex; align-items: center; gap: 4px; height: 100%; }
.nav-act { position: relative; width: 38px; height: 38px; display: flex; align-items: center; justify-content: center; border-radius: var(--radius); border: 0; background: none; cursor: pointer; }
.nav-act:hover { background: rgba(255,255,255,.12); }
.badge-count { position: absolute; top: 3px; right: 1px; min-width: 17px; height: 17px; padding: 0 4px; border-radius: 9px; background: var(--accent); color: #fff; font-size: 10.5px; font-weight: 700; line-height: 17px; text-align: center; }
.nav-user { display: flex; align-items: center; gap: 8px; height: 38px; padding: 0 8px; border: 0; background: none; cursor: pointer; border-radius: var(--radius); }
.nav-user .avatar { border: 1.5px solid rgba(255,255,255,.7); }

.dropdown {
  position: absolute; top: calc(100% + 2px); left: 0; min-width: 210px; background: var(--surface); color: var(--text);
  border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 5px 0; z-index: 100;
}
.dropdown.right { left: auto; right: 0; }
.dropdown a, .dropdown button.dd-item {
  display: flex; align-items: center; gap: 9px; width: 100%; padding: 7px 18px; border: 0; background: none; text-align: left;
  color: var(--text) !important; cursor: pointer; text-decoration: none !important; font-weight: 400;
}
.dropdown a:hover, .dropdown button.dd-item:hover { background: var(--hover); }
.dropdown .dd-header { padding: 7px 18px 3px; font-size: .8rem; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.dropdown hr { border: 0; border-top: 1px solid var(--border-soft); margin: 5px 0; }
.dropdown .selected::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--brand); margin-left: -12px; margin-right: 0; }

/* Menu app (icona a griglia) */
.apps-panel { position: fixed; inset: var(--nav-h) 0 0 0; background: linear-gradient(160deg, color-mix(in srgb, var(--brand) 92%, #000), var(--brand) 55%, color-mix(in srgb, var(--brand) 70%, var(--accent))); z-index: 60; padding: 60px 20px; overflow: auto; }
.apps-grid { max-width: 760px; margin: 0 auto; display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 26px 14px; }
.app-tile { display: flex; flex-direction: column; align-items: center; gap: 10px; color: #fff !important; text-decoration: none !important; padding: 10px; border-radius: 8px; }
.app-tile:hover { background: rgba(255,255,255,.08); }
.app-tile .tile-ic { width: 70px; height: 70px; border-radius: 14px; background: #fff; color: var(--brand); display: flex; align-items: center; justify-content: center; box-shadow: 0 6px 16px rgba(0,0,0,.25); }
.app-tile:nth-child(2n) .tile-ic { color: var(--accent); }

/* ---------- Pannello di controllo (breadcrumb, ricerca, viste) ---------- */
.control-panel {
  background: var(--surface); border-bottom: 1px solid var(--border); padding: 10px 16px;
  display: grid; grid-template-columns: minmax(0, 1fr) minmax(280px, 560px) minmax(0, 1fr); gap: 10px 16px; align-items: center;
}
.cp-left { display: flex; align-items: center; gap: 10px; min-width: 0; }
.cp-right { display: flex; align-items: center; gap: 10px; justify-content: flex-end; }
.breadcrumb { display: flex; align-items: center; gap: 6px; min-width: 0; font-size: 1.1rem; }
.breadcrumb a { color: var(--link); white-space: nowrap; }
.breadcrumb .sep { color: var(--muted); }
.breadcrumb .current { font-weight: 500; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dirty-actions { display: inline-flex; gap: 2px; }
.dirty-actions .btn-icon { color: var(--brand); }
.view-switcher { display: inline-flex; border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.view-switcher button { width: 34px; height: 30px; border: 0; background: var(--surface); color: var(--text-2); cursor: pointer; display: flex; align-items: center; justify-content: center; }
.view-switcher button + button { border-left: 1px solid var(--border); }
.view-switcher button.active { background: color-mix(in srgb, var(--brand) 12%, #fff); color: var(--brand); }
.pager { color: var(--text-2); font-size: .93rem; white-space: nowrap; }

/* Barra di ricerca a faccette */
.searchbox { position: relative; }
.search-input {
  display: flex; align-items: center; flex-wrap: wrap; gap: 4px; min-height: 32px; padding: 2px 4px 2px 8px;
  border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface);
}
.search-input:focus-within { border-color: var(--brand); box-shadow: 0 0 0 2px color-mix(in srgb, var(--brand) 18%, transparent); }
.search-input input { flex: 1; min-width: 90px; border: 0; outline: 0; height: 26px; background: none; }
.facet { display: inline-flex; align-items: center; height: 22px; border-radius: 3px; overflow: hidden; background: #e9ecef; font-size: .9rem; max-width: 100%; }
.facet .facet-label { background: var(--brand); color: #fff; height: 100%; display: flex; align-items: center; padding: 0 6px; }
.facet .facet-label.fl-filter { background: #6b7a99; }
.facet .facet-label.fl-group { background: var(--accent); }
.facet .facet-val { padding: 0 6px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.facet button { border: 0; background: none; cursor: pointer; padding: 0 4px; height: 100%; display: flex; align-items: center; color: var(--text-2); }
.search-toggle { border: 0; border-left: 1px solid var(--border-soft); background: none; height: 26px; width: 30px; cursor: pointer; display: flex; align-items: center; justify-content: center; color: var(--text-2); }
.search-auto { position: absolute; top: calc(100% + 2px); left: 0; right: 0; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); z-index: 40; padding: 4px 0; }
.search-auto .opt { padding: 6px 12px; cursor: pointer; }
.search-auto .opt.active, .search-auto .opt:hover { background: var(--hover); }
.search-panel { position: absolute; top: calc(100% + 2px); right: 0; width: min(640px, 96vw); background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); z-index: 40; display: grid; grid-template-columns: 1fr 1fr; padding: 10px 0; }
.search-panel .sp-col { padding: 0 6px; }
.search-panel .sp-col + .sp-col { border-left: 1px solid var(--border-soft); }
.search-panel h5 { display: flex; align-items: center; gap: 7px; margin: 0 0 4px; padding: 4px 10px; font-size: .95rem; }
.search-panel h5 .ic { color: #6b7a99; }
.search-panel .sp-col:last-child h5 .ic { color: var(--accent); }
.search-panel .sp-opt { display: flex; align-items: center; gap: 8px; padding: 5px 10px 5px 32px; cursor: pointer; border-radius: 3px; position: relative; }
.search-panel .sp-opt:hover { background: var(--hover); }
.search-panel .sp-opt.on::before { content: ""; position: absolute; left: 14px; width: 9px; height: 5px; border-left: 2px solid var(--brand); border-bottom: 2px solid var(--brand); transform: rotate(-45deg); top: 10px; }
.search-panel hr { border: 0; border-top: 1px solid var(--border-soft); margin: 4px 8px; }

/* ---------- Contenuto ---------- */
.content { height: calc(100vh - var(--nav-h) - 3px - var(--cp-h, 53px)); overflow: auto; }
.content.white { background: var(--surface); }
.loading { padding: 40px; text-align: center; color: var(--muted); }
.empty-state { max-width: 460px; margin: 70px auto; text-align: center; color: var(--text-2); }
.empty-state .ic { color: var(--accent); margin-bottom: 10px; }
.empty-state h3 { font-size: 1.3rem; margin-bottom: 8px; color: var(--text); }

/* ---------- Kanban ---------- */
.kanban { display: flex; align-items: flex-start; gap: 16px; padding: 14px 16px 30px; min-height: 100%; width: max-content; min-width: 100%; }
.k-col { width: 300px; flex: none; display: flex; flex-direction: column; max-height: calc(100vh - 140px); }
.k-col.folded { width: 44px; cursor: pointer; }
.k-col.folded .k-cards, .k-col.folded .k-progress, .k-col.folded .k-quick { display: none; }
.k-col.folded .k-head { writing-mode: vertical-rl; height: auto; padding: 10px 0; align-items: center; }
.k-col.folded .k-head .k-tools { display: none; }
.k-head { display: flex; align-items: center; gap: 6px; height: 32px; padding: 0 2px; }
.k-title { font-weight: 600; font-size: 1.08rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.k-count { color: var(--muted); font-weight: 400; }
.k-tools { margin-left: auto; display: flex; opacity: 0; transition: opacity .12s; }
.k-col:hover .k-tools { opacity: 1; }
.k-progress { display: flex; align-items: center; gap: 8px; margin: 2px 2px 8px; }
.k-bar { flex: 1; height: 7px; border-radius: 4px; background: #e5e7eb; display: flex; overflow: hidden; }
.k-bar span { display: block; height: 100%; cursor: pointer; transition: opacity .1s; }
.k-bar span:hover { opacity: .8; }
.k-bar .s-planned { background: var(--success); }
.k-bar .s-today { background: var(--warning); }
.k-bar .s-overdue { background: var(--danger); }
.k-sum { font-weight: 600; font-size: .95rem; white-space: nowrap; color: var(--text-2); }
.k-cards { display: flex; flex-direction: column; gap: 8px; overflow-y: auto; min-height: 60px; padding: 2px 2px 8px; border-radius: var(--radius); }
.k-cards.drop-target { background: color-mix(in srgb, var(--brand) 7%, transparent); outline: 2px dashed color-mix(in srgb, var(--brand) 30%, transparent); }
.k-quick { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 10px; margin-bottom: 8px; box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 8px; }
.k-quick input { width: 100%; }
.card {
  position: relative; background: var(--surface); border: 1px solid var(--border-soft); border-radius: var(--radius); padding: 9px 10px 8px 12px;
  cursor: pointer; box-shadow: 0 1px 1px rgba(0,0,0,.03); transition: box-shadow .12s, border-color .12s;
}
.card::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; border-radius: var(--radius) 0 0 var(--radius); background: var(--card-color, transparent); }
.card:hover { box-shadow: var(--shadow); border-color: var(--border); }
.card.dragging { opacity: .45; }
.card-title { font-weight: 600; color: var(--text); margin-bottom: 2px; word-break: break-word; }
.card-line { color: var(--text-2); font-size: .94rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.card-revenue { font-weight: 500; color: var(--text); }
.card-tags { display: flex; flex-wrap: wrap; gap: 4px; margin: 6px 0 2px; }
.card-foot { display: flex; align-items: center; gap: 6px; margin-top: 6px; }
.card-foot .spacer { flex: 1; }
.ribbon { position: absolute; top: 8px; right: -1px; font-size: .72rem; font-weight: 700; letter-spacing: .06em; color: #fff; padding: 1px 8px; border-radius: 3px 0 0 3px; }
.ribbon.won { background: var(--success); }
.ribbon.lost { background: var(--danger); }

.tag { display: inline-flex; align-items: center; gap: 4px; height: 20px; padding: 0 8px; border-radius: 10px; font-size: .84rem; color: #fff; background: var(--tag, #9aa5b1); white-space: nowrap; max-width: 100%; overflow: hidden; text-overflow: ellipsis; }
.tag-soft { color: var(--text); background: color-mix(in srgb, var(--tag, #9aa5b1) 22%, #fff); border: 1px solid color-mix(in srgb, var(--tag, #9aa5b1) 45%, #fff); }
.tag button { border: 0; background: none; color: inherit; cursor: pointer; padding: 0; display: flex; opacity: .75; }

.priority { display: inline-flex; gap: 1px; }
.priority .star { border: 0; background: none; padding: 0; cursor: pointer; color: #c4c9d0; display: flex; }
.priority .star.on { color: #f3b81c; }
.priority .star.on svg { fill: #f3b81c; }
.priority .star:hover { color: #f3b81c; }

.act-btn { position: relative; border: 0; background: none; cursor: pointer; padding: 2px; display: inline-flex; border-radius: 50%; color: var(--muted); }
.act-btn.overdue { color: var(--danger); }
.act-btn.today { color: var(--warning); }
.act-btn.planned { color: var(--success); }
.act-btn:hover { background: var(--hover); }

.avatar { display: inline-flex; align-items: center; justify-content: center; border-radius: 50%; color: #fff; font-weight: 600; flex: none; letter-spacing: .02em; }
.avatar-empty { background: #e5e7eb; color: var(--muted); }

/* Popover attività */
.popover { position: fixed; z-index: 120; width: 330px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-lg); }
.popover-head { padding: 9px 12px; border-bottom: 1px solid var(--border-soft); font-weight: 600; display: flex; align-items: center; justify-content: space-between; }
.popover-body { max-height: 330px; overflow: auto; }
.pop-act { padding: 9px 12px; border-bottom: 1px solid var(--border-soft); display: flex; gap: 9px; }
.pop-act .pa-main { flex: 1; min-width: 0; }
.pop-act .pa-date { font-size: .88rem; font-weight: 600; }
.pop-act .pa-date.overdue { color: var(--danger); }
.pop-act .pa-date.today { color: var(--warning); }
.pop-act .pa-date.planned { color: var(--success); }
.popover-foot { padding: 8px 12px; }

/* ---------- Elenco ---------- */
.list-wrap { padding: 0; overflow-x: auto; }
table.list { width: 100%; border-collapse: collapse; background: var(--surface); }
table.list th, table.list td { padding: 7px 10px; border-bottom: 1px solid var(--border-soft); text-align: left; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 340px; }
table.list thead th { position: sticky; top: 0; background: var(--surface); z-index: 2; font-weight: 600; color: var(--text); border-bottom: 1px solid var(--border); cursor: pointer; user-select: none; }
table.list thead th.sorted::after { content: " ▾"; color: var(--muted); }
table.list thead th.sorted.asc::after { content: " ▴"; }
table.list tbody tr.row { cursor: pointer; }
table.list tbody tr.row:hover { background: var(--hover); }
table.list tbody tr.row.selected { background: color-mix(in srgb, var(--brand) 7%, #fff); }
table.list td.num, table.list th.num { text-align: right; }
table.list .cb { width: 34px; text-align: center; }
table.list tr.group-row td { background: var(--surface-2); font-weight: 600; cursor: pointer; }
table.list tr.group-row td .ic { transition: transform .12s; }
table.list tr.group-row.open td .ic { transform: rotate(90deg); }
table.list tfoot td { font-weight: 600; background: var(--surface-2); border-top: 1px solid var(--border); }
.list-actions { display: flex; align-items: center; gap: 8px; padding: 8px 16px; background: color-mix(in srgb, var(--brand) 6%, #fff); border-bottom: 1px solid var(--border); position: sticky; left: 0; }
.row-status-won { color: var(--success); font-weight: 600; }
.row-status-lost { color: var(--danger); font-weight: 600; }

/* ---------- Scheda (form) ---------- */
.form-view { display: block; min-height: 100%; }
.form-view.side-chatter { display: flex; align-items: flex-start; }
.form-main { flex: 1; min-width: 0; padding: 0 16px 30px; }
.statusbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; max-width: 1140px; margin: 0 auto; padding: 10px 0; }
.sb-buttons { display: flex; gap: 6px; flex-wrap: wrap; }
.stages-bar { display: flex; flex-wrap: wrap; }
.stage-chip {
  position: relative; height: 30px; padding: 0 14px 0 22px; border: 1px solid var(--border); border-left: 0; background: var(--surface);
  color: var(--text-2); cursor: pointer; display: flex; align-items: center; white-space: nowrap; font-size: .93rem;
  clip-path: polygon(0 0, calc(100% - 9px) 0, 100% 50%, calc(100% - 9px) 100%, 0 100%, 9px 50%);
  margin-left: -7px;
}
.stage-chip:first-child { padding-left: 14px; clip-path: polygon(0 0, calc(100% - 9px) 0, 100% 50%, calc(100% - 9px) 100%, 0 100%); border-left: 1px solid var(--border); border-radius: var(--radius) 0 0 var(--radius); margin-left: 0; }
.stage-chip:hover { background: var(--hover); }
.stage-chip.done { color: var(--text); }
.stage-chip.current { background: var(--brand); color: #fff; font-weight: 600; }
.sheet { position: relative; max-width: 1140px; margin: 0 auto; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 24px 32px 28px; box-shadow: 0 1px 2px rgba(0,0,0,.04); overflow: hidden; }
.sheet .ribbon-big { position: absolute; top: 22px; right: -42px; width: 170px; transform: rotate(45deg); text-align: center; color: #fff; font-weight: 700; letter-spacing: .1em; padding: 5px 0; font-size: .85rem; z-index: 3; }
.ribbon-big.won { background: var(--success); }
.ribbon-big.lost { background: var(--danger); }
.ribbon-big.archived { background: #6b7280; }
.oe-title { margin-bottom: 18px; }
.oe-title label { display: block; color: var(--text-2); font-size: .9rem; margin-bottom: 2px; }
.oe-title input { width: 100%; font-size: 1.9rem; font-weight: 500; border: 0; border-bottom: 1px solid transparent; padding: 2px 0; outline: none; background: none; }
.oe-title input:hover { border-bottom-color: var(--border); }
.oe-title input:focus { border-bottom-color: var(--brand); }
.oe-title .title-meta { display: flex; align-items: center; gap: 16px; margin-top: 8px; flex-wrap: wrap; }
.title-row { display: flex; align-items: flex-end; gap: 24px; flex-wrap: wrap; }
.big-num { display: flex; flex-direction: column; }
.big-num label { color: var(--text-2); font-size: .9rem; }
.big-num .bn-row { display: flex; align-items: baseline; gap: 6px; }
.big-num input { font-size: 1.3rem; font-weight: 500; width: 120px; }
.big-num.small input { width: 56px; }

.fgrid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 48px; }
.fgroup { display: grid; grid-template-columns: minmax(120px, 34%) 1fr; align-content: start; row-gap: 4px; }
.fgroup .flabel { font-weight: 600; color: var(--text); padding: 6px 12px 6px 0; font-size: .97rem; }
.fgroup .fval { min-width: 0; padding: 2px 0; }
.fgroup .fsep { grid-column: 1 / -1; font-weight: 700; font-size: .8rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); border-bottom: 1px solid var(--border-soft); padding: 14px 0 4px; margin-bottom: 4px; }
.field, .fval input, .fval select, .fval textarea, .k-quick input, .modal input, .modal select, .modal textarea, .inline-input {
  width: 100%; height: 30px; border: 0; border-bottom: 1px solid var(--border); background: none; padding: 2px 2px; outline: none; border-radius: 0;
}
.fval input:hover, .fval select:hover { border-bottom-color: #9aa1ab; }
.fval input:focus, .fval select:focus, .fval textarea:focus, .modal input:focus, .modal select:focus, .modal textarea:focus, .k-quick input:focus { border-bottom-color: var(--brand); }
.fval textarea, .modal textarea { height: auto; min-height: 70px; resize: vertical; border: 1px solid var(--border); border-radius: var(--radius); padding: 6px 8px; }
.fval .ro { display: block; padding: 6px 2px; min-height: 30px; }
.field-required input, .field-required .m2o input { background: color-mix(in srgb, var(--brand) 5%, transparent); }
.input-suffix { display: flex; align-items: center; gap: 6px; }

.notebook { margin-top: 26px; }
.nb-tabs { display: flex; border-bottom: 1px solid var(--border); gap: 2px; }
.nb-tabs button { border: 1px solid transparent; border-bottom: 0; background: none; padding: 8px 16px; cursor: pointer; color: var(--text-2); border-radius: var(--radius) var(--radius) 0 0; margin-bottom: -1px; }
.nb-tabs button.active { border-color: var(--border); background: var(--surface); color: var(--text); font-weight: 500; }
.nb-page { padding-top: 14px; }
.nb-page textarea.notes { width: 100%; min-height: 150px; border: 0; outline: none; resize: vertical; padding: 4px 0; }

.smart-buttons { display: flex; justify-content: flex-end; flex-wrap: wrap; margin: -24px -32px 18px; border-bottom: 1px solid var(--border-soft); }
.sheet.has-ribbon .smart-buttons { padding-right: 96px; }
.smart-btn { display: flex; align-items: center; gap: 10px; padding: 8px 18px; border: 0; border-left: 1px solid var(--border-soft); background: none; cursor: pointer; text-align: left; min-width: 140px; }
.smart-btn:hover { background: var(--hover); }
.smart-btn .ic { color: var(--brand); }
.smart-btn .sb-val { font-weight: 700; line-height: 1.1; }
.smart-btn .sb-lab { color: var(--text-2); font-size: .88rem; }

/* Many2one con completamento */
.m2o { position: relative; }
.m2o-drop { position: absolute; top: 100%; left: 0; right: 0; min-width: 240px; background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow); border-radius: var(--radius); z-index: 30; max-height: 260px; overflow: auto; padding: 4px 0; }
.m2o-drop .opt { padding: 6px 12px; cursor: pointer; display: flex; align-items: center; gap: 8px; }
.m2o-drop .opt.active, .m2o-drop .opt:hover { background: var(--hover); }
.m2o-drop .opt.create { color: var(--link); }
.m2o-drop .opt .sub { color: var(--muted); font-size: .88rem; }
.m2o .m2o-open { position: absolute; right: 0; top: 4px; }
.m2m { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; border-bottom: 1px solid var(--border); min-height: 30px; padding: 3px 0; }
.m2m:focus-within { border-bottom-color: var(--brand); }
.m2m input { flex: 1; min-width: 80px; border: 0 !important; height: 22px !important; }

/* ---------- Chatter ---------- */
.chatter { width: auto; max-width: 1140px; margin: 22px auto 0; padding: 0 16px 30px; }
.form-view:not(.side-chatter) .chatter { box-sizing: content-box; }
.form-view.side-chatter .chatter { width: 440px; flex: none; margin: 0; border-left: 1px solid var(--border); background: var(--surface); min-height: calc(100vh - 110px); padding: 0 16px 20px; position: sticky; top: 0; align-self: stretch; }
.chatter-top { display: flex; align-items: center; gap: 6px; padding: 12px 0; flex-wrap: wrap; }
.chatter-top .btn.active { background: var(--brand); color: #fff; }
.composer { display: flex; gap: 10px; margin-bottom: 14px; }
.composer textarea { flex: 1; min-height: 64px; border: 1px solid var(--border); border-radius: var(--radius); padding: 7px 9px; resize: vertical; outline: none; }
.composer textarea:focus { border-color: var(--brand); }
.chat-section-title { display: flex; align-items: center; gap: 10px; color: var(--text-2); font-weight: 600; margin: 14px 0 6px; font-size: .92rem; }
.chat-section-title::before, .chat-section-title::after { content: ""; flex: 1; border-top: 1px solid var(--border-soft); }
.c-activity { display: flex; gap: 10px; padding: 8px 0; }
.c-activity .ca-main { flex: 1; min-width: 0; }
.c-activity .ca-date.overdue { color: var(--danger); font-weight: 600; }
.c-activity .ca-date.today { color: var(--warning); font-weight: 600; }
.c-activity .ca-date.planned { color: var(--success); font-weight: 600; }
.c-activity .ca-actions { display: flex; gap: 2px; margin-top: 3px; }
.msg { display: flex; gap: 10px; padding: 8px 0; }
.msg .m-main { flex: 1; min-width: 0; }
.msg .m-head { display: flex; align-items: baseline; gap: 8px; }
.msg .m-author { font-weight: 600; }
.msg .m-date { color: var(--muted); font-size: .86rem; }
.msg .m-body { white-space: pre-wrap; word-break: break-word; margin-top: 2px; }
.msg.note .m-body { background: var(--surface-2); border: 1px solid var(--border-soft); border-radius: 6px; padding: 6px 10px; display: inline-block; max-width: 100%; }
.msg.activity .m-body { color: var(--text-2); }
.msg .m-track { margin: 2px 0 0; padding: 0; list-style: none; font-size: .94rem; }
.msg .m-track li { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; color: var(--text-2); }
.msg .m-track .arrow { color: var(--muted); }
.msg .m-track b { color: var(--text); font-weight: 500; }
.msg .m-del { opacity: 0; }
.msg:hover .m-del { opacity: 1; }
.act-icon { width: 30px; height: 30px; border-radius: 50%; display: flex; align-items: center; justify-content: center; color: #fff; flex: none; }
.act-icon.overdue { background: var(--danger); }
.act-icon.today { background: var(--warning); }
.act-icon.planned { background: var(--success); }

/* ---------- Report ---------- */
.dash { padding: 16px; display: grid; gap: 16px; grid-template-columns: repeat(12, 1fr); max-width: 1500px; margin: 0 auto; }
.kpi { grid-column: span 3; background: var(--surface); border: 1px solid var(--border-soft); border-radius: 6px; padding: 14px 16px; position: relative; overflow: hidden; }
.kpi::after { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: var(--brand); }
.kpi:nth-child(2n)::after { background: var(--accent); }
.kpi .k-lab { color: var(--text-2); font-size: .92rem; }
.kpi .k-val { font-size: 1.75rem; font-weight: 600; margin-top: 2px; letter-spacing: -.01em; }
.kpi .k-sub { color: var(--muted); font-size: .88rem; }
.panel { background: var(--surface); border: 1px solid var(--border-soft); border-radius: 6px; padding: 14px 16px; }
.panel h3 { font-size: 1.02rem; margin-bottom: 12px; }
.span-6 { grid-column: span 6; } .span-4 { grid-column: span 4; } .span-8 { grid-column: span 8; } .span-12 { grid-column: span 12; }
.hbar { display: grid; grid-template-columns: 130px 1fr auto; align-items: center; gap: 10px; margin: 7px 0; font-size: .95rem; }
.hbar .hb-lab { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hbar .hb-track { height: 18px; background: #eef0f3; border-radius: 3px; overflow: hidden; }
.hbar .hb-fill { height: 100%; background: var(--brand); border-radius: 3px; }
.hbar .hb-val { font-weight: 600; min-width: 80px; text-align: right; }
.funnel-row { display: flex; align-items: center; justify-content: center; margin: 5px auto; height: 34px; color: #fff; border-radius: 3px; font-weight: 500; font-size: .95rem; white-space: nowrap; overflow: hidden; }
.chart-svg text { fill: var(--text-2); font-size: 11px; }

/* ---------- Attività ---------- */
.act-list { max-width: 1100px; margin: 16px auto; padding: 0 16px; }
.act-group h3 { font-size: 1rem; margin: 18px 0 8px; display: flex; align-items: center; gap: 8px; }
.act-group h3 .dot { width: 10px; height: 10px; border-radius: 50%; }
.act-row { display: flex; align-items: center; gap: 12px; background: var(--surface); border: 1px solid var(--border-soft); border-radius: var(--radius); padding: 10px 12px; margin-bottom: 6px; }
.act-row .ar-main { flex: 1; min-width: 0; }
.act-row .ar-title { font-weight: 600; }
.act-row .ar-sub { color: var(--text-2); font-size: .93rem; }

/* ---------- Configurazione ---------- */
.cfg { max-width: 1000px; margin: 16px auto; padding: 0 16px; }
.cfg .panel + .panel { margin-top: 16px; }
.cfg table.list td { cursor: default; }
.color-dots { display: flex; gap: 5px; flex-wrap: wrap; }
.color-dot { width: 20px; height: 20px; border-radius: 50%; border: 2px solid transparent; cursor: pointer; }
.color-dot.on { border-color: var(--text); box-shadow: 0 0 0 2px #fff inset; }
.brand-preview { border: 1px solid var(--border); border-radius: 6px; overflow: hidden; }
.brand-preview .bp-nav { background: var(--brand); color: #fff; padding: 10px 14px; border-bottom: 3px solid var(--accent); display: flex; align-items: center; gap: 12px; }
.brand-preview .bp-body { padding: 14px; display: flex; gap: 8px; }

/* ---------- Marchio ---------- */
.wordmark { font-family: "Montserrat", "Segoe UI", system-ui, sans-serif; font-weight: 500; font-size: 1.32rem; letter-spacing: -.01em; line-height: 1; }
.wordmark b { font-weight: 800; color: var(--accent); }
.wordmark sup { font-size: .45em; font-weight: 500; margin-left: 1px; }
.wordmark-dark { color: var(--brand); }
.brand-logo { height: 28px; max-width: 150px; object-fit: contain; }
.login-card .brand-logo { height: 44px; max-width: 220px; }

/* ---------- Accesso ---------- */
.login-page { min-height: 100vh; display: grid; grid-template-columns: 1.1fr 1fr; }
.login-art { background: linear-gradient(150deg, color-mix(in srgb, var(--brand) 85%, #000) 0%, var(--brand) 55%, color-mix(in srgb, var(--brand) 65%, var(--accent)) 100%); color: #fff; padding: 48px; display: flex; flex-direction: column; justify-content: space-between; position: relative; overflow: hidden; }
.login-art::after { content: ""; position: absolute; width: 520px; height: 520px; border-radius: 50%; border: 70px solid rgba(255,255,255,.06); right: -170px; bottom: -170px; }
.login-art .wordmark { font-size: 2.1rem; }
.login-art h1 { font-size: 2.2rem; font-weight: 300; max-width: 460px; line-height: 1.2; }
.login-art h1 b { font-weight: 700; color: var(--accent); }
.login-art p { opacity: .85; max-width: 420px; }
.login-side { display: flex; align-items: center; justify-content: center; padding: 30px; background: var(--surface); }
.login-card { width: 100%; max-width: 360px; }
.login-card h2 { font-size: 1.5rem; margin: 22px 0 4px; }
.login-card .muted { margin-bottom: 22px; }
.login-card label { display: block; font-weight: 600; margin: 14px 0 4px; }
.login-card input { width: 100%; height: 40px; border: 1px solid var(--border); border-radius: var(--radius); padding: 0 12px; outline: none; }
.login-card input:focus { border-color: var(--brand); box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 15%, transparent); }
.login-card .btn { width: 100%; height: 40px; justify-content: center; margin-top: 22px; font-size: 1rem; }
.login-error { color: var(--danger); margin-top: 12px; min-height: 20px; }

/* ---------- Modale e notifiche ---------- */
.modal-backdrop { position: fixed; inset: 0; background: rgba(17, 24, 39, .45); z-index: 200; display: flex; align-items: flex-start; justify-content: center; padding: 60px 14px; overflow: auto; }
.modal { background: var(--surface); border-radius: 6px; width: 100%; max-width: 540px; box-shadow: var(--shadow-lg); animation: pop .14s ease-out; }
.modal.lg { max-width: 820px; }
@keyframes pop { from { transform: translateY(-8px); opacity: 0; } }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 14px 18px; border-bottom: 1px solid var(--border-soft); }
.modal-head h4 { font-size: 1.15rem; }
.modal-body { padding: 18px; }
.modal-body p { margin: 0 0 8px; }
.modal-foot { display: flex; gap: 8px; padding: 12px 18px; border-top: 1px solid var(--border-soft); }
.modal .fgroup { grid-template-columns: 150px 1fr; }
#toasts { position: fixed; right: 16px; bottom: 16px; z-index: 300; display: flex; flex-direction: column; gap: 8px; }
.toast { background: #fff; border-left: 4px solid var(--info); box-shadow: var(--shadow-lg); padding: 10px 14px; border-radius: var(--radius); min-width: 240px; max-width: 380px; transition: opacity .3s, transform .3s; }
.toast-success { border-left-color: var(--success); }
.toast-error { border-left-color: var(--danger); }
.toast.out { opacity: 0; transform: translateX(20px); }

/* ---------- Schermi piccoli ---------- */
@media (max-width: 1100px) {
  .control-panel { grid-template-columns: 1fr auto; }
  .control-panel .cp-search { grid-column: 1 / -1; grid-row: 2; }
  .kpi { grid-column: span 6; }
  .span-6, .span-4, .span-8 { grid-column: span 12; }
}
@media (max-width: 760px) {
  :root { font-size: 14px; }
  .nav-menu { display: none; }
  .nav-user .u-name { display: none; }
  .fgrid { grid-template-columns: 1fr; }
  .sheet { padding: 18px 16px; }
  .smart-buttons { margin: -18px -16px 14px; }
  .login-page { grid-template-columns: 1fr; }
  .login-art { display: none; }
  .kpi { grid-column: span 12; }
  .k-col { width: 82vw; }
  .search-panel { grid-template-columns: 1fr; }
  .search-panel .sp-col + .sp-col { border-left: 0; border-top: 1px solid var(--border-soft); padding-top: 6px; }
  .form-main { padding: 0 8px 20px; }
  .oe-title input { font-size: 1.5rem; }
  .hbar { grid-template-columns: 90px 1fr auto; }
}

/* ---------- v1.1: importazione ---------- */
.import-drop { border: 2px dashed var(--border); border-radius: 8px; padding: 34px 20px; text-align: center; color: var(--text-2); transition: background .12s, border-color .12s; }
.import-drop .ic { color: var(--brand); margin-bottom: 6px; }
.import-drop.over { border-color: var(--brand); background: color-mix(in srgb, var(--brand) 5%, #fff); }
.import-report { margin-top: 14px; border: 1px solid var(--border-soft); border-left: 4px solid var(--info); border-radius: 4px; padding: 10px 14px; background: var(--surface-2); }
.import-report.done { border-left-color: var(--success); }
.import-report h4 { margin: 0 0 6px; font-size: 1rem; }
.ir-stats { display: flex; gap: 18px; flex-wrap: wrap; }
.ir-stats b { font-size: 1.15rem; }
.ir-details { max-height: 190px; overflow: auto; margin-top: 8px; font-size: .9rem; border-top: 1px solid var(--border-soft); padding-top: 6px; }
.ir-details > div { padding: 2px 0; display: flex; gap: 8px; }
.ir-row { color: var(--muted); min-width: 64px; }

/* ---------- notifiche ---------- */
.notif-panel { width: 380px; padding: 0; max-height: 70vh; display: flex; flex-direction: column; }
.notif-panel.hidden { display: none; }
.np-head { display: flex; align-items: center; justify-content: space-between; padding: 10px 14px; border-bottom: 1px solid var(--border-soft); }
.np-body { overflow: auto; }
.dropdown a.np-item { display: flex; gap: 10px; align-items: flex-start; padding: 10px 14px; border-bottom: 1px solid var(--border-soft); white-space: normal; }
.np-item.unread { background: color-mix(in srgb, var(--brand) 6%, #fff); }
.np-ic { width: 28px; height: 28px; border-radius: 50%; display: flex; align-items: center; justify-content: center; background: #eef0f3; color: var(--brand); flex: none; }
.np-item.unread .np-ic { background: var(--accent); color: #fff; }
.np-main { display: flex; flex-direction: column; min-width: 0; }
.np-title { font-weight: 500; line-height: 1.3; }
.np-item.unread .np-title { font-weight: 600; }
.np-body-t { color: var(--text-2); font-size: .9rem; overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.np-date { color: var(--muted); font-size: .82rem; margin-top: 2px; }

/* ---------- email nel registro e menzioni ---------- */
.email-tag { display: inline-flex; align-items: center; gap: 3px; font-size: .78rem; padding: 0 6px; border-radius: 9px; background: #e8f1fb; color: #1d5fa8; font-weight: 500; }
.email-tag.out { background: #edf7ef; color: #1e7b37; }
.email-card { border: 1px solid var(--border-soft); border-radius: 6px; padding: 8px 12px; margin-top: 4px; background: var(--surface); }
.ec-subject { font-weight: 600; }
.ec-meta { font-size: .86rem; margin-bottom: 4px; word-break: break-word; }
.email-card .m-body.clamped { max-height: 9.5em; overflow: hidden; -webkit-mask-image: linear-gradient(#000 70%, transparent); mask-image: linear-gradient(#000 70%, transparent); }
.ec-actions { display: flex; gap: 4px; margin-top: 2px; }
.ec-actions .btn-link { padding: 0; margin-right: 10px; }
.mention { color: var(--link); background: color-mix(in srgb, var(--brand) 9%, #fff); border-radius: 3px; padding: 0 2px; font-weight: 500; }
.mention-drop { bottom: auto; top: 100%; }

/* ---------- duplicati ---------- */
.dup-slot { max-width: 1140px; margin: 0 auto; }
.dup-banner { display: flex; align-items: center; gap: 10px; background: #fff7e6; border: 1px solid #f5d38a; border-radius: 4px; padding: 8px 12px; margin-bottom: 10px; color: #6b4e00; }
.dup-banner > .ic { color: var(--warning); }
.dup-group + .dup-group { margin-top: 14px; }
.merge-list { display: flex; flex-direction: column; gap: 6px; margin: 10px 0 14px; }
.merge-item { display: flex; gap: 10px; align-items: flex-start; border: 1px solid var(--border-soft); border-radius: 4px; padding: 8px 10px; cursor: pointer; }
.merge-item:has(input:checked) { border-color: var(--brand); background: color-mix(in srgb, var(--brand) 5%, #fff); }
.merge-item input { margin-top: 3px; }
.note-box { background: var(--surface-2); border-left: 3px solid var(--warning); padding: 8px 12px; border-radius: 0 4px 4px 0; font-size: .93rem; }
.setup-steps li { margin-bottom: 6px; }
code { background: #eef0f3; padding: 0 4px; border-radius: 3px; font-size: .9em; }
@media (max-width: 760px) { .notif-panel { position: fixed; left: 8px; right: 8px; top: 52px; width: auto; } }
.modal input[type=radio], .modal input[type=checkbox] { width: auto; height: auto; border: 0; }
.merge-item { align-items: center; }

/* ---------- Calendario delle attività (v1.2) ---------- */
.cal-content { padding: 12px 16px 24px; }
.cal { background: var(--surface); border: 1px solid var(--border-soft); border-radius: 6px; overflow: hidden; }
.cal-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 18px; padding: 10px 14px; border-bottom: 1px solid var(--border-soft); }
.cal-nav { display: flex; align-items: center; gap: 6px; }
.cal-title { font-size: 1.25rem; font-weight: 600; margin-left: 6px; text-transform: capitalize; }
.cal-opts { display: flex; align-items: center; gap: 14px; margin-left: auto; flex-wrap: wrap; }
.cal-check { display: inline-flex; align-items: center; gap: 6px; color: var(--text-2); cursor: pointer; }
.cal-modes { display: inline-flex; border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.cal-modes button { border: 0; background: var(--surface); padding: 0 12px; height: 30px; cursor: pointer; color: var(--text-2); }
.cal-modes button + button { border-left: 1px solid var(--border); }
.cal-modes button.active { background: color-mix(in srgb, var(--brand) 12%, #fff); color: var(--brand); font-weight: 600; }
.cal-legend { flex-basis: 100%; display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: .9rem; color: var(--text-2); }
.cal-legend i, .cal-dot { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 6px; vertical-align: -1px; }

.cal-ev { display: block; width: 100%; text-align: left; border: 0; cursor: pointer; font-size: .86rem; line-height: 1.3; padding: 2px 6px; margin: 2px 0; border-radius: 3px;
  background: color-mix(in srgb, var(--ev) 18%, #fff); color: var(--text); box-shadow: inset 3px 0 0 var(--ev); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cal-ev:hover { background: color-mix(in srgb, var(--ev) 30%, #fff); }
.cal-ev[draggable="true"] { cursor: grab; }
.cal-ev.dragging { opacity: .45; }
.cal-ev.overdue { box-shadow: inset 3px 0 0 var(--ev), inset 0 0 0 1px var(--danger); }
.cal-ev.done { opacity: .6; text-decoration: line-through; }
.cal-ev small { display: block; color: var(--text-2); overflow: hidden; text-overflow: ellipsis; }
.cal-daynum { border: 0; background: none; cursor: pointer; font-weight: 600; color: var(--text-2); padding: 1px 6px; border-radius: 12px; }
.cal-daynum:hover { background: var(--hover); }
.today > .cal-daynum, .cal-dh.today .cal-daynum { background: var(--brand); color: var(--brand-ink); }
.drop-over { background: color-mix(in srgb, var(--brand) 9%, #fff) !important; }

/* mese */
.cal-mhead, .cal-mgrid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); }
.cal-mhead div { padding: 6px 8px; font-size: .86rem; font-weight: 600; color: var(--text-2); text-transform: uppercase; border-bottom: 1px solid var(--border-soft); }
.cal-cell { min-height: 108px; padding: 4px 4px 6px; border-right: 1px solid var(--border-soft); border-bottom: 1px solid var(--border-soft); min-width: 0; }
.cal-cell:nth-child(7n) { border-right: 0; }
.cal-cell.out { background: var(--surface-2); }
.cal-cell.out .cal-daynum { color: var(--muted); }
.cal-more { border: 0; background: none; color: var(--link); cursor: pointer; font-size: .85rem; padding: 2px 6px; }

/* settimana e giorno */
.cal-whead, .cal-allday { display: grid; grid-template-columns: 64px repeat(var(--days), minmax(0, 1fr)); border-bottom: 1px solid var(--border-soft); }
.cal-dh { padding: 6px 4px; text-align: center; color: var(--text-2); border-left: 1px solid var(--border-soft); }
.cal-dh span { display: block; font-size: .8rem; text-transform: uppercase; }
.cal-gutter { font-size: .78rem; color: var(--muted); padding: 6px 6px; text-align: right; }
.cal-ad { border-left: 1px solid var(--border-soft); padding: 2px 3px; min-height: 30px; min-width: 0; }
.cal-body { display: grid; grid-template-columns: 64px 1fr; max-height: calc(100vh - 290px); min-height: 360px; overflow-y: auto; }
.cal-hours div { font-size: .78rem; color: var(--muted); text-align: right; padding-right: 8px; transform: translateY(-7px); }
.cal-hours div:first-child { transform: none; }
.cal-cols { display: grid; grid-template-columns: repeat(var(--days), minmax(0, 1fr));
  background-image: linear-gradient(to bottom, var(--border-soft) 1px, transparent 1px); }
.cal-col { position: relative; border-left: 1px solid var(--border-soft); min-width: 0; }
.cal-col.today { background: color-mix(in srgb, var(--accent) 6%, transparent); }
.cal-tev-wrap { position: absolute; padding: 0 2px; box-sizing: border-box; }
.cal-tev { height: 100%; margin: 0; white-space: normal; padding: 3px 6px; overflow: hidden; }
.cal-time { display: block; font-size: .78rem; color: var(--text-2); }
.cal-now { position: absolute; left: 0; right: 0; height: 2px; background: var(--danger); z-index: 2; pointer-events: none; }
.cal-now::before { content: ''; position: absolute; left: -4px; top: -3px; width: 8px; height: 8px; border-radius: 50%; background: var(--danger); }

.cal-detail .cd-row { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.cal-detail .cd-note { white-space: pre-wrap; background: var(--surface-2); border: 1px solid var(--border-soft); border-radius: 4px; padding: 8px 10px; margin-top: 4px; }

@media (max-width: 760px) {
  .cal-content { padding: 8px; }
  .cal-opts { margin-left: 0; }
  .cal-cell { min-height: 72px; padding: 2px; }
  .cal-cell .cal-ev { font-size: .74rem; padding: 1px 3px; }
  .cal-whead, .cal-allday { grid-template-columns: 44px repeat(var(--days), minmax(0, 1fr)); }
  .cal-body { grid-template-columns: 44px 1fr; }
  .cal-week { overflow-x: auto; }
  .cal-week[style*="--days:7"] { min-width: 760px; }
}
.cal-tev.short { white-space: nowrap; padding-top: 2px; }
