* {
  box-sizing: border-box;
}

:root {
  --bg: #f5f7fb;
  --panel: #ffffff;
  --text: #18202a;
  --muted: #667085;
  --line: #e4e7ec;
  --primary: #222831;
  --primary-soft: #eef1f5;
  --success: #157347;
  --danger: #b42318;
  --warning: #9a6700;
}

body {
  margin: 0;
  font-family: Arial, Helvetica, sans-serif;
  background: var(--bg);
  color: var(--text);
}

button,
input,
select,
textarea {
  font: inherit;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.container {
  width: min(1120px, calc(100% - 32px));
  margin: 0 auto;
}

.page-content {
  padding: 30px 0 50px;
}

.topbar {
  background: #111827;
  color: #fff;
  padding: 24px 0;
}

.topbar-content {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  align-items: center;
}

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

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

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

.eyebrow,
.step {
  display: inline-block;
  font-size: 12px;
  letter-spacing: 0.08em;
  font-weight: 700;
  color: #98a2b3;
  margin-bottom: 7px;
}

.muted {
  color: var(--muted);
  line-height: 1.5;
}

.status {
  font-size: 14px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: #d0d5dd;
}

.status-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #32d583;
}

.user-controls {
  display: flex;
  align-items: center;
  gap: 16px;
}

.user-info {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 5px;
}

.user-info small {
  color: #98a2b3;
}

.center-view {
  min-height: 360px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  color: var(--muted);
}

.loader {
  width: 34px;
  height: 34px;
  border: 4px solid #d0d5dd;
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.auth-shell {
  min-height: 560px;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding-top: 34px;
}

.auth-card {
  width: min(470px, 100%);
}

.auth-card h2 {
  font-size: 27px;
  margin-bottom: 10px;
}

.auth-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  padding: 5px;
  border-radius: 12px;
  background: var(--primary-soft);
  margin: 24px 0 20px;
}

.auth-tab {
  border: 0;
  border-radius: 9px;
  padding: 11px 14px;
  background: transparent;
  color: #475467;
  font-weight: 700;
  cursor: pointer;
}

.auth-tab.active {
  background: #fff;
  color: var(--text);
  box-shadow: 0 2px 7px rgba(16, 24, 40, 0.08);
}

.auth-card .field {
  margin-bottom: 16px;
}

.form-message {
  min-height: 20px;
  font-size: 14px;
  margin: 13px 0 0;
  color: var(--danger);
  line-height: 1.45;
}

.form-message.success {
  color: var(--success);
}

.workspace-bar {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  align-items: center;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 16px 20px;
  margin-bottom: 22px;
}

.workspace-bar span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  margin-bottom: 4px;
}

.workspace-meta {
  text-align: right;
}

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

.full-column {
  grid-column: 1 / -1;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 24px;
  box-shadow: 0 8px 24px rgba(16, 24, 40, 0.05);
}

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

label {
  display: block;
  font-size: 14px;
  font-weight: 700;
  margin-bottom: 8px;
}

textarea,
input,
select {
  width: 100%;
  border: 1px solid #d0d5dd;
  border-radius: 10px;
  padding: 12px 13px;
  color: var(--text);
  background: #fff;
  outline: none;
}

textarea:focus,
input:focus,
select:focus {
  border-color: #667085;
  box-shadow: 0 0 0 3px rgba(102, 112, 133, 0.12);
}

.examples {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 14px 0 18px;
}

.example,
.text-button {
  border: 0;
  background: var(--primary-soft);
  color: #344054;
  border-radius: 999px;
  padding: 9px 12px;
  cursor: pointer;
}

.primary-button,
.secondary-button {
  border-radius: 10px;
  padding: 13px 16px;
  font-weight: 700;
  cursor: pointer;
}

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

.secondary-button {
  border: 1px solid #475467;
  background: transparent;
  color: #fff;
}

.compact-button {
  padding: 9px 14px;
}

.primary-button:hover,
.secondary-button:hover {
  opacity: 0.92;
}

.error {
  color: var(--danger);
  font-size: 14px;
  min-height: 18px;
  margin: 10px 0 0;
}

.badge {
  border-radius: 999px;
  padding: 8px 11px;
  font-size: 13px;
  font-weight: 700;
  background: #ecfdf3;
  color: var(--success);
}

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

.full-width {
  grid-column: 1 / -1;
}

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

.summary-card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 18px;
}

.summary-card span {
  display: block;
  color: var(--muted);
  font-size: 13px;
  margin-bottom: 8px;
}

.summary-card strong {
  font-size: 22px;
}

.balance-card {
  background: #111827;
  color: #fff;
}

.balance-card span {
  color: #d0d5dd;
}

.transactions-heading {
  align-items: center;
}

.text-button {
  color: var(--danger);
  background: #fef3f2;
}

.empty-state {
  text-align: center;
  padding: 36px 16px;
  color: var(--muted);
}

.empty-state strong {
  display: block;
  color: #344054;
  margin-bottom: 6px;
}

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

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

th,
td {
  text-align: left;
  padding: 13px 10px;
  border-bottom: 1px solid var(--line);
  font-size: 14px;
  white-space: nowrap;
}

td:nth-child(3) {
  min-width: 240px;
  white-space: normal;
}

th {
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.value-income {
  color: var(--success);
  font-weight: 700;
}

.value-out {
  color: var(--danger);
  font-weight: 700;
}

.delete-button {
  border: 0;
  background: transparent;
  color: var(--danger);
  cursor: pointer;
  font-weight: 700;
}

.hidden {
  display: none !important;
}

.toast {
  position: fixed;
  right: 20px;
  bottom: 20px;
  max-width: min(390px, calc(100% - 40px));
  background: #101828;
  color: #fff;
  padding: 13px 16px;
  border-radius: 10px;
  opacity: 0;
  transform: translateY(12px);
  pointer-events: none;
  transition: 0.25s ease;
  z-index: 50;
}

.toast.error {
  background: var(--danger);
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

@media (max-width: 820px) {
  .main-grid,
  .summary-section {
    grid-template-columns: 1fr;
  }

  .full-column {
    grid-column: auto;
  }

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

  .user-controls {
    width: 100%;
    justify-content: space-between;
  }

  .user-info {
    align-items: flex-start;
  }
}

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

  .full-width {
    grid-column: auto;
  }

  .panel {
    padding: 18px;
  }

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

  .workspace-meta {
    text-align: left;
  }
}
