:root {
  --primary: #1a5f2a;
  --primary-light: #2d8a42;
  --primary-dark: #0d3d18;
  --accent: #f5a623;
  --bg: #f5f7f2;
  --card-bg: #ffffff;
  --text: #1a1a1a;
  --text-dark: #1a1a1a;
  --text-muted: #5a5a5a;
  --border: #c8d4c0;
  --danger: #c0392b;
  --success: #27ae60;
  --danger-bg: #fde8e8;
  --danger-border: #e0a0a0;
  --table-header: #1a5f2a;
  --table-row-alt: #f4f8f2;
  --profil-bg-1: #e3f0de;
  --profil-bg-2: #cfe3c8;
  --profil-card-1: #0d3d18;
  --profil-card-2: #1a5f2a;
  --profil-highlight-1: #e08e0a;
  --profil-highlight-2: #b8720f;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --shadow-sm: 0 1px 4px rgba(0,0,0,0.06);
  --shadow-md: 0 2px 12px rgba(0,0,0,0.08);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-top: env(safe-area-inset-top, 0px);
}

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-behavior: smooth;
}

* { box-sizing: border-box; }

img {
  max-width: 100%;
  height: auto;
  display: block;
}

body {
  font-family: 'Segoe UI', system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg);
  margin: 0;
  padding: max(12px, var(--safe-top)) 10px calc(64px + var(--safe-bottom)) 10px;
  color: var(--text-dark);
  overflow-x: hidden;
  line-height: 1.5;
  -webkit-tap-highlight-color: transparent;
}

.container {
  max-width: 900px;
  margin: 0 auto;
  width: 100%;
}

.widget-header {
  margin-bottom: 12px;
  padding: 14px 16px;
  background:
    radial-gradient(circle at top right, rgba(255,255,255,0.14), transparent 28%),
    linear-gradient(135deg, #165224 0%, var(--primary) 45%, #2a8f40 100%);
  border-radius: var(--radius-md);
  color: #ffffff;
  box-shadow: 0 10px 26px rgba(13,61,24,0.18);
  border: 1px solid rgba(255,255,255,0.08);
}

.widget-header-row {
  display: grid;
  grid-template-columns: clamp(48px, 9vw, 75px) minmax(0, 1fr) clamp(72px, 16vw, 150px);
  align-items: center;
  gap: 12px;
  margin-left: 1rem;
  margin-right: 1rem;
}

.widget-header-logo {
  width: clamp(48px, 9vw, 75px);
  height: auto;
  max-height: clamp(48px, 9vw, 75px);
  object-fit: contain;
  flex-shrink: 0;
}

.widget-header-logo-2 {
  width: clamp(72px, 16vw, 150px);
  height: auto;
  max-height: clamp(72px, 16vw, 150px);
  object-fit: contain;
  flex-shrink: 0;
}

.widget-header-spacer {
  width: 48px;
  height: 48px;
  display: block;
  flex-shrink: 0;
}

.widget-header-text {
  text-align: center;
  min-width: 0;
  max-width: 100%;
}

.widget-header h1 {
  margin: 0 0 4px 0;
  font-size: 1.08rem;
  font-weight: 700;
  color: #ffffff;
  text-shadow: 0 1px 2px rgba(0,0,0,0.2);
  line-height: 1.3;
}

.widget-header p {
  margin: 0;
  color: #e8f5e8;
  font-size: clamp(0.5rem, 1.5vw, 0.65rem);
  line-height: 1.4;
  max-width: 42ch;
  margin-inline: auto;
  overflow-wrap: anywhere;
}

.section-card {
  background: var(--card-bg);
  border-radius: var(--radius-md);
  padding: 12px;
  margin-bottom: 10px;
  box-shadow: var(--shadow-md);
  border: 1px solid var(--border);
}

.section-title {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--primary-dark);
  margin-bottom: 10px;
  display: flex;
  align-items: flex-start;
  gap: 8px;
  line-height: 1.35;
}

.section-title .icon {
  font-size: 1.2rem;
  flex-shrink: 0;
  line-height: 1.35;
}

.section-title-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.title-main { display: block; }

.title-hint {
  display: block;
  font-size: 0.7rem;
  font-weight: 500;
  color: var(--text-muted);
}

.form-row {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
  margin-bottom: 10px;
}

.form-group {
  display: flex;
  flex-direction: column;
}

.form-group label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-dark);
  margin-bottom: 6px;
}

.form-group input, .form-group select {
  padding: 12px 14px;
  border: 2px solid var(--border);
  border-radius: 8px;
  font-size: 16px;
  color: var(--text-dark);
  background: #ffffff;
  transition: all 0.2s;
  font-weight: 500;
  width: 100%;
  min-height: 46px;
}

.form-group input:focus, .form-group select:focus {
  outline: none;
  border-color: var(--primary-light);
  box-shadow: 0 0 0 4px rgba(45,138,66,0.15);
}

.form-group input::placeholder {
  color: #999999;
}

.form-group input[readonly] {
  background: #f0f4ee;
  color: var(--primary-dark);
  font-weight: 700;
  cursor: default;
}

.expense-category {
  margin-bottom: 8px;
  padding: 6px;
  background: #f8faf6;
  border-radius: var(--radius-sm);
  border: 1px solid #dde5d8;
}

.expense-category:last-of-type { margin-bottom: 0; }

.category-header {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  padding: 6px 8px;
  background: #e0ece0;
  border-radius: 6px;
  font-weight: 700;
  color: var(--primary-dark);
  font-size: 0.8rem;
  margin-bottom: 4px;
  border: 1px solid #c8d8c0;
}

