:root {
  --bg: #f5f4f8;
  --surface: #ffffff;
  --surface-muted: #f8f7fb;
  --text: #16181d;
  --text-muted: #6b7280;
  --text-faint: #9aa0ac;
  --border: #e7e5ee;

  /* Wasabilab brand colors */
  --brand-pink: #e72776;
  --brand-teal: #19aeb6;
  --brand-purple: #634394;
  --brand-yellow: #fabc19;

  --accent: var(--brand-pink);
  --accent-hover: #c11f63;
  --accent-soft: #fce6ef;

  --green: #16a34a;
  --green-bg: #e0f6e7;
  --yellow: #92660a;
  --yellow-bg: #fef1d2;
  --red: #dc2626;
  --red-bg: #fde3e3;
  --blue: var(--brand-teal);
  --blue-bg: #e1f4f5;
  --purple: var(--brand-purple);
  --purple-bg: #ece6f3;

  /* Soft per-page background tints (brand colors at low opacity) */
  --tint-pink: rgba(231, 39, 118, 0.055);
  --tint-teal: rgba(25, 174, 182, 0.06);
  --tint-purple: rgba(99, 67, 148, 0.06);
  --tint-yellow: rgba(250, 188, 25, 0.09);

  --radius-lg: 16px;
  --radius-md: 12px;
  --radius-sm: 8px;
  --shadow-sm: 0 1px 2px rgba(16, 24, 40, 0.04);
  --shadow-md: 0 4px 16px rgba(16, 24, 40, 0.08);
  --sidebar-w: 236px;
}

* { box-sizing: border-box; }
html, body { height: 100%; overflow-x: hidden; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3, h4 { margin: 0; font-weight: 700; letter-spacing: -0.01em; }
p { margin: 0; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
button { font-family: inherit; }
ul { margin: 0; padding: 0; list-style: none; }

/* ---------- App shell ---------- */
#app {
  display: grid;
  grid-template-columns: var(--sidebar-w) minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  background: var(--surface);
  border-right: 1px solid var(--border);
  padding: 20px 14px;
  display: flex;
  flex-direction: column;
  gap: 18px;
  position: sticky;
  top: 0;
  height: 100vh;
}
.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 8px;
}
.sidebar-brand .logo-mark {
  width: 36px; height: 36px; border-radius: 10px;
  display: flex; align-items: center; justify-content: center; flex: none;
}
.sidebar-brand .logo-mark img { width: 100%; height: 100%; object-fit: contain; }
.sidebar-brand .brand-text strong { display: block; font-size: 14.5px; }
.sidebar-brand .brand-text span { font-size: 11.5px; color: var(--text-muted); }

.nav-group { display: flex; flex-direction: column; gap: 2px; }
.nav-label { font-size: 10.5px; text-transform: uppercase; letter-spacing: .06em; color: var(--text-faint); padding: 10px 10px 4px; }
.nav-link {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 10px; border-radius: var(--radius-sm);
  color: var(--text-muted); font-size: 13.5px; font-weight: 500;
  cursor: pointer; user-select: none;
}
.nav-link .icon { width: 18px; text-align: center; font-size: 15px; }
.nav-link:hover { background: var(--surface-muted); color: var(--text); text-decoration: none; }
.nav-link.active { background: var(--accent-soft); color: var(--accent-hover); }
.nav-link .badge-count {
  margin-left: auto; background: var(--red); color: white; font-size: 10.5px;
  border-radius: 999px; padding: 1px 6px; font-weight: 700;
}

.sidebar-footer { margin-top: auto; }
.role-switcher { border-top: 1px solid var(--border); padding-top: 14px; }
.role-switcher label { font-size: 10.5px; text-transform: uppercase; color: var(--text-faint); letter-spacing: .06em; }
.role-switcher select {
  width: 100%; margin-top: 6px; padding: 7px 8px; border-radius: var(--radius-sm);
  border: 1px solid var(--border); background: var(--surface-muted); font-size: 13px; color: var(--text);
}

/* ---------- Main column ---------- */
.main {
  display: flex; flex-direction: column; min-height: 100vh; min-width: 0;
}
.topbar {
  display: flex; align-items: center; gap: 14px;
  padding: 14px 28px; background: var(--surface); border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 20;
}
.topbar h1 { font-size: 18px; }
.topbar .subtitle { font-size: 12.5px; color: var(--text-muted); margin-top: 2px; }
#menu-toggle { display: none; flex: none; }
.sidebar-backdrop { display: none; }
.search-box {
  margin-left: auto; position: relative; width: 320px;
}
.search-box input {
  width: 100%; padding: 8px 12px 8px 32px; border-radius: 999px; border: 1px solid var(--border);
  background: var(--surface-muted); font-size: 13px; color: var(--text);
}
.search-box input:focus { outline: 2px solid var(--accent-soft); border-color: var(--accent); }
.search-box .icon { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); color: var(--text-faint); font-size: 13px; }
.search-results {
  position: absolute; top: calc(100% + 6px); left: 0; right: 0; background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--radius-md); box-shadow: var(--shadow-md);
  max-height: 360px; overflow-y: auto; z-index: 30;
}
.search-results .sr-group { padding: 6px 10px 2px; font-size: 10.5px; text-transform: uppercase; color: var(--text-faint); letter-spacing: .05em; }
.search-results .sr-item { padding: 8px 12px; cursor: pointer; display: flex; justify-content: space-between; gap: 8px; }
.search-results .sr-item:hover { background: var(--surface-muted); }
.search-results .sr-empty { padding: 16px; text-align: center; color: var(--text-muted); font-size: 13px; }

