:root {
  --bg0: #07090d;
  --bg1: #0d1219;
  --panel: rgba(16, 22, 32, 0.82);
  --line: rgba(255, 255, 255, 0.08);
  --text: #e8edf5;
  --muted: #8b96a8;
  --ember: #ff6b3d;
  --ember2: #ffb347;
  --cyan: #3ecfcf;
  --ok: #4ade80;
  --danger: #ff7b7b;
}

* { box-sizing: border-box; }

html {
  min-height: 100%;
  max-width: 100%;
  overflow-x: clip;
  color-scheme: dark;
}

body {
  margin: 0;
  font-family: "DM Sans", system-ui, sans-serif;
  color: var(--text);
  background: var(--bg0);
  position: relative;
  max-width: 100%;
  width: 100%;
  overflow-x: clip;
  min-height: 100vh;
  color-scheme: dark;
}

.bg {
  position: fixed;
  inset: 0;
  z-index: -1;
  overflow: hidden;
  background:
    radial-gradient(1200px 700px at 10% -10%, rgba(255, 107, 61, 0.18), transparent 55%),
    radial-gradient(900px 600px at 95% 10%, rgba(62, 207, 207, 0.12), transparent 50%),
    radial-gradient(800px 500px at 70% 100%, rgba(255, 179, 71, 0.08), transparent 55%),
    linear-gradient(180deg, #07090d 0%, #0a0f16 50%, #07090d 100%);
}
.bg__grid {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(255,255,255,0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,0.035) 1px, transparent 1px);
  background-size: 56px 56px;
  mask-image: radial-gradient(ellipse at center, #000 35%, transparent 80%);
  animation: gridDrift 28s linear infinite;
}
.bg__orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(40px);
  opacity: 0.55;
  animation: float 14s ease-in-out infinite;
}
.bg__orb--a {
  width: 340px; height: 340px;
  left: -80px; top: 20%;
  background: radial-gradient(circle, rgba(255,107,61,0.55), transparent 70%);
}
.bg__orb--b {
  width: 420px; height: 420px;
  right: -120px; top: -40px;
  background: radial-gradient(circle, rgba(62,207,207,0.4), transparent 70%);
  animation-delay: -4s;
}
.bg__orb--c {
  width: 280px; height: 280px;
  right: 20%; bottom: 5%;
  background: radial-gradient(circle, rgba(255,179,71,0.28), transparent 70%);
  animation-delay: -8s;
}
.bg__scan {
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(
    0deg,
    transparent,
    transparent 3px,
    rgba(0,0,0,0.08) 3px,
    rgba(0,0,0,0.08) 4px
  );
  pointer-events: none;
  opacity: 0.35;
}

@keyframes float {
  0%, 100% { transform: translateY(0) scale(1); }
  50% { transform: translateY(-28px) scale(1.05); }
}
@keyframes gridDrift {
  from { transform: translateY(0); }
  to { transform: translateY(56px); }
}
@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 4px rgba(255,107,61,0.2), 0 0 18px rgba(255,107,61,0.7); }
  50% { box-shadow: 0 0 0 8px rgba(255,107,61,0.08), 0 0 28px rgba(255,107,61,0.9); }
}
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

.wrap {
  max-width: 960px;
  margin: 0 auto;
  padding-left: 16px;
  padding-right: 16px;
  width: 100%;
}

.top {
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(12px);
  background: rgba(7, 9, 13, 0.55);
  position: sticky;
  top: 0;
  z-index: 20;
}
.top__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 64px;
  padding: 10px 0;
  gap: 12px;
  flex-wrap: wrap;
}
.top__actions {
  display: flex;
  align-items: center;
  gap: 12px;
}
.install-link {
  color: var(--ember2);
  font-weight: 700;
  font-size: 15px;
  text-decoration: underline;
  text-underline-offset: 3px;
}
.install-link[hidden] { display: none !important; }
.install-hint {
  flex: 1 1 100%;
  margin: 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.4;
}
.install-hint[hidden] { display: none !important; }
.login-card .install-link,
.login-card .install-hint { margin-top: 14px; }
.brand { display: flex; align-items: center; gap: 10px; }

