@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700;800&display=swap');

:root {
  /* Theme variables - Light Mode Default */
  --bg-gradient: radial-gradient(circle at 0% 0%, #f0f4f9 0%, #e2e8f0 100%);
  --panel-bg: rgba(255, 255, 255, 0.45);
  --panel-border: rgba(255, 255, 255, 0.4);
  --text-main: #1e293b;
  --text-muted: #64748b;
  --text-inverse: #ffffff;
  
  --primary: #4f46e5;
  --primary-hover: #4338ca;
  --primary-glow: rgba(79, 70, 229, 0.15);
  
  --accent-cyan: #06b6d4;
  --accent-purple: #8b5cf6;
  
  --success: #10b981;
  --success-glow: rgba(16, 185, 129, 0.1);
  --warning: #f59e0b;
  --warning-glow: rgba(245, 158, 11, 0.1);
  --danger: #ef4444;
  --danger-glow: rgba(239, 68, 68, 0.1);
  
  --shadow-sm: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -1px rgba(0, 0, 0, 0.03);
  --shadow-md: 0 10px 15px -3px rgba(0, 0, 0, 0.05), 0 4px 6px -2px rgba(0, 0, 0, 0.02);
  --shadow-lg: 0 20px 25px -5px rgba(0, 0, 0, 0.05), 0 10px 10px -5px rgba(0, 0, 0, 0.02);
  --shadow-glass: 0 8px 32px 0 rgba(31, 38, 135, 0.06);
  
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 24px;
  --radius-full: 9999px;
  
  --sidebar-width: 260px;
  --header-height: 70px;
  
  --font-main: 'Outfit', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

/* Dark Theme Variables override */
body.dark-theme {
  --bg-gradient: radial-gradient(circle at 0% 0%, #0f172a 0%, #020617 100%);
  --panel-bg: rgba(15, 23, 42, 0.45);
  --panel-border: rgba(255, 255, 255, 0.06);
  --text-main: #f1f5f9;
  --text-muted: #94a3b8;
  
  --primary: #6366f1;
  --primary-hover: #4f46e5;
  --primary-glow: rgba(99, 102, 241, 0.25);
  
  --shadow-sm: 0 4px 6px -1px rgba(0, 0, 0, 0.2);
  --shadow-md: 0 10px 15px -3px rgba(0, 0, 0, 0.3);
  --shadow-lg: 0 20px 25px -5px rgba(0, 0, 0, 0.4);
  --shadow-glass: 0 8px 32px 0 rgba(0, 0, 0, 0.3);
}

/* Base resets & styles */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: var(--font-main);
  transition: background-color 0.3s ease, border-color 0.3s ease;
}

body {
  background: var(--bg-gradient);
  color: var(--text-main);
  min-height: 100vh;
  display: flex;
  overflow: hidden;
}

button, input, select, textarea {
  font-family: inherit;
  color: inherit;
  outline: none;
}

a {
  text-decoration: none;
  color: inherit;
}

/* Glassmorphism card utility */
.glass-panel {
  background: var(--panel-bg);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--panel-border);
  box-shadow: var(--shadow-glass);
}

/* App shell structure */
.app-container {
  display: flex;
  width: 100%;
  height: 100vh;
  position: relative;
}

/* Sidebar navigation */
.sidebar {
  width: var(--sidebar-width);
  height: 100%;
  padding: 24px;
  display: flex;
  flex-direction: column;
  border-right: 1px solid var(--panel-border);
  z-index: 10;
}

.logo-container {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 36px;
}

.logo-icon {
  width: 40px;
  height: 40px;
  background: linear-gradient(135deg, var(--primary), var(--accent-purple));
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-inverse);
  box-shadow: 0 4px 12px rgba(79, 70, 229, 0.3);
}

