
/* =========================================
   CARDMIND — PREMIUM FINANCE DASHBOARD
   ========================================= */

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

:root {
  --bg: #0b0e14;
  --bg-secondary: #10141d;
  --panel: #141923;
  --panel-hover: #1a202c;
  --border: rgba(255,255,255,0.075);
  --text: #f4f6fb;
  --muted: #8c96a8;
  --muted-light: #b4bdcb;
  --accent: #8b7cff;
  --accent-light: #a99dff;
  --accent-soft: rgba(139,124,255,0.12);
  --green: #48d6a0;
  --green-soft: rgba(72,214,160,0.12);
  --red: #ff7185;
  --red-soft: rgba(255,113,133,0.12);
  --blue: #64b5ff;
  --yellow: #f5c96a;
  --radius: 18px;
  --radius-sm: 12px;
  --shadow: 0 12px 40px rgba(0,0,0,0.2);
}

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

html {
  scroll-behavior: smooth;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Inter', sans-serif;
  font-size: 14px;
  line-height: 1.6;
  min-height: 100vh;
}

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

button {
  cursor: pointer;
  transition: all 0.2s ease;
}

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

.hidden {
  display: none !important;
}

/* =========================================
   LAYOUT
   ========================================= */

.app-shell {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: 258px;
  min-width: 258px;
  background: #0e1219;
  border-right: 1px solid var(--border);
  padding: 28px 18px 18px;
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  bottom: 0;
  left: 0;
  z-index: 20;
}

.main-content {
  margin-left: 258px;
  width: calc(100% - 258px);
  padding: 36px 40px;
  max-width: 1700px;
}

/* =========================================
   BRAND
   ========================================= */

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 8px 34px;
}

.brand-icon {
  width: 42px;
  height: 42px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #9182ff, #5f55da);
  color: white;
  font-size: 20px;
  font-weight: 800;
  box-shadow: 0 5px 20px rgba(139,124,255,0.25);
}

.brand h2 {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.5px;
}

.brand span {
  font-size: 9px;
  letter-spacing: 1.4px;
  color: var(--muted);
  display: block;
  margin-top: 2px;
}

/* =========================================
   NAVIGATION
   ========================================= */

.nav-menu {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.nav-label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 1.4px;
  color: #626d7e;
  padding: 12px 12px 8px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 13px;
  padding: 11px 13px;
  border-radius: 11px;
  color: var(--muted-light);
  font-size: 13px;
  font-weight: 500;
  transition: all 0.2s ease;
}

.nav-icon {
  width: 22px;
  text-align: center;
  font-size: 16px;
  color: #8490a3;
}

.nav-item:hover {
  background: rgba(255,255,255,0.035);
  color: white;
}

.nav-item.active {
  background: var(--accent-soft);
  color: var(--accent-light);
  border: 1px solid rgba(139,124,255,0.12);
}

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

/* =========================================
   SIDEBAR BOTTOM
   ========================================= */

.sidebar-bottom {
  margin-top: auto;
}

.security-card {
  background: linear-gradient(145deg, rgba(139,124,255,0.09), rgba(139,124,255,0.025));
  border: 1px solid rgba(139,124,255,0.12);
  padding: 16px;
  border-radius: 14px;
  margin-bottom: 20px;
}

.security-icon {
  width: 32px;
  height: 32px;
  border-radius: 10px;
  background: var(--accent-soft);
  color: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  margin-bottom: 10px;
}

.security-card h4 {
  font-size: 12px;
  margin-bottom: 4px;
}

.security-card p {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.6;
}

