/* ===== EXPENSETRACKER REDESIGN DESIGN SYSTEM ===== */
@import url('https://fonts.googleapis.com/css2?family=DM+Sans:wght@400;500;600&display=swap');

/* ===== AI ASSISTANT — Immersive Full-Page Design ===== */

:root {
  --topbar-height: 73px;
  --bottom-nav-height: 0px;
}

@media (max-width: 1024px) {
  :root {
    --topbar-height: 65px;
  }
}

@media (max-width: 768px) {
  :root {
    --bottom-nav-height: 56px;
  }
}

/* Lock scrolling when AI page is active */
body.ai-assistant-body {
  overflow: hidden !important;
}

body.ai-assistant-body .main-content {
  height: 100vh !important;
  display: flex !important;
  flex-direction: column !important;
  overflow: hidden !important;
}

/* On small screens the bottom nav already provides site-wide navigation,
   so the global topbar (which duplicates the chat's own header) is
   hidden here to remove the double-header and free up vertical space.
   Left untouched on larger screens, where the topbar's hamburger is the
   only way to open the main site sidebar. */
@media (max-width: 768px) {
  body.ai-assistant-body .topbar {
    display: none !important;
  }

  body.ai-assistant-body .ai-page {
    height: 100vh !important;
  }
}

/* ═══════════════════════════════════════════════
   AI PAGE — Full Immersive Layout
   ═══════════════════════════════════════════════ */
.ai-page {
  padding: 0 !important;
  margin: 0 !important;
  height: calc(100vh - var(--topbar-height)) !important;
  display: flex !important;
  overflow: hidden !important;
  background: var(--bg-page);
  position: relative;
}

/* ═══════════════════════════════════════════
   SIDEBAR — Clean Navigation
   ═══════════════════════════════════════════ */
.ai-sidebar {
  width: 260px;
  border-right: 1px solid var(--border-color);
  background: var(--bg-sidebar);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  z-index: 10;
  transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ── Mobile Backdrop ─────────────────────── */
.ai-scrim {
  display: none;
}

.ai-sidebar-top {
  padding: 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

/* ── New Chat Button ─────────────────────── */
.ai-new-chat {
  width: 100%;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: var(--bg-user-section);
  color: var(--sidebar-text);
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.2s ease;
  font-size: 14px;
  font-weight: 500;
}

.ai-new-chat:hover {
  background: var(--sidebar-hover);
  border-color: var(--accent-primary);
}

.ai-new-chat i {
  font-size: 16px;
}

/* ── Search ──────────────────────────────── */
.ai-search {
  padding: 12px 16px;
  position: relative;
  display: flex;
  align-items: center;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.ai-search i {
  position: absolute;
  left: 28px;
  color: var(--sidebar-text-muted);
  font-size: 14px;
}

.ai-search input {
  width: 100%;
  padding: 10px 12px 10px 36px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: var(--bg-user-section);
  color: var(--sidebar-text);
  font-size: 13px;
  outline: none;
  transition: all 0.2s ease;
}

.ai-search input:focus {
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 3px rgba(254, 119, 67, 0.15);
}

.ai-search input::placeholder {
  color: var(--sidebar-text-muted);
}

/* ── History List ────────────────────────── */
.ai-history {
  flex: 1;
  overflow-y: auto;
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  scrollbar-width: thin;
  scrollbar-color: transparent transparent;
}

.ai-history:hover {
  scrollbar-color: rgba(255, 255, 255, 0.15) transparent;
}

.ai-history::-webkit-scrollbar {
  width: 4px;
}

.ai-history::-webkit-scrollbar-track {
  background: transparent;
}

.ai-history::-webkit-scrollbar-thumb {
  background: transparent;
  border-radius: 4px;
}

.ai-history:hover::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.15);
}

/* ── Sidebar Footer (trust note) ──────────── */
.ai-sidebar-footer {
  flex-shrink: 0;
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 12px 16px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  font-size: 11.5px;
  line-height: 1.45;
  color: var(--sidebar-text-muted);
}

.ai-sidebar-footer i {
  font-size: 14px;
  color: var(--accent-primary);
  flex-shrink: 0;
  margin-top: 1px;
}

/* ── Group Headers ───────────────────────── */
.ai-history-group-header {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  color: var(--sidebar-text-muted);
  letter-spacing: 0.5px;
  padding: 16px 12px 6px;
}

/* ── History Items ───────────────────────── */
.ai-history-item {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 8px;
  color: var(--sidebar-text-muted);
  font-size: 13px;
  cursor: pointer;
  transition: all 0.15s ease;
  text-align: left;
  border: none;
  background: transparent;
  width: 100%;
}

.ai-history-item:hover {
  background: var(--sidebar-hover);
  color: var(--sidebar-text);
}

.ai-history-item.active {
  background: var(--accent-primary-light);
  color: var(--accent-primary);
  font-weight: 500;
}

.ai-history-item>svg {
  display: inline-block !important;
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  opacity: 0.5;
}

.ai-history-item.active>svg {
  opacity: 1;
  color: var(--accent-primary);
}

.ai-history-item-text {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
  padding-right: 24px;
}

/* ── Edit Input ──────────────────────────── */
.ai-history-item-input {
  flex: 1;
  background: var(--bg-user-section);
  border: 1px solid var(--accent-primary);
  color: var(--sidebar-text);
  border-radius: 6px;
  padding: 4px 8px;
  font-size: 13px;
  outline: none;
  width: 100%;
}

/* ── Three-dot Menu Button ───────────────── */
.ai-three-dot-wrap {
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
}

.ai-three-dot-btn {
  border: none;
  background: transparent;
  color: var(--sidebar-text-muted);
  cursor: pointer;
  padding: 4px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: all 0.15s ease;
}

.ai-history-item:hover .ai-three-dot-btn {
  opacity: 1;
}

.ai-three-dot-btn:hover {
  background: var(--sidebar-hover);
  color: var(--sidebar-text);
}

.ai-three-dot-btn svg {
  width: 16px;
  height: 16px;
}

/* ── Dropdown Context Menu ───────────────── */
.ai-chat-menu {
  position: absolute;
  right: 0;
  top: 100%;
  min-width: 140px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
  padding: 4px;
  z-index: 100;
  display: none;
  overflow: hidden;
}

.ai-chat-menu.open {
  display: block;
  animation: aiFadeIn 0.15s ease;
}

.ai-chat-menu-item {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 8px 12px;
  border: none;
  background: transparent;
  color: var(--text-secondary);
  font-size: 13px;
  cursor: pointer;
  border-radius: 6px;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.ai-chat-menu-item:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.ai-chat-menu-item.danger:hover {
  background: rgba(239, 68, 68, 0.1);
  color: #ef4444;
}

.ai-chat-menu-item svg {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
}

/* ═══════════════════════════════════════════
   MAIN CHAT AREA
   ═══════════════════════════════════════════ */
.ai-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  background: var(--bg-page);
  overflow: hidden;
  position: relative;
  min-width: 0;
}

/* ── Content Container ───────────────────── */
.ai-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  position: relative;
}

/* ── Header ──────────────────────────────── */
.ai-header {
  height: 56px;
  flex-shrink: 0;
  padding: 0 20px;
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--bg-page);
  border-bottom: 1px solid var(--border-color);
  z-index: 5;
}

.ai-menu-btn {
  display: none;
  border: none;
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 8px;
  border-radius: 8px;
  font-size: 18px;
  align-items: center;
  transition: all 0.15s ease;
}

.ai-menu-btn:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.ai-header-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
  min-width: 0;
}

.ai-header-mark {
  flex-shrink: 0;
  width: 30px;
  height: 30px;
  border-radius: 9px;
  display: grid;
  place-items: center;
  background: var(--accent-primary-light);
  color: var(--accent-primary);
}

.ai-header-info {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
}

.ai-header-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ai-header-actions {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}

.ai-header-action {
  width: 34px;
  height: 34px;
  border: none;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  display: grid;
  place-items: center;
  border-radius: 8px;
  font-size: 16px;
  transition: all 0.15s ease;
}

.ai-header-action:hover {
  background: var(--bg-hover);
  color: var(--accent-primary);
}

.ai-header-status {
  font-size: 11px;
  color: #10b981;
  display: flex;
  align-items: center;
  gap: 4px;
}

.ai-header-status::before {
  content: '';
  width: 6px;
  height: 6px;
  background: #10b981;
  border-radius: 50%;
}

/* ── Chat Feed ───────────────────────────── */
.ai-feed {
  flex: 1;
  overflow-y: auto;
  padding: 24px 20px;
  display: none;
  flex-direction: column;
  gap: 20px;
  scrollbar-width: thin;
  scrollbar-color: transparent transparent;
  max-width: 800px;
  width: 100%;
  margin: 0 auto;
}

.ai-feed.active {
  display: flex;
}

.ai-feed:hover {
  scrollbar-color: var(--border-color) transparent;
}

.ai-feed::-webkit-scrollbar {
  width: 5px;
}

.ai-feed::-webkit-scrollbar-track {
  background: transparent;
}

.ai-feed::-webkit-scrollbar-thumb {
  background: transparent;
  border-radius: 4px;
}

.ai-feed:hover::-webkit-scrollbar-thumb {
  background: var(--border-color);
}

/* ═══════════════════════════════════════════
   WELCOME SCREEN — ChatGPT Style
   ═══════════════════════════════════════════ */
.ai-welcome {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 40px 24px;
  animation: aiFadeIn 0.4s ease;
}

/* ── Brand Mark ──────────────────────────── */
.ai-welcome-logo {
  width: 52px;
  height: 52px;
  margin-bottom: 18px;
  background: var(--accent-primary-light);
  color: var(--accent-primary);
  border-radius: 14px;
  display: grid;
  place-items: center;
}

/* ── Title ───────────────────────────────── */
.ai-welcome-title {
  font-size: 24px;
  margin-bottom: 8px;
  font-weight: 600;
  color: var(--text-primary);
  max-width: 460px;
}

.ai-welcome-subtitle {
  font-size: 14px;
  margin-bottom: 32px;
  color: var(--text-muted);
  max-width: 400px;
  line-height: 1.5;
}

/* ── Prompt Suggestions ──────────────────── */
.ai-prompts {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  width: 100%;
  max-width: 600px;
}