.tabs {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
.tab {
  font: inherit;
  font-size: 13px;
  font-weight: 700;
  color: var(--muted);
  background: transparent;
  border: 1px solid transparent;
  border-radius: 10px;
  padding: 8px 12px;
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s, background 0.15s;
}
.tab:hover { color: var(--text); }
.tab.is-active {
  color: var(--text);
  border-color: var(--line);
  background: rgba(255, 255, 255, 0.04);
}

.tab-panel[hidden] { display: none !important; }
.obj.is-zero .obj__per { color: var(--muted); }

.month-nav {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.03);
  backdrop-filter: blur(8px);
  min-width: min(320px, 100%);
}
.month-nav__btn {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s, transform 0.15s;
}
.month-nav__btn:hover {
  border-color: rgba(255, 107, 61, 0.55);
  background: rgba(255, 107, 61, 0.12);
  transform: translateY(-1px);
}
.month-nav__center {
  flex: 1;
  text-align: center;
  min-width: 0;
}
.month-nav__label {
  font-weight: 700;
  font-size: 18px;
  letter-spacing: 0.01em;
  text-transform: capitalize;
}
.month-nav__years {
  display: flex;
  justify-content: center;
  gap: 6px;
  margin-top: 6px;
}
.year-chip {
  font: inherit;
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
  background: transparent;
  border: 1px solid transparent;
  border-radius: 999px;
  padding: 4px 10px;
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s, background 0.15s;
}
.year-chip:hover { color: var(--text); }
.year-chip.is-active {
  color: #140c08;
  background: linear-gradient(135deg, var(--ember), var(--ember2));
  border-color: transparent;
}

.month-chips {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 8px;
  margin: 0 0 18px;
}
.month-chip {
  font: inherit;
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px 8px;
  cursor: pointer;
  text-transform: capitalize;
  transition: color 0.15s, border-color 0.15s, background 0.15s, transform 0.15s;
}
.month-chip:hover {
  color: var(--text);
  border-color: rgba(62, 207, 207, 0.4);
  transform: translateY(-1px);
}
.month-chip.is-active {
  color: var(--text);
  border-color: rgba(255, 107, 61, 0.55);
  background: rgba(255, 107, 61, 0.14);
  box-shadow: 0 0 0 1px rgba(255, 107, 61, 0.18);
}

.segment {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.22);
}
.segment__btn {
  font: inherit;
  font-size: 13px;
  font-weight: 700;
  color: var(--muted);
  background: transparent;
  border: 1px solid transparent;
  border-radius: 9px;
  padding: 10px 8px;
  cursor: pointer;
  transition: color 0.15s, background 0.15s, border-color 0.15s;
}
.segment__btn:hover { color: var(--text); }
.segment__btn.is-active {
  color: var(--text);
  background: rgba(62, 207, 207, 0.14);
  border-color: rgba(62, 207, 207, 0.35);
}

.form-grid--add {
  grid-template-columns: 1.4fr 0.7fr 0.9fr;
  align-items: end;
  margin-bottom: 12px;
}
.form-grid--add-footer {
  display: grid;
  grid-template-columns: 1.2fr auto;
  gap: 12px;
  align-items: end;
}
.btn--add {
  min-width: 140px;
  height: 44px;
}

.field--date .date-shell {
  position: relative;
}
.input--date {
  color-scheme: dark;
  min-height: 44px;
  padding-right: 14px;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.02em;
  background:
    linear-gradient(135deg, rgba(255, 107, 61, 0.08), rgba(62, 207, 207, 0.06)),
    #121821;
  border-color: rgba(255, 107, 61, 0.28);
  cursor: pointer;
}
.input--date:hover {
  border-color: rgba(255, 107, 61, 0.5);
}
.input--date:focus {
  border-color: rgba(255, 107, 61, 0.7);
  box-shadow: 0 0 0 3px rgba(255, 107, 61, 0.14);
}
.input--date::-webkit-calendar-picker-indicator {
  cursor: pointer;
  opacity: 0.7;
  filter: invert(0.85) sepia(1) saturate(3) hue-rotate(340deg);
}
.input--date::-webkit-calendar-picker-indicator:hover {
  opacity: 1;
}
.brand__mark {
  width: 12px; height: 12px;
  border-radius: 50%;
  background: var(--ember);
  box-shadow: 0 0 0 4px rgba(255,107,61,0.2), 0 0 18px rgba(255,107,61,0.7);
  animation: pulse 2.4s ease-in-out infinite;
}
.brand__name {
  font-family: Syne, sans-serif;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  font-size: 15px;
}
.top__meta { color: var(--muted); font-size: 13px; }

