/* ========================================================================== 
   Typography
   ========================================================================== */

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

/* ========================================================================== 
   Root / Variables
   ========================================================================== */

:root {
  --bg: #07111f;
  --bg-soft: #0a1627;
  --sidebar: #06101d;
  --panel: #0e1c30;
  --panel-soft: #13243b;
  --panel-hover: #172b47;
  --text: #edf5ff;
  --muted: #8fa5bf;
  --line: #213854;
  --primary: #2f7df6;
  --primary-soft: rgba(47, 125, 246, 0.14);
  --success: #2fd07f;
  --success-soft: rgba(47, 208, 127, 0.13);
  --danger: #ff5d6c;
  --danger-soft: rgba(255, 93, 108, 0.13);
  --warning: #f6b84b;
  --shadow: 0 20px 55px rgba(0, 0, 0, 0.25);
  --radius-xl: 22px;
  --radius-lg: 17px;
  --radius-md: 12px;
  --sidebar-width: 272px;
}

/* ========================================================================== 
   Reset
   ========================================================================== */

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

/* ========================================================================== 
   Body
   ========================================================================== */

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  font-family: "Inter", Arial, sans-serif;
  background:
    radial-gradient(
      circle at 85% 0%,
      rgba(47, 125, 246, 0.11),
      transparent 28%
    ),
    linear-gradient(145deg, #050b14 0%, #081523 45%, #0a1930 100%);
}
body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.012) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.012) 1px, transparent 1px);
  background-size: 32px 32px;
}
a {
  color: inherit;
}
button,
input,
select,
textarea {
  font: inherit;
}
button {
  cursor: pointer;
}

/* ========================================================================== 
   Layout / Container
   ========================================================================== */

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

/* ========================================================================== 
   Sidebar
   ========================================================================== */

