/* ==========================================================================
   FINFIT NEO-DARK FINTECH DESIGN SYSTEM (FULL VIEWPORT & INVOICE SYSTEM)
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=IBM+Plex+Mono:wght@400;500;600;700&family=Inter:ital,wght@0,300;0,400;0,500;0,600;0,700;1,400&family=Sora:wght@400;500;600;700;800&display=swap');

:root {
  --bg-page: #080808;
  --bg-frame: #080808;
  --bg-app: #0A0A0A;
  --surface-1: #111113;
  --surface-2: #171719;
  --surface-3: #1E1E20;
  --surface-inverse: #FFFFFF;

  --border-card: rgba(255, 255, 255, 0.06);
  --border-subtle: rgba(255, 255, 255, 0.04);
  --border-strong: rgba(255, 255, 255, 0.10);
  --frame-highlight: rgba(255, 255, 255, 0.12);

  --text-primary: #FFFFFF;
  --text-secondary: #A8A8AD;
  --text-tertiary: #6B6B70;
  --text-quaternary: #37363A;
  --text-on-inverse: #0A0A0A;

  --accent-blue: #6DA4F8;
  --accent-blue-strong: #76AAFF;
  --accent-blue-muted: #6495E0;
  --accent-blue-link: #5B93F0;

  --success: #00B774;
  --success-soft: #48C783;
  --success-badge-bg: #69CB96;
  --success-text: #4BB279;
  --warning: #FB8222;
  --warning-soft: #FD802D;
  --danger: #DE4645;
  --data-yellow: #E2B621;
  --data-purple: #A78BFA;

  --r-frame: 0px;
  --r-card: 16px;
  --r-tile: 12px;
  --r-cell: 8px;
  --r-full: 999px;

  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-display: 'Sora', sans-serif;
  --font-mono: 'IBM Plex Mono', monospace;

  --ease: cubic-bezier(.4,0,.2,1);
  --dur-base: 160ms;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: var(--font-sans);
  -webkit-font-smoothing: antialiased;
}

body {
  background-color: var(--bg-page);
  color: var(--text-primary);
  min-height: 100vh;
  width: 100vw;
  height: 100vh;
  overflow: hidden;
  display: flex;
}

.tabular-nums { font-variant-numeric: tabular-nums; }

.app-frame {
  width: 100vw;
  height: 100vh;
  max-width: 100%;
  background-color: var(--bg-frame);
  border-radius: 0;
  border: none;
  display: flex;
  overflow: hidden;
  position: relative;
}

.sidebar-rail {
  width: 72px;
  background-color: var(--surface-1);
  border-right: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 24px 0;
  z-index: 20;
}

.nav-logo {
  width: 62px;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 28px;
  cursor: pointer;
  padding: 0 2px;
}

.nav-logo img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.nav-stack {
  display: flex;
  flex-direction: column;
  gap: 18px;
  align-items: center;
}

.nav-item {
  width: 44px;
  height: 44px;
  border-radius: var(--r-tile);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-quaternary);
  background: transparent;
  border: none;
  cursor: pointer;
  transition: all var(--dur-base) var(--ease);
  font-size: 18px;
}

.nav-item:hover { color: var(--text-secondary); }
.nav-item.active { background-color: var(--surface-inverse); color: var(--text-on-inverse); }

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

.main-stage {
  flex: 1;
  background-color: var(--bg-app);
  display: flex;
  flex-direction: column;
  min-width: 0;
  height: 100vh;
}

.header-bar {
  height: 76px;
  padding: 0 32px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border-subtle);
}

.header-title {
  font-size: 28px;
  font-weight: 500;
  font-family: var(--font-display);
  letter-spacing: -0.02em;
  color: var(--text-primary);
}

.header-controls {
  display: flex;
  align-items: center;
  gap: 16px;
}

.search-pill {
  width: 260px;
  height: 44px;
  border-radius: var(--r-full);
  background-color: var(--surface-2);
  border: 1px solid var(--border-card);
  display: flex;
  align-items: center;
  padding: 0 16px;
  gap: 10px;
  cursor: pointer;
}

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

.user-chip {
  height: 48px;
  border-radius: var(--r-full);
  background-color: var(--surface-2);
  border: 1px solid var(--border-card);
  display: flex;
  align-items: center;
  padding: 6px 16px 6px 6px;
  gap: 10px;
  cursor: pointer;
}

.user-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: linear-gradient(135deg, #3B82F6, #8B5CF6);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 12px;
  color: #fff;
}

.notification-btn {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background-color: var(--surface-2);
  border: 1px solid var(--border-card);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
  position: relative;
  cursor: pointer;
}

.notification-badge {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background-color: var(--danger);
  box-shadow: 0 0 0 2px var(--surface-2);
}

.content-grid {
  padding: 28px 32px;
  display: flex;
  flex-direction: column;
  gap: 24px;
  overflow-y: auto;
  flex: 1;
}

.grid-row-1 {
  display: grid;
  grid-template-columns: 1fr 360px;
  gap: 24px;
  min-height: 420px;
}

.grid-row-2 {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 24px;
  min-height: 380px;
}

.card-panel {
  background-color: var(--surface-1);
  border: 1px solid var(--border-card);
  border-radius: var(--r-card);
  padding: 24px;
  display: flex;
  flex-direction: column;
  position: relative;
  overflow: hidden;
  transition: border-color var(--dur-base) var(--ease);
}

.card-panel:hover { border-color: var(--border-strong); }

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

.card-title {
  font-size: 19px;
  font-weight: 500;
  letter-spacing: -0.01em;
  color: var(--text-primary);
}

.hatch {
  background-image: repeating-linear-gradient(
    45deg,
    rgba(255, 255, 255, 0.045) 0 2px,
    transparent 2px 6px
  );
}

.segmented-control {
  background-color: var(--surface-2);
  border: 1px solid var(--border-card);
  border-radius: var(--r-full);
  padding: 4px;
  display: inline-flex;
  gap: 2px;
}

.segmented-item {
  padding: 8px 16px;
  border-radius: var(--r-full);
  font-size: 12.5px;
  font-weight: 500;
  color: var(--text-tertiary);
  background: transparent;
  border: none;
  cursor: pointer;
  transition: all var(--dur-base) var(--ease);
}

.segmented-item:hover { color: var(--text-primary); }

.segmented-item.active {
  color: var(--text-on-inverse);
  background-color: var(--surface-inverse);
}

.hero-metric-row {
  display: flex;
  align-items: baseline;
  gap: 10px;
}

.hero-number {
  font-size: 42px;
  font-weight: 600;
  letter-spacing: -0.03em;
  color: var(--text-primary);
  line-height: 1.05;
}

.hero-currency {
  font-size: 42px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-right: 6px;
}

.delta-badge {
  background-color: var(--success-badge-bg);
  color: #0A0A0A;
  font-size: 11px;
  font-weight: 600;
  padding: 4px 9px;
  border-radius: var(--r-full);
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.delta-comparison { font-size: 12px; color: var(--text-tertiary); }

.bar-chart-container {
  flex: 1;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  padding: 24px 12px 0 12px;
  gap: 16px;
}

.bar-col {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  height: 100%;
  justify-content: flex-end;
}

.bar-wrapper {
  width: 100%;
  max-width: 48px;
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
}

.bar-inactive {
  background-color: var(--surface-3);
  border-radius: 6px 6px 0 0;
  width: 100%;
}

.bar-cap-marker {
  position: absolute;
  top: 8px;
  left: 50%;
  transform: translateX(-50%);
  width: 24px;
  height: 3px;
  border-radius: 2px;
  background-color: var(--text-quaternary);
}

.bar-active {
  background-color: var(--accent-blue);
  border-radius: 8px;
  width: 100%;
  position: relative;
}

.bar-active-val {
  position: absolute;
  bottom: 8px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 11.5px;
  font-weight: 600;
  color: rgba(10, 10, 10, 0.85);
}

.bar-tooltip {
  position: absolute;
  top: -34px;
  left: 50%;
  transform: translateX(-50%);
  background-color: var(--accent-blue-muted);
  color: #fff;
  font-size: 11px;
  font-weight: 600;
  padding: 5px 11px;
  border-radius: var(--r-full);
  white-space: nowrap;
}

.bar-label { font-size: 11px; color: var(--text-tertiary); margin-top: 12px; }

/* Calendar Interactivity */
.calendar-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.calendar-month { font-size: 14px; font-weight: 500; color: var(--text-primary); }

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

