:root {
  --bg: #f3f0e8;
  --surface: #fffdf8;
  --ink: #17201c;
  --muted: #69726d;
  --line: #ded8cb;
  --green: #1f7a54;
  --green-dark: #15543b;
  --red: #c84d3c;
  --blue: #356b9a;
  --shadow: 0 18px 48px rgba(32, 42, 37, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
}

button,
input,
select {
  font: inherit;
}

.hidden {
  display: none !important;
}

.auth-screen {
  display: grid;
  place-items: center;
  min-height: 100vh;
  padding: 24px;
}

.auth-panel,
.panel,
.transfer-form,
.admin-form,
.balance-card,
.metric-card,
.account-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.auth-panel {
  display: grid;
  gap: 24px;
  width: min(440px, 100%);
  padding: 28px;
}

.brand-block,
.brand,
.user-panel {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-mark,
.user-avatar {
  display: inline-grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 8px;
  background: var(--green);
  color: #fff;
  font-weight: 900;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--green);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  font-size: 32px;
}

h2 {
  margin-bottom: 0;
  font-size: 22px;
}

.login-form,
.transfer-form {
  display: grid;
  gap: 15px;
}

label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 700;
}

input,
select {
  min-height: 46px;
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 12px;
  background: #fff;
  color: var(--ink);
}

.primary-button,
.ghost-button,
.logout-button,
.mini-button {
  min-height: 42px;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 800;
}

.primary-button {
  border: 0;
  padding: 0 18px;
  background: var(--green);
  color: #fff;
}

.ghost-button,
.mini-button {
  border: 1px solid var(--line);
  padding: 0 12px;
  background: #fff;
  color: var(--ink);
}

.logout-button {
  margin-top: auto;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
}

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

.form-message {
  min-height: 22px;
  margin: 0;
  color: var(--green);
  font-weight: 700;
}

.demo-box {
  display: grid;
  gap: 6px;
  padding: 14px;
  border-radius: 8px;
  background: #edf4f0;
  color: var(--muted);
  font-size: 14px;
}

.demo-box strong {
  color: var(--ink);
}

.app-shell {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  display: flex;
  flex-direction: column;
  gap: 26px;
  padding: 28px 18px;
  background: #16221d;
  color: #f9f7ef;
}

.brand small {
  display: block;
  margin-top: 2px;
  color: rgba(255, 255, 255, 0.62);
  font-size: 12px;
}

.nav {
  display: grid;
  gap: 8px;
}

.nav-item {
  display: grid;
  grid-template-columns: 30px 1fr;
  align-items: center;
  min-height: 44px;
  border: 0;
  border-radius: 8px;
  padding: 0 12px;
  background: transparent;
  color: rgba(255, 255, 255, 0.74);
  cursor: pointer;
  text-align: left;
}

.nav-item:hover,
.nav-item.active {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
}

.main {
  min-width: 0;
  padding: 30px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 28px;
}

.user-panel {
  min-width: 220px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.58);
}

.user-panel small {
  display: block;
  color: var(--muted);
}

.view {
  display: none;
}

.view.active {
  display: block;
}

.summary-grid {
  display: grid;
  grid-template-columns: minmax(260px, 1.5fr) repeat(2, minmax(190px, 1fr));
  gap: 16px;
  margin-bottom: 16px;
}

.balance-card {
  min-height: 178px;
  padding: 24px;
  background: linear-gradient(135deg, rgba(31, 122, 84, 0.96), rgba(21, 84, 59, 0.98));
  color: #fff;
}

.card-label {
  margin-bottom: 18px;
  color: rgba(255, 255, 255, 0.78);
}

.balance-card h2 {
  font-size: 42px;
  line-height: 1.05;
}

.balance-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 26px;
  color: rgba(255, 255, 255, 0.78);
  font-size: 14px;
}

.metric-card {
  display: grid;
  align-content: center;
  min-height: 178px;
  padding: 22px;
}

.metric-card p,
.metric-card span {
  color: var(--muted);
}

.metric-card strong {
  display: block;
  margin-bottom: 10px;
  font-size: 28px;
}

.content-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(320px, 0.9fr);
  gap: 16px;
}

.panel,
.transfer-form,
.admin-form {
  padding: 20px;
}

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

.section-title {
  align-items: flex-start;
  flex-direction: column;
}

.accounts-list,
.activity-list,
.account-grid,
.users-table {
  display: grid;
  gap: 12px;
}

.account-row,
.activity-row,
.user-row {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  min-height: 62px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}

.user-row {
  grid-template-columns: minmax(190px, 1fr) 110px 120px 180px;
}

.account-row:last-child,
.activity-row:last-child,
.user-row:last-child {
  border-bottom: 0;
}

.row-icon {
  display: inline-grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 8px;
  background: #e9f2ed;
  color: var(--green);
  font-weight: 800;
}

.row-title {
  margin: 0 0 3px;
  font-weight: 800;
}

.row-subtitle {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
}

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

.amount.negative {
  color: var(--red);
}

.amount.positive {
  color: var(--green);
}

.account-grid {
  grid-template-columns: repeat(3, minmax(220px, 1fr));
}

.account-card {
  display: grid;
  gap: 18px;
  min-height: 190px;
  padding: 20px;
}

.account-number {
  color: var(--muted);
  font-size: 14px;
}

.account-balance {
  font-size: 30px;
  font-weight: 900;
}

.admin-form {
  display: grid;
  grid-template-columns: 1fr 1fr 1.2fr 1fr 120px 150px 120px;
  gap: 10px;
  margin-bottom: 16px;
}

.inline-create-form {
  display: grid;
  grid-template-columns: minmax(220px, 360px) 140px auto;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
}

.account-adjust-form {
  grid-template-columns: minmax(240px, 1.4fr) 150px 150px minmax(180px, 1fr) 120px;
}

.account-create-form {
  grid-template-columns: minmax(240px, 1.4fr) minmax(180px, 1fr) 150px 140px;
}

.system-badge {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  border-radius: 8px;
  padding: 0 8px;
  background: #e9f2ed;
  color: var(--green);
  font-size: 12px;
  font-weight: 800;
}

.account-admin-row {
  grid-template-columns: minmax(180px, 1fr) minmax(220px, 1fr) 140px 110px;
}

.user-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

@media (max-width: 980px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: sticky;
    top: 0;
    z-index: 5;
    padding: 14px;
  }

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

  .nav-item {
    grid-template-columns: 1fr;
    justify-items: center;
    padding: 7px;
    text-align: center;
    font-size: 13px;
  }

  .summary-grid,
  .content-grid,
  .account-grid,
  .admin-form,
  .inline-create-form,
  .user-row {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  .main {
    padding: 18px;
  }

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

  h1 {
    font-size: 26px;
  }

  .balance-card h2 {
    font-size: 34px;
  }

  .account-row,
  .activity-row {
    grid-template-columns: 40px minmax(0, 1fr);
  }

  .amount {
    grid-column: 2;
  }
}
