@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

* {
  box-sizing: border-box;
}

:root {
  --bg: #080a0f;
  --surface: rgba(22, 26, 37, 0.85);
  --surface-solid: #161a25;
  --surface-2: rgba(28, 33, 48, 0.9);
  --border: rgba(255, 255, 255, 0.07);
  --border-bright: rgba(255, 255, 255, 0.12);
  --text: #e8ecf4;
  --text-dim: #6b7280;
  --accent: #6c8fff;
  --accent-glow: rgba(108, 143, 255, 0.35);
  --accent-dim: rgba(108, 143, 255, 0.12);
  --green: #4ade80;
  --green-glow: rgba(74, 222, 128, 0.25);
  --coral: #f87171;
  --coral-glow: rgba(248, 113, 113, 0.25);
  --amber: #fbbf24;
  --amber-glow: rgba(251, 191, 36, 0.25);
  --danger: #f87171;
  --radius: 14px;
}

body {
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  margin: 0;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  background-image:
    radial-gradient(ellipse 80% 50% at 20% -10%, rgba(108, 143, 255, 0.08) 0%, transparent 60%),
    radial-gradient(ellipse 60% 40% at 80% 110%, rgba(74, 222, 128, 0.05) 0%, transparent 60%);
}

/* ── Sidebar ── */
.layout {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: 240px;
  background: linear-gradient(180deg, #0e1120 0%, #0a0d16 100%);
  border-right: 1px solid var(--border);
  padding: 1.75rem 1.25rem;
  display: flex;
  flex-direction: column;
  position: relative;
  z-index: 10;
}

.sidebar::after {
  content: "";
  position: absolute;
  top: 0;
  right: -1px;
  width: 1px;
  height: 100%;
  background: linear-gradient(180deg, transparent, rgba(108, 143, 255, 0.3) 40%, transparent);
  pointer-events: none;
}

@keyframes logo-shimmer {
  0%   { background-position: 0% 50%; }
  50%  { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

.sidebar h1 {
  font-size: 1.15rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  margin: 0 0 2rem;
  background: linear-gradient(120deg, #a8c0ff, #6c8fff, #a78bfa, #38bdf8, #a8c0ff);
  background-size: 300% 300%;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  animation: logo-shimmer 4s ease infinite;
  position: relative;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.sidebar h1::before {
  content: "◈";
  font-size: 1rem;
  -webkit-text-fill-color: transparent;
  background: linear-gradient(135deg, #6c8fff, #a78bfa);
  -webkit-background-clip: text;
  background-clip: text;
  filter: drop-shadow(0 0 6px rgba(167, 139, 250, 0.6));
  flex-shrink: 0;
}

.sidebar ul {
  list-style: none;
  padding: 0;
  margin: 0;
  flex: 1;
}

.sidebar li + li {
  margin-top: 0.15rem;
}

.sidebar a {
  display: flex;
  align-items: center;
  padding: 0.6rem 0.85rem;
  border-radius: 10px;
  color: var(--text-dim);
  text-decoration: none;
  font-size: 0.875rem;
  font-weight: 500;
  transition: background 0.2s, color 0.2s, box-shadow 0.2s;
  position: relative;
}

.sidebar a:hover {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text);
}

.sidebar a.active {
  background: var(--accent-dim);
  color: #a8c0ff;
  box-shadow: inset 0 0 0 1px rgba(108, 143, 255, 0.2), 0 0 16px rgba(108, 143, 255, 0.15);
}

.sidebar a.active::before {
  content: "";
  position: absolute;
  left: 0;
  top: 20%;
  height: 60%;
  width: 3px;
  border-radius: 0 3px 3px 0;
  background: var(--accent);
  box-shadow: 0 0 8px var(--accent-glow);
}

.status {
  font-size: 0.72rem;
  color: var(--text-dim);
  padding-top: 1rem;
  border-top: 1px solid var(--border);
  opacity: 0.6;
}

/* ── Content ── */
.content {
  flex: 1;
  padding: 2.5rem 3rem;
  overflow-y: auto;
}

.content h2 {
  font-size: 1.9rem;
  font-weight: 800;
  margin: 0 0 1.5rem;
  letter-spacing: -0.03em;
  background: linear-gradient(120deg, #a8c0ff, #6c8fff, #a78bfa, #38bdf8, #a8c0ff);
  background-size: 300% 300%;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  animation: logo-shimmer 4s ease infinite;
}

.page > p {
  color: var(--text-dim);
}

.page-header {
  display: flex;
  align-items: baseline;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.page-header h2 {
  margin: 0;
}

.last-updated {
  font-size: 0.72rem;
  color: var(--text-dim);
  opacity: 0.7;
}

.page-header-actions {
  margin-left: auto;
  display: flex;
  gap: 8px;
}

.export-btn {
  padding: 0.45rem 1rem;
  border: 1px solid var(--border-bright);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-dim);
  font-size: 0.78rem;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  transition: background 0.2s, color 0.2s, border-color 0.2s, box-shadow 0.2s;
}

.export-btn:hover {
  background: rgba(108, 143, 255, 0.1);
  color: var(--accent);
  border-color: rgba(108, 143, 255, 0.35);
  box-shadow: 0 0 14px rgba(108, 143, 255, 0.15);
}

.actions-dropdown {
  position: relative;
}

.actions-menu {
  display: none;
  position: absolute;
  right: 0;
  top: calc(100% + 6px);
  background: #13172a;
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
  z-index: 100;
  min-width: 180px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.4);
}

.actions-menu.open {
  display: block;
}

.actions-menu button {
  display: block;
  width: 100%;
  padding: 0.6rem 1.1rem;
  background: none;
  border: none;
  color: var(--text);
  font-size: 0.85rem;
  font-family: inherit;
  text-align: left;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}

.actions-menu button:hover {
  background: rgba(108, 143, 255, 0.1);
  color: var(--accent);
}

/* ── Metric cards ── */
.metric-cards {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
  margin-bottom: 1.75rem;
}

.metric-card {
  background: var(--surface);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0;
  position: relative;
  overflow: hidden;
  transition: transform 0.2s, box-shadow 0.2s;
}

.metric-card:hover {
  transform: translateY(-2px);
}

.metric-card-body {
  padding: 1.1rem 1.1rem 1rem;
}

.metric-card::before {
  content: "";
  display: block;
  height: 3px;
  width: 100%;
}

.metric-card.accent-blue::before {
  background: linear-gradient(90deg, #4a6fff, #8fb3ff);
  box-shadow: 0 0 20px rgba(108, 143, 255, 0.5);
}
.metric-card.accent-blue:hover {
  box-shadow: 0 8px 32px rgba(108, 143, 255, 0.15);
}
.metric-card.accent-blue .metric-value {
  color: #a8c0ff;
}

.metric-card.accent-coral::before {
  background: linear-gradient(90deg, #f87171, #fca5a5);
  box-shadow: 0 0 20px rgba(248, 113, 113, 0.5);
}
.metric-card.accent-coral:hover {
  box-shadow: 0 8px 32px rgba(248, 113, 113, 0.15);
}
.metric-card.accent-coral .metric-value {
  color: #fca5a5;
}

.metric-card.accent-amber::before {
  background: linear-gradient(90deg, #f59e0b, #fcd34d);
  box-shadow: 0 0 20px rgba(251, 191, 36, 0.5);
}
.metric-card.accent-amber:hover {
  box-shadow: 0 8px 32px rgba(251, 191, 36, 0.15);
}
.metric-card.accent-amber .metric-value {
  color: #fcd34d;
}

.metric-card.accent-green::before {
  background: linear-gradient(90deg, #22c55e, #86efac);
  box-shadow: 0 0 20px rgba(74, 222, 128, 0.5);
}
.metric-card.accent-green:hover {
  box-shadow: 0 8px 32px rgba(74, 222, 128, 0.15);
}
.metric-card.accent-green .metric-value {
  color: #4ade80;
}

.metric-label {
  font-size: 0.72rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-dim);
  margin: 0 0 8px;
}

.metric-value {
  font-size: 1.6rem;
  font-weight: 700;
  margin: 0;
  letter-spacing: -0.03em;
}

/* ── Overview grid ── */
.overview-grid {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: 14px;
}

.panel {
  background: var(--surface);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  transition: border-color 0.2s;
}

.panel:hover {
  border-color: var(--border-bright);
}

.panel-title {
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-dim);
  margin: 0 0 14px;
}

.txn-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.875rem;
  transition: opacity 0.15s;
}

.txn-row:last-child {
  border-bottom: none;
}

.txn-left {
  display: flex;
  align-items: center;
  gap: 10px;
}

.txn-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.txn-meta {
  color: var(--text-dim);
  font-size: 0.75rem;
}

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

/* ── Progress bars ── */
.budget-row {
  margin-bottom: 14px;
}

.budget-row:last-child {
  margin-bottom: 0;
}

.budget-row-top {
  display: flex;
  justify-content: space-between;
  font-size: 0.78rem;
  margin-bottom: 6px;
}

.budget-row-top .label-dim {
  color: var(--text-dim);
}

.budget-bar {
  background: rgba(255, 255, 255, 0.06);
  border-radius: 999px;
  height: 5px;
  overflow: hidden;
}

.budget-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), #a8c0ff);
  border-radius: 999px;
  transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.budget-bar-fill.over {
  background: linear-gradient(90deg, var(--coral), #fca5a5);
}

.empty-hint {
  color: var(--text-dim);
  font-size: 0.85rem;
}

/* ── Forms ── */
#transaction-form,
.inline-form {
  display: flex;
  gap: 0.6rem;
  margin-bottom: 1.75rem;
  flex-wrap: wrap;
}

#transaction-form input,
.inline-form input,
.inline-form select {
  padding: 0.6rem 0.85rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface-2);
  color: var(--text);
  font-size: 0.875rem;
  font-family: inherit;
  transition: border-color 0.2s, box-shadow 0.2s;
}

#transaction-form input::placeholder,
.inline-form input::placeholder {
  color: var(--text-dim);
}

#transaction-form input:focus,
.inline-form input:focus,
.inline-form select:focus {
  outline: none;
  border-color: rgba(108, 143, 255, 0.5);
  box-shadow: 0 0 0 3px rgba(108, 143, 255, 0.1);
}

#transaction-form button,
.inline-form button {
  padding: 0.6rem 1.2rem;
  border: none;
  border-radius: 10px;
  background: linear-gradient(135deg, #5a7fff, #7c9fff);
  color: #fff;
  font-weight: 600;
  font-size: 0.875rem;
  font-family: inherit;
  cursor: pointer;
  transition: opacity 0.15s, transform 0.15s, box-shadow 0.15s;
  box-shadow: 0 2px 12px rgba(108, 143, 255, 0.3);
}

#transaction-form button:hover,
.inline-form button:hover {
  opacity: 0.9;
  transform: translateY(-1px);
  box-shadow: 0 4px 20px rgba(108, 143, 255, 0.4);
}

/* ── Paycheck columns ── */
.budget-columns {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 16px;
}

.paycheck-card {
  background: var(--surface);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.paycheck-card:hover {
  border-color: var(--border-bright);
  box-shadow: 0 8px 40px rgba(0, 0, 0, 0.3);
}

.paycheck-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 14px;
  flex-wrap: wrap;
  gap: 8px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}

.ph-header-fields {
  display: flex;
  gap: 6px;
  align-items: center;
}

.ph-header-fields input {
  padding: 5px 8px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  font-size: 0.75rem;
  font-family: inherit;
  transition: border-color 0.2s;
}

.ph-header-fields input:focus {
  outline: none;
  border-color: rgba(108, 143, 255, 0.4);
}

.ph-save-btn {
  background: linear-gradient(135deg, #5a7fff, #7c9fff);
  border: none;
  color: #fff;
  border-radius: 8px;
  padding: 5px 12px;
  cursor: pointer;
  font-size: 0.72rem;
  font-weight: 600;
  font-family: inherit;
  transition: opacity 0.15s, box-shadow 0.15s;
  box-shadow: 0 2px 8px rgba(108, 143, 255, 0.25);
}

.ph-save-btn:hover {
  opacity: 0.85;
  box-shadow: 0 4px 14px rgba(108, 143, 255, 0.4);
}

.paycheck-card-header .label {
  font-size: 0.95rem;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.paycheck-card-header .date {
  font-size: 0.75rem;
  color: var(--text-dim);
}

.bill-category {
  color: var(--text-dim);
  font-size: 0.7rem;
  margin-top: 1px;
}

.sc-category-input {
  display: block;
  background: none;
  border: none;
  border-bottom: 1px solid transparent;
  color: var(--text-dim);
  font-size: 0.7rem;
  font-family: inherit;
  margin-top: 2px;
  padding: 0;
  width: 100%;
  outline: none;
}
.sc-category-input:hover, .sc-category-input:focus {
  border-bottom-color: var(--accent);
  color: var(--text);
}

/* ── Paycheck table ── */
.paycheck-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}

.paycheck-table td {
  padding: 8px 5px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

.paycheck-table td:last-child {
  text-align: right;
}

.paycheck-table tr:last-child td {
  border-bottom: none;
}

.paycheck-table tr:not(.row-add):not(.row-add-category):not(.row-add-income):not(.row-total):not(.row-leftover):hover td {
  background: rgba(255, 255, 255, 0.02);
}

.paycheck-table .row-income td {
  font-weight: 600;
  color: var(--green);
  border-bottom: 1px solid var(--border);
}

.row-delete-income {
  background: none;
  border: none;
  color: var(--text-dim);
  cursor: pointer;
  font-size: 1rem;
  line-height: 1;
  padding: 0 4px;
  opacity: 0.4;
  transition: opacity 0.15s, color 0.15s;
}

.row-delete-income:hover {
  opacity: 1;
  color: var(--danger);
}

.row-add-income td {
  border-bottom: 1px solid var(--border-bright);
  padding-top: 8px;
  padding-bottom: 10px;
}

.row-add-income input {
  width: 100%;
  padding: 5px 8px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  font-size: 0.78rem;
  font-family: inherit;
  transition: border-color 0.2s;
}

.row-add-income input:focus {
  outline: none;
  border-color: rgba(74, 222, 128, 0.4);
  box-shadow: 0 0 0 3px rgba(74, 222, 128, 0.08);
}

.row-add-income-btn {
  background: linear-gradient(135deg, #22c55e, #4ade80);
  border: none;
  color: #0a1a0f;
  border-radius: 8px;
  width: 28px;
  height: 28px;
  cursor: pointer;
  font-size: 1rem;
  font-weight: 700;
  transition: opacity 0.15s, box-shadow 0.15s;
  box-shadow: 0 2px 8px rgba(74, 222, 128, 0.2);
}

.row-add-income-btn:hover {
  opacity: 0.85;
  box-shadow: 0 4px 14px rgba(74, 222, 128, 0.35);
}

.paycheck-table .row-total td {
  font-size: 0.8rem;
}

.paycheck-table .row-income-total td {
  color: #a8c0ff;
}

.paycheck-table .row-bills-total td {
  color: #fca5a5;
}

.paycheck-table .row-leftover td {
  font-weight: 700;
  color: #fcd34d;
  font-size: 0.88rem;
  padding-top: 10px;
}

.row-delete {
  background: none;
  border: none;
  color: var(--text-dim);
  cursor: pointer;
  font-size: 1rem;
  line-height: 1;
  padding: 0 4px;
  opacity: 0.35;
  transition: opacity 0.15s, color 0.15s;
}

.row-delete:hover {
  opacity: 1;
  color: var(--danger);
}

.row-add td,
.row-add-category td {
  border-bottom: none;
  padding-top: 10px;
}

.row-add input,
.row-add select,
.row-add-category input {
  width: 100%;
  padding: 5px 8px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  font-size: 0.78rem;
  font-family: inherit;
  transition: border-color 0.2s;
}

.row-add input:focus,
.row-add select:focus,
.row-add-category input:focus {
  outline: none;
  border-color: rgba(108, 143, 255, 0.4);
  box-shadow: 0 0 0 3px rgba(108, 143, 255, 0.08);
}

.row-add select option {
  background: #1a1f2e;
}

.row-add-btn {
  background: linear-gradient(135deg, #5a7fff, #7c9fff);
  border: none;
  color: #fff;
  border-radius: 8px;
  width: 28px;
  height: 28px;
  cursor: pointer;
  font-size: 1rem;
  font-weight: 700;
  transition: opacity 0.15s, box-shadow 0.15s;
  box-shadow: 0 2px 8px rgba(108, 143, 255, 0.25);
}

.row-add-btn:hover {
  opacity: 0.85;
  box-shadow: 0 4px 14px rgba(108, 143, 255, 0.4);
}

/* ── Due day pill ── */
.due-pill {
  display: inline-block;
  font-size: 0.62rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  padding: 3px 9px;
  border-radius: 999px;
  white-space: nowrap;
  background: rgba(108,143,255,0.15);
  color: var(--accent);
  margin-left: 6px;
  vertical-align: middle;
}

/* ── Status badges ── */
.status-badge {
  display: inline-block;
  font-size: 0.62rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  padding: 3px 9px;
  border-radius: 999px;
  white-space: nowrap;
}

.editable-name {
  cursor: pointer;
  transition: color 0.15s;
}

.editable-name:hover {
  color: var(--accent);
}

.editable-name:hover .bill-category {
  color: var(--accent);
  opacity: 0.7;
}

.name-edit-input {
  width: 100%;
  display: block;
  padding: 3px 6px;
  border: 1px solid rgba(108, 143, 255, 0.5);
  border-radius: 6px;
  background: rgba(108, 143, 255, 0.08);
  color: var(--text);
  font-size: 0.82rem;
  font-family: inherit;
  outline: none;
  box-shadow: 0 0 0 3px rgba(108, 143, 255, 0.1);
}

.editable-amount {
  cursor: pointer;
  transition: color 0.15s;
}

.editable-amount:hover {
  color: var(--accent);
}

.amount-edit-input {
  width: 80px;
  padding: 3px 6px;
  border: 1px solid rgba(108, 143, 255, 0.5);
  border-radius: 6px;
  background: rgba(108, 143, 255, 0.08);
  color: var(--text);
  font-size: 0.85rem;
  font-family: inherit;
  box-shadow: 0 0 0 3px rgba(108, 143, 255, 0.1);
  outline: none;
}

.clickable-status {
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.15s, opacity 0.15s;
  border: none;
  font-family: inherit;
}

.clickable-status:hover {
  transform: scale(1.08);
}

.status-paid {
  background: rgba(74, 222, 128, 0.12);
  color: #4ade80;
  border: 1px solid rgba(74, 222, 128, 0.25);
}

.clickable-status.status-paid:hover {
  box-shadow: 0 0 12px rgba(74, 222, 128, 0.4);
  background: rgba(74, 222, 128, 0.2);
}

.status-paying {
  background: rgba(108, 143, 255, 0.12);
  color: #a8c0ff;
  border: 1px solid rgba(108, 143, 255, 0.25);
}

.clickable-status.status-paying:hover {
  box-shadow: 0 0 12px rgba(108, 143, 255, 0.4);
  background: rgba(108, 143, 255, 0.2);
}

.status-unpaid {
  background: rgba(248, 113, 113, 0.12);
  color: #f87171;
  border: 1px solid rgba(248, 113, 113, 0.25);
}

.clickable-status.status-unpaid:hover {
  box-shadow: 0 0 12px rgba(248, 113, 113, 0.4);
  background: rgba(248, 113, 113, 0.2);
}

/* ── Paycheck totals ── */
.paycheck-totals {
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid var(--border);
  font-size: 0.8rem;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.paycheck-totals .row {
  display: flex;
  justify-content: space-between;
}

.paycheck-totals .left-over {
  font-weight: 600;
  color: var(--accent);
}

/* ── Credit cards ── */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 16px;
}

.cc-card {
  background: var(--surface);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  transition: transform 0.2s, border-color 0.2s, box-shadow 0.2s;
}

.cc-card:hover {
  transform: translateY(-3px);
  border-color: var(--border-bright);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.3);
}

.cc-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.cc-card-header .name {
  font-weight: 700;
  font-size: 0.9rem;
}

.cc-card-header .last4 {
  color: var(--text-dim);
  font-size: 0.75rem;
  font-variant-numeric: tabular-nums;
}

.cc-balance {
  font-size: 1.4rem;
  font-weight: 700;
  margin: 0 0 4px;
  letter-spacing: -0.02em;
}

.cc-limit {
  font-size: 0.72rem;
  color: var(--text-dim);
  margin: 0 0 12px;
}

.cc-actions {
  display: flex;
  gap: 8px;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--border);
}

.cc-edit-btn {
  background: none;
  border: none;
  color: var(--accent);
  cursor: pointer;
  font-size: 0.78rem;
  font-family: inherit;
  opacity: 0.7;
  padding: 0;
  transition: opacity 0.15s;
}

.cc-edit-btn:hover { opacity: 1; }

.cc-del-btn {
  background: none;
  border: none;
  color: var(--danger);
  cursor: pointer;
  font-size: 0.78rem;
  font-family: inherit;
  opacity: 0.7;
  padding: 0;
  transition: opacity 0.15s;
}

.cc-del-btn:hover { opacity: 1; }

/* ── Side Calculations ── */
.side-calc-col {
  max-width: 600px;
}

.sc-title-input {
  background: none;
  border: none;
  color: var(--text);
  font-size: 0.95rem;
  font-weight: 700;
  font-family: inherit;
  letter-spacing: -0.01em;
  flex: 1;
  outline: none;
  padding: 0;
}

.sc-title-input::placeholder {
  color: var(--text-dim);
  font-weight: 500;
}

/* ── Creditors ── */
.creditors-group {
  margin-bottom: 1.5rem;
}

.creditors-group table {
  table-layout: fixed;
  width: 100%;
}

.creditors-group table th:nth-child(1),
.creditors-group table td:nth-child(1) { width: 45%; }

.creditors-group table th:nth-child(2),
.creditors-group table td:nth-child(2) { width: 35%; }

.creditors-group table th:nth-child(3),
.creditors-group table td:nth-child(3) { width: 20%; text-align: right; }

.due-date-input {
  padding: 4px 8px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg);
  color: var(--text);
  font-size: 0.8rem;
  font-family: inherit;
  transition: border-color 0.2s;
  cursor: pointer;
  width: 60px;
}

.due-date-input:focus {
  outline: none;
  border-color: rgba(108,143,255,0.5);
  box-shadow: 0 0 0 3px rgba(108,143,255,0.1);
}

.due-date-input option {
  background: var(--bg);
  color: var(--text);
}

/* ── Trends ── */
.trends-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-template-rows: auto auto;
  gap: 14px;
}

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

.trends-grid canvas {
  width: 100%;
  display: block;
}

/* ── Generic table (Credit Cards form) ── */
table {
  width: 100%;
  border-collapse: collapse;
  background: var(--surface);
  backdrop-filter: blur(12px);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

th {
  text-align: left;
  padding: 0.75rem 1rem;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-dim);
  background: rgba(255, 255, 255, 0.03);
  border-bottom: 1px solid var(--border);
}

td {
  text-align: left;
  padding: 0.7rem 1rem;
  font-size: 0.9rem;
  border-bottom: 1px solid var(--border);
}

tr:last-child td {
  border-bottom: none;
}

td button {
  border: none;
  background: none;
  color: var(--text-dim);
  cursor: pointer;
  font-size: 0.85rem;
  opacity: 0.5;
  transition: opacity 0.15s, color 0.15s;
}

td button:hover {
  opacity: 1;
  color: var(--danger);
  text-decoration: none;
}

/* ── Login overlay ── */
.login-overlay {
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  background: var(--bg);
  background-image:
    radial-gradient(ellipse 80% 50% at 20% -10%, rgba(108, 143, 255, 0.10) 0%, transparent 60%),
    radial-gradient(ellipse 60% 40% at 80% 110%, rgba(74, 222, 128, 0.06) 0%, transparent 60%);
  z-index: 9999;
}

.login-card {
  background: var(--surface);
  border: 1px solid var(--border-bright);
  border-radius: var(--radius);
  padding: 2.5rem 2.25rem;
  width: 100%;
  max-width: 380px;
  box-shadow: 0 24px 80px rgba(0,0,0,0.5);
}

.login-logo {
  font-size: 1.75rem;
  font-weight: 700;
  margin: 0 0 2rem;
  background: linear-gradient(90deg, var(--accent) 0%, #a78bfa 50%, var(--accent) 100%);
  background-size: 200%;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  animation: logo-shimmer 3s linear infinite;
  text-align: center;
}

.login-field {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  margin-bottom: 1.1rem;
}

.login-field label {
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.login-field input {
  background: var(--surface-2);
  border: 1px solid var(--border-bright);
  border-radius: 8px;
  color: var(--text);
  font-size: 0.95rem;
  padding: 0.6rem 0.85rem;
  width: 100%;
  outline: none;
  transition: border-color 0.15s;
}

.login-field input:focus {
  border-color: var(--accent);
}

.login-error {
  color: var(--danger);
  font-size: 0.85rem;
  margin: -0.4rem 0 0.9rem;
}

.login-btn {
  width: 100%;
  padding: 0.65rem;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 8px;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.15s;
  margin-top: 0.4rem;
}

.login-btn:hover { opacity: 0.88; }

.logout-btn {
  display: block;
  width: 100%;
  margin-top: 1rem;
  padding: 0.45rem 0;
  background: transparent;
  border: 1px solid var(--border-bright);
  border-radius: 8px;
  color: var(--text-dim);
  font-size: 0.8rem;
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s;
}
.logout-btn:hover { color: var(--text); border-color: var(--accent); }

/* ── Mobile header ── */
.mobile-header {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 56px;
  background: #0e1120;
  border-bottom: 1px solid var(--border);
  align-items: center;
  padding: 0 1rem;
  gap: 1rem;
  z-index: 200;
}

.mobile-logo {
  font-size: 1rem;
  font-weight: 800;
  background: linear-gradient(120deg, #a8c0ff, #6c8fff, #a78bfa, #38bdf8, #a8c0ff);
  background-size: 300% 300%;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  animation: logo-shimmer 4s ease infinite;
}

.hamburger {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 36px;
  height: 36px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px;
  flex-shrink: 0;
}

.hamburger span {
  display: block;
  height: 2px;
  background: var(--text);
  border-radius: 2px;
  transition: transform 0.25s, opacity 0.25s;
}

.hamburger.open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.hamburger.open span:nth-child(2) { opacity: 0; }
.hamburger.open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* Sidebar overlay backdrop */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.55);
  z-index: 149;
}
.sidebar-overlay.open { display: block; }

/* ── Responsive breakpoint ── */
@media (max-width: 768px) {
  .mobile-header { display: flex; }

  .layout { flex-direction: column; padding-top: 56px; }

  /* Sidebar becomes a fixed drawer */
  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: 260px;
    z-index: 150;
    transform: translateX(-100%);
    transition: transform 0.28s cubic-bezier(0.4, 0, 0.2, 1);
    padding-top: 4rem;
  }

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

  /* Content takes full width */
  .content { padding: 1.25rem 1rem; }

  /* Metric cards: 1 column on very small, 2 on medium */
  .metric-cards {
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-bottom: 1.25rem;
  }

  .metric-value { font-size: 1.25rem; }

  /* Overview grid: single column */
  .overview-grid { grid-template-columns: 1fr; }

  /* Budget columns: single column */
  .budget-columns { grid-template-columns: 1fr; }

  /* Trends grid: single column */
  .trends-grid { grid-template-columns: 1fr !important; }

  /* Page header: wrap onto two lines */
  .page-header {
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 1rem;
  }

  .page-header-actions { margin-left: 0; width: 100%; }

  /* Forms: stack vertically */
  .inline-form {
    flex-direction: column;
    gap: 0.5rem;
  }

  .inline-form input,
  .inline-form select {
    width: 100%;
  }

  .inline-form button { width: 100%; }

  /* Tables: horizontal scroll */
  .creditors-group,
  #past-paychecks-list,
  .paycheck-table { display: block; overflow-x: auto; -webkit-overflow-scrolling: touch; }

  /* Paycheck cards full width with tighter padding */
  .paycheck-card { padding: 1rem; }

  /* Side calc column */
  .side-calc-col { grid-template-columns: 1fr; }

  /* Content h2 smaller on mobile */
  .content h2 { font-size: 1.4rem; margin-bottom: 1rem; }

  /* Credit card grid */
  .card-grid { grid-template-columns: 1fr !important; }
}

@media (max-width: 400px) {
  .metric-cards { grid-template-columns: 1fr; }
}

/* ── Creditors mobile ── */
@media (max-width: 768px) {
  .creditors-group table {
    table-layout: auto;
    min-width: 420px;
  }

  .creditors-group table th,
  .creditors-group table td {
    width: auto !important;
    white-space: nowrap;
    padding: 10px 12px;
  }
}

@media (max-width: 768px) {
  /* Creditors: card layout per row */
  .creditors-group table,
  .creditors-group thead,
  .creditors-group tbody,
  .creditors-group tr,
  .creditors-group td {
    display: block;
    width: 100% !important;
    min-width: unset !important;
    white-space: normal !important;
  }

  .creditors-group thead { display: none; }

  .creditors-group tr {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--border);
  }

  .creditors-group tr:last-child { border-bottom: none; }

  /* Bill name row */
  .creditors-group td:nth-child(1) {
    font-weight: 600;
    font-size: 0.9rem;
    padding: 0 0 0.4rem 0;
    border: none;
  }

  /* Due day row */
  .creditors-group td:nth-child(2) {
    padding: 0 0 0.5rem 0;
    border: none;
    font-size: 0.85rem;
  }

  .creditors-group td:nth-child(2) .due-date-input {
    width: auto;
  }

  /* Actions row */
  .creditors-group td:nth-child(3) {
    padding: 0;
    border: none;
    text-align: left !important;
  }
}
