/* -------------------------------------------------------------
   MOHIRFINAI — DESIGN SYSTEM & TOKENS
   Dark Luxury Emerald & Sapphire Glassmorphism Theme
------------------------------------------------------------- */
:root {
  --bg-primary: #0a0f1d;
  --bg-secondary: #11182c;
  --bg-card: rgba(18, 26, 45, 0.75);
  --bg-card-hover: rgba(26, 38, 66, 0.85);
  --bg-input: rgba(13, 20, 36, 0.85);
  --bg-accent-soft: rgba(16, 185, 129, 0.12);
  --bg-gold-soft: rgba(245, 158, 11, 0.12);
  --bg-blue-soft: rgba(59, 130, 246, 0.12);
  --bg-red-soft: rgba(239, 68, 68, 0.12);

  --border-subtle: rgba(255, 255, 255, 0.08);
  --border-active: rgba(16, 185, 129, 0.45);
  --border-focus: #10b981;

  --text-primary: #f8fafc;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;

  --accent-green: #10b981;
  --accent-green-glow: rgba(16, 185, 129, 0.35);
  --accent-gold: #f59e0b;
  --accent-gold-glow: rgba(245, 158, 11, 0.35);
  --accent-blue: #38bdf8;
  --accent-purple: #a855f7;
  --accent-red: #f43f5e;

  --font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-full: 9999px;

  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.25);
  --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.35);
  --shadow-glow: 0 0 20px rgba(16, 185, 129, 0.25);
  --shadow-glow-gold: 0 0 20px rgba(245, 158, 11, 0.25);
}

/* Base Reset */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

body {
  font-family: var(--font-family);
  background: var(--bg-primary);
  color: var(--text-primary);
  background-image: 
    radial-gradient(at 0% 0%, rgba(16, 185, 129, 0.12) 0px, transparent 50%),
    radial-gradient(at 100% 100%, rgba(56, 189, 248, 0.10) 0px, transparent 50%),
    radial-gradient(at 50% 50%, rgba(15, 23, 42, 0.5) 0px, transparent 100%);
  background-attachment: fixed;
  min-height: 100vh;
  overflow-x: hidden;
  font-size: 14px;
  line-height: 1.5;
}

/* App Container */
.app-container {
  max-width: 480px;
  margin: 0 auto;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  position: relative;
  padding-bottom: 84px;
}

/* Top Header */
.app-header {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: rgba(10, 15, 29, 0.85);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border-subtle);
}

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

.brand-logo {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, #10b981, #059669);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  box-shadow: 0 0 12px var(--accent-green-glow);
}

.brand-logo svg {
  width: 20px;
  height: 20px;
}

.brand-text h1 {
  font-size: 15px;
  font-weight: 700;
  letter-spacing: -0.3px;
  color: #fff;
}

.live-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  font-weight: 600;
  color: var(--accent-green);
}

.live-badge .dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent-green);
  box-shadow: 0 0 6px var(--accent-green);
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.4; transform: scale(1.2); }
}

.branch-select {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  color: var(--text-primary);
  padding: 7px 12px;
  border-radius: var(--radius-full);
  font-size: 12px;
  font-weight: 600;
  outline: none;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition: all 0.2s ease;
}

.branch-select:focus {
  border-color: var(--border-focus);
}

/* App Content Area */
.app-content {
  flex: 1;
  padding: 16px;
}

/* Tab Panes */
.tab-pane {
  display: none;
  animation: fadeIn 0.25s ease-out;
}

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

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

/* Section Title Card */
.section-title-card {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 14px 16px;
  margin-bottom: 14px;
  backdrop-filter: blur(12px);
}

.title-icon {
  width: 42px;
  height: 42px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.shift-icon { background: var(--bg-accent-soft); color: var(--accent-green); }
.exp-icon { background: var(--bg-red-soft); color: var(--accent-red); }
.debt-icon { background: var(--bg-gold-soft); color: var(--accent-gold); }

.section-title-card h2 {
  font-size: 16px;
  font-weight: 700;
  letter-spacing: -0.3px;
}

.section-title-card p {
  font-size: 12px;
  color: var(--text-secondary);
}

/* AI Smart Box */
.ai-box {
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.12), rgba(56, 189, 248, 0.08));
  border: 1px solid rgba(16, 185, 129, 0.3);
  border-radius: var(--radius-lg);
  padding: 14px;
  margin-bottom: 16px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
}

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

.ai-title {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 700;
  color: var(--accent-green);
}

.sparkle-icon {
  width: 16px;
  height: 16px;
  animation: rotateSparkle 4s linear infinite;
}