.logo-text {
  font-size: 1.35rem;
  font-weight: 800;
  letter-spacing: -0.5px;
  background: linear-gradient(to right, var(--text-main), var(--primary));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.nav-menu {
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex-grow: 1;
  overflow-y: auto;
}

/* Scrollbar styling */
.nav-menu::-webkit-scrollbar, 
.main-content::-webkit-scrollbar,
.modal-body::-webkit-scrollbar,
.chat-messages::-webkit-scrollbar {
  width: 6px;
}
.nav-menu::-webkit-scrollbar-thumb,
.main-content::-webkit-scrollbar-thumb,
.modal-body::-webkit-scrollbar-thumb,
.chat-messages::-webkit-scrollbar-thumb {
  background: rgba(100, 116, 139, 0.2);
  border-radius: 10px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 16px;
  border-radius: var(--radius-md);
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--text-muted);
  cursor: pointer;
  border: 1px solid transparent;
}

.nav-item:hover {
  background: rgba(79, 70, 229, 0.06);
  color: var(--primary);
}

.nav-item.active {
  background: var(--primary);
  color: var(--text-inverse);
  box-shadow: 0 4px 14px var(--primary-glow);
}

.nav-item i {
  font-size: 1.15rem;
}

.sidebar-footer {
  margin-top: auto;
  padding-top: 20px;
  border-top: 1px solid var(--panel-border);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* Top HUD bar */
.main-layout {
  flex-grow: 1;
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow: hidden;
}

.top-hud {
  height: var(--header-height);
  padding: 0 36px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--panel-border);
  z-index: 5;
}

.hud-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.page-title {
  font-size: 1.4rem;
  font-weight: 700;
  letter-spacing: -0.5px;
}

.hud-right {
  display: flex;
  align-items: center;
  gap: 16px;
}

/* Control buttons style */
.icon-btn {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--panel-border);
  background: rgba(255, 255, 255, 0.2);
  cursor: pointer;
  color: var(--text-main);
  font-size: 1.1rem;
}
.icon-btn:hover {
  background: rgba(255, 255, 255, 0.4);
  transform: translateY(-2px);
}

/* Role Selector dropdown */
.role-badge {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  border-radius: var(--radius-full);
  font-size: 0.85rem;
  font-weight: 600;
  border: 1px solid var(--panel-border);
  cursor: pointer;
}

.role-badge.admin { background: rgba(139, 92, 246, 0.15); color: var(--accent-purple); border-color: rgba(139, 92, 246, 0.3); }
.role-badge.manager { background: rgba(79, 70, 229, 0.15); color: var(--primary); border-color: rgba(79, 70, 229, 0.3); }
.role-badge.viewer { background: rgba(100, 116, 139, 0.15); color: var(--text-muted); border-color: rgba(100, 116, 139, 0.3); }
.role-badge.family { background: rgba(16, 185, 129, 0.15); color: var(--success); border-color: rgba(16, 185, 129, 0.3); }

/* User profile button & login */
.user-menu {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  padding: 4px 12px 4px 4px;
  border-radius: var(--radius-full);
  border: 1px solid var(--panel-border);
  background: rgba(255, 255, 255, 0.2);
}

.user-avatar {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-full);
  object-fit: cover;
  border: 1.5px solid var(--primary);
}

.user-info {
  display: flex;
  flex-direction: column;
}

.user-name {
  font-size: 0.85rem;
  font-weight: 600;
}

.user-role-label {
  font-size: 0.7rem;
  color: var(--text-muted);
}

.btn-login {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  border-radius: var(--radius-full);
  background: var(--primary);
  color: var(--text-inverse);
  font-weight: 600;
  font-size: 0.85rem;
  cursor: pointer;
  border: none;
  box-shadow: 0 4px 12px var(--primary-glow);
}

.btn-login:hover {
  background: var(--primary-hover);
  transform: translateY(-1px);
}

/* Sandbox banner alert */
.sandbox-banner {
  background: linear-gradient(to right, rgba(245, 158, 11, 0.15), rgba(79, 70, 229, 0.1));
  border-bottom: 1px solid rgba(245, 158, 11, 0.2);
  padding: 8px 36px;
  font-size: 0.85rem;
  font-weight: 500;
  display: none;
  align-items: center;
  justify-content: space-between;
  color: var(--warning);
}

.sandbox-banner a {
  font-weight: 700;
  text-decoration: underline;
  cursor: pointer;
  color: var(--primary);
}

