*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg: #F8FAFC;
  --bg-card: rgba(255,255,255,0.82);
  --bg-card-solid: #FFFFFF;
  --bg-dark: #0F172A;
  --bg-sidebar: #111827;
  --accent: #3B82F6;
  --accent-light: #60A5FA;
  --accent-glow: #93C5FD;
  --accent-gradient: linear-gradient(135deg, #2563EB, #3B82F6);
  --text: #1E293B;
  --text-muted: #64748B;
  --text-light: #94A3B8;
  --border: rgba(0,0,0,0.06);
  --border-focus: #3B82F6;
  --danger: #DC2626;
  --danger-bg: #FEF2F2;
  --success: #059669;
  --success-bg: #ECFDF5;
  --warning: #D97706;
  --warning-bg: #FFFBEB;
  --radius: 14px;
  --radius-sm: 10px;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
  --shadow: 0 4px 24px rgba(0,0,0,0.06), 0 1px 3px rgba(0,0,0,0.04);
  --shadow-lg: 0 20px 60px rgba(0,0,0,0.08), 0 4px 12px rgba(0,0,0,0.04);
  --shadow-glow: 0 0 20px rgba(59,130,246,0.15);
  --glass: saturate(180%) blur(14px);
  --transition: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

body {
  font-family: 'Plus Jakarta Sans', sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  background-image: radial-gradient(circle at 50% 0%, rgba(59,130,246,0.04), transparent 60%);
  background-attachment: fixed;
}

h1, h2, h3 { font-family: 'DM Serif Display', serif; font-weight: 400; letter-spacing: -0.01em; }

/* ===== ANIMATIONS ===== */
@keyframes fadeIn { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: translateY(0); } }
@keyframes slideIn { from { opacity: 0; transform: translateX(-20px); } to { opacity: 1; transform: translateX(0); } }
@keyframes slideInRight { from { opacity: 0; transform: translateX(20px); } to { opacity: 1; transform: translateX(0); } }
@keyframes scaleIn { from { opacity: 0; transform: scale(0.96); } to { opacity: 1; transform: scale(1); } }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.5; } }
@keyframes spin { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } }
@keyframes shimmer { from { background-position: -200% 0; } to { background-position: 200% 0; } }
@keyframes checkmark { 0% { stroke-dashoffset: 50; } 100% { stroke-dashoffset: 0; } }
@keyframes focusGlow { 0% { box-shadow: 0 0 0 3px rgba(59,130,246,0.08); } 50% { box-shadow: 0 0 0 5px rgba(59,130,246,0.12); } 100% { box-shadow: 0 0 0 3px rgba(59,130,246,0.08); } }
@keyframes slideDown { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: translateY(0); } }
@keyframes slideUp { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: translateY(0); } }
@keyframes toastProgress { from { width: 100%; } to { width: 0; } }
@keyframes skeletonPulse { 0%, 100% { opacity: 0.4; } 50% { opacity: 0.8; } }

.animate-fade { animation: fadeIn 0.5s ease forwards; }
.animate-slide { animation: slideIn 0.4s ease forwards; }

/* Skeleton loading */
.skeleton {
  background: linear-gradient(90deg, rgba(0,0,0,0.04) 25%, rgba(0,0,0,0.08) 50%, rgba(0,0,0,0.04) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.8s ease infinite;
  border-radius: var(--radius-sm);
}

/* Smooth tab transitions */
.main-content > * { animation: fadeIn 0.35s ease both; }

/* Table row hover upgrade */
tr { transition: all 0.2s ease; }
tr:hover td { background: rgba(59,130,246,0.03); }

/* ===== SCREEN MANAGEMENT ===== */
.screen { display: none; min-height: 100vh; }
.screen.active { display: block; }

/* ===== AUTH SCREENS ===== */
.auth-wrapper {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1fr 1fr;
}

.auth-hero {
  background: var(--bg-dark);
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 4rem;
  overflow: hidden;
}

.auth-hero::before {
  content: '';
  position: absolute;
  inset: 0;
  background: 
    radial-gradient(circle at 20% 80%, rgba(59,130,246,0.35), transparent 50%),
    radial-gradient(circle at 80% 20%, rgba(96,165,250,0.18), transparent 50%),
    radial-gradient(circle at 50% 50%, rgba(147,197,253,0.08), transparent 70%);
}
.auth-hero::after {
  content: '';
  position: absolute;
  inset: 0;
  background: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.65' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.03'/%3E%3C/svg%3E");
  pointer-events: none;
}

.auth-hero-content { position: relative; z-index: 1; }

.auth-hero .brand {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 3rem;
}

.brand-icon {
  width: 44px;
  height: 44px;
  background: var(--accent);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  color: white;
  font-size: 18px;
  letter-spacing: -1px;
}
.sidebar .brand-icon,
.mobile-nav .brand-icon { display: none !important; }

.tfa-digit:focus {
  border-color: var(--accent) !important;
  box-shadow: 0 0 0 3px rgba(59,130,246,0.15);
}

.brand-text {
  color: white;
  font-family: 'DM Serif Display', serif;
  font-size: 2.4rem;
  letter-spacing: 6px;
}

.auth-hero h1 {
  color: white;
  font-size: 3rem;
  line-height: 1.15;
  margin-bottom: 1.25rem;
}

.auth-hero p {
  color: rgba(255,255,255,0.6);
  font-size: 1.05rem;
  max-width: 420px;
  line-height: 1.7;
}

.auth-features {
  margin-top: 3rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.auth-feature {
  display: flex;
  align-items: center;
  gap: 12px;
  color: rgba(255,255,255,0.7);
  font-size: 0.9rem;
}

.auth-feature-icon {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: rgba(59,130,246,0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--accent-glow);
  flex-shrink: 0;
  font-size: 14px;
}

.auth-form-side {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  background: var(--bg);
}

.auth-form-container {
  width: 100%;
  max-width: 420px;
  animation: fadeIn 0.6s ease;
}

.auth-form-container h2 {
  font-size: 1.85rem;
  margin-bottom: 0.35rem;
}

.auth-form-container .subtitle {
  color: var(--text-muted);
  margin-bottom: 2rem;
  font-size: 0.95rem;
}

.form-group {
  margin-bottom: 1.25rem;
}

.form-group label {
  display: block;
  font-weight: 600;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--text-muted);
  margin-bottom: 0.4rem;
}

.form-group input, .form-group select, .form-group textarea {
  width: 100%;
  padding: 0.75rem 1rem;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 0.95rem;
  background: var(--bg-card);
  color: var(--text);
  transition: var(--transition);
  outline: none;
}

.form-group input:focus, .form-group select:focus, .form-group textarea:focus {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(59,130,246,0.1);
  animation: focusGlow 2s ease infinite;
}

.form-group input::placeholder { color: var(--text-light); }

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0.8rem 1.5rem;
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-weight: 600;
  font-size: 0.88rem;
  cursor: pointer;
  border: none;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  text-decoration: none;
  position: relative;
  overflow: hidden;
  letter-spacing: 0.01em;
}

.btn-primary {
  background: var(--accent-gradient);
  color: white;
  width: 100%;
  box-shadow: 0 2px 8px rgba(59,130,246,0.25);
}
.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 6px 20px rgba(59,130,246,0.35); }
.btn-primary:active { transform: translateY(0); box-shadow: 0 2px 8px rgba(59,130,246,0.2); }

.btn-secondary {
  background: transparent;
  color: var(--accent);
  border: 1.5px solid var(--border);
  backdrop-filter: blur(8px);
}
.btn-secondary:hover { border-color: var(--accent); background: rgba(59,130,246,0.05); transform: translateY(-1px); box-shadow: var(--shadow-sm); }

.btn-danger { background: var(--danger); color: white; }
.btn-danger:hover { background: #B91C1C; }

.btn-sm { padding: 0.5rem 1rem; font-size: 0.82rem; }
.btn-icon { width: 36px; height: 36px; padding: 0; border-radius: 8px; }

.auth-link {
  text-align: center;
  margin-top: 1.5rem;
  font-size: 0.9rem;
  color: var(--text-muted);
}
.auth-link a {
  color: var(--accent);
  text-decoration: none;
  font-weight: 600;
  cursor: pointer;
}
.auth-link a:hover { text-decoration: underline; }

.form-check {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 1.5rem;
}
.form-check input[type="checkbox"] { width: auto; accent-color: var(--accent); }
.form-check label { margin: 0; text-transform: none; letter-spacing: 0; font-weight: 400; font-size: 0.88rem; color: var(--text-muted); }

.role-toggle {
  display: flex;
  background: var(--bg);
  border-radius: var(--radius-sm);
  padding: 4px;
  margin-bottom: 1.5rem;
  border: 1.5px solid var(--border);
}
.role-toggle button {
  flex: 1;
  padding: 0.6rem;
  border: none;
  background: transparent;
  border-radius: 6px;
  font-family: inherit;
  font-weight: 600;
  font-size: 0.85rem;
  cursor: pointer;
  color: var(--text-muted);
  transition: var(--transition);
}
.role-toggle button.active {
  background: var(--accent);
  color: white;
  box-shadow: var(--shadow-sm);
}

/* ===== DASHBOARD LAYOUT ===== */
.dashboard {
  display: grid;
  grid-template-columns: 260px 1fr;
  min-height: 100vh;
  transition: grid-template-columns 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}
.dashboard.sidebar-collapsed { grid-template-columns: 72px 1fr; }

.sidebar {
  background: linear-gradient(180deg, #111827 0%, #0F172A 100%);
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  overflow-x: hidden;
  transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  width: 260px;
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,0.1) transparent;
}
.sidebar::-webkit-scrollbar { width: 4px; }
.sidebar::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); border-radius: 4px; }

.sidebar.collapsed { width: 72px; padding: 1.5rem 0.75rem; overflow-x: hidden; overflow-y: auto; }
.sidebar.collapsed .brand-text,
.sidebar.collapsed .nav-section-title,
.sidebar.collapsed .user-info { display: none; }
.sidebar.collapsed .nav-item { justify-content: center; padding: 0.65rem; font-size: 0; gap: 0; overflow: hidden; }
.sidebar.collapsed .nav-item svg { width: 20px; height: 20px; }
.sidebar.collapsed .nav-item .badge-count { display: none; }
.sidebar.collapsed .brand { justify-content: center; gap: 0; }
.sidebar.collapsed .user-badge { justify-content: center; }
.sidebar.collapsed .user-badge .name { display: none; }
.sidebar.collapsed .user-badge .user-avatar { margin: 0; }
.sidebar.collapsed .sidebar-footer .nav-item { font-size: 0; }
.sidebar .nav-item-label { white-space: nowrap; }

