:root {
  color-scheme: dark;
  --bg: #080a12;
  --panel: #101421;
  --panel-2: #151a2a;
  --panel-3: #0d111d;
  --line: rgba(255, 255, 255, 0.09);
  --soft-line: rgba(255, 255, 255, 0.06);
  --text: #f4f7fb;
  --muted: #96a0b5;
  --faint: #687389;
  --indigo: #7c8cff;
  --indigo-2: #4f46e5;
  --cyan: #26d3ee;
  --green: #37d399;
  --red: #fb7185;
  --amber: #fbbf24;
  --radius: 8px;
  --shadow: 0 22px 70px rgba(0, 0, 0, 0.34);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  width: 100%;
  overflow-x: hidden;
}

body {
  margin: 0;
  width: 100%;
  min-height: 100vh;
  overflow-x: hidden;
  background:
    radial-gradient(circle at top left, rgba(79, 70, 229, 0.22), transparent 34rem),
    linear-gradient(135deg, #080a12 0%, #0d111d 44%, #090b13 100%);
  color: var(--text);
}

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

button {
  cursor: pointer;
}

.app {
  width: 100%;
  max-width: 100vw;
  min-height: 100vh;
  display: grid;
  grid-template-columns: 236px minmax(0, 1fr);
  overflow-x: hidden;
}

.sidebar {
  min-width: 0;
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 26px 18px;
  border-right: 1px solid var(--line);
  background: rgba(8, 10, 18, 0.74);
  backdrop-filter: blur(24px);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 28px;
  padding: 0 8px;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 8px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: 0 14px 38px rgba(20, 184, 166, 0.22);
}

.brand-mark img {
  width: 35px;
  height: 35px;
  object-fit: contain;
}

.brand-title {
  margin: 0;
  font-size: 18px;
  line-height: 1.1;
}

.brand-subtitle {
  margin: 3px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.sidebar-logo {
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 14px 0 0;
  padding: 10px 12px;
  border: 1px solid rgba(255, 255, 255, 0.78);
  border-radius: var(--radius);
  background: linear-gradient(180deg, #ffffff, #eef3fb);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.22);
}

.sidebar-logo img {
  display: block;
  width: 100%;
  max-width: 100%;
  height: auto;
}

.wordmark-logo img {
  max-width: 172px;
}

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

.nav-group {
  display: grid;
  gap: 7px;
  padding: 10px;
  border: 1px solid var(--soft-line);
  border-radius: var(--radius);
}

.nav-group + .nav-group {
  margin-top: 0;
}

.banking-group {
  --section-accent: var(--indigo);
  --section-accent-2: var(--cyan);
  border-color: rgba(124, 140, 255, 0.18);
  background: linear-gradient(180deg, rgba(124, 140, 255, 0.1), rgba(124, 140, 255, 0.025));
}

.credit-group {
  --section-accent: var(--green);
  --section-accent-2: #2dd4bf;
  border-color: rgba(55, 211, 153, 0.18);
  background: linear-gradient(180deg, rgba(55, 211, 153, 0.1), rgba(45, 212, 191, 0.025));
}

.nav-group summary {
  cursor: pointer;
  list-style: none;
  padding: 4px 6px 8px;
  color: var(--section-accent);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.nav-group summary::-webkit-details-marker {
  display: none;
}

.nav-button {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 11px;
  min-height: 44px;
  padding: 0 12px;
  border: 1px solid transparent;
  border-radius: var(--radius);
  background: transparent;
  color: var(--muted);
  text-align: left;
}

.nav-button:hover,
.nav-button.active {
  color: var(--text);
  background: rgba(124, 140, 255, 0.12);
  border-color: rgba(124, 140, 255, 0.18);
}

.credit-group .nav-button:hover,
.credit-group .nav-button.active {
  background: rgba(55, 211, 153, 0.12);
  border-color: rgba(55, 211, 153, 0.22);
}

.banking-group .nav-button:hover,
.banking-group .nav-button.active {
  background: rgba(124, 140, 255, 0.12);
  border-color: rgba(124, 140, 255, 0.2);
}

.nav-button.active .nav-icon {
  color: var(--section-accent-2);
}

.nav-icon {
  width: 24px;
  text-align: center;
}

.side-note {
  margin-top: 28px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.035);
}

.side-note p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.main {
  min-width: 0;
  width: 100%;
  overflow-x: hidden;
  padding: 28px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 24px;
  min-width: 0;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(3, 6, 15, 0.72);
  backdrop-filter: blur(14px);
  animation: resultIn 180ms ease both;
}

.modal-card {
  width: min(520px, 100%);
  padding: 20px;
  border: 1px solid rgba(124, 140, 255, 0.26);
  border-radius: var(--radius);
  background: linear-gradient(180deg, rgba(21, 26, 42, 0.98), rgba(13, 17, 29, 0.98));
  box-shadow: var(--shadow);
}

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

.modal-field span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 16px;
}

.topbar > div {
  min-width: 0;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--indigo);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

h1 {
  margin: 0;
  font-size: clamp(28px, 4vw, 42px);
  line-height: 1.02;
  letter-spacing: 0;
  overflow-wrap: anywhere;
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
  min-width: 0;
  max-width: 100%;
}

.pill,
.primary,
.ghost,
.danger {
  min-height: 40px;
  padding: 0 14px;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  color: var(--text);
  background: rgba(255, 255, 255, 0.045);
}

.primary {
  border: 0;
  background: linear-gradient(135deg, var(--indigo), var(--indigo-2));
  box-shadow: 0 14px 32px rgba(79, 70, 229, 0.26);
}

.mock-disabled,
button:disabled {
  cursor: not-allowed;
  color: var(--faint);
  border-color: rgba(255, 255, 255, 0.06);
  background: rgba(255, 255, 255, 0.025);
  opacity: 0.58;
  box-shadow: none;
}

input:disabled,
select:disabled,
textarea:disabled {
  cursor: not-allowed;
  color: var(--muted);
  border-color: rgba(255, 255, 255, 0.07);
  background: rgba(255, 255, 255, 0.035);
  opacity: 0.72;
}

.danger {
  color: #ffd8df;
  border-color: rgba(251, 113, 133, 0.3);
  background: rgba(251, 113, 133, 0.08);
}

.view {
  display: none;
}

.view.active {
  display: block;
}

.grid {
  display: grid;
  gap: 18px;
  min-width: 0;
}

.dashboard-grid {
  grid-template-columns: minmax(0, 1.2fr) minmax(320px, 0.8fr);
}

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

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

.card {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(16, 20, 33, 0.82);
  box-shadow: var(--shadow);
}

.card-inner {
  padding: 20px;
}

.balance-card {
  min-height: 260px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  overflow: hidden;
  background:
    linear-gradient(135deg, rgba(124, 140, 255, 0.98), rgba(79, 70, 229, 0.9) 48%, rgba(38, 211, 238, 0.74)),
    radial-gradient(circle at 80% 10%, rgba(255, 255, 255, 0.36), transparent 18rem);
}

.credit-card-hero {
  min-height: 260px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  overflow: hidden;
  background:
    linear-gradient(135deg, rgba(17, 24, 39, 0.98), rgba(79, 70, 229, 0.86) 54%, rgba(55, 211, 153, 0.72)),
    radial-gradient(circle at 78% 18%, rgba(255, 255, 255, 0.28), transparent 17rem);
}

.balance-card .card-inner {
  position: relative;
  z-index: 1;
}

.credit-card-hero .card-inner {
  position: relative;
  z-index: 1;
}

.balance-label,
.small-label {
  margin: 0 0 9px;
  color: rgba(255, 255, 255, 0.76);
  font-size: 13px;
}

.balance-value {
  margin: 0;
  font-size: clamp(38px, 7vw, 64px);
  line-height: 1;
}

.balance-meta {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  margin-top: 34px;
}

.balance-meta strong {
  display: block;
  font-size: 22px;
}

.metric {
  padding: 18px;
}

.metric p {
  margin: 0 0 10px;
  color: var(--muted);
  font-size: 13px;
}

.metric strong {
  display: block;
  font-size: 24px;
}

.metric span {
  display: block;
  margin-top: 8px;
  color: var(--faint);
  font-size: 12px;
}

.category-breakdown {
  display: grid;
  gap: 10px;
}

.category-breakdown-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 12px;
  border: 1px solid var(--soft-line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.035);
}

.category-breakdown-row span {
  color: var(--muted);
}

.budget-pie-view {
  display: grid;
  grid-template-columns: minmax(180px, 0.7fr) minmax(240px, 1.3fr);
  gap: 18px;
  align-items: center;
}

.budget-pie {
  width: min(260px, 100%);
  aspect-ratio: 1;
  border: 1px solid var(--soft-line);
  border-radius: 50%;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.08), var(--shadow);
}