.btn,
.ghost {
  font: inherit;
  font-weight: 700;
  border-radius: 10px;
  padding: 10px 16px;
  cursor: pointer;
  border: 1px solid transparent;
  transition: background 0.15s, border-color 0.15s, color 0.15s, transform 0.15s;
}
.btn {
  color: #140c08;
  background: linear-gradient(135deg, var(--ember), var(--ember2));
  border-color: transparent;
}
.btn:hover { filter: brightness(1.06); transform: translateY(-1px); }
.btn:disabled { opacity: 0.55; cursor: not-allowed; transform: none; }
.ghost {
  color: var(--text);
  background: rgba(255, 255, 255, 0.04);
  border-color: var(--line);
}
.ghost:hover {
  border-color: rgba(62, 207, 207, 0.45);
  background: rgba(62, 207, 207, 0.08);
}
.ghost.is-danger {
  border-color: rgba(255, 123, 123, 0.7);
  color: #ffb4b4;
  background: rgba(255, 80, 80, 0.18);
}

.main { padding: 28px 0 64px; }

.section-head {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 18px;
}
.section-head h1 {
  margin: 0;
  font-family: Syne, sans-serif;
  font-size: 28px;
  font-weight: 800;
  letter-spacing: 0.02em;
}
.section-head p {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 14px;
}

.panel {
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--panel);
  backdrop-filter: blur(10px);
  padding: 18px;
  margin-bottom: 18px;
  animation: fadeUp 0.35s ease both;
}

.panel__title {
  margin: 0 0 14px;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
}

.form-grid {
  display: grid;
  grid-template-columns: 1.4fr 0.8fr 0.9fr auto;
  gap: 12px;
  align-items: end;
}

label.field {
  display: grid;
  gap: 6px;
}
label.field span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.input,
.select {
  width: 100%;
  font: inherit;
  font-weight: 500;
  color: var(--text);
  background-color: #121821;
  background: #121821;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 11px 12px;
  outline: none;
  color-scheme: dark;
}
.input:focus,
.select:focus {
  border-color: rgba(62, 207, 207, 0.55);
  box-shadow: 0 0 0 3px rgba(62, 207, 207, 0.12);
}
.select {
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  background-color: #121821;
  background-image:
    linear-gradient(45deg, transparent 50%, var(--muted) 50%),
    linear-gradient(135deg, var(--muted) 50%, transparent 50%),
    linear-gradient(#121821, #121821);
  background-position:
    calc(100% - 18px) calc(50% - 3px),
    calc(100% - 12px) calc(50% - 3px),
    0 0;
  background-size: 6px 6px, 6px 6px, 100% 100%;
  background-repeat: no-repeat;
  padding-right: 34px;
  cursor: pointer;
}
.select option,
.select optgroup {
  background-color: #121821;
  background: #0d1219;
  color: #e8edf5;
}
.select option:checked,
.select option:hover,
.select option:focus {
  background-color: #1a2433;
  color: #e8edf5;
}
.select--sm {
  width: auto;
  min-width: 118px;
  padding: 6px 28px 6px 10px;
  font-size: 12px;
  border-radius: 8px;
  background-position:
    calc(100% - 14px) calc(50% - 2px),
    calc(100% - 9px) calc(50% - 2px),
    0 0;
}

.totals {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-bottom: 18px;
}
.total-card {
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 14px 16px;
  background: rgba(255, 255, 255, 0.03);
}
.total-card__label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.total-card__value {
  margin-top: 8px;
  font-size: 22px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.total-card__value--ok { color: var(--ok); }
.total-card__value--cyan { color: var(--cyan); }

.list {
  display: grid;
  gap: 12px;
}

.obj {
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.03);
  overflow: hidden;
  animation: fadeUp 0.3s ease both;
}
.obj.is-open .obj__body { display: block; }
.obj.is-open .obj__chevron { transform: rotate(180deg); }

.obj__head {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  background: transparent;
  border: 0;
  color: inherit;
  font: inherit;
  cursor: pointer;
  text-align: left;
}
.obj__title {
  font-weight: 700;
  font-size: 16px;
}
.obj__meta {
  color: var(--muted);
  font-size: 13px;
  margin-top: 4px;
}
.obj__right {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}
.obj__per {
  font-weight: 700;
  color: var(--ok);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.obj__chevron {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  border: 0;
  margin: 0;
  background-color: var(--muted);
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='%23000' d='M7.41 8.59 12 13.17l4.59-4.58L18 10l-6 6-6-6z'/%3E%3C/svg%3E") center / 18px 18px no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='%23000' d='M7.41 8.59 12 13.17l4.59-4.58L18 10l-6 6-6-6z'/%3E%3C/svg%3E") center / 18px 18px no-repeat;
  transform: rotate(0deg);
  transition: transform 0.2s ease;
}

.obj__body {
  display: none;
  border-top: 1px solid var(--line);
  padding: 16px;
}

.calc-preview {
  margin: 4px 0 14px;
  padding: 12px;
  border-radius: 12px;
  border: 1px dashed rgba(62, 207, 207, 0.28);
  background: rgba(62, 207, 207, 0.05);
}
.calc-preview__label {
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}
.calc-preview__rows {
  display: grid;
  gap: 8px;
}
.calc-preview .calc-row.is-final {
  background: rgba(74, 222, 128, 0.1);
}
.calc-rows {
  display: grid;
  gap: 8px;
  margin-bottom: 14px;
}
.calc-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.22);
  font-size: 14px;
}
.calc-row span:first-child { color: var(--muted); }
.calc-row strong {
  font-variant-numeric: tabular-nums;
  font-weight: 700;
}
.calc-row.is-final {
  background: rgba(74, 222, 128, 0.08);
  border: 1px solid rgba(74, 222, 128, 0.25);
}
.calc-row.is-final strong { color: var(--ok); font-size: 16px; }

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