.sidebar .brand {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 2rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid rgba(255,255,255,0.08);
  transition: opacity 0.2s;
}
.sidebar .brand:hover { opacity: 0.8; }

.sidebar .brand-text {
  color: white;
  font-family: 'DM Serif Display', serif;
  font-size: 1.1rem;
}

.nav-section {
  margin-bottom: 2rem;
}

.nav-section-title {
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: rgba(255,255,255,0.3);
  margin-bottom: 0.75rem;
  padding-left: 0.75rem;
  font-weight: 600;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 0.7rem 0.85rem;
  border-radius: 10px;
  color: rgba(255,255,255,0.5);
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  margin-bottom: 2px;
  position: relative;
  letter-spacing: 0.01em;
}
.nav-item:hover { background: rgba(255,255,255,0.06); color: rgba(255,255,255,0.9); transform: translateX(2px); }
.msg-client-item:hover { background: var(--bg) !important; }
.msg-client-item.active { background: var(--accent-bg, rgba(59,130,246,0.1)) !important; border-left: 3px solid var(--accent); }
.nav-item.active { background: linear-gradient(135deg, rgba(59,130,246,0.3), rgba(96,165,250,0.15)); color: var(--accent-glow); box-shadow: inset 0 0 0 1px rgba(147,197,253,0.15); }
.nav-item svg { width: 18px; height: 18px; flex-shrink: 0; stroke-width: 1.8; }

.sidebar-footer {
  margin-top: auto;
  padding-top: 1.5rem;
  border-top: 1px solid rgba(255,255,255,0.06);
}

.sidebar-toggle {
  position: absolute;
  top: 1.5rem;
  right: -12px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--bg-sidebar);
  border: 1px solid rgba(255,255,255,0.12);
  color: rgba(255,255,255,0.5);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10;
  transition: all 0.3s ease;
  opacity: 0;
  padding: 0;
}
.sidebar:hover .sidebar-toggle { opacity: 1; }
.sidebar-toggle:hover { background: var(--accent); color: white; border-color: var(--accent); }
.sidebar.collapsed .sidebar-toggle { right: -12px; }
.sidebar.collapsed .sidebar-toggle svg { transform: rotate(180deg); }
.sidebar { position: relative; }

.user-badge {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0.5rem;
}

.user-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, #3B82F6, #6366F1);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-weight: 700;
  font-size: 0.82rem;
  letter-spacing: 0.5px;
  flex-shrink: 0;
}

.user-info { overflow: hidden; }
.user-info .name { color: white; font-size: 0.85rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-info .role { color: rgba(255,255,255,0.4); font-size: 0.75rem; }

.main-content {
  padding: 2.25rem 2.75rem;
  overflow-y: auto;
  max-height: 100vh;
  transition: padding 0.3s ease;
}

.page-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 2.25rem;
  animation: fadeIn 0.5s ease;
}

.page-header h1 { font-size: 1.9rem; letter-spacing: -0.02em; }
.page-header .desc { color: var(--text-muted); margin-top: 0.35rem; font-size: 0.92rem; line-height: 1.6; }

/* ===== STAT CARDS ===== */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1.25rem;
  margin-bottom: 2.25rem;
}

.stat-card {
  background: var(--bg-card);
  backdrop-filter: var(--glass);
  -webkit-backdrop-filter: var(--glass);
  border-radius: var(--radius);
  padding: 1.5rem;
  border: 1px solid var(--border);
  animation: fadeIn 0.5s ease both;
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}
.stat-card::before {
  content: '';
  position: absolute;
  top: 0;
  right: 0;
  width: 80px;
  height: 80px;
  border-radius: 50%;
  background: linear-gradient(135deg, rgba(59,130,246,0.06), transparent);
  transform: translate(20px, -20px);
}
.stat-card:hover { transform: translateY(-3px); box-shadow: var(--shadow), var(--shadow-glow); border-color: rgba(59,130,246,0.12); }

.stat-card .label {
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--text-muted);
  font-weight: 600;
  margin-bottom: 0.5rem;
}

.stat-card .value {
  font-family: 'DM Serif Display', serif;
  font-size: 1.75rem;
}

.stat-card .change {
  font-size: 0.8rem;
  margin-top: 0.35rem;
  font-weight: 600;
}
.stat-card .change.up { color: var(--success); }
.stat-card .change.down { color: var(--danger); }

/* ===== CARDS & PANELS ===== */
.card {
  background: var(--bg-card);
  backdrop-filter: var(--glass);
  -webkit-backdrop-filter: var(--glass);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  padding: 1.75rem;
  margin-bottom: 1.75rem;
  animation: fadeIn 0.5s ease both;
  transition: all 0.3s ease;
  box-shadow: var(--shadow-sm);
}
.card:hover { box-shadow: var(--shadow); border-color: rgba(0,0,0,0.08); }

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.25rem;
}

.card-header h3 { font-size: 1.15rem; }

/* ===== FINANCIAL FORM ===== */
.form-section {
  background: var(--bg-card);
  backdrop-filter: var(--glass);
  -webkit-backdrop-filter: var(--glass);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  margin-bottom: 1.25rem;
  overflow: hidden;
  animation: fadeIn 0.4s ease both;
  transition: all 0.3s ease;
  box-shadow: var(--shadow-sm);
}
.form-section:hover { box-shadow: var(--shadow); }
.form-section.open { border-left: 3px solid var(--accent); }

.form-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.5rem;
  cursor: pointer;
  transition: var(--transition);
  user-select: none;
}
.form-section-header:hover { background: rgba(59,130,246,0.03); }

.form-section-header h3 {
  font-size: 1rem;
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 10px;
}

.section-icon {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  flex-shrink: 0;
}

.section-icon.green { background: #ECFDF5; color: #059669; }
.section-icon.blue { background: #EFF6FF; color: #2563EB; }
.section-icon.purple { background: #F5F3FF; color: #7C3AED; }
.section-icon.orange { background: #FFF7ED; color: #EA580C; }
.section-icon.yellow { background: #FEFCE8; color: #CA8A04; }
.section-icon.red { background: #FEF2F2; color: #DC2626; }
.section-icon.teal { background: #F0FDFA; color: #0D9488; }

.section-toggle {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
  color: var(--text-light);
}

.form-section.open .section-toggle { transform: rotate(180deg); }

.form-section-body {
  display: none;
  padding: 0 1.5rem 1.5rem;
}

.form-section.open .form-section-body { display: block; }

.currency-input {
  position: relative;
}
.currency-input::before {
  content: '£';
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  font-weight: 600;
  pointer-events: none;
  z-index: 1;
}
.currency-input input {
  padding-left: 28px;
}

.expense-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.5rem;
  align-items: end;
  margin-bottom: 0.75rem;
}

.add-expense-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 0.5rem 0.75rem;
  background: rgba(59,130,246,0.08);
  color: var(--accent);
  border: 1px dashed var(--accent);
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  margin-top: 0.25rem;
}
.add-expense-btn:hover { background: rgba(59,130,246,0.14); }

.multi-entry {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 1.15rem;
  margin-bottom: 0.75rem;
  position: relative;
  background: rgba(247,245,242,0.4);
  animation: scaleIn 0.25s ease;
}
.multi-entry-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.85rem;
}
.multi-entry-header .entry-label {
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--text-muted);
}
.entry-remove {
  width: 26px;
  height: 26px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: white;
  color: var(--danger);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  transition: var(--transition);
}
.entry-remove:hover { background: var(--danger-bg); border-color: var(--danger); }

/* Rental expense rows */
.expense-table-header {
  display: grid;
  grid-template-columns: 1fr 1.2fr 140px 32px;
  gap: 0.5rem;
  padding: 0 0 0.4rem;
  margin-bottom: 0.4rem;
  border-bottom: 1px solid var(--border);
}
.expense-table-header span {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--text-muted);
  font-weight: 700;
}
.expense-line {
  display: grid;
  grid-template-columns: 1fr 1.2fr 140px 32px;
  gap: 0.5rem;
  align-items: center;
  margin-bottom: 0.5rem;
  animation: scaleIn 0.2s ease;
}
.expense-line input, .expense-line select {
  width: 100%;
  padding: 0.55rem 0.7rem;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 0.85rem;
  background: var(--bg-card);
  color: var(--text);
  transition: var(--transition);
  outline: none;
}
.expense-line input:focus, .expense-line select:focus {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(59,130,246,0.1);
}
.expense-line .currency-input input { padding-left: 22px; }
.expense-line .currency-input::before { left: 8px; font-size: 0.85rem; }
.expense-line-remove {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: white;
  color: var(--text-light);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  transition: var(--transition);
}
.expense-line-remove:hover { background: var(--danger-bg); color: var(--danger); border-color: var(--danger); }
.expense-total {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 1rem;
  padding-top: 0.65rem;
  border-top: 2px solid var(--text);
  margin-top: 0.25rem;
}
.expense-total .label { font-size: 0.82rem; font-weight: 700; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.5px; }
.expense-total .amount { font-family: 'DM Serif Display', serif; font-size: 1.1rem; }

/* ===== FILE UPLOAD ===== */
.upload-zone {
  border: 2px dashed rgba(59,130,246,0.25);
  border-radius: var(--radius);
  padding: 2rem;
  text-align: center;
  cursor: pointer;
  transition: all 0.3s ease;
  background: rgba(59,130,246,0.02);
  position: relative;
}
.upload-zone:hover, .upload-zone.dragover {
  border-color: var(--accent);
  background: rgba(59,130,246,0.06);
  transform: translateY(-1px);
  box-shadow: 0 4px 16px rgba(59,130,246,0.08);
}

.upload-zone svg { margin: 0 auto 0.75rem; color: var(--text-light); }
.upload-zone .upload-label { font-weight: 600; font-size: 0.92rem; margin-bottom: 0.25rem; }
.upload-zone .upload-hint { color: var(--text-muted); font-size: 0.82rem; }

.uploaded-files { margin-top: 1rem; }

.file-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.65rem 0.85rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  margin-bottom: 0.5rem;
  font-size: 0.85rem;
  animation: scaleIn 0.3s ease;
}

.file-item .file-info {
  display: flex;
  align-items: center;
  gap: 8px;
  overflow: hidden;
}

.file-item .file-name {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-weight: 500;
}

.file-item .file-size { color: var(--text-muted); flex-shrink: 0; }

.file-remove {
  background: none;
  border: none;
  color: var(--danger);
  cursor: pointer;
  padding: 4px;
  border-radius: 4px;
  font-size: 16px;
  line-height: 1;
}
.file-remove:hover { background: var(--danger-bg); }

/* ===== TABLE ===== */
.table-wrapper {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
}

th, td {
  padding: 0.85rem 1rem;
  text-align: left;
  font-size: 0.88rem;
}

th {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--text-muted);
  font-weight: 600;
  border-bottom: 1.5px solid var(--border);
  background: rgba(0,0,0,0.015);
}

