/* ==============================================================================
   Seminar Accounting Dashboard -早瀬ユウカの管理室- Custom CSS Styling Sheet
   Upgraded UI: Highly-Chic, Solid Matte Dark & Sleek Smartphone UI Layout
   Inspired by: shadcn/ui & Minimalist SaaS Aesthetics (Reference Images)
   ============================================================================== */

/* Base Design System Matte Dark Tokens */
:root {
  --bg-primary: #09090b;      /* Stark matte black-zinc */
  --bg-secondary: #0c0c0e;
  --bg-sidebar: #09090b;
  --card-matte: #18181b;      /* Solid dark charcoal zinc card */
  --card-matte-hover: #202024;
  --border-matte: #27272a;    /* Thin solid zinc outline */
  --border-focus: #52525b;
  --radius: 2px;              /* Minimal modern 2px rounded corners */

  --color-white: #fafafa;
  --color-zinc-light: #f4f4f5;
  --color-zinc-muted: #71717a;
  --color-green: #22c55e;     /* Matte success green */
  --color-red: #ef4444;       /* Matte danger red */
  
  --text-primary: #fafafa;
  --text-secondary: #a1a1aa;
  
  --transition-smooth: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  --font-family-sans: 'Inter', sans-serif;
  --font-family-mono: 'JetBrains Mono', monospace;
}

/* Base Styles & Resets */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  background-color: var(--bg-primary);
  color: var(--text-primary);
  font-family: var(--font-family-sans);
  min-height: 100vh;
  overflow-x: hidden;
}

/* ==============================================================================
   GOOGLE MATERIAL SYMBOLS FORMATTING (Ultra-Sleek shadcn Outline Style)
   ============================================================================== */
.material-symbols-outlined {
  font-variation-settings:
    'FILL' 0,
    'wght' 300, /* Lightweight outlines matching shadcn aesthetic */
    'GRAD' 0,
    'opsz' 24;
  vertical-align: middle;
  line-height: 1;
}

/* Sidebar navigation adjustments */
.menu-item {
  display: flex;
  align-items: center;
  gap: 12px;
}

.menu-icon-symbol {
  font-size: 1.25rem !important;
}

/* Header buttons & icons formatting */
.icon-button-left {
  margin-right: 8px;
  font-size: 1.15rem !important;
}

.icon-small {
  font-size: 1.15rem !important;
}

.icon-display-large {
  font-size: 2.8rem !important;
  color: var(--color-white);
}

.dropzone-icon-symbol {
  font-size: 2.5rem !important;
  color: var(--color-zinc-muted);
  margin-bottom: 8px;
}

.modal-icon-symbol {
  font-size: 2.5rem !important;
  color: var(--color-white);
  margin-bottom: 8px;
}

.trend-icon-symbol {
  font-size: 0.8rem !important;
  vertical-align: middle;
}

.source-icon {
  font-size: 0.85rem !important;
  vertical-align: middle;
  margin-right: 4px;
}

.list-card-icon {
  font-size: 1.5rem !important;
  color: var(--color-zinc-muted);
}

.meta-icon {
  font-size: 0.9rem !important;
  vertical-align: middle;
  margin-right: 4px;
  color: var(--color-zinc-muted);
}

.header-icon-symbol {
  font-size: 1.35rem !important;
  vertical-align: middle;
  margin-right: 8px;
  color: var(--color-white);
}

h1, h2, h3, h4, h5, h6 {
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--color-white);
}

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

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

.hidden {
  display: none !important;
}

/* Custom Minimalist Scrollbar */
::-webkit-scrollbar {
  width: 5px;
  height: 5px;
}
::-webkit-scrollbar-track {
  background: var(--bg-primary);
}
::-webkit-scrollbar-thumb {
  background: #27272a;
  border-radius: var(--radius);
}
::-webkit-scrollbar-thumb:hover {
  background: #3f3f46;
}

/* Common Card Utility */
.card {
  background-color: var(--card-matte);
  border: 1px solid var(--border-matte);
  border-radius: var(--radius);
  padding: 24px;
  transition: var(--transition-smooth);
}

.hover-lift:hover {
  background-color: var(--card-matte-hover);
  border-color: var(--border-focus);
}

