/* ── Spendly V2 — base stylesheet ─────────────────────────────────────────── */

@font-face {
  font-family: 'Outfit';
  font-weight: 300;
  font-style: normal;
  font-display: swap;
  src: url('../fonts/Outfit-Light.woff2') format('woff2');
}
@font-face {
  font-family: 'Outfit';
  font-weight: 400;
  font-style: normal;
  font-display: swap;
  src: url('../fonts/Outfit-Regular.woff2') format('woff2');
}
@font-face {
  font-family: 'Outfit';
  font-weight: 500;
  font-style: normal;
  font-display: swap;
  src: url('../fonts/Outfit-Medium.woff2') format('woff2');
}
@font-face {
  font-family: 'Outfit';
  font-weight: 600;
  font-style: normal;
  font-display: swap;
  src: url('../fonts/Outfit-SemiBold.woff2') format('woff2');
}

@font-face {
  font-family: 'tabler-icons';
  font-style: normal;
  font-weight: 400;
  font-display: block;
  src: url('../fonts/tabler-icons.woff2') format('woff2');
}

/* ── tokens ─────────────────────────────────────────────────────────────── */
:root {
  --bg:        #0F0F12;
  --s1:        #1C1C1F;
  --s2:        #252528;
  --s3:        #2C2C30;
  --border:    #2E2E32;
  --border2:   #3A3A3E;
  --txt:       #F5F5F7;
  --txt2:      #98989D;
  --txt3:      #58585C;
  --blue:      #4D96FF;
  --blue-bg:   #4D96FF14;
  --green:     #30D158;
  --red:       #FF453A;
  --orange:    #FF9F0A;
  --purple:    #BF5AF2;
  --amber:     #FF9F0A;
  --font:      'Outfit', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --r:         13px;
  --r-sm:      9px;
  --sidebar-w: 210px;
  --topbar-h:  48px;
}

/* ── reset ───────────────────────────────────────────────────────────────── */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

html, body {
  height: 100%;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--txt);
  display: flex;
  font-size: 14px;
}

/* hide scrollbars globally — scroll still works, bar hidden */
* {
  scrollbar-width: none;       /* Firefox */
  -ms-overflow-style: none;    /* IE/Edge */
}
*::-webkit-scrollbar {
  display: none;               /* Chrome/Safari/Opera */
}

a { color: inherit; text-decoration: none; }
button { cursor: pointer; font-family: var(--font); }
input, select, textarea { font-family: var(--font); }

/* ── sidebar ─────────────────────────────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-w);
  background: var(--s1);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: 18px 0;
  flex-shrink: 0;
  height: 100vh;
  position: sticky;
  top: 0;
  overflow: hidden;
}
.sidebar-brand {
  padding: 0 18px 18px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 10px;
  flex-shrink: 0;
}
.sidebar-brand-name {
  font-size: 18px;
  font-weight: 600;
  color: var(--txt);
  letter-spacing: -0.5px;
}
.sidebar-brand-sub {
  font-size: 11px;
  color: var(--txt3);
  margin-top: 2px;
  font-weight: 300;
  letter-spacing: 0.2px;
}
.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 18px;
  color: var(--txt2);
  font-size: 13px;
  font-weight: 400;
  transition: background 0.1s, color 0.1s;
  border-left: 2px solid transparent;
  flex-shrink: 0;
}
.nav-item:hover { background: var(--s2); color: var(--txt); }
.nav-item.active {
  color: var(--blue);
  font-weight: 500;
  background: var(--blue-bg);
  border-left-color: var(--blue);
}
.nav-item i { font-size: 15px; width: 17px; text-align: center; flex-shrink: 0; }
.sidebar-foot {
  margin-top: auto;
  padding: 14px 18px;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}
.avatar-chip { display: flex; align-items: center; gap: 9px; }
.avatar {
  width: 27px; height: 27px; border-radius: 50%;
  background: var(--blue-bg); border: 1px solid var(--blue);
  display: flex; align-items: center; justify-content: center;
  font-size: 10px; font-weight: 600; color: var(--blue); flex-shrink: 0;
}
.avatar-name  { font-size: 12px; font-weight: 500; color: var(--txt); }
.avatar-role  { font-size: 10px; color: var(--txt3); }

/* ── main layout ─────────────────────────────────────────────────────────── */
.main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow: hidden; /* content area scrolls, not main */
}

