:root {
  color-scheme: light;
  --bg: #f5f7fa;
  --surface: #ffffff;
  --surface-2: #f7f9fc;
  --text: #172033;
  --muted: #667085;
  --line: #e2e8f0;
  --primary: #1d4ed8;
  --primary-2: #0f766e;
  --danger: #ef4444;
  --warning: #f59e0b;
  --success: #16a34a;
  --success-dark: #166534;
  --purple: #8b5cf6;
  --yellow: #facc15;
  --blue: #38bdf8;
  --shadow: 0 18px 45px rgba(15, 23, 42, 0.1);
  --radius: 20px;
}

body.theme-colourful {
  --bg: #eef3f8;
  --surface: #ffffff;
  --surface-2: #f3f6fa;
  --primary: #1e40af;
  --primary-2: #0f766e;
  --shadow: 0 18px 44px rgba(15, 23, 42, 0.1);
}

body.theme-professional {
  --bg: #f6f8fb;
  --surface: #ffffff;
  --surface-2: #f8fafc;
  --text: #111827;
  --primary: #1d4ed8;
  --primary-2: #334155;
  --shadow: 0 14px 36px rgba(15, 23, 42, 0.08);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 14px;
}

.login-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 22px;
  background:
    radial-gradient(circle at 15% 12%, rgba(45, 108, 223, 0.16), transparent 28%),
    radial-gradient(circle at 88% 18%, rgba(18, 152, 129, 0.12), transparent 26%),
    linear-gradient(135deg, #f7fbff 0%, #eef5fc 52%, #ffffff 100%);
  position: relative;
  overflow: hidden;
}

.login-card {
  width: min(380px, 100%);
  padding: 26px;
  border: 1px solid #dbe7f3;
  border-radius: 22px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(250, 253, 255, 0.94)),
    var(--surface);
  box-shadow: 0 18px 44px rgba(20, 44, 84, 0.12);
  position: relative;
  overflow: hidden;
}

.login-card::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 5px;
  background: linear-gradient(90deg, #2d6cdf, #20a17b, #f5a623);
}