.ai-prompt {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.15s ease;
  text-align: left;
}

.ai-prompt:hover {
  background: var(--bg-hover);
  border-color: var(--accent-primary);
}

.ai-prompt-icon {
  flex-shrink: 0;
  width: 34px;
  height: 34px;
  border-radius: 9px;
  display: grid;
  place-items: center;
  font-size: 16px;
  background: var(--bg-hover);
  color: var(--text-secondary);
}

.ai-prompt-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.ai-prompt-title {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.3;
}

.ai-prompt-desc {
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.3;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ═══════════════════════════════════════════
   INPUT AREA — Floating Input Box
   ═══════════════════════════════════════════ */
.ai-input-area {
  padding: 16px 24px 20px;
  flex-shrink: 0;
  background: linear-gradient(180deg, transparent, var(--bg-page) 20%);
}

.ai-input-box {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  padding: 8px 12px;
  border-radius: 14px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  transition: border-color 0.15s ease;
  max-width: 760px;
  margin: 0 auto;
  width: 100%;
}

.ai-input-box:focus-within {
  border-color: var(--accent-primary);
}

.ai-input-icon {
  width: 36px;
  height: 36px;
  border: none;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  display: grid;
  place-items: center;
  border-radius: 8px;
  transition: all 0.15s ease;
  flex-shrink: 0;
}

.ai-input-icon:hover {
  background: var(--bg-hover);
  color: var(--accent-primary);
}

.ai-input-icon i {
  font-size: 18px;
}

.ai-textarea {
  flex: 1;
  border: none;
  background: transparent;
  resize: none;
  min-height: 40px;
  max-height: 120px;
  padding: 8px 4px;
  font-size: 14px;
  color: var(--text-primary);
  font-family: inherit;
  outline: none;
  line-height: 1.5;
}

.ai-textarea::placeholder {
  color: var(--text-muted);
}

.ai-send {
  width: 40px;
  height: 40px;
  border: none;
  border-radius: 10px;
  background: var(--accent-primary);
  color: #fff;
  cursor: pointer;
  display: grid;
  place-items: center;
  transition: all 0.2s ease;
  flex-shrink: 0;
  box-shadow: 0 2px 8px rgba(254, 119, 67, 0.25);
}

.ai-send:hover {
  transform: scale(1.05);
  box-shadow: 0 4px 12px rgba(254, 119, 67, 0.35);
}

.ai-send:active {
  transform: scale(0.95);
}

.ai-send i {
  font-size: 18px;
}

.ai-disclaimer {
  text-align: center;
  padding: 8px 0 0;
  font-size: 11px;
  color: var(--text-muted);
}

/* ═══════════════════════════════════════════
   CHAT MESSAGES
   ═══════════════════════════════════════════ */
.ai-msg {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  animation: aiSlideIn 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  max-width: 100%;
}

.ai-msg.user {
  justify-content: flex-end;
}

.ai-msg.user .ai-msg-content {
  align-items: flex-end;
}

.ai-msg:not(.user) .ai-msg-content {
  align-items: flex-start;
}

.ai-msg-avatar {
  display: flex !important;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 600;
  flex-shrink: 0;
}

.ai-msg.user .ai-msg-avatar {
  order: 2;
  background: var(--accent-primary);
  color: #fff;
}

.ai-msg:not(.user) .ai-msg-avatar {
  order: 1;
  background: var(--bg-hover);
  color: var(--text-secondary);
  border: 1px solid var(--border-color);
}

.ai-msg-content {
  display: flex;
  flex-direction: column;
  gap: 4px;
  max-width: calc(100% - 80px);
  order: 1;
}

.ai-msg.user .ai-msg-content {
  order: 1;
}

/* ── AI Bubble (left) ────────────────────── */
.ai-bubble {
  padding: 14px 18px;
  border-radius: 14px;
  color: var(--text-primary);
  line-height: 1.6;
  font-size: 14px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
}

.ai-msg:not(.user) .ai-bubble {
  border-top-left-radius: 4px;
}

/* ── User Bubble (right) ─────────────────── */
.ai-msg.user .ai-bubble {
  background: var(--accent-primary);
  color: #fff;
  border: none;
  border-radius: 14px 14px 4px 14px;
}

.ai-bubble strong {
  font-weight: 600;
}

.ai-msg:not(.user) .ai-bubble strong {
  color: var(--text-primary);
}

/* ── Inline Code ─────────────────────────── */
.ai-bubble code {
  background: var(--bg-hover);
  color: var(--accent-primary);
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 13px;
  font-family: 'SF Mono', SFMono-Regular, Consolas, 'Liberation Mono', Menlo, monospace;
}

/* ── Code Blocks ─────────────────────────── */
.ai-bubble pre {
  background: var(--bg-sidebar);
  color: var(--text-primary);
  padding: 14px;
  border-radius: 8px;
  overflow-x: auto;
  margin: 12px 0;
  border: 1px solid var(--border-color);
  font-size: 13px;
}

.ai-bubble pre code {
  background: transparent;
  padding: 0;
  color: inherit;
  font-size: 13px;
  font-family: inherit;
}

/* ── Tables ───────────────────────────────── */
.ai-bubble table {
  width: 100%;
  border-collapse: collapse;
  margin: 12px 0;
  font-size: 13px;
  border-radius: 8px;
  overflow: hidden;
}

.ai-bubble th,
.ai-bubble td {
  border: 1px solid var(--border-color);
  padding: 10px 14px;
  text-align: left;
}

.ai-bubble th {
  background: var(--bg-hover);
  font-weight: 600;
  color: var(--text-primary);
}

.ai-bubble tr:nth-child(even) td {
  background: var(--bg-hover);
}

/* ── Message Meta & Copy ─────────────────── */
.ai-msg-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  color: var(--text-muted);
  padding: 0 4px;
}

.ai-copy-btn {
  border: none;
  background: transparent;
  color: var(--text-muted);
  display: inline-flex;
  align-items: center;
  gap: 4px;
  cursor: pointer;
  font-size: 11px;
  font-weight: 500;
  padding: 3px 6px;
  border-radius: 4px;
  transition: all 0.15s ease;
}

.ai-copy-btn:hover {
  color: var(--accent-primary);
  background: var(--accent-primary-light);
}

.ai-copy-btn svg {
  width: 12px;
  height: 12px;
}

/* ── Focus-visible Accessibility ─────────── */
.ai-new-chat:focus-visible,
.ai-send:focus-visible,
.ai-input-icon:focus-visible,
.ai-copy-btn:focus-visible,
.ai-three-dot-btn:focus-visible,
.ai-chat-menu-item:focus-visible,
.ai-prompt:focus-visible,
.ai-history-item:focus-visible,
.ai-menu-btn:focus-visible,
.ai-header-action:focus-visible,
.btn-save:focus-visible,
.btn-cancel:focus-visible,
.btn-discard:focus-visible {
  outline: 2px solid var(--accent-primary);
  outline-offset: 2px;
}

/* ═══════════════════════════════════════════
   TYPING INDICATOR
   ═══════════════════════════════════════════ */
.ai-typing {
  display: inline-flex;
  gap: 4px;
  padding: 12px 16px;
  border-radius: 14px 14px 14px 4px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
}

.ai-typing span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--text-muted);
  animation: aiDot 1.4s infinite ease-in-out;
}

.ai-typing span:nth-child(2) {
  animation-delay: 0.2s;
}

.ai-typing span:nth-child(3) {
  animation-delay: 0.4s;
}

/* ═══════════════════════════════════════════
   EXPENSE / RECEIPT CARDS
   ═══════════════════════════════════════════ */
.expense-card,
.receipt-card {
  border: 1px solid var(--border-color);
  border-left: 3px solid var(--accent-primary);
  border-radius: 10px;
  padding: 16px;
  background: var(--bg-card);
  margin-top: 10px;
  transition: all 0.2s ease;
}

.expense-card:hover,
.receipt-card:hover {
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.receipt-img-preview {
  max-width: 100%;
  max-height: 160px;
  object-fit: cover;
  border-radius: 8px;
  border: 1px solid var(--border-color);
  margin: 10px 0;
  display: block;
}

.expense-card-header,
.receipt-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}

.expense-card-badge,
.receipt-confidence {
  padding: 3px 8px;
  border-radius: 6px;
  background: var(--accent-primary-light);
  color: var(--accent-primary);
  font-size: 11px;
  font-weight: 600;
}

.expense-card-body,
.receipt-body {
  display: grid;
  gap: 10px;
}

.expense-field label,
.receipt-item-name {
  display: block;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 4px;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.expense-field input,
.expense-field select {
  width: 100%;
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid var(--border-color);
  background: var(--bg-card);
  color: var(--text-primary);
  font: inherit;
  font-size: 14px;
  transition: all 0.2s ease;
}

.expense-field input:focus,
.expense-field select:focus {
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 3px rgba(254, 119, 67, 0.1);
  outline: none;
}

.expense-field-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.expense-card-actions,
.receipt-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
}