/* Tab Views management */
.tab-view {
  display: none;
  animation: tab-fade-in 0.3s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

.tab-view.active {
  display: block;
}

/* ==============================================================================
   OVERLAY & LOGIN WINDOW (Sleek Matte HUD)
   ============================================================================== */
.overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background-color: var(--bg-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  opacity: 0;
  pointer-events: none;
  transition: var(--transition-smooth);
}

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

.login-card {
  background-color: var(--card-matte);
  border: 1px solid var(--border-matte);
  width: 100%;
  max-width: 420px;
  padding: 40px 32px;
  border-radius: var(--radius);
  text-align: center;
  transform: scale(0.95);
  transition: var(--transition-smooth);
}

.overlay.active .login-card {
  transform: scale(1);
}

.logo-icon {
  font-size: 3rem;
  margin-bottom: 16px;
}

.login-header h1 {
  font-size: 1.8rem;
  font-weight: 800;
  color: var(--color-white);
  margin-bottom: 8px;
  letter-spacing: 0.05em;
}

.login-header p {
  color: var(--text-secondary);
  font-size: 0.8rem;
  letter-spacing: 0.02em;
}

/* ==============================================================================
   FORM CONTROLS & INPUTS (Minimal Matte Styling)
   ============================================================================== */
.form-group {
  margin-bottom: 20px;
  text-align: left;
}

.form-group label {
  display: block;
  font-size: 0.75rem;
  color: var(--text-secondary);
  margin-bottom: 6px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 10px 14px;
  background-color: var(--bg-primary);
  border: 1px solid var(--border-matte);
  border-radius: var(--radius);
  outline: none;
  font-size: 0.9rem;
  color: var(--color-zinc-light);
  transition: var(--transition-smooth);
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  border-color: var(--border-focus);
}

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

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

.field-sub {
  display: block;
  font-size: 0.7rem;
  color: var(--color-zinc-muted);
  margin-top: 4px;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 20px;
  border-radius: var(--radius);
  font-weight: 600;
  font-size: 0.9rem;
  cursor: pointer;
  border: none;
  outline: none;
  transition: var(--transition-smooth);
}

.btn-block {
  display: flex;
  width: 100%;
}

.btn-primary {
  background-color: var(--color-white);
  color: var(--bg-primary);
}

.btn-primary:hover {
  background-color: var(--color-zinc-light);
}

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

.btn-secondary:hover {
  background-color: rgba(255, 255, 255, 0.04);
}

.btn-icon {
  background-color: transparent;
  border: 1px solid var(--border-matte);
  color: var(--text-primary);
  width: 32px;
  height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius);
  cursor: pointer;
  font-weight: bold;
  transition: var(--transition-smooth);
}

.btn-icon:hover {
  background-color: rgba(255, 255, 255, 0.04);
  border-color: var(--border-focus);
}

.error-msg {
  color: var(--color-red);
  font-size: 0.8rem;
  margin-top: 12px;
  min-height: 20px;
}

/* ==============================================================================
   APP SHELL LAYOUT (Sidebar & Main Workspace)
   ============================================================================= */
#app-container {
  display: flex;
  min-height: 100vh;
}

/* Sidebar Shell */
.sidebar {
  width: 260px;
  background-color: var(--bg-sidebar);
  border-right: 1px solid var(--border-matte);
  padding: 30px 16px;
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  z-index: 10;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 30px;
  padding-left: 8px;
}

.brand-icon {
  font-size: 1.4rem;
}

.brand-text {
  font-size: 1.2rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  color: var(--color-white);
}

/* Navigation Links */
.sidebar-menu {
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex-grow: 1;
}

.menu-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 16px;
  border-radius: var(--radius);
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text-secondary);
  transition: var(--transition-smooth);
}

.menu-item:hover {
  color: var(--text-primary);
  background-color: rgba(255, 255, 255, 0.04);
}

.menu-item.active {
  color: var(--color-white);
  background-color: rgba(255, 255, 255, 0.08);
  font-weight: 600;
}

/* Workspace Frame */
.main-content {
  flex-grow: 1;
  background-color: var(--bg-primary);
  display: flex;
  flex-direction: column;
  padding: 40px;
  overflow-y: auto;
  height: 100vh;
}