.budget-total-card {
  display: grid;
  gap: 3px;
  padding: 12px;
  border: 1px solid var(--soft-line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.04);
}

.budget-total-card span,
.category-breakdown-row i + * {
  color: var(--muted);
}

.category-breakdown-row i {
  display: inline-block;
  width: 10px;
  height: 10px;
  margin-right: 8px;
  border-radius: 50%;
}

.budget-histogram {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(74px, 1fr));
  gap: 12px;
  min-height: 300px;
  align-items: end;
}

.histogram-bar {
  display: grid;
  gap: 8px;
  min-width: 0;
  text-align: center;
}

.histogram-track {
  display: flex;
  align-items: end;
  justify-content: center;
  height: 190px;
  padding: 8px;
  border: 1px solid var(--soft-line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.035);
}

.histogram-track span {
  width: 100%;
  min-height: 4px;
  border-radius: 6px 6px 2px 2px;
}

.histogram-bar strong {
  font-size: 12px;
}

.histogram-bar small {
  min-height: 32px;
  color: var(--muted);
  font-size: 11px;
  overflow-wrap: anywhere;
}

.budget-bubble-wrap {
  overflow-x: auto;
}

.budget-bubble-chart {
  width: 100%;
  min-width: 620px;
  height: auto;
}

.budget-gantt {
  display: grid;
  gap: 10px;
}