td { border-bottom: 1px solid var(--border); transition: background 0.15s ease; }

tr:last-child td { border-bottom: none; }

tr:hover td { background: rgba(59,130,246,0.025); }

.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 0.35rem 0.75rem;
  border-radius: 20px;
  font-size: 0.76rem;
  font-weight: 600;
  letter-spacing: 0.01em;
}

.status-badge.pending { background: var(--warning-bg); color: var(--warning); }
.status-badge.reviewed { background: var(--success-bg); color: var(--success); }
.status-badge.action { background: var(--danger-bg); color: var(--danger); }
.status-badge.new { background: #EFF6FF; color: #2563EB; }

.status-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}

/* ===== TOAST ===== */
.toast-container {
  position: fixed;
  top: 1.5rem;
  right: 1.5rem;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.toast {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 1rem 1.25rem;
  background: var(--bg-card-solid);
  backdrop-filter: var(--glass);
  -webkit-backdrop-filter: var(--glass);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-lg);
  border-left: 4px solid var(--accent);
  font-size: 0.88rem;
  font-weight: 500;
  animation: slideInRight 0.35s cubic-bezier(0.22, 1, 0.36, 1);
  max-width: 400px;
  position: relative;
  overflow: hidden;
}
.toast::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  height: 3px;
  background: var(--accent);
  animation: toastProgress 3.5s linear forwards;
  border-radius: 0 0 0 var(--radius-sm);
}

.toast.error { border-left-color: var(--danger); }
.toast.error::after { background: var(--danger); }
.toast.success { border-left-color: var(--success); }
.toast.success::after { background: var(--success); }

/* ===== CLIENT SUBMISSION DETAIL MODAL ===== */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(15,23,42,0.45);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 1000;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  animation: fadeIn 0.2s ease;
}
.modal-overlay.active { display: flex; }

.modal {
  background: var(--bg-card-solid);
  border-radius: 18px;
  width: 100%;
  max-width: 900px;
  max-height: 85vh;
  overflow-y: auto;
  animation: scaleIn 0.35s cubic-bezier(0.22, 1, 0.36, 1);
  padding: 2.25rem;
  box-shadow: 0 25px 65px rgba(0,0,0,0.12), 0 8px 24px rgba(0,0,0,0.08);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.75rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border);
}

.modal-close {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  transition: var(--transition);
  font-size: 1rem;
}
.modal-close:hover { background: var(--bg); color: var(--text); }

.detail-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.25rem;
  margin-bottom: 1.5rem;
  padding: 1.25rem;
  background: var(--bg);
  border-radius: var(--radius-sm);
}

.detail-item label {
  display: block;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--text-muted);
  font-weight: 600;
  margin-bottom: 0.3rem;
}

.detail-item .value {
  font-weight: 600;
  font-size: 0.95rem;
}

.divider {
  height: 1px;
  background: var(--border);
  margin: 1.25rem 0;
}

/* ===== EMPTY STATE ===== */
.empty-state {
  text-align: center;
  padding: 3.5rem 2rem;
  color: var(--text-muted);
  animation: fadeIn 0.5s ease;
}
.empty-state svg { margin: 0 auto 1.25rem; color: var(--text-light); opacity: 0.5; }
.empty-state h3 { font-size: 1.15rem; margin-bottom: 0.5rem; color: var(--text); }
.empty-state p { font-size: 0.88rem; max-width: 360px; margin: 0 auto; line-height: 1.7; }

/* ===== RESPONSIVE ===== */
@media (max-width: 1024px) {
  .auth-wrapper { grid-template-columns: 1fr; }
  .auth-hero { display: none; }
  .dashboard, .dashboard:not(.sidebar-collapsed) { grid-template-columns: 1fr !important; }
  .sidebar { display: none !important; }
  .main-content { padding: 1.5rem; }
}

@media (max-width: 640px) {
  .form-row { grid-template-columns: 1fr; }
  .detail-grid { grid-template-columns: 1fr; }
  .page-header { flex-direction: column; gap: 1rem; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
}

/* ===== TAX YEAR SELECTOR ===== */
.tax-year-select {
  display: flex;
  align-items: center;
  gap: 8px;
}
.tax-year-select label {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-muted);
  white-space: nowrap;
}
.tax-year-select select {
  padding: 0.45rem 0.75rem;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 0.85rem;
  background: var(--bg-card);
  cursor: pointer;
  outline: none;
}

/* Mobile nav */
.mobile-nav {
  display: none;
  background: var(--bg-sidebar);
  padding: 1rem 1.5rem;
  align-items: center;
  justify-content: space-between;
}
.mobile-nav .brand { display: flex; align-items: center; gap: 8px; }
.mobile-nav .brand-text { color: white; font-family: 'DM Serif Display', serif; font-size: 1.3rem; letter-spacing: 3px; }
.mobile-nav-btn { background: none; border: none; color: white; font-size: 1.5rem; cursor: pointer; padding: 4px; }

@media (max-width: 1024px) {
  .mobile-nav { display: flex; }
}

/* Success screen */
.success-screen {
  text-align: center;
  padding: 3rem;
  animation: fadeIn 0.6s ease both;
}
.success-icon {
  width: 88px;
  height: 88px;
  border-radius: 50%;
  background: linear-gradient(135deg, #ECFDF5, #D1FAE5);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 1.5rem;
  box-shadow: 0 8px 30px rgba(5,150,105,0.15);
  animation: scaleIn 0.5s cubic-bezier(0.22, 1, 0.36, 1) 0.2s both;
}
.success-icon svg { color: var(--success); }

/* Notes textarea */
textarea.form-textarea {
  width: 100%;
  padding: 0.75rem 1rem;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 0.92rem;
  background: var(--bg-card);
  color: var(--text);
  transition: var(--transition);
  outline: none;
  resize: vertical;
  min-height: 80px;
}
textarea.form-textarea:focus {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(59,130,246,0.1);
}

/* password visibility toggle */
.password-wrapper { position: relative; }
.password-wrapper input { padding-right: 40px; }
.password-toggle {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-muted);
  font-size: 14px;
  padding: 4px;
}

/* ===== CORPORATION TAX EXPENSE SHEET ===== */
.ct-wrap { animation: fadeIn 0.5s ease forwards; }
.ct-wrap *, .ct-wrap *::before, .ct-wrap *::after { box-sizing: border-box; }
.ct-wrap input[type=number]::-webkit-inner-spin-button, .ct-wrap input[type=number]::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
.ct-wrap input[type=number] { -moz-appearance: textfield; }

