/* =========================================================
   List screens (Tags, Crèches, Contacts): right of the sidebar, in place of the map (no map behind),
   laid straight on the page background — no card around the table.
   Saved lists as tabs, search + filter chips, sortable table.
   ========================================================= */
.table-view{display:none;top:calc(var(--gap) + 58px);left:calc(var(--side) + 2 * var(--gap));right:var(--gap);bottom:var(--gap);
  flex-direction:column;padding:4px 8px 0;background:none;border-radius:0;box-shadow:none;}
.app:is([data-view="companies"],[data-view="contacts"],[data-view="tags"],[data-view="pipeline"],[data-view="quotes"],[data-view="tasks"],[data-view="calls"]) .table-view:not(.settings-view):not(.quote-view):not(.calendar-view):not(.reports-view):not(.session-view),
.app[data-view="settings"] .settings-view{display:flex;}
.app:not([data-view="map"]) :is(.daybar,.legend,.focus-chip:not(.focus-chip--tag),.leaflet-control-container){display:none!important;}   /* the tag filter applies to the lists too */
.app:not([data-view="map"]) .map{visibility:hidden;}    /* hidden, not display:none: Leaflet keeps its size for the way back */

/* head: title + saved lists */
.tv-head{display:flex;flex-direction:column;gap:12px;}
.tv-title{margin:0;font-size:22px;letter-spacing:-.01em;}
.tv-count{margin-left:6px;font-size:14px;font-weight:500;color:var(--gray-l);}
.tv-headline{display:flex;align-items:center;justify-content:space-between;gap:12px;flex-wrap:wrap;}
.tv-create .btn{height:34px;font-size:13px;}
.tv-lists{display:flex;flex-direction:column;align-items:flex-start;gap:8px;}
.tv-tabs{display:flex;gap:4px;flex-wrap:wrap;flex:1;min-width:0;}
.tv-tab{display:flex;align-items:center;gap:6px;height:32px;padding:0 12px;border:1px solid var(--line);border-radius:10px;background:none;
  color:var(--gray);font-weight:500;font-size:13px;white-space:nowrap;transition:background-color .15s,color .15s;}