.gantt-row {
  display: grid;
  grid-template-columns: minmax(150px, 0.9fr) minmax(180px, 1.3fr) 56px;
  gap: 12px;
  align-items: center;
  padding: 12px;
  border: 1px solid var(--soft-line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.035);
}

.gantt-row div:first-child {
  display: grid;
  gap: 4px;
}

.gantt-row span,
.gantt-row em {
  color: var(--muted);
  font-size: 12px;
  font-style: normal;
}

.gantt-track {
  height: 12px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
}

.gantt-track span {
  display: block;
  height: 100%;
  border-radius: inherit;
}

.gantt-row .over-budget {
  color: #ff9aaa;
}

.compact-budget-list {
  max-height: 360px;
  overflow: auto;
  padding-right: 4px;
}

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

.section-head h2,
.panel-title {
  margin: 0;
  font-size: 18px;
}

.section-head p {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.section-actions {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.segments {
  display: flex;
  gap: 6px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.035);
}

.segment {
  min-height: 32px;
  padding: 0 10px;
  border: 0;
  border-radius: 6px;
  color: var(--muted);
  background: transparent;
}

.segment.active {
  color: var(--text);
  background: rgba(124, 140, 255, 0.22);
}

.chart-wrap {
  height: 310px;
}

.chart {
  width: 100%;
  height: 100%;
  overflow: visible;
}

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

.summary {
  display: grid;
  gap: 12px;
}

.summary-item {
  padding: 14px;
  border: 1px solid var(--soft-line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.035);
}

.summary-item strong {
  display: block;
  margin-bottom: 6px;
}

.summary-item p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.table-wrap {
  width: 100%;
  max-width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

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

th,
td {
  padding: 14px 12px;
  border-bottom: 1px solid var(--soft-line);
  text-align: left;
  font-size: 14px;
}

th {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
}

td {
  color: #dfe6f5;
}

.pinned-filter-row td {
  background: rgba(55, 211, 153, 0.055);
}

.merchant-cell {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.merchant-cell span {
  min-width: 0;
  overflow-wrap: anywhere;
}

.merchant-edit-button {
  min-height: 30px;
  padding: 0 8px;
  opacity: 0;
  transform: translateX(-4px);
  transition: opacity 160ms ease, transform 160ms ease;
}

tr:hover .merchant-edit-button,
.merchant-edit-button:focus-visible {
  opacity: 1;
  transform: translateX(0);
}

@media (hover: none) {
  .merchant-edit-button {
    opacity: 1;
    transform: none;
  }
}

.merchant-edit-row {
  display: grid;
  grid-template-columns: minmax(160px, 1fr) auto auto;
  gap: 8px;
  align-items: center;
  min-width: 360px;
}

.merchant-edit-field {
  min-height: 36px;
}

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

.amount.negative {
  color: #ff9aaa;
}

.category-select,
.field,
textarea {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--text);
  background: rgba(255, 255, 255, 0.055);
}

.category-select,
.field {
  padding: 0 12px;
}

textarea {
  min-height: 190px;
  padding: 12px;
  resize: vertical;
  line-height: 1.5;
}

.upload-box {
  display: grid;
  gap: 16px;
  padding: 20px;
  border: 1px dashed rgba(124, 140, 255, 0.35);
  border-radius: var(--radius);
  background: rgba(124, 140, 255, 0.06);
}

.compact-upload {
  margin-bottom: 14px;
  padding: 14px;
}

.upload-result {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 14px;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  animation: resultIn 340ms ease both;
}

.upload-result strong {
  display: block;
  margin-bottom: 6px;
}

.upload-result p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.upload-result.success {
  border-color: rgba(55, 211, 153, 0.35);
  background: rgba(55, 211, 153, 0.1);
}

.upload-result.warning {
  border-color: rgba(251, 191, 36, 0.34);
  background: rgba(251, 191, 36, 0.09);
}

.upload-result.error {
  border-color: rgba(251, 113, 133, 0.36);
  background: rgba(251, 113, 133, 0.1);
}

.result-icon {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  width: 34px;
  height: 34px;
  border-radius: 999px;
  color: #04130d;
  font-weight: 900;
  background: var(--green);
  box-shadow: 0 0 0 0 rgba(55, 211, 153, 0.5);
  animation: checkPop 720ms ease both;
}

.upload-result.warning .result-icon {
  color: #1b1200;
  background: var(--amber);
  box-shadow: 0 0 0 0 rgba(251, 191, 36, 0.44);
}

.upload-result.error .result-icon {
  color: #210007;
  background: var(--red);
  box-shadow: 0 0 0 0 rgba(251, 113, 133, 0.42);
}

.upload-actions,
.form-row {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

.helper {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.55;
}

.mode-notice {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 18px;
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.045);
  color: var(--muted);
}

.mode-notice strong {
  color: var(--text);
}

.demo-notice {
  border-color: rgba(55, 211, 153, 0.26);
  background: rgba(55, 211, 153, 0.08);
}

.empty-notice {
  border-color: rgba(251, 191, 36, 0.28);
  background: rgba(251, 191, 36, 0.08);
}

.empty-state {
  display: grid;
  place-items: center;
  min-height: 220px;
  padding: 28px;
  border: 1px dashed rgba(124, 140, 255, 0.28);
  border-radius: var(--radius);
  background: rgba(124, 140, 255, 0.055);
  text-align: center;
}

.empty-state strong {
  font-size: 18px;
}

.empty-state p {
  max-width: 420px;
  margin: 8px 0 0;
  color: var(--muted);
  line-height: 1.5;
}

.read-only-demo-panel {
  min-height: 260px;
  border-color: rgba(55, 211, 153, 0.28);
  background:
    radial-gradient(circle at 20% 0%, rgba(38, 211, 238, 0.12), transparent 18rem),
    rgba(55, 211, 153, 0.055);
}

.read-only-demo-panel strong {
  font-size: 24px;
}

.compact-empty {
  min-height: 112px;
  margin-top: 6px;
}

.budget-list,
.goal-list {
  display: grid;
  gap: 14px;
}

.goal-row {
  display: grid;
  grid-template-columns: minmax(220px, 0.75fr) minmax(360px, 1.25fr) auto;
  gap: 14px;
  align-items: center;
  padding: 14px;
  border: 1px solid var(--soft-line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.035);
}

.goal-progress {
  display: grid;
  gap: 8px;
}

.goal-fields {
  display: grid;
  grid-template-columns: minmax(160px, 1.2fr) repeat(4, minmax(120px, 0.8fr));
  gap: 10px;
}

.goal-fields label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.goal-fields label span {
  text-transform: uppercase;
}

.money-input {
  position: relative;
}

.money-input span {
  position: absolute;
  left: 12px;
  top: 50%;
  z-index: 1;
  transform: translateY(-50%);
  color: var(--muted);
  font-weight: 800;
}

.money-input input {
  padding-left: 28px;
}

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

.reset-grid {
  display: grid;
  gap: 12px;
}

.reset-option {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 14px;
  align-items: center;
  padding: 14px;
  border: 1px solid var(--soft-line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.035);
}

.reset-option strong {
  display: block;
  margin-bottom: 4px;
  font-size: 16px;
}

.reset-option p {
  margin: 0;
  color: var(--muted);
  line-height: 1.45;
}

.category-editor,
.rule-list {
  display: grid;
  gap: 12px;
}

.rule-suggestions {
  display: grid;
  gap: 10px;
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid var(--soft-line);
}

.compact-section-head {
  margin-bottom: 4px;
}

.rule-suggestion-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(160px, 0.7fr) auto;
  gap: 12px;
  align-items: center;
  padding: 12px;
  border: 1px solid rgba(55, 211, 153, 0.14);
  border-radius: var(--radius);
  background: rgba(55, 211, 153, 0.055);
}

.rule-suggestion-row strong {
  display: block;
  margin-bottom: 4px;
}

.rule-suggestion-row p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
}