/* Main Content panel wrapper */
.main-content {
  flex-grow: 1;
  padding: 36px;
  overflow-y: auto;
  position: relative;
}

.content-section {
  display: none;
  flex-direction: column;
  gap: 28px;
  animation: fadeIn 0.4s ease-out forwards;
}

.content-section.active {
  display: flex;
}

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

/* Section Header styling */
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.section-title-wrapper h2 {
  font-size: 1.8rem;
  font-weight: 800;
  letter-spacing: -0.5px;
}

.section-title-wrapper p {
  color: var(--text-muted);
  font-size: 0.95rem;
  margin-top: 4px;
}

/* Dashboard Summary Cards Grid */
.summary-cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 20px;
}

.summary-card {
  padding: 20px;
  border-radius: var(--radius-lg);
  display: flex;
  flex-direction: column;
  position: relative;
  overflow: hidden;
}

.summary-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 6px;
  height: 100%;
  background: var(--card-accent, var(--primary));
}

.summary-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: var(--text-muted);
  font-size: 0.85rem;
  font-weight: 600;
  margin-bottom: 10px;
}

.summary-card-header i {
  font-size: 1.2rem;
  color: var(--card-accent, var(--primary));
}

.summary-card-value {
  font-size: 1.75rem;
  font-weight: 800;
  letter-spacing: -0.5px;
  margin-bottom: 6px;
}

.summary-card-sub {
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* Dashboard Charts Grid */
.dashboard-grid {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 24px;
}

.dashboard-grid-small {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
  gap: 24px;
}

.chart-card {
  padding: 24px;
  border-radius: var(--radius-lg);
  display: flex;
  flex-direction: column;
  gap: 16px;
  height: 100%;
}

.chart-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.chart-card-title {
  font-size: 1.05rem;
  font-weight: 700;
}

.chart-container {
  position: relative;
  flex-grow: 1;
  min-height: 250px;
  max-height: 320px;
}

/* List view controls & table */
.list-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.search-box {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  border-radius: var(--radius-md);
  border: 1px solid var(--panel-border);
  background: rgba(255, 255, 255, 0.2);
  flex-grow: 1;
  max-width: 360px;
}

.search-box input {
  background: transparent;
  border: none;
  font-size: 0.9rem;
  width: 100%;
}

.filter-group {
  display: flex;
  align-items: center;
  gap: 12px;
}

.select-filter {
  padding: 10px 16px;
  border-radius: var(--radius-md);
  border: 1px solid var(--panel-border);
  background: rgba(255, 255, 255, 0.2);
  font-size: 0.9rem;
  cursor: pointer;
}

.btn-primary {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  border-radius: var(--radius-md);
  background: var(--primary);
  color: var(--text-inverse);
  font-weight: 600;
  border: none;
  cursor: pointer;
  box-shadow: 0 4px 12px var(--primary-glow);
}
.btn-primary:hover {
  background: var(--primary-hover);
  transform: translateY(-1px);
}

.btn-secondary {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.15);
  color: var(--text-main);
  font-weight: 600;
  border: 1px solid var(--panel-border);
  cursor: pointer;
}
.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.3);
}

/* Responsive Table */
.table-responsive {
  width: 100%;
  overflow-x: auto;
  border-radius: var(--radius-lg);
  border: 1px solid var(--panel-border);
}

.app-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 0.95rem;
}

.app-table th {
  background: rgba(100, 116, 139, 0.08);
  padding: 16px 20px;
  font-weight: 600;
  color: var(--text-muted);
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.app-table td {
  padding: 16px 20px;
  border-bottom: 1px solid var(--panel-border);
}

.app-table tbody tr:last-child td {
  border-bottom: none;
}

.app-table tbody tr:hover {
  background: rgba(255, 255, 255, 0.15);
}

/* Badges styling */
.badge {
  padding: 4px 10px;
  border-radius: var(--radius-full);
  font-size: 0.75rem;
  font-weight: 600;
}

.badge.status-paid { background: rgba(16, 185, 129, 0.15); color: var(--success); }
.badge.status-pending { background: rgba(245, 158, 11, 0.15); color: var(--warning); }
.badge.status-overdue { background: rgba(239, 68, 68, 0.15); color: var(--danger); }
.badge.status-settled { background: rgba(6, 182, 212, 0.15); color: var(--accent-cyan); }
.badge.status-failed { background: rgba(239, 68, 68, 0.2); color: var(--danger); }
.badge.status-written-off { background: rgba(100, 116, 139, 0.2); color: var(--text-muted); }

/* Modals & Dialogs overlays */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(8px);
  z-index: 100;
  display: none;
  align-items: center;
  justify-content: center;
}