.tv-tab:hover{background:var(--lav-2);color:var(--ink);}
.tv-tab.is-on{border-color:var(--blue);color:var(--blue-d);background:var(--lav-2);}
.tv-tab .icon{width:14px;height:14px;flex-basis:14px;}
.tv-actions{display:flex;gap:6px;}
.tv-actions .btn{height:32px;font-size:13px;}
.tv-actions .btn .icon{width:15px;height:15px;flex-basis:15px;}
.btn--primary{background:var(--blue);border-color:var(--blue);color:#fff;}
.btn--primary:hover{background:var(--blue-d);border-color:var(--blue-d);}

/* toolbar: search + filter chips */
.tv-toolbar{display:flex;flex-direction:column;gap:10px;padding:14px 0 12px;border-bottom:1px solid var(--line);}
.tv-toolbar-row{display:flex;align-items:center;gap:8px;flex-wrap:wrap;}
.tv-search{display:flex;align-items:center;gap:8px;width:260px;height:32px;padding:0 10px;border:1px solid var(--line);border-radius:var(--r-sm);
  background:var(--card);color:var(--gray-l);transition:border-color .15s;}
.tv-search:focus-within{border-color:var(--blue);}
.tv-search .icon{width:16px;height:16px;flex-basis:16px;}
.tv-search-input{flex:1;min-width:0;border:0;outline:0;background:none;font:inherit;font-size:13px;color:var(--ink);}
.tv-filters{display:flex;gap:6px;flex-wrap:wrap;}
.tv-filters:empty{display:none;}
.tv-filter{position:relative;}
/* filter buttons: a quiet outline; an active filter shows its value in blue and a × to clear it (no fill, no shadow) */
.tv-chip{display:inline-flex;align-items:center;height:32px;border:1px solid var(--line);border-radius:9px;background:var(--card);color:var(--ink);
  font-size:13px;font-weight:500;white-space:nowrap;transition:border-color .15s;}
.tv-chip:hover,.tv-chip.is-open{border-color:color-mix(in srgb, var(--blue) 55%, var(--line));}
.tv-chip.is-on{border-color:var(--blue);}
.tv-chip-main{display:inline-flex;align-items:center;gap:6px;height:100%;padding:0 10px 0 12px;border:0;background:none;color:inherit;font:inherit;cursor:pointer;}
.tv-chip-main .icon{width:14px;height:14px;flex-basis:14px;color:var(--gray-l);}
.tv-chip b{max-width:160px;overflow:hidden;text-overflow:ellipsis;font-weight:600;color:var(--blue-d);}
.tv-chip.is-on .tv-chip-main{padding-right:4px;}
.tv-chip-x{display:grid;place-items:center;width:24px;height:24px;margin-right:4px;padding:0;border:0;border-radius:6px;background:none;color:var(--gray);cursor:pointer;}
.tv-chip-x:hover{color:var(--ink);background:var(--lav-2);}
.tv-chip-x .icon{width:12px;height:12px;flex-basis:12px;}
.tv-chip--quiet{color:var(--gray);}
.tv-chip--quiet .tv-chip-main .icon:first-child{width:15px;height:15px;flex-basis:15px;color:var(--gray);}
.tv-toolbar-end{display:flex;align-items:center;gap:6px;margin-left:auto;}
.tv-clear{display:inline-flex;align-items:center;gap:5px;height:32px;padding:0 8px;border:0;background:none;color:var(--blue-d);font-size:12.5px;font-weight:500;cursor:pointer;}
.tv-clear:hover{text-decoration:underline;}
.tv-clear .icon{width:11px;height:11px;flex-basis:11px;}

/* filter pop-up: name and « Tout / Aucun », a search field for long lists, one line per value with its count */
.tv-pop{position:absolute;top:38px;left:0;z-index:20;display:flex;flex-direction:column;width:264px;max-height:400px;
  background:var(--card);border:1px solid var(--line);border-radius:12px;}
.tv-pop--end{left:auto;right:0;}
.tv-pop-head{display:flex;align-items:center;justify-content:space-between;gap:8px;padding:10px 12px 8px;font-size:12px;font-weight:600;color:var(--gray);
  text-transform:uppercase;letter-spacing:.03em;}
.tv-pop-links{display:flex;gap:2px;}
.tv-pop-link{height:24px;padding:0 8px;border:1px solid transparent;border-radius:6px;background:none;color:var(--blue-d);font-size:12px;font-weight:500;
  text-transform:none;letter-spacing:0;cursor:pointer;}
.tv-pop-link:hover{border-color:color-mix(in srgb, var(--blue) 40%, transparent);}
.tv-pop-search{display:flex;align-items:center;gap:6px;height:32px;margin:0 10px 6px;padding:0 9px;border:1px solid var(--line);border-radius:8px;color:var(--gray-l);}
.tv-pop-search:focus-within{border-color:var(--blue);}
.tv-pop-search input{flex:1;min-width:0;border:0;outline:0;background:none;color:var(--ink);font:inherit;font-size:13px;}
.tv-pop-list{flex:1;min-height:0;overflow:auto;padding:2px 6px 8px;border-top:1px solid var(--line);}
.tv-pop-day{display:flex;align-items:center;justify-content:space-between;gap:8px;padding:8px 12px 10px;border-top:1px solid var(--line);font-size:13px;color:var(--gray);}
.tv-pop-day input{height:30px;padding:0 8px;border:1px solid var(--line);border-radius:8px;background:none;color:var(--ink);font:inherit;font-size:13px;}
.tv-pop-day input:focus{outline:0;border-color:var(--blue);}
.tv-pop-hint{margin:0;padding:8px 12px 10px;border-top:1px solid var(--line);font-size:11.5px;line-height:1.4;color:var(--gray-l);}
.tv-opt{display:flex;align-items:center;gap:10px;min-height:32px;padding:0 8px;border:1px solid transparent;border-radius:8px;font-size:13px;cursor:pointer;}
.tv-opt[hidden]{display:none;}
.tv-opt:hover{border-color:color-mix(in srgb, var(--blue) 30%, transparent);}
.tv-opt.is-locked{cursor:default;color:var(--gray-l);}
.tv-opt.is-locked:hover{border-color:transparent;}
.tv-opt-label{flex:1;min-width:0;display:flex;align-items:center;gap:7px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;}
.tv-opt-count{min-width:22px;text-align:right;font-size:12px;color:var(--gray-l);font-variant-numeric:tabular-nums;}
.tv-only{display:none;padding:2px 7px;border:1px solid color-mix(in srgb, var(--blue) 40%, transparent);border-radius:6px;font-size:11px;font-weight:500;color:var(--blue-d);}
.tv-opt:hover .tv-only{display:inline;}
.tv-pop .tag-chip-dot{display:inline-block;}
/* check box of the pop-ups: rounded square, blue when ticked */
.tv-check{appearance:none;flex:none;width:16px;height:16px;margin:0;border:1.5px solid color-mix(in srgb, var(--gray-l) 70%, transparent);border-radius:5px;
  background:var(--card) center/11px no-repeat;cursor:pointer;transition:background-color .1s,border-color .1s;}
.tv-check:checked{border-color:var(--blue);background-color:var(--blue);
  background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cpath d='M2.5 6.2 5 8.6 9.6 3.6' fill='none' stroke='white' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");}
.tv-check:disabled{opacity:.5;cursor:default;}

/* screen Tags: tag band (filter / create / rename / delete) */
.tv-tagbar:empty{display:none;}
.tv-tagbar{display:flex;flex-direction:column;gap:10px;padding-top:14px;}
.tv-tagsort{display:flex;align-items:center;gap:4px;font-size:12px;color:var(--gray);}
.tv-tagsort > span{margin-right:4px;}
.tv-tagsort-btn{height:26px;padding:0 10px;border:1px solid var(--line);border-radius:999px;background:none;color:var(--ink);font-size:12px;cursor:pointer;}
.tv-tagsort-btn.is-on{border-color:var(--blue);color:var(--blue);}
.tv-tagchips{display:flex;flex-wrap:wrap;align-items:center;gap:6px;}
.tv-tagpick{--tag:var(--blue);display:inline-flex;align-items:center;gap:6px;height:30px;padding:0 10px;border:1px solid transparent;border-radius:8px;
  background:color-mix(in srgb, var(--tag) 12%, transparent);color:color-mix(in srgb, var(--tag) 75%, var(--ink));font-size:12.5px;font-weight:500;
  transition:background-color .15s;}
.tv-tagpick:hover{background:color-mix(in srgb, var(--tag) 22%, transparent);}
.tv-tagpick.is-on{border-color:var(--tag);}
.tv-tagpick-count{font-size:11.5px;opacity:.7;}
.tv-tagchips .tag-add{height:30px;}
.tv-tagtools{display:flex;gap:6px;margin-left:6px;}
.tv-tagtools .btn{height:30px;font-size:12.5px;}
.tv-tagpick .icon{width:12px;height:12px;flex-basis:12px;}
.tv-tagchips .tag-add{cursor:pointer;}
.tv-lists .tv-tagchips{width:100%;}
.tv-tagform{max-width:460px;}
.tv-tagform .tag-colors{margin-top:6px;}

/* screen Tags: bulk bar, shown while crèches are ticked */
.tv-bulk:empty{display:none;}
.tv-bulk{display:flex;align-items:center;gap:12px;flex-wrap:wrap;margin-top:12px;padding:8px 12px;border-radius:var(--r-sm);background:var(--lav-2);font-size:13px;}
.tv-bulk-count{font-weight:500;}
.tv-bulk-group{display:flex;align-items:center;gap:6px;}
.tv-bulk .tag-input{flex:none;width:230px;height:34px;background:var(--card);}
.tv-bulk .btn{height:34px;font-size:13px;}
.tv-bulk-select{height:34px;max-width:200px;padding:0 8px;border:1px solid var(--line);border-radius:10px;background:var(--card);color:var(--ink);font:inherit;font-size:13px;}
.tv-bulk .link-btn{margin-left:auto;}

/* table: airy rows, thin separators; hovered and ticked rows become rounded tinted strips (separators hidden around them) */
.tv-scroll{flex:1;min-height:0;overflow:auto;margin:0 -8px;padding:0 8px;}
.tv-table{width:100%;border-collapse:separate;border-spacing:0;font-size:13px;}
.tv-table th{position:sticky;top:0;z-index:1;padding:0;background:var(--bg);text-align:left;}
.tv-th{display:flex;align-items:center;gap:5px;width:100%;padding:14px 12px 10px;border:0;background:none;font:inherit;font-size:12px;font-weight:500;
  color:var(--gray-l);white-space:nowrap;text-align:left;transition:color .15s;}
.tv-th:hover,.tv-th.is-sorted{color:var(--ink);}
.tv-arrow{font-size:11px;color:var(--blue-d);}
.tv-arrow.is-idle{color:var(--line);transition:color .15s;}
.tv-th:hover .tv-arrow.is-idle{color:var(--gray-l);}
.tv-table td{padding:13px 12px;border-bottom:1px solid var(--line);vertical-align:middle;white-space:nowrap;transition:background-color .12s,border-color .12s;}
.tv-table tbody tr:is([data-act]:hover,.is-picked) td:first-child{border-radius:12px 0 0 12px;}   /* rounded only once the separator is hidden: */
.tv-table tbody tr:is([data-act]:hover,.is-picked) td:last-child{border-radius:0 12px 12px 0;}    /* a rounded cell would bend the line */
.tv-table th.is-num .tv-th{justify-content:flex-end;}
.tv-table td.is-num{text-align:right;font-variant-numeric:tabular-nums;}
.tv-table tbody tr[data-act]{cursor:pointer;}
.tv-table tbody tr[data-act]:hover td{background:color-mix(in srgb, var(--blue) 7%, transparent);}
.tv-table tbody tr.is-picked td{background:color-mix(in srgb, var(--ink) 5%, transparent);}
.tv-table tbody tr:is([data-act]:hover,.is-picked) td,
.tv-table tbody tr:has(+ tr:is([data-act]:hover,.is-picked)) td{border-bottom-color:transparent;}
.tv-table .tv-pick{width:1%;padding:0;}
.tv-pick-box{display:flex;align-items:center;padding:13px 4px 13px 12px;cursor:pointer;}
.tv-pick-box input{appearance:none;display:grid;place-items:center;width:16px;height:16px;margin:0;border:1.5px solid var(--gray-l);border-radius:4px;
  background:var(--card);cursor:pointer;transition:background-color .12s,border-color .12s;}
.tv-pick-box input:hover{border-color:var(--blue);}
.tv-pick-box input:checked,.tv-pick-box input:indeterminate{border-color:var(--blue);background:var(--blue);}
.tv-pick-box input:checked::after{content:"";width:8px;height:4px;margin-top:-2px;border:solid #fff;border-width:0 0 2px 2px;transform:rotate(-45deg);}
.tv-pick-box input:indeterminate::after{content:"";width:8px;height:2px;border-radius:1px;background:#fff;}
/* grouped screen (Pipeline): per stage a title pill + count + total, then its own header row */
.tv-table .tv-group td{padding:26px 0 8px;border-bottom:0;}
.tv-table tbody:first-child .tv-group td{padding-top:10px;}
.tv-group-line{display:flex;align-items:center;gap:12px;}
.tv-group-btn{display:inline-flex;align-items:center;gap:6px;padding:0;border:0;background:none;color:var(--gray-l);cursor:pointer;}
.tv-group-btn .icon{transition:transform .15s;}
.tv-group-btn.is-folded .icon{transform:rotate(-90deg);}
.tv-group-pill{display:inline-flex;align-items:center;gap:8px;height:28px;padding:0 10px 0 8px;border-radius:8px;
  background:color-mix(in srgb, var(--c) 15%, transparent);color:color-mix(in srgb, var(--c) 65%, var(--ink));
  font-size:12px;font-weight:700;letter-spacing:.04em;text-transform:uppercase;transition:background-color .15s;}
.tv-group-pill::before{content:"";width:3px;height:13px;border-radius:2px;background:var(--c);}
.tv-group-btn:hover .tv-group-pill{background:color-mix(in srgb, var(--c) 24%, transparent);}
.tv-group-count{font-weight:500;opacity:.75;}
.tv-group-sum{font-size:12px;color:var(--gray-l);}
.tv-table .tv-group-head th{position:static;border-bottom:1px solid var(--line);}
.tv-group-head .tv-th{padding-top:6px;}
.tv-table .tv-group-more td{padding:12px 12px 4px;border-bottom:0;font-size:13px;color:var(--gray-l);}
.tv-group-more .btn{height:32px;margin-right:10px;}
.tv-name{display:block;max-width:300px;overflow:hidden;text-overflow:ellipsis;font-weight:500;color:var(--ink);}
.tv-name--light{font-weight:400;}
.tv-sub{display:block;font-size:12px;color:var(--gray-l);}
.tv-muted{color:var(--gray-l);}
.tv-mono{color:var(--gray);}
.tv-stage{display:inline-flex;align-items:center;height:22px;padding:0 8px;border:1.5px solid var(--c);border-radius:7px;
  color:color-mix(in srgb, var(--c) 70%, var(--ink));font-size:12px;font-weight:500;}
.tv-soft{display:inline-flex;align-items:center;gap:8px;}
.tv-soft .logo{width:18px;height:18px;flex:0 0 18px;font-size:8px;}
.tv-soft .logo--none{width:12px;height:12px;flex-basis:12px;}
/* tags in a row (crèche tags, task tags): the same chips */
.tv-tags,.tv-table .task-tags{display:inline-flex;gap:4px;}
:is(.tv-tags,.tv-table .task-tags) .tag-chip-label{padding:3px 8px;border-radius:8px;transition:background-color .15s;}
:is(.tv-tags,.tv-table .task-tags) button.tag-chip-label:hover{background:color-mix(in srgb, var(--tag) 16%, transparent);}
.tv-task{display:block;}
.tv-task--late{color:var(--red);}
.tv-task--rdv{color:var(--blue-d);}
.tv-foot{display:flex;align-items:center;gap:12px;padding:14px 0 18px;font-size:13px;color:var(--gray-l);}
.tv-foot .btn{height:34px;}

@media (max-width:820px){
  .table-view{top:128px;left:12px;right:12px;bottom:86px;padding:0 4px;}
  .tv-search{width:100%;}
  .tv-scroll{margin:0 -4px;padding:0 4px;}
}

/* ---------- Crèches screen: last activity, phone + call, contacts, column drag and drop ---------- */
.tv-activity{display:inline-flex;align-items:center;gap:6px;font-weight:500;}
.tv-activity::before{content:"";width:8px;height:8px;border-radius:50%;background:currentColor;}
.tv-activity--fresh{color:var(--client-d);}
.tv-activity--aging{color:var(--orange-d);}
.tv-activity--stale{color:var(--red);}
.tv-activity--none{color:var(--gray-l);font-weight:400;}
.tv-phone{display:inline-flex;align-items:center;gap:8px;}
.tv-call{width:28px;height:28px;flex:0 0 28px;display:grid;place-items:center;padding:0;border:1px solid var(--client-l);border-radius:8px;
  background:var(--client-l);color:var(--client-d);transition:border-color .15s;}
.tv-call:hover{border-color:var(--client-d);}
.avatar-stack--table .avatar-stack-item{width:26px;height:26px;margin-left:-7px;border-width:2px;font-size:10px;}
.avatar-stack--table .avatar-stack-item:first-child{margin-left:0;}
.tv-table th[draggable="true"]{cursor:grab;}
.tv-table th.is-dragging{opacity:.4;}
.tv-table th.is-drop-before{box-shadow:inset 3px 0 0 var(--blue);}
.tv-table th.is-drop-after{box-shadow:inset -3px 0 0 var(--blue);}
/* column resize: grip on the right edge of each header; a sized column cuts its content with an ellipsis */
.tv-col-grip{position:absolute;top:4px;bottom:4px;right:0;z-index:2;width:9px;cursor:col-resize;}
.tv-col-grip::after{content:"";position:absolute;top:0;bottom:0;right:0;width:1px;background:var(--line);}
.tv-col-grip:hover::after,.tv-table th.is-resizing .tv-col-grip::after{width:3px;background:var(--blue);border-radius:2px;}
.tv-table td.is-sized,.tv-table th.is-sized{overflow:hidden;}
.tv-table td.is-sized > *,.tv-table td.is-sized .tv-name,.tv-table td.is-sized .tv-sub{max-width:100%;overflow:hidden;text-overflow:ellipsis;}
.tv-table td.is-sized{text-overflow:ellipsis;}
.tv-table th.is-sized .tv-th{overflow:hidden;text-overflow:ellipsis;}

.tv-row-btns{display:inline-flex;gap:2px;}

/* a task just ticked: fades out over 10 s (App.FADE_MS) before leaving the « À faire » list */
.tv-table tr.is-fading{animation:tv-fade 10s linear forwards;}
.tv-table tr.is-fading .tv-name{text-decoration:line-through;}
@keyframes tv-fade{from{opacity:1;}to{opacity:.25;}}
/* « Intérêt » of a crèche En contact (Crèches list): the mark in the colour of its band */
.tv-interest{font-weight:600;color:hsl(var(--h) 85% 45%);font-variant-numeric:tabular-nums;}
.tv-interest small{font-weight:400;color:var(--gray-l);}