.btn-save,
.btn-cancel,
.btn-discard {
  border: none;
  border-radius: 8px;
  padding: 10px 16px;
  font-weight: 600;
  font-size: 13px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-save {
  background: var(--accent-primary);
  color: #fff;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.btn-save:hover {
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(254, 119, 67, 0.25);
}

.btn-cancel,
.btn-discard {
  background: var(--bg-hover);
  color: var(--text-secondary);
}

.btn-cancel:hover,
.btn-discard:hover {
  color: var(--text-primary);
  background: var(--border-color);
}

/* ═══════════════════════════════════════════
   DASHBOARD CARDS (in chat)
   ═══════════════════════════════════════════ */
.ai-dashboard-cards {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.ai-dash-card {
  border-radius: 10px;
  padding: 14px;
  background: var(--bg-hover);
  border: 1px solid var(--border-color);
  transition: all 0.2s ease;
}

.ai-dash-card:hover {
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.ai-dash-card.emerald {
  background: rgba(16, 185, 129, 0.05);
  border-color: rgba(16, 185, 129, 0.15);
}

.ai-dash-card-label {
  font-size: 11px;
  color: var(--text-muted);
  margin-bottom: 4px;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  font-weight: 600;
}

.ai-dash-card-value {
  font-size: 18px;
  font-weight: 700;
  color: var(--text-primary);
}

.ai-dash-card-sub {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 2px;
}

/* ═══════════════════════════════════════════
   VOICE MODAL
   ═══════════════════════════════════════════ */
.ai-voice-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 300;
}

.ai-voice-overlay.active {
  display: flex;
  animation: aiFadeIn 0.2s ease;
}

.ai-voice-modal {
  width: min(90vw, 360px);
  padding: 32px 24px;
  border-radius: 16px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.2);
  text-align: center;
}

.ai-mic-rings {
  position: relative;
  width: 100px;
  height: 100px;
  margin: 0 auto 20px;
  display: grid;
  place-items: center;
}

.ai-mic-ring {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 2px solid var(--accent-primary);
  opacity: 0;
  animation: aiPulseRing 2s infinite ease-out;
}

.ai-mic-ring:nth-child(2) {
  animation-delay: 0.4s;
}

.ai-mic-ring:nth-child(3) {
  animation-delay: 0.8s;
}

.ai-mic-btn {
  width: 64px;
  height: 64px;
  border: none;
  border-radius: 50%;
  background: var(--accent-primary);
  color: #fff;
  cursor: pointer;
  display: grid;
  place-items: center;
  font-size: 26px;
  box-shadow: 0 4px 16px rgba(254, 119, 67, 0.3);
  transition: all 0.2s ease;
}

.ai-mic-btn:hover {
  transform: scale(1.05);
}

.ai-voice-hint {
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 4px;
}

.ai-voice-timer {
  display: block;
  font-size: 24px;
  font-weight: 600;
  color: var(--text-primary);
  margin: 12px 0;
}

.ai-waveform {
  display: flex;
  justify-content: center;
  gap: 3px;
  margin: 16px 0;
}

.ai-waveform span {
  width: 3px;
  height: 16px;
  border-radius: 999px;
  background: var(--accent-primary);
  opacity: 0.5;
  animation: aiWave 1s infinite ease-in-out;
}

.ai-waveform span:nth-child(2) {
  animation-delay: 0.1s;
  height: 22px;
}

.ai-waveform span:nth-child(3) {
  animation-delay: 0.2s;
  height: 28px;
}

.ai-waveform span:nth-child(4) {
  animation-delay: 0.3s;
  height: 22px;
}

.ai-waveform span:nth-child(5) {
  animation-delay: 0.4s;
  height: 16px;
}

.ai-waveform span:nth-child(6) {
  animation-delay: 0.5s;
  height: 22px;
}

.ai-waveform span:nth-child(7) {
  animation-delay: 0.6s;
  height: 28px;
}

.ai-waveform span:nth-child(8) {
  animation-delay: 0.7s;
  height: 22px;
}

.ai-waveform span:nth-child(9) {
  animation-delay: 0.8s;
  height: 16px;
}

.ai-voice-actions {
  display: flex;
  justify-content: center;
  gap: 10px;
  margin-top: 16px;
}

.ai-voice-stop,
.ai-voice-cancel {
  border: none;
  border-radius: 8px;
  padding: 10px 20px;
  font-weight: 600;
  font-size: 13px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.ai-voice-stop {
  background: var(--accent-primary);
  color: #fff;
}

.ai-voice-stop:hover {
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(254, 119, 67, 0.25);
}

.ai-voice-cancel {
  background: var(--bg-hover);
  color: var(--text-secondary);
}

.ai-voice-cancel:hover {
  color: var(--text-primary);
  background: var(--border-color);
}

/* ═══════════════════════════════════════════
   KEYFRAME ANIMATIONS
   ═══════════════════════════════════════════ */

/* ── Fade In ─────────────────────────────── */
@keyframes aiFadeIn {
  from {
    opacity: 0;
    transform: translateY(8px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ── Slide In (messages) ─────────────────── */
@keyframes aiSlideIn {
  from {
    opacity: 0;
    transform: translateY(12px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ── Typing Dots ─────────────────────────── */
@keyframes aiDot {

  0%,
  80%,
  100% {
    transform: scale(0.6);
    opacity: 0.3;
  }

  40% {
    transform: scale(1);
    opacity: 1;
  }
}

/* ── Voice Pulse Ring ────────────────────── */
@keyframes aiPulseRing {
  0% {
    transform: scale(0.85);
    opacity: 0.5;
  }

  100% {
    transform: scale(1.3);
    opacity: 0;
  }
}

/* ── Waveform Bars ───────────────────────── */
@keyframes aiWave {

  0%,
  100% {
    transform: scaleY(0.4);
    opacity: 0.4;
  }

  50% {
    transform: scaleY(1);
    opacity: 1;
  }
}

/* ── Welcome Logo Float ──────────────────── */
@keyframes aiFloat {

  0%,
  100% {
    transform: translateY(0);
  }

  50% {
    transform: translateY(-6px);
  }
}

/* ── Flash Highlight ─────────────────────── */
.ai-highlight-flash {
  animation: aiFlash 1.5s ease-out;
}

@keyframes aiFlash {
  0% {
    background: var(--accent-primary-light);
  }

  100% {
    background: transparent;
  }
}

/* ── Gradient Border Spin ────────────────── */
@keyframes aiGradientSpin {
  0% {
    background-position: 0% 50%;
  }

  50% {
    background-position: 100% 50%;
  }

  100% {
    background-position: 0% 50%;
  }
}

/* ── Gradient Shimmer (heading) ──────────── */
@keyframes aiGradientShimmer {
  0% {
    background-position: 0% 50%;
  }

  50% {
    background-position: 100% 50%;
  }

  100% {
    background-position: 0% 50%;
  }
}

/* ═══════════════════════════════════════════
   RESPONSIVE LAYOUT OVERRIDES & DRAWER
   ═══════════════════════════════════════════ */

@media (max-width: 1024px) {
  .ai-sidebar-toggle-btn {
    display: flex;
  }
}

@media (max-width: 768px) {
  .ai-sidebar {
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    transform: translateX(-100%);
    z-index: 1000;
    width: 280px;
    box-shadow: 12px 0 40px rgba(0, 0, 0, 0.15);
  }

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

  .ai-scrim {
    display: block;
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
    opacity: 0;
    pointer-events: none;
    z-index: 999;
    transition: opacity 0.25s ease;
  }

  .ai-scrim.open {
    opacity: 1;
    pointer-events: auto;
  }

  .ai-menu-btn {
    display: flex;
  }

  .ai-header-mark {
    display: none;
  }

  .ai-prompts {
    grid-template-columns: 1fr;
  }

  .ai-welcome {
    padding: 24px 16px;
  }

  .ai-feed {
    padding: 20px 16px;
    gap: 16px;
  }

  .ai-input-area {
    padding: 12px 16px 16px;
  }

  .ai-msg {
    gap: 12px;
  }

  .ai-msg-avatar {
    width: 32px;
    height: 32px;
    font-size: 12px;
  }

  .ai-bubble {
    padding: 12px 16px;
    font-size: 14px;
  }

  .ai-dashboard-cards {
    grid-template-columns: 1fr;
  }
}


/* ─────────────────────────────────────────────
   BRAND PALETTE
   Primary:   #FE7743  (coral/orange)
   Dark Base: #273F4F  (deep navy)
   Secondary: #447D9B  (steel blue)
   Muted:     #D7D7D7  (light gray)
   Light font: #FFFFFF / #000000 for text
───────────────────────────────────────────── */

:root {
  /* ── LIGHT MODE ─────────────────────────── */
  --bg-page: #F5F6F8;
  --bg-card: #FFFFFF;
  --bg-sidebar: #273F4F;
  --sidebar-text: #FFFFFF;
  --sidebar-text-muted: rgba(255, 255, 255, 0.55);
  --bg-user-section: rgba(255, 255, 255, 0.08);
  --sidebar-hover: rgba(255, 255, 255, 0.1);

  --accent-primary: #FE7743;
  --accent-primary-light: rgba(254, 119, 67, 0.1);
  --accent-secondary: #447D9B;
  --accent-success: #2CB67D;
  --accent-danger: #E84545;
  --accent-warning: #F59E0B;

  --text-primary: #000000;
  --text-secondary: #273F4F;
  --text-muted: #8A9BAB;
  --border-color: #D7D7D7;

  /* KPI pastel chips — based on brand palette */
  --kpi-orange: #FE7743;
  --kpi-orange-bg: rgba(254, 119, 67, 0.1);
  --kpi-blue: #447D9B;
  --kpi-blue-bg: rgba(68, 125, 155, 0.1);
  --kpi-purple: #8B5CF6;
  --kpi-purple-bg: rgba(139, 92, 246, 0.1);
  --kpi-emerald: #2CB67D;
  --kpi-emerald-bg: rgba(44, 182, 125, 0.1);
  --kpi-cyan: #447D9B;
  --kpi-cyan-bg: rgba(68, 125, 155, 0.08);
  --kpi-red: #E84545;
  --kpi-red-bg: rgba(232, 69, 69, 0.1);

  --shadow-card: 0 1px 3px rgba(39, 63, 79, 0.06), 0 1px 2px rgba(39, 63, 79, 0.04);

  --radius-card: 12px;
  --radius-input: 8px;
  --radius-btn: 8px;
  --radius-badge: 6px;
  --radius-sm: 4px;
  --radius-md: 8px;

  --glass-border: var(--border-color);
  --bg-hover: #F0F2F5;
  --glass-bg: #f3f4f6;

  --transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ── DARK MODE ──────────────────────────────────── */
body:not(.light-mode) {
  --bg-page: #0B1820;
  --bg-card: #131F2A;
  --bg-sidebar: #0D1921;
  --sidebar-text: #FFFFFF;
  --sidebar-text-muted: rgba(255, 255, 255, 0.45);
  --bg-user-section: rgba(255, 255, 255, 0.05);
  --sidebar-hover: rgba(254, 119, 67, 0.12);

  --accent-primary: #FE7743;
  --accent-primary-light: rgba(254, 119, 67, 0.15);
  --accent-secondary: #447D9B;
  --accent-success: #2CB67D;
  --accent-danger: #E84545;
  --accent-warning: #F59E0B;

  --text-primary: #FFFFFF;
  --text-secondary: #D7D7D7;
  --text-muted: #5E7A8A;
  --border-color: rgba(215, 215, 215, 0.12);

  /* KPI chips — same hues, dimmer backgrounds for dark */
  --kpi-orange: #FE7743;
  --kpi-orange-bg: rgba(254, 119, 67, 0.15);
  --kpi-blue: #447D9B;
  --kpi-blue-bg: rgba(68, 125, 155, 0.15);
  --kpi-purple: #B39DDB;
  --kpi-purple-bg: rgba(179, 157, 219, 0.12);
  --kpi-emerald: #2CB67D;
  --kpi-emerald-bg: rgba(44, 182, 125, 0.12);
  --kpi-cyan: #6BB5D4;
  --kpi-cyan-bg: rgba(107, 181, 212, 0.12);
  --kpi-red: #F07070;
  --kpi-red-bg: rgba(240, 112, 112, 0.12);

  --glass-border: var(--border-color);
  --bg-hover: rgba(255, 255, 255, 0.04);
  --glass-bg: rgba(255, 255, 255, 0.04);

  --shadow-card: 0 1px 0 rgba(0, 0, 0, 0.2);
}

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

body {
  font-family: 'DM Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg-page);
  color: var(--text-primary);
  min-height: 100vh;
  font-size: 15px;
  line-height: 1.5;
  transition: background-color 0.3s ease, color 0.3s ease;
  overflow-x: hidden;
}

/* Scrollbar */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: var(--border-color);
  border-radius: 3px;
}

/* ===== FIXED SIDEBAR (240px) ===== */
.sidebar {
  position: fixed;
  left: 0;
  top: 0;
  bottom: 0;
  width: 240px;
  background: var(--bg-sidebar);
  color: var(--sidebar-text);
  display: flex;
  flex-direction: column;
  z-index: 100;
  transition: var(--transition);
  border-right: 1px solid var(--border-color);
}

.sidebar.collapsed {
  width: 72px;
}

.sidebar.collapsed .sidebar-header {
  padding: 20px 0;
  justify-content: center;
  gap: 0;
}

.sidebar.collapsed .sidebar-title,
.sidebar.collapsed .nav-label,
.sidebar.collapsed .sidebar-footer-text,
.sidebar.collapsed .sidebar-user-info {
  opacity: 0;
  width: 0;
  padding: 0;
  margin: 0;
  overflow: hidden;
  display: none !important;
}

.sidebar.collapsed .nav-item {
  padding: 10px 0;
  justify-content: center;
  border-left-width: 4px;
  gap: 0;
}

.sidebar.collapsed .sidebar-user {
  padding: 8px 0 !important;
  margin: 0 12px 8px !important;
  justify-content: center !important;
  background: transparent !important;
  border-color: transparent !important;
}

.sidebar.collapsed .collapse-btn {
  padding: 10px 0;
  justify-content: center;
}

.sidebar.collapsed .collapse-btn svg {
  transform: rotate(180deg);
}

.sidebar-header {
  padding: 23px 20px;
  display: flex;
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid var(--border-color);
  transition: var(--transition);
}

.sidebar-logo {
  width: 32px;
  height: 32px;
  border-radius: 6px;
  background: var(--accent-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 16px;
  color: #fff;
  flex-shrink: 0;
}

.sidebar-title {
  font-size: 18px;
  font-weight: 600;
  color: var(--sidebar-text);
  white-space: nowrap;
  overflow: hidden;
  transition: var(--transition);
}

.sidebar-nav {
  flex: 1;
  padding: 16px 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  border-radius: var(--radius-btn);
  color: var(--sidebar-text-muted);
  text-decoration: none;
  transition: var(--transition);
  cursor: pointer;
  white-space: nowrap;
  font-size: 14px;
  font-weight: 500;
  border-left: 4px solid transparent;
}

.nav-item:hover {
  color: var(--sidebar-text);
  background: var(--sidebar-hover);
}

.nav-item.active {
  background: var(--accent-primary-light);
  color: var(--accent-primary);
  border-left-color: var(--accent-primary);
  font-weight: 600;
}

.nav-item svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

.sidebar-footer {
  padding: 16px 12px;
  border-top: 1px solid var(--border-color);
}

.collapse-btn {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  border-radius: var(--radius-btn);
  background: none;
  border: none;
  color: var(--sidebar-text-muted);
  cursor: pointer;
  transition: var(--transition);
  font-size: 13px;
  width: 100%;
  text-align: left;
}

.collapse-btn svg {
  transition: transform var(--transition);
}

.collapse-btn:hover {
  background: var(--sidebar-hover);
  color: var(--sidebar-text);
}

/* Sidebar User Info Section styling */
.sidebar-user {
  background: var(--bg-user-section) !important;
  border: 1px solid var(--border-color) !important;
}

.sidebar-user-avatar {
  background: var(--accent-primary) !important;
  color: #FFFFFF !important;
}

.sidebar-user-name {
  color: var(--sidebar-text) !important;
}

/* ===== MAIN CONTENT ===== */
.main-content {
  margin-left: 240px;
  min-height: 100vh;
  transition: var(--transition);
}

.sidebar.collapsed~.main-content {
  margin-left: 72px;
}

/* ===== TOP HEADER BAR ===== */
.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--bg-card);
  border-bottom: 1px solid var(--border-color);
  padding: 16px 32px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 16px;
}

.page-title {
  font-size: 18px;
  font-weight: 600;
  color: var(--text-primary);
}

.page-subtitle {
  font-size: 13px;
  color: var(--text-secondary);
}

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

.topbar-btn {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-btn);
  background: transparent;
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
}

.topbar-btn:hover {
  background: var(--bg-page);
  color: var(--text-primary);
}

.avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--accent-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 600;
  color: #fff;
  cursor: pointer;
  border: 2px solid var(--border-color);
  transition: var(--transition);
}

.avatar:hover {
  transform: scale(1.05);
}

/* ===== PAGE CONTAINER ===== */
.page {
  padding: 24px;
}

/* ===== PREMIUM CARDS ===== */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-card);
  padding: 24px;
  box-shadow: var(--shadow-card);
  transition: var(--transition);
}

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

.card-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
}

.card-subtitle {
  font-size: 13px;
  color: var(--text-secondary);
  margin-top: 2px;
}

/* ===== KPI METRIC CARDS ===== */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 12px;
}

.kpi-grid.secondary {
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 28px;
}

/* Base card */
.kpi-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-card);
  padding: 20px;
  box-shadow: var(--shadow-card);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-height: 108px;
  position: relative;
  overflow: hidden;
  transition: var(--transition);
}