.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: var(--sidebar-width);
  z-index: 30;
  display: flex;
  flex-direction: column;
  padding: 22px 16px;
  background: rgba(6, 16, 29, 0.97);
  border-right: 1px solid rgba(115, 148, 183, 0.16);
  box-shadow: 18px 0 40px rgba(0, 0, 0, 0.16);
  backdrop-filter: blur(18px);
  transition: transform 0.25s ease;
}
.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 6px 8px 22px;
  font-size: 21px;
  font-weight: 800;
  letter-spacing: -0.4px;
}
.brand-mark {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 14px;
  color: white;
  background: linear-gradient(145deg, #3b8cff, #245fd5);
  box-shadow: 0 10px 26px rgba(47, 125, 246, 0.32);
}
.brand-mark svg {
  width: 22px;
  height: 22px;
}
.brand small {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 1.2px;
  text-transform: uppercase;
}
.env {
  margin-bottom: 18px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 15px;
  background: linear-gradient(
    145deg,
    rgba(19, 36, 59, 0.9),
    rgba(12, 28, 48, 0.92)
  );
}
.env small,
.env b,
.env a {
  display: block;
}
.env small {
  font-size: 11px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.7px;
}
.env b {
  margin: 6px 0 8px;
  font-size: 14px;
}
.env a {
  font-size: 12px;
  font-weight: 700;
  color: #81b0ff;
  text-decoration: none;
}
.menu-label {
  margin: 14px 10px 7px;
  color: #627b98;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 1.2px;
  text-transform: uppercase;
}
.sidebar nav {
  display: grid;
  gap: 5px;
}
.sidebar nav a {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 44px;
  padding: 10px 12px;
  border-radius: 12px;
  color: #bdcce0;
  text-decoration: none;
  font-size: 14px;
  font-weight: 600;
  transition: 0.2s ease;
}
.sidebar nav a svg {
  width: 19px;
  height: 19px;
  stroke-width: 2;
}
.sidebar nav a:hover {
  color: #fff;
  background: var(--panel-hover);
  transform: translateX(3px);
}
.sidebar nav a.active {
  color: #fff;
  background: linear-gradient(
    90deg,
    rgba(47, 125, 246, 0.25),
    rgba(47, 125, 246, 0.1)
  );
  box-shadow: inset 3px 0 0 var(--primary);
}
.sidebar-spacer {
  flex: 1;
}

/* ========================================================================== 
   Footer
   ========================================================================== */

.sidebar-footer {
  margin-top: 20px;
  padding-top: 14px;
  border-top: 1px solid rgba(113, 145, 178, 0.14);
}
.logout-link {
  color: #ff9da7 !important;
}

/* ========================================================================== 
   Main Container
   ========================================================================== */

.main {
  width: calc(100% - var(--sidebar-width));
  margin-left: var(--sidebar-width);
  padding: 28px 32px 38px;
  position: relative;
  z-index: 1;
}

/* ========================================================================== 
   Header
   ========================================================================== */

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 26px;
}
.topbar-left {
  display: flex;
  align-items: center;
  gap: 13px;
}
.topbar h1 {
  margin: 0;
  font-size: 27px;
  line-height: 1.18;
  letter-spacing: -0.65px;
}
.topbar p {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 13px;
}
.menu-toggle {
  display: none;
  width: 42px;
  height: 42px;
  place-items: center;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 12px;
  color: #fff;
  background: var(--panel);
}
.menu-toggle svg {
  width: 21px;
}
.user-chip {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 11px 8px 8px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(14, 28, 48, 0.85);
}
.user-avatar {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 11px;
  color: white;
  background: linear-gradient(145deg, var(--primary), #2858bb);
  font-weight: 800;
}
.user-chip b {
  display: block;
  font-size: 13px;
}
.user-chip small {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-size: 10px;
}

/* ========================================================================== 
   Dashboard
   ========================================================================== */

.page-intro {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 20px;
  margin-bottom: 18px;
}
.page-intro h2 {
  margin: 0;
  font-size: 18px;
}
.page-intro p {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 18px;
}
.stats.three {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin-top: 20px;
}
.stat,
.panel {
  position: relative;
  overflow: hidden;
  border: 1px solid rgba(100, 136, 174, 0.2);
  border-radius: var(--radius-lg);
  background: linear-gradient(
    145deg,
    rgba(17, 35, 59, 0.96),
    rgba(10, 24, 42, 0.96)
  );
  box-shadow: var(--shadow);
}
.stat {
  min-height: 152px;
  padding: 20px;
  transition:
    transform 0.22s ease,
    border-color 0.22s ease;
}
.stat:hover {
  transform: translateY(-3px);
  border-color: rgba(84, 145, 241, 0.42);
}
.stat::after {
  content: "";
  position: absolute;
  right: -24px;
  bottom: -35px;
  width: 105px;
  height: 105px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.025);
}
.stat-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.stat-icon {
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  border-radius: 13px;
  color: #8cb7ff;
  background: var(--primary-soft);
}
.stat-icon svg {
  width: 20px;
  height: 20px;
}
.stat.in .stat-icon {
  color: var(--success);
  background: var(--success-soft);
}
.stat.out .stat-icon {
  color: var(--danger);
  background: var(--danger-soft);
}
.stat span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
}
.stat strong {
  display: block;
  margin: 18px 0 8px;
  font-size: 25px;
  line-height: 1;
  letter-spacing: -0.7px;
}
.stat small {
  color: #7088a4;
  font-size: 11px;
}
.stat.in {
  border-left: 3px solid var(--success);
}
.stat.out {
  border-left: 3px solid var(--danger);
}
.stat.positive {
  border-left: 3px solid var(--primary);
}

/* ========================================================================== 
   Buttons
   ========================================================================== */

.actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 18px;
}
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 42px;
  padding: 10px 15px;
  border: 1px solid transparent;
  border-radius: 12px;
  text-decoration: none;
  font-size: 13px;
  font-weight: 750;
  transition: 0.2s ease;
}
.btn svg {
  width: 17px;
  height: 17px;
}
.btn:hover {
  transform: translateY(-2px);
  filter: brightness(1.06);
}
.primary {
  color: #fff;
  background: linear-gradient(145deg, #3b88ff, #2c69d9);
  box-shadow: 0 10px 24px rgba(47, 125, 246, 0.24);
}
.success {
  color: #042719;
  background: linear-gradient(145deg, #42db91, #2cbf76);
}
.danger {
  color: white;
  background: linear-gradient(145deg, #ff6978, #e94c5d);
}
.ghost {
  color: #cfe0f5;
  background: #162944;
  border-color: var(--line);
}
.btn-outline {
  color: #cfe0f5;
  background: transparent;
  border-color: var(--line);
}

/* ========================================================================== 
   Cards / Panels
   ========================================================================== */

.grid {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, 0.95fr);
  gap: 18px;
}
.panel {
  padding: 20px;
}
.panel h2 {
  margin: 0;
  font-size: 16px;
}
.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 18px;
}
.panel-subtitle {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 12px;
}
.panel-link {
  color: #83b0ff;
  font-size: 12px;
  font-weight: 700;
  text-decoration: none;
}
.chart-wrap {
  position: relative;
  min-height: 295px;
  display: grid;
  place-items: center;
}
.chart-wrap canvas {
  max-height: 280px;
}

/* ========================================================================== 
   Transactions
   ========================================================================== */

.tx {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 13px 0;
  border-bottom: 1px solid rgba(101, 134, 169, 0.15);
}
.tx:last-child {
  border-bottom: 0;
}
.tx-left {
  display: flex;
  align-items: center;
  gap: 11px;
  min-width: 0;
}
.tx-icon {
  flex: 0 0 auto;
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border-radius: 12px;
  color: #9ac0ff;
  background: rgba(47, 125, 246, 0.12);
}
.tx-icon.income {
  color: var(--success);
  background: var(--success-soft);
}
.tx-icon.expense {
  color: var(--danger);
  background: var(--danger-soft);
}
.tx-icon svg {
  width: 18px;
  height: 18px;
}
.tx b {
  display: block;
  max-width: 250px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 13px;
}
.tx small {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 11px;
}
.tx-value {
  flex: 0 0 auto;
  text-align: right;
  font-size: 13px;
}

/* ========================================================================== 
   Utilities
   ========================================================================== */

.green {
  color: var(--success);
}
.red {
  color: var(--danger);
}

/* ========================================================================== 
   Dashboard Insights
   ========================================================================== */

.insights {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 18px;
}
.insight {
  padding: 14px;
  border: 1px solid rgba(100, 136, 174, 0.18);
  border-radius: 14px;
  background: rgba(14, 28, 48, 0.82);
}
.insight span {
  display: block;
  color: var(--muted);
  font-size: 11px;
}
.insight strong {
  display: block;
  margin-top: 8px;
  font-size: 16px;
}

/* ========================================================================== 
   Alerts
   ========================================================================== */

.alert {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 90;
  min-width: 280px;
  max-width: 420px;
  padding: 14px 16px;
  border-radius: 13px;
  box-shadow: 0 18px 45px rgba(0, 0, 0, 0.35);
  animation: toastIn 0.35s ease both;
}
.alert.success {
  color: #bdfad8;
  background: #123b2b;
  border: 1px solid rgba(47, 208, 127, 0.45);
}
.alert.error {
  color: #ffd0d5;
  background: #4a1d29;
  border: 1px solid rgba(255, 93, 108, 0.45);
}

/* ========================================================================== 
   Inputs / Forms
   ========================================================================== */

.form {
  display: grid;
  gap: 14px;
}
.form label,
.filter label {
  display: grid;
  gap: 7px;
  color: #cbd8e9;
  font-size: 13px;
}
.form input,
.form select,
.form textarea,
.filter input,
.filter select {
  width: 100%;
  min-height: 44px;
  padding: 11px 12px;
  color: #fff;
  border: 1px solid var(--line);
  border-radius: 11px;
  outline: none;
  background: #09182a;
  transition:
    border-color 0.2s ease,
    box-shadow 0.2s ease;
}
.form input:focus,
.form select:focus,
.form textarea:focus,
.filter input:focus,
.filter select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(47, 125, 246, 0.12);
}
.form textarea {
  min-height: 100px;
  resize: vertical;
}

