.card,
.stat-card,
.table-shell,
.monthly-card,
.modal,
.auth-card,
.chart-panel {
  position: relative;
  overflow: hidden;
  background: linear-gradient(180deg, rgba(255,255,255,0.96), rgba(253,254,251,0.98));
  border: 1px solid rgba(25, 28, 26, 0.06);
  box-shadow: 0 8px 20px rgba(22, 42, 33, 0.05), 0 26px 44px rgba(22, 42, 33, 0.06);
  border-radius: 26px;
}

.card::before,
.stat-card::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(180deg, rgba(255,255,255,0.6), transparent 20%);
}

.auth-card {
  width: 100%;
  padding: 1.8rem;
  backdrop-filter: blur(12px);
}

.auth-card h1 {
  font-size: 1.6rem;
  font-weight: 800;
  margin-bottom: 0.35rem;
  color: var(--text);
}

.auth-link-row {
  margin-bottom: 1.15rem;
  font-size: 0.92rem;
  color: var(--muted);
}

.auth-link-row a {
  color: var(--accent);
  font-weight: 700;
  text-decoration: none;
}

.auth-link-row a:hover {
  color: var(--accent-2);
}

.auth-footer-note {
  margin-top: 1rem;
  font-size: 0.8rem;
  color: var(--muted-2);
}

input,
select,
textarea {
  width: 100%;
  min-height: 46px;
  padding: 0.82rem 0.95rem;
  border-radius: 16px;
  background: linear-gradient(180deg, rgba(247, 249, 244, 0.96), rgba(241, 245, 239, 0.96));
  border: 1px solid rgba(20, 92, 66, 0.09);
  color: var(--text);
  font-size: 0.95rem;
  transition: border-color 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
}

input::placeholder,
textarea::placeholder {
  color: #8c9791;
}

input:focus,
select:focus,
textarea:focus {
  border-color: rgba(20, 92, 66, 0.18);
  box-shadow: 0 0 0 4px rgba(63, 171, 125, 0.12);
  background: rgba(255,255,255,0.98);
}

label {
  margin-bottom: 0.4rem;
  display: block;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--muted);
}

.btn {
  min-height: 44px;
  padding: 0.74rem 1.15rem;
  border: 1px solid transparent;
  border-radius: 16px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  font-size: 0.92rem;
  font-weight: 800;
  line-height: 1;
  text-decoration: none;
  cursor: pointer;
  transition: transform 0.16s ease, box-shadow 0.16s ease, background 0.16s ease, border-color 0.16s ease, color 0.16s ease;
}

.btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 12px 22px rgba(25, 56, 43, 0.10);
}

.btn:active {
  transform: translateY(0);
}

.btn.btn-sm {
  min-height: 40px;
  padding: 0.65rem 0.92rem;
  border-radius: 14px;
  font-size: 0.86rem;
}