.modal-overlay.active {
  display: flex;
}

.modal-container {
  width: 90%;
  max-width: 650px;
  max-height: 85vh;
  border-radius: var(--radius-lg);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: var(--shadow-lg);
  animation: modalSlideIn 0.3s ease-out;
}

.modal-container form {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  flex-grow: 1;
}

@keyframes modalSlideIn {
  from { transform: scale(0.95); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

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

.modal-title {
  font-weight: 700;
  font-size: 1.2rem;
}

.modal-close {
  font-size: 1.3rem;
  cursor: pointer;
  color: var(--text-muted);
}
.modal-close:hover {
  color: var(--text-main);
}

.modal-body {
  padding: 24px;
  overflow-y: auto;
  flex-grow: 1;
}

.modal-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--panel-border);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
}

/* Form inputs & grid layout */
.form-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 20px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.form-group.full-width {
  grid-column: span 2;
}

.form-label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-muted);
}

.form-control {
  padding: 10px 14px;
  border-radius: var(--radius-md);
  border: 1px solid var(--panel-border);
  background: rgba(255, 255, 255, 0.15);
  font-size: 0.9rem;
  color: var(--text-main);
}

.form-control:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px var(--primary-glow);
}

textarea.form-control {
  resize: vertical;
  min-height: 80px;
}

/* Payoff Planner Panel */
.planner-setup-card {
  padding: 24px;
  border-radius: var(--radius-lg);
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.planner-results-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
}

.strategy-comparison-card {
  padding: 24px;
  border-radius: var(--radius-lg);
  border-top: 5px solid var(--strategy-color, var(--primary));
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.strategy-metrics {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
}

.metric-box {
  padding: 16px;
  border-radius: var(--radius-md);
  background: rgba(100, 116, 139, 0.05);
}

.metric-title {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.metric-value {
  font-size: 1.35rem;
  font-weight: 800;
}

/* Calendar Grid rendering */
.calendar-widget {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.calendar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.calendar-days-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 8px;
  text-align: center;
}

.calendar-day-label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
  padding: 8px 0;
}

.calendar-days-container {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 8px;
}

.calendar-day-cell {
  aspect-ratio: 1.15;
  padding: 8px;
  border-radius: var(--radius-md);
  border: 1px solid var(--panel-border);
  background: rgba(255, 255, 255, 0.15);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  cursor: pointer;
  position: relative;
  min-height: 80px;
}

.calendar-day-cell:hover {
  background: rgba(255, 255, 255, 0.3);
}

.calendar-day-cell.other-month {
  opacity: 0.35;
  cursor: default;
}

.calendar-day-cell.today {
  border-color: var(--primary);
  background: rgba(79, 70, 229, 0.08);
}

.day-number {
  font-size: 0.85rem;
  font-weight: 600;
}

.calendar-events-list {
  display: flex;
  flex-direction: column;
  gap: 3px;
  margin-top: 4px;
  overflow: hidden;
}

.calendar-event-dot {
  font-size: 0.65rem;
  padding: 2px 4px;
  border-radius: 4px;
  white-space: nowrap;
  text-overflow: ellipsis;
  overflow: hidden;
  font-weight: 500;
}

.calendar-event-dot.due { background: rgba(239, 68, 68, 0.15); color: var(--danger); }
.calendar-event-dot.paid { background: rgba(16, 185, 129, 0.15); color: var(--success); }
.calendar-event-dot.settle { background: rgba(6, 182, 212, 0.15); color: var(--accent-cyan); }

/* Reminders & WhatsApp templates styles */
.template-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 20px;
}