.weekday-head { font-size: 11px; font-weight: 500; color: var(--text-tertiary); text-align: center; margin-bottom: 8px; }

.date-cell {
  height: 34px;
  border-radius: var(--r-cell);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  font-size: 12.5px;
  color: var(--text-secondary);
  background: transparent;
  cursor: pointer;
  position: relative;
  transition: all var(--dur-base) var(--ease);
}

.date-cell:hover:not(.hatch) {
  background-color: var(--surface-2);
  color: var(--text-primary);
}

.date-cell.selected { background-color: var(--accent-blue); color: #FFFFFF; font-weight: 700; }
.date-cell.selected::after {
  content: ''; width: 4px; height: 4px; border-radius: 50%; background-color: #FFFFFF; position: absolute; bottom: 4px;
}

.calendar-stat-pill {
  background-color: var(--surface-2);
  border: 1px solid var(--border-card);
  border-radius: var(--r-tile);
  padding: 14px 16px;
  margin-top: auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.donut-layout { display: flex; align-items: center; justify-content: space-between; flex: 1; }
.donut-center-text { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); text-align: center; }
.legend-stack { display: flex; flex-direction: column; gap: 10px; }
.legend-row { display: flex; align-items: center; gap: 10px; font-size: 12px; color: var(--text-secondary); }
.legend-dot { width: 7px; height: 7px; border-radius: 50%; }

.subtab-bar {
  display: flex;
  gap: 8px;
  border-bottom: 1px solid var(--border-subtle);
  padding-bottom: 12px;
  margin-bottom: 16px;
}

.subtab-btn {
  padding: 8px 18px;
  border-radius: var(--r-full);
  font-size: 12.5px;
  font-weight: 500;
  color: var(--text-tertiary);
  background: transparent;
  border: 1px solid transparent;
  cursor: pointer;
}

.subtab-btn.active {
  color: var(--text-primary);
  background-color: var(--surface-2);
  border-color: var(--border-card);
}

.cmd-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(8, 8, 8, 0.85);
  backdrop-filter: blur(12px);
  z-index: 999;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding-top: 100px;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--dur-base) var(--ease);
}

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