.kpi-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(0,0,0,0.08);
}

body:not(.light-mode) .kpi-card:hover {
  box-shadow: 0 8px 24px rgba(0,0,0,0.25);
}

/* Primary-tier card — larger, with gradient accent bar at top */
.kpi-card.primary {
  min-height: 130px;
  padding: 22px 20px 18px;
}

.kpi-card.primary::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  border-radius: var(--radius-card) var(--radius-card) 0 0;
  background: var(--kpi-accent-gradient, linear-gradient(90deg, var(--accent-primary), var(--accent-secondary)));
}

.kpi-card.primary.emerald { --kpi-accent-gradient: linear-gradient(90deg, #2CB67D, #00e5a0); }
.kpi-card.primary.purple  { --kpi-accent-gradient: linear-gradient(90deg, #8B5CF6, #c084fc); }
.kpi-card.primary.cyan    { --kpi-accent-gradient: linear-gradient(90deg, #447D9B, #6BB5D4); }
.kpi-card.primary.orange  { --kpi-accent-gradient: linear-gradient(90deg, #FE7743, #FFB347); }

/* Secondary-tier card — compact */
.kpi-card.secondary {
  min-height: 88px;
  padding: 14px 16px;
  border-radius: 10px;
}

.kpi-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 6px;
}

.kpi-label {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.4px;
}

.kpi-card.primary .kpi-label {
  font-size: 11px;
  letter-spacing: 0.6px;
}

.kpi-card.secondary .kpi-label {
  font-size: 11px;
}

/* Icon container */
.kpi-icon {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  flex-shrink: 0;
}

.kpi-card.secondary .kpi-icon {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  font-size: 14px;
}

.kpi-icon.blue   { background: var(--kpi-blue-bg);   color: var(--kpi-blue); }
.kpi-icon.green  { background: var(--kpi-emerald-bg); color: var(--kpi-emerald); }
.kpi-icon.red    { background: var(--kpi-red-bg);     color: var(--kpi-red); }
.kpi-icon.purple { background: var(--kpi-purple-bg);  color: var(--kpi-purple);
  box-shadow: 0 0 0 4px rgba(139,92,246,0.08); }
.kpi-icon.emerald{ background: var(--kpi-emerald-bg); color: var(--kpi-emerald);
  box-shadow: 0 0 0 4px rgba(44,182,125,0.08); }
.kpi-icon.cyan   { background: var(--kpi-cyan-bg);    color: var(--kpi-cyan);
  box-shadow: 0 0 0 4px rgba(68,125,155,0.08); }
.kpi-icon.orange { background: var(--kpi-orange-bg);  color: var(--kpi-orange);
  box-shadow: 0 0 0 4px rgba(254,119,67,0.08); }

body:not(.light-mode) .kpi-icon.purple  { box-shadow: 0 0 0 4px rgba(179,157,219,0.1); }
body:not(.light-mode) .kpi-icon.emerald { box-shadow: 0 0 0 4px rgba(44,182,125,0.1); }
body:not(.light-mode) .kpi-icon.cyan    { box-shadow: 0 0 0 4px rgba(107,181,212,0.1); }
body:not(.light-mode) .kpi-icon.orange  { box-shadow: 0 0 0 4px rgba(254,119,67,0.1); }

/* Value */
.kpi-value {
  font-size: 26px;
  font-weight: 700;
  color: var(--text-primary);
  margin: 4px 0 6px;
  letter-spacing: -0.5px;
  line-height: 1.2;
}

.kpi-card.primary .kpi-value {
  font-size: 28px;
  letter-spacing: -0.8px;
}

.kpi-card.secondary .kpi-value {
  font-size: 20px;
  font-weight: 600;
  margin: 2px 0 4px;
  letter-spacing: -0.3px;
}

/* Change indicator */
.kpi-change {
  font-size: 11px;
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 2px 7px;
  border-radius: 20px;
  width: fit-content;
}

.kpi-change.up {
  color: var(--accent-success);
  background: rgba(44, 182, 125, 0.1);
}

.kpi-change.down {
  color: var(--accent-danger);
  background: rgba(232, 69, 69, 0.1);
}

/* ===== DASHBOARD COLUMN GRID ===== */
.dashboard-grid {
  display: grid;
  grid-template-columns: 1.6fr 1fr;
  gap: 24px;
  margin-bottom: 24px;
}

@media(max-width:1024px) {
  .dashboard-grid {
    grid-template-columns: 1fr;
  }
}

.charts-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 24px;
  margin-bottom: 24px;
}

@media(max-width:768px) {
  .charts-grid {
    grid-template-columns: 1fr;
  }
}

.chart-container {
  position: relative;
  min-height: 280px;
  width: 100%;
  flex: 1;
}

/* ===== TABLE (ZEBRA, STICKY HEADER, NO OUTER BORDER) ===== */
.table-wrapper {
  overflow-x: auto;
}

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

th {
  text-align: left;
  padding: 12px 16px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  border-bottom: 1px solid var(--border-color);
  background: var(--bg-card);
  position: sticky;
  top: 0;
}

td {
  padding: 14px 16px;
  font-size: 15px;
  color: var(--text-primary);
  border-bottom: 1px solid var(--border-color);
}

tr:nth-child(even) td {
  background-color: var(--bg-page);
}

body:not(.light-mode) tr:nth-child(even) td {
  background-color: rgba(255, 255, 255, 0.02);
}

tr:hover td {
  background-color: var(--bg-page);
  opacity: 0.9;
}

/* ===== BADGES (6px RADIUS, SOFT COLORS) ===== */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: var(--radius-badge);
  font-size: 13px;
  font-weight: 500;
}

/* Category colors */
.badge-food {
  background: var(--kpi-orange-bg);
  color: var(--kpi-orange);
}

.badge-transport {
  background: var(--kpi-blue-bg);
  color: var(--kpi-blue);
}

.badge-entertainment {
  background: var(--kpi-purple-bg);
  color: var(--kpi-purple);
}

.badge-utilities {
  background: var(--kpi-blue-bg);
  color: var(--accent-primary);
}

.badge-health {
  background: var(--kpi-emerald-bg);
  color: var(--kpi-emerald);
}

.badge-shopping {
  background: var(--kpi-red-bg);
  color: var(--kpi-red);
}

/* Generic transaction status */
.badge-emerald {
  background: var(--kpi-emerald-bg);
  color: var(--accent-success);
}

.badge-red {
  background: var(--kpi-red-bg);
  color: var(--accent-danger);
}

.badge-cyan {
  background: var(--kpi-cyan-bg);
  color: var(--kpi-cyan);
}

/* ===== FORMS (8px INPUTS, CLEAN TOP LABELS) ===== */
.form-grid,
.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

@media (max-width: 480px) {
  .form-grid,
  .form-row {
    grid-template-columns: 1fr;
    gap: 0;
  }
}

.form-group {
  margin-bottom: 20px;
  display: flex;
  flex-direction: column;
}

.form-label {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

.form-input,
.form-select,
.form-textarea {
  width: 100%;
  padding: 10px 14px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-input);
  color: var(--text-primary);
  font-size: 15px;
  font-family: inherit;
  transition: var(--transition);
  outline: none;
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 3px rgba(254, 119, 67, 0.15);
}

.form-input:disabled,
.form-select:disabled,
.form-textarea:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  background: var(--bg-page);
}

.form-error,
.form-error-text {
  font-size: 12px;
  color: var(--accent-danger);
  margin-top: 4px;
}

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

.form-select {
  cursor: pointer;
}

/* ===== BUTTONS (8px CORNERS) ===== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 20px;
  border-radius: var(--radius-btn);
  font-size: 14px;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  border: 1px solid transparent;
  transition: var(--transition);
  text-decoration: none;
}

.btn-primary {
  background: var(--accent-primary);
  color: #fff;
}

.btn-primary:hover {
  background: #e5622e;
}

.btn-secondary {
  background: transparent;
  border-color: var(--border-color);
  color: var(--text-primary);
}

.btn-secondary:hover {
  background: var(--bg-page);
}

.btn-danger-ghost {
  background: transparent;
  color: var(--accent-danger);
}

.btn-danger-ghost:hover {
  background: rgba(232, 69, 69, 0.08);
}

.btn-sm {
  padding: 6px 12px;
  font-size: 13px;
}

/* ===== FAB ===== */
.fab {
  position: fixed;
  bottom: 32px;
  right: 32px;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--accent-primary);
  color: #fff;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  box-shadow: 0 4px 16px rgba(254, 119, 67, 0.4);
  transition: var(--transition);
  z-index: 90;
}

.fab:hover {
  transform: scale(1.05);
  box-shadow: 0 6px 20px rgba(254, 119, 67, 0.5);
}

/* ===== CLEAN MODAL ===== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
  opacity: 0;
  pointer-events: none;
  transition: var(--transition);
}

.modal-overlay.active,
.modal-overlay.open {
  opacity: 1;
  pointer-events: auto;
}

.modal {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-card);
  padding: 28px;
  width: 90%;
  max-width: 520px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.08);
  transform: translateY(16px);
  transition: var(--transition);
}

.modal-overlay.active .modal,
.modal-overlay.open .modal {
  transform: translateY(0);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}

.modal-title {
  font-size: 18px;
  font-weight: 600;
}

.modal-close {
  background: none;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  font-size: 16px;
  padding: 4px;
}

.modal-close:hover {
  color: var(--text-primary);
}

/* ===== PROGRESS BAR ===== */
.progress-bar {
  height: 6px;
  background: var(--border-color);
  border-radius: 3px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  border-radius: 3px;
  transition: width 0.8s ease;
}

.progress-fill.healthy {
  background: var(--accent-success);
}

.progress-fill.warning {
  background: var(--accent-warning);
}

.progress-fill.danger {
  background: var(--accent-danger);
}

/* ===== CIRCULAR PROGRESS (BUDGETS) ===== */
.circular-progress {
  position: relative;
  width: 72px;
  height: 72px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.circular-progress svg {
  transform: rotate(-90deg);
  width: 72px;
  height: 72px;
}

.circular-progress circle {
  fill: none;
  stroke-width: 6;
  stroke-linecap: round;
}

.circular-progress .bg-circle {
  stroke: var(--border-color);
}

.circular-progress .fg-circle {
  transition: stroke-dashoffset 0.8s ease-in-out;
}

.circular-progress .progress-value {
  position: absolute;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-primary);
}

/* ===== BUDGET CARD SYSTEM ===== */
.budget-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 20px;
  margin-bottom: 24px;
}

.budget-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-card);
  padding: 20px;
  box-shadow: var(--shadow-card);
  display: flex;
  flex-direction: column;
  gap: 16px;
  transition: var(--transition);
}

