:root {
  --brand: #00b7ff;
  --brand-dark: #0092d1;
  --brand-deep: #006ea3;
  --brand-soft: #e5f6ff;
  --brand-tint: #f2fbff;
  --accent: #eb0045;
  --accent-soft: #ffe9ef;
  --bg: #f1f6fa;
  --card: #ffffff;
  --text: #16283a;
  --text-2: #435568;
  --muted: #7a8a9a;
  --border: #dfe8ef;
  --border-strong: #c9d6e0;
  --success: #12b76a;
  --warning: #f79009;
  --danger: #e5484d;
  --radius: 14px;
  --radius-sm: 9px;
  --shadow: 0 1px 2px rgba(20, 50, 80, 0.05), 0 8px 24px -12px rgba(20, 50, 80, 0.18);
  --shadow-lg: 0 12px 40px -12px rgba(20, 50, 80, 0.3);
  --font: 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei UI', 'Microsoft YaHei', 'Noto Sans CJK SC', 'Source Han Sans SC',
    system-ui, sans-serif;
  --font-num: 'Bahnschrift', 'DIN Alternate', 'Segoe UI Variable Display', 'Helvetica Neue', 'Arial', sans-serif;
  --nav-h: 60px;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  height: 100%;
}

body {
  font-family: var(--font);
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  font-size: 14px;
  line-height: 1.5;
}

a {
  color: var(--brand-dark);
  text-decoration: none;
}

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

.num {
  font-family: var(--font-num);
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.01em;
}

.boot {
  min-height: 100vh;
  display: grid;
  place-content: center;
  text-align: center;
  color: var(--muted);
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 0 16px;
  height: 38px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong);
  background: #fff;
  color: var(--text);
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s, border-color 0.15s, transform 0.05s, box-shadow 0.15s;
  user-select: none;
}
.btn:hover {
  background: #f6fafd;
  border-color: var(--brand);
}
.btn:active {
  transform: translateY(1px);
}
.btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  transform: none;
}
.btn svg {
  width: 16px;
  height: 16px;
  flex: none;
}
.btn-primary {
  background: var(--brand);
  border-color: var(--brand);
  color: #fff;
  font-weight: 600;
  box-shadow: 0 6px 16px -8px rgba(0, 183, 255, 0.8);
}
.btn-primary:hover {
  background: var(--brand-dark);
  border-color: var(--brand-dark);
}
.btn-danger {
  color: var(--danger);
  border-color: #f3c3c5;
}
.btn-danger:hover {
  background: #fff3f3;
  border-color: var(--danger);
}
.btn-ghost {
  border-color: transparent;
  background: transparent;
  color: var(--text-2);
}
.btn-ghost:hover {
  background: rgba(0, 183, 255, 0.08);
  border-color: transparent;
  color: var(--brand-deep);
}
.btn-sm {
  height: 30px;
  padding: 0 10px;
  font-size: 13px;
  border-radius: 7px;
}
.btn-sm svg {
  width: 14px;
  height: 14px;
}
.btn-icon {
  width: 34px;
  height: 34px;
  padding: 0;
  border-radius: 8px;
}
.btn-block {
  width: 100%;
}

/* ---------- Form controls ---------- */
.input,
.select,
.textarea {
  width: 100%;
  height: 38px;
  padding: 0 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong);
  background: #fff;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
  min-width: 0;
}
.textarea {
  height: auto;
  min-height: 72px;
  padding: 8px 12px;
  resize: vertical;
}
.input:focus,
.select:focus,
.textarea:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(0, 183, 255, 0.18);
}
.input::placeholder {
  color: #a3b1bf;
}
.input-sm {
  height: 32px;
  padding: 0 8px;
  border-radius: 7px;
  font-size: 13px;
}
.input-num {
  text-align: right;
  font-family: var(--font-num);
  font-variant-numeric: tabular-nums;
}
.select {
  appearance: none;
  padding-right: 30px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%237a8a9a' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
}
.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}
.field > label {
  font-size: 13px;
  color: var(--text-2);
  font-weight: 500;
}
.field .req::after {
  content: ' *';
  color: var(--accent);
}
.field-hint {
  font-size: 12px;
  color: var(--muted);
}
.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px 16px;
}
.form-grid .span-2 {
  grid-column: span 2;
}
.radio-group {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.radio-pill {
  position: relative;
  display: inline-flex;
  align-items: center;
  height: 38px;
  padding: 0 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong);
  cursor: pointer;
  background: #fff;
  transition: all 0.15s;
}
.radio-pill input {
  position: absolute;
  opacity: 0;
  inset: 0;
  cursor: pointer;
}
.radio-pill.active {
  border-color: var(--brand);
  background: var(--brand-soft);
  color: var(--brand-deep);
  font-weight: 600;
}
.radio-pill.disabled {
  opacity: 0.6;
  cursor: not-allowed;
}
.error-text {
  color: var(--danger);
  font-size: 13px;
}