/* Header Area */
.top-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 30px;
  border-bottom: 1px solid var(--border-matte);
  padding-bottom: 20px;
}

.header-title h2 {
  font-size: 1.6rem;
  font-weight: 800;
  margin-bottom: 4px;
}

.header-title p {
  font-size: 0.8rem;
  color: var(--text-secondary);
}

/* Integrated Header Controls */
.header-controls {
  display: flex;
  align-items: center;
  gap: 16px;
}

.profile-switch {
  display: flex;
  align-items: center;
  gap: 8px;
  background-color: var(--card-matte);
  border: 1px solid var(--border-matte);
  padding: 8px 12px;
  border-radius: var(--radius);
}

.profile-switch label {
  font-size: 0.75rem;
  color: var(--text-secondary);
  font-weight: bold;
}

.user-select-dropdown {
  background-color: var(--bg-primary);
  border: 1px solid var(--border-matte);
  padding: 4px 8px;
  border-radius: var(--radius);
  font-size: 0.8rem;
  outline: none;
  cursor: pointer;
  font-family: var(--font-family-mono);
}

.header-status {
  display: flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--border-matte);
  padding: 6px 12px;
  border-radius: 50px;
}

.status-indicator {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background-color: var(--color-zinc-light);
}

.status-text {
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--text-secondary);
}

/* ==============================================================================
   1. DASHBOARD VIEW COMPONENTS (Welcome speech Chibi & Ticker Cards)
   ============================================================================= */
.welcome-card {
  display: flex;
  align-items: center;
  gap: 20px;
  margin-bottom: 30px;
}

.assistant-avatar-container {
  position: relative;
  width: 80px;
  height: 80px;
}

.avatar-svg {
  width: 100%;
  height: 100%;
}

.avatar-badge {
  position: absolute;
  bottom: -2px;
  right: -2px;
  background-color: var(--color-white);
  color: var(--bg-primary);
  font-size: 0.6rem;
  font-weight: 700;
  padding: 1px 4px;
  border-radius: 50px;
}

.speech-bubble-container {
  flex-grow: 1;
}

.character-name {
  font-size: 0.75rem;
  font-weight: 800;
  color: var(--color-white);
  margin-bottom: 4px;
  letter-spacing: 0.05em;
}

.speech-bubble {
  position: relative;
  background-color: var(--bg-primary);
  border: 1px solid var(--border-matte);
  padding: 14px 18px;
  border-radius: var(--radius);
  font-size: 0.9rem;
  line-height: 1.4;
  color: var(--text-primary);
}

.speech-bubble::before {
  content: '';
  position: absolute;
  left: -6px;
  top: 15px;
  width: 0;
  height: 0;
  border-top: 6px solid transparent;
  border-bottom: 6px solid transparent;
  border-right: 6px solid var(--border-matte);
}

/* Stats Cards Tickers - Chic Matte Grayscale */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
  margin-bottom: 30px;
}

.stat-card {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-height: 145px;
}

.stat-card-badge-trend {
  position: absolute;
  top: 20px;
  right: 20px;
  font-family: var(--font-family-mono);
  font-size: 0.7rem;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: var(--radius);
  border: 1px solid var(--border-matte);
  color: var(--text-secondary);
}

.stat-card-badge-trend.positive {
  color: var(--color-white);
}

.stat-card-badge-trend.negative {
  color: var(--color-zinc-muted);
}

.stat-card-header {
  margin-bottom: 8px;
}

.stat-label {
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--color-zinc-muted);
}

.stat-card .stat-value {
  font-size: 2rem;
  font-weight: 800;
  font-family: var(--font-family-mono);
  color: var(--color-white);
  line-height: 1;
  margin-bottom: 8px;
}

.stat-sparkline {
  width: 100%;
  height: 20px;
  margin-bottom: 8px;
}

.sparkline-svg {
  width: 100%;
  height: 100%;
}

.stat-footer-text {
  font-size: 0.65rem;
  color: var(--color-zinc-muted);
  font-weight: 500;
}
/* Dashboard columns layout */
.dashboard-columns {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  margin-bottom: 30px;
}