.budget-card:hover {
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}

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

.budget-card-body {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.budget-card-info {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.budget-card-amount {
  font-size: 18px;
  font-weight: 600;
  color: var(--text-primary);
}

.budget-card-limit {
  font-size: 12px;
  color: var(--text-secondary);
}

/* ===== EMPTY STATE ===== */
.empty-state {
  text-align: center;
  padding: 48px 24px;
  color: var(--text-secondary);
}

.empty-state svg {
  width: 48px;
  height: 48px;
  margin-bottom: 12px;
  opacity: 0.3;
}

.empty-state h3 {
  font-size: 16px;
  margin-bottom: 6px;
  color: var(--text-primary);
}

.empty-state p {
  font-size: 13px;
  margin-bottom: 16px;
}

/* ===== ANIMATIONS ===== */
.fade-in {
  animation: fadeIn 0.4s ease;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(8px)
  }

  to {
    opacity: 1;
    transform: translateY(0)
  }
}

.stagger-1 {
  animation-delay: 0.04s;
}

.stagger-2 {
  animation-delay: 0.08s;
}

.stagger-3 {
  animation-delay: 0.12s;
}

.stagger-4 {
  animation-delay: 0.16s;
}

.stagger-5 {
  animation-delay: 0.2s;
}

.stagger-6 {
  animation-delay: 0.24s;
}

/* ===== TOGGLE ===== */
.toggle {
  width: 44px;
  height: 24px;
  border-radius: 12px;
  background: var(--border-color);
  cursor: pointer;
  position: relative;
  transition: var(--transition);
  border: 1px solid transparent;
}

.toggle.active {
  background: var(--accent-primary);
}

.toggle::after {
  content: '';
  position: absolute;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #fff;
  top: 2px;
  left: 2px;
  transition: var(--transition);
}

.toggle.active::after {
  left: 22px;
}

/* ===== TOAST ===== */
.toast-container {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 999;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.toast {
  padding: 12px 18px;
  border-radius: var(--radius-input);
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  font-size: 14px;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 8px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.06);
  animation: slideIn 0.3s ease;
}

@keyframes slideIn {
  from {
    transform: translateX(100%);
    opacity: 0;
  }

  to {
    transform: translateX(0);
    opacity: 1;
  }
}

/* ===== FILTER TABS ===== */
.filter-tabs {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  background: var(--bg-page);
  padding: 4px;
  border-radius: 24px;
  border: 1px solid var(--border-color);
}

.filter-tab {
  padding: 6px 16px;
  border-radius: 20px;
  background: transparent;
  border: none;
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
  user-select: none;
  white-space: nowrap;
}

.filter-tab:hover {
  color: var(--text-primary);
  background: var(--bg-hover);
}

.filter-tab.active {
  background: var(--accent-primary);
  color: #fff;
  font-weight: 600;
  box-shadow: 0 2px 8px rgba(254, 119, 67, 0.3);
}

body.light-mode .filter-tab.active {
  box-shadow: 0 2px 8px rgba(254, 119, 67, 0.25);
}

/* ===== PROFILE GRID ===== */
.profile-grid {
  display: grid;
  grid-template-columns: 320px 1fr;
  gap: 24px;
}

@media(max-width:1024px) {
  .profile-grid {
    grid-template-columns: 1fr;
  }
}

/* ===== SETTINGS GRID ===== */
.settings-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 20px;
}

