:root {
  --bg: #f5f7fb;
  --surface: #ffffff;
  --ink: #17202a;
  --muted: #667085;
  --line: #d9e0ea;
  --primary: #2166d1;
  --primary-dark: #174a99;
  --danger: #d94f45;
  --success: #1f9d62;
  --warning: #c78a13;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: Arial, Helvetica, sans-serif;
  color: var(--ink);
  background: var(--bg);
}

a {
  color: var(--primary);
  text-decoration: none;
}

.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: 240px;
  padding: 22px 14px;
  background: linear-gradient(180deg, #101828 0%, #182033 100%);
  color: #fff;
  display: flex;
  flex-direction: column;
  gap: 7px;
  box-shadow: 8px 0 26px rgba(16, 24, 40, 0.14);
}

.sidebar-toggle {
  position: fixed;
  z-index: 20;
  top: 16px;
  left: 256px;
  width: 44px;
  height: 44px;
  border: 1px solid rgba(33, 102, 209, 0.18);
  border-radius: 12px;
  background: var(--surface);
  color: var(--primary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 10px 24px rgba(16, 24, 40, 0.12);
  cursor: pointer;
}

.sidebar-toggle:hover {
  color: var(--primary-dark);
  border-color: rgba(33, 102, 209, 0.34);
  transform: translateY(-1px);
}

.sidebar-toggle svg {
  width: 21px;
  height: 21px;
}

.sidebar,
.content,
.sidebar-toggle {
  transition: all 180ms ease;
}

.sidebar-collapsed .sidebar {
  transform: translateX(-100%);
}

.sidebar-collapsed .content {
  margin-left: 0;
}

.auth-page .content {
  margin-left: 0;
}

.sidebar-collapsed .sidebar-toggle {
  left: 16px;
}

.sidebar a,
.link-button {
  display: flex;
  align-items: center;
  gap: 11px;
  width: 100%;
  min-height: 42px;
  padding: 10px 12px;
  border-radius: 8px;
  color: #d7deea;
  background: transparent;
  border: 0;
  text-align: left;
  font: inherit;
  cursor: pointer;
}

.sidebar a:hover,
.link-button:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
}

.sidebar a svg,
.link-button svg {
  flex: 0 0 auto;
  width: 18px;
  height: 18px;
  color: #8fb4ff;
}

.brand {
  display: flex !important;
  align-items: center;
  gap: 10px;
  font-size: 24px;
  font-weight: 800;
  color: #fff !important;
  margin-bottom: 14px;
  padding: 8px 10px !important;
}

.brand:hover {
  background: transparent !important;
}

.brand-mark,
.profile-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
}

.brand-mark {
  width: 36px;
  height: 36px;
  background: #2166d1;
  color: #fff;
}

.brand-mark svg {
  width: 20px;
  height: 20px;
}

.profile {
  position: relative;
  padding: 12px;
  border: 1px solid #344054;
  border-radius: 8px;
  margin-bottom: 14px;
  background: rgba(255, 255, 255, 0.04);
  padding-left: 52px;
}

.profile-icon {
  position: absolute;
  left: 12px;
  top: 13px;
  width: 30px;
  height: 30px;
  background: rgba(143, 180, 255, 0.15);
  color: #b7ccff;
}

.profile-icon svg {
  width: 17px;
  height: 17px;
}

.profile span {
  display: block;
  color: #98a2b3;
  margin-top: 4px;
}

.content {
  margin-left: 240px;
  padding: 32px;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

h1,
h2 {
  margin: 0 0 16px;
}

h1 {
  font-size: 30px;
}

h2 {
  font-size: 20px;
}

.page-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin-bottom: 24px;
}

.section-title {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
}