.suggestion-category-select {
  min-height: 38px;
}

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

.upload-history {
  display: grid;
  gap: 10px;
}

.history-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  padding: 12px;
  border: 1px solid var(--soft-line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.035);
  animation: historyIn 360ms ease both;
}

.history-row strong {
  display: block;
  margin-bottom: 4px;
}

.history-row p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
}

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

.status-pill {
  position: relative;
  overflow: hidden;
  white-space: nowrap;
  padding: 8px 12px;
  border: 1px solid var(--soft-line);
  border-radius: 999px;
  color: var(--muted);
  background: rgba(124, 140, 255, 0.1);
}

.status-pill.imported {
  color: #b8f7dc;
  border-color: rgba(55, 211, 153, 0.34);
  background: rgba(55, 211, 153, 0.12);
}

.status-pill.imported::after {
  content: "";
  position: absolute;
  inset: 0;
  width: 45%;
  transform: translateX(-140%) skewX(-18deg);
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.22), transparent);
  animation: pillShine 1.4s ease 260ms 1;
}

.category-row,
.rule-row {
  display: grid;
  grid-template-columns: 44px minmax(150px, 1fr) 110px minmax(110px, 0.7fr) auto auto auto auto;
  gap: 10px;
  align-items: center;
  padding: 12px;
  border: 1px solid var(--soft-line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.035);
}