/* ==============================================================================
   MONOCHROME ANALYTICS PRICE CHART COMPONENT
   ============================================================================= */
.chart-main-wrapper {
  display: flex;
  align-items: center;
  gap: 16px;
  height: 170px;
  margin-bottom: 12px;
}

.chart-y-axis {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  height: 100%;
  font-family: var(--font-family-mono);
  font-size: 0.65rem;
  color: var(--color-zinc-muted);
  text-align: right;
  width: 30px;
}

.chart-body {
  flex-grow: 1;
  height: 100%;
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.trend-chart-svg {
  width: 100%;
  height: 140px;
}

.chart-x-axis {
  display: flex;
  justify-content: space-between;
  font-family: var(--font-family-mono);
  font-size: 0.65rem;
  color: var(--color-zinc-muted);
}

.hud-tag {
  font-family: var(--font-family-mono);
  font-size: 0.65rem;
  font-weight: 700;
  color: var(--color-white);
  border: 1px solid var(--border-matte);
  padding: 2px 6px;
  border-radius: var(--radius);
  background-color: var(--bg-primary);
}

.chart-sub-details {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  border-top: 1px solid var(--border-matte);
  padding-top: 16px;
  margin-top: 8px;
}

.detail-item {
  background-color: var(--bg-primary);
  border: 1px solid var(--border-matte);
  padding: 10px;
  border-radius: 8px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.det-label {
  font-size: 0.65rem;
  color: var(--color-zinc-muted);
}

.det-value {
  font-family: var(--font-family-mono);
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--color-white);
}

/* Category Breakdown HUD Rings */
.chart-container-flex {
  display: flex;
  align-items: center;
  justify-content: space-around;
  gap: 20px;
  min-height: 180px;
}

.pie-chart-wrapper {
  position: relative;
  width: 130px;
  height: 130px;
}

.donut-chart {
  width: 100%;
  height: 100%;
  transform: rotate(-90deg);
}

.chart-center-label {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  text-align: center;
}

#chart-center-percentage {
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--color-white);
  font-family: var(--font-family-mono);
}

.chart-center-sub {
  font-size: 0.6rem;
  color: var(--color-zinc-muted);
}

.chart-legend {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.75rem;
}

.legend-color {
  width: 10px;
  height: 10px;
  border-radius: 2px;
  flex-shrink: 0;
}

/* Urgent Lists on Dashboard */
.full-width-urgent-row {
  margin-top: 24px;
}

.hud-pulse-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background-color: var(--color-white);
}

.dashboard-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.urgent-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background-color: var(--bg-primary);
  border: 1px solid var(--border-matte);
  border-radius: var(--radius);
  font-size: 0.85rem;
  transition: var(--transition-smooth);
}

.urgent-item:hover {
  border-color: var(--border-focus);
}

.urgent-badge {
  padding: 2px 6px;
  border-radius: var(--radius);
  font-size: 0.65rem;
  font-weight: 700;
  font-family: var(--font-family-mono);
}

.badge-urgent {
  background-color: rgba(255, 255, 255, 0.08);
  color: var(--color-white);
  border: 1px solid var(--border-matte);
}

.badge-normal {
  background-color: transparent;
  color: var(--text-secondary);
  border: 1px solid var(--border-matte);
}

/* ==============================================================================
   2. TASKS & SCHEDULES LIST CARDS & FILTERS
   ============================================================================== */
.view-actions-card {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
  padding: 16px 20px;
}

.filters-group {
  display: flex;
  gap: 8px;
  align-items: center;
}

.label-text {
  font-size: 0.8rem;
  color: var(--text-secondary);
  margin-right: 4px;
}

.btn-filter {
  background-color: var(--bg-primary);
  border: 1px solid var(--border-matte);
  color: var(--text-secondary);
  padding: 6px 14px;
  border-radius: var(--radius);
  font-size: 0.8rem;
  cursor: pointer;
  font-weight: 600;
  transition: var(--transition-smooth);
}

.btn-filter:hover {
  color: var(--text-primary);
  border-color: var(--border-focus);
}

.btn-filter.active {
  background-color: var(--color-white);
  border-color: var(--color-white);
  color: var(--bg-primary);
  font-weight: 700;
}