.edit-grid {
  display: grid;
  grid-template-columns: 1.2fr 0.7fr 1.2fr 0.8fr;
  gap: 12px;
  margin-bottom: 12px;
}

.empty {
  text-align: center;
  color: var(--muted);
  padding: 36px 16px;
  border: 1px dashed var(--line);
  border-radius: 16px;
}

.toast {
  position: fixed;
  right: 16px;
  bottom: 16px;
  z-index: 50;
  padding: 12px 16px;
  border-radius: 12px;
  background: rgba(16, 22, 32, 0.95);
  border: 1px solid var(--line);
  color: var(--text);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.35);
  opacity: 0;
  transform: translateY(8px);
  pointer-events: none;
  transition: opacity 0.2s, transform 0.2s;
}
.toast.is-show {
  opacity: 1;
  transform: translateY(0);
}
.toast.is-error {
  border-color: rgba(255, 123, 123, 0.55);
  color: #ffb4b4;
}

/* Login */
.login-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px 16px;
}
.login-card {
  width: min(420px, 100%);
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--panel);
  backdrop-filter: blur(12px);
  padding: 28px 24px;
  animation: fadeUp 0.4s ease both;
}
.login-card h1 {
  margin: 0 0 8px;
  font-family: Syne, sans-serif;
  font-size: 24px;
  font-weight: 800;
}
.login-card p {
  margin: 0 0 20px;
  color: var(--muted);
  font-size: 14px;
}
.login-card .field { margin-bottom: 14px; }
.login-card .btn { width: 100%; margin-top: 6px; }
.login-error {
  display: none;
  margin: 0 0 12px;
  color: var(--danger);
  font-size: 13px;
  font-weight: 600;
}
.login-error.is-show { display: block; }