.icon-btn {
  width: 34px; height: 34px; border-radius: 10px; border: 1px solid var(--border); background: var(--surface);
  display: flex; align-items: center; justify-content: center; cursor: pointer; position: relative; font-size: 15px;
  color: var(--text-muted);
}
.icon-btn:hover { background: var(--surface-muted); color: var(--text); }
.icon-btn .dot { position: absolute; top: -3px; right: -3px; width: 9px; height: 9px; border-radius: 50%; background: var(--red); border: 2px solid var(--surface); }

.content { padding: 24px 28px 60px; flex: 1; min-width: 0; transition: background-color .15s ease; }
.content.tint-pink { background-color: var(--tint-pink); }
.content.tint-teal { background-color: var(--tint-teal); }
.content.tint-purple { background-color: var(--tint-purple); }
.content.tint-yellow { background-color: var(--tint-yellow); }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 6px; border-radius: var(--radius-sm);
  padding: 8px 14px; font-size: 13px; font-weight: 600; cursor: pointer; border: 1px solid transparent;
}
.btn-primary { background: var(--accent); color: white; }
.btn-primary:hover { background: var(--accent-hover); }
.btn-secondary { background: var(--surface); border-color: var(--border); color: var(--text); }
.btn-secondary:hover { background: var(--surface-muted); }
.btn-ghost { background: transparent; color: var(--text-muted); }
.btn-ghost:hover { background: var(--surface-muted); color: var(--text); }
.btn-danger { background: var(--red-bg); color: var(--red); }
.btn-sm { padding: 5px 10px; font-size: 12px; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }

/* ---------- Cards / grids ---------- */
.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg);
  padding: 18px; box-shadow: var(--shadow-sm); min-width: 0;
}
.card-title { font-size: 13.5px; font-weight: 700; margin-bottom: 12px; display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 8px; }
.section-title { font-size: 15px; font-weight: 700; margin: 26px 0 12px; }
.section-title:first-child { margin-top: 0; }