.cmd-dialog {
  width: 100%;
  max-width: 640px;
  background: var(--surface-1);
  border: 1px solid var(--border-strong);
  border-radius: var(--r-card);
  overflow: hidden;
}

.toast-container {
  position: fixed;
  bottom: 28px;
  right: 28px;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.toast {
  background: var(--surface-2);
  border: 1px solid var(--border-card);
  border-radius: var(--r-tile);
  padding: 14px 20px;
  color: var(--text-primary);
  font-size: 13.5px;
  display: flex;
  align-items: center;
  gap: 12px;
}

/* Printable Official Invoice Modal Styling */
.invoice-paper {
  background: #FFFFFF;
  color: #0A0A0A;
  border-radius: 12px;
  padding: 32px;
  font-family: var(--font-sans);
}

/* ==========================================================================
   FINBOT CHAT WIDGET (AI Summary card replacement)
   ========================================================================== */

.card-panel.finbot-card { padding: 0; }

.finbot-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 20px 22px 14px;
  border-bottom: 1px solid var(--border-subtle);
}

.finbot-title-group { display: flex; align-items: center; gap: 10px; }
.finbot-card .card-title.finbot-title { font-size: 15px; line-height: 1.2; }
.finbot-subtitle { font-size: 11px; color: var(--text-tertiary); margin-top: 1px; }

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