.btn-primary {
  color: #fff;
  background: linear-gradient(135deg, #145c42 0%, #2a8a65 100%);
  box-shadow: 0 14px 26px rgba(20, 92, 66, 0.18);
}

.btn-secondary {
  color: #214334;
  background: rgba(247, 249, 244, 0.98);
  border-color: rgba(20, 92, 66, 0.10);
}

.btn-success {
  color: #fff;
  background: linear-gradient(135deg, #1f7a4b 0%, #2aa868 100%);
}

.btn-danger {
  color: #fff;
  background: linear-gradient(135deg, #c95555 0%, #e07b7b 100%);
  box-shadow: 0 12px 22px rgba(201, 85, 85, 0.16);
}

.badge,
.chip-pill {
  border-radius: 999px;
  font-weight: 800;
}

.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 28px;
  padding: 0.2rem 0.7rem;
  font-size: 0.74rem;
  border: 1px solid rgba(20, 92, 66, 0.08);
}

.badge-free {
  color: #4f5f58;
  background: rgba(240, 244, 238, 0.94);
}

.badge-green {
  color: #165834;
  background: rgba(189, 237, 211, 0.7);
  border-color: rgba(31, 122, 75, 0.18);
}

.badge-red {
  color: #a03d3d;
  background: rgba(255, 225, 225, 0.88);
  border-color: rgba(201, 85, 85, 0.18);
}

.chip-pill {
  min-height: 32px;
  padding: 0 0.88rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(244, 247, 241, 0.95);
  border: 1px solid rgba(25, 28, 26, 0.06);
  color: #385246;
  font-size: 0.72rem;
}

.chip-pill.pro {
  background: rgba(177, 240, 206, 0.38);
  border-color: rgba(45, 106, 79, 0.12);
  color: #145c42;
}

.topbar-lang-switch {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.24rem;
  background: rgba(241, 244, 239, 0.95);
  border: 1px solid rgba(25, 28, 26, 0.05);
  border-radius: 999px;
}

.topbar-lang-btn {
  color: #6e7772;
}

.topbar-lang-btn:hover {
  color: #1a4735;
  background: rgba(45, 106, 79, 0.06);
}

.topbar-lang-btn.is-active {
  color: #fff;
  background: linear-gradient(90deg, #2d6a4f 0%, #4f9f7f 100%);
}

.sidebar-link {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 48px;
  padding: 0.82rem 0.95rem;
  border-radius: 18px;
  color: #5d6761;
  font-size: 0.92rem;
  font-weight: 600;
  transition: background 0.18s ease, color 0.18s ease, box-shadow 0.18s ease;
  cursor: pointer;
}

.sidebar-link::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  border: 1px solid transparent;
  pointer-events: none;
  transition: border-color 0.18s ease;
}

.sidebar-link:hover {
  background: rgba(20, 92, 66, 0.06);
  color: #173829;
}

.sidebar-link:hover::after {
  border-color: rgba(20, 92, 66, 0.08);
}

.sidebar-link.active {
  color: #145c42;
  background: linear-gradient(90deg, rgba(181, 241, 209, 0.58), rgba(214, 242, 233, 0.32));
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.86);
}

.sidebar-link.active::after {
  border-color: rgba(20, 92, 66, 0.16);
}

.sidebar-link.active::before {
  content: "";
  position: absolute;
  left: 10px;
  top: 10px;
  bottom: 10px;
  width: 3px;
  border-radius: 999px;
  background: linear-gradient(180deg, #145c42 0%, #2d8ccf 100%);
  box-shadow: 0 0 10px rgba(45, 140, 207, 0.18);
}

.nav-icon {
  width: 28px;
  height: 28px;
  min-width: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  border: 1px solid rgba(18, 63, 44, 0.05);
  background: rgba(255,255,255,0.8);
  color: #6c7671;
  font-size: 0.78rem;
  flex: 0 0 auto;
}

.sidebar-link.active .nav-icon {
  color: #145c42;
  background: rgba(255,255,255,0.95);
  border-color: rgba(20, 92, 66, 0.08);
}

.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1.15rem;
  margin-bottom: 1.15rem;
}

.dash-monthly-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1.15rem;
  margin-bottom: 1.15rem;
}

.panel-grid-2 {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1.15rem;
  margin-bottom: 1.15rem;
}

.dash-widgets-row {
  display: grid;
  grid-template-columns: 1.1fr 1fr 1.2fr;
  gap: 1.15rem;
  margin-bottom: 1.15rem;
}

.stat-card {
  min-height: 148px;
  padding: 1.45rem;
}

