:root {
  --bg: #f4efe1;
  --bg-accent: #eadfc3;
  --card: rgba(255, 253, 247, 0.92);
  --line: #dccfb2;
  --text: #3d3324;
  --muted: #7c6d56;
  --primary: #3867d6;
  --primary-soft: #edf2ff;
  --warm: #d87443;
  --shadow: 0 18px 50px rgba(90, 71, 31, 0.12);
  --radius: 24px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Segoe UI", Tahoma, sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at top right, rgba(216, 116, 67, 0.16), transparent 28%),
    linear-gradient(180deg, #f8f4ea 0%, var(--bg) 100%);
}

.portal-shell {
  min-height: 100vh;
}

.login-layout,
.dashboard-layout {
  width: min(100%, 1100px);
  margin: 0 auto;
  padding: 24px 16px 40px;
}

.login-layout {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
}

.login-intro,
.login-card,
.summary-card,
.metric-panel,
.table-panel,
.dashboard-header {
  background: var(--card);
  border: 1px solid rgba(220, 207, 178, 0.75);
  box-shadow: var(--shadow);
  backdrop-filter: blur(12px);
}

.login-intro,
.login-card,
.metric-panel,
.table-panel {
  border-radius: var(--radius);
  padding: 22px;
}

.mini-badge {
  display: inline-flex;
  padding: 7px 12px;
  border-radius: 999px;
  background: #f2e7ca;
  color: #856833;
  font-size: 12px;
  font-weight: 700;
}

h1,
h2,
p {
  margin: 0;
}

.login-intro h1,
.dashboard-header h1 {
  margin-top: 12px;
  font-size: clamp(28px, 7vw, 40px);
  line-height: 1.2;
}

.login-card h1 {
  font-size: clamp(34px, 7vw, 48px);
  line-height: 1.1;
}

.login-intro p,
.dashboard-header p,
.card-top p {
  margin-top: 10px;
  color: var(--muted);
  line-height: 1.8;
}

.stat-strip {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 22px;
}

.stat-pill {
  min-width: 140px;
  padding: 14px 16px;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid rgba(220, 207, 178, 0.9);
}

.stat-pill span,
.summary-card span,
.metric-row span,
th {
  color: var(--muted);
  font-size: 13px;
}

.stat-pill strong,
.summary-card strong,
.metric-row strong,
td strong {
  display: block;
  margin-top: 6px;
  color: var(--primary);
  font-size: 19px;
}

.card-top {
  margin-bottom: 18px;
  text-align: center;
}

.form-grid {
  display: grid;
  gap: 14px;
}

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

.field span {
  font-size: 14px;
  font-weight: 700;
}

.field input {
  width: 100%;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.92);
  border-radius: 18px;
  padding: 15px 16px;
  font-size: 16px;
  color: var(--text);
  outline: none;
}

.field input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(56, 103, 214, 0.12);
}

.primary-btn,
.ghost-btn {
  border: 0;
  border-radius: 18px;
  padding: 15px 18px;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
}

.primary-btn {
  background: linear-gradient(135deg, var(--warm), #de986d);
  color: #fffdf8;
}

.ghost-btn {
  background: var(--primary-soft);
  color: var(--primary);
}

.form-message {
  min-height: 24px;
  color: #b0473a;
  font-size: 14px;
  text-align: center;
}

.login-card {
  width: min(100%, 560px);
}

.dashboard-layout {
  display: grid;
  gap: 16px;
}

.dashboard-modern {
  width: min(100%, 1180px);
}

.dashboard-topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  padding: 4px 2px 12px;
}

.dashboard-topbar h1 {
  font-size: clamp(30px, 6vw, 42px);
  margin: 0;
}

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

.compact-btn {
  padding: 10px 14px;
  border-radius: 14px;
}

.kpi-grid,
.chart-grid {
  display: grid;
  gap: 16px;
}

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

.kpi-card,
.chart-card {
  background: var(--card);
  border: 1px solid rgba(220, 207, 178, 0.75);
  border-radius: 24px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(12px);
}

.kpi-card {
  padding: 18px 20px;
}

.kpi-card span,
.chart-head span {
  color: var(--muted);
  font-size: 13px;
}

.kpi-card strong {
  display: block;
  margin-top: 10px;
  font-size: clamp(24px, 6vw, 36px);
  color: var(--text);
}

.kpi-card small {
  display: block;
  margin-top: 8px;
  color: var(--muted);
}

.kpi-primary {
  background: linear-gradient(135deg, rgba(216, 116, 67, 0.12), rgba(56, 103, 214, 0.08));
}

.chart-grid {
  grid-template-columns: 1fr;
}

.chart-card {
  padding: 18px;
}

.accounts-panel {
  background: var(--card);
  border: 1px solid rgba(220, 207, 178, 0.75);
  border-radius: 24px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(12px);
  padding: 18px;
}

.accounts-head {
  margin-bottom: 14px;
}