.kpi-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
.kpi-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg);
  padding: 16px 18px; display: flex; flex-direction: column; gap: 10px; min-width: 0;
  position: relative; overflow: hidden; transition: box-shadow .15s, transform .15s;
}
.kpi-card.kpi-clickable { cursor: pointer; }
.kpi-card.kpi-clickable:hover { box-shadow: var(--shadow-md); transform: translateY(-1px); border-color: var(--accent); }
.kpi-card::before {
  content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: var(--border);
}
.kpi-card .kpi-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; }
.kpi-card .kpi-icon {
  width: 30px; height: 30px; border-radius: 9px; flex: none; font-size: 14px;
  display: flex; align-items: center; justify-content: center;
  background: var(--surface-muted); color: var(--text-muted);
}
.kpi-card .kpi-label { font-size: 12px; color: var(--text-muted); font-weight: 600; }
.kpi-card .kpi-value { font-size: 26px; font-weight: 800; line-height: 1; }
.kpi-card .kpi-sub { font-size: 11.5px; color: var(--text-faint); }
.kpi-card.kpi-red::before { background: var(--red); }
.kpi-card.kpi-red .kpi-icon { background: var(--red-bg); color: var(--red); }
.kpi-card.kpi-yellow::before { background: #d97706; }
.kpi-card.kpi-yellow .kpi-icon { background: var(--yellow-bg); color: var(--yellow); }
.kpi-card.kpi-green::before { background: var(--green); }
.kpi-card.kpi-green .kpi-icon { background: var(--green-bg); color: var(--green); }
.kpi-card.kpi-accent::before { background: var(--accent); }
.kpi-card.kpi-accent .kpi-icon { background: var(--accent-soft); color: var(--accent-hover); }

/* ---------- Dashboard header & distribution bar ---------- */
.dash-header {
  display: flex; align-items: center; gap: 16px; margin-bottom: 20px; padding: 18px 20px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg);
  position: relative; overflow: hidden;
}
.dash-header::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; }
.dash-header.tone-red::before { background: var(--red); }
.dash-header.tone-yellow::before { background: #d97706; }
.dash-header.tone-green::before { background: var(--green); }
.dash-header .status-icon {
  width: 44px; height: 44px; border-radius: 12px; display: flex; align-items: center; justify-content: center;
  font-size: 18px; flex: none;
}
.dash-header.tone-red .status-icon { background: var(--red-bg); color: var(--red); }
.dash-header.tone-yellow .status-icon { background: var(--yellow-bg); color: var(--yellow); }
.dash-header.tone-green .status-icon { background: var(--green-bg); color: var(--green); }
.dash-header .headline { font-weight: 800; font-size: 15.5px; }
.dash-header .subline { font-size: 12.5px; color: var(--text-muted); margin-top: 2px; }

.status-distribution { display: flex; height: 10px; border-radius: 999px; overflow: hidden; background: var(--surface-muted); }
.status-distribution span { height: 100%; }
.dist-legend { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 10px; }
.dist-legend .dist-item { display: flex; align-items: center; gap: 6px; font-size: 11.5px; color: var(--text-muted); }
.dist-legend .dist-dot { width: 8px; height: 8px; border-radius: 50%; flex: none; }

.two-col { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: 16px; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.stack { display: flex; flex-direction: column; gap: 10px; min-width: 0; }

/* ---------- Badges ---------- */
.badge {
  display: inline-flex; align-items: center; gap: 5px; font-size: 11px; font-weight: 700;
  padding: 3px 9px; border-radius: 999px; white-space: nowrap;
}
.badge-dot { width: 7px; height: 7px; border-radius: 50%; }
.badge-green { background: var(--green-bg); color: var(--green); }
.badge-yellow { background: var(--yellow-bg); color: var(--yellow); }
.badge-red { background: var(--red-bg); color: var(--red); }
.badge-gray { background: #eceef2; color: var(--text-muted); }
.badge-blue { background: var(--blue-bg); color: var(--blue); }
.badge-purple { background: var(--purple-bg); color: var(--purple); }
.badge-accent { background: var(--accent-soft); color: var(--accent-hover); }

.traffic-light { display: inline-flex; width: 11px; height: 11px; border-radius: 50%; flex: none; }
.traffic-green { background: var(--green); box-shadow: 0 0 0 3px var(--green-bg); }
.traffic-yellow { background: #d97706; box-shadow: 0 0 0 3px var(--yellow-bg); }
.traffic-red { background: var(--red); box-shadow: 0 0 0 3px var(--red-bg); }

/* ---------- Client profile ---------- */
.client-photo {
  width: 56px; height: 56px; border-radius: 50%; flex: none; object-fit: cover;
  display: flex; align-items: center; justify-content: center; color: #fff; font-weight: 800; font-size: 19px;
}
.client-photo.lg { width: 88px; height: 88px; font-size: 28px; border: 4px solid var(--surface); box-shadow: var(--shadow-sm); }
.client-photo.sm { width: 32px; height: 32px; font-size: 12.5px; }

.profile-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); overflow: hidden; margin-bottom: 18px; box-shadow: var(--shadow-sm); }
.profile-cover { height: 110px; background-size: cover; background-position: center; position: relative; }
.profile-avatar-wrap { position: absolute; left: 24px; bottom: -40px; }
.profile-body { display: flex; align-items: flex-start; gap: 16px; flex-wrap: wrap; padding: 50px 20px 18px; }
.profile-info { flex: 1; min-width: 220px; }
.profile-actions { display: flex; gap: 8px; }
.profile-contact { font-size: 12.5px; color: var(--text-muted); display: flex; flex-direction: column; gap: 3px; margin-top: 6px; }
.profile-contact .row { display: flex; align-items: center; gap: 6px; }
.quick-links { display: flex; flex-wrap: wrap; gap: 8px; padding: 0 20px 20px; }
.quick-link {
  display: inline-flex; align-items: center; gap: 6px; padding: 7px 13px; border-radius: 999px;
  border: 1px solid var(--border); background: var(--surface-muted); font-size: 12.5px; font-weight: 700; color: var(--text);
}
.quick-link:hover { background: var(--surface); border-color: var(--accent); text-decoration: none; }
.quick-link.whatsapp { background: #e7f9ee; color: #128c4a; border-color: #bfe8cf; }
.quick-link.whatsapp:hover { background: #d5f3e0; }

/* ---------- Client & task cards ---------- */
.client-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 14px; }
.client-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg);
  padding: 16px; cursor: pointer; display: flex; flex-direction: column; gap: 10px; transition: box-shadow .15s, transform .15s;
}
.client-card:hover { box-shadow: var(--shadow-md); transform: translateY(-1px); }
.client-card-head { display: flex; align-items: center; justify-content: space-between; }
.client-card-head .name { font-size: 15px; font-weight: 700; display: flex; align-items: center; gap: 8px; }
.client-services { display: flex; flex-wrap: wrap; gap: 5px; }
.client-meta { font-size: 12px; color: var(--text-muted); display: flex; flex-direction: column; gap: 4px; }
.client-meta .row { display: flex; align-items: center; gap: 6px; }

.task-row {
  display: flex; align-items: center; gap: 12px; padding: 11px 12px; border-radius: var(--radius-md);
  border: 1px solid var(--border); background: var(--surface); cursor: pointer;
}
.task-row:hover { background: var(--surface-muted); }
.task-row .task-title { font-weight: 600; font-size: 13.5px; flex: 1; min-width: 160px; }
.task-row .task-meta { font-size: 11.5px; color: var(--text-muted); display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.task-list { display: flex; flex-direction: column; gap: 8px; }

.avatar {
  width: 26px; height: 26px; border-radius: 50%; display: flex; align-items: center; justify-content: center;
  color: white; font-size: 10.5px; font-weight: 700; flex: none;
}
.avatar-lg { width: 40px; height: 40px; font-size: 14px; }

/* ---------- Filters bar ---------- */
.filters-bar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 16px; }
.filters-bar select, .filters-bar input[type="text"] {
  padding: 7px 10px; border-radius: var(--radius-sm); border: 1px solid var(--border); background: var(--surface);
  font-size: 12.5px; color: var(--text);
}
.chip {
  padding: 6px 12px; border-radius: 999px; border: 1px solid var(--border); background: var(--surface);
  font-size: 12px; font-weight: 600; cursor: pointer; color: var(--text-muted);
}
.chip.active { background: var(--accent); border-color: var(--accent); color: white; }

/* ---------- Tabs ---------- */
.tabs {
  display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 18px;
  overflow-x: auto; -webkit-overflow-scrolling: touch; scrollbar-width: thin;
}
.tab {
  padding: 10px 4px; margin-right: 18px; font-size: 13px; font-weight: 600; color: var(--text-muted);
  cursor: pointer; border-bottom: 2px solid transparent; flex: none; white-space: nowrap;
}
.tab:hover { color: var(--text); }
.tab.active { color: var(--accent-hover); border-color: var(--accent); }

/* ---------- Kanban ---------- */
.kanban-board { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(250px, 1fr); gap: 14px; overflow-x: auto; padding-bottom: 8px; }
.kanban-col { background: var(--surface-muted); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 12px; min-height: 200px; display: flex; flex-direction: column; gap: 10px; }
.kanban-col-head { display: flex; align-items: center; justify-content: space-between; padding: 2px 4px 4px; }
.kanban-col-head h4 { font-size: 12.5px; text-transform: uppercase; letter-spacing: .03em; color: var(--text-muted); }
.kanban-cards { display: flex; flex-direction: column; gap: 8px; min-height: 60px; }
.kanban-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-md); padding: 11px 12px;
  cursor: grab; box-shadow: var(--shadow-sm); display: flex; flex-direction: column; gap: 8px;
}
.kanban-card.dragging { opacity: .4; }
.kanban-col.drag-over { outline: 2px dashed var(--accent); outline-offset: -4px; }
.kanban-card.drag-over-top { box-shadow: 0 -3px 0 var(--accent); }
.kanban-card.drag-over-bottom { box-shadow: 0 3px 0 var(--accent); }
.kanban-card .kc-title { font-size: 12.5px; font-weight: 600; }
.kanban-card .kc-foot { display: flex; align-items: center; justify-content: space-between; }