/* ---------- Layout shell ---------- */
.shell {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  height: var(--nav-h);
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}
.topbar-inner {
  max-width: 1240px;
  margin: 0 auto;
  height: 100%;
  padding: 0 20px;
  display: flex;
  align-items: center;
  gap: 18px;
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text);
}
.brand img {
  height: 30px;
  display: block;
}
.brand-title {
  font-weight: 700;
  font-size: 15px;
  letter-spacing: 0.02em;
}
.nav {
  display: flex;
  gap: 4px;
  margin-left: 8px;
}
.nav a {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 36px;
  padding: 0 14px;
  border-radius: 999px;
  color: var(--text-2);
  font-weight: 500;
  transition: all 0.15s;
}
.nav a svg {
  width: 16px;
  height: 16px;
}
.nav a:hover {
  background: var(--brand-tint);
  color: var(--brand-deep);
}
.nav a.active {
  background: var(--brand-soft);
  color: var(--brand-deep);
  font-weight: 600;
}
.topbar-spacer {
  flex: 1;
}
.main {
  flex: 1;
  width: 100%;
  max-width: 1240px;
  margin: 0 auto;
  padding: 24px 20px 60px;
}
.page-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}
.page-title {
  margin: 0;
  font-size: 24px;
  font-weight: 700;
  letter-spacing: -0.01em;
}
.page-sub {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 13px;
}
.head-actions {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

/* ---------- Cards ---------- */
.card {
  background: var(--card);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
}
.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}
.card-title {
  margin: 0;
  font-size: 16px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 8px;
}
.card-title .dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--brand);
  box-shadow: 0 0 0 4px var(--brand-soft);
}
.card-body {
  padding: 20px;
}
.card-foot {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 24px;
  padding: 14px 20px;
  border-top: 1px solid var(--border);
  background: #fafcfe;
  border-radius: 0 0 var(--radius) var(--radius);
  flex-wrap: wrap;
}
.total-label {
  color: var(--muted);
  font-size: 13px;
}
.total-value {
  font-weight: 700;
  font-size: 18px;
}

/* ---------- Tags ---------- */
.tag {
  display: inline-flex;
  align-items: center;
  height: 22px;
  padding: 0 8px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}
.tag-blue {
  background: var(--brand-soft);
  color: var(--brand-deep);
}
.tag-violet {
  background: #efeaff;
  color: #5b3fd6;
}
.tag-orange {
  background: #fff1e0;
  color: #b95d00;
}
.tag-green {
  background: #e3f8ee;
  color: #0b7a47;
}
.tag-gray {
  background: #eef2f6;
  color: var(--text-2);
}
.tag-red {
  background: var(--accent-soft);
  color: var(--accent);
}

