/* ── Design tokens · "Backstage" ─────────────────────────────────────────────
   Every colour in the app comes from here (templates use var(--…) inline too).
   Warm paper canvas, ink-black backstage sidebar, electric cobalt accent,
   stage-lime and coral as identity highlights. */
@import url('https://fonts.googleapis.com/css2?family=Unbounded:wght@500;600;700&family=Figtree:wght@400;500;600;700&family=JetBrains+Mono:wght@400;500&display=swap');

:root {
  --bg:            #f3f1ec;
  --surface:       #ffffff;
  --surface-2:     #faf9f6;
  --surface-3:     #efece5;
  --border:        #e6e2d9;
  --border-strong: #d3cdc0;

  --text:   #0c0c11;
  --text-2: #2b2b35;
  --text-3: #5f5e6b;
  --text-4: #8f8d98;

  --accent:        #1f3bff;
  --accent-hover:  #1429d4;
  --accent-soft:   #eceffe;
  --accent-border: #c3cbff;

  --lime:   #d4ff3f;
  --coral:  #ff5b3a;
  --ink:    #0d0d12;
  --ink-2:  #17171f;
  --ink-3:  #24242e;

  --success:        #0a8a55;
  --success-soft:   #e9f9f0;
  --success-border: #a8e9c7;
  --warning:        #c25e00;
  --warning-soft:   #fff6e5;
  --warning-border: #ffd88a;
  --danger:         #d92d20;
  --danger-soft:    #fff0ee;
  --danger-border:  #ffc9c2;

  --manual:        #0b7a8c;
  --manual-soft:   #ecfafc;
  --manual-border: #b2e5ed;

  --on-solid: #ffffff;
  --radius:    16px;
  --radius-sm: 10px;
  --shadow-sm: 0 1px 2px rgba(12, 12, 17, .04);
  --shadow:    0 10px 30px -12px rgba(12, 12, 17, .18), 0 2px 6px rgba(12, 12, 17, .05);
  --ease:      cubic-bezier(.2, .8, .2, 1);
  --font:    "Figtree", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --display: "Unbounded", "Figtree", sans-serif;
  --mono:    "JetBrains Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
body { background: var(--bg); color: var(--text); font-family: var(--font);
       font-size: 14px; line-height: 1.55; -webkit-font-smoothing: antialiased;
       font-feature-settings: "tnum" 1; }
a { color: var(--accent); text-decoration: none; transition: color .15s; }
a:hover { color: var(--accent-hover); text-decoration: underline; text-underline-offset: 3px; text-decoration-thickness: 1.5px; }
code { font-family: var(--mono); font-size: .84em; background: var(--surface-3);
       color: var(--text-2); padding: 1px 6px; border-radius: 6px; }
hr { border: 0; border-top: 1px solid var(--border); }
h2 { font-family: var(--display); font-size: 1rem; font-weight: 600; color: var(--text); letter-spacing: -.02em; }
h3 { font-size: .95rem; font-weight: 700; color: var(--text); letter-spacing: -.01em; }
::selection { background: var(--lime); color: var(--ink); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 99px; border: 3px solid transparent; background-clip: padding-box; }

/* ── Shell: sidebar + main ─────────────────────────────────────────────────── */
.page { display: grid; grid-template-columns: 264px 1fr; min-height: 100vh;
        background: linear-gradient(to right, var(--ink) 264px, var(--bg) 264px); }
.sidebar { background: var(--ink); color: #b7b6c2;
           padding: 22px 14px 16px; display: flex; flex-direction: column; gap: 2px;
           position: sticky; top: 0; height: 100vh; overflow-y: auto; scrollbar-width: thin;
           scrollbar-color: var(--ink-3) transparent; }
.sidebar > * { flex-shrink: 0; }
.sidebar::-webkit-scrollbar-thumb { background: var(--ink-3); }
.sidebar-brand { display: flex; align-items: center; gap: 12px; padding: 2px 8px 4px;
                 font-family: var(--display); font-size: .98rem; font-weight: 600;
                 letter-spacing: -.02em; color: #fff; }
.brand-mark { width: 34px; height: 34px; border-radius: 10px; background: var(--lime);
              color: var(--ink); display: grid; place-items: center; flex: none;
              font-family: var(--display); font-size: .78rem; font-weight: 700; letter-spacing: -.03em; }
.brand-eq { display: flex; align-items: flex-end; gap: 2.5px; height: 15px; }
.brand-eq i { display: block; width: 3.5px; border-radius: 2px; background: var(--ink);
              animation: eq 1.4s var(--ease) infinite; transform-origin: bottom; }
.brand-eq i:nth-child(1) { height: 60%; animation-delay: -.2s; }
.brand-eq i:nth-child(2) { height: 100%; animation-delay: -.6s; }
.brand-eq i:nth-child(3) { height: 45%; animation-delay: -.9s; }
.brand-eq i:nth-child(4) { height: 80%; animation-delay: -.4s; }
@keyframes eq { 0%, 100% { transform: scaleY(1); } 50% { transform: scaleY(.45); } }
@media (prefers-reduced-motion: reduce) { .brand-eq i { animation: none; } }
.brand-sub { display: block; font-family: var(--font); font-size: .68rem; font-weight: 500;
             color: #7d7c8a; letter-spacing: .02em; margin-top: 0; }
.sidebar-subtitle { font-size: .66rem; font-weight: 600; color: #6c6b78;
                    text-transform: uppercase; letter-spacing: .12em; margin: 18px 8px 6px; }
.sidebar-tour { margin: 20px 0 6px; padding: 14px; border-radius: 14px; position: relative; overflow: hidden;
                background: var(--ink-2); border: 1px solid var(--ink-3);
                display: flex; flex-direction: column; gap: 8px; }
.sidebar-tour::before { content: ""; position: absolute; inset: 0 0 auto 0; height: 3px;
                        background: linear-gradient(90deg, var(--lime), var(--coral) 55%, var(--accent)); }
.sidebar-tour-label { font-size: .62rem; font-weight: 600; color: #7d7c8a;
                      text-transform: uppercase; letter-spacing: .14em; }
.sidebar-tour-name { font-family: var(--display); font-size: .92rem; font-weight: 600; color: #fff;
                     line-height: 1.3; letter-spacing: -.02em; overflow-wrap: anywhere; }
.sidebar .sidebar-tour-select { width: 100%; font-size: .8rem; padding: 7px 10px; background: var(--ink-3);
                       border-color: #33333f; color: #e9e8ef; box-shadow: none; }
.sidebar-tour-all { display: flex; align-items: center; gap: 6px; font-size: .78rem; font-weight: 600; color: var(--lime); }
.sidebar-tour-all:hover { color: #e6ff8a; }
.sidebar-tour-all svg { width: 13px; height: 13px; }
.sidebar-tour-all.active { color: #fff; text-decoration: underline; }
.sidebar-tour-form { display: flex; gap: 6px; margin: 0 0 8px; }
.sidebar-tour-form input { flex: 1; min-width: 0; font-size: .8rem; padding: 6px 9px; }
.sidebar-tour-btn { display: grid; place-items: center; width: 32px; flex: none;
                    background: var(--ink-3); color: #b7b6c2;
                    border: 1px solid #33333f; border-radius: var(--radius-sm);
                    cursor: pointer; font-size: .8rem; }
.sidebar-tour-btn:hover { background: #2e2e3a; color: #fff; }
.sidebar-tour-btn svg { width: 14px; height: 14px; }
.sidebar-section { font-size: .62rem; font-weight: 600; color: #6c6b78;
                   text-transform: uppercase; letter-spacing: .14em; margin: 18px 10px 5px; }
.nav-item { display: flex; align-items: center; gap: 11px; font-size: .86rem;
            font-weight: 500; color: #b7b6c2; padding: 8px 10px;
            border-radius: var(--radius-sm); text-decoration: none; position: relative;
            transition: background-color .18s var(--ease), color .18s, transform .18s var(--ease); }
.nav-item svg { width: 17px; height: 17px; flex: none; color: #6f6e7c; transition: color .18s; }
.nav-item:hover { background: var(--ink-2); color: #fff; text-decoration: none; transform: translateX(2px); }
.nav-item:hover svg { color: var(--lime); }
.nav-item.active { background: var(--lime); color: var(--ink); font-weight: 600; }
.nav-item.active svg { color: var(--ink); }
.nav-item.active:hover { transform: none; color: var(--ink); }

.badge { display: inline-block; background: var(--coral); color: var(--on-solid);
         font-size: .62rem; font-weight: 700; border-radius: 99px; padding: 1px 7px; margin-left: 6px; }
.badge.warn { background: var(--warning); }
.badge.ok { background: var(--success); }

.main { display: flex; flex-direction: column; min-height: 100vh; min-width: 0; position: relative; }
.main::before { content: ""; position: absolute; inset: 0 0 auto 0; height: 380px; pointer-events: none; z-index: 0;
                background: radial-gradient(600px 260px at 88% -60px, rgba(31, 59, 255, .10), transparent 70%),
                            radial-gradient(460px 220px at 55% -90px, rgba(212, 255, 63, .22), transparent 70%); }
.topbar { background: rgba(243, 241, 236, .78); backdrop-filter: saturate(160%) blur(16px);
          -webkit-backdrop-filter: saturate(160%) blur(16px);
          border-bottom: 1px solid rgba(211, 205, 192, .55); padding: 0 40px; height: 76px;
          display: flex; align-items: center; justify-content: space-between; gap: 16px;
          position: sticky; top: 0; z-index: 50; }
.topbar h1 { font-family: var(--display); font-size: 1.32rem; font-weight: 600; letter-spacing: -.035em;
             color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
             display: flex; align-items: center; gap: 12px; }
.topbar h1::before { content: ""; width: 10px; height: 10px; border-radius: 50%; flex: none;
                     background: var(--coral); box-shadow: 0 0 0 4px rgba(255, 91, 58, .16);
                     animation: pulse 2.4s ease-in-out infinite; }
@keyframes pulse { 0%, 100% { box-shadow: 0 0 0 4px rgba(255, 91, 58, .16); } 50% { box-shadow: 0 0 0 8px rgba(255, 91, 58, 0); } }
.topbar .meta { font-size: .78rem; font-weight: 500; color: var(--text-3); text-align: right;
                background: var(--surface); border: 1px solid var(--border); border-radius: 99px; padding: 5px 12px; }
.topbar .meta:empty { display: none; }
.content { padding: 32px 40px 64px; flex: 1; display: flex; flex-direction: column; gap: 24px;
           width: 100%; max-width: none; position: relative; z-index: 1;
           animation: rise .5s var(--ease) both; }
@keyframes rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

/* ── Status cards ──────────────────────────────────────────────────────────── */
.conflict { border-radius: var(--radius); padding: 16px 18px; display: flex;
            align-items: flex-start; gap: 12px; margin-bottom: 10px; background: var(--surface);
            border: 1px solid var(--border); box-shadow: var(--shadow-sm); }
.conflict.red { background: var(--danger-soft); border-color: var(--danger-border); }
.conflict.yellow { background: var(--warning-soft); border-color: var(--warning-border); }
.conflict-body { flex: 1; }
.conflict-title { font-size: .9rem; font-weight: 700; margin-bottom: 3px; color: var(--text); }
.conflict-desc { font-size: .82rem; color: var(--text-2); }
.conflict-action { font-size: .8rem; font-weight: 600; color: var(--accent); margin-top: 6px; }

.section-head { font-family: var(--display); font-size: .74rem; font-weight: 600; color: var(--text);
                text-transform: uppercase; letter-spacing: .06em; margin-bottom: 14px; display: flex;
                align-items: center; gap: 10px; }
.section-head::after { content: ""; flex: 1; height: 1px; background: var(--border-strong); }

.task { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
        padding: 20px 22px 18px 26px; display: flex; gap: 14px; margin-bottom: 12px;
        box-shadow: var(--shadow-sm); position: relative; overflow: hidden;
        transition: border-color .2s, box-shadow .25s var(--ease), transform .25s var(--ease);
        animation: rise .45s var(--ease) both; }
.task:nth-child(2) { animation-delay: .04s; } .task:nth-child(3) { animation-delay: .08s; }
.task:nth-child(4) { animation-delay: .12s; } .task:nth-child(5) { animation-delay: .16s; }
.task:nth-child(n+6) { animation-delay: .2s; }
.task:hover { border-color: var(--border-strong); box-shadow: var(--shadow); transform: translateY(-2px); }
.task::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 5px; background: transparent; }
.task.alta::before { background: var(--coral); }
.task.media::before { background: #ffb020; }
.task.bassa::before { background: #2bd47d; }
.task-body { flex: 1; min-width: 0; }
.task-title { font-size: 1rem; font-weight: 700; line-height: 1.4; margin-bottom: 8px; color: var(--text); letter-spacing: -.01em; }
.task-meta { font-size: .78rem; color: var(--text-3); margin-bottom: 8px; }
.task-source { font-size: .74rem; color: var(--text-4); }

.tag { display: inline-flex; align-items: center; gap: 4px; font-size: .7rem; font-weight: 600;
       background: var(--surface-3); color: var(--text-3); border: 1px solid transparent;
       border-radius: 99px; padding: 2px 10px; margin-right: 4px; line-height: 1.6; white-space: nowrap; }
.tag.alta { color: #fff; background: var(--coral); border-color: var(--coral); text-transform: uppercase; letter-spacing: .05em; font-size: .64rem; }
.tag.media { color: #6b3b00; background: #ffe3a3; border-color: #ffd270; text-transform: uppercase; letter-spacing: .05em; font-size: .64rem; }
.tag.bassa { color: #06603a; background: #c9f5dc; border-color: #a2ecc4; text-transform: uppercase; letter-spacing: .05em; font-size: .64rem; }
.tag.ok { color: var(--success); background: var(--success-soft); border-color: var(--success-border); }
.tag.manual { color: var(--manual); background: var(--manual-soft); border-color: var(--manual-border); }

/* Task inserted via the manual-ingest form: tinted so it reads as "not auto-extracted". */
.task.manual { background: var(--manual-soft); border-color: var(--manual-border); }

/* ── Buttons ───────────────────────────────────────────────────────────────── */
.actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 14px; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px;
       font-family: inherit; font-size: .8rem; font-weight: 600; line-height: 1.2;
       padding: 8px 15px; border-radius: 99px; border: 1px solid var(--border-strong);
       background: var(--surface); color: var(--text-2); cursor: pointer; text-decoration: none;
       white-space: nowrap;
       transition: background-color .15s, border-color .15s, color .15s, transform .2s var(--ease), box-shadow .2s; }
.btn:hover { background: var(--surface); border-color: var(--text); color: var(--text); text-decoration: none; transform: translateY(-1px); }
.btn:active { transform: translateY(0) scale(.98); }
.btn:disabled { opacity: .5; cursor: not-allowed; transform: none; }
.btn.primary { background: var(--accent); color: var(--on-solid); border-color: var(--accent);
               box-shadow: 0 6px 16px -6px rgba(31, 59, 255, .55); }
.btn.primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); color: var(--on-solid);
                     box-shadow: 0 10px 22px -8px rgba(31, 59, 255, .6); }
.btn.ghost { background: transparent; color: var(--text-3); border-color: transparent; box-shadow: none; }
.btn.ghost:hover { background: var(--surface-3); color: var(--text); }

button { font-family: inherit; }

.draft-box { margin-top: 14px; background: var(--surface-2); border: 1px solid var(--border);
             border-radius: 12px; padding: 16px; animation: rise .35s var(--ease) both; }
.draft-label { font-family: var(--display); font-size: .64rem; font-weight: 600; color: var(--accent); text-transform: uppercase;
               letter-spacing: .08em; margin-bottom: 10px; }
.draft-text { font-size: .84rem; color: var(--text-2); line-height: 1.7; white-space: pre-wrap; font-family: var(--font); }
.draft-actions { display: flex; gap: 8px; margin-top: 14px; flex-wrap: wrap; }

/* ── Forms ─────────────────────────────────────────────────────────────────── */
.upload-zone { border: 2px dashed var(--border-strong); border-radius: var(--radius); padding: 44px;
               text-align: center; color: var(--text-3); background: var(--surface);
               transition: border-color .2s, background-color .2s; }
.upload-zone input[type=file] { display: block; margin: 16px auto 0; color: var(--text-2); }
select, input[type=text], input[type=date], input[type=time], input[type=number], input[type=email],
input[type=search], input[type=password], input[type=url], input:not([type]), textarea {
  background: var(--surface); border: 1px solid var(--border-strong); color: var(--text);
  padding: 9px 12px; border-radius: var(--radius-sm); font-size: .86rem; font-family: inherit;
  transition: border-color .15s, box-shadow .15s; }
select:hover, input:hover, textarea:hover { border-color: var(--text-4); }
select:focus, input:focus, textarea:focus { outline: none; border-color: var(--accent);
  box-shadow: 0 0 0 4px var(--accent-soft); }
input::placeholder, textarea::placeholder { color: var(--text-4); }
input[type=checkbox], input[type=radio] { accent-color: var(--accent); }
label { color: var(--text-2); }

/* ── Data ──────────────────────────────────────────────────────────────────── */
.content table { border-collapse: collapse; }
.content th { font-weight: 600; color: var(--text-3); }

.fact-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
             padding: 16px 20px; margin-bottom: 10px; box-shadow: var(--shadow-sm);
             transition: box-shadow .2s, transform .2s var(--ease); }
.fact-card:hover { box-shadow: var(--shadow); transform: translateY(-1px); }
.fact-type { font-family: var(--display); font-size: .64rem; color: var(--accent); text-transform: uppercase; font-weight: 600;
             letter-spacing: .08em; margin-bottom: 6px; }
.fact-payload { font-size: .8rem; color: var(--text-2); font-family: var(--mono); }

.flash { background: var(--success-soft); border: 1px solid var(--success-border); border-radius: 12px;
         padding: 12px 16px; color: var(--success); font-size: .86rem; font-weight: 500; margin-bottom: 12px;
         animation: rise .35s var(--ease) both; }

details > summary { cursor: pointer; }

/* Reset entry: pushed to the bottom of the sidebar, apart from navigation. */
.sidebar-danger-section { margin-top: auto; padding-top: 16px; border-top: 1px solid var(--ink-3); }
.nav-item-danger { color: #8f8d98; }
.topbar-right { display: flex; align-items: center; gap: 14px; min-width: 0; }
.topbar-user { display: flex; align-items: center; gap: 8px; padding: 4px 4px 4px 14px;
               background: var(--surface); border: 1px solid var(--border); border-radius: 99px; min-width: 0; }
.topbar-user-email { font-size: .8rem; font-weight: 600; color: var(--text-2);
                     overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 220px; }
.topbar-user-role { font-size: .62rem; font-weight: 700; color: var(--ink); background: var(--lime);
                    border-radius: 99px; padding: 1px 8px; text-transform: uppercase; letter-spacing: .06em; }
.topbar-logout { font-size: .76rem; padding: 6px 12px; }
@media (max-width: 760px) { .topbar-right .meta { display: none; } .topbar-user-email { max-width: 140px; } }
.nav-item-danger:hover, .nav-item-danger.active { background: rgba(217, 45, 32, .16); color: #ff8a7d; }
.nav-item-danger:hover svg, .nav-item-danger.active svg { color: #ff8a7d; }

/* ── Offerte di viaggio ─────────────────────────────────────────────────────
   Griglia allineata: orario, durata, prezzo restano in colonna. */
.term { border: 1px solid var(--border); border-radius: 14px; background: var(--surface);
        margin: 12px 0; overflow: hidden; box-shadow: var(--shadow-sm); font-variant-numeric: tabular-nums; }
.term-head { display: flex; align-items: center; gap: 8px; padding: 11px 14px;
             background: var(--ink); border-bottom: 1px solid var(--ink); }
.term-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--lime); flex: none;
            box-shadow: 0 0 10px var(--lime); }
.term-title { color: #fff; font-size: .8rem; font-weight: 600;
              white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.term-count { margin-left: auto; color: #9d9ca8; font-size: .74rem; flex: none; }

.term-body { max-height: 360px; overflow-y: auto; }
.term-row { display: flex; align-items: center; gap: 12px; padding: 9px 14px;
            font-size: .8rem; border-bottom: 1px solid var(--border); transition: background-color .12s; }
.term-row:last-child { border-bottom: 0; }
.term-row:hover { background: var(--accent-soft); }
.term-legend { color: var(--text-4); font-size: .64rem; font-weight: 600; text-transform: uppercase;
               letter-spacing: .08em; background: var(--surface); }
.term-legend:hover { background: var(--surface); }

.term .c-time  { flex: none; width: 122px; color: var(--text); font-weight: 600; font-family: var(--mono); font-size: .78rem; }
.term .c-dur   { flex: none; width: 118px; color: var(--text-3); }
.term .c-car   { flex: 1; min-width: 0; color: var(--text-2);
                 white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.term .c-price { flex: none; width: 70px; text-align: right; color: var(--text-4); }
.term .c-price.has { color: var(--text); font-weight: 700; }
.term .c-price.alt { color: var(--text-3); }
.term .c-act   { flex: none; width: 70px; text-align: right; }

.term-btn { background: var(--surface); border: 1px solid var(--accent-border); color: var(--accent);
            font-family: inherit; font-size: .72rem; font-weight: 600; padding: 4px 11px;
            border-radius: 99px; cursor: pointer; transition: background-color .15s, color .15s; }
.term-btn:hover { background: var(--accent); color: #fff; border-color: var(--accent); }
.term-btn:disabled { opacity: .5; cursor: wait; }

.term-foot { padding: 8px 14px; border-top: 1px solid var(--border); background: var(--surface-2);
             color: var(--text-3); font-size: .72rem; }

/* ── Responsive ────────────────────────────────────────────────────────────── */
.menu-toggle { display: none; width: 42px; height: 42px; flex: none; border-radius: 12px; border: 1px solid var(--border-strong);
               background: var(--surface); cursor: pointer; flex-direction: column; align-items: center; justify-content: center; gap: 4px; }
.menu-toggle span { display: block; width: 18px; height: 2px; border-radius: 2px; background: var(--text); transition: transform .25s var(--ease), opacity .2s; }
.nav-open .menu-toggle span:nth-child(1) { transform: translateY(6px) rotate(45deg); }
.nav-open .menu-toggle span:nth-child(2) { opacity: 0; }
.nav-open .menu-toggle span:nth-child(3) { transform: translateY(-6px) rotate(-45deg); }
.nav-scrim { display: none; }
.topbar h1 { min-width: 0; }

@media (max-width: 1200px) {
  .page { grid-template-columns: 232px 1fr; background: linear-gradient(to right, var(--ink) 232px, var(--bg) 232px); }
  .topbar, .content { padding-left: 28px; padding-right: 28px; }
}
@media (max-width: 960px) {
  .page { grid-template-columns: 1fr; background: var(--bg); }
  .menu-toggle { display: flex; }
  .sidebar { position: fixed; inset: 0 auto 0 0; width: min(300px, 86vw); height: 100vh; height: 100dvh; z-index: 200;
             transform: translateX(-102%); transition: transform .32s var(--ease); box-shadow: 20px 0 60px -20px rgba(0,0,0,.5); }
  .nav-open .sidebar { transform: none; }
  .nav-scrim { display: block; position: fixed; inset: 0; z-index: 150; background: rgba(13, 13, 18, .45);
               backdrop-filter: blur(3px); opacity: 0; pointer-events: none; transition: opacity .3s; }
  .nav-open .nav-scrim { opacity: 1; pointer-events: auto; }
  .nav-open { overflow: hidden; }
  .nav-open .asst-fab { opacity: 0; pointer-events: none; }
  .topbar { padding: 0 18px; height: 64px; gap: 12px; justify-content: flex-start; }
  .topbar-right { margin-left: auto; }
  .topbar h1 { font-size: 1.05rem; }
  .content { padding: 22px 18px 90px; gap: 18px; }
  .content table { display: block; max-width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .two-col { grid-template-columns: 1fr !important; }
}
@media (max-width: 760px) {
  .content [style*="display:flex"]:not([style*="flex-direction:column"]), .content [style*="display:inline-flex"] { flex-wrap: wrap; min-width: 0; }
  .content .upload-zone { height: auto !important; min-height: 140px; }
  .content input[type=date], .content select { max-width: 100%; }
  .topbar-user-email { display: none; }
  .topbar-user { padding-left: 4px; }
  .topbar h1::before { display: none; }
  .task { padding: 16px 16px 14px 20px; }
  .actions .btn, .draft-actions .btn { flex: 1 1 auto; }
  .upload-zone { padding: 26px 16px; }
  .term .c-dur { display: none; }
  .term .c-time { width: 96px; }
}
@media (max-width: 480px) {
  .topbar-user-role { display: none; }
  .content { padding: 16px 12px 90px; }
  .term .c-car { display: none; }
}

/* Icon tile used at the top of upload / sync areas. */
.zone-icon { width: 46px; height: 46px; border-radius: 14px; display: grid; place-items: center;
             background: var(--ink); color: var(--lime); flex: none; transition: transform .25s var(--ease), background-color .2s; }
.zone-icon svg { width: 21px; height: 21px; }
.zone-icon-sm { width: 30px; height: 30px; border-radius: 9px; }
.zone-icon-sm svg { width: 15px; height: 15px; }
.upload-zone:hover .zone-icon { background: var(--accent); color: #fff; transform: rotate(-6deg) scale(1.05); }
label:hover > .upload-zone { border-color: var(--accent); background: var(--accent-soft); }

/* Data tables (calendar, quick views, CO₂ detail…): a white card with an ink header. */
.data-table { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
              border-collapse: separate; border-spacing: 0; overflow: hidden; box-shadow: var(--shadow-sm); }
.data-table th { padding: 12px 14px !important; background: var(--surface); color: var(--text-3);
                 font-size: .66rem; font-weight: 700; text-transform: uppercase; letter-spacing: .08em;
                 text-align: left; border-bottom: 1.5px solid var(--text); white-space: nowrap; }
.data-table td { padding: 12px 14px !important; border-bottom: 1px solid var(--border); vertical-align: top; }
.data-table tr:last-child td { border-bottom: 0; }
.data-table tbody tr { transition: background-color .12s; }
.data-table tbody tr:hover td { background: var(--accent-soft); }

/* ── Task attivi: list layout ─────────────────────────────────────────────── */


.tk-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; flex-wrap: wrap; }
.tk-focus { font-family: var(--display); font-size: clamp(1.4rem, 2.4vw, 2rem); font-weight: 600; letter-spacing: -.04em; line-height: 1.15; }
.tk-focus span { color: var(--text-4); }
.tk-focus em { font-style: normal; color: var(--coral); }
.tk-tools { display: flex; gap: 6px; }

.tk-tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.tk-tab { background: none; border: 0; padding: 10px 14px; font-size: .86rem; font-weight: 600; color: var(--text-3); cursor: pointer;
          border-bottom: 2px solid transparent; margin-bottom: -1px; transition: color .15s, border-color .15s; }
.tk-tab:hover { color: var(--text); }
.tk-tab.on { color: var(--text); border-bottom-color: var(--text); }
.tk-tab small { font-family: var(--mono); font-size: .74rem; color: var(--text-4); margin-left: 6px; font-weight: 500; }

.tk-alert { display: flex; align-items: center; gap: 10px; font-size: .86rem; color: var(--text-2); padding: 12px 16px;
            border: 1px solid var(--border); border-radius: 12px; background: var(--surface); }
.tk-alert i { width: 8px; height: 8px; border-radius: 50%; background: var(--coral); flex: none; }
.tk-alert a { margin-left: auto; font-weight: 600; white-space: nowrap; }

.tk-group { display: flex; flex-direction: column; }
.tk-group-h { display: flex; align-items: baseline; gap: 10px; padding: 0 4px 10px; }
.tk-group-h h3 { font-size: .8rem; font-weight: 700; color: var(--text); text-transform: uppercase; letter-spacing: .08em; }
.tk-group-h span { font-family: var(--mono); font-size: .76rem; color: var(--text-4); }
.tk-list { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: visible; }

.tk-row { display: grid; grid-template-columns: 22px 10px minmax(0, 1fr) auto auto 36px; align-items: center; gap: 14px;
          padding: 16px 18px; border-bottom: 1px solid var(--border); transition: background-color .15s; position: relative; }
.tk-row:last-child { border-bottom: 0; }
.tk-row:hover { background: var(--surface-2); }
.tk-row input[type=checkbox] { opacity: .25; transition: opacity .15s; width: 16px; height: 16px; }
.tk-row:hover input[type=checkbox], .tk-row input:checked { opacity: 1; }
.tk-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--border-strong); }
.tk-dot.alta { background: var(--coral); box-shadow: 0 0 0 4px rgba(255, 91, 58, .14); }
.tk-dot.media { background: #ffb020; }
.tk-dot.attesa { background: transparent; border: 2px solid var(--text-4); width: 9px; height: 9px; }
.tk-title { font-size: .95rem; font-weight: 600; color: var(--text); line-height: 1.35; overflow: hidden; text-overflow: ellipsis; }
.tk-meta { font-size: .78rem; color: var(--text-3); margin-top: 3px; }
.tk-when { font-family: var(--mono); font-size: .78rem; color: var(--text-3); white-space: nowrap; text-align: right; min-width: 92px; }
.tk-when.late { color: var(--danger); font-weight: 600; }
.tk-when.soon { color: var(--text); font-weight: 600; }
.tk-main { white-space: nowrap; }
.tk-row .btn { padding: 7px 14px; font-size: .78rem; }
.tk-row .btn.quiet { background: var(--surface); }

.tk-more { position: relative; }
.tk-more summary { list-style: none; width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; cursor: pointer;
                   color: var(--text-3); font-size: 1.1rem; letter-spacing: 1px; transition: background-color .15s; }
.tk-more summary::-webkit-details-marker { display: none; }
.tk-more summary:hover, .tk-more[open] summary { background: var(--surface-3); color: var(--text); }
.tk-menu { position: absolute; right: 0; top: 40px; z-index: 20; min-width: 220px; background: var(--surface); border: 1px solid var(--border);
           border-radius: 14px; box-shadow: var(--shadow); padding: 6px; animation: rise .18s var(--ease) both; }
.tk-menu button { display: block; width: 100%; text-align: left; background: none; border: 0; padding: 9px 12px; border-radius: 9px;
                  font-size: .84rem; color: var(--text-2); cursor: pointer; }
.tk-menu button:hover { background: var(--surface-3); color: var(--text); }
.tk-menu hr { margin: 5px 6px; }
.tk-menu .danger { color: var(--danger); }

.tk-legend { display: flex; gap: 18px; flex-wrap: wrap; font-size: .76rem; color: var(--text-3); }
.tk-legend span { display: inline-flex; align-items: center; gap: 7px; }


@media (max-width: 860px) {
  .tk-row, .task .tk-row { grid-template-columns: 18px 10px minmax(0, 1fr) 36px; gap: 8px 10px; padding: 14px; }
  .tk-row input[type=checkbox] { opacity: 1; }
  .tk-row > :nth-child(1) { grid-column: 1; grid-row: 1; }
  .tk-row > :nth-child(2) { grid-column: 2; grid-row: 1; }
  .tk-text { grid-column: 3; grid-row: 1; }
  .tk-when { grid-column: 3; grid-row: 2; text-align: left; min-width: 0; }
  .tk-when:empty { display: none; }
  .tk-main { grid-column: 3 / 5; grid-row: 3; }
  .tk-main .btn { width: 100%; }
  .tk-more { grid-column: 4; grid-row: 1; }
  .tk-tabs { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
  .tk-tab { padding: 10px 11px; white-space: nowrap; flex: none; }
}

.task:has(.tk-row) { overflow: visible; padding: 0; }
.task:has(.tk-row):hover { transform: none; }
.task:has(.tk-row)::before { display: none; }
.tk-main { min-width: 170px; text-align: right; }
.tk-list .task { border: 0; border-bottom: 1px solid var(--border); border-radius: 0; margin: 0; padding: 0; box-shadow: none;
                 background: transparent; display: block; overflow: visible; animation: none; }
.tk-list .task:last-child { border-bottom: 0; }
.tk-list .task:first-child .tk-row { border-radius: var(--radius) var(--radius) 0 0; }
.tk-list .task:last-child .tk-row { border-radius: 0 0 var(--radius) var(--radius); }
.tk-list .task:hover { transform: none; box-shadow: none; }
.tk-list .task::before { display: none; }
.task .tk-row { border-bottom: 0; }
.task:not(.editing) { padding: 0; }
.task.editing, .tk-list .task.editing { padding: 20px 22px; background: var(--surface-2); }
.task .task-title { font-size: .95rem; font-weight: 600; margin: 0; }
.task.manual .tk-row { background: var(--manual-soft); }
.tk-manual { color: var(--manual); font-weight: 600; }
.tk-dot.ok { background: var(--success); }
.tk-text { min-width: 0; }
.task [id^="draft-zone-"]:not(:empty), .task [id^="sim-feedback-"]:not(:empty) { padding: 0 18px 16px 64px; }
.task [id^="draft-zone-"] .draft-box { margin-top: 0; }
.tk-menu button:disabled { opacity: .5; cursor: wait; }
.tk-bulk { display: none; align-items: center; gap: 10px; flex-wrap: wrap; position: sticky; top: 88px; z-index: 30;
           background: var(--ink); color: #fff; border-radius: 14px; padding: 10px 12px 10px 18px; box-shadow: var(--shadow); }
.tk-bulk.on { display: flex; animation: rise .25s var(--ease) both; }
.tk-bulk #sel-count { font-weight: 700; margin-right: auto; color: var(--lime); }
.tk-bulk .btn:not(.primary) { background: transparent; color: #fff; border-color: #3a3a46; }
.tk-bulk .btn:not(.primary):hover { border-color: #fff; }
details.tk-alert { display: block; }
details.tk-alert summary { display: flex; align-items: center; gap: 10px; list-style: none; cursor: pointer; }
details.tk-alert summary::-webkit-details-marker { display: none; }
details.tk-alert summary b { margin-left: auto; color: var(--accent); white-space: nowrap; }
details.tk-alert[open] summary b { color: var(--text-3); }
.tk-alert-first { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1; }
.tk-empty { color: var(--text-3); text-align: center; padding: 56px 20px; background: var(--surface); border: 1px dashed var(--border-strong); border-radius: var(--radius); }
@media (max-width: 860px) {
  .task [id^="draft-zone-"]:not(:empty), .task [id^="sim-feedback-"]:not(:empty) { padding: 0 14px 14px; }
  .tk-bulk { top: 72px; }
}
body:has(.tk-more[open]) .asst-fab { opacity: 0; pointer-events: none; }
@media (max-width: 860px) { .tk-main { min-width: 0; text-align: left; } }

/* ── Shared labels: status pill, urgency dot, day type ─────────────────────── */
.pill { display: inline-flex; align-items: center; font-size: .7rem; font-weight: 600; border-radius: 99px; padding: 2px 10px;
        background: var(--surface-3); color: var(--text-2); white-space: nowrap; }
.pill.st-pending, .pill.st-in_progress { background: var(--accent-soft); color: var(--accent); }
.pill.st-in_attesa_risposta, .pill.st-bozza_inviata { background: var(--warning-soft); color: var(--warning); }
.pill.st-done, .pill.st-confirmed { background: var(--success-soft); color: var(--success); }
.pill.st-cancelled { background: var(--surface-3); color: var(--text-4); text-decoration: line-through; }
.u-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: #2bd47d; margin-right: 8px; vertical-align: 1px; flex: none; }
.u-dot.alta { background: var(--coral); } .u-dot.media { background: #ffb020; }
.et-cell[data-key="day_type"]::before { content: ""; display: inline-block; width: 8px; height: 8px; border-radius: 50%;
        margin-right: 8px; vertical-align: 1px; background: var(--border-strong); }
.et-cell[data-key="day_type"][data-value="show"]::before { background: var(--coral); }
.et-cell[data-key="day_type"][data-value="travel"]::before { background: #5b73ff; }
.et-cell[data-key="day_type"][data-value="day_off"]::before { background: var(--lime); box-shadow: inset 0 0 0 1px #9fbf1f; }
.day-tasks { display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.day-task { display: flex; align-items: center; gap: 12px; padding: 12px 16px; border-bottom: 1px solid var(--border); }
.day-task:last-child { border-bottom: 0; }
.day-task-type { font-size: .74rem; color: var(--text-3); min-width: 110px; }
.day-task-desc { flex: 1; min-width: 0; font-weight: 600; font-size: .88rem; }
.day-head { background: var(--ink); color: #fff; border-radius: 18px; padding: 22px 26px; }
.day-head > div > div:first-child { color: #8f8d98 !important; }
.day-head > div > div:last-child { color: #fff !important; font-family: var(--display); font-size: 1.15rem !important; font-weight: 600; letter-spacing: -.02em; }
.day-head .btn:not(.primary) { background: transparent; color: #fff; border-color: #3a3a46; }

/* ── Inbox ─────────────────────────────────────────────────────────────────── */
.ib-drop { display: flex; align-items: center; gap: 20px; flex-wrap: wrap; padding: 26px 28px; background: var(--surface);
           border: 2px dashed var(--border-strong); border-radius: var(--radius); transition: border-color .2s, background-color .2s; }
.ib-drop.over, .ib-drop:hover { border-color: var(--accent); background: var(--accent-soft); }
.ib-drop:hover .zone-icon { background: var(--accent); color: #fff; transform: rotate(-6deg) scale(1.05); }
.ib-drop-text { flex: 1; min-width: 240px; }
.ib-drop-title { font-family: var(--display); font-size: 1.05rem; font-weight: 600; letter-spacing: -.02em; }
.ib-drop-sub { font-size: .82rem; color: var(--text-3); margin-top: 4px; }
.ib-drop-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.ib-type { display: flex; align-items: center; gap: 8px; font-size: .78rem; font-weight: 600; color: var(--text-3); }
.ib-type select { padding: 7px 10px; font-size: .8rem; width: auto; max-width: 220px; }
label.btn { cursor: pointer; }
.ib-row { display: flex; align-items: center; gap: 14px; padding: 16px 18px; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.ib-row:last-child { border-bottom: 0; }
.ib-row .tk-text { flex: 1; min-width: 220px; }
.ib-ic { width: 34px; height: 34px; border-radius: 10px; background: var(--surface-3); color: var(--text-2); display: grid; place-items: center; flex: none; }
.ib-ic svg { width: 16px; height: 16px; }
.ib-inline { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
details.ib-note { display: block; }
details.ib-note summary { display: flex; align-items: center; gap: 14px; list-style: none; cursor: pointer; flex-wrap: wrap; }
details.ib-note summary::-webkit-details-marker { display: none; }
details.ib-note[open] summary .btn { display: none; }
details.ib-note form { margin: 14px 0 2px 48px; }
.ib-msg { padding: 12px 18px; }
.ib-msg .pill { min-width: 78px; justify-content: center; }
@media (max-width: 760px) { details.ib-note form { margin-left: 0; } .ib-drop { padding: 20px; } .ib-drop-actions { width: 100%; } }

/* ── Calendario ────────────────────────────────────────────────────────────── */
.cal-report { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: .78rem; color: var(--text-3); font-weight: 600; }
.cal-report input { padding: 6px 9px; font-size: .8rem; }
.cal-legend { margin-left: auto; display: flex; align-items: center; gap: 6px 8px; flex-wrap: wrap; font-size: .74rem; color: var(--text-3); padding: 0 4px; }
.cal-legend i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; margin-left: 6px; }
.cal-legend i.show, .cal-day.show { --c: var(--coral); } .cal-legend i.travel, .cal-day.travel { --c: #5b73ff; }
.cal-legend i.day_off, .cal-day.day_off { --c: #b8e22a; } .cal-legend i.other, .cal-day.other { --c: var(--text-4); }
.cal-legend i { background: var(--c); }
.cal-legend .due { margin-left: 8px; }
.cal-nav { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; flex-wrap: wrap; }
.cal-nav-t { font-family: var(--display); font-size: 1.5rem; font-weight: 600; letter-spacing: -.035em; min-width: 220px; text-align: center; text-transform: capitalize; }
.cal-arrow { width: 44px; height: 44px; border-radius: 50%; border: 1px solid var(--border-strong); background: var(--surface); font-size: 1.5rem; line-height: 1;
             cursor: pointer; color: var(--text); transition: background-color .15s, color .15s, transform .15s; }
.cal-arrow:hover:not(:disabled) { background: var(--ink); color: var(--lime); transform: scale(1.05); }
.cal-arrow:disabled { opacity: .3; cursor: default; }
.cal-month { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; }
.cal-month.big .cal-grid { gap: 8px; }
.cal-month.big .cal-day { min-height: clamp(96px, 13vh, 150px); padding: 10px 12px; }
.cal-month.big .cal-n { font-size: 1.05rem; }
.cal-month.big .cal-city { font-size: .95rem; }
.cal-venue { font-size: .74rem; color: var(--text-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cal-day.past { opacity: .55; }
.cal-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 6px; }
.cal-ygrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; margin-bottom: 26px; }
.cal-mini { background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 14px; cursor: pointer; transition: box-shadow .2s, transform .2s var(--ease); }
.cal-mini:hover { box-shadow: var(--shadow); transform: translateY(-2px); }
.cal-mini.has { border-color: var(--text); }
.cal-mini h4 { font-size: .86rem; font-weight: 700; text-transform: capitalize; margin-bottom: 8px; display: flex; align-items: center; gap: 8px; }
.cal-mini h4 span { font-family: var(--mono); font-size: .68rem; background: var(--ink); color: var(--lime); border-radius: 99px; padding: 1px 7px; }
.cal-mini .cal-grid { gap: 3px; }
.cal-mini .cal-wd { font-size: .58rem; padding: 0; text-align: center; }
.cal-mini .cal-day { min-height: 0; aspect-ratio: 1; padding: 0; border-radius: 6px; align-items: center; justify-content: center; background: transparent; }
.cal-mini .cal-day.on { border: 0; background: var(--c); color: #fff; }
.cal-mini .cal-day.day_off { color: var(--ink); }
.cal-mini .cal-n { font-family: var(--font); font-size: .7rem; font-weight: 600; }
.cal-mini .due { width: 6px; height: 6px; min-width: 0; padding: 0; font-size: 0; top: 1px; right: 1px; background: var(--ink); }
.cal-day { min-height: 82px; border-radius: 12px; background: var(--surface-2); padding: 8px 9px; position: relative; display: flex; flex-direction: column; gap: 2px; color: var(--text-4); }
.cal-day.empty { background: transparent; }
.cal-day.on { background: var(--surface); border: 1px solid var(--border); border-top: 4px solid var(--c); color: var(--text);
              text-decoration: none; transition: transform .2s var(--ease), box-shadow .2s; }
.cal-day.on:hover { transform: translateY(-2px); box-shadow: var(--shadow); text-decoration: none; color: var(--text); }
.cal-day.show { background: #fff3f0; }
.cal-day.today { outline: 2px solid var(--accent); outline-offset: 1px; }
.cal-n { font-family: var(--display); font-size: .9rem; font-weight: 600; }
.cal-city { font-size: .8rem; font-weight: 700; line-height: 1.2; margin-top: auto; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cal-kind { font-size: .66rem; color: var(--text-3); text-transform: uppercase; letter-spacing: .05em; font-weight: 600; }
.due { position: absolute; top: 7px; right: 7px; min-width: 18px; height: 18px; border-radius: 99px; background: var(--ink); color: var(--lime);
       font-size: .64rem; font-weight: 700; display: inline-grid; place-items: center; padding: 0 5px; font-family: var(--mono); }
.cal-legend .due { position: static; }
.cal-legs { display: grid; grid-template-columns: repeat(var(--n, 4), minmax(240px, 1fr)); gap: 14px; overflow-x: auto; padding-bottom: 10px; align-items: start; scroll-snap-type: x proximity; }
.cal-leg { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; scroll-snap-align: start; }
.cal-leg-h { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.cal-leg-h h3 { font-family: var(--display); font-size: 1.05rem; font-weight: 600; letter-spacing: -.03em; flex: 1; }
.cal-leg-h > span:last-child { font-size: .74rem; color: var(--text-3); }
.cal-leg-i { width: 26px; height: 26px; border-radius: 50%; background: var(--ink); color: var(--lime); display: grid; place-items: center; font-size: .74rem; font-weight: 700; }
.cal-leg-day { display: grid; grid-template-columns: 46px minmax(0, 1fr) auto; gap: 10px; align-items: center; padding: 9px 6px; border-top: 1px solid var(--border); color: inherit; text-decoration: none; border-radius: 8px; }
.cal-leg-day:hover { background: var(--accent-soft); text-decoration: none; color: inherit; }
.cal-leg-date { text-align: center; font-size: .62rem; text-transform: uppercase; color: var(--text-3); font-weight: 700; line-height: 1.1; }
.cal-leg-date b { display: block; font-family: var(--display); font-size: 1.1rem; color: var(--text); }
.cal-leg-day .task-title { font-size: .84rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: block; }
.cal-leg-arrow { align-self: center; color: var(--coral); font-size: 1.3rem; font-weight: 700; flex: none; }
.ov-pill { font-size: .64rem; font-weight: 700; border-radius: 99px; padding: 2px 9px; text-transform: uppercase; letter-spacing: .05em; white-space: nowrap; }
.ov-pill.show { background: var(--coral); color: #fff; } .ov-pill.travel { background: var(--accent-soft); color: var(--accent); }
.ov-pill.day_off { background: #e9fbc0; color: #3d5200; } .ov-pill.other { background: var(--surface-3); color: var(--text-3); }
@media (max-width: 760px) {
  .cal-day { min-height: 58px; padding: 5px; border-radius: 8px; }
  .cal-city { font-size: .66rem; } .cal-kind { display: none; } .cal-n { font-size: .78rem; }
  .cal-month { padding: 14px 10px; } .cal-grid { gap: 3px; }
  .cal-legend { display: none; }
  .cal-day .due { top: 3px; right: 3px; min-width: 14px; height: 14px; font-size: .56rem; padding: 0 3px; }
  .cal-report input { flex: 1; min-width: 0; }
  .cal-legs { grid-template-columns: repeat(var(--n, 4), 82vw); }
  .cal-month.big .cal-day { min-height: 64px; padding: 5px; } .cal-venue { display: none; }
  .cal-nav-t { min-width: 0; flex: 1; font-size: 1.15rem; } .cal-arrow { width: 38px; height: 38px; }
}
.tk-tools { flex-wrap: wrap; }
.tk-text .task-title { overflow-wrap: anywhere; }
.src-row .tk-text, .ib-row .tk-text { min-width: 0; }
.src-row { scroll-margin-top: 90px; }
.cal-leg { position: relative; }
.cal-leg:not(:last-child)::after { content: "→"; position: absolute; right: -12px; top: 18px; color: var(--coral); font-weight: 700; z-index: 1; }
@media (max-width: 760px) { .tk-tools { width: 100%; } .tk-tools .btn, .tk-tools form { flex: 1 1 auto; } .tk-tools form .btn { width: 100%; } }

/* ── CO₂ rating ────────────────────────────────────────────────────────────── */
.rt { display: inline-flex; align-items: center; gap: 6px; font-size: .7rem; font-weight: 700; border-radius: 99px; padding: 3px 10px;
      text-transform: uppercase; letter-spacing: .05em; white-space: nowrap; }
.rt::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.rt.ottimo { background: #d9f99d; color: #2f5d00; } .rt.green { background: #dcfce7; color: #08703f; }
.rt.buono { background: #e0f2fe; color: #075985; } .rt.migliorabile { background: #fff1d6; color: #9a4a00; }
.rt.alto { background: #ffe1dc; color: #b42318; }
.rt-scale { display: grid; grid-template-columns: repeat(5, 1fr); gap: 4px; margin-top: 16px; }
.rt-scale div { height: 8px; border-radius: 99px; opacity: .28; }
.rt-scale div.on { opacity: 1; height: 12px; margin-top: -2px; box-shadow: 0 0 0 3px rgba(255,255,255,.15); }
.rt-scale .ottimo { background: #b5ef3b; } .rt-scale .green { background: #22c55e; } .rt-scale .buono { background: #38bdf8; }
.rt-scale .migliorabile { background: #ffb020; } .rt-scale .alto { background: var(--coral); }
.rt-scale-l { display: grid; grid-template-columns: repeat(5, 1fr); gap: 4px; font-size: .62rem; text-transform: uppercase; letter-spacing: .06em; color: #8f8d98; margin-top: 6px; font-weight: 600; }
.rt-scale-l span.on { color: #fff; }

/* ── Panoramica & shared cards (ov-*) ── */

.ov-hero { background: var(--ink); color: #fff; border-radius: 22px; padding: 30px 34px; display: grid;
           grid-template-columns: 1.4fr 1fr; gap: 28px; position: relative; overflow: hidden; }
.ov-hero::before { content: ""; position: absolute; width: 520px; height: 520px; right: -160px; top: -260px; border-radius: 50%;
                   background: radial-gradient(circle, rgba(31, 59, 255, .6), transparent 65%); }
.ov-hero::after { content: ""; position: absolute; width: 380px; height: 380px; left: 30%; bottom: -280px; border-radius: 50%;
                  background: radial-gradient(circle, rgba(212, 255, 63, .22), transparent 65%); }
.ov-hero > * { position: relative; z-index: 1; }
.ov-eyebrow { font-size: .66rem; font-weight: 600; letter-spacing: .14em; text-transform: uppercase; color: #8f8d98; }
.ov-tour { font-family: var(--display); font-size: clamp(1.4rem, 2.4vw, 2.1rem); font-weight: 600; letter-spacing: -.04em; line-height: 1.1; margin: 8px 0 12px; }
.ov-span { display: flex; flex-wrap: wrap; gap: 8px; }
.ov-chip { font-size: .74rem; font-weight: 600; color: #e9e8ef; background: rgba(255,255,255,.08); border: 1px solid rgba(255,255,255,.12); border-radius: 99px; padding: 4px 11px; }
.ov-chip-dot::before { content: ""; display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--dc); margin-right: 7px; vertical-align: 1px; }
.ov-route { margin-top: 22px; display: flex; flex-direction: column; gap: 10px; }
.ov-route-line { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 10px; }
.ov-route-line span { font-family: var(--display); font-size: .92rem; font-weight: 600; letter-spacing: -.02em; }
.ov-route-line i { width: 28px; height: 2px; border-radius: 2px; background: linear-gradient(90deg, var(--lime), var(--coral)); position: relative; }
.ov-route-line i::after { content: ""; position: absolute; right: -2px; top: -3px; border: 4px solid transparent; border-left-color: var(--coral); }
.ov-next { background: rgba(255,255,255,.06); border: 1px solid rgba(255,255,255,.12); border-radius: 18px; padding: 20px 22px; display: flex; flex-direction: column; justify-content: space-between; gap: 10px; }
.ov-count { font-family: var(--display); font-size: 3.4rem; line-height: 1; font-weight: 700; color: var(--lime); letter-spacing: -.05em; }
.ov-count small { font-size: .9rem; color: #b7b6c2; font-weight: 500; letter-spacing: 0; margin-left: 6px; }
.ov-next-city { font-weight: 700; font-size: 1rem; }
.ov-next-city span { color: #8f8d98; font-weight: 500; }

.ov-kpis { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 14px; }
.ov-kpi { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px 18px 16px;
          display: flex; flex-direction: column; gap: 4px; text-decoration: none; color: inherit; box-shadow: var(--shadow-sm);
          transition: transform .25s var(--ease), box-shadow .25s var(--ease), border-color .2s; animation: rise .45s var(--ease) both; position: relative; overflow: hidden; }
.ov-kpi:hover { transform: translateY(-3px); box-shadow: var(--shadow); border-color: var(--border-strong); text-decoration: none; color: inherit; }
.ov-kpi::after { content: ""; position: absolute; left: 18px; right: 18px; bottom: 0; height: 3px; border-radius: 3px 3px 0 0; background: var(--kc, var(--accent)); opacity: .9; }
.ov-kpi-label { font-size: .7rem; font-weight: 600; color: var(--text-3); text-transform: uppercase; letter-spacing: .08em; }
.ov-kpi-val { font-family: var(--display); font-size: 2rem; font-weight: 600; letter-spacing: -.04em; line-height: 1.1; color: var(--text); }
.ov-kpi-val small { font-size: .8rem; font-weight: 500; color: var(--text-3); letter-spacing: 0; margin-left: 3px; }
.ov-kpi-sub { font-size: .76rem; color: var(--text-3); }
.ov-kpi:nth-child(2) { animation-delay: .04s; } .ov-kpi:nth-child(3) { animation-delay: .08s; }
.ov-kpi:nth-child(4) { animation-delay: .12s; } .ov-kpi:nth-child(5) { animation-delay: .16s; } .ov-kpi:nth-child(6) { animation-delay: .2s; }

.ov-grid { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 16px; }
.ov-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 22px 24px;
           box-shadow: var(--shadow-sm); min-width: 0; animation: rise .5s var(--ease) both; }
.ov-card h2 { font-size: .8rem; text-transform: uppercase; letter-spacing: .06em; margin-bottom: 18px; display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.ov-card h2 a { font-family: var(--font); font-size: .76rem; font-weight: 600; text-transform: none; letter-spacing: 0; }
.span-4 { grid-column: span 4; } .span-5 { grid-column: span 5; } .span-7 { grid-column: span 7; } .span-8 { grid-column: span 8; }

.ov-donut-wrap { display: flex; align-items: center; gap: 24px; }
.ov-donut { width: 132px; height: 132px; border-radius: 50%; flex: none; display: grid; place-items: center;
            background: conic-gradient(var(--accent) calc(var(--p) * 1%), var(--surface-3) 0); }
.ov-donut-in { width: 96px; height: 96px; border-radius: 50%; background: var(--surface); display: grid; place-items: center; text-align: center; }
.ov-donut-in b { font-family: var(--display); font-size: 1.5rem; font-weight: 600; letter-spacing: -.04em; display: block; line-height: 1; }
.ov-donut-in span { font-size: .66rem; color: var(--text-3); text-transform: uppercase; letter-spacing: .08em; }
.ov-legend { display: flex; flex-direction: column; gap: 9px; font-size: .84rem; flex: 1; }
.ov-legend div { display: flex; align-items: center; gap: 9px; }
.ov-legend i { width: 10px; height: 10px; border-radius: 3px; flex: none; }
.ov-legend b { margin-left: auto; font-family: var(--mono); font-size: .82rem; }

.ov-stack { display: flex; height: 14px; border-radius: 99px; overflow: hidden; background: var(--surface-3); margin-bottom: 16px; }
.ov-stack span { display: block; height: 100%; transition: width .6s var(--ease); }
.ov-bars { display: flex; flex-direction: column; gap: 11px; }
.ov-bar-row { display: grid; grid-template-columns: 120px 1fr 32px; align-items: center; gap: 12px; font-size: .84rem; }
.ov-bar { height: 10px; border-radius: 99px; background: var(--surface-3); overflow: hidden; }
.ov-bar span { display: block; height: 100%; border-radius: 99px; background: linear-gradient(90deg, var(--accent), #5b73ff);
               transform-origin: left; animation: grow .8s var(--ease) both; }
@keyframes grow { from { transform: scaleX(0); } to { transform: scaleX(1); } }
.ov-bar-row b { font-family: var(--mono); font-size: .8rem; text-align: right; }

.ov-dates { display: flex; flex-direction: column; }
.ov-date { display: grid; grid-template-columns: 58px 1fr auto; align-items: center; gap: 14px; padding: 11px 0;
           border-bottom: 1px solid var(--border); text-decoration: none; color: inherit; transition: background-color .15s, padding .2s var(--ease); border-radius: 10px; }
.ov-date:last-child { border-bottom: 0; }
.ov-date:hover { background: var(--accent-soft); padding-left: 8px; padding-right: 8px; text-decoration: none; color: inherit; }
.ov-cal { background: var(--ink); color: #fff; border-radius: 10px; text-align: center; padding: 6px 0 5px; line-height: 1.05; }
.ov-cal b { font-family: var(--display); font-size: 1.1rem; display: block; }
.ov-cal span { font-size: .6rem; text-transform: uppercase; letter-spacing: .1em; color: var(--lime); }
.ov-date-city { font-weight: 700; font-size: .92rem; }
.ov-date-sub { font-size: .76rem; color: var(--text-3); }
.ov-pill { font-size: .66rem; font-weight: 700; border-radius: 99px; padding: 2px 9px; text-transform: uppercase; letter-spacing: .05em; white-space: nowrap; }
.ov-pill.show { background: var(--coral); color: #fff; }
.ov-pill.travel { background: var(--accent-soft); color: var(--accent); }
.ov-pill.day_off { background: #e9fbc0; color: #3d5200; }
.ov-pill.other { background: var(--surface-3); color: var(--text-3); }

.ov-prio { display: flex; flex-direction: column; gap: 8px; }
.ov-prio a { display: grid; grid-template-columns: 6px 1fr auto; gap: 14px; align-items: center; padding: 12px 14px 12px 0;
             border: 1px solid var(--border); border-radius: 12px; text-decoration: none; color: inherit; overflow: hidden;
             transition: transform .2s var(--ease), border-color .2s; }
.ov-prio a:hover { transform: translateX(3px); border-color: var(--border-strong); text-decoration: none; color: inherit; }
.ov-prio i { align-self: stretch; }
.ov-prio .t { font-size: .86rem; font-weight: 600; line-height: 1.35; }
.ov-prio .m { font-size: .74rem; color: var(--text-3); margin-top: 2px; }
.ov-due { font-family: var(--mono); font-size: .74rem; font-weight: 500; color: var(--text-3); white-space: nowrap; }
.ov-due.late { color: var(--danger); font-weight: 700; }

.ov-mini { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 10px; }
.ov-mini div { background: var(--surface-2); border: 1px solid var(--border); border-radius: 12px; padding: 12px 14px; }
.ov-mini b { font-family: var(--display); font-size: 1.3rem; font-weight: 600; letter-spacing: -.03em; display: block; }
.ov-mini span { font-size: .72rem; color: var(--text-3); }
.ov-empty { font-size: .86rem; color: var(--text-3); padding: 8px 0; }

@media (max-width: 1280px) { .ov-kpis { grid-template-columns: repeat(3, minmax(0,1fr)); } .span-4, .span-5, .span-7, .span-8 { grid-column: span 6; } }
@media (max-width: 860px) { .ov-hero { grid-template-columns: 1fr; padding: 24px; } .ov-kpis { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .ov-grid > * { grid-column: 1 / -1 !important; } .ov-kpi-val { font-size: 1.6rem; } }

.day-back { margin-bottom: -10px; }
.day-back .btn { padding: 7px 14px; }
.cal-year .cal-nav-t { text-align: left; min-width: 0; }
.wd-s { display: none; }
@media (max-width: 760px) {
  .wd-l { display: none; } .wd-s { display: inline; }
  .cal-nav .cal-nav-t { order: -1; flex-basis: 100%; text-align: left; }
}
.ov-kpis.kp-row { grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); width: 100%; flex: none; }
.tk-head:has(.kp-row) { align-items: stretch; flex-direction: column; }
.tk-head:has(.kp-row) .tk-tools { justify-content: flex-end; }
.ov-kpi-val { overflow-wrap: anywhere; }
.ov-kpi-sub { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@media (max-width: 760px) { .ov-kpis.kp-row { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; } .kp-row .ov-kpi { padding: 14px; } .kp-row .ov-kpi-val { font-size: 1.5rem; } }