.category-description {
  padding: 0;
  font-size: 0.62rem;
  color: #17351d;
  line-height: 1.55;
}

.category-body {
  padding: 10px 10px 12px;
  background: #e0ece0;
  border: 1px solid #c8d8c0;
  border-top: none;
  border-radius: 0 0 8px 8px;
  margin-top: -4px;
}

.category-header-left {
  display: flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
  word-break: break-word;
  flex: 1;
}

.item-number {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.55em;
  height: 1.55em;
  padding: 0 0.4em;
  border-radius: 999px;
  background: linear-gradient(135deg, var(--primary), var(--primary-light));
  color: #ffffff;
  font-size: 0.72rem;
  font-weight: 900;
  line-height: 1;
  flex-shrink: 0;
  box-shadow: 0 2px 6px rgba(26,95,42,0.18);
}

.category-number {
  min-width: 1.8em;
  height: 1.8em;
  font-size: 0.8rem;
  background: linear-gradient(135deg, var(--primary-dark), var(--primary));
  box-shadow: 0 3px 8px rgba(13,61,24,0.22);
}

.category-actions {
  display: flex;
  gap: 4px;
  justify-content: flex-end;
  flex-shrink: 0;
}

.btn-icon {
  background: #ffffff;
  border: 1px solid #b8d0b0;
  border-radius: 6px;
  padding: 4px 7px;
  font-size: 0.68rem;
  cursor: pointer;
  color: var(--primary-dark);
  font-weight: 700;
  transition: all 0.15s;
  min-height: 28px;
  line-height: 1.2;
  flex: none;
}

.btn-icon:hover {
  background: var(--primary);
  color: #ffffff;
  border-color: var(--primary);
}

.btn-icon.delete {
  color: var(--danger);
  border-color: #e0a0a0;
}

.btn-icon.delete:hover {
  background: var(--danger);
  color: #ffffff;
  border-color: var(--danger);
}

.expense-item {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 8px 8px 9px;
  margin-bottom: 6px;
  background: #ffffff;
  border-radius: 10px;
  border: 1px solid #e8ede5;
}

.expense-item:last-child { margin-bottom: 0; }

.expense-item-main {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 112px 34px;
  gap: 8px;
  align-items: start;
}

.expense-item-label-wrap {
  min-width: 0;
  display: flex;
  flex-direction: column;
  /* gap: 4px; */
}

.expense-item-label {
  font-size: 0.8rem;
  color: var(--text-dark);
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
  overflow-wrap: break-word;
  line-height: 1.25;
}

.expense-item-label .item-number {
  margin-right: 0;
  background: #ffffff;
  color: var(--primary-dark);
  border: 1px solid #b8d0b0;
  box-shadow: 0 1px 3px rgba(0,0,0,0.06);
}

.expense-input {
  padding: 8px 10px;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  font-size: 0.95rem;
  text-align: right;
  color: var(--text-dark);
  background: #fafcfa;
  font-weight: 500;
  width: 100%;
  min-width: 0;
  min-height: 38px;
}

.expense-input:focus {
  outline: none;
  border-color: var(--primary-light);
  box-shadow: 0 0 0 3px rgba(45,138,66,0.12);
}

.btn-remove-item {
  background: var(--danger-bg);
  border: 1px solid var(--danger-border);
  color: var(--danger);
  border-radius: 5px;
  padding: 0;
  font-size: 0.7rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
  font-weight: 700;
  width: 34px;
  height: 34px;
  flex-shrink: 0;
}

.btn-remove-item:hover {
  background: var(--danger);
  color: #ffffff;
}

.btn-add-item {
  width: 100%;
  padding: 12px;
  background: #ffffff;
  border: 2px dashed var(--primary-light);
  border-radius: 8px;
  color: var(--primary-dark);
  font-size: 0.88rem;
  font-weight: 700;
  cursor: pointer;
  margin-top: 8px;
  transition: all 0.15s;
  min-height: 44px;
}

.expense-item-desc {
  font-size: 0.62rem;
  color: var(--text-muted);
  line-height: 1.5;
  padding-left: 25px;
}

.btn-add-item:hover {
  background: #f0f7f0;
  border-style: solid;
}

.btn-calculate-wrap {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 90;
  padding: 8px 10px calc(8px + var(--safe-bottom));
  background: linear-gradient(to top, var(--bg) 70%, transparent);
  pointer-events: none;
}

.btn-calculate {
  width: 100%;
  max-width: 900px;
  margin: 0 auto;
  display: block;
  padding: 12px 16px;
  background: linear-gradient(135deg, var(--primary), var(--primary-light));
  color: #ffffff;
  border: none;
  border-radius: var(--radius-md);
  font-size: 0.9rem;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.15s;
  letter-spacing: 0.2px;
  min-height: 46px;
  box-shadow: 0 4px 16px rgba(26,95,42,0.3);
  pointer-events: auto;
}

.btn-calculate:active {
  transform: scale(0.98);
}

@media (hover: hover) {
  .btn-calculate:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 24px rgba(26,95,42,0.4);
  }
}