/* ---------- Tables ---------- */
.table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
.table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 13.5px;
}
.table th,
.table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  text-align: left;
  white-space: nowrap;
  vertical-align: middle;
}
.table th {
  background: #f7fafc;
  color: var(--text-2);
  font-weight: 600;
  font-size: 12.5px;
  position: sticky;
  top: 0;
  z-index: 1;
}
.table tbody tr:hover td {
  background: #fbfdff;
}
.table .r {
  text-align: right;
}
.table .c {
  text-align: center;
}
.table .money {
  font-family: var(--font-num);
  font-variant-numeric: tabular-nums;
}
.table tfoot td {
  background: #f7fafc;
  font-weight: 700;
  border-bottom: none;
}
.table .empty {
  text-align: center;
  color: var(--muted);
  padding: 28px 12px;
}
.table .actions {
  display: flex;
  gap: 4px;
  justify-content: flex-end;
}
.table-sticky th:first-child,
.table-sticky td:first-child {
  position: sticky;
  left: 0;
  background: #fff;
  z-index: 2;
  box-shadow: 1px 0 0 var(--border);
}
.table-sticky th:first-child {
  background: #f7fafc;
  z-index: 3;
}
.table-sticky tfoot td:first-child {
  background: #f7fafc;
}
.table-edit td {
  padding: 6px 6px;
}
.table-edit .input-sm {
  width: 96px;
}
.table-edit .input-remark {
  width: 124px;
}
.row-dirty td:first-child {
  box-shadow: inset 3px 0 0 var(--warning), 1px 0 0 var(--border);
}
.col-type-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  margin-right: 5px;
  border-radius: 5px;
  font-size: 11px;
  font-weight: 700;
  vertical-align: middle;
}
.col-type-badge.col-type-income {
  background: #e3f8ee;
  color: #0b7a47;
}
.col-type-badge.col-type-expense {
  background: #fff1e0;
  color: #b95d00;
}
.table .th-add {
  width: 44px;
  padding: 4px;
  text-align: center;
  background: var(--brand-tint);
  border-left: 1px dashed var(--border-strong);
  border-right: 1px dashed var(--border-strong);
}
.table tfoot .th-add {
  background: var(--brand-tint);
}
.btn-add-col {
  width: 32px;
  height: 32px;
  border: 1px dashed var(--brand);
  color: var(--brand-deep);
  background: #fff;
}
.btn-add-col:hover {
  background: var(--brand-soft);
  border-style: solid;
}
.col-type-select {
  width: 92px;
  flex: none;
}
.col-type-select.col-type-income {
  color: #0b7a47;
  font-weight: 600;
}
.col-type-select.col-type-expense {
  color: #b95d00;
  font-weight: 600;
}
.muted {
  color: var(--muted);
}
.pos {
  color: var(--success);
}
.neg {
  color: var(--danger);
}

/* inline add form */
.add-form {
  display: grid;
  gap: 10px;
  align-items: end;
  padding: 16px 20px;
  background: var(--brand-tint);
  border-bottom: 1px solid var(--border);
}
.add-form .field > label {
  font-size: 12px;
}
.add-form-deposit {
  grid-template-columns: 1.4fr 1fr 1fr 1.4fr auto;
}
.add-form-amortized {
  grid-template-columns: 1.3fr 1fr 1fr 1fr 0.8fr 1fr auto;
}