.rule-row {
  grid-template-columns: minmax(150px, 1fr) 24px minmax(140px, 0.7fr) auto auto auto;
}

.color-field {
  width: 44px;
  height: 42px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.055);
}

.compact-field {
  min-width: 0;
}

.inline-field-label {
  display: grid;
  gap: 5px;
  min-width: 0;
}

.inline-field-label span {
  color: var(--muted);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.inline-field-label .field {
  margin-bottom: 0;
}

.budget-field {
  max-width: 130px;
}

.category-spend {
  display: grid;
  gap: 3px;
}

.category-spend span {
  color: var(--text);
  font-weight: 700;
}

.category-spend small,
.match-pill {
  color: var(--muted);
  font-size: 12px;
}

.match-pill {
  white-space: nowrap;
  padding: 8px 10px;
  border: 1px solid var(--soft-line);
  border-radius: 999px;
  background: rgba(124, 140, 255, 0.1);
}

.rule-arrow {
  color: var(--indigo);
  text-align: center;
  font-weight: 800;
}

.icon-button {
  min-height: 36px;
  padding: 0 10px;
}

.promoted-button {
  color: #b8f7dc;
  border-color: rgba(55, 211, 153, 0.34);
  background: rgba(55, 211, 153, 0.1);
}

.rule-save-button,
.rules-save-button {
  min-height: 36px;
  white-space: nowrap;
  transition: background 180ms ease, border-color 180ms ease, color 180ms ease, transform 180ms ease;
}

.rule-save-button:disabled,
.rules-save-button:disabled {
  cursor: not-allowed;
  opacity: 0.48;
}

.inline-rule-editor {
  display: grid;
  grid-template-columns: minmax(120px, 1fr) auto auto;
  gap: 8px;
  align-items: center;
  min-width: 320px;
}

.rule-keyword-field {
  min-height: 36px;
}

.rule-save-button.saved,
.rules-save-button.saved {
  color: #b8f7dc;
  border-color: rgba(55, 211, 153, 0.46);
  background: rgba(55, 211, 153, 0.16);
  transform: translateY(-1px);
  animation: savedPulse 620ms ease both;
}

.category-rule-notice {
  margin-top: 0;
}

.rule-save-notice {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
  padding: 12px 14px;
  border: 1px solid rgba(55, 211, 153, 0.34);
  border-radius: var(--radius);
  background: rgba(55, 211, 153, 0.1);
  animation: resultIn 260ms ease both;
}

.rule-save-notice span {
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border-radius: 999px;
  color: #04130d;
  font-weight: 900;
  background: var(--green);
}

.rule-save-notice strong {
  white-space: nowrap;
}

.rule-save-notice p {
  margin: 0;
  color: var(--muted);
}

.search-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  margin-bottom: 14px;
}

