:root {
  color-scheme: light;
  --ink: #17332f;
  --dark: #153c39;
  --green: #1a6659;
  --green-light: #e7f2ed;
  --cream: #f6f5f0;
  --white: #fff;
  --muted: #65746e;
  --line: #dce2da;
  --yellow: #f7d995;
  --orange: #a55422;
  --red: #a43c36;
  --redlight: #fff0e9;
  --shadow: 0 12px 36px rgba(19, 52, 47, 0.06);
  --radius: 18px;
}
* {
  box-sizing: border-box;
}
html {
  scroll-behavior: smooth;
}
body {
  margin: 0;
  background: var(--cream);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Arial, sans-serif;
  color: var(--ink);
  font-size: 15px;
  line-height: 1.48;
}
button,
input,
select,
textarea {
  font: inherit;
}
button {
  cursor: pointer;
}
button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}
a {
  color: var(--green);
}
.hidden {
  display: none !important;
}
.app-shell {
  max-width: 1280px;
  margin: auto;
  display: grid;
  grid-template-columns: 240px minmax(0, 1fr);
  min-height: 100vh;
}
.sidebar {
  background: var(--dark);
  color: #f3f9f5;
  padding: 34px 20px 24px;
  display: flex;
  flex-direction: column;
  gap: 34px;
}
.brand {
  display: flex;
  align-items: center;
  gap: 13px;
  padding: 2px 10px;
}
.brand-mark {
  background: #e4f2e9;
  color: var(--dark);
  width: 42px;
  height: 42px;
  border-radius: 13px;
  display: grid;
  place-items: center;
  font-size: 27px;
  font-weight: bold;
}
.brand strong {
  font-size: 17px;
  letter-spacing: -0.45px;
}
.brand small {
  display: block;
  font-size: 11px;
  color: #b9d2c7;
  letter-spacing: 0.7px;
  text-transform: uppercase;
}
.nav {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.nav button {
  border: 0;
  border-radius: 12px;
  color: #cbdfd6;
  background: transparent;
  padding: 12px 14px;
  text-align: left;
  display: flex;
  align-items: center;
  gap: 11px;
  font-weight: 590;
}
.nav button.active,
.nav button:hover {
  color: #113a31;
  background: #e9f3e9;
}
.nav .glyph {
  font-size: 20px;
  width: 27px;
  text-align: center;
}
.side-bottom {
  margin-top: auto;
  border-top: 1px solid #41645d;
  padding: 20px 12px 0;
  color: #cadfd5;
  font-size: 12px;
}
.side-bottom b {
  color: white;
}
.sidebar .side-lock {
  background: transparent;
  color: #d7eee2;
  border: 1px solid #7eaca0;
  border-radius: 10px;
  padding: 9px 12px;
  margin-top: 15px;
  width: 100%;
}
main {
  padding: 34px clamp(20px, 4vw, 54px) 65px;
  min-width: 0;
}
.topline {
  display: flex;
  gap: 16px;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
}
.eyebrow {
  font-weight: 800;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: var(--green);
}
h1 {
  font-family: Georgia, 'Times New Roman', serif;
  letter-spacing: -1px;
  font-size: clamp(31px, 3.2vw, 43px);
  line-height: 1.1;
  margin: 8px 0 6px;
  font-weight: 600;
}
h2 {
  font-family: Georgia, 'Times New Roman', serif;
  font-size: 25px;
  letter-spacing: -0.4px;
  font-weight: 600;
  margin: 0;
}
h3 {
  font-size: 16px;
  margin: 0;
}
p {
  margin: 8px 0;
}
.muted {
  color: var(--muted);
}
.tiny {
  font-size: 12px;
}
.btn {
  border: 1px solid transparent;
  border-radius: 11px;
  display: inline-flex;
  gap: 8px;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  padding: 11px 16px;
  background: var(--dark);
  color: white;
  text-decoration: none;
  white-space: nowrap;
}
.btn:hover {
  filter: brightness(1.09);
}
.btn.light {
  color: var(--dark);
  border-color: var(--line);
  background: white;
}
.btn.soft {
  color: var(--dark);
  background: var(--green-light);
}
.btn.danger {
  color: var(--red);
  border-color: #f1d4ca;
  background: #fff5f1;
}
.btn.small {
  font-size: 12px;
  padding: 7px 10px;
  border-radius: 9px;
}
.btn.textbtn {
  border: 0;
  background: transparent;
  padding: 6px;
  color: var(--green);
}
.intro {
  font-size: 15px;
  color: var(--muted);
  max-width: 680px;
}
.hero {
  border-radius: 22px;
  background: linear-gradient(110deg, #17463f 0%, #235e53 70%, #307464 100%);
  color: white;
  padding: 26px 30px;
  position: relative;
  overflow: hidden;
  display: flex;
  justify-content: space-between;
  gap: 20px;
  align-items: center;
  margin-bottom: 22px;
}
.hero:after {
  content: '◉';
  position: absolute;
  right: -35px;
  top: -90px;
  font-size: 295px;
  line-height: 1;
  color: rgba(255, 255, 255, 0.055);
  pointer-events: none;
}
.hero h2 {
  font-family: Georgia, serif;
  margin: 4px 0;
  font-size: 27px;
}
.hero p {
  color: #d0e5dc;
  font-size: 13px;
  margin: 8px 0 0;
  max-width: 560px;
}
.hero .btn {
  background: #fcf8ea;
  color: #1a4a42;
  z-index: 1;
}
.kpis {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 15px;
  margin: 18px 0 24px;
}
.card {
  border: 1px solid #e5e9e1;
  background: white;
  border-radius: var(--radius);
  padding: 22px;
  box-shadow: var(--shadow);
}
.stat .value {
  font-family: Georgia, serif;
  font-size: 34px;
  letter-spacing: -0.9px;
  margin: 8px 0 0;
  font-variant-numeric: tabular-nums;
}
.stat .caption {
  text-transform: uppercase;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 1px;
  color: var(--muted);
}
.stat .desc {
  font-size: 12px;
  color: var(--muted);
  margin-top: 7px;
}
.grid-two {
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: 16px;
}
.section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}
.section-heading h2 {
  font-size: 23px;
}
.pill {
  display: inline-flex;
  background: var(--green-light);
  color: #126050;
  border-radius: 999px;
  padding: 4px 9px;
  font-size: 11px;
  font-weight: 700;
}
.pill.orange {
  background: #fff1da;
  color: #925720;
}
.pill.red {
  background: #ffebe7;
  color: #a33a2f;
}
.pill.neutral {
  background: #f1f3ef;
  color: #5f6d66;
}
.item-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 13px 0;
  border-bottom: 1px solid var(--line);
}
.item-row:last-child {
  border-bottom: 0;
}
.item-row .name {
  font-weight: 750;
}
.item-row .sub {
  font-size: 12px;
  color: var(--muted);
}
.item-row .money {
  white-space: nowrap;
  font-weight: 750;
}
.bar-track {
  height: 11px;
  background: #eff3ee;
  border-radius: 12px;
  overflow: hidden;
}
.bar-fill {
  height: 100%;
  background: #277467;
  border-radius: 12px;
}
.category-row {
  margin-top: 15px;
}
.category-row .top {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  margin-bottom: 5px;
  gap: 14px;
}
.empty {
  display: grid;
  place-items: center;
  text-align: center;
  padding: 42px 25px;
  color: var(--muted);
  border: 1px dashed #c9d5cb;
  border-radius: 17px;
}
.empty .emoji {
  font-size: 34px;
  margin-bottom: 6px;
}
.toolbar {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  margin: 20px 0;
}
.toolbar .group {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  flex: 1;
}
.input {
  width: 100%;
  border: 1px solid #d4ded6;
  background: white;
  color: var(--ink);
  border-radius: 10px;
  padding: 10px 11px;
  min-width: 0;
}
.input:focus {
  outline: 2px solid #9dd0c1;
  border-color: #298170;
  outline-offset: 1px;
}
.toolbar input {
  max-width: 350px;
  flex: 2 1 200px;
}
.toolbar select {
  max-width: 220px;
  flex: 1 1 170px;
}
.contract-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 15px;
}
.contract-card {
  border: 1px solid var(--line);
  background: white;
  border-radius: 17px;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-width: 0;
}
.contract-head {
  display: flex;
  justify-content: space-between;
  gap: 9px;
  align-items: flex-start;
}
.contract-head .title {
  font-size: 18px;
  font-weight: 780;
  letter-spacing: -0.3px;
  overflow-wrap: anywhere;
}
.contract-head small {
  color: var(--muted);
}
.contract-info {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}
.contract-info dt {
  font-size: 11px;
  color: var(--muted);
  text-transform: uppercase;
  font-weight: 750;
  letter-spacing: 0.4px;
}
.contract-info dd {
  margin: 2px 0 0;
  font-weight: 700;
  overflow-wrap: anywhere;
}
.contract-actions {
  display: flex;
  gap: 7px;
  flex-wrap: wrap;
  border-top: 1px solid var(--line);
  padding-top: 14px;
  margin-top: auto;
}
.docs-list {
  display: flex;
  flex-direction: column;
  gap: 9px;
  margin-top: 10px;
}
.doc {
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  display: flex;
  gap: 12px;
  justify-content: space-between;
  align-items: center;
  min-width: 0;
}
.doc .filename {
  overflow-wrap: anywhere;
  font-weight: 650;
}
.doc .actions {
  display: flex;
  flex-shrink: 0;
  gap: 5px;
}
.compare-head {
  display: flex;
  align-items: center;
  gap: 12px;
  justify-content: space-between;
  margin-bottom: 15px;
}
.compare-card {
  padding: 21px;
  border: 1px solid var(--line);
  border-radius: 17px;
  background: white;
  margin: 13px 0;
}
.compare-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 13px;
  margin-top: 13px;
}
.compare-col {
  background: #f6f8f4;
  border-radius: 12px;
  padding: 16px;
}
.compare-col.alt {
  background: #eef7f2;
}
.compare-col .price {
  font-family: Georgia, serif;
  font-size: 25px;
  margin: 7px 0;
}
.compare-col .sub {
  font-size: 12px;
  color: var(--muted);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.compare-note {
  background: #fff8ec;
  border-radius: 10px;
  padding: 11px 13px;
  font-size: 12px;
  color: #745a35;
  margin-top: 12px;
}
.settings-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}
.settings-grid .card {
  min-height: 190px;
}
.settings-grid h3 {
  margin-bottom: 9px;
}
.settings-grid p {
  color: var(--muted);
  font-size: 13px;
}
.settings-grid .btn {
  margin-top: 10px;
}
dialog {
  border: none;
  border-radius: 19px;
  width: min(670px, calc(100vw - 20px));
  max-height: min(92vh, 930px);
  padding: 0;
  background: white;
  box-shadow: 0 20px 70px rgba(0, 0, 0, 0.25);
  color: var(--ink);
}
dialog::backdrop {
  background: rgba(10, 33, 28, 0.6);
}
.modal-header {
  padding: 24px 28px 14px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  border-bottom: 1px solid var(--line);
}
.modal-body {
  padding: 20px 28px 26px;
  overflow-y: auto;
  max-height: calc(92vh - 110px);
}
.close {
  border: 0;
  background: #f0f3ef;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  font-size: 20px;
}
.fields {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 15px;
}
.field {
  display: flex;
  flex-direction: column;
  gap: 5px;
  min-width: 0;
}
.field.wide {
  grid-column: 1/-1;
}
.field label {
  font-weight: 750;
  font-size: 12px;
}
.field .hint {
  font-size: 11px;
  color: var(--muted);
}
textarea.input {
  min-height: 80px;
  resize: vertical;
}
.checkline {
  display: flex;
  align-items: center;
  gap: 9px;
  font-size: 13px;
  padding-top: 17px;
}
.form-footer {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 22px;
  border-top: 1px solid var(--line);
  padding-top: 18px;
}
.auth-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: radial-gradient(circle at 20% 18%, #e1eee5, transparent 42%), var(--cream);
}
.auth-card {
  background: white;
  width: min(440px, 100%);
  border: 1px solid var(--line);
  border-radius: 24px;
  padding: 32px;
  box-shadow: 0 25px 90px rgba(20, 58, 49, 0.1);
}
.auth-card .logo {
  width: 58px;
  height: 58px;
  background: #174d43;
  color: white;
  display: grid;
  place-items: center;
  border-radius: 18px;
  font-size: 33px;
  margin-bottom: 22px;
}
.auth-card h1 {
  font-size: 32px;
}
.auth-card .field {
  margin-top: 14px;
}
.auth-card .btn {
  margin-top: 20px;
  width: 100%;
}
.auth-error {
  color: var(--red);
  font-size: 13px;
  margin-top: 13px;
  min-height: 20px;
}
.info-line {
  display: flex;
  gap: 8px;
  font-size: 12px;
  color: #466a5b;
  background: #edf7ee;
  border-radius: 11px;
  padding: 12px;
  margin-top: 16px;
}
.notice {
  color: #795c2d;
  background: #fff5df;
  font-size: 12px;
  border-radius: 11px;
  padding: 11px 13px;
  margin-top: 14px;
}
.notice.red {
  background: #fff0e9;
  color: #963c31;
}
#toast {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translate(-50%, 15px);
  opacity: 0;
  pointer-events: none;
  background: #153c39;
  color: white;
  box-shadow: 0 15px 50px #173c3950;
  border-radius: 11px;
  padding: 11px 17px;
  z-index: 25;
  transition:
    opacity 0.2s,
    transform 0.2s;
  font-size: 13px;
  max-width: 90vw;
}
#toast.visible {
  opacity: 1;
  transform: translate(-50%, 0);
}
.foot-note {
  text-align: center;
  font-size: 11px;
  color: #74857c;
  padding: 24px 0 0;
}
@media (max-width: 960px) {
  .app-shell {
    grid-template-columns: minmax(0, 1fr);
  }
  .sidebar {
    min-width: 0;
    width: 100%;
    padding: 13px 20px;
    gap: 8px;
    flex-direction: row;
    align-items: center;
    flex-wrap: wrap;
  }
  .brand {
    flex: 1;
  }
  .brand small {
    display: none;
  }
  .nav {
    flex-direction: row;
    overflow-x: auto;
    gap: 4px;
  }
  .nav button {
    padding: 9px;
    font-size: 12px;
    white-space: nowrap;
  }
  .nav .glyph {
    width: auto;
    font-size: 17px;
  }
  .side-bottom {
    display: none;
  }
  main {
    padding: 24px 20px 50px;
  }
}
@media (max-width: 690px) {
  .sidebar {
    display: block;
    padding: 12px 13px 9px;
  }
  .brand {
    margin-bottom: 8px;
    padding: 1px 6px;
  }
  .nav {
    display: flex;
  }
  .nav button {
    gap: 5px;
    flex: 1;
    justify-content: center;
  }
  .nav button .glyph {
    font-size: 16px;
  }
  .topline {
    align-items: flex-start;
  }
  .topline .btn {
    font-size: 12px;
    padding: 9px 11px;
  }
  .hero {
    padding: 19px;
    align-items: flex-start;
    flex-direction: column;
  }
  .hero h2 {
    font-size: 22px;
  }
  .kpis {
    gap: 8px;
  }
  .card {
    padding: 15px;
  }
  .stat .value {
    font-size: 18px;
    letter-spacing: -0.5px;
  }
  .stat .caption {
    font-size: 9px;
  }
  .stat .desc {
    font-size: 10px;
  }
  .grid-two,
  .contract-grid,
  .settings-grid {
    grid-template-columns: 1fr;
  }
  .compare-grid {
    grid-template-columns: 1fr;
  }
  .fields {
    grid-template-columns: 1fr;
  }
  .modal-header {
    padding: 18px 18px 12px;
  }
  .modal-body {
    padding: 16px 18px 22px;
  }
  .auth-card {
    padding: 24px;
  }
}
@media (prefers-reduced-motion: reduce) {
  *,
  *:before,
  *:after {
    transition: none !important;
    scroll-behavior: auto !important;
  }
}

.pwa-status {
  padding: 10px 20px;
  background: #e7f2ed;
  border-bottom: 1px solid var(--line);
  font-size: 13px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 18px;
}
.pwa-status details {
  max-width: 720px;
}
.pwa-status summary {
  cursor: pointer;
}
.pwa-status p {
  margin: 8px 0;
}
#save-status:empty,
#update-status:empty {
  display: none;
}