/* SweetAlert-style confirm */
body.swal-open { overflow: hidden; }
.swal[hidden] { display: none !important; }
.swal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  padding: 16px;
}
.swal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(2, 5, 10, 0.78);
  backdrop-filter: blur(8px);
  animation: swalFade 0.18s ease both;
}
.swal__card {
  position: relative;
  width: min(420px, 100%);
  border: 1px solid var(--line);
  border-radius: 20px;
  background: linear-gradient(180deg, rgba(22, 30, 42, 0.98), rgba(12, 17, 26, 0.98));
  padding: 28px 24px 22px;
  box-shadow: 0 28px 70px rgba(0, 0, 0, 0.55);
  text-align: center;
  animation: swalPop 0.28s cubic-bezier(0.2, 0.9, 0.3, 1.2) both;
}
.swal__icon {
  width: 64px;
  height: 64px;
  margin: 0 auto 16px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-family: Syne, sans-serif;
  font-size: 32px;
  font-weight: 800;
  color: #ffb4b4;
  border: 3px solid rgba(255, 123, 123, 0.55);
  background: rgba(255, 80, 80, 0.12);
  box-shadow: 0 0 0 6px rgba(255, 80, 80, 0.08);
  animation: swalPulse 1.6s ease-in-out infinite;
}
.swal__icon.is-warn {
  color: var(--ember2);
  border-color: rgba(255, 107, 61, 0.55);
  background: rgba(255, 107, 61, 0.12);
  box-shadow: 0 0 0 6px rgba(255, 107, 61, 0.08);
}
.swal__title {
  margin: 0 0 8px;
  font-family: Syne, sans-serif;
  font-size: 22px;
  font-weight: 800;
}
.swal__text {
  margin: 0 0 22px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.45;
  white-space: pre-line;
}
.swal__actions {
  display: flex;
  gap: 10px;
  justify-content: center;
  flex-wrap: wrap;
}
.swal__btn {
  min-width: 120px;
}
.swal__btn--danger {
  color: #140c08;
  background: linear-gradient(135deg, #ff7b7b, #ffb347);
  border: none;
}
.swal__btn--danger:hover {
  filter: brightness(1.06);
}
@keyframes swalFade {
  from { opacity: 0; }
  to { opacity: 1; }
}
@keyframes swalPop {
  from { opacity: 0; transform: scale(0.86) translateY(10px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}
@keyframes swalPulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.04); }
}

.modal[hidden] { display: none !important; }
.modal {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: grid;
  place-items: center;
  padding: 16px;
}
.modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(3, 6, 10, 0.72);
  backdrop-filter: blur(6px);
}
.modal__card {
  position: relative;
  width: min(460px, 100%);
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(16, 22, 32, 0.96);
  padding: 20px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.45);
  animation: fadeUp 0.25s ease both;
}
.modal__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}
.modal__head h2 {
  margin: 0;
  font-family: Syne, sans-serif;
  font-size: 20px;
  font-weight: 800;
}
.modal__x {
  width: 40px;
  height: 40px;
  padding: 0;
}
.segment--modal { margin-bottom: 14px; }
.modal__actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 18px;
}

.badge {
  display: inline-flex;
  align-items: center;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  border-radius: 999px;
  padding: 4px 10px;
}
.badge--open {
  color: var(--ember2);
  background: rgba(255, 107, 61, 0.14);
  border: 1px solid rgba(255, 107, 61, 0.35);
}
.badge--closed {
  color: var(--ok);
  background: rgba(74, 222, 128, 0.12);
  border: 1px solid rgba(74, 222, 128, 0.35);
}

.inline-add {
  display: grid;
  gap: 8px;
  margin-top: 10px;
}
.inline-add[hidden],
#addPanel[hidden],
.add-launch[hidden],
.zone__head .ghost[hidden] { display: none !important; }
.inline-add__actions,
.add-form__buttons {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}
.inline-add__actions { grid-column: 1 / -1; }
.inline-add--work {
  grid-template-columns: 1.4fr 0.7fr auto;
}
.inline-add--expense {
  grid-template-columns: 1.1fr 0.6fr 0.8fr auto;
}
.line-list {
  display: grid;
  gap: 6px;
  margin-bottom: 8px;
}
.line-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.22);
  font-size: 14px;
}
.line-item > div:first-child {
  min-width: 0;
  flex: 1;
  overflow-wrap: anywhere;
}
.line-item__meta { color: var(--muted); font-size: 12px; }
.line-item__right {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex-shrink: 0;
}
.line-item__right .ghost.is-danger {
  width: 36px;
  height: 36px;
  padding: 0;
  flex: 0 0 36px;
}
.subblock {
  margin: 16px 0;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}
.subblock__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}
.subblock__head h3 {
  margin: 0;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
}

.zone {
  margin: 14px 0;
  padding: 14px;
  border-radius: 14px;
}
.zone--works {
  background: rgba(62, 207, 207, 0.07);
  border: 1px solid rgba(62, 207, 207, 0.35);
}
.zone--expenses {
  background: rgba(255, 179, 71, 0.07);
  border: 1px solid rgba(255, 179, 71, 0.38);
}
.zone__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}
.zone__head h3 {
  margin: 0;
  font-size: 15px;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.zone--works h3 { color: var(--cyan); }
.zone--expenses h3 { color: var(--ember2); }
.zone .inline-add { margin-top: 12px; }
.add-launch { margin-bottom: 14px; }
.add-launch .btn { min-width: 180px; }

.dyn-rows {
  display: grid;
  gap: 8px;
}
.dyn-row {
  display: grid;
  grid-template-columns: 1.4fr 0.7fr auto;
  gap: 8px;
  align-items: center;
}
.dyn-row--expense {
  grid-template-columns: 1.2fr 0.6fr 0.8fr auto;
}
.form-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 8px;
}