.setting-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 0;
  border-bottom: 1px solid var(--border-color);
}

.setting-item:last-child {
  border-bottom: none;
}

/* ===== MOBILE BOTTOM NAV ===== */
.bottom-nav {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--bg-card);
  border-top: 1px solid var(--border-color);
  padding: 6px 0;
  z-index: 100;
}

.bottom-nav-inner {
  display: flex;
  justify-content: space-around;
  align-items: center;
}

.bottom-nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 11px;
  font-weight: 500;
  padding: 4px 8px;
  transition: var(--transition);
}

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

.bottom-nav-item svg {
  width: 20px;
  height: 20px;
}


/* ===== TOPBAR SEARCH ===== */
.topbar-search {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-input);
  padding: 8px 16px;
  transition: var(--transition);
}

.topbar-search:focus-within {
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 3px rgba(254, 119, 67, 0.15);
}

.topbar-search svg {
  color: var(--text-secondary);
  flex-shrink: 0;
}

.topbar-search input {
  background: none;
  border: none;
  outline: none;
  color: var(--text-primary);
  font-size: 14px;
  width: 100%;
}

.topbar-search input::placeholder {
  color: var(--text-secondary);
  opacity: 0.8;
}

/* ===== RECURRING EXPENSE ===== */
.recurring-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
  background: var(--kpi-cyan-bg);
  color: var(--kpi-cyan);
}

.recurring-badge.active {
  background: var(--kpi-emerald-bg);
  color: var(--accent-success);
}

.recurring-badge.paused {
  background: var(--kpi-red-bg);
  color: var(--accent-danger);
}

.recurring-cell {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.recurring-due {
  font-size: 11px;
  color: var(--text-muted);
}

.recurring-actions {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
}

.recurring-section {
  margin-top: 12px;
  padding: 16px;
  border: 1px solid var(--border-color);
  border-radius: 12px;
  background: var(--bg-page);
}

.recurring-section-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.recurring-section-title svg {
  width: 16px;
  height: 16px;
}

/* ===== DASHBOARD RECURRING WIDGET ===== */
.recurring-widget {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-card);
  padding: 22px 24px;
  box-shadow: var(--shadow-card);
  margin-bottom: 24px;
}

.recurring-widget-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border-color);
}

.recurring-widget-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 10px;
}

.recurring-widget-title-icon {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: var(--accent-primary-light);
  color: var(--accent-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.recurring-widget-subtitle {
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 400;
  margin-top: 1px;
}

/* Each recurring item — card-row style with urgency left-border */
.recurring-widget-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 14px;
  border-radius: 10px;
  margin-bottom: 8px;
  border: 1px solid var(--border-color);
  background: var(--bg-page);
  transition: var(--transition);
  border-left-width: 3px;
  gap: 12px;
}

.recurring-widget-item:last-child {
  margin-bottom: 0;
}

.recurring-widget-item:hover {
  transform: translateX(3px);
  box-shadow: 0 4px 12px rgba(0,0,0,0.06);
}

body:not(.light-mode) .recurring-widget-item:hover {
  box-shadow: 0 4px 12px rgba(0,0,0,0.2);
}

/* Urgency color variants via left border */
.recurring-widget-item.urgency-critical {
  border-left-color: var(--accent-danger);
  background: rgba(232, 69, 69, 0.04);
}

.recurring-widget-item.urgency-warning {
  border-left-color: var(--accent-warning);
  background: rgba(245, 158, 11, 0.04);
}

.recurring-widget-item.urgency-ok {
  border-left-color: var(--accent-success);
  background: rgba(44, 182, 125, 0.03);
}

body:not(.light-mode) .recurring-widget-item.urgency-critical { background: rgba(232,69,69,0.07); }
body:not(.light-mode) .recurring-widget-item.urgency-warning  { background: rgba(245,158,11,0.06); }
body:not(.light-mode) .recurring-widget-item.urgency-ok       { background: rgba(44,182,125,0.05); }

.recurring-item-left {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 1;
  min-width: 0;
}

.recurring-item-icon {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 16px;
}

.recurring-item-icon.icon-critical { background: rgba(232,69,69,0.12);   color: var(--accent-danger); }
.recurring-item-icon.icon-warning  { background: rgba(245,158,11,0.12);  color: var(--accent-warning); }
.recurring-item-icon.icon-ok       { background: rgba(44,182,125,0.12);  color: var(--accent-success); }

.recurring-item-info {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}

.recurring-item-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.recurring-item-meta {
  font-size: 11px;
  color: var(--text-muted);
  display: flex;
  gap: 6px;
  align-items: center;
}

.recurring-item-right {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
  flex-shrink: 0;
}

.recurring-item-amount {
  font-size: 15px;
  font-weight: 700;
  letter-spacing: -0.3px;
}

.recurring-item-amount.amount-critical { color: var(--accent-danger); }
.recurring-item-amount.amount-warning  { color: var(--accent-warning); }
.recurring-item-amount.amount-ok       { color: var(--accent-success); }

.recurring-due-badge {
  font-size: 10px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 20px;
  white-space: nowrap;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.recurring-due-badge.badge-critical {
  background: rgba(232,69,69,0.12);
  color: var(--accent-danger);
}

.recurring-due-badge.badge-warning {
  background: rgba(245,158,11,0.12);
  color: var(--accent-warning);
}

.recurring-due-badge.badge-ok {
  background: rgba(44,182,125,0.12);
  color: var(--accent-success);
}

/* Empty state */
.recurring-empty {
  text-align: center;
  padding: 36px 24px;
  color: var(--text-muted);
  font-size: 13px;
}

.recurring-empty-icon {
  width: 48px;
  height: 48px;
  margin: 0 auto 12px;
  opacity: 0.25;
}

.recurring-empty p {
  margin-bottom: 14px;
  color: var(--text-secondary);
  font-size: 14px;
}

/* ===== RECURRING WIDGET — TABLE LAYOUT ===== */
.recurring-table-wrap {
  overflow-x: auto;
  border-radius: 10px;
  border: 1px solid var(--border-color);
}

.recurring-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 520px;
}

/* Table head */
.recurring-table thead tr {
  background: var(--bg-page);
}

.recurring-table th {
  padding: 11px 16px;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-bottom: 1px solid var(--border-color);
  white-space: nowrap;
  position: static; /* override global sticky */
  background: var(--bg-page);
}

/* Table rows */
.recurring-table .rw-row {
  transition: background 0.15s ease, transform 0.15s ease;
  border-bottom: 1px solid var(--border-color);
}

.recurring-table .rw-row:last-child {
  border-bottom: none;
}

.recurring-table .rw-row:hover {
  background: var(--bg-hover) !important;
}

/* Urgency row tints */
.recurring-table .rw-row-critical {
  background: rgba(232, 69, 69, 0.035);
  border-left: 3px solid var(--accent-danger);
}

.recurring-table .rw-row-warning {
  background: rgba(245, 158, 11, 0.035);
  border-left: 3px solid var(--accent-warning);
}

.recurring-table .rw-row-ok {
  background: transparent;
  border-left: 3px solid var(--accent-success);
}

body:not(.light-mode) .rw-row-critical { background: rgba(232,69,69,0.07); }
body:not(.light-mode) .rw-row-warning  { background: rgba(245,158,11,0.06); }

.recurring-table td {
  padding: 13px 16px;
  font-size: 14px;
  color: var(--text-primary);
  border-bottom: none; /* handled by tr */
  vertical-align: middle;
}

/* Name cell */
.rw-name-cell {
  display: flex;
  align-items: center;
  gap: 10px;
}

.rw-avatar {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 700;
  flex-shrink: 0;
  letter-spacing: 0;
}

/* Reuse existing urgency icon colors */
.rw-avatar.icon-critical { background: rgba(232,69,69,0.12);  color: var(--accent-danger);  }
.rw-avatar.icon-warning  { background: rgba(245,158,11,0.12); color: var(--accent-warning); }
.rw-avatar.icon-ok       { background: rgba(44,182,125,0.12); color: var(--accent-success); }

.rw-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 180px;
}

/* Date column */
.rw-date {
  font-size: 13px;
  color: var(--text-secondary);
  white-space: nowrap;
}

/* Amount */
.rw-amount {
  font-size: 15px;
  font-weight: 700;
  letter-spacing: -0.3px;
  white-space: nowrap;
}

.rw-amount.amount-critical { color: var(--accent-danger);  }
.rw-amount.amount-warning  { color: var(--accent-warning); }
.rw-amount.amount-ok       { color: var(--accent-success); }

/* ===== SECTION HEADER DIVIDER ===== */
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
  margin-top: 4px;
}

.section-header-left {
  display: flex;
  align-items: center;
  gap: 10px;
}

.section-header-icon {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  background: var(--accent-primary-light);
  color: var(--accent-primary);
  display: flex;
  align-items: center;
  justify-content: center;
}

.section-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.section-line {
  flex: 1;
  height: 1px;
  background: var(--border-color);
  margin-left: 12px;
}

/* Dashboard filter bar custom-date reveal */
.custom-date-range {
  transition: opacity 0.3s ease, pointer-events 0s;
}

/* Recent expenses table — tighten */
.dashboard-table td {
  padding: 12px 16px;
  font-size: 14px;
}