@keyframes rotateSparkle {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

.ai-tag {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  background: rgba(16, 185, 129, 0.2);
  color: var(--accent-green);
  padding: 2px 7px;
  border-radius: var(--radius-full);
}

.ai-input-wrapper {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.ai-input-wrapper textarea {
  width: 100%;
  background: rgba(10, 15, 29, 0.75);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--text-primary);
  border-radius: var(--radius-md);
  padding: 10px;
  font-size: 13px;
  font-family: inherit;
  resize: none;
  outline: none;
  transition: border-color 0.2s;
}

.ai-input-wrapper textarea:focus {
  border-color: var(--accent-green);
}

.btn-ai-parse {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  background: linear-gradient(135deg, #10b981, #0d9488);
  color: #fff;
  border: none;
  padding: 8px 14px;
  border-radius: var(--radius-md);
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 2px 8px var(--accent-green-glow);
  transition: all 0.2s ease;
}

.btn-ai-parse:active {
  transform: scale(0.98);
}

.btn-ai-parse svg {
  width: 14px;
  height: 14px;
}

/* Forms & Inputs */
.form-container {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

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

.form-group label {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
}

.form-group label svg {
  width: 13px;
  height: 13px;
  color: var(--accent-green);
}

.form-group input,
.form-group select {
  width: 100%;
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  color: var(--text-primary);
  padding: 11px 14px;
  border-radius: var(--radius-md);
  font-size: 14px;
  font-family: inherit;
  outline: none;
  transition: all 0.2s ease;
}

.form-group input:focus,
.form-group select:focus {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.15);
}

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

/* Pill Toggle Buttons */
.pill-group {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  background: var(--bg-input);
  padding: 4px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
}

.pill-btn {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.pill-btn.active {
  background: var(--accent-green);
  color: #fff;
  font-weight: 700;
  box-shadow: 0 2px 8px var(--accent-green-glow);
}

/* Card Groups */
.card-group {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  backdrop-filter: blur(12px);
}

.card-group-header {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--text-primary);
  border-bottom: 1px solid var(--border-subtle);
  padding-bottom: 8px;
}

.card-group-header svg {
  width: 16px;
  height: 16px;
  color: var(--accent-green);
}

.card-group-header h3 {
  font-size: 13px;
  font-weight: 700;
  letter-spacing: -0.2px;
}

/* Live Calculation Box */
.live-calc-box {
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.1), rgba(245, 158, 11, 0.1));
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: var(--radius-lg);
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.calc-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.calc-label {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-secondary);
}

.calc-val {
  font-size: 16px;
  font-weight: 800;
}

.text-accent { color: var(--accent-green); }
.text-gold { color: var(--accent-gold); }

/* Buttons */
.btn-primary {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: linear-gradient(135deg, #10b981, #059669);
  color: #fff;
  border: none;
  padding: 14px 20px;
  border-radius: var(--radius-lg);
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 4px 16px var(--accent-green-glow);
  transition: all 0.2s ease;
  margin-top: 6px;
}

.btn-primary:active {
  transform: scale(0.98);
}

.btn-primary svg {
  width: 18px;
  height: 18px;
}

.btn-expense {
  background: linear-gradient(135deg, #f43f5e, #e11d48);
  box-shadow: 0 4px 16px rgba(244, 63, 94, 0.35);
}

/* Category Grid (Tab 2) */
.category-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}

.cat-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  padding: 10px 6px;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all 0.2s ease;
}

.cat-btn svg {
  width: 18px;
  height: 18px;
}

.cat-btn span {
  font-size: 10px;
  font-weight: 600;
  text-align: center;
  line-height: 1.2;
}

.cat-btn.active {
  background: var(--bg-accent-soft);
  border-color: var(--accent-green);
  color: var(--accent-green);
  box-shadow: 0 0 12px var(--accent-green-glow);
}

/* Amount Chips */
.amount-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 6px;
}

.chip {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  padding: 6px 10px;
  border-radius: var(--radius-full);
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.chip:active {
  background: var(--accent-green);
  color: #fff;
}

.clear-chip {
  color: var(--accent-red);
}

/* Dashboard Tab (Tab 3) */
.dashboard-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.dashboard-header-row h2 {
  font-size: 18px;
  font-weight: 800;
  letter-spacing: -0.4px;
}

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

.btn-refresh {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-refresh:active {
  transform: rotate(180deg);
}

.btn-refresh svg {
  width: 16px;
  height: 16px;
}

.kpi-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 16px;
}

.kpi-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  backdrop-filter: blur(12px);
}

.kpi-icon {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
}

.kpi-icon svg {
  width: 16px;
  height: 16px;
}