.transaction-filter-bar {
  display: grid;
  grid-template-columns: minmax(100px, 0.8fr) minmax(150px, 1.2fr) minmax(150px, 1.2fr) minmax(160px, 1fr) minmax(100px, 0.7fr) auto auto;
  gap: 10px;
  align-items: center;
  margin-bottom: 14px;
  padding: 12px;
  border: 1px solid var(--soft-line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.035);
}

.filter-count {
  color: var(--muted);
  font-size: 13px;
  white-space: nowrap;
}

.new-category-row {
  border-color: rgba(55, 211, 153, 0.42);
  background: rgba(55, 211, 153, 0.08);
  animation: categoryFocus 900ms ease both;
}

.rule-actions {
  margin-top: 16px;
}

.hidden-categories {
  margin-top: 16px;
  border-top: 1px solid var(--soft-line);
  padding-top: 14px;
}

.hidden-categories summary {
  color: var(--muted);
  cursor: pointer;
  font-weight: 700;
}

.hidden-list {
  margin-top: 12px;
  max-height: 520px;
  overflow: auto;
  padding-right: 4px;
}

.category-note {
  margin-top: 14px;
}

.progress-row {
  display: grid;
  gap: 8px;
}

.progress-label {
  display: flex;
  justify-content: space-between;
  color: var(--muted);
  font-size: 13px;
}

