:root {
  color-scheme: light;
  --bg: #fff7db;
  --panel: #fffdf6;
  --text: #18212f;
  --muted: #657085;
  --line: #ecdca8;
  --brand: #2e6cf6;
  --danger: #dd4b39;
  --ok: #198754;
  --shadow: 0 10px 30px rgba(120, 96, 24, 0.08);
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--text);
  background: var(--bg);
}

.app-shell {
  max-width: 1280px;
  margin: 0 auto;
  padding: 24px;
}

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

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

h1 {
  margin: 0;
  font-size: 32px;
}

.subtitle {
  margin: 8px 0 0;
  color: var(--muted);
}

.primary-btn, .tab-btn {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--text);
  border-radius: 12px;
  padding: 10px 14px;
  font-weight: 600;
  cursor: pointer;
}

input, select, textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 11px 12px;
  font: inherit;
  color: var(--text);
  background: #fff;
}

textarea {
  resize: vertical;
}

.primary-btn {
  background: linear-gradient(180deg, #da6a05 0%, #c85a00 100%);
  color: #fff;
  border-color: #c85a00;
  border-radius: 999px;
  padding: 12px 22px;
  font-weight: 800;
  box-shadow: 0 8px 18px rgba(200, 90, 0, 0.22);
}

.primary-btn:hover {
  filter: brightness(1.03);
}

.primary-btn:active {
  transform: translateY(1px);
}

.secondary-tone-btn {
  background: #fff3d8;
  color: #9a5f00;
  border-color: #f2d9a0;
  box-shadow: none;
}

.module-tabs {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 18px;
}

.tab-btn {
  background: #eef6ff;
  border-color: #c7daf8;
  color: #24508f;
  border-radius: 18px;
  padding: 12px 22px;
  font-weight: 700;
  box-shadow: 0 4px 12px rgba(70, 112, 184, 0.08);
}

.tab-btn.is-active {
  background: linear-gradient(180deg, #d9ecff 0%, #cfe5ff 100%);
  border-color: #9fc4ef;
  color: #163f78;
}

.status-banner {
  margin-bottom: 18px;
  padding: 12px 14px;
  border-radius: 14px;
  background: #eef4ff;
  color: #244794;
  border: 1px solid #d8e5ff;
}

.panel { display: none; }
.panel.is-active { display: block; }

.metrics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
  margin-bottom: 18px;
}

.metric-card, .card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 18px;
  box-shadow: var(--shadow);
}

.hero-card {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  align-items: flex-start;
  margin-bottom: 18px;
  background: linear-gradient(135deg, #f8fbff 0%, #eef4ff 100%);
}

.hero-label {
  margin: 0 0 8px;
  color: var(--brand);
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.hero-title {
  margin: 0;
  font-size: 28px;
  line-height: 1.2;
}

.hero-subtitle {
  margin: 10px 0 0;
  color: var(--muted);
  max-width: 760px;
}

.hero-side {
  min-width: 240px;
  display: grid;
  gap: 10px;
}

.hero-stat {
  padding: 14px;
  border-radius: 16px;
  background: rgba(255,255,255,0.9);
  border: 1px solid #dbe6ff;
}

.hero-stat-label {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  margin-bottom: 4px;
  text-transform: uppercase;
}

.hero-stat-value {
  font-size: 20px;
  font-weight: 800;
}

.metric-label {
  margin: 0 0 10px;
  color: var(--muted);
  font-weight: 600;
}

.metric-value {
  font-size: 30px;
  font-weight: 800;
}

.home-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 16px;
}

.home-grid-bottom {
  margin-top: 16px;
}

.report-filter-stack {
  display: grid;
  gap: 10px;
  margin-bottom: 14px;
}

.search-stack {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 700;
}

.search-input {
  width: 100%;
}

.filter-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.compact-filter-row {
  gap: 8px;
}

.compact-filter-row .filter-chip {
  padding: 7px 12px;
  font-size: 13px;
}

.filter-chip {
  border: 1px solid #c7daf8;
  background: #eef6ff;
  color: #24508f;
  border-radius: 999px;
  padding: 9px 14px;
  font-weight: 700;
  cursor: pointer;
}

.filter-chip.is-active {
  background: #cfe5ff;
  border-color: #9fc4ef;
  color: #163f78;
}

.report-overview {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 14px;
}

.report-stat {
  padding: 16px;
  border-radius: 16px;
  background: #f8fbff;
  border: 1px solid #dbe6ff;
  cursor: pointer;
}

.report-stat:hover {
  border-color: #9fc4ef;
  box-shadow: 0 8px 18px rgba(70, 112, 184, 0.08);
}

.report-stat-sub.is-hint {
  color: #24508f;
  font-weight: 700;
}

.report-stat-label {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  margin-bottom: 6px;
}

.report-stat-value {
  font-size: 28px;
  font-weight: 800;
}

.report-stat-sub {
  margin-top: 6px;
  color: var(--muted);
  font-size: 13px;
}

.debt-item {
  padding: 14px;
  border-radius: 16px;
  background: #fffaf0;
  border: 1px solid var(--line);
}

.debt-item-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
  flex-wrap: wrap;
}