.topbar {
  height: var(--topbar-h);
  padding: 0 22px;
  background: rgba(15,15,18,0.85);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
  z-index: 10;
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}
.topbar-title { font-size: 15px; font-weight: 600; color: var(--txt); }
.topbar-meta {
  font-size: 11px; color: var(--txt2);
  background: var(--s2); border: 1px solid var(--border2);
  padding: 4px 11px; border-radius: 20px; font-weight: 400;
}

/* default content: scrollable */
.content {
  padding: 18px 22px;
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
}

/* chat page overrides .content to be non-scrolling (chat-wrap handles it) */
.content-fixed {
  padding: 0;
  flex: 1;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

/* ── cards ───────────────────────────────────────────────────────────────── */
.card {
  background: var(--s1);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 15px;
}

/* ── utility ─────────────────────────────────────────────────────────────── */
.txt-green  { color: var(--green); }
.txt-red    { color: var(--red); }
.txt-blue   { color: var(--blue); }
.txt-muted  { color: var(--txt3); }
.txt-2      { color: var(--txt2); }
.section-label {
  font-size: 10px; font-weight: 500;
  color: var(--txt3); text-transform: uppercase;
  letter-spacing: 0.6px; margin-bottom: 12px;
}
.divider { height: 1px; background: var(--border); margin: 0 0 20px; }
.badge {
  display: inline-flex; align-items: center;
  font-size: 10px; font-weight: 500;
  padding: 2px 7px; border-radius: 20px;
}
.badge-surplus  { background: #30D15820; color: var(--green); }
.badge-deficit  { background: #FF453A18; color: var(--red); }

/* ── seg control ─────────────────────────────────────────────────────────── */
.seg {
  display: flex; background: var(--bg);
  border: 1px solid var(--border); border-radius: var(--r-sm);
  padding: 2px; gap: 2px;
}
.seg-btn {
  font-size: 11px; padding: 4px 9px; border-radius: 7px;
  border: none; background: transparent; color: var(--txt2);
  font-weight: 400; transition: all 0.12s;
}
.seg-btn.active { background: var(--s2); color: var(--txt); font-weight: 500; }

/* ── tab control ─────────────────────────────────────────────────────────── */
.tab-bar {
  display: flex; background: var(--bg);
  border: 1px solid var(--border); border-radius: var(--r-sm);
  padding: 2px; gap: 2px; margin-bottom: 12px;
}
.tab-btn {
  flex: 1; padding: 6px; text-align: center;
  font-size: 11px; font-weight: 400; color: var(--txt2);
  border: none; background: transparent; border-radius: 7px;
  transition: all 0.12s;
}
.tab-btn.active     { font-weight: 500; color: var(--txt); background: var(--s2); }
.tab-btn.active-exp { background: var(--red);   color: #fff; font-weight: 500; }
.tab-btn.active-inc { background: var(--green);  color: #fff; font-weight: 500; }

/* ── responsive: icon-only sidebar at ≤860px ────────────────────────────── */
@media (max-width: 860px) {
  :root { --sidebar-w: 52px; }
  .sidebar-brand, .nav-label, .avatar-name, .avatar-role { display: none; }
  .nav-item { padding: 10px; justify-content: center; border-left: none; }
  .nav-item.active { border-left: none; border-bottom: 2px solid var(--blue); }
  .sidebar-foot { padding: 10px; display: flex; justify-content: center; }
  .content { padding: 14px 16px; }
  .topbar { padding: 0 16px; }
}

/* ── responsive: bottom tab bar at ≤520px ───────────────────────────────── */
@media (max-width: 520px) {
  html, body { overflow: hidden; }
  body { flex-direction: column; }

  .sidebar {
    width: 100%;
    height: 52px;
    flex-direction: row;
    padding: 0;
    border-right: none;
    border-top: 1px solid var(--border);
    overflow-x: auto;
    position: fixed;
    bottom: 0;
    top: auto;
    z-index: 100;
  }
  .sidebar-brand, .sidebar-foot { display: none; }
  .nav-item {
    padding: 8px 14px;
    flex-direction: column;
    gap: 2px;
    min-width: 60px;
    border-left: none;
    border-bottom: none;
  }
  .nav-label { display: block; font-size: 9px; }
  .nav-item.active { border-bottom: 2px solid var(--blue); background: var(--blue-bg); }

  .main {
    height: calc(100vh - 52px);
    padding-bottom: 0;
  }
  .content { padding: 14px 14px; }
  .topbar { padding: 0 14px; }
}