/* ---------- Calendar ---------- */
.calendar-toolbar { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; flex-wrap: wrap; }
.calendar-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 8px; }
.calendar-strip { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 8px; }
.calendar-dow { font-size: 11px; font-weight: 700; color: var(--text-faint); text-align: center; padding-bottom: 4px; text-transform: uppercase; }
.calendar-cell {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-md);
  min-height: 108px; padding: 6px; display: flex; flex-direction: column; gap: 4px; min-width: 0;
}
.calendar-cell.outside { background: var(--surface-muted); opacity: .55; }
.calendar-cell.today { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.calendar-grid .calendar-cell, .calendar-week-grid .calendar-cell { cursor: pointer; transition: background-color .1s; }
.calendar-grid .calendar-cell:hover, .calendar-week-grid .calendar-cell:hover { background: var(--surface-muted); }
.calendar-cell .cell-date { font-size: 11.5px; font-weight: 700; color: var(--text-muted); }
.calendar-event {
  font-size: 10.5px; padding: 2px 6px; border-radius: 6px; font-weight: 600; cursor: pointer;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.calendar-week-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 8px; }
.calendar-week-grid .calendar-cell { min-height: 220px; }

/* ---------- Modal ---------- */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(15, 17, 21, 0.45); display: flex; align-items: flex-start;
  justify-content: center; padding: 40px 20px; z-index: 100; overflow-y: auto;
}
.modal {
  background: var(--surface); border-radius: var(--radius-lg); width: 100%; max-width: 640px;
  box-shadow: var(--shadow-md); overflow: hidden;
}
.modal-lg { max-width: 780px; }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 18px 22px; border-bottom: 1px solid var(--border); }
.modal-head h3 { font-size: 16px; }
.modal-body { padding: 20px 22px; display: flex; flex-direction: column; gap: 16px; max-height: 70vh; overflow-y: auto; }
.modal-foot { padding: 14px 22px; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: 8px; }