.dashboard-grid .stat-card:first-child {
  grid-column: span 2;
  background:
    radial-gradient(circle at 86% 18%, rgba(255,255,255,0.15), transparent 24%),
    linear-gradient(135deg, #1d7250 0%, #237d58 48%, #15573e 100%);
  border-color: rgba(14, 84, 58, 0.18);
  box-shadow: 0 24px 44px rgba(20, 92, 66, 0.24);
}

.dashboard-grid .stat-card:first-child .label,
.dashboard-grid .stat-card:first-child .value,
.dashboard-grid .stat-card:first-child .metric-caption {
  color: #ffffff;
}

.dashboard-grid .stat-card:first-child .label {
  opacity: 0.76;
}

.dashboard-grid .stat-card:first-child .metric-icon {
  background: rgba(255,255,255,0.16);
  color: #e8fff3;
  border-color: rgba(255,255,255,0.18);
}

.dashboard-grid .stat-card:first-child .value {
  font-size: clamp(2rem, 3vw, 3rem);
}

.monthly-card {
  padding: 1.35rem 1.4rem;
  min-height: 126px;
  box-shadow: var(--shadow-soft);
}

.monthly-card.income {
  background: linear-gradient(135deg, rgba(235, 248, 239, 0.96), rgba(252, 255, 252, 0.98));
}

.monthly-card.expense {
  background: linear-gradient(135deg, rgba(255, 241, 241, 0.96), rgba(255, 251, 251, 0.98));
}

.monthly-card.savings {
  background: linear-gradient(135deg, rgba(240, 246, 255, 0.96), rgba(253, 254, 255, 0.98));
}

.metric-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
}

.stat-card .label {
  font-size: 0.76rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: #7b8a82;
  margin-bottom: 0.45rem;
  font-weight: 800;
}

.stat-card .value {
  font-size: clamp(1.5rem, 2vw, 1.95rem);
  line-height: 1.05;
  font-weight: 900;
  color: var(--text);
}

.metric-icon {
  width: 42px;
  height: 42px;
  border-radius: 16px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.86rem;
  font-weight: 800;
  border: 1px solid transparent;
}

.metric-icon.green { background: rgba(186, 235, 208, 0.66); color: #165e38; border-color: rgba(31, 122, 75, 0.12); }
.metric-icon.red { background: rgba(255, 225, 225, 0.84); color: #b24848; border-color: rgba(201, 85, 85, 0.12); }
.metric-icon.purple { background: rgba(219, 228, 255, 0.88); color: #3d56b9; border-color: rgba(83, 103, 215, 0.12); }
.metric-icon.cyan { background: rgba(214, 242, 233, 0.88); color: #17695e; border-color: rgba(47, 136, 206, 0.12); }
.metric-icon.gold { background: rgba(255, 239, 205, 0.88); color: #8d6220; border-color: rgba(186, 139, 46, 0.12); }

.metric-caption {
  margin-top: 0.7rem;
  font-size: 0.82rem;
  line-height: 1.5;
  color: var(--muted);
}

.table-shell {
  padding: 0;
  overflow: hidden;
}

.table-shell-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.1rem 1.2rem 0.25rem;
  color: var(--muted);
  font-size: 0.86rem;
}

.chart-panel {
  position: relative;
  height: 360px;
  min-height: 360px;
  display: flex;
  flex-direction: column;
}

.chart-panel canvas,
#chart-cashflow,
#chart-inexp,
#chart-networth,
#chart-categories,
#chart-asset-alloc,
#chart-invest-alloc {
  flex: 1 1 auto;
  min-height: 0;
  width: 100% !important;
  height: 100% !important;
  max-width: 100%;
}

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

th {
  padding: 0.95rem 1rem;
  text-align: left;
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #5c6962;
  border-bottom: 1px solid rgba(22, 57, 41, 0.08);
  background: rgba(247, 250, 246, 0.84);
}

td {
  padding: 1rem;
  font-size: 0.92rem;
  color: var(--text);
  border-bottom: 1px solid rgba(22, 57, 41, 0.06);
}

tbody tr:hover td {
  background: rgba(233, 244, 237, 0.54);
}

.sortable-th,
th[data-sort-key] {
  cursor: pointer;
  user-select: none;
  transition: color 0.16s ease, background 0.16s ease;
}

.sortable-th:hover,
th[data-sort-key]:hover {
  color: #145c42;
  background: rgba(45, 106, 79, 0.03);
}

.sortable-th > span:first-child {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.sort-indicator,
.ff-sort-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 12px;
  margin-left: 0.4rem;
  font-size: 0.72rem;
  color: #93a09a;
  pointer-events: none;
}

.sort-indicator.is-active {
  color: #145c42;
}

.progress-bar {
  height: 12px;
  overflow: hidden;
  border-radius: 999px;
  background: #e7ece6;
  box-shadow: inset 0 1px 2px rgba(25, 28, 26, 0.05);
}

.progress-bar > span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #1f7a4b 0%, #4cb989 100%);
  box-shadow: 0 0 14px rgba(45, 106, 79, 0.14);
}

.modal-bg {
  position: fixed;
  inset: 0;
  z-index: 120;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  background: rgba(19, 33, 26, 0.28);
  backdrop-filter: blur(6px);
}

.modal {
  width: min(520px, 96vw);
  padding: 1.5rem;
}

#goals-grid .card,
#health-content .card {
  border-radius: 28px;
}

.license-layout.compact {
  display: grid;
  gap: 1rem;
}

.plan-comparison-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.9rem;
}