.template-card {
  padding: 20px;
  border-radius: var(--radius-lg);
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.template-badge {
  align-self: flex-start;
  background: rgba(37, 211, 102, 0.15);
  color: #128c7e;
  font-weight: 600;
  font-size: 0.75rem;
  padding: 4px 8px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.template-body {
  font-size: 0.85rem;
  line-height: 1.5;
  background: rgba(100, 116, 139, 0.05);
  padding: 12px;
  border-radius: var(--radius-md);
  border: 1px solid var(--panel-border);
}

/* AI Financial Assistant Chat window */
.ai-assistant-container {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 24px;
  height: 600px;
}

.chat-panel {
  display: flex;
  flex-direction: column;
  border-radius: var(--radius-lg);
  height: 100%;
  overflow: hidden;
}

.chat-header {
  padding: 16px 24px;
  display: flex;
  align-items: center;
  gap: 14px;
  border-bottom: 1px solid var(--panel-border);
}

.ai-avatar {
  width: 38px;
  height: 38px;
  background: linear-gradient(135deg, var(--accent-cyan), var(--primary));
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-inverse);
  font-size: 1.15rem;
}

.chat-messages {
  flex-grow: 1;
  padding: 20px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.chat-bubble {
  max-width: 75%;
  padding: 12px 18px;
  border-radius: var(--radius-md);
  font-size: 0.9rem;
  line-height: 1.5;
  animation: bubbleAppear 0.25s cubic-bezier(0.1, 0.8, 0.3, 1) forwards;
}

@keyframes bubbleAppear {
  from { opacity: 0; transform: scale(0.95) translateY(5px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

.chat-bubble.ai {
  align-self: flex-start;
  background: rgba(255, 255, 255, 0.3);
  border-bottom-left-radius: 4px;
  border: 1px solid var(--panel-border);
}

.chat-bubble.user {
  align-self: flex-end;
  background: var(--primary);
  color: var(--text-inverse);
  border-bottom-right-radius: 4px;
  box-shadow: 0 4px 12px var(--primary-glow);
}

.chat-input-area {
  padding: 16px 20px;
  border-top: 1px solid var(--panel-border);
  display: flex;
  align-items: center;
  gap: 12px;
}

.chat-input {
  flex-grow: 1;
  padding: 12px 18px;
  border-radius: var(--radius-full);
  border: 1px solid var(--panel-border);
  background: rgba(255, 255, 255, 0.15);
  font-size: 0.9rem;
}

.chips-container {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 0 20px 10px 20px;
}

.chip {
  padding: 6px 12px;
  border-radius: var(--radius-full);
  background: rgba(79, 70, 229, 0.08);
  border: 1px solid var(--panel-border);
  font-size: 0.8rem;
  cursor: pointer;
  color: var(--primary);
  font-weight: 500;
}
.chip:hover {
  background: var(--primary);
  color: var(--text-inverse);
}

.ai-recommendations-panel {
  padding: 24px;
  border-radius: var(--radius-lg);
  display: flex;
  flex-direction: column;
  gap: 20px;
  height: 100%;
}

.risk-score-card {
  padding: 20px;
  border-radius: var(--radius-md);
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

.score-dial {
  position: relative;
  width: 120px;
  height: 120px;
  border-radius: 50%;
  background: conic-gradient(var(--score-color, var(--success)) calc(var(--score-val, 80) * 1%), rgba(100, 116, 139, 0.15) 0);
  display: flex;
  align-items: center;
  justify-content: center;
}

.score-dial::after {
  content: '';
  position: absolute;
  width: 96px;
  height: 96px;
  border-radius: 50%;
  background: var(--bg-gradient);
}

.score-number {
  position: relative;
  z-index: 2;
  font-size: 2rem;
  font-weight: 800;
}

/* Document OCR Viewer details */
.document-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 20px;
}

.document-card {
  padding: 16px;
  border-radius: var(--radius-lg);
  display: flex;
  flex-direction: column;
  gap: 12px;
  cursor: pointer;
  position: relative;
}

.document-icon {
  height: 90px;
  border-radius: var(--radius-md);
  background: rgba(100, 116, 139, 0.08);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.2rem;
  color: var(--primary);
}

.document-title {
  font-size: 0.85rem;
  font-weight: 600;
  text-align: center;
  text-overflow: ellipsis;
  overflow: hidden;
  white-space: nowrap;
}

/* Toast Alerts styling */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.toast {
  padding: 14px 20px;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  color: var(--text-inverse);
  font-size: 0.9rem;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 12px;
  animation: slideInRight 0.3s cubic-bezier(0.1, 0.8, 0.3, 1);
  min-width: 280px;
}

@keyframes slideInRight {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

.toast.success { background: var(--success); }
.toast.info { background: var(--primary); }
.toast.warning { background: var(--warning); color: #1e293b; }
.toast.danger { background: var(--danger); }

/* Timeline UI */
.communication-timeline {
  display: flex;
  flex-direction: column;
  gap: 20px;
  position: relative;
  padding-left: 20px;
}

.communication-timeline::before {
  content: '';
  position: absolute;
  top: 8px;
  left: 4px;
  width: 2px;
  height: calc(100% - 16px);
  background: rgba(100, 116, 139, 0.15);
}

.timeline-item {
  position: relative;
}

.timeline-dot {
  position: absolute;
  left: -20px;
  top: 4px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--primary);
  border: 2px solid var(--bg-gradient);
}

.timeline-card {
  padding: 12px 16px;
  border-radius: var(--radius-md);
}

.timeline-meta {
  display: flex;
  justify-content: space-between;
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-bottom: 6px;
}

/* Mobile Simulator Framework */
.simulator-body-wrapper {
  display: flex;
  width: 100%;
  height: 100%;
}

.mobile-frame-container {
  display: none;
  justify-content: center;
  align-items: center;
  flex-grow: 1;
  background: rgba(0, 0, 0, 0.05);
  overflow-y: auto;
  padding: 20px;
}

body.mobile-simulated .sidebar {
  display: none;
}

body.mobile-simulated .main-layout {
  display: none;
}

body.mobile-simulated .mobile-frame-container {
  display: flex;
}

.smartphone {
  position: relative;
  width: 375px;
  height: 812px;
  border: 12px solid #2d3748;
  border-radius: 40px;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
  background: var(--bg-gradient);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* Phone status bar */
.phone-status-bar {
  height: 44px;
  padding: 0 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.8rem;
  font-weight: 600;
  z-index: 5;
}

.phone-notch {
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 150px;
  height: 25px;
  background: #2d3748;
  border-bottom-left-radius: 18px;
  border-bottom-right-radius: 18px;
  z-index: 6;
}

.phone-content {
  flex-grow: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.phone-screen {
  flex-grow: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.phone-nav-bar {
  height: 60px;
  border-top: 1px solid var(--panel-border);
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  align-items: center;
  text-align: center;
  background: var(--panel-bg);
  backdrop-filter: blur(12px);
}

.phone-nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  font-size: 0.65rem;
  color: var(--text-muted);
  cursor: pointer;
}

.phone-nav-item.active {
  color: var(--primary);
}

.phone-nav-item i {
  font-size: 1.1rem;
}

/* Float Quick Action Button */
.floating-action-btn {
  position: absolute;
  bottom: 80px;
  right: 20px;
  width: 50px;
  height: 50px;
  border-radius: 50%;
  background: var(--primary);
  color: var(--text-inverse);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.3rem;
  box-shadow: 0 4px 14px rgba(79, 70, 229, 0.4);
  cursor: pointer;
  z-index: 20;
}

/* responsive media overrides */
.sidebar-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 999;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

body.sidebar-open .sidebar-overlay {
  opacity: 1;
  pointer-events: auto;
}

@media (max-width: 1024px) {
  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    width: 280px;
    transform: translateX(-100%);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 1000;
    background: var(--panel-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    box-shadow: var(--shadow-lg);
    border-right: 1px solid var(--panel-border);
    display: flex !important;
  }
  
  body.sidebar-open .sidebar {
    transform: translateX(0);
  }
  
  .mobile-menu-toggle {
    display: flex !important;
  }
  
  .sidebar-close-toggle {
    display: flex !important;
  }
  
  .main-layout {
    width: 100%;
  }
}

@media (max-width: 992px) {
  .dashboard-grid {
    grid-template-columns: 1fr;
  }
  .ai-assistant-container {
    grid-template-columns: 1fr;
    height: auto;
  }
  .chat-panel {
    height: 480px;
  }
  .planner-results-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 768px) {
  .app-container {
    flex-direction: column;
  }
  
  .top-hud {
    padding: 0 16px;
  }
  
  .main-content {
    padding: 16px;
  }
  
  .form-grid {
    grid-template-columns: 1fr;
  }
  
  .form-group.full-width {
    grid-column: span 1;
  }
  
  /* Mobile footer tabs layout */
  .mobile-bottom-nav {
    display: grid !important;
  }
  
  /* Stacked Responsive Table */
  .app-table, .app-table thead, .app-table tbody, .app-table th, .app-table td, .app-table tr {
    display: block;
  }
  
  .app-table thead {
    display: none;
  }
  
  .app-table tr {
    margin-bottom: 16px;
    border-radius: var(--radius-md);
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--panel-border);
    padding: 12px 16px;
  }
  
  .app-table td {
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    padding: 10px 4px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.85rem;
    text-align: right;
  }
  
  .app-table td:last-child {
    border-bottom: none;
    justify-content: flex-end;
  }
  
  .app-table td::before {
    content: attr(data-label);
    font-weight: 600;
    color: var(--text-muted);
    float: left;
    text-align: left;
    margin-right: 16px;
  }
}

@media (max-width: 600px) {
  #activeRoleLabel {
    display: none;
  }
  
  .role-badge {
    padding: 8px 10px;
  }
  
  #googleSignInBtn span {
    display: none;
  }
  
  #googleSignInBtn {
    padding: 10px;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    justify-content: center;
  }
  
  .sandbox-banner {
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
    padding: 8px 16px;
    text-align: left;
  }
  
  /* Compact Calendar for mobile */
  .calendar-day-cell {
    min-height: 48px !important;
    aspect-ratio: 1;
    padding: 4px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    align-items: center;
  }
  
  .day-number {
    font-size: 0.75rem;
  }
  
  .calendar-events-list {
    flex-direction: row;
    justify-content: center;
    gap: 3px;
    margin-top: 2px;
  }
  
  .calendar-event-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    padding: 0;
    font-size: 0;
    overflow: hidden;
    display: inline-block;
  }
  
  .calendar-event-dot.due { background: var(--danger) !important; color: transparent; }
  .calendar-event-dot.paid { background: var(--success) !important; color: transparent; }
  .calendar-event-dot.settle { background: var(--accent-cyan) !important; color: transparent; }
  
  .calendar-day-cell.selected {
    border: 2px solid var(--primary) !important;
    background: rgba(79, 70, 229, 0.12) !important;
  }
}

@media (max-width: 576px) {
  .modal-container {
    width: 95% !important;
    max-height: 90vh !important;
  }
  .modal-body {
    padding: 16px !important;
  }
  .modal-footer {
    padding: 12px 16px !important;
  }
  .modal-header {
    padding: 16px 20px !important;
  }
}

@media (max-width: 480px) {
  .document-grid {
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)) !important;
    gap: 12px !important;
  }
  .template-grid {
    grid-template-columns: 1fr !important;
    gap: 12px !important;
  }
}

.mobile-bottom-nav {
  display: none;
  height: 60px;
  border-top: 1px solid var(--panel-border);
  grid-template-columns: repeat(5, 1fr);
  align-items: center;
  text-align: center;
  background: var(--panel-bg);
  backdrop-filter: blur(12px);
  position: fixed;
  bottom: 0;
  left: 0;
  width: 100%;
  z-index: 100;
}

.mobile-bottom-nav .phone-nav-item {
  color: var(--text-muted);
}
.mobile-bottom-nav .phone-nav-item.active {
  color: var(--primary);
}

body.has-bottom-nav .main-layout {
  padding-bottom: 60px;
}

/* About Developer Section Styles */
.about-dev-grid {
  display: grid;
  grid-template-columns: 320px 1fr;
  gap: 28px;
  width: 100%;
}

@media (max-width: 900px) {
  .about-dev-grid {
    grid-template-columns: 1fr;
  }
}

.dev-profile-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 36px 24px;
  gap: 16px;
  position: relative;
  overflow: hidden;
}