.field { display: flex; flex-direction: column; gap: 5px; }
.field label { font-size: 11.5px; font-weight: 700; color: var(--text-muted); text-transform: uppercase; letter-spacing: .03em; }
.field input, .field select, .field textarea {
  padding: 8px 10px; border-radius: var(--radius-sm); border: 1px solid var(--border); background: var(--surface);
  font-size: 13px; color: var(--text); font-family: inherit; width: 100%;
}
.field textarea { resize: vertical; min-height: 70px; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

.checklist-item { display: flex; align-items: center; gap: 8px; font-size: 13px; }
.checklist-item input[type="checkbox"] { width: 15px; height: 15px; }
.checklist-item.done span { text-decoration: line-through; color: var(--text-faint); }

.comment { display: flex; gap: 10px; }
.comment .bubble { background: var(--surface-muted); border-radius: var(--radius-md); padding: 8px 12px; font-size: 12.5px; flex: 1; }
.comment .bubble .meta { font-size: 10.5px; color: var(--text-faint); margin-bottom: 3px; font-weight: 700; }

/* ---------- Team workload ---------- */
.member-card { display: flex; flex-direction: column; gap: 12px; }
.member-head { display: flex; align-items: center; gap: 10px; }
.member-head .name { font-weight: 700; font-size: 14px; }
.member-head .role { font-size: 11.5px; color: var(--text-muted); }
.workload-bar { height: 8px; border-radius: 999px; background: var(--surface-muted); overflow: hidden; }
.workload-bar-fill { height: 100%; border-radius: 999px; }
.member-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; font-size: 11.5px; }
.member-stats .stat-value { font-size: 15px; font-weight: 800; }
.member-stats .stat-label { color: var(--text-muted); }

/* ---------- Empty / misc ---------- */
.empty-state { text-align: center; padding: 40px 20px; color: var(--text-muted); }
.empty-state .icon { font-size: 30px; margin-bottom: 8px; }
.muted { color: var(--text-muted); }
.faint { color: var(--text-faint); }
.divider { height: 1px; background: var(--border); margin: 14px 0; }
.link-list a { display: block; font-size: 13px; padding: 4px 0; }
.small { font-size: 11.5px; }
.pill-list { display: flex; flex-wrap: wrap; gap: 6px; }
.progress-track { height: 6px; border-radius: 999px; background: var(--surface-muted); overflow: hidden; }
.progress-fill { height: 100%; background: var(--accent); }

@media (max-width: 1100px) {
  .kpi-grid { grid-template-columns: repeat(2, 1fr); }
  .two-col { grid-template-columns: 1fr; }
  .grid-3 { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 860px) {
  .kpi-grid { grid-template-columns: repeat(2, 1fr); }
  .search-box { width: 200px; }
  :root { --sidebar-w: 196px; }
  .content { padding: 18px 16px 60px; }
}

@media (max-width: 640px) {
  #app { grid-template-columns: minmax(0, 1fr); }

  #menu-toggle { display: flex; }

  .sidebar {
    position: fixed; top: 0; left: 0; height: 100dvh; width: 250px;
    max-width: 82vw; z-index: 210; transform: translateX(-100%);
    transition: transform .22s ease; box-shadow: var(--shadow-md);
  }
  .sidebar.open { transform: translateX(0); }

  .sidebar-backdrop {
    display: none; position: fixed; inset: 0; background: rgba(15, 17, 21, 0.45); z-index: 200;
  }
  .sidebar-backdrop.open { display: block; }

  .topbar { padding: 12px 14px; gap: 8px; }
  .topbar .subtitle { display: none; }
  .topbar h1 { font-size: 16px; }
  .content { padding: 14px 12px 48px; }

  .search-box { width: auto; flex: 1; min-width: 0; }
  .search-box input { padding: 8px 10px 8px 30px; }

  .kpi-grid, .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .field-row { grid-template-columns: 1fr; }
  .filters-bar { gap: 6px; }
  .filters-bar select, .filters-bar input[type="text"] { flex: 1; min-width: 120px; }

  .modal-overlay { padding: 0; align-items: stretch; }
  .modal, .modal-lg { max-width: 100%; width: 100%; min-height: 100dvh; border-radius: 0; }
  .modal-body { max-height: calc(100dvh - 128px); }

  .calendar-scroll { overflow-x: auto; }
  .calendar-grid, .calendar-week-grid { min-width: 640px; }

  .calendar-strip {
    grid-template-columns: none; grid-auto-flow: column; grid-auto-columns: minmax(110px, 1fr);
    overflow-x: auto; padding-bottom: 4px;
  }

  .kanban-board { grid-auto-columns: minmax(220px, 82vw); }

  .client-card-head .name { font-size: 14px; }

  .dash-header { flex-direction: column; align-items: stretch; }
  .dash-header .status-icon { align-self: flex-start; }
  .dash-header .btn { justify-content: center; }

  .task-row { flex-wrap: wrap; }
  .task-row .task-title { min-width: 100%; }

  .member-stats { grid-template-columns: repeat(3, 1fr); font-size: 10.5px; }
}

/* ---------- Report tables ---------- */
.report-table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius-md); }
.report-table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.report-table th, .report-table td { text-align: left; padding: 8px 12px; border-bottom: 1px solid var(--border); white-space: nowrap; }
.report-table th {
  font-size: 10.5px; text-transform: uppercase; letter-spacing: .03em; color: var(--text-muted);
  font-weight: 700; background: var(--surface-muted);
}
.report-table tbody tr:last-child td { border-bottom: none; }
.report-table tfoot td { font-weight: 800; border-top: 2px solid var(--border); border-bottom: none; background: var(--surface-muted); }