.profile {
  border-top: 1px solid var(--border);
  padding: 18px 6px 5px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.profile-avatar {
  width: 36px;
  height: 36px;
  background: linear-gradient(135deg, #3c4561, #222a3b);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
}

.profile-info strong {
  display: block;
  font-size: 12px;
}

.profile-info span {
  color: var(--muted);
  font-size: 10px;
}

/* =========================================
   TOP BAR
   ========================================= */

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 20px;
  margin-bottom: 28px;
}

.breadcrumb {
  color: #707c8f;
  font-size: 11px;
  margin-bottom: 8px;
}

.breadcrumb span {
  color: var(--muted-light);
}

.topbar h1 {
  font-size: 26px;
  font-weight: 700;
  letter-spacing: -0.8px;
}

.page-subtitle {
  color: var(--muted);
  margin-top: 5px;
  font-size: 13px;
}

.topbar-actions {
  display: flex;
  gap: 10px;
}

.icon-button {
  height: 42px;
  width: 42px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  color: var(--muted-light);
  font-size: 18px;
}

.icon-button:hover {
  background: var(--panel-hover);
  color: white;
}

.primary-button {
  background: linear-gradient(135deg, #9182ff, #7164df);
  color: white;
  border: 1px solid rgba(255,255,255,0.08);
  padding: 11px 17px;
  border-radius: 11px;
  font-size: 12px;
  font-weight: 600;
  box-shadow: 0 4px 18px rgba(139,124,255,0.15);
}

.primary-button:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 22px rgba(139,124,255,0.28);
}

.secondary-button {
  background: #202634;
  color: var(--muted-light);
  border: 1px solid var(--border);
  padding: 11px 17px;
  border-radius: 11px;
  font-size: 12px;
  font-weight: 600;
}

.secondary-button:hover {
  background: #2a3242;
}

/* =========================================
   WELCOME BANNER
   ========================================= */

.welcome-banner {
  background:
    radial-gradient(circle at 80% 20%, rgba(139,124,255,0.19), transparent 40%),
    linear-gradient(120deg, #171c29, #121722);
  border: 1px solid rgba(139,124,255,0.11);
  border-radius: 20px;
  padding: 30px 32px;
  margin-bottom: 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  overflow: hidden;
  position: relative;
}

.banner-tag {
  color: var(--accent-light);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 1.5px;
}

.welcome-banner h2 {
  font-size: 23px;
  font-weight: 700;
  margin: 9px 0;
  letter-spacing: -0.6px;
}

.welcome-banner p {
  color: var(--muted);
  font-size: 13px;
}

.banner-art {
  font-size: 100px;
  color: rgba(169,157,255,0.25);
  line-height: 1;
  padding-right: 20px;
  transform: rotate(10deg);
}

/* =========================================
   STAT CARDS
   ========================================= */

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

.stat-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  transition: all 0.25s ease;
}

.stat-card:hover {
  transform: translateY(-2px);
  border-color: rgba(139,124,255,0.2);
  box-shadow: var(--shadow);
}

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

.stat-icon {
  width: 32px;
  height: 32px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--accent-soft);
  color: var(--accent-light);
  font-size: 14px;
  font-weight: 600;
}

.stat-card h2 {
  font-size: 23px;
  margin: 17px 0 5px;
  font-weight: 700;
  letter-spacing: -0.6px;
  overflow-wrap: anywhere;
}

.stat-description {
  font-size: 11px;
  color: #727e90;
}

/* =========================================
   PANELS
   ========================================= */

.content-grid {
  display: grid;
  grid-template-columns: 1.5fr 1fr;
  gap: 20px;
  margin-bottom: 24px;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px;
  margin-bottom: 24px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.05);
}

.content-grid .panel {
  margin-bottom: 0;
}

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

.panel-header h3 {
  font-size: 15px;
  font-weight: 600;
}

.panel-header p {
  color: var(--muted);
  font-size: 11px;
  margin-top: 4px;
}

.text-button {
  background: transparent;
  border: none;
  color: var(--accent-light);
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
}

.text-button:hover {
  color: white;
}

/* =========================================
   CREDIT CARD DISPLAY
   ========================================= */

