.tc-page {
  min-height: 100vh;
  padding: 24px;
  color: #e5efff;
  background:
    radial-gradient(circle at 30% 0%, rgba(37, 99, 235, .18), transparent 32%),
    linear-gradient(135deg, #030712 0%, #07111f 52%, #020617 100%);
}

.tc-page * {
  box-sizing: border-box;
}

.tc-header,
.tc-main,
.tc-kpis,
.tc-filters,
.tc-cat-grid,
.tc-two,
.tc-header-actions {
  display: grid;
  gap: 16px;
}

.tc-header {
  grid-template-columns: 1fr auto;
  align-items: start;
  margin-bottom: 20px;
}

.tc-header h1 {
  margin: 0;
  font-size: 26px;
  line-height: 1.2;
  letter-spacing: 0;
}

.tc-header p {
  margin: 8px 0 0;
  color: #9fb0d0;
}

.tc-header-actions {
  grid-auto-flow: column;
  align-items: center;
}

.tc-primary {
  border: 0;
  border-radius: 10px;
  padding: 11px 18px;
  color: #fff;
  font-weight: 700;
  cursor: pointer;
  background: linear-gradient(135deg, #1677ff, #8b20e8);
  box-shadow: 0 10px 26px rgba(37, 99, 235, .32);
}

.tc-primary:disabled {
  cursor: not-allowed;
  opacity: .55;
}

.tc-periods,
.tc-tabs,
.tc-radio-group,
.tc-form-actions,
.tc-actions,
.tc-cat-head,
.tc-cat-item {
  display: flex;
  align-items: center;
  gap: 8px;
}

.tc-periods {
  padding: 3px;
  border: 1px solid #22304f;
  border-radius: 12px;
  background: rgba(6, 14, 30, .78);
}

.tc-periods button,
.tc-tabs button,
.tc-radio,
.tc-ghost,
.tc-cat-head button,
.tc-actions button,
.tc-cat-item button {
  border: 1px solid #22304f;
  border-radius: 9px;
  color: #b8c5df;
  background: rgba(9, 18, 36, .86);
  cursor: pointer;
}

.tc-periods button,
.tc-tabs button,
.tc-radio,
.tc-ghost {
  min-height: 38px;
  padding: 8px 12px;
}

.tc-periods button.active,
.tc-tabs button.active,
.tc-radio.active {
  color: #fff;
  border-color: rgba(139, 92, 246, .78);
  background: linear-gradient(135deg, #2563eb, #7c3aed);
}

.tc-kpis {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin-bottom: 18px;
}

.tc-kpi,
.tc-panel,
.tc-tablewrap,
.tc-cats,
.tc-note {
  border: 1px solid #22304f;
  border-radius: 18px;
  background: rgba(16, 24, 44, .78);
  box-shadow: 0 18px 42px rgba(0, 0, 0, .22);
}

.tc-kpi {
  display: flex;
  gap: 14px;
  align-items: center;
  min-height: 118px;
  padding: 22px;
}

.tc-icon {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border-radius: 50%;
  color: #fff;
  font-weight: 800;
}

.tc-kpi.income .tc-icon { background: #22c55e; }
.tc-kpi.expense .tc-icon { background: #ef4444; }
.tc-kpi.balance .tc-icon { background: #3b82f6; }
.tc-kpi.count .tc-icon { background: #f59e0b; }

.tc-kpi small {
  display: block;
  margin-bottom: 8px;
  color: #c8d4ee;
}

.tc-kpi strong {
  display: block;
  font-size: 28px;
  line-height: 1.1;
  color: #f8fbff;
}

.tc-kpi.income strong { color: #22c55e; }
.tc-kpi.expense strong { color: #ef4444; }
.tc-kpi.balance strong { color: #3b82f6; }

.tc-main {
  grid-template-columns: minmax(0, 1fr) 420px;
  align-items: start;
}

.tc-left,
.tc-side {
  display: grid;
  gap: 16px;
}

.tc-filters {
  grid-template-columns: auto minmax(220px, 1fr) 180px 180px auto;
  align-items: center;
}

.tc-input {
  width: 100%;
  min-height: 42px;
  border: 1px solid #22304f;
  border-radius: 10px;
  padding: 10px 12px;
  color: #dce7fb;
  background: rgba(8, 16, 34, .86);
  outline: none;
}

.tc-input:focus {
  border-color: #3b82f6;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, .18);
}

.tc-tablewrap {
  overflow-x: auto;
}

.tc-table {
  width: 100%;
  min-width: 920px;
  border-collapse: collapse;
}

.tc-table th,
.tc-table td {
  padding: 14px 16px;
  border-bottom: 1px solid rgba(34, 48, 79, .82);
  text-align: left;
  white-space: nowrap;
}

.tc-table th {
  color: #9db9ee;
  font-size: 13px;
  text-transform: uppercase;
}

.tc-table td:nth-child(6) {
  max-width: 280px;
  white-space: normal;
  color: #c5d2e8;
}

.tc-badge {
  display: inline-flex;
  min-width: 54px;
  justify-content: center;
  border-radius: 8px;
  padding: 5px 9px;
  font-weight: 700;
}

.tc-badge.income {
  color: #22c55e;
  border: 1px solid rgba(34, 197, 94, .38);
  background: rgba(34, 197, 94, .1);
}

.tc-badge.expense {
  color: #ef4444;
  border: 1px solid rgba(239, 68, 68, .38);
  background: rgba(239, 68, 68, .1);
}

.tc-money-income {
  color: #22c55e;
  font-weight: 800;
}

.tc-money-expense {
  color: #ef4444;
  font-weight: 800;
}

.tc-actions button,
.tc-cat-item button {
  display: inline-grid;
  width: 34px;
  height: 30px;
  place-items: center;
  color: #dbeafe;
  background: rgba(37, 99, 235, .5);
}

.tc-actions button.danger,
.tc-cat-item button.danger {
  color: #fee2e2;
  border-color: rgba(239, 68, 68, .35);
  background: rgba(239, 68, 68, .58);
}

.tc-empty {
  height: 92px;
  color: #9fb0d0;
  text-align: center !important;
}

.tc-panel,
.tc-cats,
.tc-note {
  padding: 20px;
}

.tc-panel h2,
.tc-cats h2 {
  margin: 0 0 18px;
  font-size: 18px;
}

.tc-panel label {
  display: block;
  margin: 14px 0 7px;
  color: #d6e0f3;
  font-size: 14px;
}

.tc-order-box[hidden], #tc_note_box[hidden] { display: none; }
.tc-order-preview { display:grid; gap:6px; margin-top:10px; padding:12px; border:1px solid #29416b; border-radius:10px; color:#cbdcf6; background:#071225; line-height:1.45; }
.tc-order-preview span { display:block; }
.tc-order-preview em { color:#fbbf24; font-style:normal; font-weight:700; }
.tc-order-preview i { color:#4ade80; font-style:normal; font-weight:700; }

.tc-two {
  grid-template-columns: 1fr 1fr;
}

.tc-form-actions {
  justify-content: flex-end;
  margin-top: 18px;
}

.tc-note {
  color: #bcd7ff;
  background: rgba(17, 46, 96, .62);
}

.tc-note strong {
  display: block;
  margin-bottom: 8px;
  color: #7cc1ff;
}

.tc-note p {
  margin: 0;
  line-height: 1.55;
}

.tc-cat-grid {
  grid-template-columns: 1fr 1fr;
}

.tc-cat-head {
  justify-content: space-between;
  margin-bottom: 10px;
}

.tc-cat-head h3 {
  margin: 0;
  font-size: 15px;
}

.tc-cat-head button {
  min-height: 34px;
  padding: 7px 10px;
  color: #22c55e;
  border-color: rgba(34, 197, 94, .35);
}

.tc-cat-list {
  display: grid;
  gap: 8px;
}

.tc-cat-item {
  justify-content: space-between;
  min-height: 40px;
  padding: 7px 8px 7px 12px;
  border: 1px solid rgba(34, 48, 79, .82);
  border-radius: 10px;
  background: rgba(8, 16, 34, .56);
}

@media (max-width: 1180px) {
  .tc-kpis {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .tc-main {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 820px) {
  .tc-page {
    padding: 16px;
  }

  .tc-side {
    order: -1;
  }

  .tc-header,
  .tc-filters,
  .tc-cat-grid,
  .tc-two {
    grid-template-columns: 1fr;
  }

  .tc-header-actions {
    grid-auto-flow: row;
  }

  .tc-periods,
  .tc-tabs {
    flex-wrap: wrap;
  }

  .tc-kpis {
    grid-template-columns: 1fr;
  }

  .tc-kpi strong {
    font-size: 24px;
  }
}