.finbot-status {
  font-size: 10.5px;
  color: var(--text-tertiary);
  display: flex;
  align-items: center;
  gap: 5px;
  white-space: nowrap;
}

.finbot-dot { width: 6px; height: 6px; border-radius: 50%; display: inline-block; }
.finbot-dot.on { background: var(--success); box-shadow: 0 0 6px var(--success); }
.finbot-dot.off { background: var(--danger); }

.finbot-icon-btn {
  width: 28px;
  height: 28px;
  border-radius: var(--r-tile);
  background-color: var(--surface-2);
  border: 1px solid var(--border-card);
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  cursor: pointer;
  transition: all var(--dur-base) var(--ease);
}
.finbot-icon-btn:hover { background-color: var(--surface-3); color: var(--text-primary); }

.finbot-settings { padding: 12px 22px; border-bottom: 1px solid var(--border-subtle); background-color: var(--surface-2); }
.finbot-settings.hidden { display: none; }
.finbot-settings label { font-size: 10px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: var(--text-tertiary); }
.finbot-settings-row { display: flex; gap: 8px; margin-top: 6px; }
.finbot-settings-row input {
  flex: 1; background-color: var(--surface-1); border: 1px solid var(--border-card);
  border-radius: var(--r-tile); padding: 8px 11px; font-size: 12px; color: var(--text-primary);
  outline: none; font-family: var(--font-sans);
}
.finbot-settings-row input:focus { border-color: var(--border-strong); }
.finbot-settings-row button {
  border: none; border-radius: var(--r-tile); padding: 8px 14px;
  background-color: var(--surface-inverse); color: var(--text-on-inverse);
  font-weight: 600; font-size: 11.5px; cursor: pointer;
}

.finbot-messages { flex: 1; min-height: 0; overflow-y: auto; padding: 16px 22px; display: flex; flex-direction: column; gap: 10px; }
.finbot-messages::-webkit-scrollbar { width: 5px; }
.finbot-messages::-webkit-scrollbar-thumb { background-color: var(--surface-3); border-radius: 99px; }

