:root {
  --bg-0: #050505;
  --bg-1: #0d0d0d;
  --bg-2: #151515;
  --panel: rgba(18, 18, 18, 0.94);
  --panel-strong: #1a1a1a;
  --text: #f5f5f5;
  --muted: #c7c7c7;
  --primary: #ff7a1a;
  --primary-dark: #e46409;
  --secondary: #ff9d4d;
  --danger: #d94b4b;
  --income: #2aa85f;
  --expense: #d4583a;
  --neutral: #4f4f4f;
  --border: #2c2c2c;
  --ok: #31bf6a;
  --warning: #f18b2e;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  color: var(--text);
  font-family: "Sora", "Nunito", "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
  background:
    radial-gradient(circle at 12% -10%, rgba(255, 122, 26, 0.22), transparent 38%),
    radial-gradient(circle at 90% 6%, rgba(255, 157, 77, 0.14), transparent 28%),
    linear-gradient(180deg, #070707 0%, #101010 52%, #090909 100%);
  min-height: 100vh;
}

.bg-overlay {
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(125deg, rgba(255, 122, 26, 0.05), transparent 33%),
    radial-gradient(circle at 50% 140%, rgba(255, 122, 26, 0.11), transparent 42%);
  z-index: 0;
}

.container {
  position: relative;
  z-index: 1;
  max-width: 1220px;
  margin: 0 auto;
  padding: 26px 18px 40px;
}

.hero {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 18px;
  margin-bottom: 18px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
}

.logo {
  width: 210px;
  height: 64px;
  object-fit: contain;
}

.hero h1 {
  margin: 0;
  font-size: 2rem;
  line-height: 1.1;
  letter-spacing: -0.02em;
}

.hero p {
  margin: 6px 0 0;
  color: #ffd8b8;
}

.session-box {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 12px 14px;
  min-width: 300px;
  display: grid;
  gap: 7px;
  box-shadow: 0 14px 36px rgba(0, 0, 0, 0.38);
}

.session-box .line {
  color: #e8e8e8;
}

.session-profile {
  display: flex;
  align-items: center;
  gap: 10px;
}

.session-meta {
  display: grid;
  gap: 6px;
}

.session-actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.alerts {
  margin-bottom: 14px;
}

.alert {
  padding: 11px 13px;
  border-radius: 10px;
  margin-bottom: 8px;
  border: 1px solid;
  font-weight: 600;
}

.alert.success {
  background: rgba(49, 191, 106, 0.12);
  border-color: rgba(49, 191, 106, 0.46);
}

.alert.error {
  background: rgba(217, 75, 75, 0.13);
  border-color: rgba(217, 75, 75, 0.52);
}

.tabs {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}

.tab {
  background: #1b1b1b;
  border: 1px solid var(--border);
  padding: 9px 13px;
  border-radius: 11px;
  text-decoration: none;
  color: #f1f1f1;
  font-weight: 700;
  transition: all 0.2s ease;
}

.tab:hover {
  transform: translateY(-1px);
  border-color: #464646;
}

.tab.active {
  background: linear-gradient(135deg, #ff7a1a, #f29a4f);
  color: #151515;
  border-color: #ff9b4a;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 18px;
  margin-bottom: 16px;
  box-shadow: 0 16px 38px rgba(0, 0, 0, 0.32);
  backdrop-filter: blur(2px);
}

.panel.compact {
  padding: 12px 16px;
}

.warning-panel {
  border-color: rgba(241, 139, 46, 0.45);
  background: linear-gradient(160deg, rgba(58, 35, 18, 0.72), rgba(28, 20, 16, 0.85));
}

.panel h2 {
  margin-top: 0;
  margin-bottom: 12px;
  letter-spacing: -0.01em;
}

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

.card {
  border-radius: 14px;
  padding: 14px;
  color: #fff;
}

.card h2 {
  margin: 0;
  font-size: 0.93rem;
  font-weight: 700;
}

.card strong {
  font-size: 1.35rem;
  display: block;
  margin-top: 6px;
}

.card.income {
  background: linear-gradient(135deg, #2f8f54, #256d40);
}

.card.expense {
  background: linear-gradient(135deg, #c14f37, #983421);
}

.card.balance {
  background: linear-gradient(135deg, #f07c22, #cf5e09);
}

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

.launch-form label,
.month-form label,
.auth-form label {
  font-size: 0.9rem;
  color: var(--muted);
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.check-label {
  display: flex;
  align-items: center;
  gap: 8px;
}

small {
  color: #cfcfcf;
  font-size: 0.8rem;
}

input,
select,
button,
a.button-link {
  font: inherit;
}

a.button-link.secondary {
  background: #2d2d2d;
  color: #f7f7f7;
}

a.button-link.tiny {
  padding: 6px 9px;
  font-size: 0.76rem;
}

input,
select {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 9px 10px;
  background: #131313;
  color: var(--text);
}

input:focus,
select:focus {
  outline: 2px solid rgba(255, 122, 26, 0.5);
  outline-offset: 1px;
}

button,
a.button-link {
  border: 0;
  background: linear-gradient(135deg, var(--primary), #ff8d34);
  color: #1b1b1b;
  border-radius: 10px;
  padding: 9px 13px;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
}

button:hover,
a.button-link:hover {
  background: linear-gradient(135deg, #ff8a32, var(--primary-dark));
}

button.danger {
  background: linear-gradient(135deg, #d4583a, #b74125);
  color: #fff;
}

button.neutral {
  background: var(--neutral);
  color: #fff;
}

.month-form {
  display: flex;
  gap: 10px;
  align-items: end;
  flex-wrap: wrap;
}

.table-wrap {
  overflow-x: auto;
  border: 1px solid #2a2a2a;
  border-radius: 12px;
}

table {
  width: 100%;
  border-collapse: collapse;
  background: rgba(11, 11, 11, 0.7);
}

th,
td {
  text-align: left;
  border-bottom: 1px solid var(--border);
  padding: 10px 8px;
  font-size: 0.9rem;
  vertical-align: middle;
}

th {
  color: #ffd6b6;
  background: rgba(255, 122, 26, 0.08);
}

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

.billing-actions {
  min-width: 260px;
}

.billing-form {
  display: grid;
  gap: 6px;
  margin-bottom: 8px;
}

.billing-inline {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

.billing-label {
  font-size: 0.78rem;
  color: #c9c9c9;
}

.billing-form input[type="month"] {
  min-width: 150px;
}

.danger-disclosure {
  border: 1px solid #3a2a24;
  border-radius: 10px;
  padding: 6px;
  background: rgba(120, 43, 23, 0.18);
}

.danger-disclosure summary {
  list-style: none;
  cursor: pointer;
  background: linear-gradient(135deg, #d4583a, #b74125);
  color: #fff;
  border-radius: 8px;
  padding: 8px 10px;
  font-weight: 700;
  text-align: center;
}

.danger-disclosure summary::-webkit-details-marker {
  display: none;
}

.danger-inline-form {
  margin-top: 8px;
}

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

.chart-item {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px;
  background: rgba(255, 255, 255, 0.02);
}

.chart-head {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 6px;
  font-size: 0.9rem;
}

.chart-bar-track {
  width: 100%;
  height: 10px;
  border-radius: 999px;
  background: #2a2a2a;
  overflow: hidden;
}

.chart-bar-fill {
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(135deg, #ff8a32, #ffb26e);
}

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

.mini-progress {
  width: 100%;
  min-width: 120px;
  height: 8px;
  border-radius: 999px;
  overflow: hidden;
  background: #303030;
  margin-bottom: 4px;
}

.mini-progress-fill {
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(135deg, #ff8a32, #ffb26e);
}

.mini-progress-fill.warn {
  background: linear-gradient(135deg, #f7a84f, #f58a1f);
}

.mini-progress-fill.danger {
  background: linear-gradient(135deg, #d4583a, #bf3b1f);
}

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

.inline-alert {
  display: grid;
  gap: 2px;
  border-radius: 10px;
  padding: 8px 10px;
  border: 1px solid #3b3b3b;
  background: rgba(255, 255, 255, 0.02);
}

.inline-alert.warn {
  border-color: rgba(241, 139, 46, 0.5);
  background: rgba(241, 139, 46, 0.13);
}

.inline-alert.danger {
  border-color: rgba(217, 75, 75, 0.5);
  background: rgba(217, 75, 75, 0.14);
}

.login-credit {
  margin-top: 12px;
  color: #c7c7c7;
  font-size: 0.82rem;
}

.inline-form {
  display: contents;
}

.inline-form input,
.inline-form select {
  min-width: 130px;
}

.tag {
  display: inline-block;
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 0.79rem;
  color: #fff;
}

.tag.income {
  background: var(--income);
}

.tag.expense {
  background: var(--expense);
}

.badge {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 0.76rem;
  font-weight: 700;
}

.badge.ok {
  background: rgba(49, 191, 106, 0.16);
  border: 1px solid rgba(49, 191, 106, 0.45);
  color: #a3f0c0;
}

.badge.bad {
  background: rgba(217, 75, 75, 0.16);
  border: 1px solid rgba(217, 75, 75, 0.45);
  color: #ffb2b2;
}

.badge.warn {
  background: rgba(241, 139, 46, 0.16);
  border: 1px solid rgba(241, 139, 46, 0.45);
  color: #ffd3a6;
}

.login-shell {
  display: grid;
  grid-template-columns: 1.1fr 1fr;
  gap: 18px;
  align-items: stretch;
}

.login-brand {
  background:
    radial-gradient(circle at 90% 0%, rgba(255, 161, 92, 0.2), transparent 38%),
    linear-gradient(158deg, #111111, #181818 52%, #121212 100%);
  color: #fff;
  border-radius: 20px;
  padding: 28px;
  border: 1px solid #2f2f2f;
  box-shadow: 0 16px 36px rgba(0, 0, 0, 0.34);
}

.login-brand h2 {
  margin-top: 0;
  margin-bottom: 10px;
  color: #ffba83;
}

.login-brand p {
  margin-top: 0;
  color: #e0e0e0;
  max-width: 56ch;
}

.login-carousel {
  margin-top: 14px;
}

.carousel-slide {
  display: none;
  animation: fadeIn 0.35s ease;
}

.carousel-slide.active {
  display: block;
}

.carousel-slide h3 {
  margin: 10px 0 6px;
  color: #ffcfaa;
  font-size: 1.1rem;
}

.carousel-slide p {
  margin: 0;
}

.carousel-image {
  width: 100%;
  max-width: 300px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid #343434;
  padding: 8px;
}

.carousel-dots {
  display: flex;
  gap: 8px;
  margin-top: 12px;
}

.carousel-dot {
  width: 11px;
  height: 11px;
  border-radius: 999px;
  border: 1px solid #757575;
  background: transparent;
  padding: 0;
}

.carousel-dot.active {
  background: #ff8e37;
  border-color: #ff8e37;
}

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

.family-edit-card {
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 14px;
  background: rgba(0, 0, 0, 0.18);
}

.family-edit-card h3 {
  margin: 0 0 10px;
}

.avatar {
  border-radius: 999px;
  object-fit: cover;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #222;
  border: 1px solid #3a3a3a;
}

.avatar-fallback {
  color: #ffd3ae;
  font-weight: 700;
}

.avatar-session {
  width: 36px;
  height: 36px;
  min-width: 36px;
}

.avatar-table {
  width: 44px;
  height: 44px;
}

.avatar-profile {
  width: 58px;
  height: 58px;
}

.profile-strip {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 10px;
}

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

.auth-panel {
  max-width: 560px;
}

.auth-panel.elevated {
  align-self: center;
}

.auth-form {
  display: grid;
  gap: 10px;
}

.hint {
  color: #c9c9c9;
  margin-top: 12px;
}

.goal-inline-form {
  display: inline-flex;
  gap: 6px;
  align-items: center;
  margin-bottom: 6px;
}

.goal-inline-form input,
.goal-inline-form select {
  min-width: 104px;
}

.app-modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.62);
  padding: 16px;
}

.app-modal-backdrop[hidden] {
  display: none !important;
}

.app-modal {
  width: min(420px, 100%);
  background: #171717;
  border: 1px solid #343434;
  border-radius: 16px;
  padding: 16px;
  box-shadow: 0 18px 44px rgba(0, 0, 0, 0.45);
}

.app-modal h3 {
  margin-top: 0;
  margin-bottom: 8px;
}

.app-modal-message {
  margin-top: 0;
  margin-bottom: 12px;
  color: #dddddd;
}

.app-modal-password {
  display: grid;
  gap: 6px;
  margin-bottom: 12px;
  color: var(--muted);
  font-size: 0.9rem;
}

.app-modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

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

@media (max-width: 760px) {
  .hero,
  .month-form {
    flex-direction: column;
    align-items: stretch;
  }

  .session-box {
    min-width: 0;
  }

  .actions-row {
    flex-direction: column;
  }
}
