:root {
  --miz-red: #E63D2E;
  --deep-red: #C0392B;
  --ink: #17171A;
  --paper: #F7F7F5;
  --grey: #8A8B90;
  --grey-light: #D9D9D6;
  --blue: #2E6FE6;
  --white: #FFFFFF;
  --hairline: #ECECEA;
  --hairline-soft: #F2F2F0;
  --radius: 12px;
  --radius-sm: 8px;
  --radius-lg: 16px;
  --shadow-xs: 0 1px 2px rgba(23,23,26,0.04);
  --shadow: 0 1px 2px rgba(23,23,26,0.04), 0 3px 10px rgba(23,23,26,0.05);
  --shadow-lift: 0 6px 20px rgba(23,23,26,0.10), 0 2px 6px rgba(23,23,26,0.05);
  --shadow-modal: 0 24px 60px rgba(23,23,26,0.18), 0 4px 14px rgba(23,23,26,0.08);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; overflow-x: hidden; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--paper);
  color: var(--ink);
  -webkit-user-select: text;
  -webkit-font-smoothing: antialiased;
  line-height: 1.5;
}

a { color: var(--miz-red); text-decoration: none; }
a:hover { text-decoration: underline; }
a:focus-visible, button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, [tabindex]:focus-visible {
  outline: 2px solid var(--miz-red); outline-offset: 2px; border-radius: 4px;
}

/* Baseline heading hierarchy — only applies where a page hasn't already
   set its own inline size/weight, so nothing already-styled shifts. */
h1 { font-size: 26px; font-weight: 800; letter-spacing: -0.01em; margin: 0 0 8px; }
h2 { font-size: 21px; font-weight: 700; letter-spacing: -0.01em; margin: 0 0 6px; }
h3 { font-size: 16px; font-weight: 700; margin: 0 0 6px; }
h4 { font-size: 14px; font-weight: 700; margin: 0 0 4px; }
p { margin: 0 0 10px; }

.wordmark { font-size: 19px; font-weight: 800; color: var(--ink); letter-spacing: -0.02em; }
.wordmark span { color: var(--miz-red); }
.logo-img { height: 34px; width: auto; display: block; }

/* ---------- Top bar ---------- */
.topbar {
  background: rgba(255,255,255,.92);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--hairline);
  padding: 12px 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: sticky;
  top: 0;
  z-index: 30;
  gap: 12px;
}
.topbar-left { display: flex; align-items: center; gap: 8px; }
.topbar-center { flex: 1; text-align: center; max-width: 480px; margin: 0 auto; }
.topbar-search {
  display: flex; align-items: center; gap: 8px; background: var(--paper); border-radius: 999px;
  padding: 9px 16px; color: var(--grey); border: 1px solid transparent; transition: border-color .15s ease, background .15s ease;
}
.topbar-search:focus-within { border-color: var(--grey-light); background: var(--white); }
.topbar-search input {
  border: none; background: none; outline: none; font-size: 14px; width: 100%; color: var(--ink);
}
.icon-btn.topbar-search-icon { display: none; }
.topbar-right { display: flex; align-items: center; gap: 6px; }
.greeting { font-size: 14px; color: var(--grey); font-weight: 500; }
.new-task-btn { white-space: nowrap; }