/* Lists grid containers */
.list-container {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.card-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  animation: item-fade-in 0.3s cubic-bezier(0.4, 0, 0.2, 1) forwards;
  background-color: var(--card-matte);
  border: 1px solid var(--border-matte);
  border-radius: var(--radius);
  padding: 16px 20px;
}

.card-content-left {
  display: flex;
  align-items: flex-start;
  gap: 14px;
}

.checkbox-custom {
  appearance: none;
  -webkit-appearance: none;
  width: 20px;
  height: 20px;
  border: 2px solid var(--border-matte);
  border-radius: var(--radius);
  outline: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: var(--transition-smooth);
}

.checkbox-custom:checked {
  background-color: var(--color-white);
  border-color: var(--color-white);
}

.checkbox-custom:checked::after {
  content: '✓';
  color: var(--bg-primary);
  font-size: 0.75rem;
  font-weight: bold;
}

.card-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

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

.card-desc {
  font-size: 0.8rem;
  color: var(--text-secondary);
  line-height: 1.4;
}

.card-meta-row {
  display: flex;
  gap: 10px;
  align-items: center;
  margin-top: 4px;
}

.meta-item {
  font-size: 0.7rem;
  color: var(--color-zinc-muted);
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-family: var(--font-family-mono);
}

.card-actions-right {
  display: flex;
  gap: 6px;
}

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

.btn-trash:hover {
  background-color: rgba(255, 255, 255, 0.04);
  border-color: var(--color-red);
  color: var(--color-red);
}

/* Checked state */
.card-item.done .card-title {
  text-decoration: line-through;
  color: var(--color-zinc-muted);
}

.card-item.done {
  opacity: 0.55;
}

/* ==============================================================================
   4. EXPENSE TAB STYLINGS (Drag & Drop HUD)
   ============================================================================== */
.expense-hud-grid {
  display: grid;
  grid-template-columns: 1fr 2fr;
  gap: 24px;
  margin-bottom: 30px;
}

.hud-card {
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.hud-card-sub {
  font-size: 0.7rem;
  color: var(--color-zinc-muted);
  margin-top: 6px;
}

.col-span-2 {
  grid-column: span 2;
}

.hud-card p {
  font-size: 0.75rem;
  color: var(--color-zinc-muted);
  font-weight: 700;
  margin-bottom: 6px;
  letter-spacing: 0.05em;
}

.hud-card h2 {
  font-size: 2.2rem;
  font-weight: 800;
  font-family: var(--font-family-mono);
  color: var(--color-white);
}

.budget-progress-container {
  width: 100%;
  height: 10px;
  background-color: var(--bg-primary);
  border-radius: var(--radius);
  overflow: hidden;
  margin-bottom: 8px;
  border: 1px solid var(--border-matte);
}

.budget-progress-bar {
  height: 100%;
  width: 0%;
  background-color: var(--color-white);
  border-radius: var(--radius);
  transition: width 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

.budget-info {
  display: flex;
  justify-content: space-between;
  font-size: 0.75rem;
  color: var(--text-secondary);
  font-weight: bold;
}

#expense-budget-percent {
  color: var(--color-white);
  font-family: var(--font-family-mono);
}

/* Upload & Manual Columns Grid */
.expense-actions-columns {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  margin-bottom: 30px;
}

.action-column {
  display: flex;
  flex-direction: column;
}

.description-text {
  font-size: 0.75rem;
  color: var(--color-zinc-muted);
  line-height: 1.4;
  margin-bottom: 12px;
}

.badge {
  font-size: 0.65rem;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: var(--radius);
}

.badge-accent {
  background-color: transparent;
  color: var(--color-white);
  border: 1px solid var(--border-matte);
}

/* AI Scan drag and drop zone */
.dropzone {
  flex-grow: 1;
  border: 1px dashed var(--border-matte);
  background-color: var(--bg-primary);
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 30px;
  cursor: pointer;
  transition: var(--transition-smooth);
}

.dropzone:hover, .dropzone.dragover {
  border-color: var(--border-focus);
}

.dropzone-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}