@media (max-width: 900px) {
  .top__inner { justify-content: flex-start; }
  .tabs { order: 3; width: 100%; }
}

@media (max-width: 900px) {
  .month-chips { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}

@media (max-width: 800px) {
  .form-grid,
  .form-grid--add,
  .form-grid--add-footer,
  .edit-grid,
  .dyn-row,
  .dyn-row--expense,
  .inline-add--work,
  .inline-add--expense {
    grid-template-columns: 1fr;
  }
  .month-chips { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .section-head { align-items: stretch; }
  .month-nav { width: 100%; }
  .totals {
    grid-template-columns: 1fr;
  }
  .form-grid .btn,
  .form-grid--add .btn,
  .btn--add { width: 100%; }
}

@media (max-width: 640px) {
  body { font-size: 17px; }
  .wrap { padding-left: 12px; padding-right: 12px; }
  .top__meta { display: none; }
  .brand__name { font-size: 16px; }
  .tabs { width: 100%; }
  .tab { flex: 1 1 0; text-align: center; padding: 10px 8px; font-size: 15px; }
  .section-head h1 { font-size: 26px; }
  .section-head p { font-size: 16px; }
  .panel { padding: 14px; }
  .input,
  .select,
  .btn,
  .ghost { font-size: 16px; }
  label.field span { font-size: 13px; }
  .month-chip { font-size: 14px; padding: 12px 8px; }
  .month-nav__label { font-size: 20px; }
  .obj__head {
    flex-wrap: wrap;
    align-items: flex-start;
    padding: 12px;
    gap: 8px;
  }
  .obj__head > div:first-child { min-width: 0; flex: 1 1 160px; }
  .obj__title { overflow-wrap: anywhere; font-size: 18px; }
  .obj__meta { overflow-wrap: anywhere; font-size: 15px; }
  .obj__right {
    flex: 1 1 100%;
    justify-content: space-between;
    min-width: 0;
  }
  .obj__per {
    white-space: normal;
    font-size: 16px;
    line-height: 1.35;
  }
  .obj__body { padding: 12px; }
  .line-item { flex-wrap: wrap; align-items: flex-start; font-size: 16px; }
  .line-item__meta { font-size: 14px; }
  .line-item__right {
    width: 100%;
    flex-wrap: nowrap;
    min-width: 0;
  }
  .line-item__right .select--sm {
    flex: 1 1 auto;
    width: auto;
    min-width: 0;
    max-width: 46%;
    font-size: 15px;
  }
  .line-item__right strong {
    margin-left: auto;
    font-size: 16px;
    white-space: nowrap;
  }
  .zone { padding: 12px; }
  .zone__head { flex-wrap: wrap; }
  .zone__head h3 { font-size: 16px; }
  .zone__head .ghost { flex: 1 1 100%; }
  .add-launch .btn,
  .zone__head .ghost,
  .inline-add__actions .btn,
  .inline-add__actions .ghost,
  .add-form__buttons .btn,
  .add-form__buttons .ghost,
  .obj__actions .btn,
  .obj__actions .ghost { width: 100%; }
  .obj__actions .btn,
  .obj__actions .ghost { flex: 1 1 140px; }
  .calc-row { flex-wrap: wrap; font-size: 16px; }
  .calc-row strong { margin-left: auto; font-size: 16px; }
  .calc-row.is-final strong { font-size: 18px; }
  .total-card__label { font-size: 13px; }
  .total-card__value { font-size: 24px; }
  .modal__card { padding: 16px; }
  .modal__head h2,
  .swal__title { font-size: 22px; }
  .modal__actions { flex-wrap: wrap; }
  .modal__actions .btn,
  .modal__actions .ghost { flex: 1 1 120px; }
  .swal__card { padding: 22px 16px 16px; }
  .swal__text { font-size: 16px; }
}