.cards-container {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.credit-card {
  padding: 22px;
  border-radius: 17px;
  min-height: 175px;
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  box-shadow: 0 10px 30px rgba(0,0,0,0.2);
}

.credit-card::before {
  content: "";
  position: absolute;
  width: 220px;
  height: 220px;
  border: 1px solid rgba(255,255,255,0.09);
  border-radius: 50%;
  right: -90px;
  top: -110px;
}

.credit-card::after {
  content: "";
  position: absolute;
  width: 160px;
  height: 160px;
  border: 1px solid rgba(255,255,255,0.07);
  border-radius: 50%;
  right: -35px;
  bottom: -100px;
}

.credit-card.purple {
  background: linear-gradient(135deg, #5145a9, #29254d 60%, #17172b);
}

.credit-card.blue {
  background: linear-gradient(135deg, #25669b, #163752 60%, #102438);
}

.credit-card.green {
  background: linear-gradient(135deg, #257b68, #194b44 60%, #112e2d);
}

.credit-card.dark {
  background: linear-gradient(135deg, #39414f, #232b37 60%, #141a22);
}

.credit-card.gold {
  background: linear-gradient(135deg, #967346, #5e482e 60%, #382a1c);
}

.card-top,
.card-bottom {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  position: relative;
  z-index: 2;
}

.card-bank {
  font-size: 14px;
  font-weight: 700;
}

.card-chip {
  width: 35px;
  height: 26px;
  border-radius: 6px;
  background: linear-gradient(135deg, #d7c58a, #a58d52);
  border: 1px solid rgba(255,255,255,0.3);
  position: relative;
}

.card-chip::before {
  content: "";
  position: absolute;
  left: 11px;
  top: 0;
  bottom: 0;
  width: 1px;
  background: rgba(60,40,15,0.25);
}

.card-chip::after {
  content: "";
  position: absolute;
  top: 8px;
  left: 0;
  right: 0;
  height: 1px;
  background: rgba(60,40,15,0.25);
}

.card-number {
  font-size: 15px;
  letter-spacing: 3px;
  margin-top: 20px;
  font-weight: 500;
  position: relative;
  z-index: 2;
}

.card-bottom {
  align-items: flex-end;
}

.card-limit-label {
  color: rgba(255,255,255,0.65);
  font-size: 10px;
}

.card-limit {
  font-size: 15px;
  font-weight: 700;
  margin-top: 3px;
}

.card-brand-mark {
  font-size: 20px;
  font-weight: 800;
  font-style: italic;
  color: rgba(255,255,255,0.85);
}

.card-usage {
  position: relative;
  z-index: 2;
  margin-top: 16px;
}

.card-usage-bar {
  height: 5px;
  background: rgba(255,255,255,0.2);
  border-radius: 20px;
  overflow: hidden;
}

.card-usage-fill {
  height: 100%;
  background: rgba(255,255,255,0.8);
  border-radius: 20px;
  transition: width 0.4s ease;
}

.card-usage-info {
  display: flex;
  justify-content: space-between;
  margin-top: 7px;
  font-size: 10px;
  color: rgba(255,255,255,0.65);
}

.card-meta {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  margin-top: 14px;
  font-size: 11px;
  color: var(--muted-light);
}

.card-meta strong {
  color: white;
}

/* =========================================
   EMPTY STATE
   ========================================= */

.empty-state {
  text-align: center;
  padding: 38px 20px;
}

.empty-state.compact {
  padding: 30px 15px;
}

.empty-icon {
  width: 50px;
  height: 50px;
  background: rgba(255,255,255,0.03);
  border: 1px solid var(--border);
  border-radius: 15px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 21px;
  color: var(--muted);
  margin: 0 auto 15px;
}

.empty-state h4 {
  font-size: 13px;
  margin-bottom: 6px;
}

.empty-state p {
  color: var(--muted);
  font-size: 11px;
  margin-bottom: 17px;
}

/* =========================================
   BILLS
   ========================================= */

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

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

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

.bill-icon {
  width: 38px;
  height: 38px;
  background: rgba(255,255,255,0.035);
  border: 1px solid var(--border);
  border-radius: 11px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
}

.bill-name {
  font-size: 12px;
  font-weight: 600;
}

.bill-date {
  color: var(--muted);
  font-size: 10px;
  margin-top: 3px;
}

.bill-right {
  text-align: right;
}

.bill-amount {
  font-size: 13px;
  font-weight: 700;
}

.bill-status {
  display: inline-block;
  margin-top: 5px;
  padding: 4px 7px;
  border-radius: 6px;
  font-size: 9px;
  font-weight: 600;
}

.bill-status.pending {
  color: var(--yellow);
  background: rgba(245,201,106,0.1);
}

.bill-status.paid {
  color: var(--green);
  background: var(--green-soft);
}

.bill-status.overdue {
  color: var(--red);
  background: var(--red-soft);
}

/* =========================================
   TABLE
   ========================================= */

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

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 580px;
}

thead th {
  color: #748094;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  padding: 12px;
  text-align: left;
  border-bottom: 1px solid var(--border);
}

tbody td {
  padding: 15px 12px;
  border-bottom: 1px solid rgba(255,255,255,0.04);
  font-size: 11px;
}

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

.table-empty {
  text-align: center;
  color: var(--muted);
  padding: 40px 15px;
}

.transaction-name {
  font-weight: 600;
}

.transaction-sub {
  color: var(--muted);
  font-size: 10px;
  margin-top: 3px;
}

.category-badge {
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--border);
  color: var(--muted-light);
  padding: 5px 8px;
  border-radius: 7px;
  font-size: 10px;
}

.amount-negative {
  color: var(--text);
  font-weight: 600;
}

.amount-positive {
  color: var(--green);
  font-weight: 600;
}

/* =========================================
   MODAL
   ========================================= */

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.72);
  backdrop-filter: blur(7px);
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 20px;
  z-index: 100;
  overflow-y: auto;
}

.modal {
  background: #171c27;
  border: 1px solid rgba(255,255,255,0.09);
  border-radius: 20px;
  width: 100%;
  max-width: 480px;
  padding: 26px;
  box-shadow: 0 30px 80px rgba(0,0,0,0.5);
  margin: auto;
}

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

.modal-header h2 {
  font-size: 18px;
}

.modal-header p {
  color: var(--muted);
  font-size: 11px;
  margin-top: 5px;
}

.close-button {
  width: 32px;
  height: 32px;
  border-radius: 10px;
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--border);
  color: var(--muted);
  font-size: 20px;
}

.close-button:hover {
  background: rgba(255,255,255,0.1);
  color: white;
}

.form-group {
  margin-bottom: 17px;
}

.form-group label {
  display: block;
  font-size: 11px;
  font-weight: 600;
  color: var(--muted-light);
  margin-bottom: 7px;
}

.form-group input,
.form-group select {
  width: 100%;
  padding: 12px 14px;
  background: #0e131c;
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 10px;
  color: white;
  font-size: 12px;
  outline: none;
  transition: border 0.2s ease;
}

.form-group input:focus,
.form-group select:focus {
  border-color: rgba(139,124,255,0.5);
  box-shadow: 0 0 0 3px rgba(139,124,255,0.08);
}

.form-group input::placeholder {
  color: #5f6b7e;
}

.form-group select option {
  background: #171c27;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding-top: 10px;
}

/* =========================================
   AI ASSISTANT
   ========================================= */

.assistant-header {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 22px;
}

.assistant-avatar {
  width: 44px;
  height: 44px;
  border-radius: 14px;
  background: linear-gradient(135deg, #9182ff, #5f55da);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
}

.assistant-header h3 {
  font-size: 14px;
}

.assistant-header p {
  color: var(--muted);
  font-size: 11px;
}

.chat-messages {
  min-height: 220px;
  max-height: 400px;
  overflow-y: auto;
  background: #0e131c;
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 20px;
  margin-bottom: 16px;
}

.assistant-message {
  background: var(--accent-soft);
  border: 1px solid rgba(139,124,255,0.12);
  color: var(--muted-light);
  padding: 14px;
  border-radius: 12px;
  font-size: 12px;
  max-width: 85%;
}

.user-message {
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--border);
  color: white;
  padding: 14px;
  border-radius: 12px;
  font-size: 12px;
  max-width: 85%;
  margin: 15px 0 15px auto;
}

.chat-input-area {
  display: flex;
  gap: 10px;
}

.chat-input-area input {
  flex: 1;
  padding: 13px 15px;
  background: #0e131c;
  border: 1px solid var(--border);
  border-radius: 12px;
  color: white;
  outline: none;
  font-size: 12px;
}

.chat-input-area input:focus {
  border-color: rgba(139,124,255,0.4);
}

.chat-input-area button:disabled,
.chat-input-area input:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.assistant-note {
  color: #667185;
  font-size: 10px;
  margin-top: 12px;
}

/* =========================================
   FOOTER
   ========================================= */

.footer {
  display: flex;
  justify-content: space-between;
  gap: 15px;
  color: #5f6b7e;
  font-size: 10px;
  padding: 15px 3px 5px;
}

/* =========================================
   RESPONSIVE
   ========================================= */

@media (max-width: 1250px) {
  .main-content {
    padding: 30px;
  }

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

  .content-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 900px) {
  .sidebar {
    width: 220px;
    min-width: 220px;
  }

  .main-content {
    margin-left: 220px;
    width: calc(100% - 220px);
    padding: 25px;
  }
}

@media (max-width: 650px) {
  .sidebar {
    width: 100%;
    min-width: 0;
    position: relative;
    height: auto;
    padding: 16px;
    border-right: none;
    border-bottom: 1px solid var(--border);
  }

  .app-shell {
    flex-direction: column;
  }

  .brand {
    padding-bottom: 14px;
  }

  .nav-menu {
    flex-direction: row;
    flex-wrap: wrap;
    gap: 5px;
  }

  .nav-label {
    display: none;
  }

  .nav-item {
    padding: 9px 10px;
    font-size: 11px;
  }

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

  .sidebar-bottom {
    display: none;
  }

  .main-content {
    margin-left: 0;
    width: 100%;
    padding: 20px 16px;
  }

  .topbar {
    flex-direction: column;
    gap: 15px;
  }

  .topbar h1 {
    font-size: 22px;
  }

  .topbar-actions {
    width: 100%;
  }

  .topbar-actions .primary-button {
    flex: 1;
  }

  .welcome-banner {
    padding: 22px;
  }

  .welcome-banner h2 {
    font-size: 18px;
  }

  .welcome-banner p {
    font-size: 11px;
  }

  .banner-art {
    font-size: 55px;
    padding-right: 0;
  }

  .stats-grid {
    grid-template-columns: 1fr 1fr;
    gap: 10px;
  }

  .stat-card {
    padding: 15px;
  }

  .stat-card h2 {
    font-size: 18px;
  }

  .stat-top {
    font-size: 10px;
  }

  .panel {
    padding: 16px;
  }

  .panel-header h3 {
    font-size: 13px;
  }

  .footer {
    flex-direction: column;
  }
}

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

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