.dev-avatar-container {
  position: relative;
  width: 140px;
  height: 140px;
  margin-bottom: 8px;
}

.dev-avatar {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
  z-index: 2;
  position: relative;
  border: 4px solid var(--panel-bg);
}

.dev-avatar-ring {
  position: absolute;
  top: -4px;
  left: -4px;
  right: -4px;
  bottom: -4px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--accent-cyan), var(--accent-purple));
  z-index: 1;
  animation: rotateRing 8s linear infinite;
}

@keyframes rotateRing {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

.dev-name {
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--text-main);
  margin: 0;
  letter-spacing: -0.02em;
}

.dev-tagline {
  font-size: 0.9rem;
  color: var(--primary);
  font-weight: 600;
  margin: 0;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.dev-location {
  font-size: 0.85rem;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 6px;
}

.dev-location i {
  color: var(--danger);
}

.dev-social-links {
  display: flex;
  gap: 12px;
  margin-top: 12px;
  width: 100%;
  justify-content: center;
  border-top: 1px solid var(--panel-border);
  padding-top: 20px;
}

.dev-social-btn {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-main);
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--panel-border);
  font-size: 1.1rem;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  text-decoration: none;
}

body.dark-theme .dev-social-btn {
  background: rgba(255, 255, 255, 0.03);
}