.green-card .kpi-icon { background: var(--bg-accent-soft); color: var(--accent-green); }
.gold-card .kpi-icon { background: var(--bg-gold-soft); color: var(--accent-gold); }
.teal-card .kpi-icon { background: var(--bg-blue-soft); color: var(--accent-blue); }
.red-card .kpi-icon { background: var(--bg-red-soft); color: var(--accent-red); }
.blue-card .kpi-icon { background: rgba(168, 85, 247, 0.15); color: var(--accent-purple); }
.purple-card .kpi-icon { background: var(--bg-gold-soft); color: var(--accent-gold); }

.kpi-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-secondary);
  display: block;
}

.kpi-value {
  font-size: 15px;
  font-weight: 800;
  color: var(--text-primary);
  letter-spacing: -0.3px;
  margin-top: 2px;
}

/* External Google Sheet Banner */
.sheet-link-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: linear-gradient(135deg, rgba(37, 99, 235, 0.15), rgba(16, 185, 129, 0.15));
  border: 1px solid rgba(59, 130, 246, 0.3);
  border-radius: var(--radius-lg);
  padding: 12px 16px;
  text-decoration: none;
  color: var(--text-primary);
  margin-bottom: 16px;
  transition: transform 0.2s ease;
}

.sheet-link-banner:active {
  transform: scale(0.98);
}

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

.banner-left svg {
  width: 24px;
  height: 24px;
  color: var(--accent-blue);
}

.banner-left strong {
  font-size: 13px;
  font-weight: 700;
  display: block;
}

.banner-left p {
  font-size: 11px;
  color: var(--text-secondary);
}

/* Activity Lists */
.activity-section {
  margin-bottom: 16px;
}

.section-subhead {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}

.section-subhead h3 {
  font-size: 13px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--text-secondary);
}

.section-subhead svg {
  width: 14px;
  height: 14px;
  color: var(--accent-green);
}

.activity-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.activity-item {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 10px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.act-left {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.act-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-primary);
}

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

.act-amount {
  font-size: 14px;
  font-weight: 800;
  color: var(--accent-green);
}

.act-amount.exp {
  color: var(--accent-red);
}

.loading-spinner {
  text-align: center;
  padding: 16px;
  font-size: 12px;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.spin {
  animation: spin 1s linear infinite;
}

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

/* Tab 4: Qarzdorlik */
.debt-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 14px;
}

.debt-tab-btn {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  padding: 9px;
  border-radius: var(--radius-md);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.debt-tab-btn.active {
  background: var(--bg-accent-soft);
  border-color: var(--accent-green);
  color: var(--accent-green);
  font-weight: 700;
}

.debt-content-view {
  display: none;
  flex-direction: column;
  gap: 10px;
}

.debt-content-view.active {
  display: flex;
}

.debt-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

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

.debt-card-top h4 {
  font-size: 13px;
  font-weight: 700;
}

.status-pill {
  font-size: 10px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: var(--radius-full);
}

.status-pending {
  background: rgba(245, 158, 11, 0.15);
  color: var(--accent-gold);
}

.debt-card-body {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  background: rgba(0, 0, 0, 0.2);
  padding: 8px;
  border-radius: var(--radius-sm);
}

.debt-metric {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.d-label {
  font-size: 10px;
  color: var(--text-muted);
}

.d-val {
  font-size: 11px;
  font-weight: 700;
}

.debt-card-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 11px;
  color: var(--text-muted);
}

/* Bottom Navigation Bar */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  max-width: 480px;
  margin: 0 auto;
  background: rgba(10, 15, 29, 0.92);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-top: 1px solid var(--border-subtle);
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  padding: 8px 6px;
  z-index: 100;
}

.nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 6px 2px;
  border-radius: var(--radius-md);
  transition: all 0.2s ease;
}

.nav-item svg {
  width: 20px;
  height: 20px;
  transition: transform 0.2s ease;
}

.nav-item span {
  font-size: 10px;
  font-weight: 600;
}

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

.nav-item.active svg {
  transform: translateY(-2px);
}

/* Toast Notifications */
.toast-container {
  position: fixed;
  top: 20px;
  left: 16px;
  right: 16px;
  max-width: 440px;
  margin: 0 auto;
  z-index: 200;
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.toast-container.hidden {
  opacity: 0;
  transform: translateY(-20px);
  pointer-events: none;
}

.toast-content {
  background: #0f291e;
  border: 1px solid var(--accent-green);
  border-radius: var(--radius-lg);
  padding: 12px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
}

.toast-icon {
  width: 24px;
  height: 24px;
  color: var(--accent-green);
  flex-shrink: 0;
}

.toast-text strong {
  font-size: 13px;
  color: #fff;
  display: block;
}

.toast-text p {
  font-size: 11px;
  color: #a7f3d0;
}