.plan-compact-card,
.plan-status-card {
  border-radius: 22px;
  border: 1px solid rgba(20, 92, 66, 0.10);
  background: linear-gradient(180deg, rgba(253, 254, 251, 0.98), rgba(248, 250, 246, 0.98));
  padding: 1rem 1.05rem;
}

.plan-compact-card.is-pro,
.plan-status-card.is-pro {
  border-color: rgba(45, 106, 79, 0.14);
  background:
    radial-gradient(circle at top right, rgba(95, 181, 150, 0.18), transparent 28%),
    linear-gradient(180deg, rgba(248, 255, 251, 0.99), rgba(242, 249, 245, 0.99));
}

.plan-status-card.is-expired {
  border-color: rgba(201, 85, 85, 0.14);
  background:
    radial-gradient(circle at top right, rgba(224, 123, 123, 0.14), transparent 24%),
    linear-gradient(180deg, rgba(255, 250, 250, 0.99), rgba(252, 246, 246, 0.99));
}

.plan-compact-head,
.plan-status-top {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  flex-wrap: wrap;
}

.plan-compact-head strong {
  font-size: 0.95rem;
  color: var(--text);
}

.plan-compact-badge {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0.1rem 0.72rem;
  border-radius: 999px;
  background: rgba(244, 247, 241, 0.96);
  border: 1px solid rgba(25, 28, 26, 0.06);
  color: #4f5f58;
  font-size: 0.68rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.plan-compact-badge.is-pro {
  color: #145c42;
  background: rgba(177, 240, 206, 0.48);
  border-color: rgba(45, 106, 79, 0.12);
}

.plan-compact-copy,
.plan-status-note,
.plan-status-footnote {
  margin-top: 0.7rem;
  color: var(--muted);
  font-size: 0.83rem;
  line-height: 1.55;
}

.plan-compact-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin-top: 0.85rem;
}

.plan-compact-list span {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 0 0.8rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.82);
  border: 1px solid rgba(25, 28, 26, 0.05);
  color: #385246;
  font-size: 0.74rem;
  font-weight: 700;
}

.plan-status-grid {
  display: grid;
  gap: 0.55rem;
  margin: 0.9rem 0 0.85rem;
}

.plan-status-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.8rem;
  padding: 0.78rem 0.9rem;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid rgba(25, 28, 26, 0.05);
}

.plan-status-row span {
  color: var(--muted);
  font-size: 0.77rem;
  font-weight: 700;
}

.plan-status-row strong {
  color: var(--text);
  font-size: 0.8rem;
  text-align: right;
}

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

  .dash-monthly-row,
  .panel-grid-2,
  .dash-widgets-row {
    grid-template-columns: 1fr;
  }

  .chart-panel {
    height: 340px;
    min-height: 340px;
  }

  .plan-comparison-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 900px) {
  .chart-panel {
    height: 320px;
    min-height: 320px;
  }
}