.dev-social-btn:hover {
  color: var(--text-inverse);
  background: var(--primary);
  transform: translateY(-4px);
  box-shadow: 0 4px 12px var(--primary-glow);
  border-color: var(--primary);
}

.dev-details-card {
  padding: 36px;
  display: flex;
  flex-direction: column;
  gap: 28px;
}

.dev-info-section {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.dev-section-title {
  font-size: 1.2rem;
  font-weight: 600;
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: 10px;
  border-bottom: 1px solid var(--panel-border);
  padding-bottom: 8px;
}

.dev-section-title i {
  color: var(--primary);
}

.dev-bio-text {
  font-size: 0.95rem;
  line-height: 1.6;
  color: var(--text-main);
  opacity: 0.9;
}

.dev-link {
  color: var(--primary);
  text-decoration: none;
  font-weight: 600;
  transition: color 0.2s;
}

.dev-link:hover {
  text-decoration: underline;
  color: var(--primary-hover);
}

.dev-skills-list {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.dev-skill-tag {
  background: var(--primary-glow);
  color: var(--primary);
  border: 1px solid rgba(79, 70, 229, 0.2);
  padding: 6px 14px;
  border-radius: 9999px;
  font-size: 0.8rem;
  font-weight: 600;
  transition: all 0.2s;
}

body.dark-theme .dev-skill-tag {
  border-color: rgba(99, 102, 241, 0.2);
}

.dev-skill-tag:hover {
  transform: scale(1.05);
  background: var(--primary);
  color: var(--text-inverse);
  border-color: var(--primary);
}

.dev-contact-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 16px;
}

.dev-contact-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  background: rgba(255, 255, 255, 0.15);
  border: 1px solid var(--panel-border);
  border-radius: var(--radius-sm);
  color: var(--text-main);
  text-decoration: none;
  font-size: 0.9rem;
  transition: all 0.3s;
}

body.dark-theme .dev-contact-item {
  background: rgba(15, 23, 42, 0.2);
}

.dev-contact-item i {
  color: var(--primary);
  font-size: 1.1rem;
  width: 20px;
  text-align: center;
}

.dev-contact-item:hover {
  transform: translateX(4px);
  background: rgba(255, 255, 255, 0.3);
  border-color: var(--primary);
}

body.dark-theme .dev-contact-item:hover {
  background: rgba(15, 23, 42, 0.4);
}