.accounts-table-wrap {
  overflow: auto;
  border-radius: 18px;
  border: 1px solid rgba(220, 207, 178, 0.8);
  background: rgba(255, 255, 255, 0.72);
}

.accounts-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 460px;
}

.accounts-table th,
.accounts-table td {
  padding: 14px 12px;
  text-align: right;
  border-bottom: 1px solid rgba(220, 207, 178, 0.65);
}

.accounts-table tbody tr:last-child td {
  border-bottom: 0;
}

.amount-cell {
  color: var(--primary);
  font-weight: 700;
  white-space: nowrap;
}

.table-empty {
  text-align: center !important;
  color: var(--muted);
}

.chart-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}

.chart-head h2 {
  margin: 0;
  font-size: 22px;
}

.chart-box {
  background: rgba(255, 255, 255, 0.66);
  border: 1px solid rgba(220, 207, 178, 0.65);
  border-radius: 18px;
  padding: 10px;
}

.chart-svg {
  width: 100%;
  height: auto;
  display: block;
}

.chart-label {
  fill: var(--muted);
  font-size: 11px;
}

.dashboard-header {
  border-radius: 28px;
  padding: 20px;
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
}

.summary-grid,
.metrics-grid {
  display: grid;
  gap: 14px;
}

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

.summary-card {
  border-radius: 24px;
  padding: 18px;
}

.summary-card strong {
  font-size: clamp(24px, 7vw, 34px);
}

.summary-card small {
  display: block;
  margin-top: 8px;
  color: var(--muted);
}

.highlight-card {
  background: linear-gradient(135deg, rgba(56, 103, 214, 0.08), rgba(216, 116, 67, 0.12));
}

.metric-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 12px 0;
  border-bottom: 1px solid rgba(220, 207, 178, 0.72);
}

.metric-row:last-child {
  border-bottom: 0;
}

#currency-totals {
  display: grid;
}

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

.refresh-chip {
  padding: 8px 11px;
  border-radius: 999px;
  background: #f5ebd1;
  color: #8a6d39;
  font-size: 12px;
}

.table-wrap {
  overflow: auto;
  border-radius: 18px;
  border: 1px solid rgba(220, 207, 178, 0.8);
  background: rgba(255, 255, 255, 0.75);
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 540px;
}

th,
td {
  padding: 14px 12px;
  text-align: right;
  border-bottom: 1px solid rgba(220, 207, 178, 0.65);
}

td {
  font-size: 14px;
}

td.amount {
  color: var(--primary);
  font-weight: 700;
}

@media (min-width: 880px) {
  .login-layout {
    padding-top: 48px;
  }

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

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

@media (max-width: 680px) {
  .login-layout,
  .dashboard-layout {
    padding: 14px 10px 28px;
  }

  .dashboard-topbar {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
    padding-bottom: 4px;
  }

  .topbar-actions {
    justify-content: space-between;
  }

  .kpi-grid {
    grid-template-columns: 1fr;
  }

  .dashboard-header {
    flex-direction: column;
  }

  .summary-grid {
    grid-template-columns: 1fr;
  }

  .dashboard-topbar h1 {
    font-size: 32px;
  }

  .refresh-chip,
  .compact-btn {
    font-size: 13px;
  }

  .kpi-card,
  .chart-card,
  .accounts-panel {
    padding: 14px;
    border-radius: 20px;
  }

  .kpi-card strong {
    font-size: 26px;
  }

  .chart-head h2,
  .accounts-head h2 {
    font-size: 19px;
  }

  .chart-box {
    padding: 8px 6px 4px;
    overflow: hidden;
  }

  .chart-label {
    font-size: 10px;
  }

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

  .accounts-table,
  .accounts-table thead,
  .accounts-table tbody,
  .accounts-table tr,
  .accounts-table th,
  .accounts-table td {
    display: block;
    width: 100%;
  }

  .accounts-table {
    min-width: 0;
  }

  .accounts-table thead {
    display: none;
  }

  .accounts-table tbody {
    display: grid;
    gap: 10px;
  }

  .accounts-table tr {
    border: 1px solid rgba(220, 207, 178, 0.8);
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.78);
    padding: 12px;
    box-shadow: 0 10px 22px rgba(90, 71, 31, 0.08);
  }

  .accounts-table td {
    border-bottom: 1px solid rgba(220, 207, 178, 0.45);
    padding: 10px 0;
    text-align: right;
  }

  .accounts-table td:last-child {
    border-bottom: 0;
    padding-bottom: 0;
  }

  .accounts-table td::before {
    content: attr(data-label);
    display: block;
    margin-bottom: 6px;
    color: var(--muted);
    font-size: 12px;
    font-weight: 700;
  }

  .table-empty {
    border: 0 !important;
    padding: 20px 10px !important;
  }

  .table-empty::before {
    display: none !important;
  }

  .login-intro,
  .login-card,
  .summary-card,
  .metric-panel,
  .table-panel,
  .accounts-panel {
    padding: 18px;
    border-radius: 22px;
  }
}