/* ---------- Confetti celebration ---------- */
.confetti-layer { position: fixed; inset: 0; pointer-events: none; z-index: 500; overflow: hidden; }
.confetti-piece {
  position: absolute; top: -20px; opacity: 0.95;
  animation-name: confetti-fall; animation-timing-function: cubic-bezier(.25, .46, .45, .94); animation-fill-mode: forwards;
}
@keyframes confetti-fall {
  0% { transform: translate(0, 0) rotate(0deg); opacity: 1; }
  100% { transform: translate(var(--drift), 105vh) rotate(var(--spin)); opacity: 0.85; }
}

/* ---------- PED (piani editoriali) ---------- */
.ped-summary { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 14px; font-size: 12.5px; color: var(--text-muted); font-weight: 600; }

.ped-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 14px; }
.ped-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg);
  padding: 16px; cursor: pointer; display: flex; flex-direction: column; gap: 10px; transition: box-shadow .15s, transform .15s;
}
.ped-card:hover { box-shadow: var(--shadow-md); transform: translateY(-1px); }
.ped-card-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.ped-card-head .name { font-size: 15px; font-weight: 700; display: flex; align-items: center; gap: 8px; }
.ped-card-meta { font-size: 12px; color: var(--text-muted); }
.ped-channels-cell { display: flex; flex-wrap: wrap; gap: 5px; }
.ped-note { font-size: 12.5px; color: var(--text-muted); line-height: 1.4; }

.ped-links { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; margin-top: auto; padding-top: 10px; border-top: 1px solid var(--border); }
.ped-link-chip {
  font-size: 11px; font-weight: 700; padding: 4px 11px; border-radius: 999px;
  border: 1px solid var(--border); color: var(--accent-hover); text-decoration: none; background: var(--surface);
}
.ped-link-chip:hover { background: var(--surface-muted); }
.ped-link-chip.disabled { color: var(--text-muted); opacity: .55; cursor: default; }
.ped-del { margin-left: auto; }

/* PED modal: publishing-channel checkboxes */
.ped-channels { display: flex; flex-wrap: wrap; gap: 14px; }
.ped-channels label { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 500; cursor: pointer; }
.ped-channels input[type="checkbox"] { width: 15px; height: 15px; }

/* Dashboard PED overview */
.ped-ov-bar-wrap { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; margin: 4px 0 6px; }
.ped-ov-pct { font-size: 18px; font-weight: 800; }
.ped-ov-groups { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; margin-top: 16px; }
.ped-ov-grouphead { font-size: 10.5px; font-weight: 800; text-transform: uppercase; letter-spacing: .03em; color: var(--text-muted); margin-bottom: 8px; }
.ped-ov-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 7px 8px; border-radius: var(--radius-md); cursor: pointer; }
.ped-ov-row:hover { background: var(--surface-muted); }
.ped-ov-row .name { display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 600; }
@media (max-width: 640px) { .ped-ov-groups { grid-template-columns: 1fr; } }

/* Team management: member card action row + disabled buttons */
.member-actions { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-top: auto; padding-top: 4px; }
.btn:disabled { opacity: .45; cursor: not-allowed; }

/* Team member cards: drag & drop reordering */
.member-card[draggable="true"] { cursor: grab; }
.member-card[draggable="true"]:active { cursor: grabbing; }
.member-card.dragging { opacity: .4; }
.member-card.drag-over-top { box-shadow: inset 0 3px 0 0 var(--accent); }
.member-card.drag-over-bottom { box-shadow: inset 0 -3px 0 0 var(--accent); }