.dropzone-icon {
  font-size: 2rem;
  margin-bottom: 4px;
}

.dropzone-content p {
  font-size: 0.9rem;
  font-weight: 700;
}

.text-highlight {
  color: var(--color-white);
  text-decoration: underline;
}

.dropzone-sub {
  font-size: 0.65rem;
  color: var(--color-zinc-muted);
}

/* Scan status box */
.scan-status-box {
  margin-top: 14px;
  background-color: var(--bg-primary);
  border: 1px solid var(--border-matte);
  padding: 14px;
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  gap: 12px;
}

.spinner {
  width: 20px;
  height: 20px;
  border: 2px solid rgba(255, 255, 255, 0.1);
  border-top-color: var(--color-white);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

#scan-status-text {
  font-size: 0.8rem;
  color: var(--text-primary);
}

/* Expenses Ledger Table styling */
.expense-table-card {
  margin-bottom: 30px;
}

.table-responsive {
  width: 100%;
  overflow-x: auto;
}

.expense-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
}

.expense-table th {
  padding: 12px 14px;
  font-size: 0.75rem;
  color: var(--color-zinc-muted);
  font-weight: 700;
  border-bottom: 1px solid var(--border-matte);
}

.expense-table td {
  padding: 12px 14px;
  font-size: 0.8rem;
  border-bottom: 1px solid var(--border-matte);
}

.expense-table tr:hover td {
  background-color: rgba(255, 255, 255, 0.02);
}

.expense-source-badge {
  font-size: 0.6rem;
  font-weight: bold;
  padding: 2px 5px;
  border-radius: var(--radius);
  font-family: var(--font-family-mono);
  border: 1px solid var(--border-matte);
  background-color: var(--bg-primary);
}

.source-web, .source-manual, .source-discord {
  color: var(--text-secondary);
}

.expense-amount-val {
  font-family: var(--font-family-mono);
  font-weight: 700;
  font-size: 0.85rem;
  color: var(--color-white);
  text-align: right;
}

.expense-table th:last-child,
.expense-table td:last-child {
  text-align: right;
}

/* ==============================================================================
   5. CONFIG TAB GRID LAYOUT
   ============================================================================== */
.config-items-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-top: 10px;
}

.config-item-box {
  padding: 14px 0;
  border-bottom: 1px dashed var(--border-matte);
}

.config-item-label {
  font-size: 0.7rem;
  color: var(--color-zinc-muted);
  margin-bottom: 4px;
  font-weight: 700;
}

.config-item-value {
  font-family: var(--font-family-mono);
  font-size: 0.8rem;
  font-weight: 500;
  word-break: break-all;
}

/* Warnings */
.alert-box {
  border-left: 3px solid var(--color-zinc-muted);
  background-color: var(--bg-primary);
  margin-top: 24px;
}

.alert-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
}

.alert-icon {
  font-size: 1rem;
}

.alert-header h4 {
  font-size: 0.85rem;
  font-weight: bold;
  color: var(--color-white);
}

.alert-box p {
  font-size: 0.75rem;
  color: var(--text-secondary);
  line-height: 1.4;
}

/* ==============================================================================
   POPUP MODAL DIALOGS (Highly Interactive Overlays)
   ============================================================================== */
.modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background-color: rgba(9, 9, 11, 0.7);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  opacity: 0;
  pointer-events: none;
  transition: var(--transition-smooth);
}

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

.modal-content {
  width: 100%;
  max-width: 460px;
  transform: translateY(12px);
  transition: var(--transition-smooth);
  border: 1px solid var(--border-matte);
}

.wide-modal {
  max-width: 600px;
}

.modal.active .modal-content {
  transform: translateY(0);
}

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

.modal-header h3 {
  font-size: 1.05rem;
  font-weight: 800;
}

.btn-close {
  background: transparent;
  border: none;
  font-size: 1.4rem;
  cursor: pointer;
  color: var(--color-zinc-muted);
  line-height: 1;
}

.btn-close:hover {
  color: var(--color-white);
}

/* Receipt AI result layout */
.receipt-result-body {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 20px;
}

.receipt-result-icon {
  font-size: 2.5rem;
  text-align: center;
}