.panel,
.auth-box,
.chart-panel,
.table-wrap,
.stat {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.panel,
.auth-box {
  max-width: 640px;
  padding: 24px;
  margin-bottom: 24px;
}

.panel.wide {
  max-width: 980px;
}

.auth-box {
  margin: 8vh auto;
}

.chart-panel {
  height: 360px;
  padding: 18px;
  margin-bottom: 24px;
}

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

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

.stat {
  padding: 18px;
}

.stat span,
.stat small,
.muted {
  color: var(--muted);
}

.stat strong {
  display: block;
  font-size: 26px;
  margin-top: 8px;
}

.two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  margin-bottom: 28px;
}

.list {
  display: grid;
  gap: 10px;
}

.dashboard-scroll-list {
  max-height: 270px;
  overflow-y: auto;
  padding-right: 4px;
}

.row-link {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 14px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
}

.row-link small {
  display: inline-block;
  color: var(--muted);
  margin-left: 6px;
}

.bill-alert-panel {
  padding: 18px;
  margin-bottom: 24px;
  border: 1px solid #f3b7ac;
  border-radius: 8px;
  background: #fff7f5;
}

.bill-alert-row {
  align-items: flex-start;
  background: #fff;
}

.bill-alert-row small {
  display: block;
  margin: 4px 0 0;
}

.form {
  display: grid;
  gap: 16px;
}

.grid-form {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

label {
  display: grid;
  gap: 7px;
  font-weight: 700;
}

.check-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.check-row input {
  width: auto;
}

input,
select,
textarea {
  width: 100%;
  padding: 11px 12px;
  border: 1px solid #c8d1df;
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  font: inherit;
}

textarea {
  resize: vertical;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 40px;
  padding: 9px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

.button.primary {
  color: #fff;
  border-color: var(--primary);
  background: var(--primary);
}

.button.primary:hover {
  background: var(--primary-dark);
}

.button.danger {
  color: #fff;
  border-color: var(--danger);
  background: var(--danger);
}

.button.small {
  min-height: 34px;
  padding: 6px 10px;
}

.table-wrap {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
}

th,
td {
  padding: 13px 14px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

th {
  background: #eef3f9;
  color: #344054;
}

.actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 4px 9px;
  border-radius: 999px;
  background: #edf2f7;
  color: #344054;
  font-size: 13px;
  font-weight: 700;
}

.badge.aktif,
.badge.income {
  background: #e8f7ef;
  color: var(--success);
}

.badge.nonaktif,
.badge.expense {
  background: #fdeceb;
  color: var(--danger);
}

.alert {
  margin-bottom: 18px;
  padding: 12px 14px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: #fff;
}

.alert.success {
  border-color: #a8dec1;
  background: #ecfdf3;
}

.alert.error {
  border-color: #f0b1ad;
  background: #fff1f0;
}

.inline-filter {
  min-width: 180px;
}

.transaction-filter {
  display: flex;
  gap: 8px;
  min-width: 360px;
}

.investment-fields {
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
}

.shopping-fields {
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
}

.hidden {
  display: none !important;
}

@media print {
  .sidebar,
  .sidebar-toggle,
  .print-hide,
  .actions form,
  .actions a,
  .actions button,
  .page-watermark {
    display: none !important;
  }

  body {
    background: #fff;
  }

  .content {
    margin-left: 0;
    padding: 0;
    display: block;
  }

  .page-head {
    margin-bottom: 16px;
  }

  .table-wrap {
    border: 0;
    overflow: visible;
  }
}

.page-watermark {
  margin-top: auto;
  padding-top: 32px;
  color: var(--muted);
  font-size: 13px;
  text-align: center;
}

@media (max-width: 860px) {
  .sidebar {
    z-index: 15;
    transform: translateX(-100%);
  }

  body:not(.sidebar-collapsed) .sidebar {
    transform: translateX(0);
  }

  .sidebar-toggle,
  .sidebar-collapsed .sidebar-toggle {
    left: 16px;
  }

  .content {
    margin-left: 0;
    padding: 72px 20px 20px;
  }

  .page-head,
  .actions {
    align-items: stretch;
    flex-direction: column;
  }

  .stats-grid,
  .stats-grid.two-stats,
  .two-col,
  .grid-form {
    grid-template-columns: 1fr;
  }
}