.dashboard-table .td-title {
  font-weight: 600;
  color: var(--text-primary);
  max-width: 180px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.dashboard-table .td-amount {
  font-weight: 700;
  color: var(--accent-danger);
  letter-spacing: -0.3px;
  font-size: 14px;
}

.dashboard-table tr:hover td {
  background: var(--bg-hover);
}

body:not(.light-mode) .dashboard-table tr:hover td {
  background: rgba(255,255,255,0.03);
}


@media(max-width:1024px) {
  .sidebar {
    transform: translateX(-100%);
  }

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

  .main-content {
    margin-left: 0 !important;
  }

  .topbar {
    padding: 12px 16px;
  }

  .page {
    padding: 20px 16px;
  }
}

@media(max-width:768px) {
  .kpi-grid,
  .kpi-grid.secondary {
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
  }

  .kpi-card.primary {
    min-height: 110px;
  }

  .kpi-card.secondary {
    min-height: 80px;
  }

  .bottom-nav {
    display: block;
  }

  .page {
    padding: 16px 12px 80px;
  }

  .fab {
    bottom: 80px;
  }

  .filter-tabs {
    gap: 4px;
  }

  .filter-tab {
    padding: 5px 12px;
    font-size: 12px;
  }
}

@media(max-width:480px) {
  .kpi-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .kpi-grid.secondary {
    grid-template-columns: repeat(2, 1fr);
  }

  .recurring-widget-item {
    padding: 10px 10px;
  }

  .recurring-item-icon {
    display: none;
  }
}

/* ===== EXTRACTED AND OPTIMIZED CSS FROM TEMPLATES ===== */

/* --- Base/Global Specific Styles --- */
#menuBtn {
  display: none;
}
@media (max-width: 1024px) {
  #menuBtn {
    display: flex !important;
  }
}

/* --- Auth Pages Specific Styles (Shared) --- */
html.auth-html,
body.auth-body {
  height: 100%;
}
body.auth-body {
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-page);
  position: relative;
  overflow: hidden;
}

.btn-auth {
  width: 100%;
  margin-top: 16px;
  padding: 14px 24px;
}
.auth-alert-wrapper {
  margin-bottom: 20px;
}
.auth-alert-wrapper .auth-alert {
  display: block;
}
.form-label-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}
.form-label-row .form-label {
  margin-bottom: 0;
}
.form-label-row a {
  font-size: 13px;
}

/* Soft/Animated background orbs */
.bg-orb {
  position: fixed;
  border-radius: 50%;
  filter: blur(100px);
  opacity: 0.05;
  animation: orbFloat 20s ease-in-out infinite;
  pointer-events: none;
  z-index: 0;
}
.bg-orb-1 {
  width: 500px;
  height: 500px;
  background: var(--accent-primary);
  top: -120px;
  right: -100px;
  animation-delay: 0s;
}
body.register-body .bg-orb-1 {
  left: -100px;
  right: auto;
}
body.password-reset-body .bg-orb-1 {
  width: 450px;
  height: 450px;
  background: #f59e0b;
  top: -100px;
  right: -80px;
}
.bg-orb-2 {
  width: 400px;
  height: 400px;
  background: var(--accent-success);
  bottom: -80px;
  left: -80px;
  animation-delay: -7s;
}
body.register-body .bg-orb-2 {
  right: -80px;
  left: auto;
}
body.password-reset-body .bg-orb-2 {
  width: 350px;
  height: 350px;
  background: var(--accent-primary);
  bottom: -60px;
  left: -60px;
}
.bg-orb-3 {
  width: 300px;
  height: 300px;
  background: #06b6d4;
  top: 50%;
  left: 50%;
  animation-delay: -14s;
}
body.register-body .bg-orb-3 {
  bottom: 30%;
  left: 60%;
}
@keyframes orbFloat {
  0%, 100% { transform: translate(0, 0) scale(1); }
  25% { transform: translate(30px, -40px) scale(1.05); }
  50% { transform: translate(-20px, 20px) scale(0.95); }
  75% { transform: translate(40px, 30px) scale(1.02); }
}

.auth-wrapper {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 440px;
  padding: 20px;
}
body.register-body .auth-wrapper {
  max-width: 480px;
}
.auth-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-card);
  padding: 40px 36px;
  box-shadow: var(--shadow-card);
}
body.register-body .auth-card {
  padding: 36px 36px;
}
.auth-header {
  text-align: center;
  margin-bottom: 32px;
}
body.register-body .auth-header {
  margin-bottom: 28px;
}
.auth-logo {
  width: 56px;
  height: 56px;
  background: var(--accent-primary);
  border-radius: var(--radius-input);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 26px;
  font-weight: 600;
  color: #fff;
  margin: 0 auto 20px;
  box-shadow: 0 4px 12px rgba(79, 110, 247, 0.2);
  transition: transform 0.3s ease;
}
body.password-reset-body .auth-logo {
  font-size: 24px;
}
.auth-logo:hover {
  transform: scale(1.05);
}
.auth-title {
  font-size: 24px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 8px;
  letter-spacing: -0.5px;
}
.auth-subtitle {
  color: var(--text-secondary);
  font-size: 14px;
  line-height: 1.5;
}
.auth-footer {
  text-align: center;
  margin-top: 28px;
  font-size: 14px;
  color: var(--text-secondary);
}
body.register-body .auth-footer {
  margin-top: 24px;
}
.auth-link {
  color: var(--accent-primary);
  text-decoration: none;
  font-weight: 600;
  transition: opacity 0.2s;
}
.auth-link:hover {
  opacity: 0.8;
}
.auth-divider {
  display: flex;
  align-items: center;
  gap: 16px;
  margin: 24px 0;
  color: var(--text-secondary);
  font-size: 12px;
}
.auth-divider::before,
.auth-divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--border-color);
}

.password-wrapper {
  position: relative;
}
.password-toggle {
  position: absolute;
  right: 14px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 4px;
  display: flex;
  align-items: center;
  transition: color 0.2s;
}
.password-toggle:hover {
  color: var(--text-primary);
}
.password-strength {
  margin-top: 8px;
}
.strength-bar {
  height: 4px;
  border-radius: 2px;
  background: var(--bg-page);
  overflow: hidden;
  margin-bottom: 4px;
}
.strength-fill {
  height: 100%;
  border-radius: 2px;
  transition: width 0.3s, background 0.3s;
  width: 0;
}
.strength-text {
  font-size: 11px;
  color: var(--text-secondary);
}

.auth-alert {
  padding: 12px 16px;
  border-radius: var(--radius-input);
  font-size: 13px;
  margin-bottom: 20px;
  display: none;
  animation: fadeIn 0.3s ease;
  line-height: 1.5;
}
body.register-body .auth-alert {
  margin-bottom: 16px;
}
.auth-alert.error {
  background: rgba(244, 91, 91, 0.1);
  color: var(--accent-danger);
  border: 1px solid rgba(244, 91, 91, 0.2);
}
.auth-alert.success {
  background: rgba(34, 196, 138, 0.1);
  color: var(--accent-success);
  border: 1px solid rgba(34, 196, 138, 0.2);
}

.btn.loading {
  pointer-events: none;
  opacity: 0.7;
}
.btn.loading .btn-text {
  display: none;
}
.btn.loading .btn-spinner {
  display: inline-block;
}
.btn-spinner {
  display: none;
  width: 18px;
  height: 18px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}
@keyframes spin {
  to { transform: rotate(360deg); }
}

@media (max-width: 480px) {
  .auth-card {
    padding: 32px 24px;
  }
  body.register-body .auth-card {
    padding: 28px 20px;
  }
  .auth-title {
    font-size: 22px;
  }
  .bg-orb-1 {
    width: 300px;
    height: 300px;
  }
  .bg-orb-2 {
    width: 250px;
    height: 250px;
  }
  .bg-orb-3 {
    display: none;
  }
}

/* --- Profile Specific Styles --- */
.msg-success {
  background: rgba(16, 185, 129, 0.1);
  color: #10b981;
  border: 1px solid rgba(16, 185, 129, 0.2);
}
.msg-error {
  background: rgba(239, 68, 68, 0.1);
  color: #ef4444;
  border: 1px solid rgba(239, 68, 68, 0.2);
}
@media (max-width: 768px) {
  .profile-info-grid {
    grid-template-columns: 1fr !important;
  }
}
@keyframes spinAvatar {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

/* --- Budget & Expenses Shared Styles --- */
.budget-modal-period {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  border-radius: 12px;
  border: 1.5px solid var(--border-color);
  margin-bottom: 12px;
  transition: border-color 0.2s;
}
.budget-modal-period:focus-within {
  border-color: var(--accent-primary);
}
.bmp-icon {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
}
.bmp-info {
  flex: 1;
}
.bmp-label {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 2px;
}
.bmp-hint {
  font-size: 11px;
  color: var(--text-muted);
}
.bmp-input {
  width: 110px;
  text-align: right;
  background: var(--bg-page);
  border: 1.5px solid var(--border-color);
  border-radius: 8px;
  padding: 8px 12px;
  font-size: 14px;
  font-weight: 700;
  color: var(--text-primary);
  transition: border-color 0.2s;
}
.bmp-input:focus {
  outline: none;
  border-color: var(--accent-primary);
}
.bmp-input::placeholder {
  font-weight: 400;
  color: var(--text-muted);
}

/* --- Expenses Specific Styles --- */
:root {
  --calendar-cell-size: 44px;
}

.budget-kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 24px;
}

@media (max-width: 1200px) {
  .budget-kpi-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 600px) {
  .budget-kpi-grid {
    grid-template-columns: 1fr;
  }
}

.budget-kpi-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  padding: 20px 20px 16px;
  box-shadow: var(--shadow-card);
  position: relative;
  overflow: hidden;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.budget-kpi-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
}

.budget-kpi-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  border-radius: 16px 16px 0 0;
  background: var(--card-accent, var(--accent-primary));
}

.bkpi-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 14px;
}

.bkpi-icon-wrap {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  flex-shrink: 0;
}

.bkpi-status-chip {
  font-size: 11px;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 20px;
  letter-spacing: 0.3px;
  text-transform: uppercase;
}

.bkpi-status-chip.healthy {
  background: rgba(44, 182, 125, 0.15);
  color: var(--accent-success);
}

.bkpi-status-chip.warning {
  background: rgba(245, 158, 11, 0.15);
  color: var(--accent-warning);
}

.bkpi-status-chip.over {
  background: rgba(232, 69, 69, 0.15);
  color: var(--accent-danger);
}

.bkpi-status-chip.notset {
  background: rgba(142, 142, 142, 0.12);
  color: var(--text-muted);
}

.bkpi-label {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--text-muted);
  margin-bottom: 4px;
}

.bkpi-spent {
  font-size: 26px;
  font-weight: 800;
  color: var(--text-primary);
  line-height: 1.1;
  margin-bottom: 4px;
}

.bkpi-remaining {
  font-size: 12px;
  color: var(--text-secondary);
  margin-bottom: 14px;
}

.bkpi-remaining strong {
  color: var(--text-primary);
}

