: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;
  /* Default look is a visible secondary button; the variants below override it. */
  background: var(--white);
  color: var(--ink);
  border: 1px solid var(--grey-light);
  text-decoration: 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:hover:not(:disabled) { background: var(--paper); border-color: #C8C8C4; text-decoration: none; }
.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); border-color: transparent; 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); border-color: transparent; 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; }
.btn-ghost { background: transparent; border-color: transparent; color: var(--grey); }
.btn-ghost:hover:not(:disabled) { background: var(--paper); border-color: var(--grey-light); color: var(--ink); }

/* ---------- 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); }