.progress {
  height: 10px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
}

.progress span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--indigo), var(--cyan));
}

.mobile-menu {
  display: none;
}

@keyframes resultIn {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes checkPop {
  0% {
    opacity: 0;
    transform: scale(0.72);
    box-shadow: 0 0 0 0 rgba(55, 211, 153, 0.5);
  }
  58% {
    opacity: 1;
    transform: scale(1.12);
    box-shadow: 0 0 0 12px rgba(55, 211, 153, 0);
  }
  100% {
    transform: scale(1);
  }
}

@keyframes historyIn {
  from {
    opacity: 0;
    transform: translateX(12px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes pillShine {
  to {
    transform: translateX(260%) skewX(-18deg);
  }
}

@keyframes savedPulse {
  0% {
    box-shadow: 0 0 0 0 rgba(55, 211, 153, 0.4);
  }
  100% {
    box-shadow: 0 0 0 10px rgba(55, 211, 153, 0);
  }
}

@keyframes categoryFocus {
  0% {
    box-shadow: 0 0 0 0 rgba(55, 211, 153, 0.46);
    transform: translateY(8px);
  }
  100% {
    box-shadow: 0 0 0 12px rgba(55, 211, 153, 0);
    transform: translateY(0);
  }
}

@media (max-width: 1180px) {
  .topbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .top-actions {
    width: 100%;
    justify-content: flex-start;
  }
}

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

  .sidebar {
    position: static;
    height: auto;
    padding: 16px;
    overflow: hidden;
  }

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

  .nav-group {
    align-content: start;
    padding: 8px;
  }

  .nav-button {
    justify-content: center;
    padding: 0 8px;
  }

  .side-note,
  .sidebar-logo {
    display: none;
  }

  .main {
    padding: 18px;
  }

  .dashboard-grid,
  .two-grid,
  .metrics-grid,
  .budget-pie-view,
  .gantt-row {
    grid-template-columns: 1fr;
  }

  .category-row,
  .rule-row,
  .rule-suggestion-row,
  .goal-row,
  .goal-fields,
  .reset-option {
    grid-template-columns: 1fr;
  }

  .color-field,
  .budget-field {
    width: 100%;
    max-width: none;
  }
}

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

  .topbar,
  .section-head,
  .balance-meta {
    align-items: flex-start;
    flex-direction: column;
  }

  .nav {
    display: flex;
    overflow-x: auto;
    padding-bottom: 2px;
  }

  .nav-button {
    min-width: 118px;
    flex: 0 0 auto;
    justify-content: flex-start;
  }

  .nav-label {
    display: inline;
    font-size: 13px;
    line-height: 1.1;
  }

  .segments {
    width: 100%;
    overflow-x: auto;
  }

  .top-actions,
  .upload-actions,
  .form-row,
  .section-actions,
  .modal-actions,
  .search-row,
  .transaction-filter-bar,
  .inline-rule-editor,
  .merchant-edit-row {
    width: 100%;
    grid-template-columns: 1fr;
  }

  .history-row,
  .history-actions {
    align-items: flex-start;
    flex-direction: column;
  }

  .merchant-edit-button {
    opacity: 1;
    transform: none;
  }

  .top-actions button,
  .upload-actions button,
  .form-row button,
  .section-actions button,
  .modal-actions button,
  .suggestion-actions button,
  .goal-actions button,
  .reset-option button {
    width: 100%;
  }

  .card-inner {
    padding: 16px;
  }

  .chart-wrap {
    height: 250px;
  }
}

@media (max-width: 420px) {
  .sidebar {
    padding: 12px;
  }

  .brand {
    padding: 0;
  }

  .main {
    padding: 10px;
  }

  .pill,
  .primary,
  .ghost,
  .danger {
    padding: 0 10px;
  }
}
