:root {
  --background: #f9f9f9;
  --surface: #ffffff;
  --surface-low: #f3f3f4;
  --surface-mid: #eeeeee;
  --surface-high: #e2e2e2;
  --text: #111111;
  --muted: #626262;
  --border: #cfc4c5;
  --primary: #000000;
  --danger: #d21f2b;
  --radius: 8px;
  --sidebar: 256px;
}

* {
  box-sizing: border-box;
}

html {
  background: var(--background);
  color: var(--text);
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  letter-spacing: 0;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--background);
}

a {
  color: inherit;
  text-decoration: none;
}

button,
input,
select {
  font: inherit;
}

.material-symbols-outlined {
  font-variation-settings: "FILL" 0, "wght" 450, "GRAD" 0, "opsz" 24;
  font-size: 22px;
  line-height: 1;
}

.app {
  min-height: 100vh;
}

.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 30;
  width: var(--sidebar);
  border-right: 1px solid var(--border);
  background: var(--surface);
  display: flex;
  flex-direction: column;
  padding: 28px 24px;
}

.brand {
  margin-bottom: 52px;
}

.brand-title {
  margin: 0;
  font-size: 28px;
  line-height: 32px;
  font-weight: 850;
  color: var(--primary);
}

.brand-subtitle {
  margin: 7px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 16px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.nav {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 8px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 38px;
  padding: 8px 10px;
  border-radius: var(--radius);
  color: var(--muted);
  font-size: 14px;
  font-weight: 600;
  transition: background 160ms ease, color 160ms ease, transform 160ms ease;
}

.nav-item:hover {
  background: var(--surface-low);
  color: var(--text);
}

.nav-item.is-active {
  background: var(--primary);
  color: #ffffff;
}

.sidebar-footer {
  border-top: 1px solid var(--border);
  padding-top: 24px;
}

.main {
  margin-left: var(--sidebar);
  min-height: 100vh;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  height: 80px;
  border-bottom: 1px solid var(--border);
  background: rgba(249, 249, 249, 0.92);
  backdrop-filter: blur(12px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 40px;
}

.search {
  display: flex;
  align-items: center;
  gap: 10px;
  width: min(100%, 282px);
  min-height: 42px;
  padding: 0 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface-mid);
  color: var(--muted);
}

.search input {
  width: 100%;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--text);
}

.top-links {
  display: flex;
  align-items: center;
  gap: 34px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 600;
}

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

.icon-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
}

.icon-button.compact {
  width: 36px;
  height: 36px;
  border: 0;
  background: transparent;
}

.avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: linear-gradient(135deg, #161616, #777);
  color: #fff;
  display: grid;
  place-items: center;
  font-size: 12px;
  font-weight: 800;
}

.content {
  max-width: 1200px;
  margin: 0 auto;
  padding: 40px;
}

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

.page-title {
  margin: 0;
  font-size: 32px;
  line-height: 40px;
  font-weight: 800;
  color: var(--primary);
}

.page-description {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 16px;
  line-height: 24px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 48px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  padding: 0 18px;
  font-size: 14px;
  font-weight: 800;
  cursor: pointer;
}

.btn.primary {
  border-color: var(--primary);
  background: var(--primary);
  color: #ffffff;
}

.btn.full {
  width: 100%;
}

.grid {
  display: grid;
  gap: 24px;
}

.grid.two {
  grid-template-columns: minmax(280px, 0.75fr) minmax(360px, 1.55fr);
}

.grid.three {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.card {
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
}

.card-pad {
  padding: 24px;
}

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

.section-label {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.card-heading {
  margin: 0;
  font-size: 24px;
  line-height: 32px;
  font-weight: 800;
}

.metric {
  padding: 20px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
}

.metric-label {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.metric-value {
  margin-top: 8px;
  font-size: 26px;
  line-height: 32px;
  font-weight: 850;
}

.metric-note {
  margin-top: 8px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
}

.payment-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
  padding: 14px 12px;
  border-bottom: 1px solid var(--border);
}

.payment-item.urgent {
  border-bottom: 0;
  border-left: 4px solid var(--danger);
  border-radius: var(--radius);
  background: var(--surface-low);
}

.item-title {
  font-size: 14px;
  font-weight: 800;
}

.item-meta {
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 650;
}

.item-amount {
  white-space: nowrap;
  font-weight: 850;
}

.bar-list {
  display: grid;
  gap: 22px;
}

.bar-row {
  display: grid;
  gap: 8px;
}

.bar-meta {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.bar-track {
  height: 12px;
  border-radius: 999px;
  background: var(--surface-high);
  overflow: hidden;
}

.bar-fill {
  height: 100%;
  border-radius: 999px;
  background: var(--primary);
}

.table-card {
  overflow: hidden;
}

.table-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 24px;
  border-bottom: 1px solid var(--border);
}

.table-actions {
  display: flex;
  gap: 8px;
}

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

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

th {
  background: var(--surface-low);
  color: var(--muted);
  text-align: left;
  padding: 14px 24px;
  font-size: 12px;
  font-weight: 850;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

td {
  padding: 18px 24px;
  border-top: 1px solid var(--border);
  vertical-align: middle;
  font-size: 14px;
}

tr {
  transition: background 150ms ease;
}

tr:hover {
  background: var(--surface-low);
}

.entity {
  display: flex;
  align-items: center;
  gap: 12px;
}

.entity-icon {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface-mid);
  color: var(--muted);
}

.tag {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  background: var(--surface-mid);
  color: var(--muted);
  padding: 5px 12px;
  font-size: 12px;
  font-weight: 800;
}

.amount-cell {
  text-align: right;
  white-space: nowrap;
  font-weight: 850;
}

.table-foot {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 24px;
  border-top: 1px solid var(--border);
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.form-card {
  margin-bottom: 24px;
}

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

.field {
  display: grid;
  gap: 6px;
}

.field label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.field input,
.field select {
  width: 100%;
  height: 42px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  padding: 0 12px;
  outline: 0;
}

.field input:focus,
.field select:focus {
  border-color: var(--primary);
}

.notice {
  border: 1px solid #e0c265;
  border-radius: var(--radius);
  background: #fff9df;
  color: #6c5400;
  padding: 14px 16px;
  font-size: 13px;
  font-weight: 700;
}

.footer {
  margin-top: 88px;
  border-top: 1px solid var(--border);
  padding: 44px 40px;
  background: var(--surface);
}

.footer-inner {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

.footer-title {
  font-size: 26px;
  font-weight: 900;
}

.footer-links {
  display: flex;
  gap: 30px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.mobile-menu-button {
  display: none;
}

@media (max-width: 980px) {
  :root {
    --sidebar: 0;
  }

  .sidebar {
    transform: translateX(-100%);
    transition: transform 180ms ease;
  }

  .sidebar.open {
    transform: translateX(0);
  }

  .main {
    margin-left: 0;
  }

  .topbar {
    padding: 0 16px;
  }

  .mobile-menu-button {
    display: inline-flex;
  }

  .top-links {
    display: none;
  }

  .search {
    width: min(56vw, 280px);
  }

  .content {
    padding: 28px 16px;
  }

  .page-head {
    align-items: stretch;
    flex-direction: column;
    margin-bottom: 28px;
  }

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

  .footer-inner {
    align-items: flex-start;
    flex-direction: column;
  }
}