.btn-add-category {
  width: 100%;
  padding: 10px;
  background: linear-gradient(135deg, #e8f5e8, #d0ebd0);
  border: 1.5px dashed var(--primary-light);
  border-radius: 8px;
  color: var(--primary-dark);
  font-size: 0.82rem;
  font-weight: 700;
  cursor: pointer;
  margin-top: 8px;
  transition: all 0.15s;
  min-height: 38px;
}

.btn-add-category:hover {
  background: linear-gradient(135deg, #d0ebd0, #b8e0b8);
  border-style: solid;
}

.result-section {
  display: none;
  animation: fadeIn 0.5s ease;
}

.result-section.active {
  display: block;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

.result-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
  margin-bottom: 14px;
}

.result-card {
  background: linear-gradient(135deg, #f0f7f0, #e8f5e8);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  text-align: left;
  border: 2px solid #c8dcc0;
  min-width: 0;
}

.result-card .label {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--text-dark);
  margin-bottom: 0;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  overflow-wrap: break-word;
  flex: 1;
  min-width: 0;
}

.total-highlight-bar {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
  text-align: left;
  background: linear-gradient(135deg, var(--primary), var(--primary-light));
  color: #ffffff;
  border: 2px solid var(--primary-dark);
  box-shadow: 0 4px 16px rgba(26,95,42,0.25);
  border-radius: var(--radius-md);
  padding: 16px;
  margin-bottom: 14px;
}

.result-card .value {
  font-size: 1.05rem;
  font-weight: 800;
  color: var(--primary-dark);
  overflow-wrap: break-word;
  word-break: break-word;
  text-align: right;
  flex-shrink: 0;
}

.total-highlight-bar .label {
  color: #e8f5e8;
  margin-bottom: 0;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.4px;
}

.total-highlight-bar .value {
  font-size: 1.5rem;
  font-weight: 800;
  color: #ffffff;
  text-shadow: 0 1px 3px rgba(0,0,0,0.2);
  word-break: break-word;
  line-height: 1.2;
}

.result-card.blue {
  background: linear-gradient(135deg, #e8f4fd, #d0e8f8);
  border-color: #90c0e0;
}

.result-card.blue .label { color: #0a4a7a; }
.result-card.blue .value { color: #0a4a7a; }

.result-card.red {
  background: linear-gradient(135deg, #fde8e8, #f8d0d0);
  border-color: #e0a0a0;
}

.result-card.red .label { color: #7a1a1a; }
.result-card.red .value { color: #7a1a1a; }

.lifestyle-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 6px;
  padding: 12px 16px;
  border-radius: 50px;
  font-weight: 700;
  font-size: 0.875rem;
  margin-bottom: 14px;
  border: 2px solid;
  max-width: 100%;
  text-align: center;
  line-height: 1.3;
  margin-left: auto;
  margin-right: auto;
}

.lifestyle-badge-container {
  display: flex;
  justify-content: center;
  align-items: center;
  width: 100%;
  text-align: center;
}

.lifestyle-badge.sederhana {
  background: #e8f5e8;
  color: #1a5f2a;
  border-color: #2d8a42;
}

.lifestyle-badge.menengah {
  background: #fff8e6;
  color: #8a6d1f;
  border-color: #f5a623;
}

.lifestyle-badge.mewah {
  background: #fde8e8;
  color: #8a1a1a;
  border-color: #c0392b;
}

.lifestyle-cards-row {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}

.lifestyle-card {
  background:
    linear-gradient(180deg, rgba(255,255,255,0.72), rgba(255,255,255,0.92)),
    #ffffff;
  border: 1px solid #c8d8c0;
  border-radius: 14px;
  padding: 14px;
  box-shadow: 0 6px 18px rgba(26,95,42,0.08);
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-width: 0;
  min-height: 100%;
  position: relative;
  overflow: hidden;
}

.lifestyle-card.active {
  background:
    linear-gradient(180deg, rgba(232,245,232,0.95), rgba(242,249,238,0.98)),
    #f2f9ee;
  border-color: #1a5f2a;
  box-shadow: 0 8px 22px rgba(26,95,42,0.14);
}

.lifestyle-card-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.lifestyle-name {
  font-weight: 900;
  color: var(--primary-dark);
  line-height: 1.25;
  font-size: 0.98rem;
}

.lifestyle-status {
  display: inline-block;
  font-size: 0.68rem;
  font-weight: 700;
  padding: 3px 9px;
  border-radius: 999px;
  background: #e8f5e8;
  color: var(--primary-dark);
  flex-shrink: 0;
  white-space: nowrap;
  border: 1px solid rgba(26,95,42,0.12);
}

.lifestyle-card-range {
  font-weight: 700;
  color: #17351d;
  font-size: 0.72rem;
  line-height: 1.45;
}

.lifestyle-card-desc {
  font-size: 0.68rem;
  color: var(--text-dark);
  line-height: 1.5;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

@media (max-width: 479px) {
  body {
    padding: 10px 8px calc(76px + var(--safe-bottom)) 8px;
  }
  .container {
    max-width: 100%;
  }
  .widget-header {
    padding: 12px;
    margin-bottom: 10px;
  }
  .widget-header-row {
    grid-template-columns: 64px 1fr;
    gap: 10px 12px;
    margin-left: 0;
    margin-right: 0;
    align-items: center;
  }
  .widget-header-logo {
    width: 54px;
    height: 54px;
  }
  .widget-header-logo-2 {
    display: none;
  }
  .widget-header-text {
    text-align: left;
  }
  .widget-header h1 {
    font-size: 1rem;
    margin-bottom: 4px;
  }
  .widget-header p {
    max-width: none;
    font-size: 0.56rem;
    line-height: 1.3;
  }
  .section-card {
    padding: 10px;
    margin-bottom: 10px;
  }
  .section-title {
    font-size: 0.92rem;
    margin-bottom: 10px;
  }
  .profil-identity-wrapper {
    margin-bottom: 10px;
  }
  .profil-identity-wrapper .profil-identity-card {
    padding: 10px 12px;
  }
  .profil-identity-grid {
    display: block;
    gap: 8px;
  }
  .profil-identity-left {
    display: flex;
    gap: 8px;
  }
  .profil-identity-right-mobile {
    display: block !important;
    text-align: left;
    padding-top: 4px;
  }
  .profil-identity-right-desktop {
    display: none !important;
  }
  .profil-cards-wrapper {
    grid-template-columns: 1fr;
    gap: 10px;
    padding: 10px;
  }
  .profil-cards-wrapper .profil-card.result-card {
    grid-column: auto;
  }
  .profil-card {
    padding: 12px;
  }
  .profil-card.input-card .profil-card-label {
    min-height: 0;
  }
  .profil-card-label {
    font-size: 0.74rem;
    margin-bottom: 6px;
  }
  .profil-input-wrap input {
    font-size: 1rem;
    min-height: 42px;
    padding: 8px 12px;
    padding-right: 48px;
  }
  .profil-input-suffix {
    right: 12px;
    font-size: 0.7rem;
  }
  .profil-card-note {
    font-size: 0.62rem;
    margin-top: 6px;
    line-height: 1.35;
  }
  .profil-identity-card .profil-card-identity-line {
    font-size: 0.68rem;
  }
  .profil-identity-card .profil-input-wrap input {
    min-height: 40px;
    font-size: 0.9rem;
  }
  .profil-card-identity-value {
    display: block;
    font-size: 0.6rem;
    line-height: 1.25;
    word-break: break-word;
  }
  .profil-card.result-card {
    flex-direction: column;
    padding: 12px;
    gap: 8px;
  }
  .profil-result-value {
    font-size: 2.2rem;
  }
  .profil-card.result-card > div:last-child {
    font-size: 0.65rem !important;
  }
  .category-header {
    flex-direction: row;
    flex-wrap: wrap;
    align-items: flex-start;
    gap: 6px 8px;
    padding: 10px;
  }
  .category-header-main {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 6px;
  }
  .category-header-left {
    flex-wrap: wrap;
    gap: 6px;
    align-items: center;
  }
  .category-description {
    width: 100%;
    font-size: 0.5rem !important;
    line-height: 1.3;
    max-width: none !important;
    margin-top: 2px;
  }
  .category-actions {
    margin-left: auto;
    justify-content: flex-end;
    width: auto;
  }
  .expense-category {
    padding: 8px;
    margin-bottom: 10px;
  }
  .expense-item {
    padding: 10px;
  }
  .expense-item-main {
    /* grid-template-columns: minmax(0, 1fr) 74px 34px; */
    gap: 6px;
  }
  .expense-item-label {
    font-size: 0.76rem;
  }
  .expense-item-desc {
    font-size: 0.58rem;
    padding-left: 26px;
  }
  .btn-add-category,
  .btn-calculate {
    min-height: 46px;
    font-size: 0.9rem;
  }
  .btn-calculate-wrap {
    padding: 8px 8px calc(8px + var(--safe-bottom));
  }
  .lifestyle-cards-row {
    grid-template-columns: 1fr;
    gap: 10px;
  }
  .lifestyle-card {
    padding: 12px;
  }
  .lifestyle-card-title {
    align-items: flex-start;
  }
  .lifestyle-card-range,
  .lifestyle-card-desc {
    font-size: 0.62rem;
  }
}

.lifestyle-detail {
  background: #f8faf6;
  border: 2px solid var(--border);
  border-radius: 10px;
  padding: 16px;
  margin-top: 12px;
}

.lifestyle-detail h4 {
  margin: 0 0 10px 0;
  color: var(--primary-dark);
  font-size: 0.95rem;
}

.lifestyle-detail p {
  margin: 4px 0;
  font-size: 0.88rem;
  color: var(--text-dark);
  line-height: 1.5;
}

.lifestyle-detail .range {
  font-weight: 700;
  color: var(--primary);
}

.monthly-needed {
  background: #fff0f0;
  border: 2px solid #e0b0b0;
  border-radius: 12px;
  padding: 20px;
  margin-top: 16px;
}

.monthly-needed h4 {
  margin: 0 0 12px 0;
  color: #8a1a1a;
  font-size: 1rem;
  font-weight: 700;
}

.monthly-needed p {
  margin: 6px 0;
  font-size: 0.92rem;
  color: #5a1a1a;
  line-height: 1.5;
  font-weight: 500;
}

.summary-chart-wrap {
  margin-top: 6px;
}

.donut-chart-container {
  position: relative;
  width: min(220px, 72vw);
  height: min(220px, 72vw);
  margin: 0 auto 12px;
}

.donut-chart-container svg {
  width: 100%;
  height: 100%;
  display: block;
  overflow: visible;
}

.donut-center {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  text-align: center;
  width: 58%;
  max-width: 118px;
  pointer-events: none;
}

.donut-center-label {
  font-size: 0.62rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.3px;
  font-weight: 600;
  line-height: 1.2;
}

.donut-center-value {
  font-size: clamp(0.68rem, 3.2vw, 0.82rem);
  font-weight: 800;
  color: var(--primary-dark);
  line-height: 1.2;
  margin-top: 3px;
  word-break: break-word;
}

.donut-center-value.is-long {
  font-size: clamp(0.58rem, 2.8vw, 0.7rem);
}

.donut-seg-label {
  font-size: 11px;
  font-weight: 800;
  fill: #ffffff;
  text-anchor: middle;
  dominant-baseline: central;
  pointer-events: none;
  paint-order: stroke fill;
  stroke: rgba(0,0,0,0.25);
  stroke-width: 2px;
  stroke-linejoin: round;
}

.bar-chart-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.bar-chart-item {
  padding: 6px 8px;
  background: #f8faf6;
  border-radius: 6px;
  border: 1px solid #e8ede5;
}

.bar-chart-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
}

.bar-chart-name {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 0.74rem;
  font-weight: 600;
  color: var(--primary-dark);
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.bar-chart-name .bar-icon {
  flex-shrink: 0;
  font-size: 0.85rem;
  line-height: 1;
}

.bar-chart-pct {
  font-size: 0.68rem;
  font-weight: 700;
  color: var(--text-muted);
  flex-shrink: 0;
}

.bar-chart-track {
  height: 5px;
  background: #e0e8dc;
  border-radius: 3px;
  overflow: hidden;
  margin-bottom: 3px;
}

.bar-chart-fill {
  height: 100%;
  border-radius: 3px;
  transition: width 0.45s ease;
  min-width: 2px;
}

.bar-chart-amounts {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px 8px;
  margin-top: 1px;
}

.bar-amount-item {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
}

.bar-amount-item:last-child {
  text-align: right;
}

.bar-amount-label {
  font-size: 0.58rem;
  color: var(--text-muted);
  text-transform: uppercase;
  font-weight: 600;
  letter-spacing: 0.2px;
  line-height: 1.2;
}

.bar-amount-value {
  font-size: 0.68rem;
  color: var(--text-dark);
  font-weight: 700;
  line-height: 1.25;
  word-break: break-word;
}

.summary-total-compact {
  margin-top: 8px;
  padding: 8px 10px;
  background: linear-gradient(135deg, #e0ece0, #d4e6d4);
  border-radius: 6px;
  border: 1.5px solid #c8d8c0;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px 10px;
  font-size: 0.72rem;
}

.summary-total-compact .total-label {
  font-weight: 700;
  color: var(--primary-dark);
  text-transform: uppercase;
  letter-spacing: 0.2px;
  grid-column: 1 / -1;
  margin-bottom: 2px;
}

.summary-total-compact .total-item {
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.summary-total-compact .total-item span:first-child {
  font-size: 0.62rem;
  color: var(--text-muted);
  text-transform: uppercase;
  font-weight: 600;
}

.summary-total-compact .total-item span:last-child {
  font-weight: 800;
  color: var(--primary-dark);
  font-size: 0.78rem;
}

.summary-table-desktop {
  display: none;
}

.note {
  font-size: 0.82rem;
  color: var(--text-muted);
  margin-top: 10px;
  font-style: italic;
  line-height: 1.5;
}

.modal-overlay {
  display: none;
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.45);
  z-index: 1000;
  align-items: flex-end;
  justify-content: center;
  padding: 0;
}

.modal-overlay.active {
  display: flex;
}

.modal-box {
  background: white;
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  padding: 20px 16px calc(20px + var(--safe-bottom));
  width: 100%;
  max-width: 480px;
  max-height: 85vh;
  overflow-y: auto;
  box-shadow: 0 -8px 40px rgba(0,0,0,0.2);
  border: none;
  border-top: 3px solid var(--primary);
  animation: slideUp 0.25s ease;
}

@keyframes slideUp {
  from { transform: translateY(100%); }
  to { transform: translateY(0); }
}

.modal-box h3 {
  margin: 0 0 18px 0;
  color: var(--primary-dark);
  font-size: 1.1rem;
}

.modal-box input {
  width: 100%;
  padding: 12px 14px;
  border: 2px solid var(--border);
  border-radius: 8px;
  font-size: 16px;
  color: var(--text-dark);
  margin-bottom: 14px;
  box-sizing: border-box;
  font-weight: 500;
  min-height: 46px;
}

.modal-box input:focus {
  outline: none;
  border-color: var(--primary-light);
  box-shadow: 0 0 0 3px rgba(45,138,66,0.12);
}

.modal-actions {
  display: flex;
  flex-direction: column-reverse;
  gap: 10px;
}

.modal-actions button {
  padding: 14px 18px;
  border-radius: var(--radius-sm);
  border: none;
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.15s;
  min-height: 50px;
  width: 100%;
}

.modal-actions .btn-cancel {
  background: #e8e8e8;
  color: #555555;
}

.modal-actions .btn-cancel:hover {
  background: #d0d0d0;
}

.modal-actions .btn-confirm {
  background: var(--primary);
  color: #ffffff;
}

.modal-actions .btn-confirm:hover {
  background: var(--primary-dark);
}

.modal-pdf-box {
  padding: 14px 14px calc(14px + var(--safe-bottom));
  max-width: 960px;
  width: 100%;
  max-height: 92vh;
}

.modal-pdf-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.modal-pdf-header h3 {
  margin: 0;
  color: var(--primary-dark);
  font-size: 1rem;
}

.btn-close-pdf {
  width: 38px;
  height: 38px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #ffffff;
  color: var(--primary-dark);
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
}

.pdf-preview-frame-wrap {
  width: 100%;
  height: min(72vh, 760px);
  border: 1.5px solid #d5e1cf;
  border-radius: 12px;
  overflow: hidden;
  background: #f8faf6;
  box-shadow: inset 0 1px 3px rgba(0,0,0,0.04);
}

.pdf-preview-pages {
  width: 100%;
  height: 100%;
  overflow-y: auto;
  padding: 10px;
  background: #ffffff;
}

.pdf-preview-page {
  display: flex;
  justify-content: center;
  margin-bottom: 14px;
}

.pdf-preview-page:last-child {
  margin-bottom: 0;
}

.pdf-preview-page canvas {
  max-width: 100%;
  height: auto;
  border-radius: 8px;
  box-shadow: 0 2px 10px rgba(0,0,0,0.12);
}

.modal-pdf-actions {
  margin-top: 12px;
}

.total-bar {
  text-align: center;
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-top: 8px;
  padding: 8px 10px;
  background: #e8f0e4;
  border-radius: 6px;
  border: 1.5px solid #c8d8c0;
  font-weight: 600;
  line-height: 1.35;
}

.total-bar strong {
  display: block;
  color: var(--primary-dark);
  font-size: 1rem;
  margin-top: 2px;
  word-break: break-word;
}

.table-scroll {
  margin-top: 10px;
}

.summary-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
  margin-top: 0;
}

.summary-table th {
  background: var(--primary);
  color: #ffffff;
  padding: 12px;
  text-align: left;
  font-weight: 700;
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.4px;
}

.summary-table td {
  padding: 10px 12px;
  border-bottom: 1.5px solid var(--border);
  color: var(--text-dark);
  font-weight: 500;
  text-align: left;
}

.summary-table th:nth-child(2),
.summary-table th:nth-child(3),
.summary-table td:nth-child(2),
.summary-table td:nth-child(3) {
  text-align: right;
}

.summary-table td:nth-child(2),
.summary-table td:nth-child(3) {
  white-space: nowrap;
}

.money-cell {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  width: 100%;
  min-width: 0;
}

.money-currency {
  flex-shrink: 0;
  text-align: left;
}

.money-amount {
  flex: 1;
  text-align: right;
  min-width: 0;
}

.summary-table tr:nth-child(even) { background: #f4f8f2; }
.summary-table .total-row {
  font-weight: 800;
  background: #e0ece0 !important;
  color: var(--primary-dark);
}

/* ===== PROFIL PENSIUN CARDS ===== */
.profil-cards-wrapper {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 12px;
  background:
    linear-gradient(180deg, rgba(255,255,255,0.65), rgba(255,255,255,0.2)),
    linear-gradient(135deg, var(--profil-bg-1), var(--profil-bg-2));
  border-radius: var(--radius-lg);
  padding: 12px;
  border: 1px solid #b8d0b0;
  box-shadow: 0 8px 22px rgba(26,95,42,0.08);
}

.profil-cards-wrapper .profil-card.result-card {
  grid-column: 1 / -1;
}

.profil-card {
  border-radius: 14px;
  padding: 12px 12px 10px;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  min-height: auto;
}

.profil-card.result-card {
  flex-direction: row;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 14px 14px;
}

.profil-card.input-card {
  background: linear-gradient(135deg, var(--profil-card-1), var(--profil-card-2));
  border: 1px solid rgba(255,255,255,0.08);
  box-shadow: 0 2px 8px rgba(13,61,24,0.2);
  justify-content: flex-start;
}

.profil-identity-card {
  min-height: 0;
  padding: 6px 10px;
}

.profil-identity-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 6px 16px;
  align-items: start;
}

.profil-identity-left {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}

.profil-identity-right {
  align-self: start;
  padding-top: 1px;
  text-align: right;
}

.profil-identity-right-mobile {
  display: none;
}

.profil-identity-right-desktop {
  display: block;
}

.profil-card-identity-line {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 6px;
  min-width: 0;
  color: #ffffff;
  font-size: 0.64rem;
  line-height: 1.1;
}

.profil-card-identity-label {
  font-weight: 700;
  flex: 0 0 auto;
  white-space: nowrap;
  opacity: 0.95;
  letter-spacing: 0.2px;
}

.profil-card-identity-value {
  font-weight: 600;
  color: rgba(255,255,255,0.92);
  min-width: 0;
  overflow-wrap: anywhere;
  font-size: 0.72rem;
  line-height: 1.2;
}

.profil-identity-card .profil-input-wrap {
  min-height: 0;
  margin-bottom: 0;
  flex: 1;
  min-width: 0;
}

.profil-card-identity-line input {
  width: 100%;
  min-width: 0;
  min-height: 30px;
  padding: 4px 8px;
  border: none;
  border-radius: 8px;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-dark);
  background: rgba(255, 255, 255, 0.95);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

.profil-card-identity-line input:focus {
  outline: none;
  background: #ffffff;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15), 0 0 0 3px rgba(255, 255, 255, 0.2);
}

.profil-card-identity-line input::placeholder {
  color: #7a9a80;
  font-size: 0.7rem;
  font-weight: 500;
}

.profil-card-identity-line input[type="date"] {
  font-size: 0.72rem;
}

.profil-card.result-card {
  background: linear-gradient(135deg, var(--profil-highlight-1), var(--profil-highlight-2));
  border: 1px solid rgba(255,255,255,0.15);
  box-shadow: 0 2px 8px rgba(184,114,15,0.25);
  align-items: center;
  text-align: center;
}

.profil-card-label {
  color: #ffffff;
  font-size: 0.75rem;
  font-weight: 600;
  margin-bottom: 8px;
  text-shadow: 0 1px 2px rgba(0,0,0,0.15);
  line-height: 1.25;
}

.profil-card.input-card .profil-card-label { min-height: 0; }

.profil-card.result-card .profil-card-label {
  margin-bottom: 0;
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.profil-input-wrap {
  position: relative;
  display: flex;
  align-items: center;
  min-height: 44px;
}

.profil-input-wrap input {
  width: 100%;
  padding: 8px 12px;
  padding-right: 54px;
  border: none;
  border-radius: 12px;
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-dark);
  background: #ffffff;
  box-shadow: 0 4px 14px rgba(0,0,0,0.12);
  min-height: 44px;
}

.profil-card.input-card input[type="text"] {
  padding-right: 12px;
  font-size: 0.95rem;
  font-weight: 600;
}

.profil-input-wrap input[type=number]::-webkit-inner-spin-button,
.profil-input-wrap input[type=number]::-webkit-outer-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.profil-input-wrap input[type=number] {
  -moz-appearance: textfield;
  appearance: textfield;
}

.profil-input-wrap input:focus {
  outline: none;
  box-shadow: 0 0 0 3px rgba(255,255,255,0.45), 0 1px 4px rgba(0,0,0,0.1);
}

.profil-input-suffix {
  position: absolute;
  right: 14px;
  color: #888888;
  font-size: 0.72rem;
  font-weight: 600;
  pointer-events: none;
}

.profil-card.input-card input[type="text"] + .profil-input-suffix {
  display: none;
}

.profil-card-note {
  margin-top: 8px;
  color: rgba(255,255,255,0.9);
  font-size: 0.65rem;
  line-height: 1.35;
}

.profil-card.input-card .profil-card-label {
  min-height: 2.6em;
  display: flex;
  align-items: flex-start;
}

.profil-card.result-card > div:last-child {
  color: rgba(255,255,255,0.95);
  font-size: 0.72rem;
  line-height: 1.4;
}

.profil-identity-wrapper {
  margin-bottom: 6px;
}

.profil-identity-wrapper .profil-identity-card {
  padding: 6px 10px 4px;
  min-height: 0;
}

.profil-result-value {
  font-size: 1.7rem;
  font-weight: 800;
  color: #ffffff;
  line-height: 1;
  text-shadow: 0 1px 4px rgba(0,0,0,0.2);
}

/* ===== TABLET & DESKTOP ===== */
@media (min-width: 480px) {
  body {
    padding: max(16px, var(--safe-top)) 16px calc(24px + var(--safe-bottom)) 16px;
  }
  .widget-header { padding: 24px 20px; margin-bottom: 20px; border-radius: var(--radius-lg); box-shadow: var(--shadow-md); }
  .widget-header h1 { font-size: 1.5rem; margin-bottom: 6px; }
  .widget-header p { font-size: 0.72rem; max-width: none; }
  .widget-header p {
    font-size: 0.72rem;
    line-height: 1.45;
  }
  .widget-header-row {
    grid-template-columns: 72px minmax(0, 1fr) 88px;
    gap: 10px 12px;
    margin-left: 0;
    margin-right: 0;
  }
  .widget-header-logo {
    width: 68px;
    height: 68px;
  }
  .widget-header-logo-2 {
    width: 88px;
    height: auto;
    max-height: 88px;
  }
  .widget-header-text {
    text-align: center;
    padding-inline: 4px;
  }
  .section-card { padding: 20px; margin-bottom: 14px; }
  .section-title { font-size: 1.1rem; margin-bottom: 16px; }
  .form-row { grid-template-columns: 1fr 1fr; gap: 12px; }
  .category-header {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    padding: 10px 12px;
    margin-bottom: 8px;
    font-size: 0.9rem;
    border-radius: var(--radius-sm);
  }
  .category-actions { flex: none; }
  .item-number { font-size: 0.82rem; }
  .btn-icon { flex: none; max-width: none; min-height: 38px; padding: 8px 12px; font-size: 0.8rem; border-width: 1.5px; }
  .expense-category { padding: 12px; margin-bottom: 12px; }
  .category-body { padding: 12px 12px 14px; }
  .expense-item {
    padding: 10px 10px 12px;
    background: #ffffff;
    border: 1px solid #e8ede5;
    border-radius: 10px;
    box-shadow: none;
    margin-bottom: 8px;
  }
  .expense-item-main {
    grid-template-columns: minmax(0, 1fr) 176px 38px;
    gap: 10px;
  }
  .expense-item-label-wrap {
    /* gap: 5px; */
  }
  .expense-item-label {
    font-size: 0.84rem;
  }
  .expense-item-label .item-number {
    min-width: 1.6em;
    height: 1.6em;
  }
  .expense-input {
    min-height: 42px;
    padding: 10px 12px;
    font-size: 1.05rem;
    font-weight: 600;
    min-width: 0;
    background: #ffffff;
  }
  .btn-remove-item {
    width: 38px;
    height: 38px;
  }
  .expense-item-desc {
    font-size: 0.7rem;
    padding-left: 30px;
  }
  .result-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
  }
  .result-card {
    flex-direction: column;
    text-align: center;
    padding: clamp(14px, 4vw, 20px);
  }
  .result-card .label { margin-bottom: 6px; }
  .result-card .value { text-align: center; font-size: 1.15rem; }
  .total-highlight-bar {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
  }
  .total-highlight-bar .value { font-size: 1.75rem; }
  .profil-cards-wrapper {
    grid-template-columns: 1fr 1fr;
    gap: 14px;
    padding: 16px;
    border-radius: var(--radius-lg);
  }
  .profil-cards-wrapper .profil-card.result-card { grid-column: 1 / -1; }
  .profil-card { padding: 16px; min-height: 124px; border-radius: var(--radius-lg); }
  .profil-card.input-card { box-shadow: 0 4px 14px rgba(13,61,24,0.25); }
  .profil-card.result-card {
    flex-direction: column;
    padding: 18px;
    box-shadow: 0 4px 14px rgba(184,114,15,0.3);
  }
  .profil-card-label { font-size: 0.9rem; margin-bottom: 10px; line-height: 1.35; }
  .profil-card.input-card .profil-card-label { min-height: 3.2em; }
  .profil-card-note { font-size: 0.82rem; margin-top: 10px; }
  .profil-identity-wrapper {
    margin-bottom: 8px;
  }
  .profil-identity-wrapper .profil-identity-card {
    padding: 8px 12px 6px;
    min-height: 0;
  }
  .profil-card.result-card .profil-card-label { margin-bottom: 8px; font-size: 0.8rem; }
  .profil-input-wrap input {
    font-size: 1.6rem;
    min-height: 54px;
    padding: 12px 14px;
    padding-right: 56px;
    border-radius: var(--radius-sm);
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
  }
  .profil-input-suffix { right: 14px; font-size: 0.8rem; }
  .profil-result-value { font-size: 3.5rem; text-shadow: 0 2px 8px rgba(0,0,0,0.2); }
  .btn-calculate-wrap {
    position: static;
    padding: 0;
    background: none;
    pointer-events: auto;
    margin-top: 8px;
  }
  .btn-calculate {
    max-width: none;
    box-shadow: none;
    min-height: 52px;
  }
  .modal-overlay {
    align-items: center;
    padding: 16px;
  }
  .modal-box {
    border-radius: var(--radius-lg);
    padding: 24px;
    border: 2px solid var(--border);
    border-top: 2px solid var(--border);
    animation: fadeIn 0.25s ease;
  }
  .modal-pdf-box {
    padding: 18px;
  }
  .modal-pdf-header h3 {
    font-size: 1.1rem;
  }
  .pdf-preview-frame-wrap {
    height: 72vh;
  }
  .pdf-preview-pages {
    padding: 14px;
  }
  .modal-actions {
    flex-direction: row;
    justify-content: flex-end;
  }
  .modal-actions button { width: auto; flex: 1; min-height: 44px; }
  .btn-add-category {
    padding: 14px;
    font-size: 0.95rem;
    min-height: 48px;
    margin-top: 10px;
    border-width: 2px;
  }
  .total-bar { text-align: right; padding: 14px; font-size: 0.875rem; }
  .total-bar strong { display: inline; font-size: 1.15rem; margin-top: 0; }
  .summary-table-desktop { display: block; margin-top: 16px; }
  .summary-chart-wrap {
    display: grid;
    grid-template-columns: 210px 1fr;
    gap: 20px;
    align-items: start;
  }
  .donut-chart-container {
    width: 200px;
    height: 200px;
    margin: 0;
  }
  .donut-center { width: 55%; max-width: 108px; }
  .donut-center-label { font-size: 0.68rem; }
  .donut-center-value { font-size: 0.88rem; }
  .donut-center-value.is-long { font-size: 0.76rem; }
  .donut-seg-label { font-size: 12px; }
  .bar-chart-item { padding: 8px 10px; }
  .bar-chart-name { font-size: 0.82rem; }
  .bar-chart-amounts { gap: 6px 12px; }
  .bar-amount-label { font-size: 0.62rem; }
  .bar-amount-value { font-size: 0.75rem; }
  .summary-total-compact {
    grid-column: 1 / -1;
    padding: 12px 14px;
    font-size: 0.82rem;
  }
  .summary-total-compact .total-item span:last-child { font-size: 0.9rem; }
  .lifestyle-cards-row {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 14px;
    align-items: stretch;
  }
  .lifestyle-card {
    padding: 16px;
  }
  .lifestyle-card-range {
    min-height: 2.7em;
  }
}

@media (min-width: 720px) {
  body { padding: max(20px, var(--safe-top)) 24px 24px 24px; }
  .container { max-width: 900px; }
  .profil-cards-wrapper {
    grid-template-columns: 1fr 1fr 1fr;
    gap: 14px;
    padding: 16px;
    border-radius: var(--radius-lg);
  }
  .profil-cards-wrapper .profil-card.result-card { grid-column: auto; }
  .profil-card { padding: 16px 18px; min-height: 168px; }
  .profil-card.input-card,
  .profil-card.result-card { flex-direction: column; }
  .profil-card-label { margin-bottom: 12px; }
  .profil-card-note { margin-top: 12px; }
  .profil-input-wrap input { font-size: 1.75rem; padding-right: 64px; }
  .profil-result-value { font-size: 4rem; }
  .profil-identity-card .profil-card-identity-line {
    font-size: 0.78rem;
  }
  .profil-identity-card .profil-input-wrap input {
    min-height: 42px;
    font-size: 0.92rem;
  }
  .widget-header h1 { font-size: 1.65rem; }
}

@media (min-width: 480px) and (max-width: 719px) {
  .widget-header {
    padding: 16px 14px;
    margin-bottom: 12px;
  }
  .widget-header-row {
    grid-template-columns: 56px minmax(0, 1fr) 72px;
    gap: 8px 10px;
    margin-left: 0;
    margin-right: 0;
  }
  .widget-header-logo {
    width: 52px;
    height: 52px;
  }
  .widget-header-logo-2 {
    width: 72px;
    height: auto;
    max-height: 72px;
  }
  .widget-header-text {
    padding-inline: 2px;
  }
  .widget-header h1 {
    font-size: 0.9rem;
    line-height: 1.2;
  }
  .widget-header p {
    font-size: 0.5rem;
    line-height: 1.2;
    max-width: none;
  }
  .profil-identity-grid {
    display: block;
  }
  .profil-identity-right-desktop {
    display: none !important;
  }
  .profil-identity-right-mobile {
    display: block !important;
    text-align: left;
    padding-top: 4px;
  }
  .profil-card-identity-value {
    display: block;
    font-size: 0.64rem;
    line-height: 1.25;
    word-break: break-word;
  }
  .profil-cards-wrapper {
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    padding: 10px;
  }
  .profil-cards-wrapper .profil-card.result-card {
    grid-column: 1 / -1;
  }
  .section-card {
    padding: 11px;
  }
}