.receipt-ai-comment {
  background-color: var(--bg-primary);
  border: 1px solid var(--border-matte);
  padding: 16px;
  border-radius: 10px;
  font-size: 0.8rem;
  line-height: 1.5;
  white-space: pre-wrap;
  max-height: 300px;
  overflow-y: auto;
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  border-top: 1px solid var(--border-matte);
  padding-top: 12px;
}

/* ==============================================================================
   RESPONSIVE SMARTPHONE UI (Adaptive Layouts)
   ============================================================================= */

@media (max-width: 768px) {
  
  /* Sidebar transforms into Bottom Nav Bar */
  .sidebar {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100vw;
    height: 64px;
    flex-direction: row;
    background-color: var(--bg-primary);
    border-top: 1px solid var(--border-matte);
    border-right: none;
    padding: 0 12px;
    justify-content: space-around;
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.6);
    z-index: 1000;
  }

  .sidebar-brand {
    display: none; /* Hide brand/logo on mobile bottom nav */
  }

  .sidebar-menu {
    width: 100%;
    flex-direction: row;
    justify-content: space-around;
    align-items: center;
    gap: 0;
  }

  .menu-item {
    flex-direction: column;
    align-items: center;
    gap: 2px;
    padding: 6px;
    font-size: 0.65rem;
    text-align: center;
    border: none !important;
    border-radius: var(--radius);
    color: var(--color-zinc-muted);
  }

  .menu-item .menu-icon {
    font-size: 1.15rem;
    margin: 0;
  }

  .menu-item:hover {
    background-color: transparent;
    padding-left: 6px;
  }

  .menu-item.active {
    color: var(--color-white);
    background-color: rgba(255, 255, 255, 0.05);
  }

  /* Main Workspace adjustments */
  .main-content {
    padding: 24px 16px 88px 16px; /* High bottom padding to prevent overlap with bottom nav bar! */
    height: auto;
    min-height: calc(100vh - 64px);
  }

  /* Stacking Top Header */
  .top-header {
    flex-direction: column;
    align-items: stretch;
    gap: 16px;
    border-bottom: 1px solid var(--border-matte);
    padding-bottom: 16px;
  }

  .header-controls {
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 10px;
    width: 100%;
  }

  .profile-switch {
    flex-grow: 1;
    justify-content: space-between;
  }

  #btn-logout {
    padding: 8px 12px;
    font-size: 0.8rem;
  }

  /* Layout Grids Stacking to 1 Column */
  .stats-grid {
    grid-template-columns: 1fr;
    gap: 16px;
  }

  .stat-card {
    min-height: 130px;
  }

  .dashboard-columns,
  .expense-actions-columns {
    grid-template-columns: 1fr;
    gap: 20px;
  }

  .expense-hud-grid {
    grid-template-columns: 1fr;
    gap: 16px;
  }

  .col-span-2 {
    grid-column: span 1;
  }

  .hud-card {
    padding: 16px;
  }

  .config-items-grid {
    grid-template-columns: 1fr;
  }

  .welcome-card {
    flex-direction: column;
    text-align: center;
    gap: 14px;
    padding: 16px;
  }

  .speech-bubble::before {
    display: none; /* Hide side arrow of speech bubble */
  }

  .pie-chart-wrapper {
    width: 110px;
    height: 110px;
  }

  .chart-container-flex {
    flex-direction: column;
    gap: 16px;
    padding: 10px 0;
  }

  /* Table responsiveness and clean details */
  .expense-table th:nth-child(3),
  .expense-table td:nth-child(3),
  .expense-table th:nth-child(4),
  .expense-table td:nth-child(4) {
    display: none; /* Hide Description & Source on small mobile devices to prevent overflow */
  }

  .expense-table th, .expense-table td {
    padding: 10px 8px;
    font-size: 0.75rem;
  }
}

/* ==============================================================================
   DYNAMIC ANIMATION KEYFRAMES
   ============================================================================== */
@keyframes tab-fade-in {
  from {
    opacity: 0;
    transform: translateY(4px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes item-fade-in {
  from {
    opacity: 0;
    transform: translateX(-4px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes logo-float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-4px); }
}

@keyframes spin {
  to { transform: rotate(360deg); }
}