/* ---------- Dashboard ---------- */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}
.kpi {
  position: relative;
  overflow: hidden;
  border-radius: 18px;
  padding: 22px 22px 18px;
  color: #fff;
  min-height: 140px;
  display: flex;
  flex-direction: column;
  box-shadow: 0 14px 34px -18px var(--kpi-shadow, rgba(0, 0, 0, 0.35));
  background: var(--kpi-bg);
  animation: rise 0.5s cubic-bezier(0.2, 0.8, 0.2, 1) both;
}
.kpi::before {
  content: '';
  position: absolute;
  right: -40px;
  top: -60px;
  width: 190px;
  height: 190px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.12);
}
.kpi::after {
  content: '';
  position: absolute;
  right: 30px;
  bottom: -90px;
  width: 170px;
  height: 170px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.08);
}
.kpi-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  position: relative;
}
.kpi-icon {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.22);
  display: grid;
  place-items: center;
}
.kpi-icon svg {
  width: 22px;
  height: 22px;
}
.kpi-value {
  font-family: var(--font-num);
  font-variant-numeric: tabular-nums;
  font-size: 34px;
  font-weight: 700;
  line-height: 1;
  letter-spacing: -0.01em;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
  min-width: 0;
  white-space: nowrap;
}
.kpi-value small {
  font-size: 18px;
  font-weight: 600;
  opacity: 0.85;
  margin-right: 2px;
}
.kpi-label {
  position: relative;
  margin-top: 14px;
  font-size: 15px;
  font-weight: 700;
}
.kpi-desc {
  position: relative;
  margin-top: 4px;
  font-size: 12.5px;
  opacity: 0.88;
}
.kpi-1 {
  --kpi-bg: linear-gradient(135deg, #1e8bff, #00b7ff);
  --kpi-shadow: rgba(0, 150, 255, 0.55);
}
.kpi-2 {
  --kpi-bg: linear-gradient(135deg, #ff3d6e, #eb0045);
  --kpi-shadow: rgba(235, 0, 69, 0.5);
}
.kpi-3 {
  --kpi-bg: linear-gradient(135deg, #34c759, #12a150);
  --kpi-shadow: rgba(18, 161, 80, 0.5);
}
.kpi-4 {
  --kpi-bg: linear-gradient(135deg, #ff9a3c, #f0710f);
  --kpi-shadow: rgba(240, 113, 15, 0.5);
}
.kpi-5 {
  --kpi-bg: linear-gradient(135deg, #8b6cff, #6242e0);
  --kpi-shadow: rgba(98, 66, 224, 0.5);
}
.kpi-6 {
  --kpi-bg: linear-gradient(135deg, #2fd4c0, #0fa99a);
  --kpi-shadow: rgba(15, 169, 154, 0.5);
}
.kpi:nth-child(2) {
  animation-delay: 0.05s;
}
.kpi:nth-child(3) {
  animation-delay: 0.1s;
}
.kpi:nth-child(4) {
  animation-delay: 0.15s;
}
.kpi:nth-child(5) {
  animation-delay: 0.2s;
}
.kpi:nth-child(6) {
  animation-delay: 0.25s;
}
@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(14px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}
.store-cta {
  margin-top: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  height: 84px;
  border-radius: 18px;
  background: linear-gradient(120deg, #0f5aa8, #1e8bff 55%, #00b7ff);
  color: #fff;
  font-size: 22px;
  font-weight: 800;
  letter-spacing: 0.08em;
  box-shadow: 0 14px 34px -16px rgba(30, 139, 255, 0.7);
  position: relative;
  overflow: hidden;
  transition: transform 0.15s, box-shadow 0.15s;
}
.store-cta:hover {
  transform: translateY(-2px);
  box-shadow: 0 18px 40px -16px rgba(30, 139, 255, 0.85);
}
.store-cta svg {
  width: 26px;
  height: 26px;
}
.store-cta .count {
  position: absolute;
  right: 22px;
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0;
  opacity: 0.9;
}
.seg {
  display: inline-flex;
  padding: 3px;
  border-radius: 999px;
  background: #e6edf3;
}
.seg button {
  border: none;
  background: transparent;
  height: 30px;
  padding: 0 14px;
  border-radius: 999px;
  cursor: pointer;
  color: var(--text-2);
  font-weight: 500;
}
.seg button.active {
  background: #fff;
  color: var(--brand-deep);
  font-weight: 700;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12);
}

/* ---------- Store list ---------- */
.region-block {
  margin-bottom: 30px;
}
.region-head {
  display: flex;
  align-items: baseline;
  gap: 10px;
  padding-bottom: 10px;
  margin-bottom: 14px;
  border-bottom: 2px solid var(--border-strong);
}
.region-head h3 {
  margin: 0;
  font-size: 17px;
  font-weight: 700;
  padding-left: 12px;
  position: relative;
}
.region-head h3::before {
  content: '';
  position: absolute;
  left: 0;
  top: 4px;
  bottom: 4px;
  width: 4px;
  border-radius: 2px;
  background: var(--brand);
}
.region-head span {
  color: var(--muted);
  font-size: 13px;
}
.store-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 14px;
}
.store-card {
  position: relative;
  display: block;
  color: var(--text);
  background: #fff;
  border-radius: 14px;
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  overflow: hidden;
  transition: transform 0.15s, box-shadow 0.15s, border-color 0.15s;
  cursor: pointer;
}
.store-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-lg);
  border-color: var(--brand);
}
.store-card-head {
  background: linear-gradient(120deg, #00b7ff, #38c9ff);
  color: #fff;
  padding: 12px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.store-card-head .name {
  font-weight: 700;
  font-size: 16px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.store-card-head img {
  height: 22px;
  background: #fff;
  border-radius: 6px;
  padding: 2px 4px;
  flex: none;
}
.store-card-body {
  padding: 12px 14px 14px;
  display: grid;
  gap: 7px;
  font-size: 13px;
}
.store-card-body .row {
  display: flex;
  justify-content: space-between;
  gap: 10px;
}
.store-card-body .row span:first-child {
  color: var(--muted);
  flex: none;
}
.store-card-body .row span:last-child {
  text-align: right;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.store-card-tags {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 4px;
}
.store-card-new {
  display: grid;
  place-items: center;
  min-height: 150px;
  border: 2px dashed var(--border-strong);
  border-radius: 14px;
  color: var(--muted);
  background: transparent;
  cursor: pointer;
  transition: all 0.15s;
  font-weight: 600;
}
.store-card-new:hover {
  border-color: var(--brand);
  color: var(--brand-deep);
  background: var(--brand-tint);
}
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--muted);
}
.empty-state img {
  height: 48px;
  opacity: 0.6;
  margin-bottom: 12px;
}

/* ---------- Store detail ---------- */
.detail-head {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 18px;
  flex-wrap: wrap;
}
.detail-brand {
  display: flex;
  align-items: center;
  gap: 12px;
}
.detail-brand img {
  height: 34px;
}
.detail-brand .divider {
  width: 2px;
  height: 26px;
  background: var(--border-strong);
}
.detail-brand h1 {
  margin: 0;
  font-size: 22px;
  font-weight: 800;
}
.detail-tags {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
.info-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px 20px;
}
.info-item {
  min-width: 0;
}
.info-item .k {
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 2px;
}
.info-item .v {
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.section {
  margin-top: 20px;
}
.summary-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-top: 16px;
}
.summary-item {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px 14px;
}
.summary-item .k {
  font-size: 12px;
  color: var(--muted);
}
.summary-item .v {
  font-size: 20px;
  font-weight: 700;
  margin-top: 2px;
}
.progress {
  height: 6px;
  border-radius: 3px;
  background: #e6edf3;
  overflow: hidden;
  min-width: 80px;
}
.progress > i {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, var(--brand), #6ad6ff);
  border-radius: 3px;
}
.year-nav {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.year-nav .select {
  width: 110px;
  height: 34px;
}
.save-bar {
  position: sticky;
  bottom: 14px;
  display: flex;
  justify-content: center;
  margin-top: 14px;
  pointer-events: none;
  z-index: 20;
}
.save-bar .inner {
  pointer-events: auto;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px 10px 18px;
  background: #16283a;
  color: #fff;
  border-radius: 999px;
  box-shadow: 0 16px 40px -14px rgba(0, 0, 0, 0.55);
  animation: rise 0.25s both;
}

/* ---------- Modal ---------- */
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(10, 30, 50, 0.45);
  backdrop-filter: blur(3px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  animation: fade 0.15s both;
}
.modal {
  width: 100%;
  max-width: 560px;
  max-height: calc(100vh - 40px);
  background: #fff;
  border-radius: 18px;
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
  animation: pop 0.2s cubic-bezier(0.2, 0.8, 0.2, 1) both;
}
.modal-lg {
  max-width: 720px;
}
.modal-sm {
  max-width: 420px;
}
.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 22px 12px;
}
.modal-head h3 {
  margin: 0;
  font-size: 18px;
  font-weight: 700;
}
.modal-body {
  padding: 6px 22px 18px;
  overflow-y: auto;
}
.modal-foot {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 14px 22px 20px;
  border-top: 1px solid var(--border);
}
@keyframes fade {
  from {
    opacity: 0;
  }
}
@keyframes pop {
  from {
    opacity: 0;
    transform: translateY(10px) scale(0.98);
  }
}

/* ---------- Toast ---------- */
.toasts {
  position: fixed;
  top: 16px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 200;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}
.toast {
  padding: 10px 16px;
  border-radius: 10px;
  background: #16283a;
  color: #fff;
  font-size: 14px;
  box-shadow: 0 10px 30px -10px rgba(0, 0, 0, 0.5);
  animation: pop 0.2s both;
  display: flex;
  align-items: center;
  gap: 8px;
  max-width: 90vw;
}
.toast-success {
  background: #0b7a47;
}
.toast-error {
  background: #c62828;
}

/* ---------- Login ---------- */
.login {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 20px;
  background:
    radial-gradient(1200px 600px at 10% -10%, rgba(0, 183, 255, 0.28), transparent 60%),
    radial-gradient(900px 500px at 110% 110%, rgba(235, 0, 69, 0.16), transparent 60%),
    var(--bg);
}
.login-card {
  width: 100%;
  max-width: 400px;
  background: #fff;
  border-radius: 22px;
  padding: 36px 32px 30px;
  box-shadow: var(--shadow-lg);
  text-align: center;
  animation: pop 0.3s both;
}
.login-card img {
  height: 46px;
}
.login-card h1 {
  margin: 16px 0 4px;
  font-size: 20px;
  font-weight: 800;
}
.login-card p {
  margin: 0 0 24px;
  color: var(--muted);
  font-size: 13px;
}
.login-card .input {
  height: 46px;
  font-size: 16px;
  text-align: center;
  letter-spacing: 0.2em;
}
.login-card .btn {
  height: 46px;
  font-size: 15px;
  margin-top: 14px;
}
.login-card .error-text {
  margin-top: 10px;
  min-height: 20px;
}

/* ---------- Settings ---------- */
.settings-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}
.col-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.col-item {
  display: flex;
  align-items: center;
  gap: 8px;
}
.col-item .input {
  flex: 1;
}
.col-item .order {
  width: 26px;
  color: var(--muted);
  text-align: center;
  font-size: 13px;
}

/* ---------- Utilities ---------- */
.stack {
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.row-between {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}
.mt-1 {
  margin-top: 8px;
}
.mt-2 {
  margin-top: 16px;
}
.text-sm {
  font-size: 13px;
}
.hide-mobile {
  display: initial;
}
.only-mobile {
  display: none;
}
.spinner {
  width: 18px;
  height: 18px;
  border: 2px solid rgba(255, 255, 255, 0.4);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
.spinner-dark {
  border-color: rgba(0, 0, 0, 0.12);
  border-top-color: var(--brand);
}
@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}
.loading-block {
  display: flex;
  justify-content: center;
  padding: 60px;
}

/* ---------- Responsive ---------- */
@media (max-width: 1024px) {
  .kpi-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .info-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .add-form-deposit,
  .add-form-amortized {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .add-form .btn {
    grid-column: span 2;
  }
}

@media (max-width: 720px) {
  body {
    font-size: 14px;
  }
  .topbar-inner {
    padding: 0 14px;
    gap: 10px;
  }
  .brand-title {
    display: none;
  }
  .nav a {
    padding: 0 10px;
    height: 34px;
    font-size: 13px;
  }
  .nav a span {
    display: none;
  }
  .main {
    padding: 16px 14px 90px;
  }
  .page-title {
    font-size: 20px;
  }
  .kpi-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }
  .kpi {
    min-height: 0;
    padding: 18px 18px 16px;
  }
  .kpi-value {
    font-size: 22px;
  }
  .kpi-value small {
    font-size: 13px;
  }
  .kpi-label {
    font-size: 13px;
    margin-top: 10px;
  }
  .kpi-desc {
    display: none;
  }
  .login-card {
    padding: 28px 20px 24px;
  }
  .login-card h1 {
    font-size: 18px;
  }
  .store-cta {
    height: 72px;
    font-size: 19px;
  }
  .store-cta .count {
    display: none;
  }
  .form-grid {
    grid-template-columns: 1fr;
  }
  .form-grid .span-2 {
    grid-column: span 1;
  }
  .settings-grid {
    grid-template-columns: 1fr;
  }
  .summary-strip {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .info-grid {
    grid-template-columns: 1fr;
  }
  .card-head,
  .card-body,
  .card-foot,
  .add-form {
    padding-left: 14px;
    padding-right: 14px;
  }
  .add-form-deposit,
  .add-form-amortized {
    grid-template-columns: 1fr 1fr;
  }
  .modal {
    max-height: calc(100vh - 20px);
    border-radius: 16px;
  }
  .modal-backdrop {
    padding: 10px;
    align-items: flex-end;
  }
  .hide-mobile {
    display: none;
  }
  .only-mobile {
    display: initial;
  }
  .detail-brand h1 {
    font-size: 18px;
  }
  .detail-brand img {
    height: 28px;
  }
  .store-card-new {
    min-height: 56px;
  }
  .head-actions .input {
    width: 100% !important;
  }
  .table th,
  .table td {
    padding: 8px 10px;
  }
}