.finbot-msg { max-width: 88%; padding: 9px 13px; border-radius: 14px; font-size: 12.5px; line-height: 1.5; color: var(--text-secondary); }
.finbot-msg p + p { margin-top: 6px; }
.finbot-msg ul { margin: 6px 0 2px 16px; }
.finbot-msg li { margin: 3px 0; }
.finbot-msg b { color: var(--text-primary); font-weight: 600; }
.finbot-msg.bot { align-self: flex-start; background-color: var(--surface-2); border: 1px solid var(--border-card); border-bottom-left-radius: 4px; }
.finbot-msg.user { align-self: flex-end; background-color: var(--surface-3); color: var(--text-primary); border-bottom-right-radius: 4px; }
.finbot-msg.user b { color: var(--text-primary); }
.finbot-msg.err { align-self: flex-start; background-color: rgba(222, 70, 69, 0.12); border: 1px solid rgba(222, 70, 69, 0.3); color: #F0A8A7; }

.finbot-typing { display: flex; gap: 4px; padding: 11px 14px; }
.finbot-typing i { width: 6px; height: 6px; border-radius: 50%; background-color: var(--accent-blue); opacity: .35; animation: finbot-blink 1.2s infinite; }
.finbot-typing i:nth-child(2) { animation-delay: .2s; }
.finbot-typing i:nth-child(3) { animation-delay: .4s; }
@keyframes finbot-blink { 0%, 100% { opacity: .25; transform: translateY(0); } 50% { opacity: 1; transform: translateY(-3px); } }

.finbot-chips { display: flex; gap: 6px; padding: 0 22px 12px; overflow-x: auto; flex-shrink: 0; scrollbar-width: none; }
.finbot-chips::-webkit-scrollbar { display: none; }
.finbot-chips button {
  flex-shrink: 0; border: 1px solid var(--border-card); background-color: var(--surface-2);
  color: var(--text-secondary); font-size: 11px; font-weight: 500; padding: 6px 12px;
  border-radius: var(--r-full); cursor: pointer; white-space: nowrap;
  transition: all var(--dur-base) var(--ease);
}
.finbot-chips button:hover { background-color: var(--surface-3); color: var(--text-primary); border-color: var(--border-strong); }

.finbot-upload { padding: 12px 22px; border-top: 1px solid var(--border-subtle); display: flex; flex-direction: column; gap: 8px; flex-shrink: 0; }
.finbot-upload.hidden { display: none; }
.finbot-upfile { display: flex; align-items: center; gap: 10px; background-color: var(--surface-2); border-radius: var(--r-tile); padding: 8px 10px; }
.finbot-upfile span { font-size: 18px; }
.finbot-upmeta { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.finbot-upmeta b { font-size: 12px; color: var(--text-primary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.finbot-upmeta small { font-size: 10px; color: var(--text-tertiary); }
#finbot-up-cancel { border: none; background: none; cursor: pointer; color: var(--text-tertiary); font-size: 12px; width: 24px; height: 24px; border-radius: 8px; }
#finbot-up-cancel:hover { background-color: var(--surface-3); color: var(--danger); }
.finbot-uprow { display: flex; gap: 6px; }
.finbot-uprow input, .finbot-uprow select {
  border: 1px solid var(--border-card); background-color: var(--surface-2); color: var(--text-primary);
  border-radius: var(--r-tile); padding: 8px 10px; font-size: 11.5px; outline: none; font-family: var(--font-sans);
}
.finbot-uprow input { flex: 1; min-width: 0; }
.finbot-uprow input:focus, .finbot-uprow select:focus { border-color: var(--border-strong); }
.finbot-upbtn {
  border: none; border-radius: var(--r-tile); cursor: pointer; padding: 9px 12px;
  background-color: var(--surface-inverse); color: var(--text-on-inverse);
  font-weight: 700; font-size: 11.5px; letter-spacing: .02em;
}
.finbot-upbtn:disabled { opacity: .6; cursor: not-allowed; }

.finbot-composer { display: flex; gap: 8px; align-items: flex-end; padding: 12px 22px 18px; border-top: 1px solid var(--border-subtle); flex-shrink: 0; }
.finbot-composer textarea {
  flex: 1; resize: none; border: 1px solid var(--border-card); background-color: var(--surface-2);
  color: var(--text-primary); border-radius: var(--r-tile); padding: 9px 13px; font-family: var(--font-sans);
  font-size: 12.5px; outline: none; max-height: 90px; transition: border var(--dur-base) var(--ease);
}
.finbot-composer textarea::placeholder { color: var(--text-tertiary); }
.finbot-composer textarea:focus { border-color: var(--border-strong); }
.finbot-attach-btn { width: 36px; height: 36px; flex-shrink: 0; }
.finbot-send-btn {
  width: 36px; height: 36px; border: none; border-radius: var(--r-tile); cursor: pointer;
  background-color: var(--surface-inverse); color: var(--text-on-inverse);
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
  transition: all var(--dur-base) var(--ease);
}
.finbot-send-btn:hover { transform: scale(1.05); }
.finbot-send-btn:disabled { opacity: .5; cursor: not-allowed; transform: none; }

.finbot-chatimg { max-width: 100%; max-height: 180px; border-radius: 10px; display: block; margin: 6px 0; border: 1px solid var(--border-card); cursor: zoom-in; }
.finbot-chatlink {
  display: inline-block; margin: 3px 0; padding: 6px 10px; border-radius: var(--r-tile);
  background-color: var(--surface-1); color: var(--accent-blue-link); font-weight: 600; font-size: 11.5px;
  text-decoration: none; border: 1px solid var(--border-card);
  max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.finbot-chatlink:hover { border-color: var(--border-strong); }
