/* Finance Bot dashboard styles — mobile-first */
:root {
  --bg: #F7F7FB;
  --card: #FFFFFF;
  --text: #1A1A2E;
  --text-secondary: #737391;
  --text-muted: #9999B5;
  --accent: #6B5CFF;
  --accent-2: #8E7FFF;
  --error: #E54848;
  --warning: #F0A02E;
  --shadow: 0 2px 12px rgba(20, 20, 50, 0.05);
  --radius: 20px;
  --radius-sm: 14px;
}

*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 16px;
  line-height: 1.4;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}

.container {
  max-width: 480px;
  margin: 0 auto;
  padding: 20px 16px 80px;
}

/* === Header === */
.header {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  margin-bottom: 20px;
}
.greeting-small {
  font-size: 14px;
  color: var(--text-secondary);
  font-weight: 500;
}
.greeting-name {
  font-size: 24px;
  font-weight: 700;
  color: var(--text);
}
.logout-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px; height: 40px;
  border-radius: 50%;
  background: var(--card);
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 18px;
  box-shadow: var(--shadow);
}

/* === Total card (gradient) === */
.card-total {
  background: linear-gradient(135deg, #6B5CFF 0%, #8E7FFF 100%);
  border-radius: var(--radius);
  padding: 22px 24px;
  color: white;
  margin-bottom: 28px;
  box-shadow: 0 8px 24px rgba(107, 92, 255, 0.25);
}
.card-total-label {
  font-size: 13px;
  font-weight: 500;
  opacity: 0.85;
  letter-spacing: 0.2px;
}
.card-total-amount {
  font-size: 34px;
  font-weight: 700;
  margin: 6px 0 16px;
  font-variant-numeric: tabular-nums;
}
.card-total-empty {
  opacity: 0.6;
  font-weight: 600;
}
.card-total-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.card-total-time {
  font-size: 13px;
  opacity: 0.85;
}
.btn-refresh {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(255, 255, 255, 0.22);
  border: none;
  border-radius: 100px;
  padding: 8px 14px;
  color: white;
  font-family: inherit;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s ease;
}
.btn-refresh:hover  { background: rgba(255, 255, 255, 0.32); }
.btn-refresh:active { transform: translateY(1px); }
.refresh-icon { font-size: 16px; line-height: 1; }
.htmx-indicator {
  opacity: 0;
  transition: opacity 0.15s ease;
}
.htmx-request .htmx-indicator      { opacity: 1; }
.htmx-request.htmx-indicator       { opacity: 1; }
.htmx-request .refresh-text        { opacity: 0.5; }
.htmx-request .refresh-icon        { animation: spin 0.6s linear infinite; }
@keyframes spin { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }

/* === Section === */
.section-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin: 0 0 14px 4px;
}

/* === Group card === */
.card-group {
  background: var(--card);
  border-radius: var(--radius);
  padding: 18px 20px;
  margin-bottom: 14px;
  box-shadow: var(--shadow);
}
.card-group-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 2px;
}
.card-group-total {
  font-size: 13px;
  color: var(--text-secondary);
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  margin-bottom: 12px;
}
.card-group-divider {
  height: 1px;
  background: #EFEFF7;
  margin: 8px 0 12px;
}

/* === Row (account) === */
.row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 0;
  gap: 12px;
}
.row + .row { border-top: 1px solid #F4F4FA; }
.row-label {
  flex: 1;
  display: flex;
  align-items: baseline;
  gap: 6px;
  min-width: 0;
}
.row-name {
  font-size: 15px;
  font-weight: 500;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
}
.row-tag {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  background: #F2F2F8;
  padding: 2px 7px;
  border-radius: 6px;
  white-space: nowrap;
  letter-spacing: 0.2px;
}
.row-amount {
  font-size: 15px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  color: var(--text);
}
.row-dash { color: var(--text-muted); font-weight: 400; }
.row-error  .row-amount { color: var(--error); }
.row-stale  .row-amount { color: var(--warning); }

/* === Login screen === */
.login-screen {
  min-height: 80vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: 40px 0;
}
.logo {
  font-size: 28px;
  font-weight: 700;
  background: linear-gradient(135deg, #6B5CFF 0%, #8E7FFF 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin: 0 0 32px;
}
.login-card {
  width: 100%;
  background: var(--card);
  border-radius: var(--radius);
  padding: 28px 24px;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.field span {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
}
.field input {
  font-family: inherit;
  font-size: 16px;
  padding: 12px 14px;
  border: 1px solid #E4E4EE;
  border-radius: var(--radius-sm);
  background: #FAFAFE;
  color: var(--text);
  transition: border-color 0.15s ease, background 0.15s ease;
}
.field input:focus {
  outline: none;
  border-color: var(--accent);
  background: white;
}
.btn-primary {
  font-family: inherit;
  font-size: 16px;
  font-weight: 600;
  padding: 14px;
  background: linear-gradient(135deg, #6B5CFF 0%, #8E7FFF 100%);
  color: white;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: opacity 0.15s ease;
  margin-top: 4px;
}
.btn-primary:hover  { opacity: 0.92; }
.btn-primary:active { opacity: 0.85; }
.error {
  background: #FFE8E8;
  color: var(--error);
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 500;
}