.bkpi-progress-wrap {
  position: relative;
  height: 6px;
  background: var(--border-color);
  border-radius: 6px;
  overflow: hidden;
  margin-bottom: 10px;
}

.bkpi-progress-fill {
  height: 100%;
  border-radius: 6px;
  transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1);
  background: var(--card-accent, var(--accent-primary));
}

.bkpi-progress-fill.over {
  background: var(--accent-danger);
}

.bkpi-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12px;
  color: var(--text-muted);
}

.bkpi-budget-amt {
  font-weight: 700;
  color: var(--text-secondary);
}

.bkpi-pct {
  font-weight: 700;
}

/* Savings card special */
.savings-kpi-card {
  background: linear-gradient(135deg, var(--accent-primary) 0%, #ff9a6c 100%);
  border: none;
  border-radius: 16px;
  padding: 20px;
  color: #fff;
  box-shadow: 0 8px 24px rgba(254, 119, 67, 0.35);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-height: 150px;
  transition: transform 0.2s ease;
}

.savings-kpi-card:hover {
  transform: translateY(-3px);
}

.savings-kpi-card .bkpi-label {
  color: rgba(255, 255, 255, 0.8);
}

.savings-kpi-card .bkpi-spent {
  color: #fff;
}

.savings-kpi-card .bkpi-remaining {
  color: rgba(255, 255, 255, 0.85);
}

/* ── BUDGET HEADER BAR ── */
.budgets-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}

.budgets-header-left h2 {
  font-size: 20px;
  font-weight: 800;
  margin-bottom: 2px;
}

.budgets-header-left p {
  font-size: 13px;
  color: var(--text-muted);
}

.budget-loaded-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  font-weight: 700;
  background: rgba(44, 182, 125, 0.12);
  color: var(--accent-success);
  padding: 4px 10px;
  border-radius: 20px;
  margin-left: 10px;
  opacity: 0;
  transition: opacity 0.4s;
}

.budget-loaded-badge.visible {
  opacity: 1;
}

.premium-grid {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 24px;
  margin-bottom: 24px;
}

@media (max-width: 1024px) {
  .premium-grid {
    grid-template-columns: 1fr;
  }
}

.kpi-budget-info {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: 8px;
}

.kpi-budget-value {
  font-weight: 700;
  color: var(--text-primary);
}

/* Calendar Enhancements */
.calendar-container {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-card);
  padding: 24px;
  box-shadow: var(--shadow-card);
}

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

.calendar-title {
  font-size: 18px;
  font-weight: 700;
}

.calendar-nav {
  display: flex;
  gap: 8px;
}

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

.calendar-weekday {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border-color);
}

.calendar-day {
  position: relative;
  padding: 12px 4px;
  border-radius: var(--radius-input);
  border: 1px solid transparent;
  cursor: pointer;
  transition: var(--transition);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  min-height: 60px;
  background: var(--bg-page);
}

.calendar-day:hover {
  background: var(--bg-card);
  transform: translateY(-2px);
  border-color: var(--border-color);
}

.calendar-day.empty {
  background: transparent;
  cursor: default;
  pointer-events: none;
}

.calendar-day.today {
  border-color: var(--accent-primary);
  background: rgba(79, 110, 247, 0.05);
}

.calendar-day.active {
  background: rgba(79, 110, 247, 0.1);
  border-color: var(--accent-primary);
}

.calendar-day-num {
  font-size: 18px;
  font-weight: 800;
}

.calendar-day-amount {
  font-size: 10px;
  font-weight: 500;
  color: var(--text-secondary);
  margin-top: 4px;
}

.calendar-indicator {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  margin-top: 4px;
}

.calendar-indicator.healthy {
  background: var(--accent-success);
}

.calendar-indicator.warning {
  background: #f59e0b;
}

.calendar-indicator.danger {
  background: var(--accent-danger);
}

/* Analytics Cards */
.analytics-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-card);
  padding: 20px;
  box-shadow: var(--shadow-card);
}

/* History Panel */
.history-container {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-card);
  padding: 24px;
  box-shadow: var(--shadow-card);
}

/* ==========================================================================
   MINIMAL PROFILE PAGE STYLESHEET
   ========================================================================== */

/* Layout & Grid Setup */
.profile-redesign-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 8px 16px 40px;
  animation: profileFadeIn 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.profile-redesign-layout {
  display: grid;
  grid-template-columns: 300px 1fr;
  gap: 48px;
  align-items: start;
}

/* --- Left Panel (Sidebar Profile Visuals) --- */
.profile-sidebar-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-card);
  padding: 32px 24px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  position: sticky;
  top: calc(var(--topbar-height) + 24px);
  transition: border-color var(--transition);
}

.profile-sidebar-card:hover {
  border-color: var(--accent-primary);
}

/* Avatar Styling */
.profile-avatar-wrapper {
  position: relative;
  margin-bottom: 20px;
}

.profile-avatar-circle {
  width: 100px;
  height: 100px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent-primary) 0%, #ff9e7a 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 36px;
  font-weight: 700;
  color: #ffffff;
  box-shadow: 0 8px 24px rgba(254, 119, 67, 0.15);
  transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.profile-avatar-circle:hover {
  transform: scale(1.05) rotate(5deg);
}

/* Text Identity */
.profile-name {
  font-size: 22px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 4px;
  letter-spacing: -0.02em;
}

.profile-meta-date {
  font-size: 13px;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin-bottom: 24px;
}

/* Stats Block */
.profile-stats-panel {
  width: 100%;
  border-top: 1px solid var(--border-color);
  padding-top: 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  text-align: left;
}

.profile-stats-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.profile-stats-label {
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.profile-stats-val {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
}

/* --- Right Panel (Main Content Section) --- */
.profile-right-panel {
  display: flex;
  flex-direction: column;
  gap: 32px;
}

/* Sections */
.profile-settings-section {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-card);
  padding: 32px;
  transition: border-color var(--transition), box-shadow var(--transition);
}

.profile-settings-section:hover {
  border-color: var(--border-color);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.02);
}

.profile-settings-section.danger-section {
  border-color: rgba(232, 69, 69, 0.2);
}
.profile-settings-section.danger-section:hover {
  border-color: var(--accent-danger);
}

/* Section Header */
.profile-section-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 20px;
  margin-bottom: 24px;
}

.profile-section-title-group {
  max-width: 80%;
}

.profile-section-title {
  font-size: 18px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 4px;
  display: flex;
  align-items: center;
  gap: 8px;
}

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

.profile-section-subtitle {
  font-size: 13px;
  color: var(--text-muted);
}

/* View Mode List */
.profile-details-list {
  display: flex;
  flex-direction: column;
}

.profile-details-row {
  display: grid;
  grid-template-columns: 200px 1fr;
  padding: 16px 0;
  border-bottom: 1px solid var(--border-color);
  align-items: center;
}

.profile-details-row:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.profile-details-row:first-child {
  padding-top: 0;
}

.profile-details-label {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-muted);
}

.profile-details-value {
  font-size: 15px;
  font-weight: 500;
  color: var(--text-primary);
}

/* Inputs & Form Groups */
.profile-form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-bottom: 20px;
}

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

.profile-form-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.profile-form-input {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  padding: 12px 16px;
  font-size: 14px;
  border-radius: var(--radius-input);
  outline: none;
  font-family: inherit;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.profile-form-input:focus {
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 3px var(--accent-primary-light);
}

.profile-form-input::placeholder {
  color: var(--text-muted);
  opacity: 0.7;
}

/* Password update grid */
.password-form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 16px;
  margin-bottom: 24px;
}

/* Buttons */
.btn-redesign {
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  padding: 10px 18px;
  border-radius: var(--radius-btn);
  border: 1px solid transparent;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: all 0.2s ease;
}

.btn-redesign-primary {
  background: var(--accent-primary);
  color: #ffffff;
}

.btn-redesign-primary:hover {
  background: #e6622d;
  transform: translateY(-1px);
}

.btn-redesign-secondary {
  background: var(--bg-hover);
  border-color: var(--border-color);
  color: var(--text-primary);
}

.btn-redesign-secondary:hover {
  background: var(--border-color);
  color: var(--text-primary);
}

.btn-redesign-danger {
  background: rgba(232, 69, 69, 0.08);
  border-color: rgba(232, 69, 69, 0.2);
  color: var(--accent-danger);
}

.btn-redesign-danger:hover {
  background: var(--accent-danger);
  color: #ffffff;
  border-color: var(--accent-danger);
}

/* Alerts and Messages */
.profile-alert-banner {
  padding: 12px 16px;
  border-radius: var(--radius-md);
  margin-bottom: 24px;
  font-size: 14px;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 10px;
  animation: profileSlideDown 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.profile-alert-success {
  background: rgba(44, 182, 125, 0.1);
  color: var(--accent-success);
  border: 1px solid rgba(44, 182, 125, 0.2);
}

.profile-alert-error {
  background: rgba(232, 69, 69, 0.1);
  color: var(--accent-danger);
  border: 1px solid rgba(232, 69, 69, 0.2);
}

/* Danger Panel Extra */
.danger-section-content {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
}

.danger-text-group {
  max-width: 70%;
}

.danger-text-title {
  font-weight: 600;
  font-size: 14px;
  color: var(--text-primary);
  margin-bottom: 2px;
}

.danger-text-desc {
  font-size: 13px;
  color: var(--text-muted);
}

/* Animations */
@keyframes profileFadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes profileSlideDown {
  from {
    opacity: 0;
    transform: translateY(-8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* View and Edit Toggles */
.profile-fade-transition {
  animation: profileFadeIn 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

/* Responsive Overrides */
@media (max-width: 1024px) {
  .profile-redesign-layout {
    grid-template-columns: 1fr;
    gap: 32px;
  }
  .profile-sidebar-card {
    position: static;
    width: 100%;
  }
}

@media (max-width: 768px) {
  .profile-form-grid {
    grid-template-columns: 1fr;
  }
  .password-form-grid {
    grid-template-columns: 1fr;
  }
  .profile-details-row {
    grid-template-columns: 1fr;
    gap: 4px;
  }
  .danger-section-content {
    flex-direction: column;
    align-items: flex-start;
  }
  .danger-text-group {
    max-width: 100%;
  }
}