.ct-period-bar { background: linear-gradient(135deg, var(--bg-dark), #1E293B); border-radius: var(--radius); padding: 16px 20px; margin-bottom: 20px; display: flex; justify-content: space-between; align-items: center; color: #fff; }
.ct-period-bar .ct-plbl { font-size: 0.7rem; opacity: 0.5; text-transform: uppercase; letter-spacing: 1px; }
.ct-period-bar .ct-pval { font-size: 1.1rem; font-weight: 700; font-family: 'DM Serif Display', serif; }
.ct-period-bar .ct-nv { font-size: 1.25rem; font-weight: 800; font-family: monospace; color: #93C5FD; }
.ct-period-bar .ct-nv.negative { color: #ee6a6a; }

.ct-tabs { display: flex; gap: 4px; overflow-x: auto; padding-bottom: 4px; margin-bottom: 20px; flex-wrap: wrap; }
.ct-tab { padding: 8px 16px; border: 1.5px solid var(--border); border-radius: var(--radius-sm); cursor: pointer; font-size: 0.8rem; font-weight: 500; color: var(--text-muted); background: var(--bg-card); white-space: nowrap; transition: var(--transition); font-family: 'Plus Jakarta Sans', sans-serif; }
.ct-tab:hover { border-color: var(--accent); color: var(--accent); }
.ct-tab.active { background: var(--accent); color: #fff; border-color: var(--accent); font-weight: 700; }

.ct-panel { display: none; }
.ct-panel.active { display: block; }

.ct-section { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px 24px; margin-bottom: 16px; box-shadow: var(--shadow-sm); }
.ct-section-title { font-size: 1rem; font-weight: 400; color: var(--text); margin-bottom: 12px; display: flex; align-items: center; gap: 8px; padding-bottom: 8px; border-bottom: 2px solid var(--accent); font-family: 'DM Serif Display', serif; }
.ct-section-title .ct-icon { font-size: 16px; }

.ct-field-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.ct-field-grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 14px; }
.ct-field { display: flex; flex-direction: column; gap: 4px; }
.ct-field label { font-size: 0.68rem; font-weight: 600; color: var(--text-muted); letter-spacing: 0.5px; text-transform: uppercase; }
.ct-field .ct-iw { position: relative; }
.ct-field .ct-pfx { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); color: var(--text-light); font-size: 0.82rem; font-weight: 600; pointer-events: none; }
.ct-field input, .ct-field select { width: 100%; padding: 8px 12px; border: 1.5px solid var(--border); border-radius: var(--radius-sm); font-size: 0.85rem; font-family: 'Plus Jakarta Sans', sans-serif; background: var(--bg); color: var(--text); outline: none; transition: var(--transition); }
.ct-field input:focus, .ct-field select:focus { border-color: var(--accent); }
.ct-field input.ct-has-pfx { padding-left: 22px; }
.ct-field input[readonly] { background: #eef4f6; color: var(--text-muted); }

.ct-ch-wrap { position: relative; margin-bottom: 12px; }
.ct-ch-input { width: 100%; padding: 10px 14px 10px 34px; border: 2px solid var(--accent); border-radius: var(--radius-sm); font-size: 0.88rem; font-family: 'Plus Jakarta Sans', sans-serif; background: #f8fffc; outline: none; }
.ct-ch-input:focus { box-shadow: 0 0 0 3px rgba(59,130,246,0.15); }
.ct-ch-icon { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); font-size: 14px; color: var(--accent); pointer-events: none; }
.ct-ch-spinner { position: absolute; right: 12px; top: 50%; transform: translateY(-50%); width: 18px; height: 18px; border: 2px solid var(--border); border-top-color: var(--accent); border-radius: 50%; animation: spin 0.6s linear infinite; display: none; }
@keyframes ctspin { to { transform: translateY(-50%) rotate(360deg); } }
.ct-ch-results { position: absolute; top: calc(100% + 4px); left: 0; right: 0; background: #fff; border: 1.5px solid var(--border); border-radius: var(--radius-sm); box-shadow: var(--shadow-lg); z-index: 100; max-height: 260px; overflow-y: auto; display: none; }
.ct-ch-item { padding: 10px 14px; cursor: pointer; border-bottom: 1px solid #f0f4f6; font-size: 0.82rem; }
.ct-ch-item:hover { background: var(--success-bg); }
.ct-ch-item:last-child { border-bottom: none; }
.ct-ch-name { font-weight: 600; }
.ct-ch-meta { font-size: 0.72rem; color: var(--text-muted); margin-top: 2px; display: flex; gap: 10px; }
.ct-ch-badge { display: inline-block; padding: 1px 6px; border-radius: 3px; font-size: 0.6rem; font-weight: 700; }
.ct-badge-active { background: var(--success-bg); color: var(--success); }
.ct-badge-dissolved { background: var(--danger-bg); color: var(--danger); }
.ct-ch-no { padding: 16px; text-align: center; color: var(--text-muted); font-size: 0.82rem; }

.ct-sel-card { background: #EFF6FF; border: 1.5px solid #BFDBFE; border-radius: var(--radius-sm); padding: 14px 18px; margin-bottom: 12px; position: relative; }
.ct-sel-card .ct-sel-x { position: absolute; top: 6px; right: 10px; background: none; border: none; font-size: 16px; color: var(--text-muted); cursor: pointer; }
.ct-sel-name { font-size: 1rem; font-weight: 400; color: var(--text); font-family: 'DM Serif Display', serif; }
.ct-sel-num { font-size: 0.72rem; color: var(--accent); font-family: monospace; margin-bottom: 8px; }
.ct-sel-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 6px; }
.ct-sel-item { background: #fff; border-radius: 5px; padding: 5px 8px; border: 1px solid #c8e0d0; }
.ct-sel-item .ct-sl { font-size: 0.55rem; color: var(--accent); text-transform: uppercase; letter-spacing: 0.8px; font-weight: 600; }
.ct-sel-item .ct-sv { font-size: 0.78rem; color: var(--text); font-weight: 600; }
.ct-filled-tag { display: inline-block; margin-left: 4px; padding: 1px 5px; background: var(--accent); color: #fff; font-size: 0.5rem; border-radius: 3px; font-weight: 700; vertical-align: middle; }

.ct-period-info { background: var(--success-bg); border: 1.5px solid #b8dcc8; border-radius: var(--radius-sm); padding: 14px 18px; margin-top: 14px; }
.ct-pi-title { font-size: 0.82rem; font-weight: 700; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.ct-pi-tag { background: var(--accent); color: #fff; font-size: 0.58rem; padding: 2px 7px; border-radius: 3px; font-weight: 600; }
.ct-pi-detail { font-size: 0.72rem; color: var(--accent); margin-top: 4px; line-height: 1.5; }
.ct-pi-months { display: flex; flex-wrap: wrap; gap: 3px; margin-top: 6px; }
.ct-pi-chip { padding: 3px 8px; background: #fff; border: 1px solid #BFDBFE; border-radius: 3px; font-size: 0.65rem; font-weight: 600; color: var(--accent); font-family: monospace; }

.ct-hint { background: var(--success-bg); border: 1px solid #c8e8d8; border-radius: var(--radius-sm); padding: 10px 14px; margin-top: 8px; font-size: 0.72rem; line-height: 1.6; color: var(--accent); }

.ct-scroll { overflow-x: auto; margin-bottom: 4px; }
.ct-mh { display: flex; align-items: center; gap: 0; margin-bottom: 3px; }
.ct-mh .ct-cat { min-width: 200px; max-width: 200px; padding: 5px 8px; font-size: 0.62rem; font-weight: 700; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.8px; }
.ct-mh .ct-mc { width: 80px; min-width: 80px; padding: 5px 2px; font-size: 0.62rem; text-align: center; font-weight: 700; color: #fff; background: var(--bg-dark); line-height: 1.3; }
.ct-mh .ct-mc .ct-my { display: block; font-size: 0.52rem; opacity: 0.6; }
.ct-mh .ct-tc { width: 90px; min-width: 90px; padding: 5px 8px; font-size: 0.62rem; text-align: center; font-weight: 700; color: #fff; background: var(--accent); border-radius: 0 4px 0 0; }

.ct-mr { display: flex; align-items: center; gap: 0; margin-bottom: 2px; }
.ct-mr .ct-rl { min-width: 200px; max-width: 200px; font-size: 0.82rem; color: var(--text); font-weight: 500; padding: 7px 8px; background: var(--bg); border-radius: 4px 0 0 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ct-mr input { width: 80px; min-width: 80px; padding: 7px 4px; border: 1px solid var(--border); font-size: 0.82rem; text-align: right; font-family: monospace; color: var(--text); outline: none; background: #fff; }
.ct-mr input:focus { background: #e8fff5 !important; }
.ct-mr .ct-rt { width: 90px; min-width: 90px; padding: 7px 8px; background: var(--success-bg); border-radius: 0 4px 4px 0; font-size: 0.82rem; text-align: right; font-weight: 700; font-family: monospace; color: var(--accent); }

.ct-auto .ct-rl { color: var(--accent); font-weight: 600; background: #e0f0e8; }
.ct-auto .ct-ac { width: 80px; min-width: 80px; padding: 7px 4px; border: 1px solid var(--border); font-size: 0.82rem; text-align: right; font-family: monospace; background: #e8f8f0; color: var(--accent); }
.ct-auto .ct-rt { background: #c8e8d0; }

.ct-total-bar { display: flex; justify-content: space-between; align-items: center; padding: 9px 14px; border-radius: var(--radius-sm); margin-top: 6px; margin-bottom: 10px; }
.ct-total-bar .ct-tl { font-size: 0.82rem; font-weight: 400; color: #fff; font-family: 'DM Serif Display', serif; }
.ct-total-bar .ct-tv { font-size: 0.95rem; font-weight: 800; color: #fff; font-family: monospace; }

.ct-inc-add { display: flex; gap: 8px; align-items: end; margin-bottom: 14px; flex-wrap: wrap; }
.ct-inc-add select, .ct-inc-add input[type=text] { padding: 8px 12px; border: 1.5px solid var(--border); border-radius: var(--radius-sm); font-size: 0.82rem; font-family: 'Plus Jakarta Sans', sans-serif; background: var(--bg); outline: none; flex: 1; min-width: 150px; }
.ct-add-btn { padding: 8px 18px; border: 1.5px solid var(--accent); border-radius: var(--radius-sm); background: var(--success-bg); color: var(--accent); cursor: pointer; font-size: 0.8rem; font-weight: 700; font-family: 'Plus Jakarta Sans', sans-serif; white-space: nowrap; }
.ct-add-btn:hover { background: var(--accent); color: #fff; }

.ct-inc-rm { width: 18px; min-width: 18px; height: 18px; border: none; background: var(--danger-bg); color: var(--danger); border-radius: 3px; cursor: pointer; font-size: 10px; font-weight: 700; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }

.ct-dyn-row { display: flex; gap: 6px; margin-bottom: 4px; align-items: center; }
.ct-dyn-row input.ct-dn { flex: 1; padding: 6px 10px; border: 1.5px solid var(--border); border-radius: var(--radius-sm); font-size: 0.8rem; font-family: 'Plus Jakarta Sans', sans-serif; background: var(--bg); outline: none; }
.ct-dyn-row .ct-daw { position: relative; width: 110px; }
.ct-dyn-row .ct-daw .ct-pfx { position: absolute; left: 8px; top: 50%; transform: translateY(-50%); color: var(--text-light); font-size: 0.72rem; font-weight: 600; pointer-events: none; }
.ct-dyn-row input.ct-da { width: 100%; padding: 6px 10px 6px 20px; border: 1.5px solid var(--border); border-radius: var(--radius-sm); font-size: 0.8rem; font-family: monospace; background: var(--bg); outline: none; text-align: right; }
.ct-dyn-row .ct-drm { background: none; border: none; cursor: pointer; color: var(--danger); font-size: 14px; padding: 0 4px; }
.ct-dyn-add { background: none; border: 1.5px dashed var(--border); border-radius: var(--radius-sm); padding: 5px 14px; font-size: 0.72rem; color: var(--text-muted); cursor: pointer; font-family: 'Plus Jakarta Sans', sans-serif; font-weight: 600; margin-top: 4px; }
.ct-dyn-add:hover { background: var(--bg); border-color: var(--accent); color: var(--accent); }
.ct-subtotal { text-align: right; font-size: 0.8rem; font-weight: 700; font-family: monospace; color: var(--accent); margin-top: 4px; }

.ct-rev-row { display: flex; justify-content: space-between; align-items: center; padding: 9px 14px; border-bottom: 1px solid var(--border); font-size: 0.85rem; }
.ct-rev-row.ct-rev-inc { background: var(--success-bg); }
.ct-rev-dot { width: 8px; height: 8px; border-radius: 2px; display: inline-block; margin-right: 8px; }
.ct-rev-label { display: flex; align-items: center; font-weight: 500; }
.ct-rev-label.bold { font-weight: 700; }
.ct-rev-val { font-weight: 700; font-family: monospace; }
.ct-rev-val.income { color: var(--success); }
.ct-rev-val.expense { color: var(--danger); }
.ct-divider { height: 2px; background: linear-gradient(90deg, var(--bg-dark), var(--accent), var(--bg-dark)); margin: 8px 0; }
.ct-net-bar { display: flex; justify-content: space-between; align-items: center; padding: 14px 18px; border-radius: var(--radius-sm); margin-top: 8px; }
.ct-net-bar .ct-nb-l { font-size: 1.05rem; font-weight: 400; color: #fff; font-family: 'DM Serif Display', serif; }
.ct-net-bar .ct-nb-v { font-size: 1.3rem; font-weight: 800; font-family: monospace; color: #fff; }

.ct-no-period { text-align: center; padding: 30px 16px; color: var(--text-muted); }
.ct-no-period p { font-size: 0.85rem; line-height: 1.6; }
.ct-review-grid { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 10px; margin-bottom: 16px; }
.ct-review-box { background: var(--bg); border-radius: var(--radius-sm); padding: 12px; }
.ct-review-box .ct-rbl { font-size: 0.6rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.8px; }
.ct-review-box .ct-rbv { font-size: 0.92rem; font-weight: 600; margin-top: 2px; }
.ct-sub-title { font-size: 0.82rem; color: var(--text); margin-bottom: 6px; font-weight: 600; margin-top: 16px; }
.ct-table-wrap { min-width: max-content; }

/* Submission choice modal */
.sub-choice-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.5); z-index: 1000; display: flex; align-items: center; justify-content: center; animation: fadeIn 0.2s ease; }
.sub-choice-modal { background: #fff; border-radius: var(--radius); padding: 2rem; max-width: 480px; width: 90%; box-shadow: var(--shadow-lg); animation: scaleIn 0.3s ease; }
.sub-choice-modal h2 { font-family: 'DM Serif Display', serif; font-size: 1.35rem; margin-bottom: 0.5rem; }
.sub-choice-modal p { color: var(--text-muted); font-size: 0.88rem; margin-bottom: 1.5rem; }
.sub-choice-options { display: flex; flex-direction: column; gap: 12px; }
.sub-choice-btn { display: flex; align-items: center; gap: 14px; padding: 16px 20px; border: 1.5px solid var(--border); border-radius: var(--radius-sm); cursor: pointer; background: #fff; transition: var(--transition); text-align: left; font-family: 'Plus Jakarta Sans', sans-serif; }
.sub-choice-btn:hover { border-color: var(--accent); background: var(--success-bg); }
.sub-choice-btn .sc-icon { width: 44px; height: 44px; border-radius: 10px; display: flex; align-items: center; justify-content: center; font-size: 20px; flex-shrink: 0; }
.sub-choice-btn .sc-title { font-size: 0.95rem; font-weight: 700; color: var(--text); }
.sub-choice-btn .sc-desc { font-size: 0.78rem; color: var(--text-muted); margin-top: 2px; }
.sub-choice-cancel { text-align: center; margin-top: 14px; }
.sub-choice-cancel button { background: none; border: none; color: var(--text-muted); font-size: 0.85rem; cursor: pointer; font-family: 'Plus Jakarta Sans', sans-serif; padding: 8px 16px; }
.sub-choice-cancel button:hover { color: var(--text); }
.sub-type-badge { display: inline-block; padding: 2px 8px; border-radius: 4px; font-size: 0.68rem; font-weight: 700; letter-spacing: 0.3px; }
.sub-type-sa { background: #EEF2FF; color: #4338CA; }
.sub-type-ct { background: var(--success-bg); color: var(--accent); }

.sub-hist-tab { transition: var(--transition); display: inline-flex; align-items: center; }
.sub-hist-tab.active { background: #EEF2FF !important; color: #4338CA !important; border-color: #C7D2FE !important; }

@media (max-width: 768px) {
  .ct-field-grid, .ct-field-grid-3 { grid-template-columns: 1fr; }
  .ct-review-grid { grid-template-columns: 1fr; }
  .ct-inc-add { flex-direction: column; }
}

/* ===== MOBILE MENU ===== */
.mobile-menu {
  display: none;
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  padding: 0.5rem 1rem;
  flex-direction: column;
}
.mobile-menu.open { display: flex; }
.mobile-menu-item {
  padding: 0.75rem 1rem;
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text);
  cursor: pointer;
  border-radius: var(--radius-sm);
  transition: var(--transition);
}
.mobile-menu-item:hover, .mobile-menu-item.active {
  background: var(--success-bg);
  color: var(--accent);
}

/* ===== MOBILE OVERRIDES ===== */
@media (max-width: 1024px) {
  /* Main content */
  .main-content { padding: 1rem !important; max-height: none !important; }
  .page-header h1 { font-size: 1.4rem; }

  /* Tables scroll horizontally */
  .table-wrapper { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .table-wrapper table { min-width: 500px; }

  /* CT monthly tables scroll */
  .ct-panel { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .ct-table-wrap { min-width: 700px; }

  /* CT tabs row scrolls */
  .ct-tabs { overflow-x: auto; -webkit-overflow-scrolling: touch; flex-wrap: nowrap; gap: 2px; padding-bottom: 4px; }
  .ct-tab { white-space: nowrap; flex-shrink: 0; font-size: 0.68rem; padding: 8px 10px; }

  /* CT nav buttons */
  .ct-nav { padding: 12px 8px; }

  /* Modal */
  .modal { max-width: 95vw; max-height: 90vh; padding: 1.25rem; margin: 0.5rem; }
  .modal-overlay { padding: 0.5rem; }

  /* Stats grid */
  .stats-grid { grid-template-columns: 1fr 1fr; gap: 0.75rem; }

  /* Accountant messages grid — stack on mobile */
  .admin-chat-grid { grid-template-columns: 1fr !important; }

  /* Sub choice modal */
  .sub-choice-modal { padding: 1.5rem; }

  /* Auth form */
  .auth-card { padding: 1.5rem; }

  /* History tabs wrap */
  .sub-hist-tab { font-size: 0.78rem !important; padding: 7px 12px !important; }
}

@media (max-width: 640px) {
  .form-row { grid-template-columns: 1fr; }
  .detail-grid { grid-template-columns: 1fr; }
  .page-header { flex-direction: column; gap: 0.75rem; align-items: stretch; }
  .page-header .btn { width: 100%; }
  .stats-grid { grid-template-columns: 1fr; }

  /* CT fields */
  .ct-field-grid, .ct-field-grid-3 { grid-template-columns: 1fr; }
  .ct-period-bar { flex-direction: column; gap: 8px; text-align: center; }
  .ct-period-bar > div:last-child { text-align: center; }

  /* Buttons stack */
  .success-screen { padding: 1.5rem; }
  .success-screen div[style*="display:flex"] { flex-direction: column; }

  /* Submission choice */
  .sub-choice-btn { padding: 12px 14px; }
  .sub-choice-btn .sc-icon { width: 36px; height: 36px; font-size: 16px; }

  /* Modal action buttons wrap */
  .modal .btn-sm { font-size: 0.75rem; padding: 6px 10px; }
}

/* ===== COMPREHENSIVE MOBILE FIXES ===== */
@media (max-width: 480px) {
  /* Prevent horizontal overflow everywhere */
  body, html { overflow-x: hidden; }
  .main-content { padding: 0.75rem !important; }

  /* Page header */
  .page-header { flex-direction: column; gap: 0.5rem; align-items: stretch !important; }
  .page-header h1 { font-size: 1.2rem; }
  .page-header .btn { width: 100%; font-size: 0.82rem; padding: 10px 12px; }
  .page-header .desc { font-size: 0.78rem; }

  /* Stats grid — 2 cols on small mobile */
  .stats-grid { grid-template-columns: 1fr 1fr !important; gap: 0.5rem; }
  .stat-card { padding: 0.75rem 0.85rem; }
  .stat-card .label { font-size: 0.6rem; }
  .stat-card .value { font-size: 1.1rem; }

  /* Quick action cards — 2 cols */
  .client-action-card { padding: 0.75rem; min-height: auto; }
  .client-action-card .action-icon { width: 32px; height: 32px; margin-bottom: 6px; }
  .client-action-card .action-icon svg { width: 18px; height: 18px; }
  .client-action-card .action-label { font-size: 0.72rem; }
  .client-action-card .action-desc { font-size: 0.62rem; }

  /* SA form sections */
  .form-section-header { padding: 0.75rem 1rem; }
  .form-section-header h3 { font-size: 0.85rem; }
  .form-section-body { padding: 0.75rem 1rem; }
  .section-icon { width: 24px; height: 24px; font-size: 0.65rem; }

  /* Tax year select — stack */
  .tax-year-select { flex-direction: column; align-items: flex-start; gap: 4px; }
  .tax-year-select select { width: 100%; }

  /* SA draft indicator */
  #sa_saveIndicator { font-size: 0.65rem; }

  /* Upload zone */
  .upload-zone { padding: 1.25rem 0.75rem; }
  .upload-zone .upload-label { font-size: 0.82rem; }
  .upload-zone .upload-hint { font-size: 0.68rem; }

  /* Currency inputs */
  .currency-input input { font-size: 0.85rem; }

  /* Cards */
  .card { padding: 0.75rem; border-radius: 8px; }

  /* Tables — force scroll */
  .table-wrapper { margin: 0 -0.75rem; padding: 0 0.75rem; }
  .table-wrapper table { min-width: 450px; font-size: 0.75rem; }
  th, td { padding: 6px 8px; }

  /* CT tabs — smaller */
  .ct-tabs { gap: 1px; }
  .ct-tab { font-size: 0.6rem !important; padding: 6px 7px !important; }
  .ct-wrap { padding: 0; }
  .ct-section { padding: 0.75rem; margin-bottom: 0.75rem; }
  .ct-section-title { font-size: 0.82rem; }
  .ct-hint { font-size: 0.72rem; padding: 8px 10px; }
  .ct-ch-input { font-size: 0.85rem; }
  .ct-total-bar { font-size: 0.78rem; padding: 10px 12px; }
  .ct-nav { padding: 8px; gap: 6px; }
  .ct-nav .btn { font-size: 0.75rem; padding: 8px 12px; }

  /* Help popup — mobile friendly */
  .help-popup { max-width: 95vw; padding: 1.25rem; margin: 0.5rem; }
  .help-popup h3 { font-size: 0.95rem; }
  .help-popup p { font-size: 0.82rem; }
  .help-popup ul { font-size: 0.8rem; }
  .help-popup-overlay { padding: 0.5rem; }

  /* Tax year picker popup */
  .tax-year-popup { padding: 1.25rem !important; }
  .tax-year-popup h2 { font-size: 1.1rem; }
  .tax-year-popup select { font-size: 0.88rem; padding: 10px; }

  /* Modal */
  .modal { max-width: 100vw !important; margin: 0 !important; border-radius: 12px 12px 0 0; max-height: 92vh; }
  .modal-overlay { padding: 0 !important; align-items: flex-end !important; }
  .modal-header h2 { font-size: 1rem; }

  /* Submission choice */
  .sub-choice-modal { padding: 1rem; }
  .sub-choice-btn { padding: 10px 12px; }
  .sub-choice-btn .sc-title { font-size: 0.85rem; }
  .sub-choice-btn .sc-desc { font-size: 0.72rem; }

  /* Messages */
  .msg-input-row { flex-direction: column; }
  .msg-input-row textarea { min-height: 60px; }
  .msg-input-row .btn { width: 100%; }

  /* Action items */
  #clientActionItems div[style*="padding:10px"] { padding: 8px 0.75rem !important; font-size: 0.8rem; }

  /* Engagement form */
  .form-group label { font-size: 0.8rem; }
  .form-group input, .form-group select, .form-group textarea { font-size: 0.85rem; padding: 8px 10px; }

  /* Invoice table */
  .invoice-header { flex-direction: column; gap: 6px; }

  /* Breadcrumb / back buttons */
  .btn-sm { font-size: 0.72rem !important; padding: 4px 10px !important; }

  /* Dynamic entry rows */
  .add-expense-btn { font-size: 0.75rem; padding: 6px 10px; }
  .expense-total { font-size: 0.78rem; }

  /* Ensure no horizontal overflow from inline styles */
  [style*="display:grid"][style*="repeat(auto-fit"] { grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)) !important; }
  [style*="grid-template-columns:repeat(4"] { grid-template-columns: repeat(2, 1fr) !important; }
  [style*="grid-template-columns:repeat(3"] { grid-template-columns: repeat(2, 1fr) !important; }
  [style*="grid-template-columns:1fr 1fr 1fr 1fr"] { grid-template-columns: 1fr 1fr !important; }
}

/* ===== PHASE 1+2 MOBILE FIXES ===== */
@media (max-width: 640px) {
  /* Reporting page — period buttons + new debtors/WIP buttons wrap */
  #rptPeriodBtns { flex-wrap: wrap; gap: 4px; }
  #rptPeriodBtns button { font-size: 0.72rem !important; padding: 5px 10px !important; }

  /* WIP log table — key columns only */
  #rptContent table th:nth-child(4),
  #rptContent table td:nth-child(4) { display: none; } /* hide Staff col */

  /* Reminders table */
  #remindersTable table th:nth-child(4),
  #remindersTable table td:nth-child(4) { display: none; } /* hide Notes col */

  /* Aged debtors — hide middle buckets on tiny screens */
  #rptContent table th:nth-child(4),
  #rptContent table td:nth-child(4),
  #rptContent table th:nth-child(5),
  #rptContent table td:nth-child(5) { display: none; }

  /* ENGLET table */
  #engLettersPane table th:nth-child(2),
  #engLettersPane table td:nth-child(2) { display: none; } /* hide services col */

  /* Email thread modal */
  .modal { max-height: 92vh; }

  /* Account manager card — stack */
  .acc-mgr-card { flex-direction: column !important; }

  /* Notification bell — reposition for mobile */
  #notifBellWrap { top: 12px !important; right: 12px !important; }
}

@media (max-width: 480px) {
  /* Stats grid in debtors/WIP report */
  #rptContent .stats-grid { grid-template-columns: 1fr 1fr !important; }

  /* WIP add button — full width */
  #rptContent .page-header,
  #remindersTable > div > div:first-child { flex-wrap: wrap; }

  /* Reminders table — compress */
  #remindersTable table { font-size: 0.75rem; }
  #remindersTable table td, #remindersTable table th { padding: 7px 8px !important; }

  /* WIP modal grid — stack */
  #wip_hours, #wip_rate, #wip_date { width: 100% !important; }
}

/* Tablet portrait — between 481px and 768px */
@media (min-width: 481px) and (max-width: 768px) {
  .stats-grid { grid-template-columns: 1fr 1fr !important; }
  .page-header { flex-wrap: wrap; }
  .ct-tab { font-size: 0.65rem !important; padding: 7px 9px !important; }
  .help-popup { max-width: 90vw; }
  .modal { max-width: 92vw; }
}

.breadcrumb {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-bottom: 0.5rem;
  flex-wrap: wrap;
}
.breadcrumb-item {
  cursor: pointer;
  color: var(--accent);
  transition: opacity 0.15s;
}
.breadcrumb-item:hover { opacity: 0.7; text-decoration: underline; }
.breadcrumb-sep { color: var(--text-muted); font-size: 0.7rem; }
.breadcrumb-current { color: var(--text-muted); }
@media (max-width: 480px) { .breadcrumb { font-size: 0.72rem; } }

/* Global Search (Cmd+K) */
.search-overlay{position:fixed;inset:0;background:rgba(0,0,0,0.5);z-index:9998;display:none;align-items:flex-start;justify-content:center;padding-top:min(20vh,140px);backdrop-filter:blur(4px)}
.search-overlay.active{display:flex}
.search-box{width:min(580px,92vw);background:#FFFFFF;border-radius:16px;box-shadow:0 24px 80px rgba(0,0,0,0.25);overflow:hidden;animation:searchIn .15s ease}
@keyframes searchIn{from{opacity:0;transform:scale(.97) translateY(-8px)}to{opacity:1;transform:none}}
.search-input-wrap{display:flex;align-items:center;gap:10px;padding:14px 18px;border-bottom:1px solid #E2E8F0;background:#FFFFFF}
.search-input-wrap svg{flex-shrink:0;color:#94A3B8}
.search-input-wrap input{flex:1;border:none;outline:none;font-size:1rem;font-family:inherit;background:transparent;color:#1E293B}
.search-input-wrap kbd{font-size:.68rem;padding:2px 6px;border-radius:4px;background:#F1F5F9;border:1px solid #E2E8F0;color:#64748B;font-family:inherit}
.search-results{max-height:min(50vh,400px);overflow-y:auto;background:#FFFFFF}
.search-item{display:flex;align-items:center;gap:12px;padding:10px 18px;cursor:pointer;transition:background .1s;border-bottom:1px solid #F1F5F9}
.search-item:hover,.search-item.active{background:#F1F5F9}
.search-item-icon{width:36px;height:36px;border-radius:10px;display:flex;align-items:center;justify-content:center;flex-shrink:0;font-size:.75rem;font-weight:700}
.search-item-text{flex:1;min-width:0}
.search-item-title{font-size:.88rem;font-weight:600;color:#1E293B;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.search-item-sub{font-size:.75rem;color:#64748B;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.search-item-badge{font-size:.68rem;padding:2px 8px;border-radius:6px;font-weight:600;white-space:nowrap}
.search-section-title{font-size:.68rem;font-weight:700;text-transform:uppercase;letter-spacing:.5px;color:#94A3B8;padding:12px 18px 4px;background:#FAFBFC}

/* Nav Badges */
.nav-badge{display:inline-flex;align-items:center;justify-content:center;min-width:18px;height:18px;padding:0 5px;border-radius:9px;font-size:.65rem;font-weight:700;line-height:1;margin-left:auto;flex-shrink:0}
.nav-badge-danger{background:#FEE2E2;color:#DC2626}
.nav-badge-warning{background:#FEF3C7;color:#D97706}
.nav-badge-info{background:#DBEAFE;color:#2563EB}
.nav-badge-success{background:#D1FAE5;color:#059669}
.nav-item{display:flex;align-items:center}
.sidebar.collapsed .nav-badge{display:none}

/* ===== DESIGN UPGRADE v54+ ===== */

/* Sortable table headers */
th.sortable { cursor: pointer; user-select: none; position: relative; padding-right: 1.5rem; }
th.sortable::after { content: '⇅'; position: absolute; right: 4px; top: 50%; transform: translateY(-50%); font-size: 0.65rem; opacity: 0.3; }
th.sortable.asc::after { content: '↑'; opacity: 0.8; color: var(--accent); }
th.sortable.desc::after { content: '↓'; opacity: 0.8; color: var(--accent); }
th.sortable:hover { color: var(--accent); }
th.sortable:hover::after { opacity: 0.6; }

/* Toast animation upgrade */
.toast-container .toast {
  animation: toastSlideIn 0.35s cubic-bezier(0.22, 1, 0.36, 1) both;
}
.toast-container .toast.toast-out {
  animation: toastSlideOut 0.3s ease forwards;
}
@keyframes toastSlideIn { from { opacity: 0; transform: translateX(40px) scale(0.95); } to { opacity: 1; transform: translateX(0) scale(1); } }
@keyframes toastSlideOut { from { opacity: 1; transform: translateX(0); } to { opacity: 0; transform: translateX(40px) scale(0.95); } }

/* Sidebar colour variation */
.nav-item.active {
  background: linear-gradient(135deg, rgba(99,102,241,0.25), rgba(59,130,246,0.15));
  color: #C7D2FE;
  box-shadow: inset 0 0 0 1px rgba(165,180,252,0.15);
}

/* Dashboard section headers */
.dash-section { margin-bottom: 2rem; }
.dash-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
  cursor: pointer;
  padding: 0.5rem 0;
}
.dash-section-header h3 {
  font-size: 1rem;
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-weight: 700;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 8px;
}
.dash-section-header .dash-collapse-icon {
  transition: transform 0.25s ease;
  color: var(--text-light);
}
.dash-section-header.collapsed .dash-collapse-icon {
  transform: rotate(-90deg);
}

/* Empty state illustrations */
.empty-state-illustration {
  width: 120px;
  height: 120px;
  margin: 0 auto 1.5rem;
  border-radius: 50%;
  background: linear-gradient(135deg, #EFF6FF, #E0E7FF);
  display: flex;
  align-items: center;
  justify-content: center;
  animation: scaleIn 0.5s cubic-bezier(0.22, 1, 0.36, 1) both;
}
.empty-state-illustration svg { width: 48px; height: 48px; color: #6366F1; opacity: 0.6; }

/* Client portal — bigger action cards */
.client-action-card {
  padding: 1.5rem;
  border-radius: var(--radius);
  border: 1.5px solid var(--border);
  background: var(--bg-card);
  cursor: pointer;
  transition: all 0.25s ease;
  text-align: center;
  box-shadow: var(--shadow-sm);
}
.client-action-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow);
  border-color: var(--accent);
}
.client-action-card .action-icon {
  width: 52px;
  height: 52px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 0.75rem;
}
.client-action-card .action-label {
  font-weight: 600;
  font-size: 0.88rem;
  color: var(--text);
}
.client-action-card .action-desc {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-top: 0.25rem;
}

/* Chart containers */
.chart-container {
  position: relative;
  height: 280px;
  width: 100%;
  padding: 0.5rem;
}
.chart-container canvas { border-radius: var(--radius-sm); }

/* Smooth scrollbar for main content */
.main-content::-webkit-scrollbar { width: 6px; }
.main-content::-webkit-scrollbar-track { background: transparent; }
.main-content::-webkit-scrollbar-thumb { background: rgba(0,0,0,0.08); border-radius: 3px; }
.main-content::-webkit-scrollbar-thumb:hover { background: rgba(0,0,0,0.15); }

/* Subtle divider between dashboard sections */
.dash-divider {
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--border), transparent);
  margin: 0.5rem 0 2rem;
}

/* Improved badge pill for counts */
.count-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 22px;
  height: 22px;
  padding: 0 7px;
  border-radius: 11px;
  font-size: 0.7rem;
  font-weight: 700;
  background: var(--bg);
  color: var(--text-muted);
}

/* ============================================================
   UI/UX AUDIT — DESIGN SYSTEM IMPROVEMENTS
   ============================================================ */

/* === Step 3 & 4: Type Scale + Utility Classes === */
.text-2xs { font-size: 0.65rem !important; }
.text-xs  { font-size: 0.72rem !important; }
.text-sm  { font-size: 0.82rem !important; }
.text-base{ font-size: 0.9rem !important; }
.text-lg  { font-size: 1rem !important; }
.text-xl  { font-size: 1.2rem !important; }
.text-2xl { font-size: 1.5rem !important; }
.text-muted { color: var(--text-muted) !important; }
.text-light { color: var(--text-light) !important; }
.text-accent{ color: var(--accent) !important; }
.text-danger{ color: var(--danger) !important; }
.text-success{color: var(--success) !important; }
.text-warning{color: var(--warning) !important; }
.text-bold { font-weight: 600 !important; }
.text-semibold { font-weight: 500 !important; }
.flex-between { display: flex; justify-content: space-between; align-items: center; }
.flex-center { display: flex; align-items: center; justify-content: center; }
.flex-start { display: flex; align-items: center; }
.gap-xs { gap: 4px; }
.gap-sm { gap: 8px; }
.gap-md { gap: 12px; }
.gap-lg { gap: 16px; }
.mt-sm { margin-top: 0.5rem; }
.mt-md { margin-top: 1rem; }
.mb-sm { margin-bottom: 0.5rem; }
.mb-md { margin-bottom: 1rem; }
.truncate { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* === Step 5: Button Consistency === */
.btn-ghost { background: none; border: none; color: var(--text-muted); padding: 0.4rem 0.75rem; font-size: 0.82rem; font-weight: 500; cursor: pointer; border-radius: var(--radius-sm); transition: all 0.15s; }
.btn-ghost:hover { color: var(--accent); background: rgba(59,130,246,0.06); }
.btn-xs { padding: 0.25rem 0.6rem; font-size: 0.7rem; border-radius: 6px; }

/* === Step 6: Badge System === */
.badge { display: inline-flex; align-items: center; gap: 4px; font-size: 0.68rem; padding: 2px 8px; border-radius: 6px; font-weight: 600; line-height: 1.5; white-space: nowrap; }
.badge-success { background: #ECFDF5; color: #059669; }
.badge-warning { background: #FFFBEB; color: #D97706; }
.badge-danger  { background: #FEF2F2; color: #DC2626; }
.badge-info    { background: #EFF6FF; color: #2563EB; }
.badge-neutral { background: var(--bg); color: var(--text-muted); }
.badge-purple  { background: #F5F3FF; color: #7C3AED; }
.badge-lg { font-size: 0.75rem; padding: 3px 10px; border-radius: 8px; }

/* === Step 1: Collapsible Sidebar Sections === */
.nav-section-title { cursor: pointer; display: flex; align-items: center; justify-content: space-between; user-select: none; transition: color 0.15s; }
.nav-section-title:hover { color: rgba(255,255,255,0.5); }
.nav-section-title .chevron-icon { transition: transform 0.25s ease; font-size: 10px; opacity: 0.4; }
.nav-section.collapsed .nav-section-title .chevron-icon { transform: rotate(-90deg); }
.nav-section.collapsed .nav-item { display: none !important; }
.nav-section.collapsed { margin-bottom: 0.75rem; }

/* === Step 10: Dashboard Stat Hierarchy === */
.stat-card.stat-primary { border-left: 3px solid var(--accent); background: linear-gradient(135deg, rgba(59,130,246,0.04), var(--bg-card)); }
.stat-card.stat-danger  { border-left: 3px solid var(--danger); }
.stat-card.stat-success { border-left: 3px solid var(--success); }
.stat-card.stat-warning { border-left: 3px solid var(--warning); }
.stat-card.stat-primary .value { color: var(--accent); }

/* === Step 11: Notification Bell === */
.notif-bell { position: relative; cursor: pointer; padding: 6px; border-radius: var(--radius-sm); transition: all 0.15s; border: 1px solid var(--border); background: var(--bg-card); }
.notif-bell:hover { border-color: var(--accent); background: rgba(59,130,246,0.04); }
.notif-bell .notif-count { position: absolute; top: -4px; right: -4px; min-width: 18px; height: 18px; border-radius: 50%; background: var(--danger); color: #fff; font-size: 0.6rem; font-weight: 700; display: flex; align-items: center; justify-content: center; padding: 0 4px; border: 2px solid var(--bg-card); }
.notif-dropdown { position: absolute; top: calc(100% + 8px); right: 0; width: 360px; max-height: 420px; background: var(--bg-card-solid); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-lg); overflow: hidden; z-index: 1000; animation: slideDown 0.2s ease; }
.notif-dropdown-header { padding: 12px 16px; border-bottom: 1px solid var(--border); font-weight: 600; font-size: 0.88rem; display: flex; justify-content: space-between; align-items: center; }
.notif-item { padding: 10px 16px; border-bottom: 1px solid var(--border); cursor: pointer; transition: background 0.12s; font-size: 0.82rem; }
.notif-item:hover { background: var(--bg); }
.notif-item.unread { background: rgba(59,130,246,0.03); border-left: 3px solid var(--accent); }
.notif-item .notif-time { font-size: 0.7rem; color: var(--text-light); margin-top: 2px; }

/* === Step 13: Keyboard Shortcuts Overlay === */
.shortcuts-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.5); z-index: 9999; display: flex; align-items: center; justify-content: center; animation: fadeIn 0.15s ease; }
.shortcuts-panel { background: var(--bg-card-solid); border-radius: var(--radius); padding: 1.5rem 2rem; max-width: 520px; width: 90%; box-shadow: var(--shadow-lg); max-height: 80vh; overflow-y: auto; }
.shortcut-row { display: flex; justify-content: space-between; align-items: center; padding: 6px 0; border-bottom: 1px solid var(--border); font-size: 0.85rem; }
.shortcut-row:last-child { border-bottom: none; }
.shortcut-key { display: inline-flex; gap: 4px; }
.shortcut-key kbd { padding: 2px 7px; background: var(--bg); border: 1px solid var(--border); border-radius: 4px; font-family: 'Plus Jakarta Sans', sans-serif; font-size: 0.72rem; font-weight: 600; color: var(--text-muted); min-width: 24px; text-align: center; }

/* === Step 14: Table Sort Indicators === */
th[data-sort] { cursor: pointer; user-select: none; position: relative; transition: color 0.15s; }
th[data-sort]:hover { color: var(--accent); }
th[data-sort]::after { content: '⇅'; margin-left: 4px; font-size: 0.7em; opacity: 0.3; }
th[data-sort].sort-asc::after { content: '▲'; opacity: 0.7; color: var(--accent); }
th[data-sort].sort-desc::after { content: '▼'; opacity: 0.7; color: var(--accent); }

/* === Step 15: Card Depth + Hover === */
.card { box-shadow: 0 1px 3px rgba(0,0,0,0.08), 0 1px 2px rgba(0,0,0,0.04); }
.card:hover { box-shadow: 0 4px 12px rgba(0,0,0,0.07), 0 1px 3px rgba(0,0,0,0.05); transform: translateY(-1px); }
.stat-card { box-shadow: 0 1px 4px rgba(0,0,0,0.07); }

/* === Step 16: Table Density + Alternating Rows === */
.main-content table tbody tr:nth-child(even) td { background: rgba(248,250,252,0.7); }
.main-content table tbody tr { transition: all 0.15s ease; }
.main-content table tbody tr:hover td { background: rgba(59,130,246,0.04) !important; }
.main-content table th { position: sticky; top: 0; background: var(--bg-card-solid); z-index: 2; border-bottom: 2px solid var(--border); }

/* === Step 18: Section Colour Accents === */
.nav-section[data-section="clients"] .nav-item.active { background: linear-gradient(135deg, rgba(59,130,246,0.3), rgba(96,165,250,0.15)); }
.nav-section[data-section="work"] .nav-item.active { background: linear-gradient(135deg, rgba(168,85,247,0.3), rgba(192,132,252,0.15)); color: #E9D5FF; }
.nav-section[data-section="finance"] .nav-item.active { background: linear-gradient(135deg, rgba(5,150,105,0.3), rgba(52,211,153,0.15)); color: #A7F3D0; }
.nav-section[data-section="comms"] .nav-item.active { background: linear-gradient(135deg, rgba(234,179,8,0.3), rgba(250,204,21,0.15)); color: #FEF08A; }
.nav-section[data-section="insights"] .nav-item.active { background: linear-gradient(135deg, rgba(236,72,153,0.3), rgba(244,114,182,0.15)); color: #FBCFE8; }

/* === Step 2: Pagination Controls === */
.pagination { display: flex; align-items: center; justify-content: center; gap: 4px; padding: 12px 0; }
.pagination button { min-width: 32px; height: 32px; border-radius: 6px; border: 1px solid var(--border); background: var(--bg-card-solid); color: var(--text-muted); font-family: inherit; font-size: 0.78rem; font-weight: 500; cursor: pointer; transition: all 0.15s; display: flex; align-items: center; justify-content: center; }
.pagination button:hover { border-color: var(--accent); color: var(--accent); }
.pagination button.active { background: var(--accent); color: #fff; border-color: var(--accent); }
.pagination button:disabled { opacity: 0.3; cursor: not-allowed; }
.pagination .page-info { font-size: 0.78rem; color: var(--text-muted); padding: 0 8px; }

/* === Step 7: Empty State Illustrations === */
.empty-state-icon { width: 56px; height: 56px; border-radius: 50%; background: var(--bg); display: flex; align-items: center; justify-content: center; margin: 0 auto 1rem; }
.empty-state-icon svg { opacity: 0.3; }

/* === Step 8: Client Profile Tabs === */
.profile-tabs { display: flex; gap: 0; border-bottom: 2px solid var(--border); margin-bottom: 1.25rem; overflow-x: auto; }
.profile-tab { padding: 10px 18px; font-size: 0.82rem; font-weight: 500; color: var(--text-muted); cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -2px; transition: all 0.15s; white-space: nowrap; background: none; border-top: none; border-left: none; border-right: none; font-family: inherit; }
.profile-tab:hover { color: var(--text); background: var(--bg); }
.profile-tab.active { color: var(--accent); border-bottom-color: var(--accent); font-weight: 600; }
.profile-section { display: none; animation: fadeIn 0.25s ease; }
.profile-section.active { display: block; }

/* === Step 12: Responsive Improvements === */
@media(max-width:1024px) {
  .main-content { padding: 1.5rem 1.25rem; }
}
@media(max-width:768px) {
  .pagination button { min-width: 28px; height: 28px; font-size: 0.7rem; }
  .profile-tabs { gap: 0; }
  .profile-tab { padding: 8px 12px; font-size: 0.78rem; }
  .notif-dropdown { width: calc(100vw - 2rem); right: -1rem; }
}

/* === Step 13: Dark Mode === */
[data-theme="dark"] {
  --bg: #0F172A;
  --bg-card: rgba(30,41,59,0.85);
  --bg-card-solid: #1E293B;
  --text: #E2E8F0;
  --text-muted: #94A3B8;
  --text-light: #64748B;
  --border: rgba(255,255,255,0.08);
  --border-focus: #60A5FA;
  --danger-bg: rgba(220,38,38,0.12);
  --success-bg: rgba(5,150,105,0.12);
  --warning-bg: rgba(217,119,6,0.12);
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.3);
  --shadow: 0 4px 24px rgba(0,0,0,0.3);
  --shadow-lg: 0 20px 60px rgba(0,0,0,0.4);
}
[data-theme="dark"] body { background-image: radial-gradient(circle at 50% 0%, rgba(59,130,246,0.06), transparent 60%); }
[data-theme="dark"] .auth-form-side { background: var(--bg); }
[data-theme="dark"] input, [data-theme="dark"] select, [data-theme="dark"] textarea { background: var(--bg-card-solid); color: var(--text); border-color: var(--border); }
[data-theme="dark"] .stat-card::before { background: linear-gradient(135deg, rgba(59,130,246,0.1), transparent); }
[data-theme="dark"] table tbody tr:nth-child(even) td { background: rgba(30,41,59,0.5); }
[data-theme="dark"] table tbody tr:hover td { background: rgba(59,130,246,0.08) !important; }
[data-theme="dark"] .sub-choice-modal, [data-theme="dark"] .modal { background: var(--bg-card-solid); color: var(--text); }
[data-theme="dark"] th { background: var(--bg-card-solid) !important; }
.dark-toggle { cursor: pointer; padding: 6px; border-radius: var(--radius-sm); border: 1px solid rgba(255,255,255,0.08); background: none; color: rgba(255,255,255,0.5); transition: all 0.15s; display: flex; align-items: center; justify-content: center; }
.dark-toggle:hover { color: rgba(255,255,255,0.9); border-color: rgba(255,255,255,0.2); }

/* === Step 14: Micro-animations === */
@keyframes countUp { from { transform: scale(0.6); opacity: 0; } to { transform: scale(1); opacity: 1; } }
@keyframes bellRing { 0%,100% { transform: rotate(0); } 15% { transform: rotate(12deg); } 30% { transform: rotate(-10deg); } 45% { transform: rotate(6deg); } 60% { transform: rotate(-4deg); } }
@keyframes slideInRow { from { opacity: 0; transform: translateX(-8px); } to { opacity: 1; transform: translateX(0); } }
.animate-count { animation: countUp 0.35s cubic-bezier(0.34,1.56,0.64,1); }
.animate-bell { animation: bellRing 0.6s ease; }
.animate-row { animation: slideInRow 0.3s ease; }
.badge-count-anim { transition: transform 0.25s cubic-bezier(0.34,1.56,0.64,1); }
.badge-count-anim.bump { transform: scale(1.3); }
.stat-card .value { transition: all 0.3s ease; }

/* === Step 15: Auto-collapse sidebar at 1280px === */
@media(max-width:1280px) {
  .dashboard:not(.sidebar-collapsed) { grid-template-columns: 72px 1fr; }
  .dashboard:not(.sidebar-collapsed) .sidebar { width: 72px; padding: 1.5rem 0.75rem; }
  .dashboard:not(.sidebar-collapsed) .sidebar .brand-text,
  .dashboard:not(.sidebar-collapsed) .sidebar .nav-section-title,
  .dashboard:not(.sidebar-collapsed) .sidebar .user-info { display: none; }
  .dashboard:not(.sidebar-collapsed) .sidebar .nav-item { justify-content: center; padding: 0.65rem; font-size: 0; gap: 0; }
  .dashboard:not(.sidebar-collapsed) .sidebar .nav-item svg { width: 20px; height: 20px; }
  .dashboard:not(.sidebar-collapsed) .sidebar .brand { justify-content: center; gap: 0; }
  .dashboard:not(.sidebar-collapsed) .sidebar .user-badge { justify-content: center; }
  .dashboard:not(.sidebar-collapsed) .sidebar .sidebar-footer .nav-item { font-size: 0; }
  .dashboard:not(.sidebar-collapsed) .sidebar #menuEditBtn { display: none; }
  .dashboard:not(.sidebar-collapsed) .sidebar > div:nth-child(3) { display: none; }
}

/* === Step 16: Print Styles === */
@media print {
  .sidebar, .mobile-nav, .mobile-menu, .sidebar-toggle, #notifBellWrap, .page-header .btn, .page-header button { display: none !important; }
  .dashboard { grid-template-columns: 1fr !important; display: block !important; }
  .main-content { max-height: none !important; overflow: visible !important; padding: 1rem !important; }
  .card { box-shadow: none !important; border: 1px solid #ddd !important; break-inside: avoid; page-break-inside: avoid; }
  .stat-card { box-shadow: none !important; }
  .card:hover, .stat-card:hover { transform: none !important; box-shadow: none !important; }
  body { background: white !important; background-image: none !important; }
  .screen { min-height: auto !important; }
  table { font-size: 0.8rem; }
  .btn { display: none !important; }
  a { text-decoration: none; color: inherit; }
}

/* === Context menu === */
.ctx-menu { position: fixed; z-index: 9999; background: var(--bg-card-solid); border: 1px solid var(--border); border-radius: var(--radius-sm); box-shadow: var(--shadow-lg); padding: 4px 0; min-width: 180px; animation: slideDown 0.12s ease; }
.ctx-menu-item { padding: 7px 14px; font-size: 0.82rem; cursor: pointer; display: flex; align-items: center; gap: 8px; color: var(--text); transition: background 0.1s; }
.ctx-menu-item:hover { background: var(--bg); }
.ctx-menu-item.danger { color: var(--danger); }
.ctx-menu-sep { height: 1px; background: var(--border); margin: 4px 0; }

/* === Bulk action bar === */
.bulk-bar { position: sticky; bottom: 0; z-index: 50; background: var(--bg-card-solid); border-top: 2px solid var(--accent); padding: 10px 16px; display: flex; align-items: center; gap: 12px; box-shadow: 0 -4px 12px rgba(0,0,0,0.08); animation: slideUp 0.2s ease; border-radius: var(--radius) var(--radius) 0 0; }

/* === Sticky notes === */
.sticky-note { padding: 10px 12px; border-radius: 6px; font-size: 0.82rem; line-height: 1.5; position: relative; margin-bottom: 6px; border-left: 3px solid; }
.sticky-note.yellow { background: #FEF9C3; border-color: #EAB308; color: #713F12; }
.sticky-note.blue { background: #DBEAFE; border-color: #3B82F6; color: #1E3A5F; }
.sticky-note.green { background: #DCFCE7; border-color: #22C55E; color: #14532D; }
.sticky-note.red { background: #FEE2E2; border-color: #EF4444; color: #7F1D1D; }
.sticky-note .sticky-del { position: absolute; top: 4px; right: 6px; cursor: pointer; opacity: 0; font-size: 0.7rem; color: inherit; transition: opacity 0.15s; background: none; border: none; padding: 2px 4px; }
.sticky-note:hover .sticky-del { opacity: 0.6; }
.sticky-note:hover .sticky-del:hover { opacity: 1; }

/* === Help Info Icons & Popups === */
.help-icon { display: inline-flex; align-items: center; justify-content: center; width: 18px; height: 18px; border-radius: 50%; background: rgba(59,130,246,0.1); color: var(--accent); font-size: 0.65rem; font-weight: 700; cursor: pointer; margin-left: 6px; transition: all 0.15s; flex-shrink: 0; font-style: normal; vertical-align: middle; border: 1px solid rgba(59,130,246,0.2); }
.help-icon:hover { background: var(--accent); color: #fff; transform: scale(1.1); }
.help-popup-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.4); z-index: 9999; display: flex; align-items: center; justify-content: center; animation: fadeIn 0.15s ease; }
.help-popup { background: var(--bg-card-solid); border-radius: var(--radius); padding: 1.5rem 1.75rem; max-width: 480px; width: 90%; box-shadow: var(--shadow-lg); animation: scaleIn 0.2s ease; max-height: 80vh; overflow-y: auto; }
.help-popup h3 { font-size: 1.05rem; margin-bottom: 0.75rem; display: flex; align-items: center; gap: 8px; }
.help-popup p { font-size: 0.88rem; line-height: 1.7; color: var(--text-muted); margin-bottom: 0.75rem; }
.help-popup ul { padding-left: 1.25rem; font-size: 0.85rem; color: var(--text-muted); line-height: 1.75; margin-bottom: 0.75rem; }
.help-popup .help-close { display: block; width: 100%; margin-top: 1rem; padding: 8px; background: var(--accent); color: #fff; border: none; border-radius: var(--radius-sm); font-family: inherit; font-size: 0.85rem; font-weight: 600; cursor: pointer; transition: opacity 0.15s; }
.help-popup .help-close:hover { opacity: 0.9; }
.tax-year-popup { text-align: center; position: relative; }
.tax-year-popup h2 { font-size: 1.3rem; margin-bottom: 0.5rem; }
.tax-year-popup .yr-badge { position: absolute; top: 16px; right: 20px; background: var(--accent); color: #fff; padding: 4px 12px; border-radius: 6px; font-size: 0.75rem; font-weight: 700; }
