/* Lunedì PWA — mobile-first styles */
:root {
  --green: #17225a;
  --brand-navy: #17225a;
  --brand-amber: #ff9412;
  --green-dark: #0f1a4a;
  --success: #1f7a5c;
  --gold: #c9a24b;
  --ink: #1c2321;
  --muted: #6b7684;
  --line: #e4e8ec;
  --bg: #f4f6f7;
  --card: #ffffff;
  --draft: #fff3c4;
  --draft-border: #e5c93c;
  --danger: #c0392b;
  --radius: 12px;
  --tint-base: #ffffff;
}
/* ---- dark mode ---- */
html[data-theme="dark"] {
  color-scheme: dark;
  --ink: #e9edec;
  --muted: #9aa7b0;
  --line: #2b3437;
  --bg: #0f1314;
  --card: #1a2124;
  --draft: #3a2f10;
  --draft-border: #8a7420;
  --tint-base: #1a2124;
}
html[data-theme="dark"] .field input, html[data-theme="dark"] .field select, html[data-theme="dark"] .field textarea { background: var(--card); color: var(--ink); }
html[data-theme="dark"] .btn.ghost { background: #2a3436; color: var(--ink); }
html[data-theme="dark"] .toolbar .seg button { background: var(--card); }
html[data-theme="dark"] .toolbar .loc-sel { background: var(--card); }
html[data-theme="dark"] .publish-bar { background: #2e250c; }
html[data-theme="dark"] .sched-table td.day.today { background: #14251c; }
html[data-theme="dark"] .sched-table td.day.dragover { background: #14251c; }
html[data-theme="dark"] .shift-pill { background: #15211a; border-color: #2c4234; }
html[data-theme="dark"] .add-shift { border-color: var(--line); }
html[data-theme="dark"] .labor-strip th, html[data-theme="dark"] .labor-strip td { background: #141b1a; }
html[data-theme="dark"] .labor-strip .hbar { background: #2b3437; }
html[data-theme="dark"] .pill-badge.pending { background: #3a2f10; color: #f0d060; }
html[data-theme="dark"] .pill-badge.approved { background: #123527; color: #4ade80; }
html[data-theme="dark"] .pill-badge.denied { background: #3a1a15; color: #f08070; }
html[data-theme="dark"] .conflict { background: #3a2f10; color: #f0d060; }
html[data-theme="dark"] .modal { background: var(--card); }
html[data-theme="dark"] .bottomnav { background: var(--card); }
html[data-theme="dark"] .emp-picker { background: var(--card); }
html[data-theme="dark"] .emp-search { background: var(--card); color: var(--ink); }
html[data-theme="dark"] .emp-row:active { background: #232d31; }
html[data-theme="dark"] .emp-row.sel { background: #14251c; }
html[data-theme="dark"] .emp-av.open-av { background: #2b3437; color: #9aa7b0; }
html[data-theme="dark"] .toast { background: #e9edec; color: #0f1314; }
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--ink);
  font-size: 15px;
  line-height: 1.45;
  -webkit-tap-highlight-color: transparent;
}
button { font: inherit; cursor: pointer; }
input, select, textarea { font: inherit; }

/* ---- login ---- */
.login-wrap {
  min-height: 100dvh;
  display: flex; align-items: center; justify-content: center;
  padding: 24px;
  background: linear-gradient(160deg, var(--green-dark), var(--green));
}
.login-card {
  background: var(--card);
  border-radius: 18px;
  padding: 32px 28px;
  width: 100%; max-width: 380px;
  box-shadow: 0 12px 40px rgba(0,0,0,.25);
}
.login-logo { text-align: center; margin-bottom: 20px; }
.login-logo .login-icon {
  display: inline-block;
  width: 64px; height: 64px; border-radius: 18px;
  box-shadow: 0 4px 18px rgba(23,34,90,.35);
}
.login-card h1 { margin: 10px 0 2px; font-size: 24px; text-align: center; }
.login-card p.sub { text-align: center; color: var(--muted); margin: 0 0 20px; font-size: 14px; }
.field { margin-bottom: 14px; }
.field label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 6px; color: var(--ink); }
.field input, .field select, .field textarea {
  width: 100%; padding: 11px 12px;
  border: 1px solid var(--line); border-radius: 10px;
  background: #fff;
}
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  border: none; border-radius: 10px;
  padding: 11px 16px; font-weight: 700;
  background: var(--green); color: #fff;
}
.btn:active { transform: scale(.98); }
.btn.block { width: 100%; }
.btn.ghost { background: #eef2f4; color: var(--ink); }
.btn.warn { background: var(--gold); color: #3a2c05; }
.btn.accent { background: var(--brand-amber); color: #1a1000; }
.btn.danger { background: var(--danger); color: #fff; }
.btn.small { padding: 7px 10px; font-size: 13px; border-radius: 8px; }
.btn:disabled { opacity: .5; cursor: default; }
.error { color: var(--danger); font-size: 13px; margin-top: 10px; min-height: 18px; }
.alt-action { text-align: center; font-size: 13px; color: var(--muted); margin-top: 14px; }
.alt-action a { color: var(--green); font-weight: 700; }

/* ---- app chrome ---- */
.topbar {
  position: sticky; top: 0; z-index: 40;
  background: var(--green-dark); color: #fff;
  padding: 12px 14px calc(12px + env(safe-area-inset-top, 0px));
  padding-top: calc(12px + env(safe-area-inset-top, 0px));
  display: flex; align-items: center; gap: 10px;
}
.topbar .brand { font-weight: 800; font-size: 18px; letter-spacing: .2px; }
.topbar .spacer { flex: 1; }
.topbar .userchip { font-size: 13px; opacity: .9; }
.toolbar {
  position: sticky; top: 60px; z-index: 30;
  background: var(--card); border-bottom: 1px solid var(--line);
  padding: 8px 10px; display: flex; gap: 8px; align-items: center; overflow-x: auto;
}
.toolbar .seg { display: flex; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.toolbar .seg button { border: none; background: #fff; padding: 8px 12px; font-weight: 600; font-size: 13px; }
.toolbar .seg button.on { background: var(--green); color: #fff; }
.toolbar .loc-sel { border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; font-weight: 700; font-size: 13px; background: #fff; color: var(--ink); max-width: 170px; }
.toolbar .weeknav { display: flex; align-items: center; gap: 4px; font-weight: 700; white-space: nowrap; }
.publish-bar {
  display: none; background: #fff7d6; border-bottom: 2px solid var(--draft-border);
  padding: 10px 14px; align-items: center; gap: 10px;
}
.publish-bar.show { display: flex; }
.publish-bar .count { font-weight: 700; }
.labor-bar {
  display: flex; background: #eef7ee; border-bottom: 2px solid #cde6cd;
  padding: 8px 14px; align-items: center; gap: 12px; font-size: 13px; flex-wrap: wrap;
}
html[data-theme="dark"] .labor-bar { background: #14261a; border-bottom-color: #234a2e; }
.labor-bar .labor-total { font-weight: 700; font-size: 15px; }
.labor-bar .labor-meta { color: #555; }
html[data-theme="dark"] .labor-bar .labor-meta { color: #aaa; }
.labor-bar .labor-note { margin-left: auto; color: #888; font-size: 12px; }
.team-rate { display: inline-flex; align-items: center; gap: 4px; font-size: 13px; color: #555; margin-left: 8px; }
.team-rate input { width: 70px; padding: 4px 6px; border: 1px solid #ccc; border-radius: 6px; font-size: 13px; }
html[data-theme="dark"] .team-rate { color: #aaa; }
html[data-theme="dark"] .team-rate input { background: #222; border-color: #444; color: #fff; }
.content { padding: 12px 10px calc(80px + env(safe-area-inset-bottom, 0px)); }

/* ---- schedule grid ---- */
.grid-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.sched-table { border-collapse: separate; border-spacing: 0; min-width: 100%; }
.sched-table th, .sched-table td { border-bottom: 1px solid var(--line); }
.sched-table thead th {
  position: sticky; top: 0;
  background: var(--card); text-align: center;
  padding: 8px 6px; font-size: 12px; color: var(--muted);
  border-top: 1px solid var(--line); min-width: 108px;
}
.sched-table thead th .dnum { display: block; font-size: 16px; color: var(--ink); font-weight: 800; }
.sched-table tbody th {
  position: sticky; left: 0; z-index: 5;
  background: var(--card); text-align: left;
  padding: 10px 8px; font-size: 14px; min-width: 120px; max-width: 150px;
  border-right: 1px solid var(--line);
}
.emp-name { display: flex; align-items: center; gap: 6px; cursor: grab; }
.emp-name .grip { color: var(--muted); font-size: 14px; }
.emp-role { display: block; font-size: 11px; color: var(--muted); font-weight: 400; }
.sched-table td.day { vertical-align: top; padding: 6px; min-width: 108px; }
.sched-table td.day.today { background: #eef7f3; }
/* Weekday headers + time frame labels get a little color; cells stay clean. */
.tf-grid tr.tf-head th.tf-day {
  background: color-mix(in srgb, var(--dstripe, #3b82f6) 14%, transparent);
  border-bottom: 2px solid color-mix(in srgb, var(--dstripe, #3b82f6) 45%, transparent);
}
.tf-grid tr.tf-head th.tf-day.today {
  background: color-mix(in srgb, var(--dstripe, #3b82f6) 22%, transparent);
}
.tf-grid tr.tf-row th.tf-label {
  background: color-mix(in srgb, var(--dstripe, #3b82f6) 8%, transparent);
  border-left: 3px solid color-mix(in srgb, var(--dstripe, #3b82f6) 50%, transparent);
}
html[data-theme="dark"] .tf-grid tr.tf-head th.tf-day {
  background: color-mix(in srgb, var(--dstripe, #3b82f6) 18%, transparent);
}
html[data-theme="dark"] .tf-grid tr.tf-row th.tf-label {
  background: color-mix(in srgb, var(--dstripe, #3b82f6) 12%, transparent);
}
.sched-table td.day.dragover { outline: 2px dashed var(--green); outline-offset: -2px; background: #e9f5ef; }

.shift-pill {
  background: #e8f0ec; border: 1px solid #bcd6c7;
  border-left: 4px solid var(--green);
  border-radius: 8px; padding: 6px 7px; margin-bottom: 6px;
  font-size: 12.5px; cursor: grab; user-select: none;
}
.shift-pill .t { font-weight: 700; }
.shift-pill .r { color: var(--muted); font-size: 11.5px; }
.shift-pill.draft {
  background: var(--draft); border-color: var(--draft-border);
}
.shift-pill.dragging { opacity: .4; }
/* 7shifts-style time-frame bands: pill edge color = time of day */
.shift-pill.frame-open { border-left-color: #0ea5a5; }
.shift-pill.frame-mid { border-left-color: #d63384; }
.shift-pill.frame-close { border-left-color: #7c3aed; }
.frame-legend { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; color: var(--muted); margin-left: 6px; }
.frame-legend i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
.frame-legend i + i { margin-left: 6px; }
.sched-table thead th .hcount { display: block; font-size: 11px; color: var(--muted); font-weight: 600; }
/* labor strip */
.labor-strip th, .labor-strip td { background: #f6faf8; }
.labor-strip th .lab-head { font-size: 11px; color: var(--muted); font-weight: 700; text-transform: uppercase; letter-spacing: .4px; }
.labor-strip th .lab-total { font-size: 15px; font-weight: 800; }
.labor-strip td { text-align: center; font-size: 13px; font-weight: 700; vertical-align: middle; }
.labor-strip .hbar { height: 4px; background: #e2ebe7; border-radius: 2px; margin: 4px 8px 0; }
.labor-strip .hbar i { display: block; height: 100%; background: var(--green); border-radius: 2px; }
.add-shift {
  width: 100%; border: 1px dashed #b9c6ce; background: transparent;
  border-radius: 8px; color: var(--muted); font-size: 16px; padding: 4px;
}
.add-shift:hover { border-color: var(--green); color: var(--green); }

/* ---- sections / cards ---- */
.section { margin-top: 22px; }
.section h2 { font-size: 17px; margin: 0 0 10px; }
.card {
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 14px; margin-bottom: 10px;
}
.card .row { display: flex; gap: 10px; align-items: center; justify-content: space-between; }
.pill-badge {
  display: inline-block; font-size: 11px; font-weight: 700;
  padding: 3px 8px; border-radius: 999px; text-transform: uppercase; letter-spacing: .4px;
}
.pill-badge.pending { background: #fff3c4; color: #7a5c00; }
.pill-badge.approved { background: #dff2e7; color: #1f7a5c; }
.pill-badge.denied { background: #f8dcd7; color: var(--danger); }
.conflict { color: #8a5a00; background: #fff3c4; border-radius: 8px; padding: 8px 10px; font-size: 13px; margin-top: 8px; }

/* ---- modal ---- */
.modal-back {
  position: fixed; inset: 0; z-index: 100;
  background: rgba(20,25,23,.55);
  display: flex; align-items: flex-end; justify-content: center;
}
@media (min-width: 640px) { .modal-back { align-items: center; } }
.modal {
  background: #fff; width: 100%; max-width: 480px;
  border-radius: 18px 18px 0 0; padding: 18px;
  max-height: 92dvh; overflow-y: auto;
  padding-bottom: calc(18px + env(safe-area-inset-bottom, 0px));
}
@media (min-width: 640px) { .modal { border-radius: 18px; } }
.modal h3 { margin: 0 0 14px; font-size: 18px; }
.modal .field-row { display: flex; gap: 10px; }
.modal .field-row .field { flex: 1; }
.check-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin: 6px 0 14px; }
.check-grid label {
  border: 1px solid var(--line); border-radius: 8px; padding: 8px 4px;
  font-size: 12px; text-align: center; display: flex; gap: 4px;
  align-items: center; justify-content: center;
}
.check-grid label.on { background: var(--green); color: #fff; border-color: var(--green); }
.modal-actions { display: flex; gap: 10px; margin-top: 6px; }
.modal-actions .btn { flex: 1; }

/* ---- bottom nav ---- */
.bottomnav {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 40;
  background: #fff; border-top: 1px solid var(--line);
  display: flex; padding-bottom: env(safe-area-inset-bottom, 0px);
}
.bottomnav button {
  flex: 1; border: none; background: none; padding: 10px 4px 8px;
  font-size: 11px; color: var(--muted); font-weight: 600;
}
.bottomnav button.on { color: var(--green); }
.bottomnav .ico { display: block; font-size: 20px; margin-bottom: 2px; }

/* ---- employee schedule list ---- */
.mysched-day { border-bottom: 1px solid var(--line); padding: 12px 4px; }
.mysched-day .d { font-weight: 800; font-size: 15px; letter-spacing: .2px; }
.mysched-day .s { margin-top: 6px; }
/* Premium employee shift cards: subtle depth, location pin row. */
.mysched-day .shift-pill.my-shift {
  background: linear-gradient(135deg, #f3f9f5 0%, #e7f1ec 100%);
  border: 1px solid #c3dccc;
  border-left: 4px solid var(--green);
  border-radius: 12px;
  padding: 12px 14px;
  margin-bottom: 8px;
  box-shadow: 0 2px 8px rgba(31, 122, 92, .10);
  font-size: 14px;
  cursor: default;
}
.mysched-day .shift-pill.my-shift .t { font-weight: 800; font-size: 15.5px; }
.mysched-day .shift-pill.my-shift .r { color: inherit; font-size: 13px; font-weight: 600; opacity: .72; margin-top: 2px; }
.mysched-day .shift-pill.my-shift .loc {
  display: flex; align-items: center; gap: 5px;
  margin-top: 7px; font-size: 13px; font-weight: 700; color: var(--green);
}
.off-day {
  text-align: center; padding: 28px 16px; color: var(--muted);
  font-size: 14px; background: var(--card); border-radius: 12px;
  border: 1px dashed var(--line);
}
/* Skeleton loading - instant feedback, never a dead screen. */
.skel {
  height: 64px; border-radius: 12px; margin-bottom: 8px;
  background: linear-gradient(90deg, var(--card) 25%, var(--line) 50%, var(--card) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.2s infinite;
}
@keyframes shimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }
/* Button loading state */
.btn.loading { opacity: .7; pointer-events: none; position: relative; }
.btn.loading::after {
  content: ''; width: 14px; height: 14px; margin-left: 8px;
  border: 2px solid currentColor; border-top-color: transparent;
  border-radius: 50%; display: inline-block; vertical-align: -2px;
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
/* Delightful micro-interactions (Part 11) */
@media (prefers-reduced-motion: no-preference) {
  .shift-pill { transition: transform .12s ease, box-shadow .12s ease; }
  .shift-pill:active { transform: scale(.97); }
  .mysched-day .shift-pill.my-shift { animation: cardIn .25s ease both; }
  @keyframes cardIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
  .bottomnav button { transition: color .15s ease; }
  .bottomnav button.on .ico { animation: popIn .2s ease; display: inline-block; }
  @keyframes popIn { 0% { transform: scale(.6); } 60% { transform: scale(1.15); } 100% { transform: scale(1); } }
  .btn:active { transform: scale(.96); }
  .btn { transition: transform .1s ease; }
}
.mysched-day .shift-pill.my-shift .loc .pin { font-size: 12px; }
.mysched-day .shift-pill.my-shift .n { font-size: 12.5px; color: var(--muted); margin-top: 4px; }
html[data-theme="dark"] .mysched-day .shift-pill.my-shift {
  background: linear-gradient(135deg, #17241d 0%, #101a15 100%);
  border-color: #2c4234;
  box-shadow: 0 2px 12px rgba(0, 0, 0, .35);
}
/* Department-colored cards: same department -> same color as the manager grid
 * (green/yellow/orange/blue/purple/pink cycle). Rich tint + solid left edge. */
.mysched-day .shift-pill.my-shift[data-dept] {
  border-left: 5px solid var(--dept);
  border-color: color-mix(in srgb, var(--dept) 45%, #c3dccc);
  border-left-color: var(--dept);
  background: linear-gradient(135deg,
    color-mix(in srgb, var(--dept) 14%, #ffffff) 0%,
    color-mix(in srgb, var(--dept) 20%, #f2faf6) 100%);
  box-shadow: 0 2px 10px color-mix(in srgb, var(--dept) 22%, transparent);
}
.mysched-day .shift-pill.my-shift[data-dept] .loc { color: var(--dept); }
html[data-theme="dark"] .mysched-day .shift-pill.my-shift[data-dept] {
  background: linear-gradient(135deg,
    color-mix(in srgb, var(--dept) 24%, #17241d) 0%,
    color-mix(in srgb, var(--dept) 17%, #101a15) 100%);
  border-color: color-mix(in srgb, var(--dept) 55%, #2c4234);
  border-left-color: var(--dept);
  box-shadow: 0 2px 12px rgba(0, 0, 0, .35);
}
.off { color: var(--muted); font-size: 13px; }
.toast {
  position: fixed; left: 50%; transform: translateX(-50%);
  bottom: calc(84px + env(safe-area-inset-bottom, 0px)); z-index: 200;
  background: var(--ink); color: #fff; border-radius: 10px;
  padding: 10px 16px; font-size: 14px; opacity: 0; transition: opacity .2s;
  max-width: 90vw; text-align: center;
}
.toast.show { opacity: 1; }
.spin { text-align: center; padding: 40px; color: var(--muted); }
.empty { text-align: center; color: var(--muted); padding: 26px 12px; font-size: 14px; }

/* ---- 7shifts-style time-frames grid ---- */
.tf-grid .corner { position: sticky; left: 0; z-index: 6; background: var(--card); font-size: 12px; color: var(--muted); text-align: left; padding: 8px 10px; }
.dept-bar th { background: color-mix(in srgb, var(--dstripe, #22c55e) 85%, #000); color: #fff; text-shadow: 0 1px 2px rgba(0,0,0,.25); text-align: left; padding: 10px 12px; font-size: 13px; text-transform: uppercase; letter-spacing: .06em; position: sticky; left: 0; z-index: 5; border-left: 14px solid var(--dstripe, #22c55e); }
.dept-name { font-weight: 800; }
.dept-bar .icon-btn { margin-left: 10px; color: rgba(255,255,255,.85); background: none; border: none; cursor: pointer; font-size: 14px; }
/* Role bars: one full-width solid color band per role, 7shifts time-frames style. */
.tf-grid tr.role-bar th { background: color-mix(in srgb, var(--rcolor, #64748b) 12%, var(--card)); color: var(--text); border-left: 4px solid var(--rcolor, #64748b); text-align: left; padding: 7px 12px; font-size: 12px; font-weight: 800; text-transform: uppercase; letter-spacing: .08em; position: sticky; left: 0; z-index: 5; }
.tf-grid tr.role-bar .role-meta { font-weight: 600; text-transform: none; letter-spacing: 0; opacity: .75; margin-left: 8px; font-size: 11px; }
.tf-grid tr.role-bar .role-add { float: right; background: color-mix(in srgb, var(--rcolor, #64748b) 18%, transparent); border: none; color: var(--text); border-radius: 8px; font-size: 15px; font-weight: 800; width: 28px; height: 28px; line-height: 1; cursor: pointer; }
.tf-grid tr.role-bar th.role-cell { text-align: center; padding: 7px 6px; border-left: 1px solid rgba(255,255,255,.25); }
.tf-grid tr.role-bar th.role-cell .role-meta { margin-left: 6px; }
.tf-grid tr.role-bar th.role-corner { min-width: 120px; }
.role-band th { text-align: left; padding: 7px 12px 7px 10px; background: var(--card); border-left: 14px solid var(--band, #64748b); position: sticky; left: 0; z-index: 5; }
.band-dot { display: inline-flex; width: 22px; height: 22px; border-radius: 6px; background: var(--band, #64748b); color: #fff; font-weight: 800; font-size: 12px; align-items: center; justify-content: center; margin-right: 8px; vertical-align: middle; }
.band-name { font-weight: 800; font-size: 14px; vertical-align: middle; }
.band-create { margin-left: 14px; background: none; border: none; color: var(--band, #0ea5e9); font-size: 12px; cursor: pointer; font-weight: 700; vertical-align: middle; }
.band-create:hover { text-decoration: underline; }
.day-label { position: sticky; left: 0; z-index: 5; background: var(--card); font-size: 12px; white-space: nowrap; text-align: left; padding: 8px 10px; color: var(--ink); font-weight: 700; }
.day-label .dl-day { display: block; }
.day-label .hcount { display: block; font-size: 10px; color: var(--muted); font-weight: 600; margin-top: 1px; }
/* transposed grid: time spans run across the top as column headers */
.ts-head th { background: var(--card); font-size: 11px; color: var(--muted); font-weight: 700; padding: 9px 10px; text-align: left; white-space: nowrap; border-bottom: 1px solid var(--line); }
.ts-head th.ts-add { width: 36px; text-align: center; }
.ts-newtf { background: none; border: 1px dashed var(--line); border-radius: 8px; color: var(--muted); font-size: 15px; font-weight: 700; width: 28px; height: 28px; line-height: 1; cursor: pointer; }
/* ---- 24h timeline grid ---- */
.tf-grid.h24 { table-layout: fixed; min-width: 1220px; }
.tf-grid.h24 .corner { width: 120px; }
.ts-head.h24-head th.h24h { text-align: center; padding: 9px 1px; font-size: 10px; letter-spacing: 0; }
.tl-cell { padding: 6px 10px 6px 6px !important; vertical-align: top; }
.tl { position: relative; }
.tl::before {
  content: ''; position: absolute; inset: 0; pointer-events: none; opacity: .65;
  background-image: linear-gradient(to right, var(--line) 1px, transparent 1px);
  background-size: calc(100% / 24) 100%;
}
.tl-chip { position: absolute; margin: 0; min-width: 52px; max-width: 98%; box-sizing: border-box; z-index: 2; }
.tl-chip .n { font-size: 11px; }
/* Timeline chips get a solid per-time-frame fill, so every distinct time block reads apart at a glance. */
.tl-chip { background: var(--rcolor, var(--dcolor, #0ea5e9)); border: 1px solid rgba(0,0,0,.14); color: #fff; }
.tl-chip .n { color: #fff; }
.tl-chip .t { font-size: 10px; color: rgba(255,255,255,.88); }
.tl-add {
  position: absolute; right: 0; top: 0; z-index: 3;
  width: 26px; height: 26px; border-radius: 8px;
  border: 1px dashed var(--line); background: var(--card);
  color: var(--muted); font-size: 15px; font-weight: 700; line-height: 1; cursor: pointer;
}
.tl-add:hover { border-color: var(--green); color: var(--green); }
.tl.dragover { outline: 2px dashed var(--green); outline-offset: -2px; background: #e9f5ef; border-radius: 8px; }
html[data-theme="dark"] .tl.dragover { background: #14251c; }
/* 7shifts-style time-frames grid: days across the top, time frames down the side */
.tf-grid tr.tf-head th { background: var(--card); font-size: 11px; color: var(--muted); font-weight: 700; padding: 9px 10px; text-align: center; white-space: nowrap; border-bottom: 1px solid var(--line); }
.tf-grid tr.tf-head th.corner { text-align: left; }
.tf-day .dl-day { display: block; font-size: 12px; color: var(--ink); }
.tf-day .hcount { display: block; font-size: 10px; color: var(--muted); font-weight: 600; margin-top: 1px; }
.tf-day.today { background: color-mix(in srgb, var(--green) 12%, var(--card)); }
.tf-label { position: sticky; left: 0; z-index: 5; background: var(--card); font-size: 12px; white-space: nowrap; text-align: left; padding: 8px 10px; color: var(--ink); font-weight: 700; border-bottom: 1px solid var(--line); }
.tf-cell { vertical-align: top; padding: 4px !important; border-bottom: 1px solid var(--line); min-width: 140px; }
.tf-cell.today { background: color-mix(in srgb, var(--green) 7%, transparent); }
.tf-cell .emp-chip { margin: 2px 0; }
.tf-add { display: block; width: 100%; margin-top: 2px; border: 1px dashed var(--line); background: transparent; color: var(--muted); border-radius: 8px; font-size: 14px; font-weight: 700; cursor: pointer; padding: 2px 0; line-height: 1.4; }
.tf-add:hover { border-color: var(--green); color: var(--green); }
.tf-cell.dragover { outline: 2px dashed var(--green); outline-offset: -2px; background: #e9f5ef; }
html[data-theme="dark"] .tf-cell.dragover { background: #14251c; }
/* (department highlight lives only on the dept-bar row above; day rows stay clean) */
.theme-btn { background: rgba(255,255,255,.15); border: none; color: #fff; border-radius: 8px; font-size: 17px; padding: 6px 9px; line-height: 1; }
.emp-chip { background: color-mix(in srgb, var(--rcolor, #22c55e) 24%, var(--card)); border: 1px solid color-mix(in srgb, var(--rcolor, #22c55e) 55%, transparent); border-left: 4px solid var(--rcolor, #0ea5e9); border-radius: 8px; padding: 4px 8px; margin: 3px 0; cursor: pointer; font-size: 12px; box-shadow: 0 1px 2px rgba(0,0,0,.06); }
.emp-chip .n { font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.emp-chip .t { color: var(--muted); font-size: 11px; }
.emp-chip.draft { opacity: .62; border-style: dashed; }
.row-flex { display: flex; gap: 8px; }
.row-flex input { flex: 1; }
.role-row { display: flex; align-items: center; gap: 8px; padding: 5px 0; }
.role-row .band-dot { --band: #64748b; }
.checkline { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; margin-right: 16px; }
.btn.sm { padding: 6px 12px; font-size: 13px; white-space: nowrap; }
.icon-btn.danger { color: #dc2626; }
.muted { color: var(--muted); font-size: 13px; }
@media (max-width: 640px) {
  .day-label { font-size: 11px; padding: 6px 8px; }
  .emp-chip { font-size: 11px; }
  .sched-table td.day { min-width: 92px; }
}

/* ---- 7shifts-style employee picker (shift modal) ---- */
.emp-picker { border: 1px solid var(--line); border-radius: 10px; overflow: hidden; background: #fff; }
.emp-search { width: 100%; padding: 10px 12px; border: 0; border-bottom: 1px solid var(--line); outline: none; background: #fff; }
.emp-search:focus { border-bottom-color: var(--green); }
.emp-list { max-height: 264px; overflow-y: auto; -webkit-overflow-scrolling: touch; }
.emp-row { display: flex; align-items: center; gap: 10px; padding: 9px 12px; cursor: pointer; border-bottom: 1px solid var(--line); }
.emp-row:last-child { border-bottom: 0; }
.emp-row:active { background: #f1f5f9; }
.emp-row.sel { background: #eef6f1; box-shadow: inset 3px 0 0 var(--green); }
.emp-av { width: 34px; height: 34px; border-radius: 50%; color: #fff; font-weight: 700; font-size: 15px; display: flex; align-items: center; justify-content: center; flex: none; }
.emp-av.open-av { background: #e2e8f0; color: #64748b; font-size: 18px; font-weight: 400; }
.emp-main { flex: 1; min-width: 0; }
.emp-name { font-weight: 600; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.emp-status { font-size: 12px; color: var(--muted); }
.emp-status.ok { color: #16a34a; }
.emp-status.busy { color: #b45309; }
.emp-status.off { color: #c0392b; }
.emp-hours { font-size: 12px; color: var(--muted); white-space: nowrap; }
.emp-empty { padding: 14px; text-align: center; color: var(--muted); font-size: 13px; }

/* ---- smooth & alive (Ombra-grade feel) ---- */
.grid-scroll { scroll-behavior: smooth; }
.btn, .seg button, .add-shift, .emp-chip, .shift-pill, .band-create, .emp-row,
.bottomnav button, .theme-btn, .icon-btn, .frame-legend {
  transition: transform .22s cubic-bezier(.34,1.56,.64,1), box-shadow .16s ease, background-color .2s ease, opacity .2s ease;
}
.btn:active, .seg button:active, .add-shift:active, .emp-chip:active, .shift-pill:active,
.band-create:active, .bottomnav button:active, .theme-btn:active, .icon-btn:active { transform: scale(.94); }
.emp-chip:hover, .shift-pill:hover { box-shadow: 0 4px 12px rgba(0,0,0,.14); }
.add-shift:hover { background: var(--green); border-color: var(--green); color: #fff; }
@keyframes sheetUp { from { transform: translateY(28px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
.modal { animation: sheetUp .3s cubic-bezier(.2,.9,.25,1); }
@keyframes popIn { from { transform: translateX(-50%) scale(.95); opacity: 0; } to { transform: translateX(-50%) scale(1); opacity: 1; } }
.toast.show { animation: popIn .18s ease; }
@keyframes fadeSlide { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }

/* ---- touch ripples: every tap leaves a visible pulse ---- */
.rip { position: relative; overflow: hidden; }
.ripple {
  position: absolute; border-radius: 50%; pointer-events: none;
  background: currentColor; opacity: .22; transform: scale(0);
  animation: ripOut .55s ease-out forwards;
}
@keyframes ripOut { to { transform: scale(1); opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .ripple { display: none; } }

/* ---- update bar: appears when a new version is ready ---- */
#updatebar {
  position: fixed; left: 12px; right: 12px; bottom: 78px; z-index: 90;
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  background: #111827; color: #fff; border-radius: 12px; padding: 10px 12px;
  font-size: 13px; font-weight: 600; box-shadow: 0 8px 24px rgba(0,0,0,.25);
  animation: fadeSlide .25s ease both;
}
.mysched-day { animation: fadeSlide .3s ease both; }
.mysched-day:nth-child(2) { animation-delay: .04s; }
.mysched-day:nth-child(3) { animation-delay: .08s; }
.mysched-day:nth-child(4) { animation-delay: .12s; }
.mysched-day:nth-child(5) { animation-delay: .16s; }
.mysched-day:nth-child(6) { animation-delay: .2s; }
.mysched-day:nth-child(7) { animation-delay: .24s; }

/* ---- AI news ticker ---- */
.ai-ticker {
  display: flex; align-items: center; gap: 10px;
  background: var(--card); border-bottom: 1px solid var(--line);
  padding: 7px 12px; overflow: hidden; flex: none;
}
.ai-badge {
  display: inline-flex; align-items: center; gap: 6px; flex: none;
  font-size: 11px; font-weight: 800; letter-spacing: .08em; color: #fff;
  background: linear-gradient(135deg, #7c3aed, #0ea5e9);
  border-radius: 999px; padding: 4px 10px 4px 8px;
  box-shadow: 0 2px 8px rgba(124,58,237,.35);
}
.ai-badge .pulse { width: 8px; height: 8px; border-radius: 50%; background: #4ade80; animation: aiPulse 1.6s ease-in-out infinite; }
@keyframes aiPulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(74,222,128,.55); }
  50% { box-shadow: 0 0 0 7px rgba(74,222,128,0); }
}
.ai-ticker-view { flex: 1; overflow: hidden; -webkit-mask-image: linear-gradient(90deg, transparent, #000 20px, #000 calc(100% - 20px), transparent); mask-image: linear-gradient(90deg, transparent, #000 20px, #000 calc(100% - 20px), transparent); }
.ai-ticker-track { display: inline-flex; white-space: nowrap; animation: aiTick 36s linear infinite; will-change: transform; }
.ai-ticker:hover .ai-ticker-track, .ai-ticker:active .ai-ticker-track { animation-play-state: paused; }
@keyframes aiTick { to { transform: translateX(-50%); } }
.ai-item { display: inline-flex; align-items: center; font-size: 13px; color: var(--ink); font-weight: 500; }
.ai-item .sep { color: var(--gold); margin: 0 14px; font-weight: 800; }

@media (prefers-reduced-motion: reduce) {
  .ai-ticker-track, .ai-badge .pulse, .modal, .mysched-day, .toast.show { animation: none !important; }
  .btn, .seg button, .add-shift, .emp-chip, .shift-pill, .band-create, .emp-row,
  .bottomnav button, .theme-btn, .icon-btn, .frame-legend { transition: none !important; }
  .grid-scroll { scroll-behavior: auto; }
}

/* ---- phone-friendly ---- */
@media (max-width: 640px) {
  /* toolbar wraps into two thumb-friendly rows instead of sideways scrolling */
  .toolbar { flex-wrap: wrap; overflow-x: visible; row-gap: 8px; }
  .toolbar .weeknav { flex: 1 1 auto; }
  .toolbar .seg { flex: 1 1 100%; order: 3; }
  .toolbar .seg button { flex: 1; min-height: 42px; padding: 8px 2px; }
  .toolbar .loc-sel { flex: 1 1 auto; max-width: none; min-height: 40px; }
  .btn.small { min-height: 40px; }
  .frame-legend { display: none; }
  /* topbar: name chip crowds small screens; theme + sign out stay */
  .topbar .userchip { display: none; }
  .topbar { gap: 8px; padding-left: 12px; padding-right: 12px; }
  /* bigger tap targets on the grid */
  .add-shift { padding: 10px 4px; font-size: 18px; }
  .emp-chip { padding: 7px 10px; }
  .tf-grid td.day { min-width: 96px; }
  /* day mode: one full-width column, no sideways scroll at all */
  .tf-grid.daymode td.day { min-width: 0; }
  .tf-grid.daymode .day-label { min-width: 76px; }
  .tf-grid.daymode .dept-bar th,
  .tf-grid.daymode .role-band th,
  .tf-grid.daymode tr.role-bar th { white-space: normal; }
  /* ticker + cards breathe */
  .ai-item { font-size: 12px; }
  .card { padding: 12px; }
  .mysched-day { padding: 14px 4px; }
  .shift-pill { padding: 10px 12px; }
  .bottomnav button { padding: 12px 4px 10px; }
}

/* ---- weekly shifts page (7shifts-style) ---- */
.s7-head { display:flex; align-items:center; gap:6px; padding:14px 14px 10px; }
.s7-cal { width:38px; height:38px; border-radius:10px; border:1.5px solid var(--muted); background:var(--card); position:relative; cursor:pointer; flex:none; padding:0; }
.s7-cal i { position:absolute; top:7px; left:7px; right:7px; height:6px; border:2px solid var(--muted); border-bottom:none; border-radius:4px 4px 0 0; }
.s7-cal span { position:absolute; left:0; right:0; bottom:3px; text-align:center; font-weight:800; font-size:14px; color:var(--ink); }
.s7-month { flex:1; display:flex; align-items:center; justify-content:center; gap:2px; font-size:21px; color:var(--ink); }
.s7-month b { font-weight:800; }
.s7-month .btn { font-size:20px; padding:6px 10px; }
.iconbtn { width:40px; height:40px; border:none; background:transparent; color:var(--ink); font-size:24px; line-height:1; cursor:pointer; border-radius:10px; flex:none; }
.iconbtn:active { transform:scale(.94); }
.ws-strip { display:grid; grid-template-columns:repeat(7,1fr); gap:2px; padding:2px 8px 12px; border-bottom:1px solid var(--line); }
.ws-day { border:none; background:transparent; border-radius:14px; padding:9px 0 11px; display:flex; flex-direction:column; align-items:center; gap:3px; cursor:pointer; color:var(--muted); font:inherit; }
.ws-day .dow { font-size:12px; font-weight:600; }
.ws-day .dnum { font-size:21px; font-weight:700; }
.ws-day.today { background:#2fbfa5; color:#fff; box-shadow:0 4px 12px rgba(47,191,165,.35); }
.s7-loc { display:flex; align-items:center; gap:10px; padding:13px 16px; border-bottom:1px solid var(--line); background:var(--card); font-size:15px; }
.s7-loc select { flex:1; min-width:0; border:none; background:transparent; font:inherit; font-weight:600; color:var(--ink); }
.s7-filt { color:var(--muted); font-size:18px; }
.s7-page { padding-bottom:calc(90px + env(safe-area-inset-bottom,0px)); }
.s7-day { padding:16px 16px 2px; scroll-margin-top:8px; }
.s7-dayhead { display:flex; justify-content:space-between; align-items:center; font-size:17px; font-weight:800; color:var(--ink); margin-bottom:6px; }
.s7-count { color:var(--muted); font-size:14px; font-weight:600; }
.s7-row { display:flex; align-items:center; gap:14px; width:100%; background:var(--card); border:none; border-bottom:1px solid var(--line); padding:13px 2px; text-align:left; font:inherit; color:var(--ink); cursor:pointer; }
.s7-row .emp-av { width:52px; height:52px; font-size:20px; }
.s7-main { flex:1; min-width:0; display:flex; flex-direction:column; gap:4px; }
.s7-name { font-size:16px; font-weight:600; }
.s7-draft { font-size:11px; font-weight:700; background:#e8edf0; color:#5b6b76; border-radius:6px; padding:2px 6px; }
.s7-time { font-size:14px; color:var(--muted); }
.s7-meta { font-size:14px; color:var(--muted); display:flex; align-items:center; gap:7px; }
.s7-meta i { width:9px; height:9px; border-radius:50%; flex:none; }
.s7-chev { color:#c3ccd4; font-size:24px; font-weight:300; }
.s7-new { width:100%; margin:14px 0 10px; padding:15px; border:1.5px dashed #c3ccd4; border-radius:12px; background:transparent; color:var(--muted); font:inherit; font-size:15px; cursor:pointer; }
.s7-new:active { transform:scale(.98); }

/* ---- Lunedì logo + living flame ---- */
.login-logo .login-icon { animation: logoPop .7s cubic-bezier(.2, 1.6, .4, 1); }
.topbar .brand { display: inline-flex; align-items: center; gap: 8px; }
.brand .brand-icon { width: 28px; height: 28px; border-radius: 8px;
  display: inline-block; box-shadow: 0 1px 6px rgba(23,34,90,.3); }
.logo-intro .brand-icon { animation: logoPop .7s cubic-bezier(.2, 1.6, .4, 1); }

/* Vector flame: gradient outer + hot core, each flickering on its own rhythm */
.flame-wrap { position: relative; display: inline-block; vertical-align: middle; }
.login-logo .flame-wrap { margin-left: 8px; }
.flame-svg { display: block; overflow: visible;
  filter: drop-shadow(0 0 5px rgba(255,138,30,.75)) drop-shadow(0 2px 8px rgba(244,63,30,.35)); }
.login-logo .flame-svg { width: 30px; height: 34px; }
.brand .flame-svg { width: 21px; height: 24px; }
.flame-svg .f-outer { transform-box: fill-box; transform-origin: 50% 100%;
  animation: fOuter 1.9s ease-in-out infinite; }
.flame-svg .f-core { transform-box: fill-box; transform-origin: 50% 100%;
  animation: fCore 1.15s ease-in-out infinite; }
@keyframes fOuter {
  0%, 100% { transform: scaleY(1) skewX(0deg); }
  30% { transform: scaleY(1.09) skewX(2.5deg); }
  62% { transform: scaleY(.93) skewX(-2deg); }
}
@keyframes fCore {
  0%, 100% { transform: scale(1, 1); }
  38% { transform: scale(1.14, .88); }
  70% { transform: scale(.92, 1.08); }
}
/* Ignition: the flame bursts alive on the login screen, and once per session
   on the topbar right after sign-in (.logo-intro). Embers rise and die out. */
.login-logo .flame-wrap, .logo-intro .flame-wrap { animation: ignite 1.1s cubic-bezier(.2, 1.3, .35, 1); }
@keyframes ignite {
  0% { transform: scale(0) rotate(-24deg); filter: brightness(3) saturate(1.6); }
  55% { transform: scale(1.4) rotate(7deg); filter: brightness(2.1) saturate(1.4); }
  100% { transform: scale(1) rotate(0); filter: brightness(1); }
}
.flame-wrap .ember { position: absolute; bottom: 4px; left: 50%; width: 5px; height: 5px;
  margin-left: -2.5px; border-radius: 50%; background: #ffc94d; opacity: 0; pointer-events: none; }
.login-logo .ember, .logo-intro .ember { animation: emberRise 1.4s ease-out .3s 1 forwards; }
.login-logo .ember.e2, .logo-intro .ember.e2 { animation-delay: .5s; left: 36%; }
.login-logo .ember.e3, .logo-intro .ember.e3 { animation-delay: .68s; left: 64%; }
@keyframes emberRise {
  0% { opacity: 0; transform: translateY(0) scale(1); }
  18% { opacity: 1; }
  100% { opacity: 0; transform: translateY(-44px) scale(.25); }
}
@keyframes logoPop {
  0% { transform: scale(0) rotate(-30deg); }
  60% { transform: scale(1.25) rotate(8deg); }
  100% { transform: scale(1) rotate(0); }
}

/* ---- Lunedì AI tab ---- */
.ai-wrap { padding: 14px 12px calc(84px + env(safe-area-inset-bottom)); display: flex; flex-direction: column; gap: 10px; }
/* Keep the message bar pinned above the bottom nav while chatting. */
.ai-wrap .ai-input { position: sticky; bottom: calc(64px + env(safe-area-inset-bottom)); background: var(--bg); padding: 8px 0; z-index: 5; }
.ai-title { font-weight: 800; font-size: 18px; display: flex; align-items: center; gap: 8px; }
.ai-sub { font-size: 12px; color: var(--muted); margin-top: 2px; }
.ai-thread { display: flex; flex-direction: column; gap: 8px; max-height: 52vh; overflow-y: auto; padding: 4px 2px; }
.ai-msg { max-width: 88%; padding: 9px 12px; border-radius: 14px; font-size: 14px; line-height: 1.45; white-space: pre-wrap; word-break: break-word; }
.ai-msg.user { align-self: flex-end; background: var(--green); color: #fff; border-bottom-right-radius: 4px; }
.ai-msg.ai { align-self: flex-start; background: rgba(127,127,127,.14); border-bottom-left-radius: 4px; }
.ai-typing { opacity: .6; }
.ai-chips { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 2px; -webkit-overflow-scrolling: touch; }
.ai-chips button { flex: 0 0 auto; border: 1px solid var(--line); background: transparent; color: inherit; border-radius: 999px; padding: 8px 12px; font-size: 13px; }
.ai-input { display: flex; gap: 8px; }
.ai-input input { flex: 1; padding: 11px 12px; border: 1px solid var(--line); border-radius: 10px; background: #fff; font-size: 15px; }
html[data-theme="dark"] .ai-input input { background: #101418; color: #e8eaed; }
.ai-prop { border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; margin-top: 2px; background: #fff; align-self: stretch; }
html[data-theme="dark"] .ai-prop { background: #141a17; }
.ai-prop-main { font-size: 14px; }
.ai-prop-sub { font-size: 13px; color: var(--muted); margin-top: 2px; }
.ai-prop-reason { font-size: 13px; margin-top: 6px; }
.ai-prop-actions { display: flex; gap: 8px; margin-top: 8px; }
.ai-prop.applied { opacity: .6; }

/* ---- Team tab: invites + roster ---- */
.team-wrap { display: flex; flex-direction: column; gap: 12px; padding: 12px 12px 90px; max-width: 640px; margin: 0 auto; }
.team-card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; box-shadow: 0 1px 3px rgba(0,0,0,.06); }
.team-title { font-size: 16px; font-weight: 700; margin-bottom: 4px; }
.team-sub { font-size: 13px; color: var(--muted); margin-bottom: 12px; }
.team-msg { font-size: 13px; margin-top: 10px; min-height: 18px; }
.team-msg.ok { color: var(--green); font-weight: 600; }
.team-msg.err { color: var(--danger); font-weight: 600; }
.loc-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.loc-chip { display: inline-flex; align-items: center; gap: 6px; padding: 8px 12px; border: 1px solid var(--line); border-radius: 999px; font-size: 13px; cursor: pointer; background: var(--bg); }
.loc-chip input { accent-color: var(--green); width: 16px; height: 16px; }
.team-row { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-top: 1px solid var(--line); }
.team-row:first-child { border-top: none; }
.team-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.team-name { font-size: 14px; font-weight: 600; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.team-meta { font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pill { font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 999px; text-transform: uppercase; letter-spacing: .04em; }
.pill.active { background: #dcfce7; color: #15803d; }
.pill.invited { background: #fef3c7; color: #b45309; }
.pill.unknown { background: #e2e8f0; color: #64748b; }
.pill.deactivated { background: #f1f5f9; color: #64748b; }
.team-row.off { opacity: .55; }
.team-actions { display: flex; gap: 6px; flex-shrink: 0; }
.btn.small.ghost.danger { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 40%, transparent); }
html[data-theme="dark"] .pill.deactivated { background: #2b3437; color: #9aa7b0; }
html[data-theme="dark"] .pill.active { background: #14532d; color: #bbf7d0; }
html[data-theme="dark"] .pill.invited { background: #451a03; color: #fcd34d; }
html[data-theme="dark"] .pill.unknown { background: #2b3437; color: #9aa7b0; }
/* ---- setup-done banner on the login screen ---- */
.setup-banner { background: #dcfce7; color: #15803d; border-radius: 10px; padding: 10px 12px; font-size: 13px; font-weight: 600; margin: 0 0 14px; text-align: center; }
html[data-theme="dark"] .setup-banner { background: #14532d; color: #bbf7d0; }
/* ---- calendar sync ---- */
.cal-actions { display: flex; flex-direction: column; gap: 8px; }
.cal-actions .btn.block { margin: 0; }

/* ----- Learn training materials (per business) ----- */
.learn-mats { border: 1px solid var(--line); border-radius: 12px; padding: 12px; margin-bottom: 12px; }
.learn-mats-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.learn-mat { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 8px 0; border-top: 1px solid var(--line); }
.learn-mat-title { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.learn-mat-actions { display: flex; gap: 6px; flex: 0 0 auto; }
.learn-empty { color: var(--muted); font-size: 14px; line-height: 1.5; padding: 4px 0; }
.learn-edit { display: flex; flex-direction: column; gap: 8px; margin-top: 10px; }
.learn-edit input, .learn-edit textarea { width: 100%; box-sizing: border-box; border: 1px solid var(--line); border-radius: 8px; padding: 10px; font: inherit; background: var(--bg); color: var(--text); }
.learn-edit-btns { display: flex; gap: 8px; }
.learn-err { color: #dc2626; font-size: 13px; min-height: 18px; }

/* ----- Part 13: Smart suggest preview ----- */
.suggest-modal { max-width: 560px; max-height: 84vh; overflow-y: auto; }
.suggest-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.suggest-head h3 { margin: 0; font-size: 18px; }
.suggest-summary { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; margin-bottom: 10px; font-size: 14px; display: flex; flex-direction: column; gap: 4px; }
.suggest-note { color: var(--muted); font-size: 13px; font-style: italic; }
.suggest-actions { display: flex; gap: 8px; margin-bottom: 12px; }
.suggest-day { margin-bottom: 12px; }
.suggest-day-head { font-weight: 800; font-size: 14px; margin-bottom: 6px; display: flex; justify-content: space-between; align-items: center; }
.suggest-row { display: flex; align-items: center; gap: 8px; padding: 8px; border: 1px dashed var(--accent); border-radius: 8px; margin-bottom: 6px; background: color-mix(in srgb, var(--accent) 6%, transparent); font-size: 13px; }
.suggest-time { font-weight: 700; white-space: nowrap; min-width: 110px; }
.suggest-who { font-weight: 600; }
.suggest-who em { color: var(--muted); font-style: normal; }
.suggest-why { color: var(--muted); font-size: 12px; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.suggest-adjust { display: flex; gap: 8px; margin-bottom: 6px; }
.suggest-adjust input { flex: 1; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; font-size: 14px; background: #fff; }
html[data-theme="dark"] .suggest-adjust input { background: #101418; color: #e8eaed; }
.suggest-adjust-msg { font-size: 13px; color: var(--muted); margin-bottom: 10px; min-height: 18px; }

/* 12C: Lucide outline icons in bottom nav */
.bottomnav .ico { display: block; width: 24px; height: 24px; margin: 0 auto 2px; }
.bottomnav .ico svg { width: 100%; height: 100%; }
.bottomnav button.on .ico { color: var(--green); }
.bottomnav .lbl { display: block; font-size: 11px; }
/* 12C: AI tab modes */
.ai-modes { margin-bottom: 12px; }
.seg.ai-modes { display: flex; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.seg.ai-modes button { flex: 1; border: none; background: #fff; padding: 10px; font-weight: 600; font-size: 14px; }
.seg.ai-modes button.on { background: var(--green); color: #fff; }
html[data-theme="dark"] .seg.ai-modes button { background: var(--card); }
html[data-theme="dark"] .seg.ai-modes button.on { background: var(--green); }

/* ----- Part 11: Delightful schedule interactions ----- */
/* Drag: lift on pick-up (scale, shadow, slight tilt) */
.shift-pill.dragging, .s7-new.dragging {
  transform: scale(1.05) rotate(1.5deg);
  box-shadow: 0 12px 24px rgba(0,0,0,.25);
  opacity: .9;
  z-index: 50;
  transition: transform .18s cubic-bezier(.34,1.56,.64,1), box-shadow .18s ease;
}
/* Drop target glow */
.tf-cell.dragover {
  background: color-mix(in srgb, var(--accent) 18%, transparent) !important;
  box-shadow: inset 0 0 0 2px var(--accent);
  transition: background .15s ease, box-shadow .15s ease;
}
/* New shifts grow in */
@keyframes shiftIn {
  from { transform: scale(.8); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}
.shift-pill.shift-in { animation: shiftIn .22s cubic-bezier(.34,1.56,.64,1); }
/* Invalid drop shake */
@keyframes shakeX {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-6px); }
  75% { transform: translateX(6px); }
}
.shift-pill.shake { animation: shakeX .3s ease; }
/* Publish: sweep highlight across week */
@keyframes publishSweep {
  from { box-shadow: inset 0 0 0 999px rgba(31,122,92,.0); }
  50% { box-shadow: inset 0 0 0 999px rgba(31,122,92,.18); }
  to { box-shadow: inset 0 0 0 999px rgba(31,122,92,.0); }
}
.tf-grid.publishing { animation: publishSweep .9s ease; }
/* Copy cascade: shifts appear day by day */
@keyframes cascadeIn {
  from { transform: translateY(8px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}
.shift-pill.cascade { animation: cascadeIn .25s ease backwards; }
/* Overtime flash */
@keyframes amberFlash {
  0%, 100% { background: transparent; }
  50% { background: rgba(255,148,18,.25); }
}
.ot-flash { animation: amberFlash .6s ease 2; }
/* Time off diagonal stripes */
.timeoff-stripe {
  background-image: repeating-linear-gradient(45deg, transparent, transparent 6px, rgba(100,116,139,.12) 6px, rgba(100,116,139,.12) 12px);
}
/* Reduce motion: replace movement with fades */
@media (prefers-reduced-motion: reduce) {
  .shift-pill.dragging, .s7-new.dragging { transform: none; }
  .shift-pill.shift-in, .shift-pill.cascade { animation: fadeIn .15s ease; }
  .shift-pill.shake, .tf-grid.publishing, .ot-flash { animation: none; }
  .tf-cell.dragover { box-shadow: inset 0 0 0 2px var(--accent); }
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

/* ---------- Part 14: Learn knowledge base ---------- */
.set-wrap { max-width: 720px; margin: 0 auto; padding: 16px 14px 90px; }
.set-card { background: var(--card, #fff); border: 1px solid var(--line, #e5e7eb); border-radius: 14px; padding: 16px; margin-top: 12px; }
.set-title { font-weight: 700; font-size: 16px; }
.set-sub { color: var(--muted, #6b7280); font-size: 13px; margin: 4px 0 12px; }
.set-note { font-size: 13px; color: var(--muted, #6b7280); margin: 8px 0; }
.set-note.ok { color: #15803d; font-weight: 600; }
.set-note.err { color: #b91c1c; font-weight: 600; }
.set-status { margin-top: 10px; }
.fld { display: block; margin: 10px 0; }
.fld > span { display: block; font-size: 13px; font-weight: 600; margin-bottom: 4px; }
.fld input, .fld select, .fld textarea { width: 100%; padding: 10px 12px; border: 1px solid var(--line, #e5e7eb); border-radius: 10px; font-size: 15px; background: var(--input, #fff); color: inherit; }
.fld-row { display: flex; gap: 10px; }
.fld-row .fld { flex: 1; }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }
.learn-progress { display: flex; gap: 10px; align-items: center; padding: 12px; font-size: 14px; }
.spinner { width: 22px; height: 22px; border: 3px solid var(--line, #e5e7eb); border-top-color: #16a34a; border-radius: 50%; animation: spin 0.9s linear infinite; flex: none; }
@keyframes spin { to { transform: rotate(360deg); } }
.learn-review-banner { background: #fef3c7; color: #92400e; border-radius: 10px; padding: 10px 12px; font-size: 13px; font-weight: 600; margin-bottom: 10px; }
.kb-head { margin: 14px 0 6px; }
.kb-head strong { font-size: 15px; }
.kb-bar { margin-bottom: 6px; }
.kb-sec { border: 1px solid var(--line, #e5e7eb); border-radius: 12px; margin: 8px 0; background: var(--card, #fff); }
.kb-sec > summary { padding: 12px 14px; cursor: pointer; list-style: none; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.kb-sec > summary::-webkit-details-marker { display: none; }
.kb-badge { font-size: 11px; font-weight: 700; padding: 3px 8px; border-radius: 20px; }
.kb-badge.draft { background: #fef3c7; color: #92400e; }
.kb-badge.pub { background: #dcfce7; color: #166534; }
.kb-items { padding: 0 14px 6px; }
.kb-item { border-top: 1px solid var(--line, #e5e7eb); padding: 10px 0; }
.kb-item.ok .kb-text { border-left: 3px solid #16a34a; padding-left: 8px; }
.kb-text { font-size: 14px; line-height: 1.45; }
.kb-meta { font-size: 12px; color: var(--muted, #6b7280); margin-top: 4px; display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.kb-meta a { color: #2563eb; text-decoration: none; }
.kb-verify { background: #fef3c7; color: #92400e; font-weight: 700; padding: 2px 8px; border-radius: 12px; font-size: 11px; }
.kb-origin { text-transform: capitalize; opacity: 0.7; }
.kb-row { display: flex; justify-content: space-between; align-items: center; margin-top: 6px; gap: 8px; flex-wrap: wrap; }
.kb-approve { font-size: 13px; font-weight: 600; display: flex; gap: 6px; align-items: center; }
.kb-ibtns { display: flex; gap: 4px; }
.kb-edit textarea { width: 100%; margin-top: 8px; padding: 8px; border: 1px solid var(--line, #e5e7eb); border-radius: 8px; font-size: 14px; }
.kb-add { display: flex; gap: 6px; padding: 8px 14px 12px; }
.kb-add input { flex: 1; padding: 8px 10px; border: 1px solid var(--line, #e5e7eb); border-radius: 8px; font-size: 14px; }
.kb-versions { margin: 0 14px 12px; font-size: 13px; }
.kb-versions summary { cursor: pointer; color: var(--muted, #6b7280); }
.kb-v { display: flex; justify-content: space-between; align-items: center; padding: 6px 0; border-top: 1px dashed var(--line, #e5e7eb); }
.kb-ins { display: grid; gap: 12px; }
@media (min-width: 640px) { .kb-ins { grid-template-columns: 1fr 1fr; } }
.kb-ins-t { font-weight: 700; font-size: 14px; margin-bottom: 6px; }
.kb-q { border: 1px solid var(--line, #e5e7eb); border-radius: 10px; padding: 10px; margin-bottom: 8px; font-size: 14px; }
.kb-count { color: var(--muted, #6b7280); font-size: 12px; }
.tip-card { background: linear-gradient(135deg, #f0fdf4, #dcfce7); border: 1px solid #bbf7d0; border-radius: 12px; padding: 12px 14px; margin-bottom: 10px; font-size: 14px; }
.tip-label { font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: 0.06em; color: #15803d; margin-bottom: 4px; }
.quiz-q { border: 1px solid var(--line, #e5e7eb); border-radius: 10px; padding: 10px; margin: 8px 0; font-size: 14px; }
.quiz-q.ok { border-color: #16a34a; }
.quiz-q.bad { border-color: #dc2626; }
.quiz-qt { font-weight: 600; margin-bottom: 6px; }
.quiz-o { display: block; padding: 6px 4px; font-size: 14px; }
.learn-empty { color: var(--muted, #6b7280); font-size: 13px; padding: 8px 0; }
.skel { height: 60px; border-radius: 10px; background: linear-gradient(90deg, var(--line, #e5e7eb) 25%, transparent 50%, var(--line, #e5e7eb) 75%); background-size: 200% 100%; animation: skel 1.2s infinite; }
@keyframes skel { to { background-position: -200% 0; } }
@media (prefers-color-scheme: dark) {
  .tip-card { background: linear-gradient(135deg, #052e16, #14532d); border-color: #166534; }
  .learn-review-banner, .kb-verify, .kb-badge.draft { background: #451a03; color: #fcd34d; }
}
@media (prefers-reduced-motion: reduce) {
  .spinner, .skel { animation: none; }
}