/* ===================================================================== */
/* ===== EXPERIMENTAL — "Vibrant Wasabi" theme.                     ===== */
/* ===== To revert: delete everything from this marker to EOF,      ===== */
/* ===== or restore css/styles.backup.css.                          ===== */
/* ===================================================================== */
:root {
  --bg: #f7f3ea;
  --radius-lg: 26px;
  --radius-md: 18px;
  --radius-sm: 12px;
  --shadow-sm: 0 2px 10px rgba(16, 24, 40, 0.05);
  --shadow-md: 0 12px 34px rgba(16, 24, 40, 0.12);
  /* pastel brand tints for colorful tiles */
  --p-pink: #fce0ed;
  --p-yellow: #fdefc8;
  --p-teal: #d6f1f2;
  --p-purple: #e9e2f7;
  --p-green: #e0f6e7;
}

/* ---- Typography: bolder + tighter ---- */
h1, h2, h3, h4 { letter-spacing: -0.025em; font-weight: 800; }
.topbar h1 { font-size: 22px; }
.card-title { font-size: 14px; font-weight: 800; }

/* ---- Sidebar: pill nav + gradient logo + vivid active ---- */
.sidebar-brand .logo-mark { background: linear-gradient(135deg, var(--brand-pink), var(--brand-purple)); }
.nav-link { border-radius: 999px; font-weight: 600; margin: 1px 0; }
.nav-link:hover { background: var(--p-purple); color: var(--brand-purple); }
.nav-link.active { background: linear-gradient(135deg, var(--brand-purple), #8f5fc2); color: #fff; box-shadow: 0 8px 18px rgba(99, 67, 148, 0.35); }
.role-switcher select { border-radius: 12px; }

/* ---- Topbar ---- */
.icon-btn { border-radius: 14px; }
.search-box input { border-radius: 999px; }

/* ---- Buttons: full pill + gradient primary ---- */
.btn { border-radius: 999px; font-weight: 700; }
.btn-primary { background: linear-gradient(135deg, var(--brand-purple), #8f5fc2); box-shadow: 0 8px 18px rgba(99, 67, 148, 0.32); }
.btn-primary:hover { background: linear-gradient(135deg, #4f3576, var(--brand-purple)); }
.btn-secondary { border-radius: 999px; }

/* ---- Cards: rounder, borderless, floaty ---- */
.card { border-radius: var(--radius-lg); border: none; box-shadow: var(--shadow-md); }

/* ---- KPI tiles: white cards with true-Wasabi colored borders ---- */
.kpi-card { border-radius: var(--radius-lg); background: var(--surface); border: 2px solid var(--border); box-shadow: var(--shadow-md); }
.kpi-card::before { display: none; } /* drop the old left accent bar; the full border is the accent now */
.kpi-grid > .kpi-card:nth-child(4n + 1) { border-color: var(--brand-pink); }
.kpi-grid > .kpi-card:nth-child(4n + 2) { border-color: var(--brand-yellow); }
.kpi-grid > .kpi-card:nth-child(4n + 3) { border-color: var(--brand-teal); }
.kpi-grid > .kpi-card:nth-child(4n + 4) { border-color: var(--brand-purple); }
.kpi-value { font-size: 32px; font-weight: 800; letter-spacing: -0.03em; }
.kpi-icon { background: var(--surface-muted); border-radius: 12px; width: 30px; height: 30px; display: flex; align-items: center; justify-content: center; }
.kpi-card.kpi-clickable:hover { transform: translateY(-3px); box-shadow: 0 16px 40px rgba(16, 24, 40, 0.16); }

/* ---- Dashboard hero header ---- */
.dash-header { border-radius: var(--radius-lg); border: none; box-shadow: var(--shadow-md); }
.dash-header .headline { font-size: 20px; font-weight: 800; }

/* ---- Badges / chips: chunky pills ---- */
.badge { border-radius: 999px; font-weight: 700; }
.chip { border-radius: 999px; font-weight: 600; }
.chip.active { background: var(--brand-pink); border-color: var(--brand-pink); color: #fff; }

/* ---- Tile grids: white cards with true-Wasabi colored borders ---- */
.client-card, .member-card, .ped-card { border-radius: var(--radius-lg); background: var(--surface); border: 2px solid var(--border); box-shadow: var(--shadow-md); }
.client-grid > .client-card:nth-child(4n + 1), .grid-3 > .member-card:nth-child(4n + 1), .ped-grid > .ped-card:nth-child(4n + 1) { border-color: var(--brand-pink); }
.client-grid > .client-card:nth-child(4n + 2), .grid-3 > .member-card:nth-child(4n + 2), .ped-grid > .ped-card:nth-child(4n + 2) { border-color: var(--brand-teal); }
.client-grid > .client-card:nth-child(4n + 3), .grid-3 > .member-card:nth-child(4n + 3), .ped-grid > .ped-card:nth-child(4n + 3) { border-color: var(--brand-yellow); }
.client-grid > .client-card:nth-child(4n + 4), .grid-3 > .member-card:nth-child(4n + 4), .ped-grid > .ped-card:nth-child(4n + 4) { border-color: var(--brand-purple); }
.client-card:hover, .member-card:hover, .ped-card:hover { transform: translateY(-3px); box-shadow: 0 16px 40px rgba(16, 24, 40, 0.16); }

/* ---- Inputs / selects: rounder ---- */
select, input[type="text"], input[type="email"], input[type="number"], input[type="date"], input[type="url"], textarea { border-radius: 14px; }

/* ---- Modals: rounder ---- */
.modal, .modal-lg { border-radius: var(--radius-lg); }

/* ---- List rows a touch rounder ---- */
.task-row { border-radius: var(--radius-md); }

/* ---- Dark mode toggle button (sidebar footer) ---- */
.theme-toggle {
  width: 100%; margin-bottom: 12px; border-radius: 999px; border: 1px solid var(--border);
  background: var(--surface-muted); color: var(--text); padding: 9px 12px; font-size: 12.5px;
  font-weight: 700; cursor: pointer; display: flex; align-items: center; justify-content: center; gap: 6px;
}
.theme-toggle:hover { background: var(--p-purple); color: var(--brand-purple); }

/* ===== DARK MODE ===== */
body.dark {
  --bg: #131118;
  --surface: #1d1a25;
  --surface-muted: #262230;
  --text: #f1eff7;
  --text-muted: #a9a4b8;
  --text-faint: #7f7a8e;
  --border: #322d3e;
  --shadow-sm: 0 2px 10px rgba(0, 0, 0, 0.35);
  --shadow-md: 0 14px 36px rgba(0, 0, 0, 0.5);
  --accent-soft: #3a2440;
  --p-pink: #3b2233;
  --p-yellow: #3a3320;
  --p-teal: #17333a;
  --p-purple: #2c2545;
  --p-green: #1e3328;
  --green-bg: #17301f;
  --yellow-bg: #33280f;
  --red-bg: #3a1c1c;
  --blue-bg: #123339;
  --purple-bg: #2a2445;
}
body.dark .badge-gray { background: #2f2b39; color: var(--text-muted); }
body.dark .kpi-icon { background: rgba(255, 255, 255, 0.10); }
body.dark .ped-link-chip { background: rgba(255, 255, 255, 0.10); color: #d7b9ff; }
body.dark .ped-card .badge-gray { background: rgba(255, 255, 255, 0.10); color: var(--text); }
body.dark .nav-link:hover { color: #b79be0; }
body.dark .dash-header { background: var(--surface); }
body.dark input, body.dark select, body.dark textarea { background: var(--surface-muted); color: var(--text); border-color: var(--border); }
body.dark .progress-track, body.dark .workload-bar { background: #2f2b39; }
body.dark .btn-secondary { background: var(--surface-muted); color: var(--text); border-color: var(--border); }

/* ---- Login screen ---- */
.login-screen { grid-column: 1 / -1; min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px; background: var(--bg); }
.login-card { width: 100%; max-width: 380px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow-md); padding: 28px 26px; display: flex; flex-direction: column; gap: 14px; }
.login-brand { display: flex; align-items: center; gap: 10px; }
.login-brand .logo-mark { width: 40px; height: 40px; border-radius: 12px; overflow: hidden; display: flex; align-items: center; justify-content: center; background: linear-gradient(135deg, var(--brand-pink), var(--brand-purple)); flex: none; }
.login-brand .logo-mark img { width: 100%; height: 100%; object-fit: contain; }
.login-brand .brand-text strong { display: block; font-size: 15px; }
.login-brand .brand-text span { font-size: 11.5px; color: var(--text-muted); }
.login-card h2 { font-size: 22px; margin-top: 6px; }
.login-sub { font-size: 13px; color: var(--text-muted); margin-top: -8px; }
.login-card .field label { font-size: 12px; font-weight: 600; color: var(--text-muted); display: block; margin-bottom: 5px; }
.login-card .field input { width: 100%; padding: 10px 12px; border-radius: 12px; border: 1px solid var(--border); background: var(--surface-muted); color: var(--text); font-size: 14px; }
.login-error { background: var(--red-bg); color: var(--red); border-radius: 10px; padding: 8px 12px; font-size: 12.5px; font-weight: 600; }
.login-card .btn-primary { margin-top: 4px; justify-content: center; }

/* ---- Sidebar user box ---- */
.user-box { display: flex; align-items: center; gap: 10px; border-top: 1px solid var(--border); padding-top: 12px; }
.user-box-info { display: flex; flex-direction: column; line-height: 1.2; min-width: 0; }
.user-box-info strong { font-size: 13px; }
.user-box-info span { font-size: 11px; color: var(--text-muted); }

/* Text link button (login: "Password dimenticata?" / "Torna al login") */
.login-card .link-btn { background: none; border: none; color: var(--brand-purple); font-size: 12.5px; font-weight: 700; cursor: pointer; padding: 4px; align-self: center; }
.login-card .link-btn:hover { text-decoration: underline; }
