:root {
  --bg-main: #0f111a;
  --bg-panel: rgba(26, 29, 45, 0.7);
  --bg-input: #1c1f2e;
  --text-main: #e2e8f0;
  --text-muted: #94a3b8;
  --border: rgba(255, 255, 255, 0.1);
  --primary: #8b5cf6;
  --primary-hover: #7c3aed;
  --income: #10b981;
  --income-bg: rgba(16, 185, 129, 0.15);
  --expense: #ef4444;
  --expense-bg: rgba(239, 68, 68, 0.15);
  --balance: #3b82f6;
  --radius: 16px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background-color: var(--bg-main);
  background-image: 
    radial-gradient(circle at 15% 50%, rgba(139, 92, 246, 0.15), transparent 25%),
    radial-gradient(circle at 85% 30%, rgba(59, 130, 246, 0.15), transparent 25%);
  background-attachment: fixed;
  color: var(--text-main);
  line-height: 1.5;
  min-height: 100vh;
}

/* Стеклянная панель (Glassmorphism) */
.panel {
  background: var(--bg-panel);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
  margin-bottom: 24px;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}
.panel:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.3);
}

/* Шапка */
.topbar {
  background: rgba(15, 17, 26, 0.8);
  backdrop-filter: blur(10px);
  padding: 16px 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 50;
}
.brand { font-weight: 800; font-size: 20px; letter-spacing: -0.5px; background: linear-gradient(90deg, #a78bfa, #60a5fa); -webkit-background-clip: text; -webkit-text-fill-color: transparent; }
.user { display: flex; gap: 16px; align-items: center; font-size: 14px; color: var(--text-muted); }

/* Кнопки */
.ghost, .btn-link, button {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-main);
  padding: 10px 16px;
  border-radius: 10px;
  border: 1px solid var(--border);
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  text-decoration: none;
  transition: all 0.2s ease;
}
.ghost:hover, .btn-link:hover, button:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.2);
}
button[type="submit"] {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}
button[type="submit"]:hover { background: var(--primary-hover); border-color: var(--primary-hover); }

/* Формы и инпуты */
input, select {
  width: 100%;
  padding: 12px 16px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--text-main);
  font-size: 15px;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
  font-family: inherit;
}
input:focus, select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.2);
}
option { background: var(--bg-main); }

/* KPI Карточки */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}
.kpi {
  background: var(--bg-panel);
  backdrop-filter: blur(12px);
  padding: 24px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  position: relative;
  overflow: hidden;
  transition: transform 0.2s;
}
.kpi:hover { transform: translateY(-3px); }
.kpi::before {
  content: ''; position: absolute; top: 0; left: 0; width: 4px; height: 100%;
}
.kpi.income::before { background: var(--income); }
.kpi.expense::before { background: var(--expense); }
.kpi.balance::before { background: var(--balance); }
.kpi-label { font-size: 13px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 1px; margin-bottom: 8px; }
.kpi-value { font-size: 28px; font-weight: 700; }

/* Таблица */
table { width: 100%; border-collapse: collapse; }
thead th {
  text-align: left; font-size: 12px; text-transform: uppercase;
  color: var(--text-muted); padding: 12px 16px; border-bottom: 1px solid var(--border);
  font-weight: 600; letter-spacing: 0.5px;
}
tbody td { padding: 14px 16px; border-bottom: 1px solid rgba(255,255,255,0.05); font-size: 15px; }
tbody tr { transition: background 0.2s; }
tbody tr:hover { background: rgba(255,255,255,0.03); }
.num { text-align: right; font-weight: 600; font-variant-numeric: tabular-nums; }
.amount-income { color: var(--income); }
.amount-expense { color: var(--expense); }
.type-income { color: var(--income); font-weight: 600; }
.type-expense { color: var(--expense); font-weight: 600; }
.del { background: transparent; border: none; color: #64748b; cursor: pointer; font-size: 18px; padding: 4px; }
.del:hover { color: var(--expense); background: var(--expense-bg); border-radius: 6px; }

/* Сетки и контейнеры */
.container { max-width: 1100px; margin: 0 auto; padding: 24px; }
.tx-form { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; }
.filters { display: flex; flex-wrap: wrap; gap: 12px; align-items: end; margin-bottom: 20px; }
.filters label { font-size: 13px; color: var(--text-muted); display: flex; flex-direction: column; gap: 6px; flex: 1; min-width: 140px; }

/* Авторизация */
.auth-page {
  display: flex; align-items: center; justify-content: center;
  min-height: 100vh; padding: 20px;
}
.card {
  background: var(--bg-panel); backdrop-filter: blur(16px);
  border: 1px solid var(--border); border-radius: 24px; padding: 40px;
  width: 100%; max-width: 420px; box-shadow: 0 24px 64px rgba(0,0,0,0.4);
}
.card h1 { text-align: center; margin-bottom: 32px; font-size: 28px; }
.tabs { display: flex; gap: 8px; margin-bottom: 24px; background: rgba(0,0,0,0.2); border-radius: 12px; padding: 4px; }
.tab { flex: 1; padding: 10px; border: none; background: transparent; border-radius: 8px; cursor: pointer; font-weight: 600; color: var(--text-muted); transition: 0.2s; }
.tab.active { background: rgba(255,255,255,0.1); color: var(--text-main); }
.form { display: none; flex-direction: column; gap: 16px; }
.form.active { display: flex; }
.error { color: var(--expense); font-size: 14px; margin-top: 12px; text-align: center; }

/* Виджет хостинга */
.hosting-widget {
  background: linear-gradient(135deg, rgba(139, 92, 246, 0.2), rgba(59, 130, 246, 0.2));
  border: 1px solid rgba(139, 92, 246, 0.3);
  padding: 20px; border-radius: var(--radius);
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 24px;
}
.hosting-days { font-size: 32px; font-weight: 800; color: #fff; line-height: 1; }
.hosting-label { font-size: 14px; color: var(--text-muted); margin-top: 4px; }
.hosting-alert { color: var(--expense); font-weight: bold; animation: pulse 2s infinite; }
@keyframes pulse { 0% { opacity: 1; } 50% { opacity: 0.5; } 100% { opacity: 1; } }

/* Мобильная адаптация */
@media (max-width: 768px) {
  .container { padding: 16px; }
  .topbar { padding: 12px 16px; flex-wrap: wrap; gap: 12px; }
  .user { gap: 8px; width: 100%; justify-content: space-between; font-size: 13px; }
  .tx-form { grid-template-columns: 1fr; }
  .filters { flex-direction: column; align-items: stretch; }
  .kpi-grid { grid-template-columns: 1fr; }
  
  thead { display: none; }
  tbody td { display: flex; justify-content: space-between; align-items: center; padding: 12px; border-bottom: 1px solid rgba(255,255,255,0.05); }
  tbody td::before { content: attr(data-label); font-weight: 600; color: var(--text-muted); font-size: 12px; text-transform: uppercase; }
  .num { text-align: right; }
  
  .profile-layout { grid-template-columns: 1fr !important; }
  .hosting-widget { flex-direction: column; text-align: center; gap: 12px; }
}