/* ========================================================================== 
   Tables
   ========================================================================== */

.phead {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 18px;
}
.table {
  overflow: auto;
  border-radius: 13px;
}
table {
  width: 100%;
  border-collapse: collapse;
}
th,
td {
  padding: 13px;
  text-align: left;
  border-bottom: 1px solid rgba(100, 136, 174, 0.15);
  white-space: nowrap;
  font-size: 13px;
}
th {
  color: var(--muted);
  background: rgba(7, 17, 31, 0.45);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
tbody tr {
  transition: background 0.18s ease;
}
tbody tr:hover {
  background: rgba(47, 125, 246, 0.05);
}
.delete {
  color: #ff8792;
}
.empty {
  display: grid;
  place-items: center;
  min-height: 150px;
  padding: 25px;
  color: var(--muted);
  text-align: center;
}

/* ========================================================================== 
   Reports
   ========================================================================== */

.filter {
  display: flex;
  align-items: end;
  gap: 12px;
  flex-wrap: wrap;
}
.filter label {
  min-width: 170px;
}

/* ========================================================================== 
   Login / Authentication
   ========================================================================== */

.auth {
  display: grid;
  place-items: center;
  padding: 25px;
}
.card {
  width: min(430px, 100%);
  padding: 30px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: #0a182a;
  box-shadow: var(--shadow);
}

/* ========================================================================== 
   Helpers
   ========================================================================== */

.install {
  width: min(620px, 100%);
}
.big {
  font-size: 45px;
}
.envpage {
  width: min(900px, 100%);
  text-align: center;
}
.envgrid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin: 30px 0;
}
.envcard {
  padding: 30px;
  text-align: left;
  text-decoration: none;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--panel);
  transition: 0.2s ease;
}
.envcard:hover {
  transform: translateY(-3px);
  border-color: #3b82f6;
}
.envcard span {
  color: #7fb0ff;
}

/* ========================================================================== 
   Mobile Navigation Helper
   ========================================================================== */

.mobile-overlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 20;
  background: rgba(0, 0, 0, 0.58);
  backdrop-filter: blur(3px);
}

/* ========================================================================== 
   Responsiveness
   ========================================================================== */

@media (max-width: 1100px) {
  .stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .insights {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
@media (max-width: 900px) {
  .sidebar {
    transform: translateX(-105%);
  }
  .main {
    width: 100%;
    margin-left: 0;
    padding: 18px;
  }
  .menu-toggle {
    display: grid;
  }
  body.open .sidebar {
    transform: translateX(0);
  }
  body.open .mobile-overlay {
    display: block;
  }
  .grid {
    grid-template-columns: 1fr;
  }
  .user-chip .user-meta {
    display: none;
  }
  .topbar {
    align-items: flex-start;
  }
  .envgrid {
    grid-template-columns: 1fr;
  }
}
@media (max-width: 600px) {
  .stats,
  .stats.three,
  .insights {
    grid-template-columns: 1fr;
  }
  .topbar h1 {
    font-size: 22px;
  }
  .main {
    padding: 15px;
  }
  .panel,
  .stat {
    padding: 16px;
  }
  .phead,
  .panel-header,
  .page-intro {
    align-items: flex-start;
    flex-direction: column;
  }
  .actions .btn {
    flex: 1;
  }
  .tx b {
    max-width: 155px;
  }
  .alert {
    left: 14px;
    right: 14px;
    top: 14px;
    min-width: 0;
  }
}

/* ========================================================================== 
   Animations
   ========================================================================== */

@keyframes toastIn {
  from {
    opacity: 0;
    transform: translateY(-12px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}