.icon-btn {
  background: none; border: none; cursor: pointer; color: var(--ink);
  display: inline-flex; align-items: center; justify-content: center;
  width: 38px; height: 38px; border-radius: 999px; position: relative;
  transition: background .15s ease;
}
.icon-btn:hover { background: var(--paper); }
.notif-dot {
  position: absolute; top: 2px; right: 2px; background: var(--miz-red); color: var(--white);
  font-size: 10px; font-weight: 700; min-width: 16px; height: 16px; border-radius: 999px;
  display: flex; align-items: center; justify-content: center; padding: 0 3px;
  box-shadow: 0 0 0 2px var(--white);
}
.avatar {
  width: 32px; height: 32px; border-radius: 999px; background: var(--ink); color: var(--white);
  display: flex; align-items: center; justify-content: center; font-size: 13px; font-weight: 700;
  flex-shrink: 0; object-fit: cover;
}
.avatar-lg {
  width: 72px; height: 72px; border-radius: 999px; background: var(--ink); color: var(--white);
  display: flex; align-items: center; justify-content: center; font-size: 28px; font-weight: 700;
  flex-shrink: 0; object-fit: cover; position: relative;
}
.avatar-upload-btn {
  position: absolute; bottom: -2px; right: -2px; width: 26px; height: 26px; border-radius: 999px;
  background: var(--miz-red); color: var(--white); display: flex; align-items: center; justify-content: center;
  border: 2px solid var(--white); cursor: pointer; font-size: 12px;
}
.quick-access-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(80px, 1fr)); gap: 12px; text-align: center; }
.quick-access-item { display: flex; flex-direction: column; align-items: center; gap: 6px; color: var(--ink); font-size: 12px; font-weight: 500; }
.quick-access-item:hover { text-decoration: none; }
.quick-access-icon { width: 46px; height: 46px; border-radius: 12px; display: flex; align-items: center; justify-content: center; font-size: 20px; }
.tab-strip { display: flex; gap: 4px; border-bottom: 1px solid #ECECEA; margin-bottom: 14px; overflow-x: auto; }
.tab-strip .tab-btn { padding: 8px 12px; white-space: nowrap; flex-shrink: 0; }

/* ---------- Calendar ---------- */
.calendar-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.calendar-weekday { font-size: 11px; font-weight: 700; color: var(--grey); text-transform: uppercase; text-align: center; padding: 4px 0; }
.calendar-cell {
  background: var(--white); border-radius: 8px; box-shadow: var(--shadow); min-height: 90px;
  padding: 6px; font-size: 12px; overflow: hidden;
  display: block; color: inherit; text-decoration: none; cursor: pointer; transition: box-shadow .15s;
}
.calendar-cell:hover { box-shadow: var(--shadow-lift); text-decoration: none; }
.calendar-cell-empty { background: none; box-shadow: none; cursor: default; }
.calendar-cell-today { border: 2px solid var(--miz-red); }
.calendar-cell-past { background: #F6F6F4; }
.calendar-cell-past .calendar-day-num { color: var(--grey); }
.calendar-day-num { font-weight: 700; font-size: 13px; margin-bottom: 4px; }
.calendar-item { display: block; padding: 2px 5px; border-radius: 5px; margin-bottom: 2px; font-size: 11px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.calendar-item-task { color: var(--white); }
.calendar-item-open { background: #2E6FE6; }
.calendar-item-overdue { background: #E63D2E; }
.calendar-item-done { background: #1E7B3B; }
.calendar-item-holiday { background: #FDF0DA; color: #A6650A; }
.calendar-item-event { background: #F0E7FD; color: #6B4FA8; }
.calendar-legend-dot { display: inline-block; width: 8px; height: 8px; border-radius: 999px; margin-right: 4px; }

/* ---------- Attendance month matrix (dashboard) ---------- */
.att-matrix-wrap { overflow-x: auto; }
.att-matrix { border-collapse: collapse; font-size: 11px; white-space: nowrap; }
.att-matrix th, .att-matrix td { padding: 4px 6px; text-align: center; border-bottom: 1px solid #F0F0EE; }
.att-matrix th { font-weight: 700; color: var(--grey); position: sticky; top: 0; background: var(--white); }
.att-matrix td:first-child, .att-matrix th:first-child {
  position: sticky; left: 0; background: var(--white); text-align: left; font-weight: 600; color: var(--ink); z-index: 1; padding-right: 12px;
}
.att-cell { display: inline-block; min-width: 26px; padding: 2px 4px; border-radius: 4px; font-weight: 700; }
.att-present { background: #E4F5E9; color: #1E7B3B; }
.att-late { background: #FFE9D6; color: #C2540A; }
.att-wfh { background: #E7F0FD; color: #2E6FE6; }
.att-onduty { background: #F0E7FD; color: #6B4FA8; }
.att-absent { background: #FCE7E5; color: #B3261E; }
.att-halfday { background: #FFF3D6; color: #8A6100; }
.att-leave { background: #EFEFEE; color: var(--grey); }
.att-holiday { background: #FDF0DA; color: #A6650A; }

.profile-quicklink {
  display: flex; flex-direction: column; align-items: center; gap: 8px; text-align: center;
  padding: 16px 8px; border-radius: 10px; background: var(--paper); color: var(--ink); font-size: 12.5px; font-weight: 600;
}
.profile-quicklink svg { color: var(--miz-red); }
.profile-quicklink:hover { background: #F0F0EE; text-decoration: none; }

@media (max-width: 860px) {
  .calendar-grid { grid-template-columns: repeat(7, 1fr); gap: 3px; }
  .calendar-cell { min-height: 60px; padding: 3px; font-size: 10px; }
  .calendar-weekday { font-size: 9px; }
  .calendar-item { font-size: 9px; }
}

/* ---------- Hamburger menu (off-canvas) ---------- */
.hamburger-overlay {
  display: none; position: fixed; inset: 0; background: rgba(23,23,26,0.45); z-index: 40;
  backdrop-filter: blur(1px); transition: opacity .18s ease;
}
.hamburger-overlay.open { display: block; }
.hamburger-menu {
  position: fixed; top: 0; left: 0; bottom: 0; width: 280px; background: var(--white);
  z-index: 50; transform: translateX(-100%); transition: transform .22s cubic-bezier(.4,0,.2,1);
  overflow-y: auto; box-shadow: var(--shadow-modal);
}
.hamburger-menu.open { transform: translateX(0); }
.hmenu-header { display: flex; justify-content: space-between; align-items: center; padding: 16px 18px; border-bottom: 1px solid var(--hairline-soft); }
.hmenu-section { padding: 10px 10px; border-bottom: 1px solid var(--hairline-soft); }
.hmenu-section:last-child { border-bottom: none; }
.hmenu-title { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--grey); padding: 8px 10px 4px; font-weight: 700; }
.hmenu-section a {
  display: flex; align-items: center; gap: 10px; padding: 10px 10px; border-radius: var(--radius-sm); color: var(--ink); font-size: 14.5px; font-weight: 500;
  transition: background .12s ease;
}
.hmenu-section a:hover { background: var(--paper); text-decoration: none; }
.hmenu-section a svg { flex-shrink: 0; color: var(--grey); transition: color .12s ease; }
.hmenu-section a:hover svg { color: var(--miz-red); }

.main-content-full { min-width: 0; }
.page-body { padding: 20px 24px 90px; max-width: 1180px; margin: 0 auto; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 20px;
  border-radius: 10px;
  border: none;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background .15s ease, box-shadow .15s ease, transform .1s ease, border-color .15s ease;
}
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .55; cursor: not-allowed; transform: none; }
.btn:focus-visible { outline: 2px solid var(--miz-red); outline-offset: 2px; }
.btn-primary { background: var(--miz-red); color: var(--white); box-shadow: 0 2px 8px rgba(230,61,46,.25); }
.btn-primary:hover:not(:disabled) { background: var(--deep-red); box-shadow: 0 4px 14px rgba(230,61,46,.32); text-decoration: none; }
.btn-secondary { background: var(--white); color: var(--ink); border: 1px solid var(--grey-light); }
.btn-secondary:hover:not(:disabled) { background: var(--paper); border-color: #C8C8C4; text-decoration: none; }
.btn-danger { background: #B3261E; color: var(--white); box-shadow: 0 2px 8px rgba(179,38,30,.25); }
.btn-danger:hover:not(:disabled) { background: #931F19; box-shadow: 0 4px 14px rgba(179,38,30,.32); text-decoration: none; }
.btn-sm { padding: 6px 14px; font-size: 13px; border-radius: 8px; }

/* ---------- Cards / stats ---------- */
.card {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  border: 1px solid var(--hairline-soft);
  padding: 20px;
}
.dash-greeting-card { position: relative; overflow: hidden; }
.dash-greeting-card::before {
  content: ''; position: absolute; top: -40px; right: -40px; width: 160px; height: 160px; border-radius: 50%;
  background: radial-gradient(circle, rgba(230,61,46,.10), transparent 70%); pointer-events: none;
}
.dash-greeting-avatar { box-shadow: 0 0 0 3px var(--white), 0 0 0 5px rgba(230,61,46,.35); }
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 14px; margin-bottom: 22px; }
.stat-card { background: var(--white); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px; transition: box-shadow .15s, transform .15s; min-width: 0; }
.stat-card:hover { box-shadow: var(--shadow-lift); transform: translateY(-1px); }
.stat-card-link { display: block; color: inherit; text-decoration: none; cursor: pointer; min-width: 0; }
.stat-card-link:hover { text-decoration: none; }
.stat-card .value { font-size: 26px; font-weight: 700; color: var(--ink); }
.stat-card .label { font-size: 13px; color: var(--grey); margin-top: 4px; }

/* Department drill-down cards */
.dept-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 14px; margin-bottom: 24px; }

/* ---------- CRM: Deal pipeline Kanban board ---------- */
.deal-kanban { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-bottom: 24px; overflow-x: auto; }
.deal-kanban-col { background: var(--paper); border-radius: var(--radius); padding: 10px; min-width: 0; display: flex; flex-direction: column; }
.deal-kanban-col-head {
  display: flex; justify-content: space-between; align-items: center; padding: 6px 6px 10px; font-size: 13px; font-weight: 700; color: var(--ink);
}
.deal-kanban-count {
  background: var(--white); border: 1px solid var(--hairline); border-radius: 999px; padding: 1px 8px; font-size: 11.5px; color: var(--grey); font-weight: 600;
}
.deal-kanban-col-body { display: flex; flex-direction: column; gap: 10px; min-height: 40px; }
.deal-kanban-empty { color: var(--grey); font-size: 12.5px; text-align: center; padding: 14px 4px; margin: 0; }
.deal-card {
  background: var(--white); border-radius: var(--radius-sm); box-shadow: var(--shadow); padding: 12px; border: 1px solid var(--hairline-soft); min-width: 0;
}
.deal-card-title {
  display: block; font-weight: 600; font-size: 13.5px; color: var(--ink); margin-bottom: 4px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.deal-card-value { font-size: 15px; font-weight: 700; color: var(--miz-red); margin-bottom: 4px; }
.deal-card-meta { font-size: 12px; color: var(--grey); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.deal-card-owner { font-size: 11.5px; color: var(--grey); margin-top: 2px; }
.deal-card-actions { display: flex; align-items: center; gap: 6px; margin-top: 10px; padding-top: 8px; border-top: 1px solid var(--hairline-soft); }
.deal-card-move { flex: 1; min-width: 0; }
.deal-card-move select { width: 100%; font-size: 11.5px; padding: 5px 6px; border-radius: 6px; border: 1px solid var(--grey-light); background: var(--white); color: var(--ink); }
.deal-card-btn {
  width: 26px; height: 26px; border-radius: 6px; border: 1px solid var(--hairline); background: var(--white); cursor: pointer; font-size: 13px;
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.deal-card-btn-win { color: #1E7B3B; }
.deal-card-btn-win:hover { background: #E7F2E9; border-color: #1E7B3B; }
.deal-card-btn-lose { color: #B3261E; }
.deal-card-btn-lose:hover { background: #FBEEEC; border-color: #B3261E; }

.deal-closed-strip { display: grid; grid-template-columns: 1fr; gap: 16px; }
.deal-closed-card h3 .deal-closed-count { color: var(--grey); font-weight: 500; font-size: 13px; }
.deal-closed-row { display: flex; justify-content: space-between; gap: 10px; padding: 7px 0; border-bottom: 1px solid #F5F5F3; font-size: 13px; }
.deal-closed-row span { color: var(--grey); flex-shrink: 0; }

@media (min-width: 720px) {
  .deal-closed-strip { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 860px) {
  .deal-kanban { grid-template-columns: minmax(240px, 1fr); grid-auto-flow: column; grid-auto-columns: minmax(240px, 80vw); }
}

/* Dashboard multi-column rows (profile+stats, 3-up widget rows). Fixed
   desktop ratios, but MUST collapse to a single column on narrow screens —
   without this override these rows force their minimum content width and
   push the whole page into horizontal scroll on mobile. */
.dash-grid-2 { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); gap: 16px; margin-bottom: 16px; }
.dash-grid-3 { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr) minmax(0, 1fr); gap: 16px; margin-bottom: 16px; }
.dash-grid-2 > *, .dash-grid-3 > * { min-width: 0; }
.dept-card {
  background: var(--white); border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px;
  display: block; color: var(--ink); transition: box-shadow .15s, transform .15s; border: 1px solid transparent;
}
.dept-card:hover { box-shadow: var(--shadow-lift); text-decoration: none; transform: translateY(-1px); border-color: #F0D8D5; }
.dept-card .dept-name { font-weight: 700; font-size: 15px; margin-bottom: 10px; display: flex; justify-content: space-between; align-items: center; }
.dept-card .dept-nums { display: flex; gap: 18px; }
.dept-card .dept-nums > div { margin-right: 18px; min-width: 50px; }
.dept-card .dept-nums > div:last-child { margin-right: 0; }
.dept-card .dept-num-label { display: block; margin-top: 2px; }
.dept-card .dept-num { font-size: 22px; font-weight: 700; }
.dept-card .dept-num-label { font-size: 11px; color: var(--grey); text-transform: uppercase; letter-spacing: .03em; }
.dept-card .dept-num.pending { color: var(--miz-red); }

.breadcrumb { font-size: 13px; color: var(--grey); margin-bottom: 14px; }
.breadcrumb a { color: var(--grey); }
.breadcrumb .sep { margin: 0 6px; }
.breadcrumb .current { color: var(--ink); font-weight: 600; }

/* Status pills for WFH/On-duty/Office */
.status-pill { display: inline-flex; align-items: center; gap: 5px; padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; }
.status-pill.office { background: #E3F5E7; color: #1E7B3B; }
.status-pill.wfh { background: #E7EEFD; color: #2E5FCC; }
.status-pill.onduty { background: #FDF0DA; color: #A6650A; }

/* ---------- Tables ---------- */
table { width: 100%; border-collapse: collapse; background: var(--white); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); border: 1px solid var(--hairline-soft); }
th, td { text-align: left; padding: 13px 16px; font-size: 14px; border-bottom: 1px solid var(--hairline-soft); }
tbody tr { transition: background .12s; }
tbody tr:hover { background: var(--paper); }
tbody tr:last-child td { border-bottom: none; }
td a { font-weight: 600; }
th { color: var(--grey); font-weight: 700; font-size: 11.5px; text-transform: uppercase; letter-spacing: .05em; background: var(--paper); }

.badge { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; }
.badge-active { background: #E3F5E7; color: #1E7B3B; }
.badge-invited, .badge-pending_setup { background: #FFF3D6; color: #8A6100; }
.badge-deactivated, .badge-archived { background: #EFEFEE; color: var(--grey); }
/* Dedicated task-priority colors — previously priority badges borrowed
   .badge-active/.badge-invited (meant for user invite status), which gave
   low+medium the same green and high+urgent the same amber, with no visual
   distinction between the two pairs. */
/* Priority colors per Sumit's spec: Urgent=dark red, High=light red,
   Medium=yellow, Low=light green. Text color picked per-swatch for
   readable contrast rather than defaulting all to white. */
.badge-priority-urgent { background: #b10202; color: #ffcfca; font-weight: 700; }
.badge-priority-high   { background: #ffc8ab; color: #753800; font-weight: 700; }
.badge-priority-medium { background: #ffe5a1; color: #504128; font-weight: 700; }
.badge-priority-low    { background: #d4edbb; color: #13734b; font-weight: 700; }

/* Task STATUS badges — deliberately distinct from priority colors above.
   Only "Completed" is green; every other status gets its own non-green
   color so a quick glance at a list doesn't read as "everything's fine". */
.badge-status-backlog            { background: #5B5C61; color: #FFFFFF; }
.badge-status-todo               { background: #2E6FE6; color: #FFFFFF; }
.badge-status-in_progress        { background: #D9720A; color: #FFFFFF; }
.badge-status-review             { background: #7C3AED; color: #FFFFFF; }
.badge-status-changes_requested  { background: #E0620A; color: #FFFFFF; }
.badge-status-blocked             { background: #B3261E; color: #FFFFFF; font-weight: 700; }
.badge-status-completed          { background: #13734b; color: #d4edbd; font-weight: 700; }
.badge-status-archived            { background: #8A8B90; color: #FFFFFF; }

/* Dedicated "this is late" flag for tasks — deliberately darker/bolder
   than the general-purpose amber .badge-invited (which is shared with
   unrelated things like "Handoff Pending"), so an overdue task actually
   stands out instead of blending in with routine warnings. */
.badge-overdue { background: #B3261E; color: #FFFFFF; font-weight: 700; }

.clickable-row { cursor: pointer; }
.clickable-row:hover { background: var(--paper); }

.teammate-row {
  display: flex; align-items: center; gap: 12px; padding: 10px 8px; border-radius: 10px;
  color: inherit; text-decoration: none; border-bottom: 1px solid #F5F5F3;
}
.teammate-row:hover { background: var(--paper); text-decoration: none; }
.teammate-row:last-child { border-bottom: none; }

/* ---------- Forms ---------- */
.form-group { margin-bottom: 16px; }
label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 6px; }
input[type=text], input[type=email], input[type=password], input[type=date], input[type=datetime-local], input[type=number], select, textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--grey-light);
  border-radius: 8px;
  font-size: 14px;
  background: var(--white);
  transition: border-color .15s ease, box-shadow .15s ease;
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--miz-red);
  box-shadow: 0 0 0 3px rgba(230,61,46,.14);
}

/* ---------- Searchable select (see app.js initSearchableSelect) ---------- */
.searchable-select { position: relative; }
.searchable-select-native {
  /* Visually hidden but NOT display:none — a `required` native select is
     excluded from constraint validation entirely when display:none, so we
     tuck it off-screen instead to keep native form validation working. */
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0;
}
.searchable-select-input {
  width: 100%; padding: 10px 12px; border: 1px solid var(--grey-light);
  border-radius: 8px; font-size: 14px; background: var(--white);
}
.searchable-select-list {
  position: absolute; z-index: 20; top: calc(100% + 4px); left: 0; right: 0;
  max-height: 220px; overflow-y: auto; background: var(--white);
  border: 1px solid var(--grey-light); border-radius: var(--radius-sm);
  box-shadow: var(--shadow-lift); padding: 4px;
}
.searchable-select-option { padding: 9px 10px; border-radius: 6px; font-size: 14px; cursor: pointer; transition: background .1s ease; }
.searchable-select-option:hover, .searchable-select-option.is-selected { background: var(--paper); }
.searchable-select-empty { padding: 8px 10px; font-size: 13px; color: var(--grey); }

/* ---------- Auth pages ---------- */
.auth-wrapper {
  min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 20px;
  background: var(--ink);
  background-image:
    radial-gradient(500px 260px at 20% 15%, rgba(230,61,46,.18), transparent 60%),
    radial-gradient(500px 260px at 80% 85%, rgba(46,111,230,.12), transparent 60%);
}
.auth-box { background: var(--white); width: 100%; max-width: 400px; border-radius: var(--radius-lg); padding: 40px 34px; box-shadow: var(--shadow-modal); position: relative; }
.auth-box::before { content: ""; position: absolute; top: 0; left: 24px; right: 24px; height: 3px; background: var(--miz-red); border-radius: 0 0 4px 4px; }
.auth-box h1 { font-size: 24px; margin: 0 0 4px; }
.auth-box .brand-mark { color: var(--miz-red); font-weight: 800; }
.auth-box p.sub { color: var(--grey); font-size: 14px; margin-top: 0; margin-bottom: 24px; }
.auth-back-link { display: block; text-align: center; margin-top: 18px; font-size: 13px; color: rgba(255,255,255,.6); }
.auth-back-link:hover { color: var(--white); }

/* ---------- Auth pages: split-screen layout (login/register/etc.) ----------
   Separate from .auth-wrapper/.auth-box above, which error pages (403/404/500)
   still use as a simple centered box — kept untouched so those aren't affected. */
.auth-shell { min-height: 100vh; display: grid; grid-template-columns: 1fr; }
.auth-form-inner { animation: authFormIn .35s ease-out; }
@keyframes authFormIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}
.auth-brand-panel {
  display: none; background: var(--ink); color: var(--paper); padding: 40px; flex-direction: column;
  position: relative; overflow: hidden;
}
.auth-brand-panel::before {
  content: ''; position: absolute; inset: 0; z-index: 0; pointer-events: none;
  background-image: radial-gradient(600px 320px at 15% 10%, rgba(230,61,46,.20), transparent 60%), radial-gradient(600px 320px at 85% 90%, rgba(46,111,230,.16), transparent 60%);
  animation: authPanelDrift 18s ease-in-out infinite alternate;
}
@keyframes authPanelDrift {
  0% { transform: translate3d(0,0,0) scale(1); }
  100% { transform: translate3d(-3%, 2%, 0) scale(1.08); }
}
.auth-brand-logo, .auth-brand-mid, .auth-brand-back { position: relative; z-index: 1; }
.auth-brand-logo { font-size: 20px; font-weight: 800; color: #fff; flex-shrink: 0; }
.auth-brand-logo span { color: var(--miz-red); }
.auth-brand-trust { display: flex; gap: 20px; margin-top: 28px; flex-wrap: wrap; }
.auth-brand-trust-item { display: flex; align-items: baseline; gap: 6px; }
.auth-brand-trust-item strong { font-size: 16px; color: #fff; font-weight: 700; }
.auth-brand-trust-item span { font-size: 11.5px; color: #A9A9B0; }
.auth-brand-mid { flex: 1; display: flex; flex-direction: column; justify-content: center; }
.auth-brand-mid h2 { font-size: 27px; line-height: 1.28; margin: 0 0 14px; color: #fff; max-width: 15ch; letter-spacing: -0.01em; }
.auth-brand-mid p { color: #C6C6CC; font-size: 15px; line-height: 1.6; max-width: 36ch; margin: 0 0 28px; }
.auth-brand-illustration { display: flex; }
.auth-brand-illustration svg { max-width: 100%; height: auto; }
.auth-brand-back { color: rgba(255,255,255,.6); font-size: 13.5px; flex-shrink: 0; }
.auth-brand-back:hover { color: #fff; }

.auth-form-panel { display: flex; align-items: center; justify-content: center; padding: 40px 24px; background: var(--paper); }
.auth-form-inner { width: 100%; max-width: 380px; }
.auth-mobile-logo { display: inline-block; font-size: 19px; font-weight: 800; color: var(--ink); margin-bottom: 22px; }
.auth-mobile-logo span { color: var(--miz-red); }
.auth-form-inner p.sub { color: var(--grey); font-size: 14px; margin-top: 0; margin-bottom: 22px; }
.auth-form-back { display: block; text-align: center; margin-top: 18px; font-size: 13px; color: var(--grey); }
.auth-form-back:hover { color: var(--ink); }

@media (max-width: 899px) {
  .auth-form-panel { align-items: flex-start; padding-top: 64px; }
}

@media (min-width: 900px) {
  .auth-shell { grid-template-columns: 1fr 1fr; }
  .auth-brand-panel { display: flex; }
  .auth-mobile-logo { display: none; }
}

/* ---------- Flash / states ---------- */
.flash { padding: 13px 16px; border-radius: var(--radius-sm); font-size: 14px; margin-bottom: 16px; font-weight: 500; border: 1px solid transparent; }
.flash-success { background: #E3F5E7; color: #1E7B3B; border-color: #CCEAD4; }
.flash-error { background: #FCE7E5; color: #B3261E; border-color: #F6D3D0; }

.empty-state { text-align: center; padding: 56px 20px; color: var(--grey); }
.empty-state h3 { color: var(--ink); margin-bottom: 6px; font-size: 17px; }
.empty-state p { font-size: 14px; max-width: 340px; margin-left: auto; margin-right: auto; }

/* ---------- Bottom nav (mobile) ---------- */
.bottom-nav { display: none; }

@media (max-width: 860px) {
  .greeting { display: none; }
  .new-task-btn { display: none; }
  .topbar-search { display: none; }
  .icon-btn.topbar-search-icon { display: inline-flex; }
  .page-body { padding: 14px 14px 90px; }
  .dash-grid-2, .dash-grid-3 { grid-template-columns: minmax(0, 1fr) !important; }
  .stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .dept-grid { grid-template-columns: 1fr; }
  .btn { min-height: 44px; }
  .btn-sm { min-height: 38px; }
  table, thead, tbody, th, td, tr { display: block; }
  thead { display: none; }
  tr { background: var(--white); border-radius: var(--radius); box-shadow: var(--shadow); border: 1px solid var(--hairline-soft); margin-bottom: 12px; padding: 12px 16px; }
  td { border: none; padding: 7px 0; }
  td::before { content: attr(data-label); display: block; font-size: 10.5px; font-weight: 700; letter-spacing: .04em; color: var(--grey); text-transform: uppercase; margin-bottom: 2px; }

  .bottom-nav {
    display: flex; position: fixed; bottom: 0; left: 0; right: 0; background: rgba(255,255,255,.94);
    backdrop-filter: blur(8px); border-top: 1px solid var(--hairline); z-index: 10; align-items: center; padding: 6px 0;
    padding-bottom: calc(6px + env(safe-area-inset-bottom));
  }
  .bottom-nav a { flex: 1; text-align: center; padding: 6px 4px 8px; font-size: 11px; color: var(--grey); font-weight: 500; display: flex; flex-direction: column; align-items: center; gap: 2px; }
  .bottom-nav a svg { width: 19px; height: 19px; }
  .bottom-nav-fab {
    background: var(--miz-red); color: var(--white) !important; width: 42px; height: 42px; border-radius: 999px;
    display: flex; align-items: center; justify-content: center; font-size: 22px; font-weight: 400;
    flex: 0 0 42px !important; margin: 0 6px; box-shadow: var(--shadow-lift);
  }
}

/* ---------- Notes (see app/views/notes/index.php) ---------- */
.notes-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 16px;
}
.note-card { border: 1px solid rgba(0,0,0,0.06); transition: box-shadow .15s ease; }
.note-card.note-color-yellow { background: #FEF6D8; }
.note-card.note-color-green  { background: #DFF3E3; }
.note-card.note-color-blue   { background: #DCEBFB; }
.note-card.note-color-pink   { background: #FBE1EC; }
.note-card.note-color-grey   { background: #EAEAE7; }
.note-color-picker { display: flex; gap: 6px; }
.note-swatch {
  width: 22px; height: 22px; border-radius: 999px; cursor: pointer; display: inline-block;
  border: 2px solid transparent; box-sizing: border-box;
}
.note-swatch-yellow { background: #F4D35E; }
.note-swatch-green  { background: #8FD9A0; }
.note-swatch-blue   { background: #8FC1F0; }
.note-swatch-pink   { background: #F0A8C6; }
.note-swatch-grey   { background: #B8B8B3; }
.note-swatch.is-selected { border-color: rgba(0,0,0,0.55); }

/* =====================================================================
   v4 UI refresh — shared page chrome, segmented tabs, KPI tiles,
   Work Report (timeline / feed / people table), dashboard snapshot.
   Additive only: existing classes above keep working unchanged.
   ===================================================================== */
:root {
  --good: #1E7B3B; --good-bg: #E4F5E9;
  --warn: #A6650A; --warn-bg: #FFF1DA;
  --bad: #B3261E; --bad-bg: #FCE7E5;
  --info: #2E5FCC; --info-bg: #E7EEFD;
  --ink-2: #4A4B50;
}
body { font-feature-settings: "cv11", "ss01"; }
.muted { color: var(--grey); }
.card { border-radius: 14px; }
.card + .card { margin-top: 0; }

/* Page header */
.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 14px; flex-wrap: wrap; margin-bottom: 16px; }
.page-title { font-size: 24px; font-weight: 800; letter-spacing: -0.02em; margin: 0; }
.page-sub { color: var(--grey); font-size: 14px; margin: 4px 0 0; }
.page-sub strong { color: var(--ink-2); font-weight: 600; }
.page-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.section-title { font-size: 15px; font-weight: 700; margin: 6px 0 10px; }

/* Segmented control */
.seg { display: inline-flex; background: #EDEDEA; border-radius: 10px; padding: 3px; gap: 2px; max-width: 100%; overflow-x: auto; scrollbar-width: none; }
.seg::-webkit-scrollbar { display: none; }
.seg a, .seg button, .seg span {
  border: 0; background: transparent; padding: 7px 14px; border-radius: 8px; font-size: 13px; font-weight: 600;
  color: var(--ink-2); white-space: nowrap; cursor: pointer; text-decoration: none; font-family: inherit; line-height: 1.4;
}
.seg a:hover, .seg button:hover { color: var(--ink); text-decoration: none; }
.seg .is-active { background: var(--white); color: var(--ink); box-shadow: 0 1px 3px rgba(23,23,26,.10); }
.seg-lg a { padding: 9px 18px; font-size: 14px; }
.seg-sm a, .seg-sm button { padding: 5px 11px; font-size: 12.5px; }

/* Toolbar + chips */
.toolbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 16px; }
.toolbar .filters { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.toolbar .filters select, .toolbar .filters input[type=date] { width: auto; min-width: 150px; padding: 7px 10px; font-size: 13px; }
.toolbar .filters .searchable-select { min-width: 200px; }
.toolbar .filters .searchable-select-input { padding: 7px 10px; font-size: 13px; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { padding: 6px 12px; border-radius: 999px; font-size: 12.5px; font-weight: 600; color: var(--ink-2); background: var(--white); border: 1px solid var(--hairline); }
.chip:hover { border-color: var(--grey-light); text-decoration: none; color: var(--ink); }
.chip.is-active { background: var(--ink); color: var(--white); border-color: var(--ink); }
.range-form { display: flex; align-items: center; gap: 6px; margin-left: auto; }
.range-form input[type=date] { width: auto; padding: 6px 8px; font-size: 13px; }
.range-form span { color: var(--grey); }

.btn-xs { padding: 4px 10px; font-size: 12px; border-radius: 7px; font-weight: 600; }

/* Pills */
.pill { display: inline-flex; align-items: center; gap: 4px; padding: 2px 9px; border-radius: 999px; font-size: 11.5px; font-weight: 700; background: #EFEFEE; color: var(--ink-2); white-space: nowrap; }
a.pill:hover { text-decoration: none; filter: brightness(.97); }
.pill-good { background: var(--good-bg); color: var(--good); }
.pill-warn { background: var(--warn-bg); color: var(--warn); }
.pill-bad { background: var(--bad-bg); color: var(--bad); }
.pill-info { background: var(--info-bg); color: var(--info); margin-left: 6px; }

/* Summary strip (tasks) */
.sum-strip { display: grid; grid-template-columns: repeat(5, minmax(0,1fr)); gap: 10px; margin-bottom: 14px; }
.sum-strip > * { background: var(--white); border: 1px solid var(--hairline-soft); border-radius: 12px; padding: 10px 14px; box-shadow: var(--shadow-xs); color: var(--ink); display: flex; flex-direction: column; }
.sum-strip > a:hover { text-decoration: none; box-shadow: var(--shadow); }
.sum-strip strong { font-size: 20px; line-height: 1.2; }
.sum-strip span span, .sum-strip a span { font-size: 12px; color: var(--grey); font-weight: 600; }
.sum-strip .is-active { border-color: var(--ink); }
.sum-strip .sum-bad strong { color: var(--bad); }
.sum-strip .sum-good strong { color: var(--good); }

/* Clean table */
.table-wrap { overflow-x: auto; border-radius: 14px; }
.table-clean { box-shadow: none; border: 0; border-radius: 0; }
.card .table-clean, .card-flush .table-clean { background: transparent; }
.table-wrap > .table-clean { border: 1px solid var(--hairline-soft); border-radius: 14px; box-shadow: var(--shadow-xs); }
.table-clean th { background: #FAFAF8; }
.table-clean td { vertical-align: middle; }
.table-clean .num { text-align: center; }
.table-clean .cell-sm { font-size: 13px; }
.task-title { color: var(--ink); font-weight: 600; }
.task-title:hover { color: var(--miz-red); }
.task-desc { color: var(--grey); font-size: 12.5px; margin-top: 2px; }
.row-overdue td:first-child { box-shadow: inset 3px 0 0 var(--bad); }
.row-actions { text-align: right; white-space: nowrap; }
.row-actions form, .row-actions a { margin: 2px 0 2px 4px; }

/* Board */
.board { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(250px, 1fr); gap: 12px; overflow-x: auto; padding-bottom: 8px; }
.board-col { background: #EFEFEC; border-radius: 12px; padding: 10px; min-width: 0; }
.board-col-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.board-count { font-size: 12px; font-weight: 700; color: var(--grey); background: var(--white); border-radius: 999px; padding: 1px 8px; }
.board-empty { color: var(--grey); text-align: center; font-size: 12px; padding: 10px; }
.board-card { display: block; background: var(--white); border-radius: 10px; padding: 12px; margin-bottom: 8px; box-shadow: var(--shadow-xs); border: 1px solid var(--hairline-soft); color: var(--ink); transition: box-shadow .15s, transform .15s; }
.board-card:hover { text-decoration: none; box-shadow: var(--shadow-lift); transform: translateY(-1px); }
.board-card-title { font-weight: 600; font-size: 13.5px; margin-bottom: 4px; }
.board-card-meta { font-size: 12px; color: var(--grey); }
.board-card-foot { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; margin-top: 8px; }

/* KPI tiles */
.kpi-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-bottom: 18px; }
.kpi { background: var(--white); border: 1px solid var(--hairline-soft); border-radius: 14px; padding: 14px 16px; box-shadow: var(--shadow-xs); color: var(--ink); position: relative; overflow: hidden; }
.kpi::before { content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: var(--hairline); }
.kpi-good::before { background: var(--good); }
.kpi-warn::before { background: #E39B2B; }
.kpi-bad::before { background: var(--bad); }
.kpi-bad .kpi-value { color: var(--bad); }
.kpi-link:hover { text-decoration: none; box-shadow: var(--shadow); }
.kpi-value { font-size: 26px; font-weight: 800; letter-spacing: -0.02em; line-height: 1.15; }
.kpi-value small { font-size: 13px; font-weight: 600; color: var(--grey); }
.kpi-label { font-size: 12.5px; color: var(--grey); font-weight: 600; margin-top: 2px; }

/* Report layout */
.report-cols { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr); gap: 16px; align-items: start; }
.stack { display: flex; flex-direction: column; gap: 16px; }
.card-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 12px; flex-wrap: wrap; }
.card-head h3 { margin: 0; font-size: 15px; }
.card-head .muted { font-size: 12.5px; }
.card-flush { padding: 0; overflow: hidden; }
.card-flush .pad, .pad { padding: 16px 20px 0; }
.card-flush .table-wrap { border-radius: 0; }
.empty-mini { color: var(--grey); font-size: 13.5px; padding: 14px 0; }
.legend { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--grey); flex-wrap: wrap; }
.dot { width: 8px; height: 8px; border-radius: 999px; display: inline-block; margin-left: 6px; }
.dot-good { background: var(--good); } .dot-warn { background: #E39B2B; } .dot-bad { background: var(--bad); }

.person-card { display: flex; align-items: center; gap: 14px; margin-bottom: 16px; flex-wrap: wrap; }
.person-name { font-size: 18px; font-weight: 800; letter-spacing: -0.01em; }
.person-meta { color: var(--grey); font-size: 13px; }

.wr-avatar { width: 32px; height: 32px; border-radius: 999px; background: #EDE7E6; color: var(--deep-red); display: inline-flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 800; flex-shrink: 0; object-fit: cover; }
.wr-avatar-lg { width: 52px; height: 52px; font-size: 18px; }
.wr-avatar-sm { width: 28px; height: 28px; font-size: 11px; }
.person-cell { display: flex; align-items: center; gap: 10px; color: var(--ink); font-weight: 600; }
.person-cell:hover { text-decoration: none; color: var(--miz-red); }
.person-cell small, .lr-main small { display: block; color: var(--grey); font-weight: 500; font-size: 12px; }

.list-row { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--hairline-soft); color: var(--ink); }
.list-row:last-child { border-bottom: 0; }
a.list-row:hover { text-decoration: none; background: #FAFAF8; margin: 0 -10px; padding-left: 10px; padding-right: 10px; border-radius: 8px; }
.lr-main { min-width: 0; font-size: 13.5px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; }

/* Timeline */
.timeline { list-style: none; margin: 0; padding: 0; }
.tl-day { font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: .06em; color: var(--grey); padding: 12px 0 6px; }
.tl-day:first-child { padding-top: 0; }
.tl-item { display: grid; grid-template-columns: 64px 14px minmax(0,1fr); gap: 8px; align-items: start; padding: 6px 0; position: relative; }
.tl-time { font-size: 12px; color: var(--grey); text-align: right; padding-top: 1px; white-space: nowrap; }
.tl-dot { width: 10px; height: 10px; border-radius: 999px; background: var(--grey-light); margin-top: 5px; box-shadow: 0 0 0 3px var(--white); position: relative; z-index: 1; }
.tl-item::before { content: ''; position: absolute; left: 76px; top: 0; bottom: 0; width: 2px; background: var(--hairline-soft); }
.tl-body { font-size: 13.5px; color: var(--ink-2); }
.tl-body a { font-weight: 600; }
.tl-note { font-size: 12.5px; color: var(--grey); margin-top: 3px; background: #FAFAF8; border-radius: 8px; padding: 6px 9px; }
.tone-create .tl-dot { background: var(--info); }
.tone-done .tl-dot { background: var(--good); }
.tone-review .tl-dot { background: #7C3AED; }
.tone-transfer .tl-dot { background: #E39B2B; }
.tone-comment .tl-dot { background: #8A8B90; }
.tone-warn .tl-dot { background: var(--bad); }

/* Feed */
.feed { list-style: none; margin: 0; padding: 0; max-height: 640px; overflow-y: auto; }
.feed li { display: flex; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--hairline-soft); font-size: 13.5px; color: var(--ink-2); }
.feed li:last-child { border-bottom: 0; }
.feed strong { color: var(--ink); }
.feed a { font-weight: 600; }
.feed-time { font-size: 11.5px; color: var(--grey); margin-top: 2px; }
.feed .tone-done .wr-avatar, .feed li.tone-done .wr-avatar { background: var(--good-bg); color: var(--good); }
.feed li.tone-create .wr-avatar { background: var(--info-bg); color: var(--info); }

/* Meter */
.meter { height: 7px; border-radius: 999px; background: #EDEDEA; overflow: hidden; }
.meter span { display: block; height: 100%; background: linear-gradient(90deg, #1E7B3B, #38A169); border-radius: 999px; }

/* Dashboard snapshot card */
.snap-card { margin-bottom: 16px; }
.snap-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 14px; flex-wrap: wrap; }
.snap-head h3 { margin: 0; font-size: 16px; }
.snap-eyebrow { font-size: 11px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; color: var(--miz-red); }
.snap-progress { display: flex; align-items: center; gap: 14px; margin-bottom: 10px; }
.snap-progress-num { font-size: 15px; color: var(--grey); white-space: nowrap; }
.snap-progress-num strong { font-size: 26px; color: var(--ink); }
.snap-sub { font-size: 12px; font-weight: 700; color: var(--grey); margin: 6px 0 6px; }
.snap-people { display: flex; flex-wrap: wrap; gap: 6px; }
.snap-divider { height: 1px; background: var(--hairline-soft); margin: 14px 0; }
.snap-mini { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 10px; }
.snap-mini a { background: #FAFAF8; border-radius: 10px; padding: 10px 12px; color: var(--ink); display: flex; flex-direction: column; }
.snap-mini a:hover { text-decoration: none; background: #F3F3F0; }
.snap-mini strong { font-size: 20px; line-height: 1.2; }
.snap-mini span { font-size: 12px; color: var(--grey); font-weight: 600; }
.snap-mini .is-bad strong { color: var(--bad); }

@media (max-width: 960px) {
  .report-cols { grid-template-columns: minmax(0,1fr); }
}
@media (max-width: 860px) {
  .page-title { font-size: 21px; }
  .sum-strip { grid-template-columns: repeat(3, minmax(0,1fr)); }
  .snap-mini { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .range-form { margin-left: 0; width: 100%; }
  .range-form input[type=date] { flex: 1; min-width: 0; }
  .toolbar .filters { width: 100%; }
  .toolbar .filters select, .toolbar .filters input[type=date], .toolbar .filters .searchable-select { flex: 1; min-width: 0; }
  .kpi-grid { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .row-actions { text-align: left; }
  .table-clean tr { padding: 12px 14px; }
  .table-clean .num { text-align: left; }
  .tl-item { grid-template-columns: 56px 12px minmax(0,1fr); }
  .tl-item::before { left: 66px; }
  .board { grid-auto-columns: minmax(240px, 82vw); }
}

@media print {
  .topbar, .hamburger-menu, .hamburger-overlay, .bottom-nav, .toolbar, .page-actions, #pwa-install-banner { display: none !important; }
  body { background: #fff; }
  .page-body { padding: 0; max-width: none; }
  .card, .kpi { box-shadow: none; border: 1px solid #ddd; break-inside: avoid; }
  .report-cols { grid-template-columns: 1fr; }
  .feed { max-height: none; }
}

/* row-overdue mobile: on card-style rows, mark the whole card instead of the first cell */
@media (max-width: 860px) {
  .row-overdue td:first-child { box-shadow: none; }
  .table-clean tr.row-overdue { border-left: 3px solid var(--bad); }
}

/* =====================================================================
   v6 — App shell redesign (sidebar layout, Inter, softer surfaces).
   Same Mizup brand colors (red #E63D2E + ink). Overrides earlier rules.
   ===================================================================== */
:root {
  --paper: #F5F5F3;
  --surface: #FFFFFF;
  --hairline: #EAEAE6;
  --hairline-soft: #F0F0EC;
  --radius: 14px;
  --radius-lg: 18px;
  --sidebar-w: 248px;
  --shadow-xs: 0 1px 2px rgba(23,23,26,.04);
  --shadow: 0 1px 2px rgba(23,23,26,.04), 0 4px 14px rgba(23,23,26,.04);
  --red-soft: #FDECEA;
}
body {
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--paper);
  font-size: 14px;
  letter-spacing: -0.003em;
}
h1, h2, h3 { letter-spacing: -0.02em; }

/* ---------- Sidebar ---------- */
.sidebar {
  position: fixed; top: 0; left: 0; bottom: 0; width: var(--sidebar-w); z-index: 50;
  background: linear-gradient(180deg, #FFFFFF 0%, #FBFAF9 60%, #FCF4F3 100%);
  border-right: 1px solid var(--hairline);
  display: flex; flex-direction: column;
  transform: none; box-shadow: none; overflow: hidden;
}
.sb-head { display: flex; align-items: center; justify-content: space-between; padding: 18px 18px 14px; }
.sb-logo .logo-img { height: 30px; }
.sb-close { display: none; font-size: 24px; }
.sb-nav { flex: 1; overflow-y: auto; padding: 4px 12px 12px; scrollbar-width: thin; }
.sb-title { font-size: 11px; font-weight: 700; color: #A3A4A8; text-transform: uppercase; letter-spacing: .08em; padding: 16px 10px 6px; }
.sb-group { display: flex; flex-direction: column; gap: 2px; }
.sb-nav a {
  display: flex; align-items: center; gap: 11px; padding: 9px 10px; border-radius: 10px;
  color: #3D3E43; font-size: 14px; font-weight: 500; text-decoration: none; transition: background .12s, color .12s;
}
.sb-nav a svg { color: #8A8B90; flex-shrink: 0; transition: color .12s; }
.sb-nav a span { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sb-nav a:hover { background: #F2F2EF; color: var(--ink); text-decoration: none; }
.sb-nav a:hover svg { color: var(--ink); }
.sb-nav a.is-active { background: var(--white); color: var(--ink); font-weight: 600; box-shadow: 0 1px 2px rgba(23,23,26,.06), 0 0 0 1px var(--hairline); }
.sb-nav a.is-active svg { color: var(--miz-red); }
.sb-count { font-style: normal; font-size: 11.5px; font-weight: 700; color: var(--miz-red); background: var(--red-soft); border-radius: 999px; padding: 1px 8px; }
.sb-install { margin-top: 10px; }
.sb-user { margin: 10px 12px 14px; padding: 10px; background: var(--white); border: 1px solid var(--hairline); border-radius: 14px; display: flex; align-items: center; gap: 6px; box-shadow: var(--shadow-xs); }
.sb-user-link { flex: 1; min-width: 0; display: flex; align-items: center; gap: 10px; color: var(--ink); }
.sb-user-link:hover { text-decoration: none; }
.sb-user .avatar { width: 36px; height: 36px; }
.sb-user-text { min-width: 0; display: flex; flex-direction: column; line-height: 1.25; }
.sb-user-text strong { font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sb-user-text small { font-size: 11.5px; color: var(--grey); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sb-logout { margin: 0; }
.sb-logout .icon-btn { width: 34px; height: 34px; color: var(--grey); }
.sb-logout .icon-btn:hover { color: var(--miz-red); background: var(--red-soft); }

/* ---------- Shell / topbar ---------- */
.shell { margin-left: var(--sidebar-w); min-width: 0; min-height: 100vh; }
.topbar {
  background: rgba(245,245,243,.85); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--hairline); padding: 12px 28px; gap: 16px;
}
.topbar-logo { display: none; }
#menu-toggle { display: none; }
.topbar-welcome { display: flex; flex-direction: column; line-height: 1.2; }
.topbar-welcome span { font-size: 12.5px; color: var(--grey); }
.topbar-welcome strong { font-size: 15px; font-weight: 700; color: var(--ink); }
.topbar-center { max-width: 520px; }
.topbar-search { background: var(--white); border: 1px solid var(--hairline); border-radius: 12px; padding: 9px 12px 9px 14px; box-shadow: var(--shadow-xs); }
.topbar-search:focus-within { border-color: #D6D6D2; box-shadow: 0 0 0 4px rgba(23,23,26,.04); }
.topbar-search kbd { font-family: inherit; font-size: 11px; font-weight: 600; color: var(--grey); background: var(--paper); border: 1px solid var(--hairline); border-radius: 6px; padding: 1px 7px; }
.topbar-right { gap: 8px; }
.topbar-right .icon-btn { background: var(--white); border: 1px solid var(--hairline); width: 38px; height: 38px; }
.topbar-right .icon-btn:hover { background: var(--white); border-color: #D6D6D2; }
.new-task-btn { padding: 9px 16px !important; border-radius: 11px !important; font-size: 13.5px !important; }
.page-body { padding: 24px 28px 90px; max-width: 1320px; }

/* ---------- Buttons / inputs ---------- */
.btn { border-radius: 11px; font-weight: 600; letter-spacing: -0.005em; }
.btn-primary { box-shadow: 0 1px 2px rgba(230,61,46,.25), inset 0 1px 0 rgba(255,255,255,.18); }
.btn-secondary { border-color: var(--hairline); box-shadow: var(--shadow-xs); }
.btn-secondary:hover:not(:disabled) { background: #FAFAF8; border-color: #D6D6D2; }
.btn-dark { background: var(--ink); color: #fff; }
.btn-dark:hover { background: #000; text-decoration: none; }
input[type=text], input[type=email], input[type=password], input[type=date], input[type=datetime-local], input[type=number], select, textarea, .searchable-select-input {
  border-color: var(--hairline); border-radius: 10px; font-family: inherit;
}
input:focus, select:focus, textarea:focus { border-color: var(--miz-red); box-shadow: 0 0 0 4px rgba(230,61,46,.10); }

/* ---------- Surfaces ---------- */
.card { border: 1px solid var(--hairline); box-shadow: var(--shadow-xs); border-radius: 16px; }
.stat-card {
  border: 1px solid var(--hairline); box-shadow: var(--shadow-xs); border-radius: 16px; padding: 18px 20px; position: relative;
}
.stat-card:hover { box-shadow: var(--shadow); transform: none; border-color: #DCDCD7; }
.stat-card .value { font-size: 28px; font-weight: 800; letter-spacing: -0.03em; }
.stat-card .label { font-weight: 500; }
.stat-card-link::after {
  content: 'View →'; position: absolute; top: 16px; right: 18px; font-size: 12px; font-weight: 600; color: var(--grey); opacity: 0; transition: opacity .15s;
}
.stat-card-link:hover::after { opacity: 1; }
.dept-card { border: 1px solid var(--hairline); box-shadow: var(--shadow-xs); border-radius: 16px; }
table { border: 1px solid var(--hairline); box-shadow: var(--shadow-xs); border-radius: 16px; }
th { background: #FAFAF8; font-size: 11px; }
.flash { border-radius: 12px; }

/* Dashboard welcome header (Tasklify-style) */
.welcome-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 14px; flex-wrap: wrap; margin: 4px 0 20px; }
.welcome-head h1 { font-size: 26px; font-weight: 800; margin: 0; }
.welcome-head p { margin: 4px 0 0; color: var(--grey); font-size: 14.5px; }
.welcome-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* ---------- Task board (weihu-style tinted cards) ---------- */
.board { grid-auto-columns: minmax(270px, 1fr); gap: 16px; align-items: start; }
.board-col { background: rgba(255,255,255,.6); border: 1px solid var(--hairline); border-radius: 18px; padding: 12px; }
.board-col-head { padding: 4px 4px 10px; margin-bottom: 8px; border-bottom: 1px solid var(--hairline-soft); }
.bc-title { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 14.5px; color: var(--ink); }
.bc-dot { width: 9px; height: 9px; border-radius: 999px; }
.bc-actions { display: flex; align-items: center; gap: 6px; }
.bc-add { width: 26px; height: 26px; border-radius: 8px; display: inline-flex; align-items: center; justify-content: center; color: var(--grey); border: 1px solid var(--hairline); background: #fff; }
.bc-add:hover { color: var(--ink); text-decoration: none; }
.board-list { display: flex; flex-direction: column; gap: 10px; max-height: calc(100vh - 330px); min-height: 60px; overflow-y: auto; padding: 2px; scrollbar-width: thin; }
.board-card { margin: 0; border-radius: 14px; padding: 14px; border: 1px solid transparent; box-shadow: none; }
.board-card:hover { transform: translateY(-1px); box-shadow: 0 6px 18px rgba(23,23,26,.08); }
.bcard-tags { display: flex; flex-wrap: wrap; gap: 5px; margin-bottom: 9px; }
.bcard-tag { font-size: 11px; font-weight: 600; background: rgba(255,255,255,.75); border: 1px solid rgba(23,23,26,.06); border-radius: 7px; padding: 2px 7px; color: var(--ink-2); max-width: 150px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bcard-title { font-weight: 700; font-size: 14px; line-height: 1.35; margin-bottom: 4px; }
.bcard-note { font-size: 12.5px; color: var(--ink-2); opacity: .8; margin-bottom: 8px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.bcard-progress { margin: 10px 0 4px; }
.bcard-progress-head { display: flex; justify-content: space-between; font-size: 11.5px; font-weight: 600; color: var(--ink-2); margin-bottom: 5px; }
.bcard-dots { display: flex; gap: 3px; flex-wrap: wrap; }
.bcard-dots i { width: 10px; height: 10px; border-radius: 999px; background: rgba(23,23,26,.10); display: inline-block; }
.bcard-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 10px; }
.bcard-people { display: flex; }
.bcard-people .wr-avatar { width: 24px; height: 24px; font-size: 9.5px; border: 2px solid #fff; margin-left: -6px; background: #fff; }
.bcard-people .wr-avatar:first-child { margin-left: 0; }
.bcard-meta { display: flex; align-items: center; gap: 5px; flex-wrap: wrap; justify-content: flex-end; }
.bcard-chip { display: inline-flex; align-items: center; gap: 4px; font-size: 11.5px; font-weight: 600; color: var(--ink-2); background: rgba(255,255,255,.75); border: 1px solid rgba(23,23,26,.06); border-radius: 7px; padding: 2px 7px; white-space: nowrap; }
.bcard-chip.is-late { color: var(--bad); background: #fff; border-color: #F3C9C5; }
.bcard-flag { font-size: 11px; font-weight: 700; border-radius: 7px; padding: 2px 7px; }
.bcard-flag.p-urgent { background: #FDE2DF; color: #B3261E; }
.bcard-flag.p-high { background: #FFE6D5; color: #B5530C; }
.bcard-flag.p-medium { background: #FFF3CF; color: #8A6100; }
.bcard-flag.p-low { background: #E2F3E6; color: #1E7B3B; }

/* status tints */
.tint-todo { background: #EAF0FF; } .tint-todo .bcard-title { color: #2D4FB0; } .tint-todo .bcard-dots i.on { background: #4F6FD8; }
.tint-progress { background: #FFF0E3; } .tint-progress .bcard-title { color: #B5530C; } .tint-progress .bcard-dots i.on { background: #E67E22; }
.tint-review { background: #F2ECFF; } .tint-review .bcard-title { color: #6B3FC8; } .tint-review .bcard-dots i.on { background: #8B5CF6; }
.tint-done { background: #E5F6EC; } .tint-done .bcard-title { color: #1E7B3B; } .tint-done .bcard-dots i.on { background: #2F9E57; }
.tint-blocked { background: #FDEBEA; } .tint-blocked .bcard-title { color: #B3261E; } .tint-blocked .bcard-dots i.on { background: #D9483B; }
.dot-todo { background: #4F6FD8; } .dot-progress { background: #E67E22; } .dot-review { background: #8B5CF6; } .dot-done { background: #2F9E57; }

/* view switcher with icons */
.view-switch .seg button { display: inline-flex; align-items: center; gap: 6px; }

/* ---------- Mobile ---------- */
@media (max-width: 1024px) {
  .sidebar { transform: translateX(-100%); transition: transform .22s cubic-bezier(.4,0,.2,1); box-shadow: var(--shadow-modal); }
  .sidebar.open { transform: translateX(0); }
  .sb-close { display: inline-flex; }
  .shell { margin-left: 0; }
  #menu-toggle { display: inline-flex; }
  .topbar-logo { display: block; }
  .topbar-logo .logo-img { height: 28px; }
  .topbar-welcome { display: none; }
  .topbar { padding: 10px 16px; }
  .page-body { padding: 18px 18px 90px; }
}
@media (max-width: 860px) {
  .topbar-right .icon-btn { border: 0; background: transparent; }
  .topbar-hide-sm { display: none !important; }
  .page-body { padding: 14px 14px 90px; }
  .welcome-head h1 { font-size: 21px; }
  .board { grid-auto-columns: minmax(260px, 84vw); }
  .board-list { max-height: none; }
  .stat-card-link::after { display: none; }
  .bottom-nav a.is-active { color: var(--miz-red); }
}
@media print {
  .sidebar { display: none !important; }
  .shell { margin-left: 0; }
}

/* =====================================================================
   v7 — delight layer: drag & drop, toasts, colourful stat accents,
   gentle entrance motion. Brand: Mizup red + ink.
   ===================================================================== */
.page-body > * { animation: mzRise .35s cubic-bezier(.2,.8,.2,1) both; }
.page-body > *:nth-child(2) { animation-delay: .03s; } .page-body > *:nth-child(3) { animation-delay: .06s; }
.page-body > *:nth-child(4) { animation-delay: .09s; } .page-body > *:nth-child(5) { animation-delay: .12s; }
@keyframes mzRise { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .page-body > * { animation: none; } }

/* Stat cards: soft colour accents so the dashboard isn't grey-on-grey */
.stat-grid .stat-card { overflow: hidden; }
.stat-grid .stat-card::before { content: ''; position: absolute; top: 0; left: 0; right: 0; height: 3px; background: var(--miz-red); opacity: .9; }
.stat-grid .stat-card:nth-child(2)::before { background: #4F6FD8; }
.stat-grid .stat-card:nth-child(3)::before { background: #E67E22; }
.stat-grid .stat-card:nth-child(4)::before { background: #8B5CF6; }
.stat-grid .stat-card:nth-child(5)::before { background: #2F9E57; }
.stat-grid .stat-card:nth-child(6)::before { background: #17171A; }

.welcome-head h1 { background: linear-gradient(90deg, #17171A 0%, #17171A 55%, #E63D2E 100%); -webkit-background-clip: text; background-clip: text; color: transparent; }
.welcome-head p strong { color: var(--ink); }

/* Snapshot card: brand wash */
.snap-card { background: linear-gradient(135deg, #FFFFFF 0%, #FFFFFF 55%, #FFF3F1 100%); }

/* Filter note */
.filter-note { background: #FFF6F4; border: 1px solid #F6D6D1; color: var(--ink-2); border-radius: 12px; padding: 9px 14px; font-size: 13px; margin-bottom: 12px; }
.filter-note a { font-weight: 600; }

/* Drag & drop */
.board-card.is-movable { cursor: grab; }
.board-card.is-dragging { opacity: .45; transform: rotate(2deg) scale(.98); cursor: grabbing; }
.board-card.is-saving { opacity: .6; pointer-events: none; }
.board-col { transition: background .15s, border-color .15s, box-shadow .15s; }
.board-col.is-over { background: #FFF6F4; border-color: var(--miz-red); box-shadow: 0 0 0 4px rgba(230,61,46,.10); }
.board-col.is-over .board-list { min-height: 120px; }
.dnd-toast { position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%); background: var(--ink); color: #fff; padding: 10px 18px; border-radius: 999px; font-size: 13px; font-weight: 600; z-index: 60; box-shadow: var(--shadow-modal); }
.dnd-toast.is-bad { background: var(--bad); }
@media (max-width: 860px) { .dnd-toast { bottom: 84px; } }

/* Sidebar active: brand pill */
.sb-nav a.is-active { position: relative; }
.sb-nav a.is-active::before { content: ''; position: absolute; left: -12px; top: 9px; bottom: 9px; width: 3px; border-radius: 0 3px 3px 0; background: var(--miz-red); }

/* board: four columns fit the screen on desktop */
@media (min-width: 1025px) { .board { grid-auto-flow: row; grid-template-columns: repeat(4, minmax(0, 1fr)); overflow: visible; } }
.row-done td { opacity: .62; }
.row-done:hover td { opacity: 1; }

/* =====================================================================
   v9 — QA fixes: contrast, colour meaning, native controls, mobile.
   ===================================================================== */
:root { --grey: #6B6C72; --link: #2559C7; }
html, body { overflow-x: clip; }
a { color: var(--link); }
td a, .task-title, .list-row, .person-cell, .tl-body a, .feed a { color: var(--ink); }
td a:hover, .tl-body a:hover, .feed a:hover { color: var(--miz-red); }
.page-body > * { animation-duration: .18s; }
@keyframes mzRise { from { opacity: .6; transform: translateY(3px); } to { opacity: 1; transform: none; } }

/* Positive = green, destructive = red outline */
.btn-success { background: var(--good); color: #fff; box-shadow: 0 1px 2px rgba(30,123,59,.25); }
.btn-success:hover:not(:disabled) { background: #176530; color: #fff; text-decoration: none; }
.btn-danger-outline { background: #fff; color: var(--bad); border: 1px solid #EBB9B4; }
.btn-danger-outline:hover:not(:disabled) { background: var(--bad-bg); color: var(--bad); text-decoration: none; }
.req { color: var(--bad); font-weight: 700; }

/* Board overdue cue */
.board-card.is-overdue { box-shadow: inset 3px 0 0 var(--bad); }

/* Native controls brought into the design system */
input[type=time], input[type=search], input[type=url], input[type=tel] {
  width: 100%; padding: 10px 12px; border: 1px solid var(--hairline); border-radius: 10px; font-size: 14px; font-family: inherit; background: var(--white);
}
input[type=file] { font-family: inherit; font-size: 13px; color: var(--grey); }
input[type=file]::file-selector-button {
  font-family: inherit; font-weight: 600; font-size: 13px; color: var(--ink); background: var(--white);
  border: 1px solid var(--hairline); border-radius: 9px; padding: 7px 12px; margin-right: 10px; cursor: pointer;
}
input[type=file]::file-selector-button:hover { background: var(--paper); }
.page-body button:not([class]) {
  font-family: inherit; font-size: 13px; font-weight: 600; color: var(--ink-2); background: var(--white);
  border: 1px solid var(--hairline); border-radius: 999px; padding: 6px 14px; cursor: pointer;
}
.page-body button:not([class]):hover { border-color: #D6D6D2; color: var(--ink); }
.page-body select { font-family: inherit; }

/* Mobile polish */
.bottom-nav-fab { font-size: 28px !important; line-height: 1; }
@media (max-width: 860px) {
  .seg { max-width: 100%; }
  .seg-lg a { padding: 8px 12px; font-size: 13px; }
  .sum-strip { display: flex; overflow-x: auto; scrollbar-width: none; }
  .sum-strip > * { flex: 0 0 auto; min-width: 104px; }
  .sum-strip::-webkit-scrollbar { display: none; }
  .toolbar .filters > * { flex: 1 1 100%; }
}

/* v10 — projects list */
button.chip { font-family: inherit; cursor: pointer; }
.proj-status { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 700; }
.ps-planning { background: #E7EEFD; color: #2E5FCC; }
.ps-active { background: var(--good-bg); color: var(--good); }
.ps-on_hold { background: var(--warn-bg); color: var(--warn); }
.ps-completed { background: #13734b; color: #fff; }
.ps-archived { background: #EFEFEE; color: var(--grey); }
#proj-search { padding: 8px 12px; font-size: 13px; }