.login-card .brand-mark {
  margin-bottom: 14px;
  width: 48px;
  height: 48px;
  border-radius: 14px;
  background: linear-gradient(135deg, #2d6cdf, #20a17b);
}

.login-card h1 {
  margin: 0;
  font-size: 25px;
  letter-spacing: -0.03em;
}

.login-card p {
  color: var(--muted);
}

.login-subtitle {
  margin: 6px 0 14px;
  line-height: 1.45;
  font-size: 13px;
}

.login-card .field {
  margin-top: 12px;
}

.login-card .primary-button {
  width: 100%;
  justify-content: center;
  margin-top: 16px;
  min-height: 44px;
  font-size: 14px;
  background: linear-gradient(135deg, #2d6cdf, #1f8f73);
  box-shadow: 0 10px 22px rgba(45, 108, 223, 0.22);
}

.login-note {
  font-size: 12px;
  line-height: 1.5;
}

button, input, select, textarea {
  font: inherit;
}

button {
  border: 0;
  cursor: pointer;
}

.app-shell {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  background:
    linear-gradient(180deg, #ffffff 0%, #f7faff 100%);
  color: #1f2937;
  padding: 22px 16px;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow: auto;
  z-index: 30;
  display: flex;
  flex-direction: column;
  border-right: 1px solid #dce7f5;
  box-shadow: 10px 0 30px rgba(37, 99, 235, 0.06);
}

.brand {
  display: flex;
  gap: 12px;
  align-items: center;
  margin-bottom: 24px;
  padding: 8px 8px 16px;
  border-bottom: 1px solid #e5edf7;
}

.brand-mark {
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  border-radius: 14px;
  font-size: 22px;
  color: #fff;
  background: linear-gradient(135deg, #2d6cdf, #1f8f73);
  box-shadow: 0 10px 22px rgba(45, 108, 223, 0.2);
}

.brand h1 {
  font-size: 18px;
  line-height: 1.2;
  margin: 0;
  color: #102a43;
  font-weight: 800;
}

.brand p, .small-muted {
  margin: 4px 0 0;
  color: #64748b;
  font-size: 12px;
}

.brand .brand-company-name {
  margin-top: 8px;
  color: #1e40af;
  font-size: 13px;
  font-weight: 700;
  line-height: 1.35;
}

.brand .brand-company-address {
  color: #64748b;
  font-size: 11px;
  line-height: 1.4;
  white-space: pre-line;
}

.nav {
  display: grid;
  gap: 6px;
}

.nav button {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 11px 13px;
  border-radius: 10px;
  color: #334155;
  background: transparent;
  text-align: left;
  transition: 0.2s ease;
  border: 1px solid transparent;
  font-weight: 600;
}

.nav button:hover, .nav button.active {
  background: #eef6ff;
  color: #1d4ed8;
  border-color: #d5e9ff;
}

.nav button.active {
  background: linear-gradient(90deg, #eaf3ff, #f7fbff);
  box-shadow: inset 4px 0 0 #2d6cdf;
}

.role-card, .current-user-card {
  margin-top: 26px;
  padding: 16px;
  border-radius: 14px;
  background: #f1f6fd;
  border: 1px solid #d9e8f8;
}

.current-user-card {
  margin-top: auto;
}

.current-user-card span {
  display: block;
  color: #64748b;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 8px;
}

.current-user-card strong {
  display: block;
  color: #102a43;
  font-size: 16px;
}

.sidebar-contact-card {
  margin-top: 12px;
  padding: 14px 16px;
  border-radius: 18px;
  background: rgba(29, 78, 216, 0.18);
  border: 1px solid rgba(191, 219, 254, 0.18);
}

.sidebar-contact-card span {
  display: block;
  margin-top: 10px;
  color: #a8b7ce;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.sidebar-contact-card span:first-child {
  margin-top: 0;
}

.sidebar-contact-card a,
.sidebar-contact-card strong {
  display: block;
  margin-top: 5px;
  color: #ffffff;
  font-size: 14px;
  font-weight: 700;
  text-decoration: none;
  word-break: break-word;
}

.sidebar-contact-card a:hover {
  text-decoration: underline;
}

.role-card select {
  width: 100%;
  margin-top: 10px;
  color: #0f172a;
  border: 0;
  border-radius: 12px;
  padding: 10px;
}

.content {
  min-width: 0;
  padding: 22px;
}

.topbar {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: center;
  margin-bottom: 20px;
}

.topbar h2 {
  margin: 0;
  font-size: clamp(22px, 3.4vw, 30px);
}

.topbar p {
  margin: 6px 0 0;
  color: var(--muted);
}

.top-actions {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.icon-button, .primary-button, .secondary-button, .danger-button {
  border-radius: 14px;
  padding: 11px 14px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: 0 7px 22px rgba(15, 23, 42, 0.05);
}

.primary-button {
  color: #fff;
  background: linear-gradient(135deg, var(--primary), var(--primary-2));
  border: 0;
}

.top-action-button {
  border: 0;
  border-radius: 14px;
  padding: 11px 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-weight: 800;
  cursor: pointer;
  color: #fff;
  box-shadow: 0 10px 22px rgba(15, 23, 42, 0.13);
}

.top-action-sample { background: linear-gradient(135deg, #64748b, #334155); }
.top-action-import { background: linear-gradient(135deg, #0f766e, #14b8a6); }
.top-action-export { background: linear-gradient(135deg, #d97706, #facc15); color: #422006; }
.top-action-add { background: linear-gradient(135deg, #1d4ed8, #2563eb); }
.top-action-logout { background: linear-gradient(135deg, #475569, #0f172a); }

#chatButton,
#notifyButton {
  color: #fff;
  border: 0;
  box-shadow: 0 12px 24px rgba(15, 23, 42, 0.14);
}

#chatButton {
  background: linear-gradient(135deg, #7c3aed, #2563eb);
}

#notifyButton {
  background: linear-gradient(135deg, #d97706, #ea580c);
}

.danger-button {
  color: #fff;
  background: var(--danger);
  border: 0;
}

.secondary-button:disabled, .primary-button:disabled, .danger-button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.mobile-menu {
  display: none;
}

.page {
  display: none;
  animation: fadeIn 0.2s ease;
}

.page.active {
  display: block;
}

.render-error-note {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin: 18px 0;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

.grid {
  display: grid;
  gap: 16px;
}

.metrics {
  grid-template-columns: repeat(5, minmax(0, 1fr));
}

.staff-dashboard-metrics {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.staff-performance-metrics {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.metric-card {
  position: relative;
  overflow: hidden;
  min-height: 118px;
  padding: 15px;
  border-radius: var(--radius);
  color: #fff;
  box-shadow: var(--shadow);
  border: 0;
  text-align: left;
  transition: transform 0.18s ease, box-shadow 0.18s ease;
}

.metric-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 26px 58px rgba(15, 23, 42, 0.18);
}

.metric-card::after {
  content: "";
  position: absolute;
  width: 125px;
  height: 125px;
  border-radius: 50%;
  right: -32px;
  bottom: -42px;
  background: rgba(255,255,255,0.2);
}

.metric-card span {
  display: inline-flex;
  padding: 6px 9px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.18);
  font-size: 11px;
}

.metric-card strong {
  display: block;
  font-size: 26px;
  margin: 12px 0 4px;
}

.metric-card p {
  margin: 0;
  font-size: 12px;
  opacity: 0.9;
}

.grad-blue { background: linear-gradient(135deg, #1d4ed8, #2563eb); }
.grad-red { background: linear-gradient(135deg, #b91c1c, #dc2626); }
.grad-yellow { background: linear-gradient(135deg, #b45309, #d97706); }
.grad-purple { background: linear-gradient(135deg, #5b21b6, #6d28d9); }
.grad-green { background: linear-gradient(135deg, #047857, #059669); }
.grad-darkgreen { background: linear-gradient(135deg, #064e3b, #047857); }
.grad-slate { background: linear-gradient(135deg, #334155, #475569); }
.grad-pink { background: linear-gradient(135deg, #9f1239, #be123c); }

.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px;
}

.panel h3 {
  margin: 0 0 14px;
  font-size: 18px;
}

.dashboard-layout {
  display: grid;
  grid-template-columns: 1.3fr 0.7fr;
  gap: 16px;
  margin-top: 16px;
}

.dashboard-layout.dashboard-single {
  grid-template-columns: 1fr;
}

.charts {
  grid-template-columns: 1fr 1fr;
}

.bar-row {
  display: grid;
  grid-template-columns: 110px 1fr 36px;
  gap: 10px;
  align-items: center;
  margin: 12px 0;
  font-size: 13px;
}

.bar-link {
  width: 100%;
  border: 0;
  color: var(--text);
  background: transparent;
  text-align: left;
  border-radius: 12px;
  padding: 8px;
  transition: background 0.18s ease;
}

.bar-link:hover {
  background: var(--surface-2);
}

.bar-track {
  height: 12px;
  background: var(--surface-2);
  border-radius: 999px;
  overflow: hidden;
}

.bar-fill {
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--primary), var(--primary-2));
}

.donut-wrap {
  display: grid;
  place-items: center;
  gap: 12px;
}

.donut {
  width: 180px;
  height: 180px;
  border-radius: 50%;
  background: conic-gradient(var(--success) 0 40%, var(--blue) 40% 68%, var(--warning) 68% 86%, var(--danger) 86% 100%);
  position: relative;
}

.donut::after {
  content: "";
  position: absolute;
  inset: 26px;
  background: var(--surface);
  border-radius: 50%;
}

.legend {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: center;
  color: var(--muted);
  font-size: 12px;
}

.dot {
  width: 10px;
  height: 10px;
  display: inline-block;
  border-radius: 50%;
  margin-right: 5px;
}

.filters {
  display: grid;
  grid-template-columns: repeat(6, minmax(140px, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

.filter-hero {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: center;
  padding: 18px;
  margin-bottom: 14px;
  color: #fff;
  border-radius: var(--radius);
  background: linear-gradient(135deg, #1e3a8a, #1d4ed8 60%, #0f766e);
  box-shadow: 0 18px 38px rgba(15, 23, 42, 0.14);
}

.filter-hero h3 {
  margin: 0 0 6px;
  font-size: 20px;
}

.filter-hero p {
  margin: 0;
  opacity: 0.9;
}

.filter-hero span {
  flex: 0 0 auto;
  padding: 9px 12px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.18);
  font-weight: 800;
}

.colourful-filters {
  padding: 16px;
  border-radius: var(--radius);
  background:
    linear-gradient(135deg, rgba(14, 165, 233, 0.12), rgba(139, 92, 246, 0.12)),
    var(--surface-2);
  border: 1px solid rgba(37, 99, 235, 0.12);
}

.field {
  display: grid;
  gap: 7px;
}

.field label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.field input, .field select, .field textarea {
  width: 100%;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--text);
  border-radius: 13px;
  padding: 11px 12px;
  outline: none;
}

.readonly-value {
  width: 100%;
  border: 1px solid var(--line);
  background: var(--surface-2);
  color: var(--text);
  border-radius: 13px;
  padding: 11px 12px;
  min-height: 40px;
}

.password-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
}

.password-wrap input {
  flex: 1;
}

.password-wrap button {
  flex: 0 0 auto;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px 12px;
  background: var(--surface-2);
  color: var(--text);
}

.field textarea {
  min-height: 90px;
  resize: vertical;
}

.table-wrap {
  overflow: auto;
}

.file-table-wrap {
  margin-top: 14px;
  padding: 10px;
  border: 1px solid rgba(148, 163, 184, 0.28);
  border-radius: 22px;
  background:
    linear-gradient(180deg, rgba(248, 250, 252, 0.96), rgba(241, 245, 249, 0.82)),
    var(--surface);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.82), 0 18px 45px rgba(15, 23, 42, 0.08);
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 980px;
}

th, td {
  padding: 13px 12px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
  font-size: 13px;
}

th {
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  background: var(--surface-2);
  position: sticky;
  top: 0;
  z-index: 1;
}

.file-table {
  border-collapse: separate;
  border-spacing: 0 9px;
  min-width: 1040px;
}

.file-table th {
  padding: 13px 14px;
  color: #334155;
  background: linear-gradient(180deg, #eaf1fb, #dfe9f7);
  border-top: 1px solid rgba(148, 163, 184, 0.35);
  border-bottom: 1px solid rgba(148, 163, 184, 0.35);
}

.file-table th:first-child {
  border-left: 1px solid rgba(148, 163, 184, 0.35);
  border-radius: 16px 0 0 16px;
}

.file-table th:last-child {
  border-right: 1px solid rgba(148, 163, 184, 0.35);
  border-radius: 0 16px 16px 0;
}

.file-table td {
  position: relative;
  padding: 15px 14px;
  border-top: 1px solid rgba(148, 163, 184, 0.22);
  border-bottom: 1px solid rgba(148, 163, 184, 0.22);
  background: #ffffff;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.04);
}

.file-table td + td {
  border-left: 1px solid rgba(226, 232, 240, 0.82);
}

.file-table tr:nth-child(even) td {
  background: #f8fbff;
}

.file-table tr:hover td {
  background: #eef6ff;
  border-color: rgba(37, 99, 235, 0.22);
  box-shadow: 0 14px 34px rgba(37, 99, 235, 0.10);
}

.file-table td:first-child {
  border-left: 1px solid rgba(148, 163, 184, 0.22);
  border-radius: 16px 0 0 16px;
  padding-left: 20px;
}

.file-table td:first-child::before {
  content: "";
  position: absolute;
  left: 0;
  top: 12px;
  bottom: 12px;
  width: 5px;
  border-radius: 999px;
  background: #64748b;
}

.file-table td:last-child {
  border-right: 1px solid rgba(148, 163, 184, 0.22);
  border-radius: 0 16px 16px 0;
}

.file-row-overdue td:first-child::before,
.file-row-pending td:first-child::before { background: #dc2626; }
.file-row-progress td:first-child::before { background: #2563eb; }
.file-row-approval td:first-child::before { background: #d97706; }
.file-row-report td:first-child::before { background: #7c3aed; }
.file-row-filed td:first-child::before { background: #059669; }
.file-row-billed td:first-child::before { background: #166534; }

.client-name {
  font-weight: 800;
}

.subtext {
  display: block;
  color: var(--muted);
  font-size: 12px;
  margin-top: 3px;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 9px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.badge.pending { color: #9a3412; background: #ffedd5; }
.badge.progress { color: #075985; background: #e0f2fe; }
.badge.overdue { color: #991b1b; background: #fee2e2; }
.badge.approval { color: #854d0e; background: #fef9c3; }
.badge.report { color: #6d28d9; background: #ede9fe; }
.badge.filed { color: #166534; background: #dcfce7; }
.badge.billed { color: #14532d; background: #bbf7d0; }

.priority-urgent { color: #991b1b; background: #fee2e2; }
.priority-high { color: #9a3412; background: #ffedd5; }
.priority-medium { color: #854d0e; background: #fef3c7; }
.priority-low { color: #166534; background: #dcfce7; }

.pipeline {
  display: flex;
  gap: 6px;
  min-width: 190px;
}

.pipe-step {
  width: 24px;
  height: 9px;
  border-radius: 99px;
  background: #dbe3ee;
}

.pipe-step.done {
  background: linear-gradient(90deg, var(--primary), var(--success));
}

.checkbox-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(120px, 1fr));
  gap: 10px;
}

.check-pill {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 11px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface-2);
  font-size: 13px;
}

.two-col {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.three-col {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.drawer, .notification-panel {
  position: fixed;
  right: 0;
  top: 0;
  width: min(620px, 100%);
  height: 100vh;
  background: var(--surface);
  box-shadow: -18px 0 50px rgba(15, 23, 42, 0.2);
  z-index: 50;
  transform: translateX(105%);
  transition: 0.24s ease;
  display: flex;
  flex-direction: column;
}

.drawer.open, .notification-panel.open {
  transform: translateX(0);
}

.drawer-head {
  padding: 18px;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.drawer-head h3 { margin: 0; }

.drawer-body {
  padding: 18px;
  overflow: auto;
  display: grid;
  gap: 14px;
}

.drawer-actions {
  padding: 16px 18px;
  border-top: 1px solid var(--line);
  display: flex;
  gap: 10px;
  justify-content: flex-end;
}

.backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.42);
  z-index: 40;
}

.backdrop.show { display: block; }

.card-list {
  display: grid;
  gap: 12px;
}

.alert-card, .user-card, .invite-card, .attachment-card {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--surface-2);
}

.alert-card {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
}

.alert-card p, .user-card p, .invite-card p, .attachment-card p { margin: 4px 0 0; color: var(--muted); font-size: 13px; }

.user-access-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.user-access-card {
  border: 1px solid var(--line);
  border-radius: 16px;
  background: linear-gradient(180deg, #ffffff, #f8fafc);
  overflow: hidden;
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.06);
}

.user-access-row {
  display: grid;
  grid-template-columns: 88px minmax(0, 1fr);
  gap: 8px;
  padding: 9px 12px;
  border-bottom: 1px solid #e5e7eb;
  align-items: center;
}

.user-access-row span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
}

.user-access-row strong {
  color: var(--text);
  font-size: 13px;
  overflow-wrap: anywhere;
}

.user-access-actions {
  display: flex;
  gap: 8px;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
}

.admin-data-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.team-chat-body {
  height: calc(100vh - 78px);
  grid-template-rows: minmax(0, 1fr) auto;
}

.chat-messages {
  display: grid;
  gap: 10px;
  overflow: auto;
  padding-right: 4px;
  align-content: start;
}

.chat-message {
  max-width: 86%;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 16px 16px 16px 4px;
  background: var(--surface-2);
}

.chat-message.own {
  justify-self: end;
  border-radius: 16px 16px 4px 16px;
  color: #fff;
  background: linear-gradient(135deg, var(--primary), var(--primary-2));
  border-color: transparent;
}

.chat-meta {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  margin-bottom: 6px;
  font-size: 12px;
}

.chat-meta span {
  color: var(--muted);
  white-space: nowrap;
}

.chat-message.own .chat-meta span {
  color: rgba(255, 255, 255, 0.75);
}

.chat-message p {
  margin: 0;
  line-height: 1.45;
  white-space: pre-wrap;
}

.chat-compose {
  display: grid;
  gap: 10px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.chat-target-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.chat-compose textarea {
  min-height: 88px;
  resize: vertical;
}

.chat-attachment-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.chat-attach-button {
  width: fit-content;
  cursor: pointer;
}

.chat-attachment-card {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 2px 8px;
  margin-top: 10px;
  padding: 10px 12px;
  border: 1px solid rgba(37, 99, 235, 0.22);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.78);
  color: #1d4ed8;
  text-decoration: none;
}

.chat-message.own .chat-attachment-card {
  background: rgba(255, 255, 255, 0.16);
  border-color: rgba(255, 255, 255, 0.32);
  color: #ffffff;
}

.chat-attachment-card span {
  grid-row: span 2;
  font-size: 18px;
}

.chat-attachment-card strong,
.chat-attachment-card small {
  overflow-wrap: anywhere;
}

.chat-attachment-card small {
  color: var(--muted);
}

.chat-message.own .chat-attachment-card small {
  color: rgba(255, 255, 255, 0.78);
}

.report-date-filter {
  display: grid;
  grid-template-columns: repeat(3, minmax(160px, 1fr));
  gap: 12px;
  margin: 16px 0 18px;
  padding: 14px;
  border: 1px solid rgba(148, 163, 184, 0.24);
  border-radius: 18px;
  background: linear-gradient(135deg, #f8fbff, #eef4ff);
}

@media (max-width: 720px) {
  .report-date-filter {
    grid-template-columns: 1fr;
  }
}

.staff-selector {
  max-width: 360px;
  margin-bottom: 16px;
}

.report-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.report-card {
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  position: relative;
  overflow: hidden;
  box-shadow: 0 14px 34px rgba(15, 23, 42, 0.08);
}

.report-card::before {
  content: "";
  position: absolute;
  inset: 0;
  opacity: 0.12;
  pointer-events: none;
}

.report-card h4 { margin: 0 0 8px; }
.report-card p { color: var(--muted); min-height: 40px; }
.report-card strong { display: block; margin: 0 0 14px; }

.report-icon {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border-radius: 15px;
  margin-bottom: 12px;
  background: rgba(255, 255, 255, 0.55);
  font-size: 22px;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.35);
}

.report-panel {
  background:
    radial-gradient(circle at 8% 0%, rgba(59, 130, 246, 0.12), transparent 30%),
    radial-gradient(circle at 94% 4%, rgba(236, 72, 153, 0.12), transparent 28%),
    var(--surface);
}

.report-hero {
  background: linear-gradient(135deg, #0f172a, #7c3aed 55%, #06b6d4);
}

.report-blue::before { background: #2563eb; }
.report-purple::before { background: #8b5cf6; }
.report-cyan::before { background: #06b6d4; }
.report-red::before { background: #ef4444; }
.report-yellow::before { background: #f59e0b; }
.report-green::before { background: #16a34a; }
.report-pink::before { background: #db2777; }

.report-list-hero {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 16px;
  margin-bottom: 14px;
  border-radius: 18px;
  color: #fff;
  background: linear-gradient(135deg, #111827, #1e3a8a);
}

.report-list-hero h3 {
  margin: 0 0 4px;
}

.report-list-hero p {
  margin: 0;
  opacity: 0.88;
}

.report-list-hero span {
  padding: 8px 12px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.15);
  font-weight: 800;
}

.report-list {
  display: grid;
  gap: 10px;
}

.report-card-grid {
  margin-top: 14px;
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.compact-report-list {
  margin-top: 16px;
}

.report-export-card {
  min-height: 170px;
}

.report-card-actions {
  position: relative;
  z-index: 1;
  display: flex;
  gap: 8px;
  margin-top: 16px;
}

.report-card-actions button {
  border: 1px solid rgba(255, 255, 255, 0.35);
  border-radius: 11px;
  padding: 8px 12px;
  color: #fff;
  background: rgba(255, 255, 255, 0.16);
  backdrop-filter: blur(8px);
}

.report-card-actions button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.report-row {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) auto auto;
  gap: 10px;
  align-items: center;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: linear-gradient(180deg, #ffffff, #f8fafc);
}

.report-row span {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
}

.empty {
  padding: 28px;
  text-align: center;
  color: var(--muted);
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%) translateY(120px);
  background: #0f172a;
  color: #fff;
  padding: 12px 16px;
  border-radius: 14px;
  box-shadow: var(--shadow);
  z-index: 80;
  transition: 0.25s ease;
}

.toast.show {
  transform: translateX(-50%) translateY(0);
}

.permission-note {
  color: var(--muted);
  background: var(--surface-2);
  border: 1px dashed var(--line);
  border-radius: 14px;
  padding: 12px;
  font-size: 13px;
}

.action-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.file-action-button {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 40px;
  min-height: 40px;
  padding: 0 14px;
  border-radius: 9px;
  font-weight: 700;
  white-space: nowrap;
  box-shadow: 0 3px 9px rgba(15, 23, 42, 0.06);
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}

.file-action-button svg {
  width: 16px;
  height: 16px;
  fill: currentColor;
  flex: 0 0 auto;
}

.file-action-button:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 7px 15px rgba(15, 23, 42, 0.10);
}

.file-action-button:active:not(:disabled) {
  transform: translateY(0);
  box-shadow: 0 2px 6px rgba(15, 23, 42, 0.08);
}

.file-action-button:disabled {
  cursor: wait;
  opacity: 0.65;
}

.file-action-clear {
  color: #334155;
  background: linear-gradient(145deg, #ffffff, #f8fafc);
  border: 1px solid #cbd5e1;
}

.file-action-excel {
  color: #15803d;
  background: linear-gradient(145deg, #f0fdf4, #dcfce7);
  border: 1px solid #86efac;
}

.file-action-pdf {
  color: #b91c1c;
  background: linear-gradient(145deg, #fef2f2, #fee2e2);
  border: 1px solid #fca5a5;
}

.file-action-clear:hover:not(:disabled) { border-color: #94a3b8; }
.file-action-excel:hover:not(:disabled) { border-color: #22c55e; }
.file-action-pdf:hover:not(:disabled) { border-color: #f87171; }

@media (max-width: 620px) {
  .action-row .file-action-button {
    width: 100%;
    justify-content: center;
  }
}

.mini-button {
  padding: 8px 10px;
  border-radius: 11px;
  border: 1px solid var(--line);
  color: var(--text);
  background: var(--surface);
}

.mini-button.danger { color: var(--danger); }
.mini-button.success {
  color: var(--success-dark);
  background: #dcfce7;
  border-color: #bbf7d0;
}

.hidden { display: none !important; }

@media (max-width: 1180px) {
  .metrics, .charts, .report-grid, .user-access-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .filters {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 880px) {
  .app-shell {
    grid-template-columns: 1fr;
  }
  .sidebar {
    position: fixed;
    transform: translateX(-105%);
    transition: 0.24s ease;
    width: 280px;
  }
  .sidebar.open { transform: translateX(0); }
  .mobile-menu { display: inline-flex; }
  .topbar {
    align-items: flex-start;
  }
  .dashboard-layout, .two-col, .three-col {
    grid-template-columns: 1fr;
  }
  .filters {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .checkbox-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 620px) {
  .content {
    padding: 14px;
  }
  .topbar {
    flex-direction: column;
  }
  .top-actions {
    width: 100%;
    justify-content: stretch;
  }
  .top-actions > * {
    flex: 1;
    justify-content: center;
  }
  .metrics, .filters, .report-grid, .checkbox-grid, .user-access-grid {
    grid-template-columns: 1fr;
  }
  .metric-card {
    min-height: 112px;
  }
  .drawer-actions {
    flex-direction: column;
  }
}

/* Modern chat and notification controls */
.top-actions {
  align-items: center;
}

.top-icon-action {
  position: relative;
  display: inline-grid;
  width: 46px;
  height: 46px;
  min-width: 46px;
  min-height: 46px;
  place-items: center;
  border-radius: 12px;
  border: 1px solid transparent;
  color: #ffffff;
  cursor: pointer;
  transition: transform 0.18s ease, box-shadow 0.18s ease, filter 0.18s ease;
}

.top-icon-action svg {
  width: 20px;
  height: 20px;
  fill: currentColor;
}

.top-icon-action:hover {
  transform: translateY(-2px);
  filter: saturate(1.08);
}

.top-icon-chat {
  background: linear-gradient(135deg, #8b5cf6, #6d28d9);
  border-color: #c4b5fd;
  box-shadow: 0 5px 14px rgba(109, 40, 217, 0.22);
}

.top-icon-notify {
  background: linear-gradient(135deg, #fbbf24, #f59e0b);
  border-color: #fcd34d;
  box-shadow: 0 5px 14px rgba(245, 158, 11, 0.22);
}

.top-action-badge {
  position: absolute;
  top: -6px;
  right: -6px;
  display: inline-grid;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  place-items: center;
  border: 2px solid #ffffff;
  border-radius: 999px;
  background: #f43f5e;
  color: #ffffff;
  font-size: 10px;
  font-weight: 900;
  line-height: 1;
}

.modern-drawer-head {
  background: linear-gradient(135deg, #ffffff, #f8fbff);
}

.drawer-eyebrow {
  display: block;
  margin-bottom: 4px;
  color: #2563eb;
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.drawer-head-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.drawer-close {
  min-width: 42px;
  min-height: 42px;
}

.notification-drawer-body {
  gap: 16px;
  background: #f8fbff;
}

.notification-tabs {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 4px;
}

.notification-tab {
  flex: 0 0 auto;
  padding: 9px 12px;
  border: 1px solid #d7e3f1;
  border-radius: 999px;
  background: #ffffff;
  color: #475569;
  font-size: 12px;
  font-weight: 850;
  cursor: pointer;
}

.notification-tab.active {
  color: #1d4ed8;
  background: #eaf2ff;
  border-color: #93c5fd;
}

.notification-list,
.notification-group {
  display: grid;
  gap: 10px;
}

.notification-group h4 {
  margin: 4px 0 0;
  color: #64748b;
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.notification-card {
  display: grid;
  grid-template-columns: 40px minmax(0, 1fr) auto;
  gap: 12px;
  align-items: start;
  padding: 13px;
  border: 1px solid #d7e3f1;
  border-left: 4px solid #3b82f6;
  border-radius: 14px;
  background: #ffffff;
  box-shadow: 0 7px 18px rgba(15, 23, 42, 0.05);
}

.notification-card.is-unread {
  background: linear-gradient(135deg, #eff6ff, #f5f3ff);
}

.notification-icon {
  display: grid;
  width: 36px;
  height: 36px;
  place-items: center;
  border-radius: 10px;
  color: #2563eb;
  background: #dbeafe;
}

.notification-icon svg {
  width: 18px;
  height: 18px;
  fill: currentColor;
}

.notification-title-line {
  display: flex;
  align-items: center;
  gap: 8px;
}

.notification-title-line strong {
  color: #0f172a;
  font-size: 14px;
}

.notification-content p {
  margin: 4px 0 8px;
  color: #475569;
  font-size: 13px;
  line-height: 1.35;
}

.notification-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  color: #64748b;
  font-size: 11px;
  font-weight: 750;
}

.notification-meta span,
.notification-meta time {
  padding: 3px 7px;
  border-radius: 999px;
  background: #f1f5f9;
}

.notification-actions {
  display: flex;
  gap: 6px;
  align-items: center;
}

.unread-dot {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: #2563eb;
}

.modern-chat-body {
  grid-template-columns: 280px minmax(0, 1fr);
  grid-template-rows: minmax(0, 1fr);
  height: calc(100vh - 82px);
  padding: 0;
  gap: 0;
  background: #f8fbff;
}

.team-chat-panel {
  width: min(980px, 100%);
}

.chat-sidebar {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 12px;
  padding: 16px;
  border-right: 1px solid #d7e3f1;
  background: linear-gradient(180deg, #ffffff, #f4f8ff);
}

.chat-search-wrap input {
  width: 100%;
  min-height: 42px;
  border: 1px solid #d7e3f1;
  border-radius: 12px;
  background: #ffffff;
}

.chat-conversation-list {
  display: grid;
  align-content: start;
  gap: 9px;
  overflow: auto;
}

.chat-conversation-item {
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  width: 100%;
  padding: 10px;
  border: 1px solid transparent;
  border-radius: 14px;
  background: transparent;
  color: #0f172a;
  text-align: left;
  cursor: pointer;
}

.chat-conversation-item.active,
.chat-conversation-item:hover {
  border-color: #c7d2fe;
  background: #eef2ff;
}

.chat-avatar {
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  border-radius: 12px;
  color: #3730a3;
  background: linear-gradient(135deg, #ddd6fe, #bfdbfe);
  font-size: 12px;
  font-weight: 900;
}

.chat-conversation-copy {
  min-width: 0;
}

.chat-conversation-copy strong,
.chat-conversation-copy small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chat-conversation-copy small,
.chat-conversation-meta {
  color: #64748b;
  font-size: 11px;
}

.chat-conversation-meta {
  display: grid;
  justify-items: end;
  gap: 4px;
}

.chat-conversation-meta em {
  min-width: 18px;
  padding: 2px 5px;
  border-radius: 999px;
  background: #f43f5e;
  color: #ffffff;
  font-style: normal;
  font-size: 10px;
  font-weight: 900;
}

.chat-conversation-panel {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  min-width: 0;
}

.chat-conversation-head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px;
  border-bottom: 1px solid #d7e3f1;
  background: #ffffff;
}

.chat-conversation-head h4,
.chat-conversation-head p {
  margin: 0;
}

.chat-conversation-head p {
  margin-top: 3px;
  color: #64748b;
  font-size: 12px;
}

.modern-chat-body .chat-messages {
  padding: 18px;
}

.chat-date-separator {
  justify-self: center;
  padding: 5px 10px;
  border-radius: 999px;
  background: #e2e8f0;
  color: #475569;
  font-size: 11px;
  font-weight: 850;
}

.modern-chat-body .chat-message {
  border-color: #d7e3f1;
  background: #ffffff;
  box-shadow: 0 7px 18px rgba(15, 23, 42, 0.05);
}

.modern-chat-body .chat-message.own {
  background: linear-gradient(135deg, #4f46e5, #0891b2);
}

.modern-chat-body .chat-compose {
  margin: 0;
  border-width: 1px 0 0;
  border-radius: 0;
  background: #ffffff;
  box-shadow: none;
}

.chat-composer-line {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) auto;
  gap: 10px;
  align-items: end;
}

.chat-tool-button {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border: 1px solid #c7d2fe;
  border-radius: 12px;
  color: #4f46e5;
  background: #eef2ff;
  cursor: pointer;
}

.chat-tool-button svg,
.chat-send-button svg {
  width: 18px;
  height: 18px;
  fill: currentColor;
}

.chat-send-button {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 42px;
  white-space: nowrap;
}

@media (max-width: 820px) {
  .modern-chat-body {
    grid-template-columns: 1fr;
  }

  .chat-sidebar {
    max-height: 220px;
    border-right: 0;
    border-bottom: 1px solid #d7e3f1;
  }

  .notification-card {
    grid-template-columns: 34px minmax(0, 1fr);
  }

  .notification-actions {
    grid-column: 2;
    justify-content: flex-start;
  }
}

@media (max-width: 620px) {
  .dashboard-topbar .top-icon-action {
    width: 100%;
  }

  .chat-composer-line {
    grid-template-columns: 42px minmax(0, 1fr);
  }

  .chat-send-button {
    grid-column: 1 / -1;
    justify-content: center;
  }
}

/* Premium CA Office Theme Refresh */
body.theme-professional,
body.theme-colourful {
  --bg: #f4f7fb;
  --surface: #ffffff;
  --surface-2: #f8fbff;
  --text: #132238;
  --muted: #64748b;
  --line: #dce7f3;
  --primary: #2563eb;
  --primary-2: #0f766e;
  --success: #16a34a;
  --success-dark: #166534;
  --danger: #dc2626;
  --warning: #d97706;
  --blue: #2563eb;
  --purple: #7c3aed;
  --yellow: #f59e0b;
  --shadow: 0 18px 45px rgba(15, 23, 42, 0.08);
}

body {
  background:
    radial-gradient(circle at 8% 4%, rgba(37, 99, 235, 0.08), transparent 28%),
    radial-gradient(circle at 95% 2%, rgba(15, 118, 110, 0.08), transparent 26%),
    #f4f7fb;
}

.app-shell {
  background: transparent;
}

.content {
  padding: 24px;
}

.sidebar {
  background: linear-gradient(180deg, #ffffff 0%, #f8fbff 100%);
  border-right: 1px solid #dce7f3;
  box-shadow: 12px 0 34px rgba(37, 99, 235, 0.06);
}

.brand {
  border-bottom: 1px solid #e5eef8;
}

.brand-mark {
  color: #fff;
  background: linear-gradient(135deg, #2563eb, #0f766e);
  box-shadow: 0 12px 26px rgba(37, 99, 235, 0.22);
}

.brand h1 {
  color: #102a43;
}

.nav {
  gap: 7px;
}

.nav button {
  min-height: 44px;
  border-radius: 12px;
  color: #334155;
  background: transparent;
  border: 1px solid transparent;
  font-size: 14px;
}

.nav button:hover {
  background: #f0f7ff;
  color: #1d4ed8;
  transform: translateX(2px);
}

.nav button.active {
  color: #1d4ed8;
  background: linear-gradient(90deg, #e8f2ff, #ffffff);
  border-color: #cfe3ff;
  box-shadow: inset 4px 0 0 #2563eb, 0 8px 18px rgba(37, 99, 235, 0.08);
}

.nav button > span:first-child,
.nav button:not(:has(span)) {
  line-height: 1;
}

.role-card,
.current-user-card {
  background: linear-gradient(180deg, #f8fbff, #eef6ff);
  border: 1px solid #d7e8fb;
  box-shadow: 0 10px 24px rgba(37, 99, 235, 0.06);
}

.topbar {
  padding: 16px 18px;
  margin-bottom: 18px;
  background: rgba(255, 255, 255, 0.86);
  backdrop-filter: blur(12px);
  border: 1px solid #e2eaf4;
  border-radius: 22px;
  box-shadow: 0 14px 34px rgba(15, 23, 42, 0.06);
}

.topbar h2 {
  color: #102a43;
  letter-spacing: -0.035em;
}

.top-actions {
  gap: 9px;
}

.icon-button,
.primary-button,
.secondary-button,
.danger-button,
.top-action-button,
.mini-button {
  border-radius: 12px;
  transition: transform 0.18s ease, box-shadow 0.18s ease, filter 0.18s ease, background 0.18s ease;
}

.icon-button:hover,
.primary-button:hover,
.secondary-button:hover,
.danger-button:hover,
.top-action-button:hover,
.mini-button:hover {
  transform: translateY(-1px);
  filter: brightness(1.02);
}

.primary-button,
.top-action-add {
  background: linear-gradient(135deg, #2563eb, #1d4ed8);
  box-shadow: 0 12px 24px rgba(37, 99, 235, 0.22);
}

.secondary-button {
  color: #1d4ed8;
  background: #eef6ff;
  border: 1px solid #cfe3ff;
}

.danger-button,
.mini-button.danger {
  color: #fff;
  background: linear-gradient(135deg, #dc2626, #b91c1c);
  border-color: transparent;
}

.mini-button {
  font-weight: 700;
  background: #ffffff;
  border-color: #dce7f3;
  box-shadow: 0 6px 14px rgba(15, 23, 42, 0.05);
}

.mini-button.success {
  color: #065f46;
  background: linear-gradient(135deg, #dcfce7, #bbf7d0);
  border-color: #a7f3d0;
}

#chatButton {
  background: linear-gradient(135deg, #2563eb, #7c3aed);
}

#notifyButton {
  background: linear-gradient(135deg, #f59e0b, #ea580c);
}

.top-action-sample {
  background: linear-gradient(135deg, #475569, #334155);
}

.top-action-import {
  background: linear-gradient(135deg, #0f766e, #14b8a6);
}

.top-action-export {
  background: linear-gradient(135deg, #f59e0b, #facc15);
  color: #422006;
}

.top-action-logout {
  background: linear-gradient(135deg, #64748b, #334155);
}

.panel,
.drawer,
.notification-panel,
.login-card {
  border: 1px solid #e2eaf4;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(248, 251, 255, 0.96));
  box-shadow: var(--shadow);
}

.panel {
  border-radius: 22px;
}

.panel h3 {
  color: #102a43;
  letter-spacing: -0.02em;
}

.metrics {
  gap: 16px;
}

.metric-card {
  border-radius: 22px;
  min-height: 128px;
  box-shadow: 0 18px 36px rgba(15, 23, 42, 0.11);
  border: 1px solid rgba(255, 255, 255, 0.36);
  overflow: hidden;
  position: relative;
}

.metric-card::after {
  content: "";
  position: absolute;
  right: -24px;
  top: -24px;
  width: 92px;
  height: 92px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.18);
}

.metric-card span {
  font-weight: 700;
  letter-spacing: 0.01em;
}

.metric-card strong {
  font-size: 34px;
  letter-spacing: -0.05em;
}

.grad-blue { background: linear-gradient(135deg, #2563eb, #1d4ed8); }
.grad-red { background: linear-gradient(135deg, #ef4444, #b91c1c); }
.grad-yellow { background: linear-gradient(135deg, #f59e0b, #d97706); }
.grad-purple { background: linear-gradient(135deg, #7c3aed, #5b21b6); }
.grad-green { background: linear-gradient(135deg, #16a34a, #047857); }
.grad-darkgreen { background: linear-gradient(135deg, #065f46, #047857); }
.grad-slate { background: linear-gradient(135deg, #475569, #1e293b); }
.grad-pink { background: linear-gradient(135deg, #db2777, #be123c); }

.filters,
.two-col,
.three-col {
  gap: 14px;
}

.field label {
  color: #334155;
  font-weight: 800;
  font-size: 12px;
}

input,
select,
textarea {
  border-radius: 12px;
  border: 1px solid #d7e3f0;
  background: #ffffff;
  color: #132238;
  transition: border-color 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
}

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: #2563eb;
  box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.1);
}

textarea {
  min-height: 96px;
}

.table-wrap {
  border-radius: 18px;
  border: 1px solid #dce7f3;
  box-shadow: 0 12px 28px rgba(15, 23, 42, 0.05);
}

.file-table {
  border-collapse: separate;
  border-spacing: 0;
}

.file-table th {
  background: linear-gradient(180deg, #f1f6fd, #eaf2fb);
  color: #334155;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.file-table td {
  border-bottom: 1px solid #edf2f7;
  vertical-align: middle;
}

.file-table tbody tr:nth-child(even) {
  background: #fbfdff;
}

.file-table tbody tr:hover {
  background: #eef6ff;
}

.client-name {
  color: #102a43;
  font-weight: 800;
}

.badge {
  border-radius: 999px;
  font-weight: 800;
  padding: 5px 9px;
  letter-spacing: 0.01em;
}

.badge.pending,
.badge.overdue {
  background: #fee2e2;
  color: #991b1b;
}

.badge.progress {
  background: #dbeafe;
  color: #1e40af;
}

.badge.approval {
  background: #fef3c7;
  color: #92400e;
}

.badge.report {
  background: #ede9fe;
  color: #5b21b6;
}

.badge.filed {
  background: #dcfce7;
  color: #166534;
}

.badge.billed {
  background: #ccfbf1;
  color: #115e59;
}

.drawer-head {
  background: linear-gradient(135deg, #f8fbff, #eef6ff);
  border-bottom: 1px solid #dce7f3;
}

.drawer-actions {
  background: #ffffff;
  border-top: 1px solid #e2eaf4;
}

.checkbox-grid {
  gap: 10px;
}

.check-pill {
  border-radius: 999px;
  border: 1px solid #d7e3f0;
  background: #ffffff;
  box-shadow: 0 6px 14px rgba(15, 23, 42, 0.04);
}

.check-pill:has(input:checked) {
  color: #1d4ed8;
  background: #eef6ff;
  border-color: #bfdbfe;
}

.alert-card,
.user-card,
.invite-card,
.attachment-card,
.user-access-card,
.chat-message {
  border-color: #dce7f3;
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.05);
}

.chat-message {
  border-radius: 18px;
}

.chat-message.own {
  background: linear-gradient(135deg, #eef6ff, #e0f2fe);
}

.report-card,
.user-access-card {
  border-radius: 18px;
}

.login-page {
  background:
    radial-gradient(circle at 10% 12%, rgba(37, 99, 235, 0.12), transparent 26%),
    radial-gradient(circle at 88% 14%, rgba(15, 118, 110, 0.12), transparent 26%),
    linear-gradient(135deg, #f8fbff, #eef6ff 52%, #ffffff);
}

@media (max-width: 880px) {
  .content {
    padding: 18px;
  }

  .topbar,
  .panel {
    border-radius: 18px;
  }
}

@media (max-width: 620px) {
  .content {
    padding: 12px;
  }

  .top-actions > * {
    min-width: 0;
    font-size: 12px;
    padding-left: 10px;
    padding-right: 10px;
  }

  .metric-card strong {
    font-size: 28px;
  }
}

/* Stunning SaaS Theme v2 - premium accounting dashboard */
body.theme-professional,
body.theme-colourful {
  --bg: #eef3fb;
  --surface: rgba(255, 255, 255, 0.94);
  --surface-2: #f8fbff;
  --text: #101828;
  --muted: #667085;
  --line: #d9e4f2;
  --primary: #1e40af;
  --primary-2: #0ea5e9;
  --danger: #ef4444;
  --warning: #f59e0b;
  --success: #10b981;
  --success-dark: #047857;
  --purple: #7c3aed;
  --yellow: #f59e0b;
  --blue: #0ea5e9;
  --shadow: 0 24px 70px rgba(15, 23, 42, 0.10);
  --radius: 24px;
}

body {
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 14px;
  line-height: 1.5;
  background:
    radial-gradient(circle at 8% -4%, rgba(30, 64, 175, 0.16), transparent 30%),
    radial-gradient(circle at 88% 0%, rgba(14, 165, 233, 0.14), transparent 28%),
    radial-gradient(circle at 80% 92%, rgba(16, 185, 129, 0.12), transparent 32%),
    linear-gradient(135deg, #f6f9ff 0%, #eef3fb 42%, #f9fbff 100%);
}

::selection {
  color: #fff;
  background: #1e40af;
}

.app-shell {
  grid-template-columns: 292px minmax(0, 1fr);
}

.content {
  padding: 26px;
  min-width: 0;
}

/* Sidebar - high-end business app style */
.sidebar {
  padding: 22px 16px;
  background:
    radial-gradient(circle at 16% 0%, rgba(59, 130, 246, 0.30), transparent 28%),
    radial-gradient(circle at 92% 18%, rgba(16, 185, 129, 0.18), transparent 22%),
    linear-gradient(180deg, #07111f 0%, #0f172a 52%, #111827 100%);
  color: #e5edf8;
  border-right: 1px solid rgba(148, 163, 184, 0.18);
  box-shadow: 16px 0 50px rgba(15, 23, 42, 0.20);
}

.brand {
  margin-bottom: 20px;
  padding: 12px 10px 18px;
  border-bottom: 1px solid rgba(226, 232, 240, 0.12);
}

.brand-text-only h1 {
  margin: 0;
  color: #ffffff;
  font-size: 22px;
  line-height: 1.15;
  letter-spacing: -0.045em;
  font-weight: 900;
}

.brand-text-only p {
  margin: 5px 0 0;
  color: #93c5fd;
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.02em;
}

.brand-text-only .brand-byline {
  margin-top: 4px;
  color: rgba(226, 232, 240, 0.78);
  font-size: 12px;
  font-weight: 400;
}

.brand-text-only .brand-firm {
  margin-top: 14px;
  color: #bfdbfe;
  font-size: 16px;
  font-weight: 800;
  line-height: 1.2;
}

.brand-text-only .brand-place {
  margin-top: 4px;
  color: #93c5fd;
  font-size: 13px;
  font-weight: 800;
}

.brand-mark {
  width: 52px;
  height: 52px;
  border-radius: 18px;
  color: #fff;
  font-size: 21px;
  font-weight: 900;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.22), transparent),
    linear-gradient(135deg, #2563eb, #0ea5e9 48%, #10b981);
  box-shadow: 0 18px 32px rgba(37, 99, 235, 0.35);
}

.brand h1 {
  color: #ffffff;
  font-size: 18px;
  letter-spacing: -0.035em;
}

.brand p,
.brand .brand-company-address,
.sidebar .small-muted {
  color: rgba(226, 232, 240, 0.70);
}

.brand .brand-company-name {
  color: #93c5fd;
}

.nav {
  gap: 8px;
}

.nav button {
  min-height: 46px;
  padding: 12px 14px;
  border-radius: 15px;
  color: rgba(226, 232, 240, 0.82);
  background: transparent;
  border: 1px solid transparent;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.nav .nav-icon {
  width: 24px;
  height: 24px;
  display: inline-grid;
  place-items: center;
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.08);
  color: #bfdbfe;
}

.nav button:hover {
  transform: translateX(3px);
  color: #fff;
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.10);
}

.nav button.active {
  color: #fff;
  background:
    linear-gradient(135deg, rgba(37, 99, 235, 0.95), rgba(14, 165, 233, 0.75)),
    rgba(255, 255, 255, 0.12);
  border-color: rgba(147, 197, 253, 0.42);
  box-shadow: 0 16px 34px rgba(37, 99, 235, 0.26), inset 0 1px 0 rgba(255, 255, 255, 0.18);
}

.nav button.active .nav-icon {
  background: rgba(255, 255, 255, 0.20);
  color: #fff;
}

.role-card,
.current-user-card {
  color: #e5edf8;
  border: 1px solid rgba(226, 232, 240, 0.13);
  background: rgba(255, 255, 255, 0.07);
  backdrop-filter: blur(14px);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08), 0 16px 28px rgba(0, 0, 0, 0.15);
}

.current-user-card span {
  color: rgba(226, 232, 240, 0.62);
}

.current-user-card strong {
  color: #ffffff;
}

/* Topbar */
.topbar {
  margin-bottom: 22px;
  padding: 18px 20px;
  border-radius: 26px;
  border: 1px solid rgba(226, 232, 240, 0.78);
  background: rgba(255, 255, 255, 0.78);
  backdrop-filter: blur(20px);
  box-shadow: 0 22px 60px rgba(15, 23, 42, 0.08);
}

.topbar h2 {
  font-size: 28px;
  line-height: 1.15;
  color: #111827;
  letter-spacing: -0.055em;
}

#pageSubtitle {
  color: #64748b;
}

.top-actions {
  gap: 10px;
}

/* Buttons */
.icon-button,
.primary-button,
.secondary-button,
.danger-button,
.top-action-button,
.mini-button {
  border-radius: 14px;
  font-weight: 800;
  letter-spacing: -0.01em;
  transition: transform 0.18s ease, box-shadow 0.18s ease, filter 0.18s ease, border-color 0.18s ease;
}

.icon-button:hover,
.primary-button:hover,
.secondary-button:hover,
.danger-button:hover,
.top-action-button:hover,
.mini-button:hover {
  transform: translateY(-2px);
}

.primary-button,
.top-action-add {
  color: #fff;
  background: linear-gradient(135deg, #1e40af, #2563eb 55%, #0ea5e9);
  box-shadow: 0 16px 34px rgba(37, 99, 235, 0.25);
}

.secondary-button {
  color: #1e40af;
  background: linear-gradient(180deg, #ffffff, #eef6ff);
  border: 1px solid #cfe3ff;
}

.danger-button,
.mini-button.danger {
  color: #fff;
  background: linear-gradient(135deg, #ef4444, #b91c1c);
  border-color: transparent;
  box-shadow: 0 12px 24px rgba(239, 68, 68, 0.22);
}

.mini-button {
  padding: 8px 12px;
  border: 1px solid #d9e4f2;
  background: linear-gradient(180deg, #ffffff, #f8fbff);
  box-shadow: 0 10px 18px rgba(15, 23, 42, 0.06);
}

.mini-button.success {
  color: #065f46;
  background: linear-gradient(135deg, #d1fae5, #a7f3d0);
  border-color: #99f6e4;
}

.action-row {
  gap: 5px;
}

.mini-button {
  padding: 5px 8px;
  border-radius: 8px;
  font-size: 11px;
  line-height: 1.15;
  box-shadow: 0 6px 12px rgba(15, 23, 42, 0.05);
}

#chatButton {
  background: linear-gradient(135deg, #1e40af, #7c3aed);
  box-shadow: 0 14px 28px rgba(124, 58, 237, 0.22);
}

#notifyButton {
  background: linear-gradient(135deg, #f59e0b, #f97316);
  box-shadow: 0 14px 28px rgba(245, 158, 11, 0.24);
}

.top-action-sample { background: linear-gradient(135deg, #334155, #64748b); }
.top-action-import { background: linear-gradient(135deg, #0f766e, #14b8a6); }
.top-action-export { background: linear-gradient(135deg, #f59e0b, #fde047); color: #422006; }
.top-action-logout { background: linear-gradient(135deg, #475569, #111827); }

/* Premium panels and cards */
.panel,
.drawer,
.notification-panel,
.login-card,
.table-wrap,
.alert-card,
.user-card,
.invite-card,
.attachment-card,
.user-access-card {
  border: 1px solid rgba(217, 228, 242, 0.92);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(248, 251, 255, 0.94));
  box-shadow: 0 22px 58px rgba(15, 23, 42, 0.08);
}

.panel {
  border-radius: 28px;
  padding: 20px;
}

.panel h3 {
  color: #0f172a;
  font-size: 18px;
  letter-spacing: -0.035em;
}

.dashboard-layout {
  gap: 18px;
}

.charts {
  gap: 18px;
}

/* Dashboard cards */
.metrics {
  gap: 18px;
}

.metric-card {
  min-height: 142px;
  padding: 20px;
  border-radius: 28px;
  color: #fff;
  box-shadow: 0 24px 52px rgba(15, 23, 42, 0.16);
  border: 1px solid rgba(255, 255, 255, 0.24);
  overflow: hidden;
  position: relative;
}

.metric-card::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.20), transparent 42%),
    radial-gradient(circle at 88% 18%, rgba(255, 255, 255, 0.28), transparent 22%);
  pointer-events: none;
}

.metric-card::after {
  width: 108px;
  height: 108px;
  right: -30px;
  top: -28px;
  background: rgba(255, 255, 255, 0.16);
}

.metric-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 30px 64px rgba(15, 23, 42, 0.20);
}

.metric-card span,
.metric-card strong,
.metric-card p {
  position: relative;
  z-index: 1;
}

.metric-card span {
  font-size: 13px;
  opacity: 0.92;
}

.metric-card strong {
  font-size: 38px;
  letter-spacing: -0.06em;
}

.metric-card p {
  opacity: 0.82;
}

.grad-blue { background: linear-gradient(135deg, #1e40af, #2563eb 56%, #0ea5e9); }
.grad-red { background: linear-gradient(135deg, #991b1b, #ef4444); }
.grad-yellow { background: linear-gradient(135deg, #b45309, #f59e0b); }
.grad-purple { background: linear-gradient(135deg, #5b21b6, #7c3aed 58%, #a855f7); }
.grad-green { background: linear-gradient(135deg, #047857, #10b981); }
.grad-darkgreen { background: linear-gradient(135deg, #064e3b, #047857 55%, #0f766e); }
.grad-slate { background: linear-gradient(135deg, #0f172a, #334155); }
.grad-pink { background: linear-gradient(135deg, #9f1239, #db2777); }

/* Forms */
.filters,
.two-col,
.three-col {
  gap: 16px;
}

.field label {
  margin-bottom: 7px;
  color: #344054;
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0.02em;
}

input,
select,
textarea {
  min-height: 42px;
  border: 1px solid #d6e2f0;
  border-radius: 14px;
  background: #ffffff;
  color: #101828;
  box-shadow: inset 0 1px 0 rgba(16, 24, 40, 0.02);
}

input:hover,
select:hover,
textarea:hover {
  border-color: #b9cce2;
}

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: #2563eb;
  box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.10), inset 0 1px 0 rgba(16, 24, 40, 0.02);
}

textarea {
  min-height: 102px;
}

.password-wrap {
  border-radius: 14px;
}

/* Tables */
.table-wrap {
  border-radius: 24px;
  overflow: auto;
}

.file-table {
  border-collapse: separate;
  border-spacing: 0;
}

.file-table th {
  background: linear-gradient(180deg, #f8fbff, #eef4fb);
  color: #475467;
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  white-space: nowrap;
}

.file-table td {
  border-bottom: 1px solid #eef2f7;
  color: #24364b;
}

.file-table tbody tr:nth-child(even) {
  background: rgba(248, 251, 255, 0.70);
}

.file-table tbody tr:hover {
  background: #eef6ff;
}

.client-name {
  color: #0f172a;
  font-weight: 900;
}

.subtext {
  color: #667085;
}

/* Badges and statuses */
.badge {
  border-radius: 999px;
  padding: 5px 10px;
  font-size: 11px;
  font-weight: 900;
  border: 1px solid transparent;
}

.badge.pending { background: #fff7ed; color: #c2410c; border-color: #fed7aa; }
.badge.overdue { background: #fef2f2; color: #b91c1c; border-color: #fecaca; }
.badge.progress { background: #eff6ff; color: #1d4ed8; border-color: #bfdbfe; }
.badge.approval { background: #fffbeb; color: #b45309; border-color: #fde68a; }
.badge.report { background: #f5f3ff; color: #6d28d9; border-color: #ddd6fe; }
.badge.filed { background: #ecfdf5; color: #047857; border-color: #a7f3d0; }
.badge.billed { background: #ecfeff; color: #0e7490; border-color: #a5f3fc; }

.priority-low { background: #ecfdf5; color: #047857; }
.priority-medium { background: #eff6ff; color: #1d4ed8; }
.priority-high { background: #fff7ed; color: #c2410c; }
.priority-urgent { background: #fef2f2; color: #b91c1c; }

/* Drawer / modal polish */
.drawer,
.notification-panel {
  border-radius: 28px 0 0 28px;
}

.drawer-head {
  padding: 18px 20px;
  background:
    radial-gradient(circle at 10% 0%, rgba(37, 99, 235, 0.12), transparent 34%),
    linear-gradient(135deg, #ffffff, #eef6ff);
  border-bottom: 1px solid #d9e4f2;
}

.drawer-head h3 {
  letter-spacing: -0.035em;
}

.drawer-body {
  padding: 20px;
}

.drawer-actions {
  padding: 16px 20px;
  background: rgba(255, 255, 255, 0.92);
  border-top: 1px solid #e4edf7;
}

.checkbox-grid {
  gap: 10px;
}

.check-pill {
  padding: 10px 12px;
  border-radius: 999px;
  border: 1px solid #d9e4f2;
  background: #ffffff;
  box-shadow: 0 8px 16px rgba(15, 23, 42, 0.04);
}

.check-pill:has(input:checked) {
  color: #1d4ed8;
  background: linear-gradient(180deg, #eef6ff, #ffffff);
  border-color: #bfdbfe;
}

/* Chat / notifications */
.alert-card {
  border-radius: 20px;
}

.chat-message {
  border-radius: 20px;
  background: #ffffff;
}

.chat-message.own {
  background: linear-gradient(135deg, #eef6ff, #e0f2fe);
}

.chat-compose {
  border-radius: 22px;
  background: #f8fbff;
  border: 1px solid #d9e4f2;
}

/* Login - impressive but trustworthy */
.login-page {
  background:
    radial-gradient(circle at 14% 12%, rgba(37, 99, 235, 0.24), transparent 28%),
    radial-gradient(circle at 84% 14%, rgba(16, 185, 129, 0.18), transparent 25%),
    radial-gradient(circle at 52% 90%, rgba(124, 58, 237, 0.12), transparent 30%),
    linear-gradient(135deg, #f8fbff 0%, #eef6ff 48%, #ffffff 100%);
}

.login-card {
  width: min(400px, 100%);
  padding: 30px;
  border-radius: 28px;
  border: 1px solid rgba(255, 255, 255, 0.86);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(248, 251, 255, 0.92));
  backdrop-filter: blur(18px);
  box-shadow: 0 30px 80px rgba(30, 64, 175, 0.16);
}

.login-card::before {
  height: 6px;
  background: linear-gradient(90deg, #1e40af, #0ea5e9, #10b981, #f59e0b);
}

.login-card h1 {
  font-size: 29px;
}

.login-card .brand-mark {
  width: 54px;
  height: 54px;
  border-radius: 18px;
}

/* Reports/User management polish */
.report-card,
.user-access-card,
.user-card,
.invite-card {
  border-radius: 22px;
}

.report-card-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.report-export-card {
  min-height: 142px;
  padding: 20px;
  border-radius: 28px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.report-export-card strong {
  margin: 8px 0 2px;
}

.report-export-card p {
  margin-bottom: 10px;
}

.report-card-actions {
  margin-top: auto;
}

.report-card-grid .report-export-card {
  min-height: 76px;
  height: 76px;
  padding: 10px 12px;
  border-radius: 18px;
  overflow: hidden;
}

.report-card-grid .report-export-card p {
  display: none;
}

.report-card-grid .report-export-card strong {
  font-size: 22px;
  margin: 4px 0 0;
}

.report-card-grid .report-card-actions {
  margin-top: 6px;
  gap: 6px;
}

.report-card-grid .report-card-actions button {
  padding: 5px 8px;
  border-radius: 9px;
  font-size: 11px;
}

.staff-performance-metrics {
  gap: 12px;
}

.staff-performance-metrics .metric-card {
  min-height: 76px;
  padding: 12px 14px;
  border-radius: 18px;
}

.staff-performance-metrics .metric-card span {
  font-size: 11px;
  padding: 4px 7px;
}

.staff-performance-metrics .metric-card strong {
  font-size: 22px;
  margin: 6px 0 1px;
}

.staff-performance-metrics .metric-card p {
  font-size: 11px;
  line-height: 1.25;
}

.staff-performance-metrics .metric-card::after {
  width: 62px;
  height: 62px;
  right: -18px;
  top: -18px;
}

.metrics .metric-card,
.report-card-grid .metric-card {
  min-height: 76px;
  padding: 12px 14px;
  border-radius: 18px;
}

.metrics .metric-card span,
.report-card-grid .metric-card span {
  font-size: 11px;
  padding: 4px 7px;
}

.metrics .metric-card strong,
.report-card-grid .metric-card strong {
  font-size: 22px;
  margin: 6px 0 1px;
}

.metrics .metric-card p,
.report-card-grid .metric-card p {
  font-size: 11px;
  line-height: 1.25;
}

.metrics .metric-card::after,
.report-card-grid .metric-card::after {
  width: 62px;
  height: 62px;
  right: -18px;
  top: -18px;
}

.report-export-card {
  min-height: 76px;
  padding: 12px 14px;
}

.charts .panel {
  background:
    radial-gradient(circle at 100% 0%, rgba(37, 99, 235, 0.08), transparent 26%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(248, 251, 255, 0.95));
  border-radius: 24px;
  padding: 18px;
}

.charts .panel h3 {
  display: flex;
  align-items: center;
  gap: 9px;
  margin-bottom: 16px;
  font-size: 15px;
  font-weight: 900;
}

.charts .panel h3::before {
  content: "";
  width: 10px;
  height: 26px;
  border-radius: 999px;
  background: linear-gradient(180deg, #2563eb, #0ea5e9);
  box-shadow: 0 8px 16px rgba(37, 99, 235, 0.22);
}

.bar-row {
  grid-template-columns: minmax(92px, 0.95fr) minmax(120px, 1.2fr) 36px;
  gap: 10px;
  margin: 8px 0;
  padding: 10px;
  border: 1px solid #e2eaf4;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.72);
  box-shadow: 0 8px 18px rgba(15, 23, 42, 0.045);
}

.bar-link:hover {
  background: #eef6ff;
  transform: translateY(-1px);
  box-shadow: 0 12px 22px rgba(37, 99, 235, 0.08);
}

.bar-row span {
  color: #24364b;
  font-weight: 800;
  font-size: 12px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.bar-row strong {
  width: 30px;
  height: 30px;
  display: inline-grid;
  place-items: center;
  justify-self: end;
  border-radius: 10px;
  color: #1e40af;
  background: #eef6ff;
  font-size: 13px;
}

.bar-track {
  height: 9px;
  background: #e9f0f8;
  box-shadow: inset 0 1px 2px rgba(15, 23, 42, 0.05);
}

.bar-fill {
  background: linear-gradient(90deg, #2563eb, #0ea5e9);
  box-shadow: 0 0 18px rgba(37, 99, 235, 0.28);
}

.bar-row[data-staff-kind="pending"] .bar-fill {
  background: linear-gradient(90deg, #ef4444, #f59e0b);
}

.bar-row[data-staff-kind="pending"] strong {
  color: #b91c1c;
  background: #fef2f2;
}

.bar-row[data-staff-kind="completed"] .bar-fill {
  background: linear-gradient(90deg, #047857, #10b981);
}

.bar-row[data-staff-kind="completed"] strong {
  color: #047857;
  background: #ecfdf5;
}

.bar-row[data-staff-kind="not-started"] .bar-fill {
  background: linear-gradient(90deg, #475569, #94a3b8);
}

.bar-row[data-staff-kind="not-started"] strong {
  color: #334155;
  background: #f1f5f9;
}

/* Lighter Search & Filter Theme */
.filters,
.colourful-filters {
  padding: 14px;
  border-radius: 20px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.88), rgba(247, 251, 255, 0.78));
  border: 1px solid #e8f0fa;
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.035);
}

.colourful-filters {
  background:
    linear-gradient(135deg, rgba(239, 246, 255, 0.86), rgba(248, 250, 252, 0.88));
}

.filters .field,
.colourful-filters .field {
  gap: 5px;
}

.filters .field label,
.colourful-filters .field label {
  color: #64748b;
  font-size: 11px;
  font-weight: 800;
}

.filters input,
.filters select,
.filters textarea,
.colourful-filters input,
.colourful-filters select,
.colourful-filters textarea {
  background: #fbfdff;
  border-color: #e3edf8;
  box-shadow: none;
}

.filters input:hover,
.filters select:hover,
.filters textarea:hover,
.colourful-filters input:hover,
.colourful-filters select:hover,
.colourful-filters textarea:hover {
  background: #ffffff;
  border-color: #cfe0f4;
}

.filter-hero {
  background:
    radial-gradient(circle at 8% 0%, rgba(37, 99, 235, 0.13), transparent 26%),
    radial-gradient(circle at 88% 16%, rgba(16, 185, 129, 0.12), transparent 26%),
    linear-gradient(135deg, #f8fbff, #eff6ff 55%, #f0fdfa);
  border: 1px solid #dcecff;
  color: #24364b;
  box-shadow: 0 8px 18px rgba(15, 23, 42, 0.025);
}

.filter-hero h3 {
  color: #1f2937;
}

.filter-hero span {
  background: #ffffff;
  color: #1d4ed8;
  border: 1px solid #cfe3ff;
}

.filters.colourful-filters {
  background:
    linear-gradient(135deg, rgba(239, 246, 255, 0.92), rgba(240, 253, 250, 0.78)),
    #ffffff;
  border-color: #dcecff;
  box-shadow: 0 10px 22px rgba(37, 99, 235, 0.045);
}

.checkbox-grid {
  grid-template-columns: repeat(4, minmax(120px, 1fr));
  gap: 8px;
}

.check-pill {
  min-height: 38px;
  padding: 8px 10px;
  border-radius: 9px;
  border: 1px solid #d9e4f2;
  background: #ffffff;
  color: #334155;
  box-shadow: none;
  font-size: 12px;
  font-weight: 700;
}

.check-pill input {
  width: 15px;
  height: 15px;
  min-height: 15px;
  accent-color: #2563eb;
}

.check-pill:has(input:checked) {
  color: #1d4ed8;
  background: #f4f9ff;
  border-color: #bfdbfe;
  box-shadow: inset 0 0 0 1px rgba(37, 99, 235, 0.05);
}

.check-pill:has(input:disabled) {
  opacity: 0.58;
}

.user-access-row {
  border-bottom-color: #e6eef8;
}

/* Team chat colour theme */
.team-chat-panel {
  background:
    radial-gradient(circle at 12% 0%, rgba(20, 184, 166, 0.16), transparent 30%),
    linear-gradient(180deg, #f0fdfa 0%, #f8fbff 46%, #ffffff 100%);
}

.team-chat-panel .drawer-head {
  background:
    radial-gradient(circle at 10% 0%, rgba(45, 212, 191, 0.22), transparent 34%),
    linear-gradient(135deg, #ecfeff, #f0fdfa 58%, #f8fafc);
  border-bottom-color: #bae6fd;
}

.team-chat-panel .drawer-head h3 {
  color: #0f766e;
}

.team-chat-body {
  background: transparent;
}

.chat-messages {
  padding: 6px 6px 10px 0;
}

.chat-message {
  color: #164e63;
  border-color: #a7f3d0;
  background: linear-gradient(180deg, #ecfeff, #f0fdfa);
  box-shadow: 0 12px 26px rgba(15, 118, 110, 0.10);
}

.chat-message.own {
  color: #ffffff;
  border-color: transparent;
  background: linear-gradient(135deg, #0f766e, #0891b2 58%, #1d4ed8);
  box-shadow: 0 16px 30px rgba(8, 145, 178, 0.20);
}

.chat-message .chat-meta strong {
  color: #0f766e;
}

.chat-message.own .chat-meta strong {
  color: #ffffff;
}

.chat-message .chat-meta span {
  color: #64748b;
}

.chat-message.own .chat-meta span {
  color: rgba(255, 255, 255, 0.78);
}

.chat-compose {
  padding: 14px;
  border: 1px solid #ccfbf1;
  border-radius: 22px;
  background: linear-gradient(180deg, rgba(240, 253, 250, 0.96), rgba(236, 254, 255, 0.92));
  box-shadow: 0 14px 32px rgba(15, 118, 110, 0.10);
}

.chat-compose textarea,
.chat-compose select {
  border-color: #99f6e4;
  background: #ffffff;
}

.chat-compose textarea:focus,
.chat-compose select:focus {
  border-color: #14b8a6;
  box-shadow: 0 0 0 4px rgba(20, 184, 166, 0.12);
}

.chat-attach-button {
  color: #0f766e;
  border-color: #99f6e4;
  background: linear-gradient(180deg, #ffffff, #ecfeff);
}

.chat-attachment-card {
  color: #0f766e;
  border-color: #99f6e4;
  background: rgba(255, 255, 255, 0.82);
}

.chat-message.own .chat-attachment-card {
  border-color: rgba(255, 255, 255, 0.36);
  background: rgba(255, 255, 255, 0.18);
}

.file-table-compact {
  border-spacing: 0 5px;
}

.file-table-compact th {
  padding: 8px 10px;
}

.file-table-compact td {
  padding: 7px 10px;
  line-height: 1.2;
}

.file-table-compact td:first-child {
  padding-left: 15px;
}

.file-table-compact .subtext {
  margin-top: 2px;
  font-size: 10px;
}

.client-details-cell {
  min-width: 180px;
  white-space: normal;
}

.client-details-cell .client-name,
.client-details-cell .subtext {
  display: block;
}

.client-details-cell .subtext {
  color: #64748b;
  font-size: 11px;
  font-weight: 600;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.file-table-compact .badge {
  padding: 3px 7px;
  font-size: 10px;
}

/* Responsive polish */
@media (max-width: 1180px) {
  .app-shell {
    grid-template-columns: 270px minmax(0, 1fr);
  }

  .report-card-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 880px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    width: 292px;
    box-shadow: 22px 0 60px rgba(15, 23, 42, 0.28);
  }

  .content {
    padding: 18px;
  }

  .topbar {
    border-radius: 22px;
  }
}

@media (max-width: 620px) {
  .content {
    padding: 12px;
  }

  .topbar {
    padding: 14px;
  }

  .topbar h2 {
    font-size: 23px;
  }

  .top-actions > * {
    font-size: 12px;
    padding: 10px;
  }

  .metric-card {
    min-height: 120px;
    border-radius: 22px;
  }

  .metric-card strong {
    font-size: 30px;
  }

  .panel {
    border-radius: 22px;
    padding: 15px;
  }

  .report-card-grid {
    grid-template-columns: 1fr;
  }

  .login-card {
    padding: 24px;
    border-radius: 24px;
  }
}

/* Professional file search and table polish */
.filter-hero {
  border: 1px solid #cbd5e1;
  background: linear-gradient(180deg, #ffffff, #f8fafc);
  box-shadow: none;
}

.filter-hero h3 {
  color: #0f172a;
  font-weight: 900;
}

.filter-hero span {
  border: 1px solid #cbd5e1;
  color: #0f172a;
  background: #ffffff;
  box-shadow: none;
}

.filter-hero #fileCount {
  border-color: #93c5fd;
  color: #1d4ed8;
  background: linear-gradient(180deg, #eff6ff, #dbeafe);
  font-weight: 950;
  box-shadow: 0 6px 14px rgba(37, 99, 235, 0.12);
}

.filters,
.colourful-filters,
.filters.colourful-filters {
  gap: 12px;
  padding: 14px;
  border: 1px solid #cbd5e1;
  border-radius: 12px;
  background: #f8fafc;
  box-shadow: none;
}

.filters .field,
.colourful-filters .field {
  gap: 6px;
}

.filters .field label,
.colourful-filters .field label {
  color: #1e293b;
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
}

.filters input,
.filters select,
.filters textarea,
.colourful-filters input,
.colourful-filters select,
.colourful-filters textarea {
  min-height: 38px;
  border: 1px solid #94a3b8;
  border-radius: 8px;
  color: #0f172a;
  background: #ffffff;
  font-weight: 700;
  box-shadow: inset 0 1px 2px rgba(15, 23, 42, 0.04);
}

.filters input::placeholder,
.colourful-filters input::placeholder,
.filters textarea::placeholder,
.colourful-filters textarea::placeholder {
  color: #475569;
  opacity: 1;
  font-weight: 700;
}

.filters input:focus,
.filters select:focus,
.filters textarea:focus,
.colourful-filters input:focus,
.colourful-filters select:focus,
.colourful-filters textarea:focus {
  border-color: #2563eb;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.14);
}

.table-wrap,
.file-table-wrap {
  padding: 0;
  border: 1px solid #94a3b8;
  border-radius: 10px;
  background: #ffffff;
  box-shadow: none;
}

.file-table {
  width: 100%;
  border-collapse: collapse;
  border-spacing: 0;
  min-width: 980px;
}

.file-table th {
  padding: 10px 12px;
  border: 1px solid #94a3b8;
  color: #0f172a;
  background: #e2e8f0;
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
}

.file-table td {
  padding: 10px 12px;
  border: 1px solid #cbd5e1;
  color: #1e293b;
  background: #ffffff;
  vertical-align: middle;
}

.file-table td:first-child,
.file-table th:first-child,
.file-table td:last-child,
.file-table th:last-child {
  border-radius: 0;
}

.file-table td:first-child::before {
  display: none;
}

.file-table tbody tr:nth-child(even) td {
  background: #f8fafc;
}

.file-table tbody tr:hover td {
  background: #eff6ff;
  border-color: #93c5fd;
  box-shadow: none;
}

.client-name {
  color: #020617;
  font-weight: 950;
}

.subtext {
  color: #334155;
  font-weight: 700;
}

.file-table-compact {
  border-spacing: 0;
}

.file-table-compact th {
  padding: 7px 10px;
}

.file-table-compact td {
  padding: 6px 10px;
}

.file-table th:first-child,
.file-table td:first-child {
  width: 54px;
  text-align: center;
  font-weight: 900;
}

.completed-staff-cell {
  width: 150px;
  max-width: 150px;
  color: #0f172a;
  font-weight: 800;
  white-space: normal;
  line-height: 1.25;
}

.completed-careof-cell {
  width: 110px;
  max-width: 110px;
  color: #334155;
  font-weight: 800;
  white-space: normal;
  line-height: 1.25;
}

.completed-doc-cell {
  width: 96px;
  max-width: 96px;
  font-weight: 900;
  white-space: nowrap;
}

.due-date-cell {
  width: 104px;
  max-width: 104px;
  font-weight: 900;
  white-space: nowrap;
  text-align: center;
}

.overdue-due-date {
  color: #b91c1c;
  background: #fef2f2 !important;
}

.file-table-compact .completed-staff-cell,
.file-table-compact .completed-careof-cell,
.file-table-compact .completed-doc-cell,
.file-table-compact .due-date-cell {
  padding-top: 7px;
  padding-bottom: 7px;
}

/* Dashboard refresh */
.dashboard-main-metrics {
  grid-template-columns: repeat(5, minmax(150px, 1fr));
  gap: 14px;
}

.dashboard-main-metrics .metric-card,
.staff-dashboard-metrics .metric-card {
  min-height: 104px;
  border: 1px solid rgba(148, 163, 184, 0.34);
  border-radius: 18px;
  color: #0f172a;
  background: linear-gradient(180deg, #ffffff, #f8fbff);
  box-shadow: 0 12px 28px rgba(15, 23, 42, 0.08);
}

.dashboard-main-metrics .metric-card span,
.staff-dashboard-metrics .metric-card span {
  color: #334155;
  background: rgba(255, 255, 255, 0.72);
}

.dashboard-main-metrics .metric-card strong,
.staff-dashboard-metrics .metric-card strong {
  color: #0f172a;
  font-size: 26px;
}

.dashboard-main-metrics .metric-card p,
.staff-dashboard-metrics .metric-card p {
  color: #475569;
  opacity: 1;
}

.staff-performance-panel {
  width: 100%;
}

.staff-performance-head,
.staff-performance-section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.staff-performance-head {
  margin-bottom: 14px;
}

.staff-performance-head h3 {
  margin: 0 0 4px;
}

.staff-performance-head p {
  margin: 0;
  color: #64748b;
  font-weight: 700;
}

.staff-performance-total,
.staff-performance-section-title span {
  border: 1px solid #cfe0f2;
  border-radius: 999px;
  background: #eaf4ff;
  color: #0f4f82;
  font-size: 12px;
  font-weight: 900;
  padding: 6px 10px;
  white-space: nowrap;
}

.staff-performance-controls {
  margin-bottom: 16px;
}

.staff-performance-section {
  margin-top: 18px;
}

.staff-performance-section-title {
  margin-bottom: 8px;
  padding: 9px 12px;
  border: 1px solid #dbe6f3;
  border-radius: 12px;
  background: #f7fbff;
}

.staff-performance-section-title h4 {
  margin: 0;
  color: #0f172a;
  font-size: 15px;
}

.dashboard-status-panel,
.dashboard-staff-summary-panel {
  margin-top: 16px;
}

.dashboard-section-title {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 14px;
}

.dashboard-section-title h3 {
  margin: 0 0 4px;
  color: #0f172a;
  font-size: 20px;
}

.dashboard-section-title p {
  margin: 0;
  color: #64748b;
  font-weight: 700;
}

.dashboard-status-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(130px, 1fr));
  gap: 12px;
}

.status-summary-card {
  min-height: 96px;
  padding: 13px;
  border: 1px solid #d7e2ef;
  border-radius: 16px;
  text-align: left;
  background: #ffffff;
  box-shadow: 0 10px 20px rgba(15, 23, 42, 0.06);
}

.status-summary-card span {
  display: inline-grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 950;
}

.status-summary-card strong {
  display: block;
  margin-top: 10px;
  color: #0f172a;
  font-size: 24px;
}

.status-summary-card p {
  margin: 2px 0 0;
  color: #475569;
  font-size: 12px;
  font-weight: 850;
}

.status-summary-card.tone-blue span { color: #1d4ed8; background: #dbeafe; }
.status-summary-card.tone-slate span { color: #475569; background: #e2e8f0; }
.status-summary-card.tone-purple span { color: #6d28d9; background: #ede9fe; }
.status-summary-card.tone-amber span { color: #b45309; background: #fef3c7; }
.status-summary-card.tone-green span { color: #047857; background: #d1fae5; }
.status-summary-card.tone-red span { color: #b91c1c; background: #fee2e2; }
.status-summary-card.tone-cyan span { color: #0e7490; background: #cffafe; }
.status-summary-card.tone-pink span { color: #be185d; background: #fce7f3; }

.staff-summary-toggle {
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 16px;
  border: 1px solid #cbd5e1;
  border-radius: 14px;
  color: #0f172a;
  background: linear-gradient(180deg, #ffffff, #f8fafc);
  font-weight: 950;
}

.staff-summary-toggle strong {
  padding: 6px 10px;
  border-radius: 999px;
  color: #1d4ed8;
  background: #dbeafe;
}

.staff-summary-body {
  margin-top: 14px;
}

.dashboard-staff-filters {
  grid-template-columns: repeat(5, minmax(140px, 1fr));
}

.dashboard-staff-actions {
  margin: 12px 0;
}

.dashboard-staff-table td:first-child {
  text-align: left;
}

.dashboard-staff-table th {
  background: #eaf2fb;
  color: #0f172a;
}

.staff-summary-count {
  min-width: 42px;
  padding: 5px 9px;
  border: 1px solid transparent;
  border-radius: 999px;
  font-weight: 950;
  text-align: center;
}

.staff-summary-count.tone-blue { color: #1d4ed8; background: #dbeafe; border-color: #bfdbfe; }
.staff-summary-count.tone-amber { color: #b45309; background: #fef3c7; border-color: #fde68a; }
.staff-summary-count.tone-slate { color: #475569; background: #e2e8f0; border-color: #cbd5e1; }
.staff-summary-count.tone-purple { color: #6d28d9; background: #ede9fe; border-color: #ddd6fe; }
.staff-summary-count.tone-green { color: #047857; background: #d1fae5; border-color: #a7f3d0; }
.staff-summary-count.tone-red { color: #b91c1c; background: #fee2e2; border-color: #fecaca; }

@media (max-width: 1180px) {
  .dashboard-main-metrics,
  .dashboard-status-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .dashboard-staff-filters {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 620px) {
  .dashboard-main-metrics,
  .dashboard-status-grid,
  .dashboard-staff-filters {
    grid-template-columns: 1fr;
  }
}

/* Soft pastel dashboard card shading */
.metrics .metric-card {
  border: 1px solid rgba(148, 163, 184, 0.34);
  color: #0f172a;
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.07);
}

.metrics .metric-card:hover,
.status-summary-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 16px 32px rgba(15, 23, 42, 0.10);
  filter: none;
}

.metrics .metric-card span,
.metrics .metric-card strong,
.metrics .metric-card p {
  color: #0f172a;
}

.metrics .metric-card span {
  background: rgba(255, 255, 255, 0.62);
}

.metric-card.grad-blue { background: linear-gradient(135deg, #eff6ff, #f8fafc); }
.metric-card.grad-red { background: linear-gradient(135deg, #fff1f2, #ffffff); }
.metric-card.grad-yellow { background: linear-gradient(135deg, #fffbeb, #ffffff); }
.metric-card.grad-purple { background: linear-gradient(135deg, #f5f3ff, #ffffff); }
.metric-card.grad-green { background: linear-gradient(135deg, #ecfdf5, #ffffff); }
.metric-card.grad-darkgreen { background: linear-gradient(135deg, #f0fdfa, #ffffff); }
.metric-card.grad-pink { background: linear-gradient(135deg, #fdf2f8, #ffffff); }
.metric-card.grad-slate { background: linear-gradient(135deg, #f8fafc, #ffffff); }

.status-summary-card.tone-blue { background: linear-gradient(135deg, #eff6ff, #ffffff); }
.status-summary-card.tone-slate { background: linear-gradient(135deg, #f8fafc, #ffffff); }
.status-summary-card.tone-purple { background: linear-gradient(135deg, #f5f3ff, #ffffff); }
.status-summary-card.tone-amber { background: linear-gradient(135deg, #fffbeb, #ffffff); }
.status-summary-card.tone-green { background: linear-gradient(135deg, #ecfdf5, #ffffff); }
.status-summary-card.tone-red { background: linear-gradient(135deg, #fff1f2, #ffffff); }
.status-summary-card.tone-cyan { background: linear-gradient(135deg, #ecfeff, #ffffff); }
.status-summary-card.tone-pink { background: linear-gradient(135deg, #fdf2f8, #ffffff); }

/* Clearer light dashboard card palette */
.metrics .metric-card {
  border-width: 1.5px;
  box-shadow: 0 12px 26px rgba(15, 23, 42, 0.09);
}

.metrics .metric-card strong {
  font-weight: 950;
}

.metric-card.grad-blue {
  border-color: #93c5fd;
  background: #dbeafe;
}

.metric-card.grad-blue span { color: #1d4ed8; background: #bfdbfe; }

.metric-card.grad-red {
  border-color: #fca5a5;
  background: #fee2e2;
}

.metric-card.grad-red span { color: #b91c1c; background: #fecaca; }

.metric-card.grad-yellow {
  border-color: #fcd34d;
  background: #fef3c7;
}

.metric-card.grad-yellow span { color: #b45309; background: #fde68a; }

.metric-card.grad-purple {
  border-color: #c4b5fd;
  background: #ede9fe;
}

.metric-card.grad-purple span { color: #6d28d9; background: #ddd6fe; }

.metric-card.grad-green {
  border-color: #86efac;
  background: #dcfce7;
}

.metric-card.grad-green span { color: #047857; background: #bbf7d0; }

.metric-card.grad-darkgreen {
  border-color: #5eead4;
  background: #ccfbf1;
}

.metric-card.grad-darkgreen span { color: #0f766e; background: #99f6e4; }

.metric-card.grad-pink {
  border-color: #f9a8d4;
  background: #fce7f3;
}

.metric-card.grad-pink span { color: #be185d; background: #fbcfe8; }

.metric-card.grad-slate {
  border-color: #cbd5e1;
  background: #e2e8f0;
}

.metric-card.grad-slate span { color: #334155; background: #cbd5e1; }

.status-summary-card {
  border-width: 1.5px;
}

.status-summary-card.tone-blue { border-color: #93c5fd; background: #dbeafe; }
.status-summary-card.tone-slate { border-color: #cbd5e1; background: #e2e8f0; }
.status-summary-card.tone-purple { border-color: #c4b5fd; background: #ede9fe; }
.status-summary-card.tone-amber { border-color: #fcd34d; background: #fef3c7; }
.status-summary-card.tone-green { border-color: #86efac; background: #dcfce7; }
.status-summary-card.tone-red { border-color: #fca5a5; background: #fee2e2; }
.status-summary-card.tone-cyan { border-color: #67e8f9; background: #cffafe; }
.status-summary-card.tone-pink { border-color: #f9a8d4; background: #fce7f3; }

.metrics .metric-card:hover,
.status-summary-card:hover {
  box-shadow: 0 18px 34px rgba(15, 23, 42, 0.13);
  filter: saturate(1.04);
}

/* Accounting-inspired dashboard palette */
.metrics .metric-card,
.status-summary-card {
  border-radius: 18px;
  color: #172033;
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.08);
}

.metrics .metric-card {
  border-left-width: 5px;
}

.status-summary-card {
  border-left-width: 5px;
}

.metrics .metric-card strong,
.status-summary-card strong {
  color: #111827;
  font-weight: 950;
}

.metrics .metric-card p,
.status-summary-card p {
  color: #24364b;
  opacity: 1;
}

.metric-card.grad-blue,
.status-summary-card.tone-blue {
  border-color: #5aa9ee;
  background: #dceeff;
}

.metric-card.grad-blue span,
.status-summary-card.tone-blue span {
  color: #0f5ea8;
  background: #b9dcff;
}

.metric-card.grad-green,
.status-summary-card.tone-green {
  border-color: #55b877;
  background: #ddf4e4;
}

.metric-card.grad-green span,
.status-summary-card.tone-green span {
  color: #187443;
  background: #cdefd8;
}

.metric-card.grad-darkgreen,
.status-summary-card.tone-cyan {
  border-color: #36aaa1;
  background: #d8f3f0;
}

.metric-card.grad-darkgreen span,
.status-summary-card.tone-cyan span {
  color: #08756f;
  background: #bcebe6;
}

.metric-card.grad-yellow,
.status-summary-card.tone-amber {
  border-color: #e0ad25;
  background: #fff0c2;
}

.metric-card.grad-yellow span,
.status-summary-card.tone-amber span {
  color: #925f05;
  background: #ffe399;
}

.metric-card.grad-red,
.status-summary-card.tone-red {
  border-color: #ef7777;
  background: #ffdcdc;
}

.metric-card.grad-red span,
.status-summary-card.tone-red span {
  color: #a92929;
  background: #ffc4c4;
}

.metric-card.grad-purple,
.status-summary-card.tone-purple {
  border-color: #9b7cf0;
  background: #e9e0ff;
}

.metric-card.grad-purple span,
.status-summary-card.tone-purple span {
  color: #6341c5;
  background: #d8caff;
}

.metric-card.grad-pink {
  border-color: #f1a05f;
  background: #ffe1c7;
}

.metric-card.grad-pink span {
  color: #a84f0f;
  background: #ffd0a5;
}

.metric-card.grad-slate,
.status-summary-card.tone-slate {
  border-color: #aab4c0;
  background: #eef1f4;
}

.metric-card.grad-slate span,
.status-summary-card.tone-slate span {
  color: #465569;
  background: #dce2e8;
}

.metrics .metric-card:hover,
.status-summary-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 18px 36px rgba(15, 23, 42, 0.13);
  filter: saturate(1.06);
}

/* Lighter top action buttons */
#chatButton,
#notifyButton,
.top-action-button {
  border: 1px solid rgba(148, 163, 184, 0.34);
  color: #172033;
  box-shadow: 0 8px 18px rgba(15, 23, 42, 0.08);
}

#chatButton {
  background: #e9e0ff;
  border-color: #c4b5fd;
  color: #4c1d95;
}

#notifyButton {
  background: #fff0c2;
  border-color: #fcd34d;
  color: #7c4a03;
}

.top-action-sample {
  background: #eef1f4;
  border-color: #cbd5e1;
  color: #334155;
}

.top-action-import {
  background: #d8f3f0;
  border-color: #67d7cf;
  color: #0f766e;
}

.top-action-export {
  background: #ffe1c7;
  border-color: #fdba74;
  color: #8a3d0a;
}

.top-action-add {
  background: #dceeff;
  border-color: #93c5fd;
  color: #0f5ea8;
}

.top-action-logout {
  background: #eef1f4;
  border-color: #cbd5e1;
  color: #334155;
}

#chatButton:hover,
#notifyButton:hover,
.top-action-button:hover {
  box-shadow: 0 12px 24px rgba(15, 23, 42, 0.11);
  filter: saturate(1.04);
}

.bulk-report-panel {
  margin-top: 18px;
  padding: 16px;
  border: 1px solid #bfdbfe;
  border-radius: 10px;
  background: #f0f7ff;
  box-shadow: 0 10px 24px rgba(37, 99, 235, 0.08);
}

.bulk-report-panel h3 {
  margin: 0 0 4px;
  color: #123f6d;
}

.bulk-report-panel p {
  margin: 0 0 12px;
  color: #475569;
  font-size: 13px;
}

.bulk-report-summary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 8px;
  margin-bottom: 12px;
}

.bulk-report-summary span {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  padding: 9px 10px;
  border: 1px solid #dbeafe;
  border-radius: 8px;
  background: #ffffff;
  color: #334155;
  font-size: 12px;
}

.bulk-report-summary strong {
  color: #0f172a;
  font-size: 14px;
}

.visitor-panel .filter-hero,
.daily-report-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 14px;
  margin-bottom: 14px;
}

.visitor-filters {
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
}

.visitor-action-row,
.daily-report-actions {
  flex-wrap: wrap;
  justify-content: flex-end;
}

.visitor-purpose-cell,
.daily-report-table td {
  white-space: normal;
  line-height: 1.35;
}

.visitor-table th:first-child,
.visitor-table td:first-child,
.daily-report-table th:first-child,
.daily-report-table td:first-child {
  width: 42px;
  max-width: 42px;
  text-align: center;
}

.inline-field-row {
  display: flex;
  gap: 8px;
  align-items: center;
}

.inline-field-row input {
  min-width: 0;
  flex: 1;
}

.visitor-view {
  display: grid;
  gap: 12px;
}

.visitor-view div {
  padding: 12px;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  background: #f8fafc;
}

.visitor-view span {
  display: block;
  margin-bottom: 5px;
  color: #64748b;
  font-size: 12px;
  font-weight: 800;
}

.visitor-view strong,
.visitor-view p {
  margin: 0;
  color: #0f172a;
}

.visitor-entry-table-wrap {
  overflow-x: auto;
}

.visitor-inline-entry {
  margin: 14px 0;
  padding: 14px;
  border: 1px solid #dbeafe;
  border-radius: 10px;
  background: #f8fbff;
}

.visitor-entry-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 1120px;
  table-layout: fixed;
}

.visitor-entry-table th,
.visitor-entry-table td {
  border: 1px solid #dbe3ee;
  padding: 7px;
  vertical-align: top;
}

.visitor-entry-table th {
  background: #eaf2fb;
  color: #0f3f6f;
  font-size: 12px;
  text-align: left;
}

.visitor-entry-table th:first-child,
.visitor-entry-table td:first-child {
  width: 110px;
  max-width: none;
  text-align: left;
}

.visitor-entry-table th:nth-child(2),
.visitor-entry-table td:nth-child(2) {
  width: 190px;
}

.visitor-entry-table th:nth-child(3),
.visitor-entry-table td:nth-child(3) {
  width: 150px;
}

.visitor-entry-table th:nth-child(4),
.visitor-entry-table td:nth-child(4) {
  width: 180px;
}

.visitor-entry-table th:nth-child(5),
.visitor-entry-table td:nth-child(5) {
  width: 220px;
}

.visitor-entry-table th:nth-child(6),
.visitor-entry-table td:nth-child(6) {
  width: 170px;
}

.visitor-entry-table th:nth-child(7),
.visitor-entry-table td:nth-child(7) {
  width: 220px;
}

.visitor-entry-table th:last-child,
.visitor-entry-table td:last-child {
  width: 150px;
  text-align: center;
}

.visitor-entry-table input,
.visitor-entry-table textarea,
.visitor-entry-table select {
  width: 100%;
  min-width: 0;
}

.visitor-entry-table tr.invalid-row td {
  background: #fff1f2;
  border-color: #fca5a5;
}

.transaction-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 16px;
}

.transaction-heading h3 {
  margin: 0;
  color: #0f172a;
  font-size: 24px;
  letter-spacing: 0;
}

.transaction-table-head {
  display: flex;
  justify-content: flex-end;
  margin: 10px 0;
  color: #0f3f6f;
}

.transaction-table {
  min-width: 1160px;
}

.transaction-table th,
.transaction-table td {
  vertical-align: top;
}

.transaction-table .wrap-cell {
  min-width: 180px;
  max-width: 260px;
  white-space: normal;
  line-height: 1.35;
}

.transaction-table .action-col,
.visitor-table .action-col {
  width: 150px;
  min-width: 150px;
}

.daily-report-panel {
  background: #ffffff;
}

.daily-report-head h3 {
  margin: 0 0 5px;
  color: #123f6d;
  font-size: 20px;
}

.daily-report-head p {
  margin: 0;
  color: #64748b;
}

.daily-date-field {
  max-width: 240px;
  margin-bottom: 14px;
}

.daily-report-section {
  margin-top: 16px;
  padding: 12px;
  border: 1px solid #dbeafe;
  border-radius: 10px;
  background: #f8fbff;
}

.daily-report-section h3 {
  margin: 0 0 8px;
  color: #0f3f6f;
  font-size: 15px;
}

.daily-report-total {
  margin: 10px 0 0;
  color: #0f172a;
  font-weight: 900;
}

@media (max-width: 760px) {
  .visitor-panel .filter-hero,
  .daily-report-head {
    display: grid;
  }

  .daily-report-actions,
  .visitor-action-row,
  .inline-field-row {
    align-items: stretch;
  }

  .inline-field-row {
    flex-direction: column;
  }
}

/* Modern left navigation */
.app-shell {
  grid-template-columns: 286px minmax(0, 1fr);
  transition: grid-template-columns 0.2s ease;
}

.app-shell.sidebar-collapsed {
  grid-template-columns: 82px minmax(0, 1fr);
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 16px 12px;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  gap: 12px;
  overflow: hidden;
  color: #e5edf8;
  background: linear-gradient(180deg, #132238 0%, #182b45 52%, #203856 100%);
  border-right: 1px solid #263f61;
  box-shadow: 10px 0 28px rgba(15, 23, 42, 0.14);
}

.sidebar .brand {
  display: grid;
  grid-template-columns: 40px minmax(0, 1fr) 32px;
  align-items: center;
  gap: 10px;
  margin: 0;
  padding: 6px 4px 14px;
  border-bottom: 1px solid rgba(203, 213, 225, 0.18);
}

.sidebar .brand-mark {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  color: #d8f3f0;
  background: rgba(20, 184, 166, 0.18);
  border: 1px solid rgba(153, 246, 228, 0.28);
  box-shadow: none;
}

.sidebar svg {
  width: 18px;
  height: 18px;
  fill: currentColor;
}

.brand-text-only h1 {
  margin: 0;
  color: #ffffff;
  font-size: 17px;
  line-height: 1.1;
  letter-spacing: 0;
  font-weight: 900;
}

.brand-text-only h1 span {
  color: #5eead4;
}

.brand-text-only h1 em {
  font-style: normal;
  font-weight: 700;
}

.brand-text-only .brand-byline {
  margin: 4px 0 0;
  color: #b7c4d7;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0;
}

.sidebar-collapse-button,
.sidebar-logout-button {
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  border-radius: 10px;
  color: #cbd5e1;
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid rgba(203, 213, 225, 0.16);
  transition: background 0.18s ease, color 0.18s ease, transform 0.18s ease;
}

.sidebar-collapse-button:hover,
.sidebar-logout-button:hover {
  color: #5eead4;
  background: rgba(20, 184, 166, 0.14);
  transform: translateY(-1px);
}

.nav {
  display: block;
  min-height: 0;
  overflow-y: auto;
  padding: 2px 2px 10px;
  scrollbar-width: thin;
  scrollbar-color: #cbd5e1 transparent;
}

.nav-group {
  margin: 0 0 10px;
}

.nav-section-title {
  width: 100%;
  height: 26px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 8px;
  color: #94a3b8;
  background: transparent;
  border: 0;
  font-size: 10px;
  font-weight: 950;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.nav-section-title strong {
  width: 18px;
  height: 18px;
  display: grid;
  place-items: center;
  color: #94a3b8;
  transition: transform 0.18s ease;
}

.nav-group.collapsed .nav-section-title strong {
  transform: rotate(-90deg);
}

.nav-section-title:disabled {
  cursor: default;
}

.nav-group.collapsed .nav-group-items {
  display: none;
}

.nav .nav-item {
  position: relative;
  width: 100%;
  min-height: 39px;
  display: grid;
  grid-template-columns: 32px minmax(0, 1fr) auto;
  align-items: center;
  gap: 9px;
  margin: 3px 0;
  padding: 6px 9px;
  color: #dbe7f4;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 12px;
  font-size: 13px;
  font-weight: 800;
  text-align: left;
  letter-spacing: 0;
  transition: background 0.18s ease, border-color 0.18s ease, color 0.18s ease, transform 0.18s ease;
}

.nav .nav-item::before {
  content: "";
  position: absolute;
  left: 0;
  top: 8px;
  bottom: 8px;
  width: 3px;
  border-radius: 99px;
  background: transparent;
}

.nav .nav-icon {
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  color: #99f6e4;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 10px;
}

.nav .nav-label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.nav .nav-item:hover {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.10);
  border-color: rgba(153, 246, 228, 0.22);
  transform: translateX(2px);
}

.nav .nav-item.active {
  color: #ffffff;
  background: rgba(20, 184, 166, 0.22);
  border-color: rgba(153, 246, 228, 0.42);
  box-shadow: none;
}

.nav .nav-item.active::before {
  background: #5eead4;
}

.nav .nav-item.active .nav-icon {
  color: #ffffff;
  background: #14b8a6;
}

.nav-badge {
  min-width: 22px;
  height: 20px;
  padding: 0 7px;
  display: inline-grid;
  place-items: center;
  border-radius: 99px;
  color: #0f172a;
  background: #e2e8f0;
  font-size: 11px;
  font-weight: 950;
}

.nav-badge-active,
.nav-badge-myTask { background: #dbeafe; color: #1d4ed8; }
.nav-badge-notChecked { background: #fef3c7; color: #a16207; }
.nav-badge-completed { background: #dcfce7; color: #15803d; }
.nav-badge-nonBilled { background: #ffedd5; color: #c2410c; }
.nav-badge-billed { background: #ccfbf1; color: #0f766e; }
.nav-badge-feePending { background: #fee2e2; color: #b91c1c; }
.nav-badge-feeReceived { background: #dcfce7; color: #166534; }
.nav-badge-reAssigned { background: #ede9fe; color: #6d28d9; }

.reassigned-inline-label {
  display: inline-flex;
  align-items: center;
  margin-left: 6px;
  padding: 2px 7px;
  border-radius: 999px;
  border: 1px solid #c4b5fd;
  background: #f5f3ff;
  color: #6d28d9;
  font-size: 10px;
  font-weight: 900;
  line-height: 1.2;
  white-space: nowrap;
}

.current-user-card {
  margin: 0;
  padding: 12px 10px;
  display: grid;
  grid-template-columns: 36px minmax(0, 1fr) 32px;
  align-items: center;
  gap: 10px;
  color: #ffffff;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(203, 213, 225, 0.16);
  border-radius: 14px;
  box-shadow: none;
}

.profile-avatar {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border-radius: 12px;
  color: #0f172a;
  background: #99f6e4;
  font-size: 12px;
  font-weight: 950;
}

.profile-copy {
  min-width: 0;
}

.current-user-card span {
  margin: 0;
  color: #aebdd0;
  font-size: 10px;
  font-weight: 950;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.current-user-card strong {
  display: block;
  margin-top: 1px;
  color: #ffffff;
  font-size: 13px;
  line-height: 1.15;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.current-user-card .small-muted {
  margin: 1px 0 0;
  color: #b7c4d7;
  font-size: 11px;
}

.sidebar.collapsed {
  padding: 16px 10px;
}

.sidebar.collapsed .brand {
  grid-template-columns: 40px;
  justify-content: center;
}

.sidebar.collapsed .brand-text-only,
.sidebar.collapsed .sidebar-collapse-button,
.sidebar.collapsed .nav-section-title span,
.sidebar.collapsed .nav-label,
.sidebar.collapsed .nav-badge,
.sidebar.collapsed .profile-copy,
.sidebar.collapsed .sidebar-logout-button {
  display: none;
}

.sidebar.collapsed .nav-section-title {
  height: 12px;
  padding: 0;
}

.sidebar.collapsed .nav .nav-item {
  grid-template-columns: 32px;
  justify-content: center;
  padding: 6px;
}

.sidebar.collapsed .current-user-card {
  grid-template-columns: 36px;
  justify-content: center;
  padding: 10px 8px;
}

@media (max-width: 880px) {
  .app-shell,
  .app-shell.sidebar-collapsed {
    grid-template-columns: 1fr;
  }

  .sidebar,
  .sidebar.collapsed {
    position: fixed;
    left: 0;
    top: 0;
    width: 286px;
    transform: translateX(-104%);
    transition: transform 0.2s ease;
    z-index: 60;
    box-shadow: 18px 0 42px rgba(15, 23, 42, 0.18);
  }

  .sidebar.open {
    transform: translateX(0);
  }

  .sidebar.collapsed .brand-text-only,
  .sidebar.collapsed .nav-section-title span,
  .sidebar.collapsed .nav-label,
  .sidebar.collapsed .nav-badge,
  .sidebar.collapsed .profile-copy,
  .sidebar.collapsed .sidebar-logout-button {
    display: block;
  }

  .sidebar.collapsed .brand {
    grid-template-columns: 40px minmax(0, 1fr) 32px;
  }

  .sidebar.collapsed .nav .nav-item {
    grid-template-columns: 32px minmax(0, 1fr) auto;
    justify-content: stretch;
    padding: 6px 9px;
  }

  .sidebar.collapsed .current-user-card {
    grid-template-columns: 36px minmax(0, 1fr) 32px;
  }
}

/* Dashboard palette matched with navy sidebar */
.dashboard-main-metrics .metric-card,
.staff-dashboard-metrics .metric-card,
.metrics .metric-card,
.status-summary-card {
  color: #102033;
  border-left-width: 5px;
  box-shadow: 0 12px 26px rgba(19, 34, 56, 0.10);
}

.dashboard-main-metrics .metric-card strong,
.staff-dashboard-metrics .metric-card strong,
.metrics .metric-card strong,
.status-summary-card strong {
  color: #102033;
  font-weight: 950;
}

.dashboard-main-metrics .metric-card p,
.staff-dashboard-metrics .metric-card p,
.metrics .metric-card p,
.status-summary-card p {
  color: #2f4562;
}

.metric-card.grad-blue,
.status-summary-card.tone-blue {
  background: #dce8f7;
  border-color: #34577f;
}

.metric-card.grad-blue span,
.status-summary-card.tone-blue span {
  color: #132238;
  background: #bdd3ed;
}

.metric-card.grad-darkgreen,
.status-summary-card.tone-cyan {
  background: #d8f3f0;
  border-color: #14b8a6;
}

.metric-card.grad-darkgreen span,
.status-summary-card.tone-cyan span {
  color: #075e57;
  background: #aee6df;
}

.metric-card.grad-green,
.status-summary-card.tone-green {
  background: #dff4e8;
  border-color: #36a374;
}

.metric-card.grad-green span,
.status-summary-card.tone-green span {
  color: #126642;
  background: #bce8ce;
}

.metric-card.grad-yellow,
.status-summary-card.tone-amber {
  background: #fff0c2;
  border-color: #d5a01f;
}

.metric-card.grad-yellow span,
.status-summary-card.tone-amber span {
  color: #7a5208;
  background: #ffe29b;
}

.metric-card.grad-red,
.status-summary-card.tone-red {
  background: #ffe0df;
  border-color: #dc6b67;
}

.metric-card.grad-red span,
.status-summary-card.tone-red span {
  color: #9b2d2a;
  background: #ffc4c1;
}

.metric-card.grad-purple,
.status-summary-card.tone-purple {
  background: #e6e2fb;
  border-color: #7467c7;
}

.metric-card.grad-purple span,
.status-summary-card.tone-purple span {
  color: #43388f;
  background: #d3cdf4;
}

.metric-card.grad-pink,
.status-summary-card.tone-pink {
  background: #ffe4cf;
  border-color: #dc8a43;
}

.metric-card.grad-pink span,
.status-summary-card.tone-pink span {
  color: #8a470f;
  background: #ffd0a8;
}

.metric-card.grad-slate,
.status-summary-card.tone-slate {
  background: #edf1f6;
  border-color: #6a7f98;
}

.metric-card.grad-slate span,
.status-summary-card.tone-slate span {
  color: #263f61;
  background: #dbe3ec;
}

.dashboard-status-panel,
.dashboard-staff-summary-panel,
.staff-performance-panel {
  border-color: #d9e4f2;
  background: linear-gradient(180deg, #ffffff, #f8fbff);
}

.dashboard-section-title h3,
.staff-performance-head h3 {
  color: #132238;
}

.expense-shell {
  display: grid;
  gap: 18px;
  max-width: 100%;
}

.transactions-page-head,
.expense-hero {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: center;
  padding: 18px 20px;
  border: 1px solid #cbd8e8;
  border-radius: 18px;
  background: #ffffff;
  box-shadow: 0 14px 30px rgba(19, 34, 56, 0.06);
}

.transactions-page-head h3 {
  margin: 0;
  color: #0f172a;
  font-size: 28px;
  line-height: 1.1;
  letter-spacing: 0;
}

.transactions-page-head p,
.expense-card-head p {
  margin: 6px 0 0;
  color: #64748b;
  font-size: 14px;
}

.expense-card-head h3 {
  margin: 0;
  color: #132238;
  font-size: 20px;
  letter-spacing: 0;
}

.expense-hero strong {
  min-width: 180px;
  padding: 12px 16px;
  border: 1px solid #14b8a6;
  border-radius: 16px;
  background: #d8f3f0;
  color: #075e57;
  font-size: 24px;
  text-align: right;
}

.expense-overview-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(180px, 1fr));
  gap: 14px;
}

.expense-overview-card {
  display: flex;
  gap: 12px;
  min-height: 118px;
  padding: 16px;
  border: 1px solid #d6e2f1;
  border-radius: 16px;
  background: #ffffff;
  box-shadow: 0 12px 26px rgba(19, 34, 56, 0.06);
  transition: transform 160ms ease, box-shadow 160ms ease, border-color 160ms ease;
}

.expense-overview-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 18px 32px rgba(19, 34, 56, 0.1);
}

.expense-card-icon {
  display: grid;
  place-items: center;
  flex: 0 0 40px;
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: #e0f2fe;
  color: #075985;
  font-weight: 900;
}

.expense-overview-card span {
  color: #475569;
  font-size: 12px;
  font-weight: 900;
}

.expense-overview-card strong {
  display: block;
  margin-top: 8px;
  color: #132238;
  font-size: 22px;
  line-height: 1.15;
}

.expense-overview-card p {
  margin: 8px 0 0;
  color: #64748b;
  font-size: 12px;
  font-weight: 700;
}

.expense-overview-card.balance {
  background: #f8feff;
  border-color: #14b8a6;
}

.expense-overview-card.balance .expense-card-icon,
.cash-balance-card.highlight {
  background: #d8f3f0;
}

.expense-overview-card.expense {
  background: #fffafa;
  border-color: #dc6b67;
}

.expense-overview-card.expense .expense-card-icon {
  background: #ffe0df;
  color: #9b2d2a;
}

.expense-overview-card.collection {
  background: #fbfffd;
  border-color: #36a374;
}

.expense-overview-card.collection .expense-card-icon {
  background: #dff4e8;
  color: #08704d;
}

.expense-overview-card.fee {
  background: #fbfdff;
  border-color: #34577f;
}

.expense-overview-card.fee .expense-card-icon {
  background: #ede9fe;
  color: #5b21b6;
}

.expense-tabs {
  display: grid;
  grid-template-columns: repeat(3, minmax(160px, 1fr));
  gap: 6px;
  width: min(100%, 760px);
  padding: 6px;
  border: 1px solid #d8e3f0;
  border-radius: 14px;
  background: #f3f7fb;
}

.expense-tab-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 42px;
  padding: 9px 14px;
  border: 1px solid transparent;
  border-radius: 10px;
  color: #41556f;
  font-weight: 900;
  cursor: pointer;
  background: transparent;
  transition: background 160ms ease, transform 160ms ease, box-shadow 160ms ease;
}

.expense-tab-button:hover {
  background: #ffffff;
}

.tab-icon {
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.75);
}

.expense-tab-button.tab-collections {
  background: #d8f3f0;
  border-color: #9ddbd3;
  color: #075e57;
}

.expense-tab-button.tab-expenses {
  background: #ffe0df;
  border-color: #f4b3af;
  color: #9b2d2a;
}

.expense-tab-button.tab-balance {
  background: #dce8f7;
  border-color: #b8cce5;
  color: #263f61;
}

.expense-tab-button.active-tab {
  filter: saturate(1.08);
  border-width: 2px;
  box-shadow: 0 8px 18px rgba(19, 34, 56, 0.08);
  transform: translateY(-1px);
}

.expense-entry-grid {
  display: grid;
  grid-template-columns: minmax(320px, 0.95fr) minmax(360px, 1.35fr);
  gap: 16px;
  align-items: start;
}

.expense-stack {
  display: grid;
  gap: 16px;
}

.expense-form,
.expense-tools-card {
  border: 1px solid #d8e3f0;
  border-radius: 18px;
  background: #ffffff;
  box-shadow: 0 14px 30px rgba(19, 34, 56, 0.06);
}

.expense-form {
  display: grid;
  grid-template-columns: repeat(4, minmax(150px, 1fr));
  gap: 12px;
  padding: 18px;
}

.collection-form {
  grid-template-columns: repeat(4, minmax(150px, 1fr));
}

.expense-entry-form {
  grid-template-columns: repeat(4, minmax(150px, 1fr));
}

.expense-entry-form .expense-card-head,
.expense-entry-form .expense-item-field,
.expense-entry-form .expense-remarks-field,
.expense-entry-form .expense-attachment-field,
.expense-entry-form .action-row {
  grid-column: 1 / -1;
}

.collection-form .expense-card-head,
.collection-form .expense-item-field,
.collection-form .expense-remarks-field,
.collection-form .expense-attachment-field,
.collection-form .action-row {
  grid-column: 1 / -1;
}

.expense-tools-card {
  padding: 16px;
}

.expense-card-head {
  grid-column: 1 / -1;
  margin-bottom: 3px;
}

.expense-form .action-row {
  grid-column: 1 / -1;
  margin-top: 4px;
  justify-content: flex-end;
}

.expense-remarks-field,
.expense-attachment-field {
  grid-column: span 2;
}

.expense-remarks-field textarea {
  min-height: 68px;
  resize: vertical;
  line-height: 1.45;
}

.amount-input {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.upload-drop {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 4px 10px;
  align-items: center;
  min-height: 78px;
  padding: 13px;
  border: 1px dashed #9db7d6;
  border-radius: 12px;
  background: #f8fbff;
  cursor: pointer;
}

.upload-drop input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.upload-drop span {
  display: grid;
  place-items: center;
  grid-row: span 2;
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: #e0f2fe;
  color: #075985;
  font-weight: 900;
}

.upload-drop strong {
  color: #0f172a;
  font-size: 13px;
}

.upload-drop small {
  margin: 0;
  color: #64748b;
}

.expense-attachment-field small {
  display: block;
  margin-top: 5px;
  color: #64748b;
  font-weight: 700;
}

.opening-balance-card {
  background: #f8fbff;
}

.opening-balance-form {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) 150px 150px auto;
  gap: 10px;
  align-items: end;
  margin-top: 14px;
}

.opening-balance-list {
  margin-top: 12px;
}

.expense-form .action-row .primary-button,
.expense-form .action-row .secondary-button {
  min-height: 36px;
}

.expense-item-field {
  grid-column: 1 / -1;
}

.expense-item-combo {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) auto;
  gap: 8px;
  align-items: center;
}

.expense-item-combo .secondary-button,
.expense-item-combo .expense-action-select {
  min-height: 34px;
  padding: 7px 12px;
}

.expense-filters {
  margin: 14px 0 0;
}

.expense-search-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(145px, 1fr));
  gap: 10px;
  align-items: end;
}

.balance-filter-row {
  grid-template-columns: repeat(auto-fit, minmax(145px, 1fr));
  align-items: end;
}

.expense-table {
  margin-top: 16px;
  overflow: hidden;
  border-radius: 14px;
}

.expense-table th {
  background: #edf4fb;
  color: #263f61;
}

.expense-table th,
.expense-table td {
  padding-top: 8px;
  padding-bottom: 8px;
}

.expense-table .expense-date-col {
  min-width: 112px;
  white-space: nowrap;
}

.expense-table .amount-col,
.expense-table .amount-cell {
  min-width: 120px;
  text-align: right;
}

.attachment-link {
  color: #263f61;
  font-weight: 800;
  text-decoration: underline;
}

.cash-balance-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(190px, 1fr));
  gap: 12px;
}

.cash-balance-card {
  padding: 16px;
  border: 1px solid #d9e4f2;
  border-left: 5px solid #263f61;
  border-radius: 16px;
  background: #ffffff;
  box-shadow: 0 10px 22px rgba(19, 34, 56, 0.06);
}

.cash-balance-card span {
  color: #475569;
  font-weight: 800;
}

.cash-balance-card strong {
  display: block;
  margin-top: 8px;
  color: #132238;
  font-size: 24px;
  text-align: right;
}

.negative-amount {
  color: #dc2626 !important;
}

.cash-status {
  display: inline-flex;
  width: fit-content;
  margin-top: 12px;
  padding: 7px 11px;
  border-radius: 999px;
  font-weight: 900;
}

.cash-status.ok {
  background: #dcfce7;
  color: #166534;
}

.cash-status.warn {
  background: #fee2e2;
  color: #991b1b;
}

.cash-verify-grid {
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
}

.soft-modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(15, 23, 42, 0.28);
}

.expense-item-manager {
  width: min(620px, 100%);
}

.expense-item-manager-grid {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) auto;
  gap: 10px;
  margin: 14px 0;
}

.expense-item-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  max-height: 220px;
  overflow: auto;
}

.visitor-head-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

.visitor-today-note,
.form-error {
  margin: 10px 0;
  padding: 10px 12px;
  border-radius: 10px;
  background: #f0f9ff;
  color: #075985;
  font-weight: 800;
}

.form-error {
  background: #fee2e2;
  color: #991b1b;
}

.danger-soft {
  color: #b91c1c;
  background: #fee2e2;
  border-color: #fecaca;
}

@media (max-width: 1050px) {
  .expense-overview-grid,
  .cash-balance-grid {
    grid-template-columns: repeat(2, minmax(180px, 1fr));
  }

  .expense-entry-grid {
    grid-template-columns: 1fr;
  }

  .expense-form,
  .expense-entry-form,
  .collection-form {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 900px) {
  .expense-hero {
    align-items: stretch;
    flex-direction: column;
  }

  .expense-hero strong {
    min-width: 0;
  }

  .expense-form,
  .expense-entry-form,
  .collection-form,
  .opening-balance-form,
  .expense-item-combo {
    grid-template-columns: 1fr;
  }

  .expense-remarks-field,
  .expense-attachment-field {
    grid-column: 1 / -1;
  }

  .expense-tabs {
    display: grid;
    width: 100%;
    grid-template-columns: repeat(3, minmax(190px, 1fr));
    overflow-x: auto;
  }

  .expense-overview-grid,
  .cash-balance-grid {
    grid-template-columns: 1fr;
  }
}

.workflow-status-select {
  width: 100%;
  min-height: 44px;
  padding: 10px 40px 10px 12px;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  background: #fff;
  color: #0f172a;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: border-color 0.18s ease, box-shadow 0.18s ease;
}

.workflow-status-select:focus {
  outline: none;
  border-color: #2563eb;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

/* Final workflow polish: keep these overrides after all module styles. */
.dashboard-maker-tag {
  display: block;
  margin-top: 5px;
  color: #2563eb;
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0;
}

.staff-performance-metrics .metric-card {
  position: relative;
  overflow: hidden;
  min-height: 118px;
  padding: 18px;
  border: 1px solid #d7e3f1;
  border-bottom: 4px solid #2563eb;
  border-radius: 14px;
  background: linear-gradient(145deg, #ffffff 0%, #fbfdff 100%);
  box-shadow: 0 5px 15px rgba(15, 23, 42, 0.06);
  transition: transform 180ms ease, box-shadow 180ms ease, border-color 180ms ease;
}

.staff-performance-metrics .metric-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 9px 22px rgba(15, 23, 42, 0.10);
}

.staff-performance-metrics .metric-card span {
  color: #334155;
  font-size: 12px;
  font-weight: 850;
}

.staff-performance-metrics .metric-card strong {
  color: #020617;
  font-size: 25px;
  font-weight: 950;
}

.staff-performance-metrics .metric-card p {
  color: #64748b;
  font-size: 12px;
}

.transactions-module .expense-card,
.transactions-module .transaction-card,
.transactions-module .chart-card,
.transactions-module .cash-balance-card,
.transactions-module .transaction-register-card,
.transactions-module .search-report-card,
.transaction-workspace .expense-card,
.transaction-workspace .transaction-card,
.transaction-workspace .chart-card,
.transaction-workspace .cash-balance-card {
  border: 1px solid #d7e3f1;
  border-radius: 14px;
  background: linear-gradient(145deg, #ffffff 0%, #fbfdff 100%);
  box-shadow: 0 5px 15px rgba(15, 23, 42, 0.06);
  transition: transform 180ms ease, box-shadow 180ms ease, border-color 180ms ease;
}

.transactions-module .expense-card:hover,
.transactions-module .transaction-card:hover,
.transactions-module .chart-card:hover,
.transactions-module .cash-balance-card:hover,
.transactions-module .transaction-register-card:hover,
.transactions-module .search-report-card:hover,
.transaction-workspace .expense-card:hover,
.transaction-workspace .transaction-card:hover,
.transaction-workspace .chart-card:hover,
.transaction-workspace .cash-balance-card:hover {
  transform: translateY(-2px);
  border-color: #b8cce3;
  box-shadow: 0 9px 22px rgba(15, 23, 42, 0.10);
}

.correction-required-table th,
.correction-required-table td {
  vertical-align: top;
}

.correction-required-table .correction-reason-cell {
  min-width: 240px;
  max-width: 360px;
  white-space: normal;
  color: #7f1d1d;
  font-weight: 800;
}

/* Final visual overrides for staff performance and transaction cards. */
.dashboard-maker-tag {
  display: inline-flex;
  margin-top: 7px;
  padding: 5px 10px;
  border: 1px solid #bfdbfe;
  border-radius: 999px;
  background: #eff6ff;
  color: #1d4ed8;
  font-size: 11px;
  font-weight: 900;
}

.staff-performance-metrics .metric-card {
  min-height: 126px;
  padding: 14px;
  border: 1px solid #c8d9ec;
  border-bottom-width: 4px;
  border-radius: 14px;
  background:
    radial-gradient(circle at top right, rgba(37, 99, 235, 0.08), transparent 38%),
    linear-gradient(145deg, #ffffff 0%, #fbfdff 65%, #f6f9ff 100%);
  color: #0f172a;
  box-shadow: 0 5px 15px rgba(15, 23, 42, 0.06);
}

.staff-performance-metrics .metric-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 9px 22px rgba(15, 23, 42, 0.10);
}

.staff-performance-metrics .metric-card::after {
  display: none;
}

.staff-performance-metrics .metric-card span {
  color: #2563eb;
  background: #e8efff;
}

.staff-performance-metrics .metric-card strong {
  color: #0f172a;
}

.staff-performance-metrics .metric-card p {
  color: #64748b;
  opacity: 1;
}

.staff-performance-metrics .metric-card.grad-red { border-bottom-color: #ef4444; }
.staff-performance-metrics .metric-card.grad-yellow { border-bottom-color: #f59e0b; }
.staff-performance-metrics .metric-card.grad-green,
.staff-performance-metrics .metric-card.grad-darkgreen { border-bottom-color: #14b8a6; }
.staff-performance-metrics .metric-card.grad-slate { border-bottom-color: #475569; }
.staff-performance-metrics .metric-card.grad-blue { border-bottom-color: #2563eb; }

#staff .staff-performance-console,
#staff .staff-performance-workload {
  position: relative;
  overflow: hidden;
  border: 1px solid #bfd3eb;
  border-radius: 18px;
  background:
    radial-gradient(circle at 96% 0%, rgba(37, 99, 235, 0.10), transparent 30%),
    radial-gradient(circle at 12% 100%, rgba(20, 184, 166, 0.08), transparent 28%),
    linear-gradient(145deg, #ffffff 0%, #fbfdff 100%);
  box-shadow:
    0 10px 28px rgba(15, 23, 42, 0.08),
    inset 0 1px 0 rgba(255, 255, 255, 0.9);
}

#staff .staff-performance-console::before,
#staff .staff-performance-workload::before {
  position: absolute;
  inset: 0 auto 0 0;
  width: 5px;
  background: linear-gradient(180deg, #2563eb, #14b8a6);
  content: "";
}

#staff .staff-selector {
  max-width: 340px;
  margin-bottom: 14px;
}

#staff .staff-selector select {
  min-height: 42px;
  border-radius: 12px;
  border-color: #bfdbfe;
  background: #ffffff;
  box-shadow: 0 5px 14px rgba(37, 99, 235, 0.08);
}

#staff .staff-performance-actions {
  gap: 10px;
  margin-bottom: 16px;
}

#staff .staff-performance-actions .secondary-button {
  border-color: #bfdbfe;
  background: linear-gradient(145deg, #eff6ff 0%, #ffffff 100%);
  color: #1d4ed8;
  font-weight: 900;
  box-shadow: 0 7px 18px rgba(37, 99, 235, 0.10);
}

#staff .staff-performance-actions .secondary-button:nth-child(2) {
  border-color: #99f6e4;
  background: linear-gradient(145deg, #ecfeff 0%, #ffffff 100%);
  color: #0f766e;
}

#staff .staff-performance-metrics {
  gap: 16px;
}

#staff .staff-performance-metrics .metric-card {
  min-height: 132px;
  border-radius: 18px;
  box-shadow:
    0 8px 20px rgba(15, 23, 42, 0.07),
    inset 0 1px 0 rgba(255, 255, 255, 0.85);
  transition: transform 180ms ease, box-shadow 180ms ease, border-color 180ms ease;
}

#staff .staff-performance-metrics .metric-card span {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 7px 10px;
  border-radius: 9px;
}

#staff .staff-performance-metrics .metric-card strong {
  margin-top: 10px;
  font-size: 30px;
  line-height: 1;
}

#staff .staff-performance-metrics .metric-card p {
  margin-top: 6px;
  font-size: 13px;
}

#staff .staff-performance-workload {
  margin-top: 16px;
}

#staff .staff-performance-workload h3 {
  margin: 0 0 12px;
  color: #172554;
  font-size: 20px;
  letter-spacing: 0;
}

@media (max-width: 760px) {
  #staff .staff-performance-actions {
    align-items: stretch;
    flex-direction: column;
  }

  #staff .staff-selector {
    max-width: none;
  }
}

.expense-overview-card,
.expense-form,
.expense-tools-card,
.transaction-side-card,
.cash-balance-card,
.transactions-page-head {
  border-color: #bfd3eb;
  box-shadow:
    0 7px 20px rgba(15, 23, 42, 0.07),
    inset 0 1px 0 rgba(255, 255, 255, 0.9);
}

.expense-form,
.expense-tools-card,
.transaction-side-card {
  background: linear-gradient(145deg, #ffffff 0%, #fbfdff 100%);
}

.cash-balance-card {
  border: 1px solid #bfd3eb;
}

.correction-required-table th,
.correction-required-table td {
  white-space: nowrap;
}

.correction-required-table .correction-reason-cell {
  min-width: 260px;
  max-width: 420px;
  white-space: normal;
  line-height: 1.45;
}

/* Staff performance and transaction polish */
.dashboard-maker-tag {
  display: inline-flex;
  margin-top: 7px;
  padding: 5px 10px;
  border: 1px solid #bfdbfe;
  border-radius: 999px;
  background: #eff6ff;
  color: #1d4ed8;
  font-size: 11px;
  font-weight: 900;
}

.staff-performance-metrics .metric-card {
  min-height: 126px;
  padding: 14px;
  border: 1px solid #c8d9ec;
  border-bottom-width: 4px;
  border-radius: 14px;
  background:
    radial-gradient(circle at top right, rgba(37, 99, 235, 0.08), transparent 38%),
    linear-gradient(145deg, #ffffff 0%, #fbfdff 65%, #f6f9ff 100%);
  color: #0f172a;
  box-shadow: 0 5px 15px rgba(15, 23, 42, 0.06);
}

.staff-performance-metrics .metric-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 9px 22px rgba(15, 23, 42, 0.10);
}

.staff-performance-metrics .metric-card::after {
  display: none;
}

.staff-performance-metrics .metric-card span {
  color: #2563eb;
  background: #e8efff;
}

.staff-performance-metrics .metric-card strong {
  color: #0f172a;
}

.staff-performance-metrics .metric-card p {
  color: #64748b;
  opacity: 1;
}

.staff-performance-metrics .metric-card.grad-red { border-bottom-color: #ef4444; }
.staff-performance-metrics .metric-card.grad-yellow { border-bottom-color: #f59e0b; }
.staff-performance-metrics .metric-card.grad-green,
.staff-performance-metrics .metric-card.grad-darkgreen { border-bottom-color: #14b8a6; }
.staff-performance-metrics .metric-card.grad-slate { border-bottom-color: #475569; }
.staff-performance-metrics .metric-card.grad-blue { border-bottom-color: #2563eb; }

.expense-overview-card,
.expense-form,
.expense-tools-card,
.transaction-side-card,
.cash-balance-card,
.transactions-page-head {
  border-color: #bfd3eb;
  box-shadow:
    0 7px 20px rgba(15, 23, 42, 0.07),
    inset 0 1px 0 rgba(255, 255, 255, 0.9);
}

.expense-form,
.expense-tools-card,
.transaction-side-card {
  background: linear-gradient(145deg, #ffffff 0%, #fbfdff 100%);
}

.cash-balance-card {
  border: 1px solid #bfd3eb;
}

.correction-required-table th,
.correction-required-table td {
  white-space: nowrap;
}

.correction-required-table .correction-reason-cell {
  min-width: 260px;
  max-width: 420px;
  white-space: normal;
  line-height: 1.45;
}

/* Final dashboard action-bar guards. These sit last because older theme layers
   repeat topbar rules for different deployments. */
.dashboard-topbar .top-action-sample {
  margin-left: 0 !important;
}

.dashboard-topbar .top-actions {
  justify-content: flex-end;
}

.dashboard-topbar .top-icon-action {
  flex: 0 0 auto;
  width: 46px;
  min-width: 46px;
  height: 46px;
}

/* Transactions: scoped expense register column sizing */
.expense-register-table .voucher-column,
.expense-register-table .voucher-cell {
  width: 90px;
  min-width: 80px;
  max-width: 110px;
  white-space: nowrap;
}

.expense-register-table .voucher-cell {
  overflow: hidden;
  text-overflow: ellipsis;
}

.expense-register-table .amount-column,
.expense-register-table .amount-cell.amount-column {
  width: 110px;
  min-width: 100px;
  max-width: 125px;
  text-align: right;
  white-space: nowrap;
}

.expense-register-table .expense-item-column,
.expense-register-table .expense-item-cell,
.expense-register-table .paid-to-column,
.expense-register-table .paid-to-cell {
  min-width: 190px;
}

.admin-opening-balance {
  border: 1px solid #bfdbfe;
  border-left: 5px solid #2563eb;
  background: linear-gradient(145deg, #ffffff 0%, #f8fbff 100%);
}

.admin-opening-balance .expense-card-head span {
  color: #1d4ed8;
  background: #dbeafe;
  border-color: #bfdbfe;
}

.admin-opening-balance .opening-balance-form {
  grid-template-columns: minmax(170px, 0.8fr) minmax(180px, 0.9fr) minmax(220px, 1fr);
}

/* Staff dashboard: match the main admin KPI card rhythm. */
.staff-modern-dashboard .staff-dashboard-kpi-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.staff-modern-dashboard .dashboard-kpi-card {
  min-height: 104px;
  padding: 12px;
  border-radius: 12px;
  border-bottom-width: 3px;
}

.staff-modern-dashboard .dashboard-kpi-top {
  gap: 8px;
}

.staff-modern-dashboard .dashboard-kpi-icon {
  width: 32px;
  height: 32px;
  border-radius: 10px;
}

.staff-modern-dashboard .dashboard-kpi-icon svg {
  width: 16px;
  height: 16px;
}

.staff-modern-dashboard .dashboard-kpi-title {
  font-size: 11px;
  line-height: 1.25;
  white-space: normal;
}

.staff-modern-dashboard .dashboard-kpi-card > strong {
  margin-top: 7px;
  font-size: 22px;
  line-height: 1;
}

.staff-modern-dashboard .dashboard-kpi-meta {
  margin-top: 5px;
  gap: 6px;
}

.staff-modern-dashboard .dashboard-kpi-meta small {
  font-size: 10px;
  line-height: 1.2;
}

.staff-modern-dashboard .dashboard-kpi-trend {
  height: 16px;
}

/* Notifications: keep per-item read actions visible and mobile-friendly. */
.notification-actions {
  justify-content: flex-end;
}

.notification-read-button {
  min-width: 58px;
}

.notification-read-button:disabled {
  opacity: 0.55;
  cursor: default;
}

@media (max-width: 680px) {
  .modern-drawer-head .drawer-head-actions {
    flex-wrap: wrap;
    justify-content: flex-end;
  }

  .notification-actions {
    grid-column: 1 / -1;
    justify-content: flex-start;
  }
}

/* Staff Details module */
.staff-details-shell {
  display: grid;
  gap: 16px;
}

.staff-details-hero,
.staff-form-head,
.celebration-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.staff-details-hero {
  padding: 18px;
  border: 1px solid #d7e3f1;
  border-radius: 16px;
  background: linear-gradient(145deg, #ffffff 0%, #fbfdff 100%);
  box-shadow: 0 5px 15px rgba(15, 23, 42, 0.06);
}

.staff-details-hero h3,
.staff-profile-summary h3 {
  margin: 0;
  color: #0f172a;
}

.staff-details-hero p,
.staff-form-head p,
.staff-profile-summary p {
  margin: 4px 0 0;
  color: #64748b;
}

.staff-details-actions,
.staff-form-actions,
.staff-details-filter-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  justify-content: flex-end;
}

.staff-summary-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(170px, 1fr));
  gap: 12px;
}

.staff-summary-card {
  cursor: default;
}

.staff-form-panel,
.staff-details-panel,
.staff-profile-panel,
.staff-celebration-card {
  border: 1px solid #d7e3f1;
  background: linear-gradient(145deg, #ffffff 0%, #fbfdff 100%);
  box-shadow: 0 5px 15px rgba(15, 23, 42, 0.06);
}

.staff-entry-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 14px 0;
}

.staff-entry-tabs button {
  padding: 10px 12px;
  border: 1px solid #d7e3f1;
  border-radius: 999px;
  background: #ffffff;
  color: #475569;
  font-weight: 850;
  cursor: pointer;
}

.staff-entry-tabs button.active {
  color: #1d4ed8;
  background: #eaf2ff;
  border-color: #93c5fd;
}

.staff-details-form,
.staff-details-filter-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.staff-user-search,
.staff-user-picker,
.staff-form-errors,
.staff-form-actions {
  grid-column: 1 / -1;
}

.staff-other-department {
  transition: opacity 160ms ease;
}

.staff-form-errors {
  display: grid;
  gap: 6px;
}

.staff-form-errors p {
  margin: 0;
  padding: 8px 10px;
  border-radius: 10px;
  background: #fee2e2;
  color: #991b1b;
  font-weight: 800;
}

.staff-details-table-wrap {
  margin-top: 12px;
}

.staff-details-table th,
.staff-details-table td {
  white-space: nowrap;
}

.staff-avatar,
.celebration-avatar {
  display: inline-grid;
  width: 38px;
  height: 38px;
  place-items: center;
  border-radius: 12px;
  overflow: hidden;
  background: linear-gradient(135deg, #dbeafe, #ccfbf1);
  color: #0f766e;
  font-size: 12px;
  font-weight: 900;
}

.staff-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.staff-status {
  display: inline-flex;
  width: fit-content;
  padding: 5px 9px;
  border-radius: 999px;
  background: #e0f2fe;
  color: #075985;
  font-size: 11px;
  font-weight: 900;
}

.status-resigned,
.status-terminated,
.status-inactive {
  background: #fee2e2;
  color: #991b1b;
}

.status-on-leave {
  background: #fef3c7;
  color: #92400e;
}

.staff-profile {
  display: grid;
  gap: 16px;
}

.staff-profile-summary {
  display: flex;
  align-items: center;
  gap: 14px;
}

.staff-profile-summary .staff-avatar {
  width: 58px;
  height: 58px;
  border-radius: 18px;
  font-size: 16px;
}

.staff-profile-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.staff-profile-grid section {
  padding: 14px;
  border: 1px solid #d7e3f1;
  border-radius: 14px;
  background: #ffffff;
}

.staff-profile-grid h4 {
  margin: 0 0 10px;
  color: #0f172a;
}

.staff-profile-grid section div {
  display: grid;
  gap: 2px;
  padding: 7px 0;
  border-top: 1px solid #eef2f7;
}

.staff-profile-grid span {
  color: #64748b;
  font-size: 11px;
  font-weight: 800;
}

.staff-profile-grid strong {
  color: #0f172a;
  font-size: 13px;
}

.staff-celebration-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.celebration-section {
  display: grid;
  gap: 12px;
  min-height: 190px;
  padding: 14px;
  border: 1px solid #d7e3f1;
  border-radius: 14px;
  background: #ffffff;
}

.celebration-birthday {
  border-left: 4px solid #a855f7;
}

.celebration-anniversary {
  border-left: 4px solid #2563eb;
}

.celebration-section-head span {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border-radius: 12px;
  color: #7c3aed;
  background: #f3e8ff;
}

.celebration-anniversary .celebration-section-head span {
  color: #1d4ed8;
  background: #dbeafe;
}

.celebration-section-head svg {
  width: 18px;
  height: 18px;
  fill: currentColor;
}

.celebration-section-head strong {
  flex: 1;
  min-width: 0;
}

.celebration-list {
  display: grid;
  gap: 10px;
}

.celebration-row {
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
}

.celebration-row strong,
.celebration-row p {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.celebration-row p {
  margin: 2px 0 0;
  color: #64748b;
  font-size: 12px;
  font-weight: 750;
}

@media (max-width: 1100px) {
  .staff-summary-grid,
  .staff-profile-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .staff-details-form,
  .staff-details-filter-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 760px) {
  .staff-details-hero,
  .staff-form-head {
    align-items: stretch;
    flex-direction: column;
  }

  .staff-summary-grid,
  .staff-details-form,
  .staff-details-filter-grid,
  .staff-profile-grid,
  .staff-celebration-grid {
    grid-template-columns: 1fr;
  }

  .staff-details-actions {
    justify-content: flex-start;
  }
}

.admin-opening-balance .opening-balance-list .amount-col,
.admin-opening-balance .opening-balance-list .amount-cell {
  text-align: right;
  white-space: nowrap;
}

@media (max-width: 760px) {
  .expense-register-table .expense-item-column,
  .expense-register-table .expense-item-cell,
  .expense-register-table .paid-to-column,
  .expense-register-table .paid-to-cell {
    min-width: 160px;
  }

  .admin-opening-balance .opening-balance-form {
    grid-template-columns: 1fr;
  }
}

/* Team Chat direct-message refresh */
.team-chat-panel {
  width: min(1180px, calc(100vw - 28px));
  max-width: 1180px;
}

.team-chat-panel .drawer-head {
  min-width: 0;
  border-bottom: 1px solid #d7e3f1;
}

.modern-chat-body {
  display: grid;
  grid-template-columns: minmax(330px, 380px) minmax(0, 1fr);
  height: min(90vh, 820px);
  min-height: 620px;
  padding: 0;
  overflow: hidden;
  background: #f8fafc;
}

.chat-sidebar,
.chat-conversation-panel,
.chat-sidebar-top,
.chat-conversation-copy,
.chat-active-copy {
  min-width: 0;
}

.chat-sidebar {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 0;
  position: relative;
  padding: 0;
  border-right: 1px solid #d7e3f1;
  background: #f3f6fa;
}

.chat-sidebar-top {
  display: grid;
  gap: 12px;
  padding: 16px;
  border-bottom: 1px solid #d7e3f1;
  background: #ffffff;
}

.chat-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.chat-title-row strong {
  display: block;
  color: #0f172a;
  font-size: 18px;
  font-weight: 900;
}

.chat-title-row span {
  color: #64748b;
  font-size: 12px;
}

.chat-new-button,
.chat-filter-chip,
.new-chat-mode button,
.chat-head-icon,
.chat-mobile-back,
.chat-search-clear {
  border: 1px solid #d7e3f1;
  background: #ffffff;
  color: #172554;
  cursor: pointer;
}

.chat-new-button {
  padding: 9px 12px;
  border-radius: 999px;
  background: linear-gradient(135deg, #2563eb, #7c3aed);
  color: #ffffff;
  font-weight: 900;
  box-shadow: 0 7px 18px rgba(37, 99, 235, 0.22);
}

.chat-search-wrap {
  display: grid;
  grid-template-columns: 20px minmax(0, 1fr) 26px;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  padding: 0 10px;
  border: 1px solid #cbd5e1;
  border-radius: 14px;
  background: #f8fafc;
}

.chat-search-wrap svg {
  width: 18px;
  height: 18px;
  fill: #64748b;
}

.chat-search-wrap input {
  width: 100%;
  min-width: 0;
  min-height: 40px;
  padding: 0;
  border: 0;
  outline: 0;
  background: transparent;
}

.chat-search-wrap:focus-within {
  border-color: #60a5fa;
  box-shadow: 0 0 0 3px rgba(96, 165, 250, 0.18);
}

.chat-search-clear {
  display: grid;
  width: 24px;
  height: 24px;
  place-items: center;
  border-radius: 999px;
  color: #64748b;
  font-weight: 900;
}

.chat-filter-tabs,
.new-chat-mode {
  display: flex;
  gap: 8px;
  overflow-x: auto;
}

.chat-filter-chip,
.new-chat-mode button {
  flex: 0 0 auto;
  padding: 8px 11px;
  border-radius: 999px;
  color: #475569;
  font-size: 12px;
  font-weight: 850;
}

.chat-filter-chip.active,
.new-chat-mode button.active {
  color: #1d4ed8;
  background: #eaf2ff;
  border-color: #93c5fd;
}

.new-chat-panel {
  display: grid;
  gap: 10px;
  position: absolute;
  top: 138px;
  left: 12px;
  right: 12px;
  z-index: 8;
  padding: 12px;
  border: 1px solid #d7e3f1;
  border-radius: 16px;
  background: #fbfdff;
  box-shadow: 0 18px 42px rgba(15, 23, 42, 0.18);
}

.new-chat-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  color: #0f172a;
  font-weight: 900;
}

.new-chat-panel input {
  width: 100%;
  min-height: 38px;
  border: 1px solid #d7e3f1;
  border-radius: 10px;
  background: #ffffff;
}

.new-chat-user-list {
  display: grid;
  gap: 8px;
  max-height: min(330px, 46vh);
  overflow: auto;
}

.new-chat-user {
  display: grid;
  grid-template-columns: auto 38px minmax(0, 1fr) auto;
  gap: 9px;
  align-items: center;
  width: 100%;
  padding: 8px;
  border: 1px solid #e2e8f0;
  border-radius: 13px;
  background: #ffffff;
  color: #0f172a;
  text-align: left;
}

button.new-chat-user {
  grid-template-columns: 38px minmax(0, 1fr) auto;
  cursor: pointer;
}

.new-chat-user strong,
.new-chat-user small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.new-chat-user small {
  color: #64748b;
  font-size: 11px;
}

.new-chat-user em {
  color: #2563eb;
  font-style: normal;
  font-size: 12px;
  font-weight: 900;
}

.create-group-button {
  width: 100%;
}

.chat-conversation-list {
  display: grid;
  align-content: start;
  gap: 7px;
  min-height: 0;
  padding: 10px;
  overflow-y: auto;
}

.chat-conversation-item {
  display: grid;
  grid-template-columns: 46px minmax(0, 1fr) auto;
  gap: 11px;
  align-items: center;
  width: 100%;
  min-width: 0;
  padding: 10px;
  border: 1px solid transparent;
  border-radius: 16px;
  background: transparent;
  color: #0f172a;
  text-align: left;
}

.chat-conversation-item:hover {
  background: #ffffff;
  border-color: #d7e3f1;
}

.chat-conversation-item.active {
  background: linear-gradient(135deg, #eef2ff, #ecfeff);
  border-color: #93c5fd;
  box-shadow: 0 8px 20px rgba(37, 99, 235, 0.10);
}

.chat-conversation-item.unread .chat-user-name,
.chat-conversation-item.unread small {
  font-weight: 900;
  color: #0f172a;
}

.chat-avatar {
  display: grid;
  width: 44px;
  height: 44px;
  place-items: center;
  border-radius: 999px;
  background: linear-gradient(135deg, #2563eb, #14b8a6);
  color: #ffffff;
  font-size: 13px;
  font-weight: 950;
  box-shadow: 0 8px 18px rgba(37, 99, 235, 0.18);
}

.chat-conversation-copy {
  display: grid;
  gap: 3px;
}

.chat-user-name,
.chat-conversation-copy small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}

.chat-user-name {
  color: #0b1220;
  font-size: 15px;
  font-weight: 950;
}

.chat-conversation-copy small {
  color: #64748b;
  font-size: 12px;
  line-height: 1.25;
}

.chat-conversation-meta {
  display: grid;
  justify-items: end;
  gap: 5px;
  min-width: 42px;
  color: #94a3b8;
  font-size: 10px;
  white-space: nowrap;
}

.chat-conversation-meta em {
  min-width: 20px;
  padding: 3px 6px;
  border-radius: 999px;
  background: #2563eb;
  color: #ffffff;
  font-style: normal;
  font-size: 10px;
  font-weight: 950;
  text-align: center;
}

.chat-conversation-panel {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  min-width: 0;
  min-height: 0;
  background: #ffffff;
}

.chat-conversation-head {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  padding: 14px 18px;
  border-bottom: 1px solid #d7e3f1;
  background: rgba(255, 255, 255, 0.96);
}

.chat-active-copy {
  flex: 1 1 auto;
}

.chat-active-copy h4,
.chat-active-copy p {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chat-active-copy h4 {
  margin: 0;
  color: #0f172a;
  font-size: 16px;
}

.chat-active-copy p {
  margin: 2px 0 0;
  color: #64748b;
  font-size: 12px;
}

.chat-head-tools {
  display: flex;
  gap: 8px;
}

.chat-head-icon,
.chat-mobile-back {
  display: grid;
  width: 36px;
  height: 36px;
  place-items: center;
  border-radius: 999px;
}

.chat-head-icon svg,
.chat-mobile-back svg {
  width: 17px;
  height: 17px;
  fill: currentColor;
}

.chat-mobile-back {
  display: none;
}

.modern-chat-body .chat-messages {
  display: grid;
  align-content: start;
  gap: 8px;
  min-height: 0;
  padding: 18px;
  overflow-y: auto;
  background:
    radial-gradient(circle at top left, rgba(59, 130, 246, 0.08), transparent 30%),
    #ffffff;
}

.chat-date-separator {
  justify-self: center;
  margin: 8px 0;
  padding: 5px 11px;
  border-radius: 999px;
  background: #f1f5f9;
  color: #64748b;
  font-size: 11px;
  font-weight: 850;
}

.modern-chat-body .chat-message {
  justify-self: start;
  max-width: min(68%, 560px);
  padding: 9px 12px;
  border: 1px solid #e2e8f0;
  border-radius: 18px 18px 18px 6px;
  background: #f8fafc;
  color: #0f172a;
  box-shadow: 0 5px 14px rgba(15, 23, 42, 0.05);
}

.modern-chat-body .chat-message.own {
  justify-self: end;
  border-color: transparent;
  border-radius: 18px 18px 6px 18px;
  background: linear-gradient(135deg, #2563eb, #7c3aed);
  color: #ffffff;
}

.chat-message .chat-meta {
  display: grid;
  gap: 2px;
  margin-bottom: 4px;
}

.chat-message .chat-meta strong {
  color: #1d4ed8;
  font-size: 11px;
  font-weight: 900;
}

.chat-message .chat-meta span {
  color: #64748b;
  font-size: 10px;
}

.chat-message.own .chat-meta span {
  color: rgba(255, 255, 255, 0.82);
}

.chat-message p {
  margin: 0;
  color: inherit;
  font-size: 14px;
  line-height: 1.45;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.modern-chat-body .chat-compose {
  margin: 0;
  padding: 12px;
  border-width: 1px 0 0;
  border-color: #d7e3f1;
  border-radius: 0;
  background: #ffffff;
  box-shadow: 0 -8px 20px rgba(15, 23, 42, 0.04);
}

.chat-composer-line {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) 42px;
  gap: 10px;
  align-items: end;
}

.chat-composer-line textarea {
  min-height: 42px;
  max-height: 132px;
  width: 100%;
  min-width: 0;
  padding: 11px 13px;
  resize: none;
  border: 1px solid #d7e3f1;
  border-radius: 16px;
  background: #f8fafc;
  line-height: 1.35;
  overflow-y: auto;
}

.chat-composer-line textarea:focus {
  border-color: #60a5fa;
  box-shadow: 0 0 0 3px rgba(96, 165, 250, 0.18);
}

.chat-tool-button,
.chat-send-button {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border-radius: 999px;
}

.chat-tool-button {
  border: 1px solid #c7d2fe;
  background: #eef2ff;
  color: #4f46e5;
}

.chat-send-button {
  border: 0;
  background: linear-gradient(135deg, #2563eb, #0891b2);
  color: #ffffff;
  cursor: pointer;
}

.chat-send-button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

.chat-tool-button svg,
.chat-send-button svg {
  width: 18px;
  height: 18px;
  fill: currentColor;
}

.chat-attachment-preview {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
  padding: 8px 10px;
  border: 1px solid #d7e3f1;
  border-radius: 12px;
  background: #f8fafc;
  color: #334155;
  font-size: 12px;
}

.chat-attachment-preview button {
  border: 0;
  background: transparent;
  color: #dc2626;
  font-weight: 900;
  cursor: pointer;
}

.chat-empty-state {
  padding: 18px;
  border: 1px dashed #cbd5e1;
  border-radius: 16px;
  background: #ffffff;
  color: #64748b;
  text-align: center;
  font-size: 13px;
  font-weight: 750;
}

@media (max-width: 900px) {
  .modern-chat-body {
    grid-template-columns: minmax(280px, 330px) minmax(0, 1fr);
    min-height: 560px;
  }

  .modern-chat-body .chat-message {
    max-width: 82%;
  }
}

@media (max-width: 680px) {
  .team-chat-panel {
    width: 100vw;
    max-width: 100vw;
  }

  .modern-chat-body {
    grid-template-columns: 1fr;
    height: calc(100vh - 70px);
    min-height: 0;
  }

  .chat-conversation-panel {
    display: none;
  }

  .team-chat-panel.chat-mobile-open .chat-sidebar {
    display: none;
  }

  .team-chat-panel.chat-mobile-open .chat-conversation-panel {
    display: grid;
  }

  .chat-mobile-back {
    display: grid;
  }

  .modern-chat-body .chat-message {
    max-width: 90%;
  }
}

/* Filing Index inspired operations theme */
:root,
body.theme-professional,
body.theme-default,
body.theme-clean {
  --ops-bg: #f4f6f8;
  --ops-sidebar: #14181b;
  --ops-sidebar-soft: #1f252a;
  --ops-sidebar-active: #303437;
  --ops-sidebar-line: #2a3035;
  --ops-text: #111827;
  --ops-muted: #667085;
  --ops-line: #dce3ea;
  --ops-card: #ffffff;
  --ops-teal: #00a98f;
  --ops-red: #ef4444;
  --ops-blue: #4775ff;
  --ops-orange: #f59e2f;
  --ops-purple: #8b5cf6;
}

body {
  background: var(--ops-bg);
  color: var(--ops-text);
}

.app-shell,
.app-shell.sidebar-collapsed {
  grid-template-columns: 324px minmax(0, 1fr);
  min-height: 100vh;
  background: var(--ops-bg);
}

.sidebar,
.sidebar.collapsed {
  padding: 0;
  color: #d7dee6;
  background: var(--ops-sidebar);
  border-right: 0;
  box-shadow: none;
}

.sidebar .brand,
.sidebar.collapsed .brand {
  min-height: 136px;
  grid-template-columns: 50px minmax(0, 1fr);
  gap: 14px;
  align-content: center;
  padding: 22px 26px;
  border-bottom: 1px solid var(--ops-sidebar-line);
}

.sidebar .brand-mark,
.sidebar.collapsed .brand-mark {
  width: 50px;
  height: 50px;
  border-radius: 14px;
  color: #0f172a;
  background: linear-gradient(145deg, #ffffff, #f7fbff);
  border: 1px solid rgba(215, 227, 241, 0.95);
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.18);
}

.sidebar .brand-mark svg {
  width: 21px;
  height: 21px;
  color: var(--ops-red);
}

.ca-logo-mark {
  position: relative;
  display: grid;
  place-items: center;
  overflow: hidden;
  font-weight: 950;
  letter-spacing: -0.04em;
}

.ca-logo-mark img {
  display: block;
  width: 42px;
  height: 42px;
  object-fit: contain;
}

.brand-text-only,
.sidebar.collapsed .brand-text-only {
  display: block;
}

.brand-text-only h1 {
  color: #ffffff;
  font-size: 23px;
  line-height: 1.05;
  font-weight: 850;
}

.brand-text-only h1 span,
.brand-text-only h1 em {
  color: #ffffff;
  font-weight: 850;
}

.brand-text-only .brand-byline {
  margin-top: 6px;
  color: #8da0ad;
  font-size: 13px;
  font-weight: 650;
}

.brand-text-only .brand-subline {
  margin: 3px 0 0;
  color: #7f93a3;
  font-size: 12px;
  font-weight: 650;
}

.sidebar-collapse-button {
  display: none;
}

.nav {
  padding: 18px 14px 24px;
  scrollbar-color: #b8c2cc transparent;
}

.nav-group {
  margin-bottom: 22px;
}

.nav-section-title,
.sidebar.collapsed .nav-section-title {
  height: auto;
  min-height: 26px;
  padding: 0 14px 10px;
  color: #8fb1bd;
  font-size: 12px;
  font-weight: 850;
  letter-spacing: 0.16em;
}

.nav-section-title span,
.sidebar.collapsed .nav-section-title span {
  display: inline;
}

.nav-section-title strong {
  color: #98a8b4;
}

.nav .nav-item,
.sidebar.collapsed .nav .nav-item {
  min-height: 52px;
  grid-template-columns: 28px minmax(0, 1fr) auto;
  gap: 10px;
  margin: 2px 0;
  padding: 0 14px;
  color: #cbd5df;
  background: transparent;
  border: 0;
  border-radius: 12px;
  font-size: 15px;
  font-weight: 650;
  transform: none;
}

.nav .nav-item::before {
  top: 0;
  bottom: 0;
  left: 0;
  width: 4px;
  border-radius: 12px 0 0 12px;
}

.nav .nav-icon {
  width: 28px;
  height: 28px;
  color: #c9d5df;
  background: transparent;
  border-radius: 8px;
}

.nav .nav-label,
.sidebar.collapsed .nav-label {
  display: block;
  white-space: nowrap;
}

.nav .nav-item:hover {
  color: #ffffff;
  background: var(--ops-sidebar-soft);
  border-color: transparent;
  transform: none;
}

.nav .nav-item.active {
  color: #ffffff;
  background: var(--ops-sidebar-active);
  border-color: transparent;
  box-shadow: inset 4px 0 0 var(--ops-red);
}

.nav .nav-item.active::before {
  background: transparent;
}

.nav .nav-item.active .nav-icon {
  color: #ffffff;
  background: transparent;
}

.nav-badge,
.sidebar.collapsed .nav-badge {
  display: inline-grid;
  min-width: 42px;
  height: 22px;
  padding: 0 8px;
  color: #cfd8df;
  background: #343a40;
  font-size: 11px;
  font-weight: 850;
}

.nav-item.active .nav-badge,
.nav-badge-active,
.nav-badge-myTask {
  color: #ffffff;
  background: var(--ops-red);
}

.nav-badge-notChecked,
.nav-badge-feePending {
  color: #111827;
  background: #f4b63b;
}

.nav-badge-completed,
.nav-badge-billed {
  color: #ffffff;
  background: var(--ops-teal);
}

.nav-badge-nonBilled {
  color: #ffffff;
  background: var(--ops-orange);
}

.current-user-card,
.sidebar.collapsed .current-user-card {
  min-height: 78px;
  grid-template-columns: 42px minmax(0, 1fr) 34px;
  gap: 12px;
  margin: 0;
  padding: 14px 24px;
  color: #dce6ef;
  background: transparent;
  border: 0;
  border-top: 1px solid var(--ops-sidebar-line);
  border-radius: 0;
}

.profile-avatar {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  color: #008b78;
  background: #dff7f2;
  font-size: 14px;
}

.profile-copy,
.sidebar.collapsed .profile-copy,
.sidebar.collapsed .sidebar-logout-button {
  display: block;
}

.current-user-card span {
  color: #8da0ad;
  font-size: 11px;
  letter-spacing: 0.12em;
}

.current-user-card strong {
  color: #ffffff;
  font-size: 14px;
}

.current-user-card .small-muted {
  color: #9fadb8;
  font-size: 12px;
}

.sidebar-logout-button {
  color: #dce6ef;
  background: transparent;
  border: 1px solid var(--ops-sidebar-line);
}

.content {
  min-width: 0;
  padding: 0;
  background: var(--ops-bg);
}

.topbar {
  min-height: 102px;
  padding: 0 38px 0 34px;
  display: grid;
  grid-template-columns: minmax(220px, auto) minmax(0, 1fr) auto;
  align-items: center;
  gap: 24px;
  background: #ffffff;
  border-bottom: 1px solid var(--ops-line);
  box-shadow: none;
}

.topbar-title-block,
.topbar > div:first-child {
  min-width: 260px;
}

.topbar h2 {
  margin: 0;
  color: var(--ops-text);
  font-size: 28px;
  line-height: 1.1;
  font-weight: 850;
  letter-spacing: -0.02em;
}

.topbar p {
  margin: 6px 0 0;
  color: var(--ops-muted);
  font-size: 14px;
}

.top-actions {
  margin-left: auto;
  gap: 14px;
}

.icon-button,
.top-action-button,
.mini-button,
.secondary-button,
.primary-button {
  border-radius: 11px;
  letter-spacing: 0;
}

.icon-button {
  min-width: 50px;
  min-height: 50px;
  color: #111827;
  background: #ffffff;
  border: 1px solid var(--ops-line);
  box-shadow: none;
}

.top-action-button,
.secondary-button {
  min-height: 48px;
  color: #111827;
  background: #ffffff;
  border: 1px solid var(--ops-line);
  box-shadow: none;
}

.top-action-add,
.primary-button {
  color: #ffffff;
  background: var(--ops-teal);
  border-color: var(--ops-teal);
}

.top-action-sample {
  color: #ffffff;
  background: linear-gradient(135deg, #2563eb, #1d4ed8);
  border-color: #2563eb;
}

.top-action-import {
  color: #ffffff;
  background: linear-gradient(135deg, #0891b2, #0e7490);
  border-color: #0891b2;
}

.top-action-add {
  background: linear-gradient(135deg, #0f9f8c, #047857);
}

.top-action-profile {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  max-width: 210px;
  padding: 0 14px 0 8px;
  color: #0f172a;
  background: linear-gradient(135deg, #ecfeff, #e0f2fe);
  border-color: #bae6fd;
}

.topbar-profile-avatar {
  display: grid;
  flex: 0 0 auto;
  width: 34px;
  height: 34px;
  place-items: center;
  border-radius: 999px;
  background: linear-gradient(135deg, #99f6e4, #67e8f9);
  color: #0f766e;
  font-weight: 900;
}

.topbar-profile-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.daily-quote-slot {
  min-width: 0;
}

.daily-quote-slot.hidden {
  display: none;
}

.daily-quote-banner {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 44px;
  padding: 9px 14px;
  overflow: hidden;
  border: 1px solid #d8d7ff;
  border-radius: 14px;
  background: linear-gradient(90deg, #f4f7ff 0%, #f8f5ff 100%);
  box-shadow: 0 4px 14px rgba(30, 64, 175, 0.06);
}

.daily-quote-icon {
  display: grid;
  flex: 0 0 30px;
  width: 30px;
  height: 30px;
  place-items: center;
  border-radius: 10px;
  background: #eef2ff;
  color: #4f46e5;
  font-size: 15px;
}

.daily-quote-copy {
  display: flex;
  align-items: baseline;
  gap: 6px;
  min-width: 0;
  overflow: hidden;
}

.daily-quote-title {
  color: #1d4ed8;
  font-size: 13px;
  font-weight: 900;
  white-space: nowrap;
}

.daily-quote-text {
  min-width: 0;
  overflow: hidden;
  color: #172554;
  font-size: 14px;
  font-weight: 650;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.daily-quote-author {
  flex: 0 0 auto;
  color: #475569;
  font-size: 12px;
  font-weight: 700;
  opacity: 0.75;
  white-space: nowrap;
}

.dashboard-topbar {
  grid-template-columns: minmax(0, 1fr) auto;
  min-height: 70px;
  padding: 10px 34px;
}

.dashboard-topbar .topbar-title-block,
.dashboard-topbar > div:first-child {
  min-width: auto;
}

.dashboard-topbar .topbar-title-block,
.dashboard-topbar #pageTitle,
.dashboard-topbar #pageSubtitle {
  display: none;
}

.dashboard-topbar .top-actions {
  flex: 0 0 auto;
  flex-wrap: nowrap;
  gap: 8px;
  width: auto;
}

.dashboard-topbar .top-action-sample {
  margin-left: 0;
}

.dashboard-mode .page {
  padding-top: 14px;
}

.page {
  padding: 42px 34px;
}

.page.active {
  display: block;
}

.metrics,
.dashboard-main-metrics,
.staff-dashboard-metrics,
.report-card-grid {
  gap: 16px;
}

.dashboard-main-metrics,
.staff-dashboard-metrics,
.metrics {
  grid-template-columns: repeat(auto-fit, minmax(224px, 1fr));
}

.metric-card,
.dashboard-main-metrics .metric-card,
.staff-dashboard-metrics .metric-card,
.metrics .metric-card,
.status-summary-card {
  min-height: 150px;
  padding: 22px 20px 18px;
  align-items: start;
  color: var(--ops-text);
  background: var(--ops-card);
  border: 1px solid var(--ops-line);
  border-bottom: 4px solid #111827;
  border-left-width: 1px;
  border-radius: 12px;
  box-shadow: none;
  text-align: left;
}

.metric-card:hover,
.status-summary-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 14px 28px rgba(17, 24, 39, 0.08);
}

.metric-card span,
.status-summary-card span,
.dashboard-main-metrics .metric-card span,
.staff-dashboard-metrics .metric-card span,
.metrics .metric-card span {
  width: fit-content;
  min-height: 30px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  color: #111827;
  background: #edf1f5;
  border-radius: 10px;
  padding: 7px 10px;
  font-size: 12px;
  line-height: 1;
  font-weight: 850;
  text-transform: uppercase;
}

.metric-card strong,
.status-summary-card strong,
.dashboard-main-metrics .metric-card strong,
.staff-dashboard-metrics .metric-card strong,
.metrics .metric-card strong {
  margin-top: 16px;
  color: var(--ops-text);
  font-size: 32px;
  line-height: 1;
  font-weight: 850;
}

.metric-card p,
.status-summary-card p,
.dashboard-main-metrics .metric-card p,
.staff-dashboard-metrics .metric-card p,
.metrics .metric-card p {
  margin-top: 9px;
  color: var(--ops-muted);
  font-size: 14px;
  line-height: 1.35;
}

.metric-card.grad-blue,
.status-summary-card.tone-blue {
  border-bottom-color: var(--ops-blue);
}

.metric-card.grad-red,
.status-summary-card.tone-red {
  border-bottom-color: var(--ops-red);
}

.metric-card.grad-yellow,
.status-summary-card.tone-amber {
  border-bottom-color: var(--ops-orange);
}

.metric-card.grad-purple,
.status-summary-card.tone-purple {
  border-bottom-color: var(--ops-purple);
}

.metric-card.grad-green,
.metric-card.grad-darkgreen,
.status-summary-card.tone-green,
.status-summary-card.tone-cyan {
  border-bottom-color: var(--ops-teal);
}

.metric-card.grad-pink,
.status-summary-card.tone-pink {
  border-bottom-color: #f97316;
}

.metric-card.grad-slate,
.status-summary-card.tone-slate {
  border-bottom-color: #111827;
}

.metric-card.grad-blue span,
.status-summary-card.tone-blue span { color: var(--ops-blue); background: #e8efff; }
.metric-card.grad-red span,
.status-summary-card.tone-red span { color: var(--ops-red); background: #ffe8e8; }
.metric-card.grad-yellow span,
.status-summary-card.tone-amber span { color: var(--ops-orange); background: #fff1dc; }
.metric-card.grad-purple span,
.status-summary-card.tone-purple span { color: var(--ops-purple); background: #f0eaff; }
.metric-card.grad-green span,
.metric-card.grad-darkgreen span,
.status-summary-card.tone-green span,
.status-summary-card.tone-cyan span { color: var(--ops-teal); background: #ddf7f2; }
.metric-card.grad-pink span,
.status-summary-card.tone-pink span { color: #f97316; background: #ffeddc; }

.panel,
.dashboard-status-panel,
.dashboard-staff-summary-panel,
.staff-performance-panel,
.form-card,
.table-card,
.report-card,
.visitor-panel,
.expense-hero,
.expense-card,
.file-panel,
.user-panel {
  background: #ffffff;
  border: 1px solid var(--ops-line);
  border-radius: 14px;
  box-shadow: none;
}

.dashboard-section-title h3,
.staff-performance-head h3,
.panel h3,
.form-card h3 {
  color: var(--ops-text);
  letter-spacing: 0;
}

table th {
  color: #111827;
  background: #edf1f5;
}

table td {
  color: #182230;
}

.staff-summary-toggle {
  color: var(--ops-text);
  background: #ffffff;
  border: 0;
  border-bottom: 1px solid var(--ops-line);
}

.staff-summary-toggle strong {
  color: #ffffff;
  background: var(--ops-teal);
}

.correction-panel {
  display: grid;
  gap: 12px;
  padding: 14px;
  border: 1px solid #fecaca;
  border-left: 4px solid var(--ops-red);
  border-radius: 12px;
  background: #fff7f7;
}

.correction-history {
  display: grid;
  gap: 6px;
  color: #7f1d1d;
  font-size: 13px;
}

.correction-history strong {
  color: #991b1b;
}

.correction-history p,
.correction-reason-line {
  margin: 0;
  color: #991b1b;
  font-weight: 750;
}

.receipt-summary {
  display: block;
  margin-top: 6px;
  color: #047857;
  font-weight: 750;
}

.simple-modal {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.simple-modal.open {
  display: flex;
}

.simple-modal-card {
  width: min(560px, 100%);
  max-height: calc(100vh - 40px);
  overflow: auto;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 24px 70px rgba(15, 23, 42, 0.26);
}

.receipt-modal-card {
  width: min(720px, 100%);
}

.receipt-form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.receipt-form-grid .full-span {
  grid-column: 1 / -1;
}

.receipt-form-grid textarea {
  width: 100%;
  resize: vertical;
}

.receipt-status-row {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 12px;
  align-items: center;
  margin-top: 14px;
  padding: 12px 14px;
  border: 1px solid #d7e3f1;
  border-radius: 12px;
  background: linear-gradient(145deg, #ffffff 0%, #f8fbff 100%);
}

.receipt-status-row span {
  font-weight: 800;
  color: #334155;
}

.receipt-status-row strong {
  color: #0f172a;
  white-space: nowrap;
}

.receipt-status-row em {
  color: #64748b;
  font-size: 12px;
  font-style: normal;
  font-weight: 700;
}

.receipt-push-control {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 12px;
  padding: 12px 14px;
  border: 1px solid #bfdbfe;
  border-radius: 12px;
  background: #eff6ff;
  color: #1e3a8a;
  font-weight: 800;
}

.receipt-push-control input {
  width: 18px;
  height: 18px;
  accent-color: #2563eb;
}

.receipt-push-control.is-pushed {
  border-color: #99f6e4;
  background: #ecfdf5;
  color: #047857;
}

@media (max-width: 640px) {
  .receipt-form-grid,
  .receipt-status-row {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 880px) {
  .app-shell,
  .app-shell.sidebar-collapsed {
    grid-template-columns: 1fr;
  }

  .sidebar,
  .sidebar.collapsed {
    width: min(324px, 88vw);
  }

  .sidebar .brand,
  .sidebar.collapsed .brand {
    min-height: 128px;
    padding: 22px;
  }

  .topbar {
    min-height: auto;
    padding: 18px;
    align-items: flex-start;
    flex-direction: column;
  }

  .top-actions {
    width: 100%;
    margin-left: 0;
    justify-content: flex-start;
    overflow-x: auto;
  }

  .page {
    padding: 22px 16px;
  }

  .dashboard-main-metrics,
  .staff-dashboard-metrics,
  .metrics {
    grid-template-columns: 1fr;
  }
}

/* Main dashboard theme inspired by the reference operations dashboard */
:root {
  --dash-bg: #f5f7fb;
  --dash-sidebar: #0f1d33;
  --dash-sidebar-soft: #17233c;
  --dash-text: #0f172a;
  --dash-muted: #64748b;
  --dash-line: #dbe4f0;
  --dash-card: #ffffff;
  --dash-blue: #2563eb;
  --dash-cyan: #0891b2;
  --dash-teal: #0f9f8c;
  --dash-green: #059669;
  --dash-amber: #f59e0b;
  --dash-red: #ef4444;
  --dash-purple: #7c3aed;
}

body,
.main,
.page {
  background: var(--dash-bg);
}

.sidebar,
.sidebar.collapsed {
  background: linear-gradient(180deg, var(--dash-sidebar-soft) 0%, var(--dash-sidebar) 100%);
  border-right: 1px solid rgba(148, 163, 184, 0.18);
}

.sidebar .brand,
.sidebar.collapsed .brand {
  background: rgba(15, 23, 42, 0.22);
  border-bottom: 1px solid rgba(148, 163, 184, 0.18);
}

.nav-section-label {
  color: #93b7c8;
  letter-spacing: 0.16em;
}

.nav-item {
  color: #cbd5e1;
}

.nav-item:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #ffffff;
}

.nav-item.active {
  background: linear-gradient(135deg, #2563eb, #0891b2);
  color: #ffffff;
  border-left: 4px solid #60a5fa;
  box-shadow: 0 12px 24px rgba(37, 99, 235, 0.22);
}

.nav-badge {
  background: #303842;
  color: #e2e8f0;
}

.nav-item.active .nav-badge {
  background: var(--dash-red);
  color: #ffffff;
}

.modern-dashboard {
  display: grid;
  gap: 12px;
}

.dashboard-topbar-card,
.dashboard-data-card,
.dashboard-kpi-card {
  background: linear-gradient(145deg, #ffffff 0%, #fbfdff 100%);
  border: 1px solid #c8d9ec;
  border-radius: 14px;
  box-shadow:
    0 5px 15px rgba(15, 23, 42, 0.06),
    inset 0 1px 0 rgba(255, 255, 255, 0.9);
}

.dashboard-data-card,
.dashboard-kpi-card,
.dashboard-topbar-card {
  transition: transform 160ms ease, box-shadow 160ms ease, border-color 160ms ease;
}

.dashboard-data-card:hover,
.dashboard-kpi-card:hover,
.dashboard-topbar-card:hover {
  transform: translateY(-2px);
  box-shadow:
    0 9px 22px rgba(15, 23, 42, 0.10),
    inset 0 1px 0 rgba(255, 255, 255, 0.95);
}

.dashboard-compact-filterbar {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 38px;
  flex: 0 0 auto;
  flex-wrap: nowrap;
  white-space: nowrap;
}

.dashboard-topbar-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 16px;
  border-color: #c5d7eb;
  background:
    radial-gradient(circle at top right, rgba(37, 99, 235, 0.08), transparent 42%),
    linear-gradient(145deg, #ffffff 0%, #fbfdff 100%);
}

.dashboard-eyebrow {
  display: block;
  margin-bottom: 4px;
  color: #5f7184;
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.15em;
  text-transform: uppercase;
}

.dashboard-greeting h2 {
  margin: 0;
  color: var(--dash-text);
  font-size: 24px;
  line-height: 1.05;
}

.dashboard-greeting p {
  margin: 6px 0 0;
  color: var(--dash-muted);
  font-size: 13px;
}

.dashboard-date-pill,
.dashboard-filter-pill,
.dashboard-period-select {
  min-height: 36px;
  border: 1px solid var(--dash-line);
  border-radius: 10px;
  background: #ffffff;
  color: var(--dash-text);
  font-weight: 800;
}

.dashboard-date-pill,
.dashboard-filter-pill {
  display: inline-flex;
  align-items: center;
  padding: 0 12px;
  font-size: 12px;
}

.dashboard-filter-pill {
  cursor: pointer;
}

.dashboard-visitor-row > span {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border-radius: 999px;
  background: #d9f8f2;
  color: #04796c;
  font-weight: 900;
}

.dashboard-kpi-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(148px, 1fr));
  gap: 10px;
}

.dashboard-kpi-card {
  --kpi-accent: var(--dash-blue);
  --kpi-border: #93c5fd;
  --kpi-shade: rgba(37, 99, 235, 0.08);
  --kpi-icon-start: #3b82f6;
  --kpi-icon-end: #2563eb;
  min-height: 126px;
  padding: 14px;
  background:
    radial-gradient(circle at top right, var(--kpi-shade), transparent 38%),
    linear-gradient(145deg, #ffffff 0%, #fbfdff 65%, #f6f9ff 100%);
  text-align: left;
  cursor: pointer;
  border-color: var(--kpi-border);
  border-bottom-width: 4px;
}

.dashboard-kpi-card:hover {
  border-color: var(--kpi-accent);
}

.dashboard-kpi-top {
  display: flex;
  align-items: center;
  gap: 10px;
}

.dashboard-kpi-icon {
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  border-radius: 11px;
  background: linear-gradient(135deg, var(--kpi-icon-start), var(--kpi-icon-end));
  color: #ffffff;
  box-shadow: 0 12px 24px color-mix(in srgb, var(--kpi-accent) 28%, transparent);
}

.dashboard-kpi-icon svg {
  width: 19px;
  height: 19px;
  fill: currentColor;
}

.dashboard-kpi-title {
  color: #475569;
  font-size: 11.5px;
  font-weight: 900;
  line-height: 1.25;
}

.dashboard-kpi-card > strong {
  display: block;
  margin-top: 10px;
  color: var(--dash-text);
  font-size: 26px;
  font-weight: 900;
  line-height: 1;
}

.dashboard-kpi-card .negative-amount {
  color: var(--dash-red);
}

.dashboard-kpi-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: 6px;
}

.dashboard-kpi-meta small {
  color: var(--dash-muted);
  font-size: 10.5px;
  text-align: right;
}

.kpi-trend {
  flex: 0 0 auto;
  font-size: 11px;
  font-weight: 900;
}

.kpi-trend.positive {
  color: var(--dash-green);
}

.kpi-trend.negative {
  color: var(--dash-red);
}

.dashboard-mini-trend {
  width: 100%;
  height: 22px;
  margin-top: 8px;
}

.dashboard-mini-trend polyline {
  fill: none;
  stroke: var(--kpi-accent);
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 3;
}

.kpi-active {
  --kpi-accent: #2563eb;
  --kpi-border: #93c5fd;
  --kpi-shade: rgba(37, 99, 235, 0.1);
  --kpi-icon-start: #3b82f6;
  --kpi-icon-end: #2563eb;
}

.kpi-received {
  --kpi-accent: #059669;
  --kpi-border: #86efac;
  --kpi-shade: rgba(5, 150, 105, 0.1);
  --kpi-icon-start: #34d399;
  --kpi-icon-end: #059669;
}

.kpi-wip {
  --kpi-accent: #d97706;
  --kpi-border: #fcd34d;
  --kpi-shade: rgba(245, 158, 11, 0.12);
  --kpi-icon-start: #fbbf24;
  --kpi-icon-end: #f59e0b;
}

.kpi-completed {
  --kpi-accent: #7c3aed;
  --kpi-border: #c4b5fd;
  --kpi-shade: rgba(124, 58, 237, 0.1);
  --kpi-icon-start: #8b5cf6;
  --kpi-icon-end: #6d28d9;
}

.kpi-overdue {
  --kpi-accent: #dc2626;
  --kpi-border: #fca5a5;
  --kpi-shade: rgba(239, 68, 68, 0.11);
  --kpi-icon-start: #fb7185;
  --kpi-icon-end: #ef4444;
}

.kpi-notchecked,
.kpi-cash {
  --kpi-accent: #0891b2;
  --kpi-border: #67e8f9;
  --kpi-shade: rgba(8, 145, 178, 0.1);
  --kpi-icon-start: #22d3ee;
  --kpi-icon-end: #0891b2;
}

.kpi-billed {
  --kpi-accent: #059669;
  --kpi-border: #86efac;
  --kpi-shade: rgba(5, 150, 105, 0.1);
  --kpi-icon-start: #34d399;
  --kpi-icon-end: #059669;
}

.kpi-receivedfee {
  --kpi-accent: #2563eb;
  --kpi-border: #93c5fd;
  --kpi-shade: rgba(37, 99, 235, 0.1);
  --kpi-icon-start: #60a5fa;
  --kpi-icon-end: #2563eb;
}

.kpi-feepending {
  --kpi-accent: #ea580c;
  --kpi-border: #fdba74;
  --kpi-shade: rgba(234, 88, 12, 0.11);
  --kpi-icon-start: #fb923c;
  --kpi-icon-end: #f97316;
}

.kpi-collectiontoday {
  --kpi-accent: #7c3aed;
  --kpi-border: #c4b5fd;
  --kpi-shade: rgba(124, 58, 237, 0.1);
  --kpi-icon-start: #a78bfa;
  --kpi-icon-end: #7c3aed;
}

.kpi-expensetoday {
  --kpi-accent: #dc2626;
  --kpi-border: #fca5a5;
  --kpi-shade: rgba(239, 68, 68, 0.11);
  --kpi-icon-start: #fb7185;
  --kpi-icon-end: #ef4444;
}

.dashboard-chart-grid,
.dashboard-lower-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(260px, 1fr));
  gap: 12px;
}

.dashboard-data-card {
  min-width: 0;
  min-height: 270px;
  padding: 14px;
  border-left: 4px solid #2563eb;
  background:
    linear-gradient(145deg, #ffffff 0%, #fbfdff 100%),
    linear-gradient(90deg, rgba(37, 99, 235, 0.08), transparent 34%);
}

.dashboard-chart-grid .dashboard-data-card:nth-child(2) {
  border-left-color: #0ea5e9;
}

.dashboard-chart-grid .dashboard-data-card:nth-child(3) {
  border-left-color: #3b82f6;
}

.dashboard-lower-grid .dashboard-data-card:nth-child(1) {
  border-left-color: #7c3aed;
}

.dashboard-lower-grid .dashboard-data-card:nth-child(2) {
  border-left-color: #f59e0b;
}

.dashboard-lower-grid .dashboard-data-card:nth-child(3) {
  border-left-color: #0891b2;
}

.dashboard-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.dashboard-card-head h3 {
  margin: 0;
  color: var(--dash-text);
  font-size: 15px;
  font-weight: 900;
}

.dashboard-card-head p {
  margin: 3px 0 0;
  color: var(--dash-muted);
  font-size: 12px;
}

.dashboard-card-head .mini-button {
  white-space: nowrap;
}

.dashboard-donut-wrap {
  display: grid;
  grid-template-columns: 138px 1fr;
  gap: 12px;
  align-items: center;
}

.dashboard-donut {
  position: relative;
  display: grid;
  width: 138px;
  height: 138px;
  place-items: center;
}

.dashboard-donut svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  transform: rotate(-90deg);
}

.dashboard-donut strong,
.dashboard-donut span {
  position: relative;
  z-index: 1;
}

.dashboard-donut strong {
  color: var(--dash-text);
  font-size: 24px;
  font-weight: 900;
}

.dashboard-donut span {
  margin-top: 32px;
  color: var(--dash-muted);
  font-size: 12px;
  font-weight: 800;
}

.status-legend {
  display: grid;
  gap: 7px;
}

.status-legend div {
  display: grid;
  grid-template-columns: 12px minmax(0, 1fr) auto auto;
  gap: 8px;
  align-items: center;
  color: var(--dash-muted);
  font-size: 12px;
}

.status-legend span {
  width: 10px;
  height: 10px;
  border-radius: 999px;
}

.status-legend strong {
  overflow: hidden;
  color: var(--dash-text);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.status-legend em {
  color: var(--dash-text);
  font-style: normal;
  font-weight: 900;
}

.dashboard-line-chart {
  width: 100%;
  height: 150px;
}

.grid-lines line {
  stroke: #e5edf6;
  stroke-width: 1;
}

.dashboard-line-chart polyline {
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 4;
}

.line-received {
  stroke: var(--dash-blue);
}

.line-completed {
  stroke: #0ea5e9;
}

.dashboard-line-chart text {
  fill: var(--dash-muted);
  font-size: 10px;
}

.chart-legend-inline {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  color: var(--dash-muted);
  font-size: 12px;
  font-weight: 800;
}

.blue-dot,
.green-dot,
.cyan-dot {
  width: 9px;
  height: 9px;
  border-radius: 999px;
}

.blue-dot { background: var(--dash-blue); }
.green-dot,
.cyan-dot { background: #0ea5e9; }

.fee-gauge {
  position: relative;
  display: grid;
  width: 140px;
  height: 140px;
  margin: 0 auto 12px;
  place-items: center;
}

.fee-gauge-arc {
  position: absolute;
  inset: 0;
  border-radius: 999px;
  background: conic-gradient(#2563eb calc(var(--fee-percent) * 1%), #dbeafe 0);
}

.fee-gauge::after {
  position: absolute;
  inset: 17px;
  content: "";
  border-radius: 999px;
  background: #ffffff;
  box-shadow: inset 0 0 0 1px var(--dash-line);
}

.fee-gauge strong,
.fee-gauge span {
  position: relative;
  z-index: 1;
}

.fee-gauge strong {
  color: #1e3a8a;
  font-size: 26px;
  font-weight: 900;
}

.fee-gauge span {
  margin-top: 40px;
  color: var(--dash-muted);
  font-size: 12px;
  font-weight: 900;
}

.fee-breakdown {
  display: grid;
  gap: 7px;
}

.fee-breakdown div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 7px 10px;
  border: 1px solid var(--dash-line);
  border-radius: 10px;
  background: #f8fafc;
}

.fee-breakdown span {
  color: var(--dash-muted);
  font-size: 12px;
  font-weight: 800;
}

.fee-breakdown strong {
  color: var(--dash-text);
  font-size: 14px;
}

.dashboard-list-card {
  min-height: 300px;
}

.dashboard-list-scroll {
  display: grid;
  gap: 10px;
  max-height: 265px;
  overflow: auto;
}

.dashboard-activity-row,
.dashboard-due-row,
.dashboard-visitor-row {
  display: grid;
  align-items: center;
  gap: 12px;
  padding: 11px;
  border: 1px solid #e7edf5;
  border-radius: 12px;
  background: #fbfdff;
}

.dashboard-activity-row {
  grid-template-columns: 38px minmax(0, 1fr) auto;
}

.dashboard-due-row,
.dashboard-visitor-row {
  grid-template-columns: 48px minmax(0, 1fr) auto;
}

.dashboard-activity-row strong,
.dashboard-due-row strong,
.dashboard-visitor-row strong {
  display: block;
  overflow: hidden;
  color: var(--dash-text);
  font-size: 13px;
  font-weight: 900;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dashboard-activity-row p,
.dashboard-due-row p,
.dashboard-visitor-row p {
  margin: 4px 0 0;
  overflow: hidden;
  color: var(--dash-muted);
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dashboard-activity-row time {
  color: var(--dash-muted);
  font-size: 11px;
  font-weight: 800;
}

.activity-dot,
.due-date-badge {
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  border-radius: 10px;
  background: #eaf1ff;
  color: var(--dash-blue);
}

.activity-dot svg {
  width: 18px;
  height: 18px;
  fill: currentColor;
}

.activity-dot.purple {
  background: #f1e9ff;
  color: var(--dash-purple);
}

.due-date-badge {
  height: 46px;
  background: #eef6ff;
}

.due-date-badge strong {
  font-size: 14px;
}

.due-date-badge span {
  color: var(--dash-muted);
  font-size: 10px;
  font-weight: 900;
  text-transform: uppercase;
}

.dashboard-due-row.is-overdue {
  border-color: #fecaca;
  background: #fff8f8;
}

.priority-badge {
  padding: 5px 8px;
  border-radius: 999px;
  background: #e2e8f0;
  color: #475569;
  font-size: 11px;
  font-weight: 900;
}

.priority-badge.priority-high,
.priority-badge.priority-urgent {
  background: #fee2e2;
  color: #b91c1c;
}

.priority-badge.priority-medium {
  background: #fef3c7;
  color: #92400e;
}

.visitor-bars {
  display: flex;
  align-items: end;
  gap: 6px;
  height: 52px;
  margin-bottom: 14px;
  padding: 8px 10px;
  border: 1px solid var(--dash-line);
  border-radius: 12px;
  background: #f8fafc;
}

.visitor-bars span {
  flex: 1;
  min-width: 8px;
  border-radius: 999px 999px 4px 4px;
  background: linear-gradient(180deg, var(--dash-cyan), var(--dash-teal));
}

.dashboard-empty-state {
  display: grid;
  min-height: 150px;
  place-items: center;
  border: 1px dashed var(--dash-line);
  border-radius: 12px;
  color: var(--dash-muted);
  font-weight: 800;
}

@media (max-width: 1360px) {
  .dashboard-kpi-grid {
    grid-template-columns: repeat(3, minmax(150px, 1fr));
  }

  .staff-modern-dashboard .staff-dashboard-kpi-grid {
    grid-template-columns: repeat(4, minmax(130px, 1fr));
  }

  .staff-modern-dashboard .dashboard-kpi-card {
    min-height: 100px;
    padding: 11px;
  }

  .staff-modern-dashboard .dashboard-kpi-card > strong {
    font-size: 21px;
  }

  .staff-modern-dashboard .dashboard-kpi-meta small {
    font-size: 10.5px;
  }

  .dashboard-chart-grid,
  .dashboard-lower-grid {
    grid-template-columns: repeat(2, minmax(260px, 1fr));
  }
}

@media (max-width: 980px) {
  .topbar,
  .dashboard-topbar {
    grid-template-columns: 1fr;
    align-items: stretch;
    gap: 10px;
  }

  .topbar-title-block {
    min-width: 0;
  }

  .daily-quote-copy {
    flex-wrap: wrap;
    row-gap: 2px;
  }

  .daily-quote-text {
    white-space: normal;
  }

  .dashboard-topbar .top-actions {
    flex-wrap: wrap;
    width: 100%;
  }

  .dashboard-topbar .top-action-sample {
    margin-left: 0;
  }

  .dashboard-topbar-card {
    align-items: flex-start;
    flex-direction: column;
  }

  .dashboard-kpi-grid,
  .staff-modern-dashboard .staff-dashboard-kpi-grid {
    grid-template-columns: repeat(2, minmax(150px, 1fr));
  }

  .dashboard-donut-wrap {
    grid-template-columns: 1fr;
    justify-items: center;
  }
}

@media (max-width: 620px) {
  .dashboard-kpi-grid,
  .staff-modern-dashboard .staff-dashboard-kpi-grid,
  .dashboard-chart-grid,
  .dashboard-lower-grid {
    grid-template-columns: 1fr;
  }

  .dashboard-topbar {
    padding: 12px 14px;
  }

  .daily-quote-banner {
    align-items: flex-start;
    min-height: 40px;
    padding: 8px 10px;
  }

  .daily-quote-icon {
    width: 28px;
    height: 28px;
    flex-basis: 28px;
  }

  .daily-quote-title,
  .daily-quote-text {
    font-size: 12px;
  }

  .daily-quote-author {
    font-size: 11px;
  }

  .dashboard-topbar .top-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .dashboard-topbar .icon-button,
  .dashboard-topbar .top-action-button {
    width: 100%;
    min-height: 42px;
  }

  .top-action-profile {
    grid-column: 1 / -1;
    max-width: none;
    justify-content: flex-start;
  }

  .dashboard-activity-row,
  .dashboard-due-row,
  .dashboard-visitor-row {
    grid-template-columns: 42px minmax(0, 1fr);
  }

  .dashboard-activity-row time,
  .priority-badge {
    grid-column: 2;
    justify-self: start;
  }
}

/* Modern professional finance theme for Transactions only */
.expense-shell {
  max-width: 1540px;
  margin: 0 auto;
  gap: 18px;
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

#expenses {
  background:
    radial-gradient(circle at 12% 0%, rgba(37, 99, 235, 0.07), transparent 28%),
    radial-gradient(circle at 92% 12%, rgba(20, 184, 166, 0.06), transparent 24%),
    #f6f8fc;
}

.transactions-page-head {
  position: relative;
  overflow: hidden;
  border: 1px solid #d7e3f1;
  border-radius: 16px;
  background:
    linear-gradient(145deg, #ffffff 0%, #fbfdff 100%);
  box-shadow: 0 8px 22px rgba(15, 23, 42, 0.07);
}

.transactions-page-head::before {
  position: absolute;
  inset: 0 auto 0 0;
  width: 5px;
  background: linear-gradient(180deg, #2563eb, #14b8a6);
  content: "";
}

.transactions-page-head h3 {
  color: #172554;
  font-size: 25px;
  letter-spacing: 0;
}

.transactions-page-head p {
  color: #64748b;
}

.transactions-head-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.transactions-head-actions .primary-button,
.transactions-head-actions .secondary-button {
  min-height: 38px;
  border-radius: 10px;
  padding: 8px 13px;
}

.expense-overview-card {
  position: relative;
  overflow: hidden;
  min-height: 126px;
  border-width: 1.8px;
  border-radius: 16px;
  background:
    radial-gradient(circle at top right, rgba(37, 99, 235, 0.07), transparent 34%),
    linear-gradient(145deg, #ffffff, #fbfdff);
  box-shadow: 0 8px 22px rgba(15, 23, 42, 0.07);
  transition: transform 180ms ease, box-shadow 180ms ease, border-color 180ms ease;
}

.expense-overview-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.1);
}

.expense-overview-card.balance {
  border-color: #93c5fd;
}

.expense-overview-card.collection {
  border-color: #86efac;
}

.expense-overview-card.expense {
  border-color: #fca5a5;
}

.expense-overview-card.fee {
  border-color: #c4b5fd;
}

.expense-card-icon {
  width: 44px;
  height: 44px;
  border-radius: 14px;
  font-size: 19px;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.65);
}

.expense-overview-card.balance .expense-card-icon {
  background: #dbeafe;
  color: #2563eb;
}

.expense-overview-card.collection .expense-card-icon {
  background: #dcfce7;
  color: #059669;
}

.expense-overview-card.expense .expense-card-icon {
  background: #fee2e2;
  color: #dc2626;
}

.expense-overview-card.fee .expense-card-icon {
  background: #ede9fe;
  color: #7c3aed;
}

.expense-overview-card span {
  color: #475569;
  font-size: 13px;
}

.expense-overview-card strong {
  color: #0f172a;
  font-size: 24px;
  font-weight: 900;
}

.expense-overview-card .negative-amount {
  display: inline-block;
  padding: 4px 8px;
  border-radius: 10px;
  background: #fee2e2;
}

.transaction-sparkline {
  display: block;
  width: 100%;
  height: 30px;
  margin-top: 10px;
}

.transaction-sparkline polyline {
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 3;
  opacity: 0.75;
}

.expense-overview-card.balance .transaction-sparkline { color: #2563eb; }
.expense-overview-card.collection .transaction-sparkline { color: #059669; }
.expense-overview-card.expense .transaction-sparkline { color: #dc2626; }
.expense-overview-card.fee .transaction-sparkline { color: #7c3aed; }

.expense-tabs {
  width: 100%;
  max-width: 760px;
  border: 1px solid #dbe4f0;
  border-radius: 16px;
  background: linear-gradient(145deg, #ffffff, #f8fbff);
  box-shadow: 0 8px 20px rgba(15, 23, 42, 0.06);
}

.expense-tab-button,
.expense-tab-button.tab-collections,
.expense-tab-button.tab-expenses,
.expense-tab-button.tab-balance {
  position: relative;
  background: transparent;
  border: 0;
  color: #334155;
  box-shadow: none;
}

.expense-tab-button:hover {
  background: #f1f7ff;
}

.expense-tab-button.active-tab,
.expense-tab-button.tab-collections.active-tab,
.expense-tab-button.tab-expenses.active-tab,
.expense-tab-button.tab-balance.active-tab {
  background: linear-gradient(135deg, #eff6ff, #eefdfb);
  color: #2563eb;
  border: 0;
  box-shadow: none;
  transform: none;
}

.expense-tab-button.active-tab::after {
  position: absolute;
  right: 16px;
  bottom: 0;
  left: 16px;
  height: 3px;
  border-radius: 999px;
  background: #2563eb;
  content: "";
}

.expense-tab-button.active-tab .tab-icon {
  background: #dbeafe;
  color: #2563eb;
}

.transaction-workspace {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 310px;
  gap: 16px;
  align-items: start;
}

.transaction-main-column {
  min-width: 0;
}

.expense-form,
.expense-tools-card,
.transaction-side-card {
  border: 1px solid #d7e3f1;
  border-radius: 16px;
  background: linear-gradient(145deg, #ffffff 0%, #fbfdff 100%);
  box-shadow: 0 8px 22px rgba(15, 23, 42, 0.07);
}

.expense-form {
  grid-template-columns: repeat(4, minmax(145px, 1fr));
  gap: 15px 14px;
}

.expense-card-head h3 {
  color: #172554;
  font-size: 18px;
}

.expense-card-head span {
  color: #0f766e;
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.expense-form .field label,
.expense-filters .field label,
.opening-balance-form .field label {
  margin-bottom: 6px;
  color: #334155;
  font-size: 12px;
  font-weight: 900;
}

.expense-form input,
.expense-form select,
.expense-form textarea,
.expense-filters input,
.expense-filters select,
.opening-balance-form input,
.expense-item-combo input,
.expense-item-combo select {
  min-height: 44px;
  border: 1px solid #cbd5e1;
  border-radius: 12px;
  background: #fbfdff;
  color: #0f172a;
  transition: border-color 160ms ease, box-shadow 160ms ease, background 160ms ease;
}

.expense-form input:focus,
.expense-form select:focus,
.expense-form textarea:focus,
.expense-filters input:focus,
.expense-filters select:focus,
.opening-balance-form input:focus,
.expense-item-combo input:focus,
.expense-item-combo select:focus {
  border-color: #2563eb;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.13);
  background: #ffffff;
  outline: none;
}

.expense-entry-form .expense-item-field,
.collection-form .expense-item-field,
.collection-form .cash-received-from-field {
  grid-column: span 2;
}

.expense-entry-form .expense-card-head,
.collection-form .expense-card-head,
.expense-entry-form .expense-remarks-field,
.collection-form .expense-remarks-field,
.expense-entry-form .expense-attachment-field,
.collection-form .expense-attachment-field,
.expense-entry-form .action-row,
.collection-form .action-row {
  grid-column: 1 / -1;
}

.expense-item-combo {
  grid-template-columns: minmax(0, 1fr) auto;
}

.cash-received-from-field .expense-item-combo {
  grid-template-columns: minmax(0, 1fr) minmax(130px, 0.75fr) auto;
}

.expense-remarks-field textarea {
  min-height: 84px;
  max-height: 110px;
}

.upload-drop {
  min-height: 96px;
  border: 1.5px dashed #9db7d6;
  border-radius: 16px;
  background:
    linear-gradient(145deg, rgba(239, 246, 255, 0.72), rgba(255, 255, 255, 0.95));
}

.upload-drop:hover {
  border-color: #2563eb;
  background: #eff6ff;
}

.upload-drop span {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: #dbeafe;
  color: #2563eb;
}

.expense-form .action-row {
  justify-content: flex-end;
  gap: 10px;
  padding-top: 8px;
  border-top: 1px solid #edf2f7;
}

.expense-form .primary-button {
  background: #059669;
  border-color: #059669;
  color: #ffffff;
  box-shadow: 0 10px 20px rgba(5, 150, 105, 0.22);
}

.expense-form .secondary-button {
  background: #ffffff;
  border-color: #cbd5e1;
  color: #334155;
}

.transaction-side-column {
  display: grid;
  gap: 14px;
  position: sticky;
  top: 96px;
}

.transaction-side-card {
  padding: 16px;
  border-color: #cfe0f4;
}

.transaction-info-row,
.transaction-quick-action {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  width: 100%;
  min-height: 44px;
  margin-top: 8px;
  padding: 10px 11px;
  border: 1px solid #d7e3f1;
  border-radius: 12px;
  background: linear-gradient(145deg, #f8fafc, #ffffff);
}

.transaction-info-row span {
  color: #64748b;
  font-size: 12px;
  font-weight: 800;
}

.transaction-info-row strong {
  color: #0f172a;
  font-size: 13px;
  text-align: right;
}

.transaction-info-row.collection strong { color: #059669; }
.transaction-info-row.expense strong { color: #dc2626; }
.transaction-info-row.fee strong { color: #7c3aed; }
.transaction-info-row.balance strong { color: #2563eb; }

.transaction-quick-action {
  justify-content: flex-start;
  color: #172554;
  font-weight: 900;
  cursor: pointer;
  transition: transform 160ms ease, border-color 160ms ease, background 160ms ease;
}

.transaction-quick-action:hover {
  transform: translateX(2px);
  border-color: #93c5fd;
  background: #eff6ff;
}

.transaction-table-head {
  margin-top: 2px;
  padding: 14px 16px;
  border: 1px solid #dbe4f0;
  border-bottom: 0;
  border-radius: 16px 16px 0 0;
  background: #ffffff;
  box-shadow: 0 5px 16px rgba(15, 23, 42, 0.05);
}

.transaction-table-head + .table-wrap {
  border: 1px solid #dbe4f0;
  border-radius: 0 0 16px 16px;
  background: #ffffff;
  box-shadow: 0 6px 18px rgba(15, 23, 42, 0.06);
}

.transaction-table {
  margin-top: 0;
}

.transaction-table thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #f8fafc;
  color: #172554;
  font-size: 12px;
}

.transaction-table tbody tr:nth-child(even) {
  background: #fbfdff;
}

.transaction-table tbody tr:hover {
  background: #eff6ff;
}

.transaction-table .amount-cell {
  color: #0f172a;
  font-weight: 900;
}

.transaction-table .action-col .mini-button {
  min-width: 0;
  padding: 6px 9px;
  border-radius: 9px;
}

.transaction-table .action-col .mini-button[data-view-expense],
.transaction-table .action-col .mini-button[data-view-cash] {
  color: #1d4ed8;
  background: #dbeafe;
  border-color: #bfdbfe;
}

.transaction-table .action-col .mini-button[data-edit-expense],
.transaction-table .action-col .mini-button[data-edit-cash] {
  color: #4338ca;
  background: #e0e7ff;
  border-color: #c7d2fe;
}

.cash-balance-card {
  border: 1px solid #dbe4f0;
  border-left: 5px solid #2563eb;
  border-radius: 14px;
}

.cash-balance-card:nth-child(2) {
  border-left-color: #059669;
}

.cash-balance-card:nth-child(3) {
  border-left-color: #dc2626;
}

.cash-balance-card.highlight {
  background: #eff6ff;
  border-left-color: #2563eb;
}

.cash-status.warn {
  border: 1px solid #f59e0b;
  background: #fffbeb;
  color: #92400e;
}

@media (max-width: 1180px) {
  .transaction-workspace {
    grid-template-columns: 1fr;
  }

  .transaction-side-column {
    position: static;
    grid-template-columns: repeat(2, minmax(240px, 1fr));
  }

  .expense-overview-grid {
    grid-template-columns: repeat(2, minmax(190px, 1fr));
  }
}

@media (max-width: 760px) {
  .transactions-page-head {
    align-items: flex-start;
    flex-direction: column;
  }

  .transactions-head-actions {
    justify-content: flex-start;
  }

  .expense-form,
  .expense-entry-form,
  .collection-form,
  .expense-entry-form .expense-item-field,
  .collection-form .expense-item-field,
  .collection-form .cash-received-from-field,
  .cash-received-from-field .expense-item-combo,
  .transaction-side-column {
    grid-template-columns: 1fr;
  }

  .expense-entry-form .expense-item-field,
  .collection-form .expense-item-field,
  .collection-form .cash-received-from-field {
    grid-column: 1 / -1;
  }

  .expense-overview-grid,
  .cash-balance-grid {
    grid-template-columns: 1fr;
  }
}

/* Modern login screen */
.login-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 28px;
  background:
    radial-gradient(circle at 12% 8%, rgba(37, 99, 235, 0.20), transparent 26%),
    radial-gradient(circle at 86% 18%, rgba(14, 165, 233, 0.18), transparent 24%),
    radial-gradient(circle at 50% 95%, rgba(20, 184, 166, 0.14), transparent 30%),
    linear-gradient(135deg, #f7fbff 0%, #eef6ff 48%, #ffffff 100%);
}

.login-shell {
  display: grid;
  width: min(980px, 100%);
  min-height: 560px;
  grid-template-columns: 1.18fr 0.82fr;
  overflow: hidden;
  border: 1px solid rgba(191, 219, 254, 0.95);
  border-radius: 30px;
  background: rgba(255, 255, 255, 0.82);
  box-shadow: 0 30px 90px rgba(15, 23, 42, 0.16);
  backdrop-filter: blur(18px);
}

.login-brand-panel {
  display: flex;
  min-width: 0;
  flex-direction: column;
  justify-content: space-between;
  gap: 28px;
  padding: 34px;
  color: #f8fafc;
  background:
    linear-gradient(145deg, rgba(15, 23, 42, 0.94), rgba(18, 41, 78, 0.96)),
    radial-gradient(circle at top right, rgba(14, 165, 233, 0.34), transparent 35%);
}

.login-brand-lockup,
.login-card-head {
  display: flex;
  align-items: center;
  gap: 14px;
}

.login-brand-lockup .brand-mark,
.login-card-head .brand-mark {
  display: grid;
  flex: 0 0 auto;
  place-items: center;
  color: #0f4f78;
  font-weight: 950;
  letter-spacing: -0.04em;
  background: #ffffff;
  box-shadow: 0 14px 30px rgba(15, 23, 42, 0.16);
}

.login-brand-lockup .brand-mark-logo,
.login-card-head .brand-mark-logo {
  overflow: hidden;
  padding: 8px;
}

.login-brand-lockup .brand-mark-logo img,
.login-card-head .brand-mark-logo img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.login-brand-lockup .brand-mark {
  width: 58px;
  height: 58px;
  border-radius: 16px;
  font-size: 22px;
}

.login-card-head .brand-mark {
  width: 48px;
  height: 48px;
  border-radius: 15px;
  background: #ffffff;
}

.login-brand-lockup strong,
.login-brand-lockup span,
.login-brand-lockup small {
  display: block;
}

.login-brand-lockup strong {
  font-size: 22px;
  line-height: 1.05;
}

.login-brand-lockup span {
  margin-top: 5px;
  color: #cbd5e1;
  font-weight: 800;
}

.login-brand-lockup small {
  margin-top: 3px;
  color: #93c5fd;
  font-weight: 800;
}

.login-eyebrow {
  color: #2563eb;
  font-size: 11px;
  font-weight: 950;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.login-brand-panel .login-eyebrow {
  color: #67e8f9;
}

.login-brand-copy h1 {
  max-width: 520px;
  margin: 10px 0 0;
  font-size: clamp(18px, 2vw, 25px);
  line-height: 1.12;
  letter-spacing: 0;
}

.login-brand-copy p {
  max-width: 500px;
  margin: 18px 0 0;
  color: #cbd5e1;
  font-size: 15px;
  line-height: 1.65;
}

.login-feature-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.login-feature-grid span {
  min-width: 0;
  padding: 12px 10px;
  border: 1px solid rgba(147, 197, 253, 0.26);
  border-radius: 14px;
  color: #dbeafe;
  background: rgba(255, 255, 255, 0.08);
  font-size: 12px;
  font-weight: 850;
  text-align: center;
}

.login-card {
  display: flex;
  width: 100%;
  min-width: 0;
  flex-direction: column;
  justify-content: center;
  padding: 42px 34px;
  border: 0;
  border-radius: 0;
  background:
    radial-gradient(circle at top right, rgba(37, 99, 235, 0.08), transparent 38%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(248, 251, 255, 0.96));
  box-shadow: none;
}

.login-card::before {
  display: none;
}

.login-card h1 {
  margin: 3px 0 0;
  color: #0f172a;
  font-size: 31px;
  line-height: 1;
  letter-spacing: -0.04em;
}

.login-subtitle {
  margin: 18px 0 8px;
  color: #64748b;
  font-size: 14px;
  line-height: 1.5;
}

.login-card .field {
  margin-top: 15px;
}

.login-card .field label {
  color: #334155;
  font-size: 11px;
  font-weight: 950;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.login-card input {
  min-height: 48px;
  border: 1px solid #cbdff4;
  border-radius: 14px;
  background: #ffffff;
  color: #0f172a;
  font-weight: 700;
  box-shadow: 0 8px 18px rgba(15, 23, 42, 0.04);
}

.login-card input:focus {
  border-color: #2563eb;
  box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.12);
  outline: none;
}

.login-card .password-wrap {
  gap: 8px;
}

.login-card .password-wrap button {
  min-width: 62px;
  border: 1px solid #cbdff4;
  border-radius: 14px;
  color: #0f4f78;
  background: #eff6ff;
  font-weight: 900;
}

.login-card .primary-button {
  width: 100%;
  min-height: 48px;
  margin-top: 20px;
  justify-content: center;
  border-radius: 14px;
  background: linear-gradient(135deg, #2563eb, #0891b2, #059669);
  box-shadow: 0 16px 30px rgba(37, 99, 235, 0.24);
}

.login-action-stack {
  display: flex;
  width: 100%;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  margin-top: 20px;
}

.login-action-stack .primary-button {
  margin-top: 0;
}

.login-note {
  margin: 14px 0 0;
  color: #64748b;
  font-size: 12px;
  line-height: 1.45;
  text-align: center;
}

.login-credit {
  margin: 0;
  color: #0f4f78;
  font-family: "Segoe UI", Arial, sans-serif;
  font-size: 14px;
  font-style: italic;
  font-weight: 800;
  letter-spacing: 0.02em;
  text-align: center;
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.7);
}

@media (max-width: 820px) {
  .login-page {
    padding: 16px;
  }

  .login-shell {
    min-height: 0;
    grid-template-columns: 1fr;
  }

  .login-brand-panel {
    padding: 26px;
  }

  .login-brand-copy h1 {
    font-size: 32px;
  }

  .login-feature-grid {
    grid-template-columns: 1fr;
  }

  .login-card {
    padding: 30px 24px;
  }
}

/* Mobile and tablet performance guards: preserve logic, improve layout only. */
html,
body {
  max-width: 100%;
  overflow-x: hidden;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

* {
  box-sizing: border-box;
}

img,
svg,
canvas,
video {
  max-width: 100%;
}

button,
input,
select,
textarea,
.nav-item,
.notification-tab,
.mini-button,
.icon-button,
.top-action-button {
  touch-action: manipulation;
}

.table-wrap,
.file-table-wrap,
.staff-details-table-wrap,
.visitor-entry-table-wrap,
.opening-balance-list {
  max-width: 100%;
  overflow-x: auto;
  overscroll-behavior-inline: contain;
  -webkit-overflow-scrolling: touch;
}

.file-table,
.expense-table,
.transaction-table,
.staff-details-table {
  width: 100%;
}

.drawer-body,
.notification-drawer-body,
.team-chat-body {
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}

.daily-quote-minimize {
  flex: 0 0 auto;
  min-height: 32px;
  padding: 6px 10px;
  border: 1px solid #c7d2fe;
  border-radius: 10px;
  color: #3730a3;
  background: #ffffff;
  font-size: 11px;
  font-weight: 900;
}

@media (max-width: 1024px) {
  .app-shell,
  .app-shell.sidebar-collapsed {
    grid-template-columns: 1fr;
    min-height: 100dvh;
  }

  .sidebar,
  .sidebar.collapsed {
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 80;
    width: min(86vw, 320px);
    height: 100dvh;
    transform: translateX(-105%);
    transition: transform 0.24s ease;
    box-shadow: 18px 0 42px rgba(15, 23, 42, 0.28);
  }

  .sidebar.open,
  .sidebar.collapsed.open {
    transform: translateX(0);
  }

  .sidebar-collapse-button {
    display: none;
  }

  .content {
    min-width: 0;
    width: 100%;
  }

  .mobile-menu {
    display: inline-flex;
  }

  .topbar,
  .dashboard-topbar {
    position: sticky;
    top: 0;
    z-index: 30;
    grid-template-columns: 1fr;
    min-height: auto;
    padding: max(10px, env(safe-area-inset-top)) 16px 10px;
    gap: 10px;
  }

  .topbar-title-block {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
  }

  .topbar h2 {
    font-size: 22px;
  }

  .topbar p {
    display: none;
  }

  .top-actions {
    width: 100%;
    margin-left: 0;
    justify-content: flex-start;
    gap: 8px;
    overflow-x: auto;
    padding-bottom: 2px;
  }

  .top-icon-action,
  .icon-button,
  .mini-button,
  .top-action-button,
  .secondary-button,
  .primary-button {
    min-width: 44px;
    min-height: 44px;
  }

  .top-action-profile {
    flex: 0 0 auto;
    max-width: 190px;
  }

  .daily-quote-slot {
    order: 2;
  }

  .daily-quote-banner {
    min-height: 40px;
    padding: 8px 10px;
  }

  .daily-quote-copy {
    flex-wrap: wrap;
    row-gap: 2px;
  }

  .daily-quote-text {
    display: -webkit-box;
    overflow: hidden;
    white-space: normal;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
  }

  .page,
  .dashboard-mode .page {
    padding: 14px;
  }

  .dashboard-topbar-card,
  .panel,
  .card,
  .transactions-form-panel,
  .dashboard-chart-card {
    max-width: 100%;
  }

  .filters,
  .two-col,
  .three-col,
  .dashboard-staff-filters,
  .transaction-form-grid,
  .staff-details-form-grid {
    grid-template-columns: 1fr !important;
  }

  .field input,
  .field select,
  .field textarea,
  input,
  select,
  textarea {
    width: 100%;
    min-height: 44px;
    font-size: 16px;
  }

  .drawer,
  .notification-panel,
  .team-chat-panel {
    width: min(100vw, 620px);
    max-width: 100vw;
    height: 100dvh;
    max-height: 100dvh;
    border-radius: 0;
  }

  .drawer.open,
  .notification-panel.open,
  .team-chat-panel.open {
    transform: translateX(0);
  }

  .drawer-head,
  .modern-drawer-head {
    position: sticky;
    top: 0;
    z-index: 3;
    min-height: 58px;
    background: inherit;
  }

  .drawer-body {
    max-height: calc(100dvh - 128px);
    padding-bottom: 92px;
  }

  .drawer-actions {
    position: sticky;
    bottom: 0;
    z-index: 4;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
    padding: 10px 14px calc(10px + env(safe-area-inset-bottom));
    background: rgba(255, 255, 255, 0.96);
    border-top: 1px solid #dbe7f5;
    backdrop-filter: blur(12px);
  }

  .file-table {
    min-width: 760px;
  }

  .transaction-table,
  .expense-table,
  .staff-details-table {
    min-width: 720px;
  }
}

@media (max-width: 768px) {
  .dashboard-kpi-grid,
  .staff-modern-dashboard .staff-dashboard-kpi-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }

  .dashboard-kpi-card {
    min-height: 112px;
    padding: 12px;
  }

  .dashboard-kpi-card > strong {
    font-size: 24px;
  }

  .dashboard-chart-grid,
  .dashboard-lower-grid,
  .dashboard-layout,
  .transactions-main-grid,
  .staff-performance-grid {
    grid-template-columns: 1fr !important;
  }

  .team-chat-panel.open {
    inset: 0;
    width: 100vw;
  }

  .modern-chat-body {
    height: calc(100dvh - 74px);
    min-height: 0;
  }

  .team-chat-panel .chat-sidebar,
  .chat-sidebar {
    width: 100%;
    min-width: 0;
  }

  .team-chat-panel.chat-mobile-open .chat-sidebar {
    display: none;
  }

  .chat-main {
    min-width: 0;
  }

  .chat-composer {
    position: sticky;
    bottom: 0;
    padding-bottom: calc(10px + env(safe-area-inset-bottom));
    background: #ffffff;
  }

  .notification-tabs {
    display: flex;
    overflow-x: auto;
    padding-bottom: 8px;
    scrollbar-width: thin;
  }

  .notification-tab {
    flex: 0 0 auto;
    min-height: 40px;
  }
}

@media (max-width: 430px) {
  .page,
  .dashboard-mode .page {
    padding: 10px;
  }

  .dashboard-kpi-grid,
  .staff-modern-dashboard .staff-dashboard-kpi-grid {
    grid-template-columns: 1fr;
  }

  .topbar,
  .dashboard-topbar {
    padding-inline: 10px;
  }

  .top-actions {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    overflow: visible;
  }

  .top-action-button,
  .top-icon-action {
    width: 100%;
    padding-inline: 8px;
  }

  .top-action-profile {
    grid-column: 1 / -1;
    max-width: none;
    justify-content: flex-start;
  }

  .daily-quote-title,
  .daily-quote-text {
    font-size: 12px;
  }

  .daily-quote-author,
  .daily-quote-minimize {
    font-size: 10px;
  }

  .file-table,
  .transaction-table,
  .expense-table,
  .staff-details-table {
    min-width: 680px;
  }
}

/* Staff dashboard fix: keep KPI cards and wide performance tables inside the page width. */
#dashboard,
.dashboard-layout,
.dashboard-single,
.staff-modern-dashboard,
.staff-modern-performance-wrap,
.staff-performance-panel,
.staff-performance-section {
  min-width: 0;
  max-width: 100%;
}

.staff-modern-dashboard,
.staff-modern-performance-wrap,
.staff-performance-panel {
  overflow-x: hidden;
}

.staff-performance-section .file-table-wrap {
  display: block;
  width: 100%;
  max-width: 100%;
  overflow-x: auto;
}

.staff-modern-dashboard .staff-dashboard-kpi-grid {
  display: grid !important;
  width: 100% !important;
  max-width: 100% !important;
  grid-template-columns: repeat(4, minmax(0, 1fr)) !important;
  gap: 8px !important;
}

.staff-modern-dashboard .dashboard-kpi-card {
  min-width: 0 !important;
  min-height: 92px !important;
  padding: 9px 10px !important;
  border-radius: 12px !important;
}

.staff-modern-dashboard .dashboard-kpi-top {
  gap: 7px !important;
}

.staff-modern-dashboard .dashboard-kpi-icon {
  width: 28px !important;
  height: 28px !important;
  border-radius: 9px !important;
}

.staff-modern-dashboard .dashboard-kpi-icon svg {
  width: 14px !important;
  height: 14px !important;
}

.staff-modern-dashboard .dashboard-kpi-title {
  min-width: 0;
  font-size: 10px !important;
  line-height: 1.18 !important;
  white-space: normal !important;
}

.staff-modern-dashboard .dashboard-kpi-card > strong {
  margin-top: 6px !important;
  font-size: 20px !important;
  line-height: 1 !important;
}

.staff-modern-dashboard .dashboard-kpi-meta {
  margin-top: 4px !important;
  gap: 5px !important;
}

.staff-modern-dashboard .dashboard-kpi-meta small {
  font-size: 9.5px !important;
  line-height: 1.12 !important;
}

.staff-modern-dashboard .dashboard-kpi-trend {
  height: 13px !important;
}

@media (max-width: 1180px) {
  .staff-modern-dashboard .staff-dashboard-kpi-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  }
}

@media (max-width: 420px) {
  .staff-modern-dashboard .staff-dashboard-kpi-grid {
    grid-template-columns: 1fr !important;
  }
}

/* Compact sidebar menu: no count badges, more room for readable labels. */
.nav .nav-item,
.sidebar.collapsed .nav .nav-item {
  min-height: 42px !important;
  grid-template-columns: 24px minmax(0, 1fr) !important;
  gap: 9px !important;
  margin: 1px 0 !important;
  padding: 0 12px !important;
  border-radius: 10px !important;
}

.nav .nav-icon {
  width: 24px !important;
  height: 24px !important;
}

.nav .nav-icon svg {
  width: 16px !important;
  height: 16px !important;
}

.nav .nav-label,
.sidebar.collapsed .nav-label {
  min-width: 0 !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
  white-space: nowrap !important;
}

.nav-badge,
.sidebar.collapsed .nav-badge {
  display: none !important;
}

.nav-group {
  margin-bottom: 10px !important;
}

.nav-group-items {
  gap: 2px !important;
}

.nav-section-title {
  min-height: 30px !important;
  padding: 4px 12px 6px !important;
  font-size: 12px !important;
}

.sidebar-menu {
  padding: 10px 8px 12px !important;
}

/* Modern top Chat and Notification icons */
.top-actions .top-icon-action {
  position: relative !important;
  isolation: isolate;
  width: auto !important;
  min-width: 116px !important;
  height: 50px !important;
  min-height: 50px !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 8px !important;
  padding: 0 13px !important;
  border-radius: 16px !important;
  border: 1px solid rgba(148, 163, 184, 0.28) !important;
  box-shadow:
    0 10px 24px rgba(15, 23, 42, 0.10),
    inset 0 1px 0 rgba(255, 255, 255, 0.65) !important;
  color: #0f172a !important;
  overflow: visible !important;
  transform: translateZ(0);
  transition:
    transform 0.18s ease,
    box-shadow 0.18s ease,
    border-color 0.18s ease,
    filter 0.18s ease !important;
}

.top-actions .top-icon-action::before {
  content: "";
  position: absolute;
  inset: 5px;
  z-index: -1;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.58);
}

.top-actions .top-icon-symbol {
  display: inline-grid;
  flex: 0 0 auto;
  width: 24px;
  height: 24px;
  place-items: center;
}

.top-actions .top-icon-symbol svg,
.top-actions .top-icon-action svg {
  width: 20px !important;
  height: 20px !important;
  fill: currentColor !important;
}

.top-actions .top-icon-label {
  display: inline-block;
  max-width: 92px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: #0f172a;
  font-size: 12px;
  font-weight: 850;
  line-height: 1;
}

.top-actions .top-icon-action:hover,
.top-actions .top-icon-action:focus-visible {
  transform: translateY(-2px);
  border-color: rgba(37, 99, 235, 0.30) !important;
  box-shadow:
    0 14px 30px rgba(15, 23, 42, 0.14),
    inset 0 1px 0 rgba(255, 255, 255, 0.78) !important;
}

.top-actions .top-icon-action:focus-visible {
  outline: 3px solid rgba(37, 99, 235, 0.18);
  outline-offset: 2px;
}

.top-actions .top-icon-chat {
  background: linear-gradient(135deg, #eef2ff 0%, #f5f3ff 52%, #e0f2fe 100%) !important;
  border-color: #c4b5fd !important;
  color: #5b21b6 !important;
}

.top-actions .top-icon-notify {
  background: linear-gradient(135deg, #fff7ed 0%, #fef3c7 52%, #fff1f2 100%) !important;
  border-color: #fde68a !important;
  color: #92400e !important;
}

.top-actions .top-icon-chat:hover,
.top-actions .top-icon-chat:focus-visible {
  border-color: #a78bfa !important;
  filter: saturate(1.08);
}

.top-actions .top-icon-notify:hover,
.top-actions .top-icon-notify:focus-visible {
  border-color: #fbbf24 !important;
  filter: saturate(1.08);
}

.top-actions .top-action-badge {
  top: -8px !important;
  right: -8px !important;
  min-width: 22px !important;
  height: 22px !important;
  padding: 0 7px !important;
  border: 2px solid #ffffff !important;
  border-radius: 999px !important;
  background: linear-gradient(135deg, #fb7185, #ef4444) !important;
  color: #ffffff !important;
  font-size: 11px !important;
  font-weight: 900 !important;
  line-height: 1 !important;
  box-shadow: 0 8px 18px rgba(239, 68, 68, 0.28) !important;
}

@media (max-width: 760px) {
  .top-actions .top-icon-action {
    min-width: 78px !important;
    height: 44px !important;
    min-height: 44px !important;
    gap: 5px !important;
    padding: 0 9px !important;
    border-radius: 14px !important;
  }

  .top-actions .top-icon-action::before {
    inset: 4px;
    border-radius: 10px;
  }

  .top-actions .top-icon-symbol {
    width: 20px;
    height: 20px;
  }

  .top-actions .top-icon-symbol svg,
  .top-actions .top-icon-action svg {
    width: 18px !important;
    height: 18px !important;
  }

  .top-actions .top-icon-label {
    max-width: 48px;
    font-size: 10px;
  }

  .top-actions .top-action-badge {
    top: -7px !important;
    right: -7px !important;
    min-width: 19px !important;
    height: 19px !important;
    padding: 0 5px !important;
    font-size: 10px !important;
  }
}
