/* Signed-in shell: fixed sidebar, app bar, and the dashboard panels inside it. */

:root { --sidebar-w: 268px; --appbar-h: 68px; }

.chrome-app { background: #f4f6fa; }

.shell { min-height: 100vh; }
.shell-main {
  margin-left: var(--sidebar-w);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-width: 0;
}
.chrome-app .page { max-width: 1280px; width: 100%; padding: 1.5rem 1.75rem 2.5rem; }

/* ---------------------------------------------------------------------------
   Sidebar
   ------------------------------------------------------------------------ */

.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: var(--sidebar-w);
  background: #fff;
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  padding: 1.1rem 1rem 1rem;
  overflow-y: auto;
  z-index: 40;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: .55rem;
  font-size: 1.12rem;
  font-weight: 700;
  letter-spacing: -.02em;
  color: var(--ink);
  text-decoration: none;
  padding: .25rem .35rem 1rem;
}

.sidebar-user {
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 1rem;
  display: grid;
  justify-items: center;
  gap: .6rem;
  text-align: center;
  background: #fbfcfe;
}
.sidebar-user-meta { min-width: 0; width: 100%; }
.sidebar-user-name {
  font-weight: 650;
  font-size: .95rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sidebar-user-id { font-size: .8rem; color: var(--ink-subtle); font-variant-numeric: tabular-nums; }

.avatar-lg { width: 48px; height: 48px; font-size: 1.05rem; }
.avatar-btn { border: 0; cursor: pointer; font: inherit; font-weight: 700; font-size: .85rem; }

.verify-pill {
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  font-size: .82rem;
  font-weight: 650;
  padding: .35rem .75rem;
  border-radius: 999px;
  background: #fef2f2;
  color: #b91c1c;
  border: 1px solid #fecaca;
  text-decoration: none;
}
.verify-pill:hover { background: #fee2e2; }
.verify-pill.is-done { background: var(--success-soft); color: #047857; border-color: #a7f3d0; }
.verify-pill svg { width: 14px; height: 14px; }

.sidebar-user-actions { display: grid; grid-template-columns: 1fr 1fr; gap: .45rem; width: 100%; }
.sidebar-user-actions .btn { min-height: 34px; padding: .35rem .5rem; font-size: .84rem; }

.sidebar-nav { margin-top: 1.25rem; display: grid; gap: .15rem; }
.sidebar-group {
  font-size: .7rem;
  font-weight: 700;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: #94a3b8;
  padding: 1rem .6rem .35rem;
}
.sidebar-group:first-child { padding-top: 0; }

.sidebar-link {
  display: flex;
  align-items: center;
  gap: .7rem;
  padding: .62rem .7rem;
  border-radius: 10px;
  font-size: .93rem;
  font-weight: 550;
  color: var(--ink-muted);
  text-decoration: none;
  position: relative;
  transition: background-color .18s ease, color .18s ease;
}
.sidebar-link svg { width: 19px; height: 19px; flex: none; }
.sidebar-link:hover { background: #f1f5fb; color: var(--ink); }
.sidebar-link.is-active { background: var(--brand-soft); color: var(--brand); font-weight: 650; }
.sidebar-link.is-active::before {
  content: "";
  position: absolute;
  left: -1rem;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 22px;
  border-radius: 0 3px 3px 0;
  background: var(--brand);
}

.sidebar-foot {
  margin-top: auto;
  padding-top: 1.25rem;
  display: flex;
  align-items: center;
  gap: .45rem;
  font-size: .82rem;
  color: var(--ink-subtle);
}
.sidebar-foot svg { width: 15px; height: 15px; color: #047857; }

.sidebar-scrim {
  position: fixed;
  inset: 0;
  z-index: 35;
  border: 0;
  background: rgba(8, 21, 38, .45);
  cursor: pointer;
}

/* ---------------------------------------------------------------------------
   App bar
   ------------------------------------------------------------------------ */

.appbar {
  position: sticky;
  top: 0;
  z-index: 30;
  min-height: var(--appbar-h);
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: .75rem 1.75rem;
  background: rgba(255, 255, 255, .88);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.appbar-date {
  display: flex;
  align-items: center;
  gap: .5rem;
  font-size: .92rem;
  font-weight: 550;
  color: var(--ink-muted);
}
.appbar-date svg { width: 17px; height: 17px; color: var(--brand); }
.appbar-right { margin-left: auto; display: flex; align-items: center; gap: .7rem; }

.balance-pill {
  display: inline-flex;
  align-items: center;
  gap: .45rem;
  padding: .45rem .85rem;
  border-radius: 999px;
  background: var(--brand-soft);
  color: var(--brand);
  font-size: .88rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.balance-pill svg { width: 16px; height: 16px; }

.icon-btn {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink-muted);
  cursor: pointer;
  transition: background-color .18s ease, color .18s ease, border-color .18s ease;
}
.icon-btn:hover { background: #f1f5fb; color: var(--ink); }
.icon-btn svg { width: 19px; height: 19px; }
.icon-btn-ghost { border-color: rgba(255, 255, 255, .28); background: rgba(255, 255, 255, .14); color: #fff; }
.icon-btn-ghost:hover { background: rgba(255, 255, 255, .24); color: #fff; }

.sidebar-toggle { display: none; }

.user-menu { position: relative; }
.user-dropdown {
  position: absolute;
  right: 0;
  top: calc(100% + .5rem);
  width: 15rem;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: 0 14px 40px rgba(15, 23, 42, .14);
  padding: .9rem;
  display: grid;
  gap: .3rem;
  z-index: 45;
  animation: dropIn .18s ease both;
}
@keyframes dropIn {
  from { opacity: 0; transform: translateY(-6px); }
  to   { opacity: 1; transform: none; }
}
.user-dropdown-name { font-weight: 650; font-size: .94rem; }
.user-dropdown-id { font-size: .8rem; color: var(--ink-subtle); margin-bottom: .5rem; }
.user-dropdown .verify-pill { margin-bottom: .5rem; justify-self: start; }
.user-dropdown a {
  display: flex;
  align-items: center;
  gap: .6rem;
  padding: .55rem .5rem;
  border-radius: 9px;
  font-size: .91rem;
  color: var(--ink-muted);
  text-decoration: none;
}
.user-dropdown a:hover { background: #f1f5fb; color: var(--ink); }
.user-dropdown a svg { width: 17px; height: 17px; }

/* ---------------------------------------------------------------------------
   Panels
   ------------------------------------------------------------------------ */

.panel {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: 1.35rem;
  margin-bottom: 1.25rem;
}
.panel .section-head { margin-bottom: 1rem; }
.panel .account-grid { margin-bottom: 0; }

/* ---------------------------------------------------------------------------
   Stat strip
   ------------------------------------------------------------------------ */

.stat-strip {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 1rem;
  margin-bottom: 1.25rem;
}
.stat-tile {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.15rem 1.25rem;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: #fff;
  box-shadow: var(--shadow-sm);
}
.stat-tile-label { font-size: .85rem; color: var(--ink-subtle); }
.stat-tile-value {
  font-size: 1.45rem;
  font-weight: 700;
  letter-spacing: -.025em;
  margin-top: .25rem;
  font-variant-numeric: tabular-nums;
}
.stat-tile-icon {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 12px;
  flex: none;
}
.stat-tile-icon svg { width: 21px; height: 21px; }

.stat-neutral  .stat-tile-icon { background: #eef2f7; color: var(--ink-muted); }
.stat-positive { background: #f4fcf8; border-color: #cbeedd; }
.stat-positive .stat-tile-icon { background: #dcfce7; color: #047857; }
.stat-negative { background: #fff6f6; border-color: #f7d9d9; }
.stat-negative .stat-tile-icon { background: #fee2e2; color: #b91c1c; }
.stat-info     { background: #f5f8ff; border-color: #d9e4fb; }
.stat-info .stat-tile-icon { background: var(--brand-soft); color: var(--brand); }

/* ---------------------------------------------------------------------------
   Dashboard layout
   ------------------------------------------------------------------------ */

.dash-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 340px);
  gap: 1.25rem;
  align-items: start;
}
.dash-main { min-width: 0; }
.dash-rail { min-width: 0; }

/* ---------------------------------------------------------------------------
   Hero balance panel
   ------------------------------------------------------------------------ */

.hero-panel {
  position: relative;
  overflow: hidden;
  border-radius: var(--radius);
  padding: 1.5rem;
  margin-bottom: 1.25rem;
  color: #fff;
  background: linear-gradient(140deg, #1d4ed8 0%, #1740ad 52%, #102a77 100%);
  box-shadow: 0 14px 34px rgba(16, 42, 119, .28);
}
.hero-panel::after {
  content: "";
  position: absolute;
  right: -4rem;
  top: -5rem;
  width: 18rem;
  height: 18rem;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 255, 255, .16), transparent 66%);
  pointer-events: none;
}
.hero-panel > * { position: relative; z-index: 1; }

.hero-panel-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}
.hero-greeting { display: flex; align-items: center; gap: .85rem; }
.hero-greeting .avatar { background: rgba(255, 255, 255, .2); color: #fff; }
.hero-hello { font-size: .88rem; color: #c5d8fb; }
.hero-name { font-size: 1.2rem; font-weight: 700; letter-spacing: -.02em; }
.hero-time { text-align: right; }
.hero-clock {
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -.02em;
  font-variant-numeric: tabular-nums;
}
.hero-date { font-size: .84rem; color: #c5d8fb; }

.hero-balance {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin: 1.75rem 0 1.5rem;
}
.hero-balance-label { font-size: .9rem; color: #c5d8fb; }
.hero-balance-value {
  font-size: clamp(2rem, 4vw, 2.75rem);
  font-weight: 700;
  letter-spacing: -.035em;
  line-height: 1.1;
  margin-top: .2rem;
  font-variant-numeric: tabular-nums;
}
.hero-balance .trend { margin-top: .6rem; }

#balanceToggle .eye-shut { display: none; }
#balanceToggle.is-hidden .eye-open { display: none; }
#balanceToggle.is-hidden .eye-shut { display: block; }

.hero-account {
  display: flex;
  align-items: center;
  gap: .9rem;
  flex-wrap: wrap;
  padding: 1rem 1.15rem;
  border-radius: 12px;
  background: rgba(255, 255, 255, .13);
  border: 1px solid rgba(255, 255, 255, .18);
}
.hero-account-icon {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 11px;
  background: rgba(255, 255, 255, .18);
  flex: none;
}
.hero-account-icon svg { width: 20px; height: 20px; }
.hero-account-meta { min-width: 0; margin-right: auto; }
.hero-account-label {
  font-size: .82rem;
  color: #c5d8fb;
  display: flex;
  align-items: center;
  gap: .45rem;
  flex-wrap: wrap;
}
.hero-account-number {
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: .04em;
  font-variant-numeric: tabular-nums;
}
.hero-account-actions { display: flex; gap: .45rem; flex-wrap: wrap; }

.dot-badge {
  display: inline-flex;
  align-items: center;
  gap: .3rem;
  font-size: .72rem;
  font-weight: 650;
  padding: .12rem .5rem;
  border-radius: 999px;
  background: rgba(16, 185, 129, .22);
  color: #6ee7b7;
}
.dot-badge::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #34d399;
}

.btn-light { background: rgba(255, 255, 255, .92); color: var(--brand); border-color: transparent; }
.btn-light:hover { background: #fff; }

/* ---------------------------------------------------------------------------
   Action tiles
   ------------------------------------------------------------------------ */

.tile-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(165px, 1fr));
  gap: .85rem;
}
.tile {
  position: relative;
  display: grid;
  gap: .3rem;
  padding: 1.15rem;
  border-radius: 13px;
  border: 1px solid var(--line);
  background: #fff;
  text-decoration: none;
  color: inherit;
  cursor: pointer;
  transition: transform .22s var(--ease-out, ease), box-shadow .22s ease, border-color .18s ease;
}
.tile:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); }
.tile.is-locked { opacity: .58; cursor: not-allowed; }
.tile.is-locked:hover { transform: none; box-shadow: none; }
.tile-icon {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 12px;
  margin-bottom: .55rem;
}
.tile-icon svg { width: 20px; height: 20px; }
.tile-title { font-weight: 650; font-size: .95rem; }
.tile-sub { font-size: .82rem; color: var(--ink-subtle); line-height: 1.4; }
.tile-lock { position: absolute; top: 1rem; right: 1rem; width: 15px; height: 15px; color: var(--ink-subtle); }

.tile-blue   .tile-icon { background: var(--brand-soft); color: var(--brand); }
.tile-green  .tile-icon { background: #dcfce7; color: #047857; }
.tile-amber  .tile-icon { background: #fef3c7; color: #b45309; }
.tile-violet .tile-icon { background: #ede9fe; color: #6d28d9; }

/* ---------------------------------------------------------------------------
   Stat rows (rail)
   ------------------------------------------------------------------------ */

.stat-rows { list-style: none; margin: 0; padding: 0; display: grid; gap: .3rem; }
.stat-row {
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: .6rem 0;
  border-bottom: 1px solid var(--line);
}
.stat-row:last-child { border-bottom: 0; }
.stat-row-icon {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 10px;
  flex: none;
}
.stat-row-icon svg { width: 18px; height: 18px; }
.row-blue   { background: var(--brand-soft); color: var(--brand); }
.row-amber  { background: #fef3c7; color: #b45309; }
.row-violet { background: #ede9fe; color: #6d28d9; }
.row-green  { background: #dcfce7; color: #047857; }
.stat-row-label { font-size: .88rem; color: var(--ink-muted); margin-right: auto; }
.stat-row-value { font-weight: 650; font-size: .92rem; font-variant-numeric: tabular-nums; }

.quick-form .field { margin-bottom: .85rem; }

/* ---------------------------------------------------------------------------
   App footer
   ------------------------------------------------------------------------ */

.app-footer {
  margin-top: auto;
  padding: 1.25rem 1.75rem;
  border-top: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  font-size: .84rem;
  color: var(--ink-subtle);
}
.app-footer-brand { display: inline-flex; align-items: center; gap: .45rem; font-weight: 650; color: var(--ink-muted); }

/* ---------------------------------------------------------------------------
   Responsive
   ------------------------------------------------------------------------ */

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

@media (max-width: 1024px) {
  .shell-main { margin-left: 0; }
  .sidebar {
    transform: translateX(-100%);
    transition: transform .28s var(--ease-out, ease);
    box-shadow: 0 0 40px rgba(8, 21, 38, .2);
  }
  .sidebar.is-open { transform: none; }
  .sidebar-toggle { display: grid; }
  body.sidebar-open { overflow: hidden; }
}

@media (min-width: 1025px) {
  .sidebar-scrim { display: none !important; }
}

@media (max-width: 640px) {
  .chrome-app .page { padding: 1rem 1rem 2rem; }
  .appbar { padding: .65rem 1rem; gap: .6rem; }
  .appbar-date { font-size: .8rem; }
  .appbar-date svg { display: none; }
  .balance-pill { font-size: .8rem; padding: .35rem .6rem; }
  .panel { padding: 1.1rem; }
  .hero-panel { padding: 1.25rem; }
  .hero-panel-top { flex-direction: column; }
  .hero-time { text-align: left; }
  .hero-balance { margin: 1.25rem 0 1.1rem; }
  .hero-account { flex-direction: column; align-items: stretch; }
  .hero-account-actions .btn { flex: 1; }
  .tile-grid { grid-template-columns: 1fr 1fr; }
  .stat-strip { grid-template-columns: 1fr 1fr; gap: .7rem; }
  .stat-tile { padding: .9rem; flex-direction: column; align-items: flex-start; gap: .6rem; }
  .stat-tile-value { font-size: 1.15rem; }
  .app-footer { padding: 1rem; flex-direction: column; align-items: flex-start; }
}

@media (max-width: 380px) {
  .tile-grid, .stat-strip { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  .sidebar { transition: none; }
  .tile:hover { transform: none; }
  .user-dropdown { animation: none; }
}