.debt-item-title {
  font-size: 18px;
  font-weight: 800;
}

.debt-status-pill {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 6px 10px;
  font-size: 12px;
  font-weight: 800;
  border: 1px solid #d7e7b1;
  background: #f4f9e6;
  color: #55721d;
}

.debt-status-pill.is-warning {
  border-color: #f2d9a0;
  background: #fff3d8;
  color: #996515;
}

.debt-status-pill.is-ok {
  border-color: #cbeed8;
  background: #eefaf2;
  color: #146c43;
}

.debt-meta-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 10px;
  margin-bottom: 10px;
}

.debt-meta-card {
  padding: 10px 12px;
  border-radius: 14px;
  background: #fff;
  border: 1px solid #eee2bd;
}

.debt-meta-label {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  margin-bottom: 4px;
}

.debt-meta-value {
  font-size: 18px;
  font-weight: 800;
}

.debt-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

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

.task-composer-head {
  margin-bottom: 0;
}

.section-head-copy {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.task-composer-body {
  margin-top: 14px;
}

.card h2 {
  margin: 0;
  font-size: 20px;
}

.pill {
  background: #f3f6fb;
  border: 1px solid var(--line);
  color: var(--muted);
  border-radius: 999px;
  padding: 6px 10px;
  font-size: 13px;
  font-weight: 700;
}

.table-wrap {
  overflow: auto;
}

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

.table th, .table td {
  padding: 12px 10px;
  text-align: left;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
  background: var(--panel);
}

.table th {
  font-size: 13px;
  color: var(--muted);
  font-weight: 700;
}

.table th.action-col,
.table td.action-col {
  position: sticky;
  right: 0;
  z-index: 1;
  min-width: 190px;
  box-shadow: -8px 0 14px rgba(236, 220, 168, 0.45);
}

.table th.action-col {
  z-index: 2;
}

.list-lite {
  display: grid;
  gap: 10px;
}

.list-item {
  padding: 12px;
  border-radius: 14px;
  background: #f8faff;
  border: 1px solid #e4ebf7;
}

.list-item strong {
  display: block;
  margin-bottom: 4px;
}

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

.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
}

.data-form label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 600;
}

.form-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.form-status {
  color: var(--muted);
  font-size: 14px;
}

.empty-state {
  color: var(--muted);
  padding: 12px 0;
}

.panel-insight {
  margin-bottom: 14px;
  padding: 12px 14px;
  border-radius: 14px;
  background: #f8fbff;
  border: 1px solid #dfe9fb;
  color: #406089;
  font-size: 14px;
}

.inline-chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.inline-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 10px;
  border-radius: 999px;
  background: #f3f6fb;
  border: 1px solid var(--line);
  color: #44536a;
  font-size: 13px;
  font-weight: 600;
}

.mini-btn {
  border: 1px solid #bfd2ff;
  background: #e9f0ff;
  color: var(--brand);
  border-radius: 10px;
  padding: 7px 10px;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
}

.secondary-btn {
  border-color: var(--line);
  background: #fff;
  color: #44536a;
}

.task-action-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.is-danger { color: var(--danger); }
.is-ok { color: var(--ok); }

@media (max-width: 720px) {
  .app-shell { padding: 16px; }
  .topbar { flex-direction: column; }
  .hero-card { flex-direction: column; }
  .hero-side { min-width: 0; width: 100%; }
  .card-head { align-items: flex-start; flex-direction: column; }
  .task-composer-head .primary-btn { width: 100%; }
  h1 { font-size: 28px; }
  .hero-title { font-size: 24px; }
}
