:root {
  --ink: #1c1915;
  --ink-soft: #5c534b;
  --paper: #efe8dc;
  --card: #fbf8f3;
  --line: #e4d9cb;
  --line-strong: #d3c4b2;
  --rust: #c6532a;
  --rust-deep: #8d3416;
  --moss: #2f4a3c;
  --sand: #f0e2c4;
  --sidebar: #141210;
  --sidebar-text: #f3eadf;
  --sidebar-dim: #b3a79b;
  --danger: #8d2e2e;
  --shadow: 0 18px 40px rgba(48, 32, 16, 0.08);
  --radius: 18px;
  color-scheme: light;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 232px 1fr;
  background: var(--paper);
  color: var(--ink);
  font-family: Outfit, "Segoe UI", sans-serif;
  font-size: 16px;
  line-height: 1.45;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
img { max-width: 100%; }

aside {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 22px 16px 16px;
  background: var(--sidebar);
  color: var(--sidebar-text);
  display: flex;
  flex-direction: column;
  gap: 22px;
}
.brand {
  display: flex;
  gap: 10px;
  align-items: center;
  color: inherit;
  text-decoration: none;
}
.brand svg { width: 36px; height: 36px; flex: none; }
.brand strong {
  display: block;
  font-family: Fraunces, Georgia, serif;
  font-weight: 560;
  font-size: 22px;
  letter-spacing: -0.03em;
  line-height: 1;
}
.brand em {
  display: block;
  margin-top: 3px;
  font-style: normal;
  font-size: 12px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--sidebar-dim);
}
aside nav { display: flex; flex-direction: column; gap: 4px; scrollbar-width: none; }
aside nav::-webkit-scrollbar, .calc-nav::-webkit-scrollbar { display: none; }
aside nav a {
  color: var(--sidebar-dim);
  text-decoration: none;
  padding: 9px 12px;
  border-radius: 999px;
}
aside nav a.is-on { background: #2a241f; color: #fff; }
.aside-foot {
  margin-top: auto;
  color: var(--sidebar-dim);
  font-size: 13px;
  line-height: 1.4;
}

main { padding: 28px 32px 72px; min-width: 0; }
.wrap { max-width: 1120px; }

h1, h2, .figure {
  font-family: Fraunces, Georgia, serif;
  font-weight: 560;
  letter-spacing: -0.03em;
  line-height: 1.02;
  margin: 0;
}
h1 { font-size: clamp(40px, 5vw, 68px); }
h2 { font-size: 32px; }
.kicker {
  margin: 0 0 8px;
  font-size: 12px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--rust-deep);
}
.deck { max-width: 42rem; font-size: 18px; color: var(--ink-soft); }
.help, .note, .fine { color: var(--ink-soft); }
.help { margin: 8px 0 18px; max-width: 42rem; }
.fine { font-size: 13px; margin: 8px 0 0; }
.formula {
  font-size: 14px;
  color: var(--ink);
  background: var(--sand);
  border-radius: 12px;
  padding: 10px 12px;
}

.topbar {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: end;
  margin-bottom: 26px;
}
.project-pick { display: flex; flex-direction: column; gap: 6px; min-width: min(100%, 280px); }
.project-pick span, .field > span, .meta span {
  font-size: 13px;
  color: var(--ink-soft);
}
.top-actions, .result-actions, .row-actions, .tool-row { display: flex; flex-wrap: wrap; gap: 8px; }

button.primary, button.ghost, button.danger, .text-btn {
  border-radius: 999px;
  padding: 10px 16px;
  border: 1px solid transparent;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
button.primary { background: var(--rust); color: #fffaf6; }
button.ghost, .text-btn { background: transparent; border-color: var(--line-strong); color: var(--ink); }
button.danger { background: transparent; color: var(--danger); border-color: transparent; padding-inline: 10px; }
.text-btn { padding: 8px 12px; }

.home-grid, .cards, .guide-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}
.card, .panel, .ticket, .rows, .guide {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.card, .guide, .panel { padding: 18px; }
.card { color: inherit; text-decoration: none; display: block; }
.card .idx {
  font-family: Fraunces, Georgia, serif;
  color: var(--rust);
  font-size: 28px;
}
.card h2 { font-size: 28px; margin: 8px 0; }
.card p, .guide p { margin: 0; color: var(--ink-soft); }
.summary {
  margin-top: 18px;
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: end;
}
.summary .figure { font-size: 56px; }

.steps { margin: 22px 0; padding: 0; list-style: none; display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.steps li { padding: 14px; border-top: 2px solid var(--rust); }
.steps strong { display: block; margin-bottom: 4px; }

.work {
  display: grid;
  grid-template-columns: 190px minmax(0, 1fr) 340px;
  gap: 22px;
  align-items: start;
}
.calc-nav { display: flex; flex-direction: column; gap: 4px; position: sticky; top: 18px; }
.nav-label {
  margin: 12px 0 4px;
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-soft);
}
.calc-nav a {
  text-decoration: none;
  color: var(--ink);
  padding: 7px 10px;
  border-radius: 999px;
}
.calc-nav a.is-on { background: var(--ink); color: var(--paper); }
.result-col {
  position: sticky;
  top: 18px;
  max-height: calc(100vh - 36px);
  overflow: auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding-bottom: 8px;
}
.ticket {
  background: var(--sidebar);
  color: var(--sidebar-text);
  padding: 20px;
  border: 0;
}
.ticket .kicker { color: #e0b08a; }
.figure { font-size: clamp(48px, 6vw, 72px); }
.figure small { font-size: 0.38em; letter-spacing: 0; margin-left: 4px; }
.ticket-label { margin: 4px 0 0; color: var(--sidebar-dim); }
.rows { padding: 8px 14px; box-shadow: none; }
.rows div, .guide dl div, .totals div, .bar-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 9px 0;
  border-bottom: 1px solid var(--line);
}
.rows div:last-child, .guide dl div:last-child, .totals div:last-child { border-bottom: 0; }
.rows b, .totals b { font-weight: 600; text-align: right; }
.picks { display: flex; flex-direction: column; gap: 8px; }
.pick {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 4px 10px;
  align-items: center;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--card);
}
.pick b { display: block; font-weight: 600; }
.pick small { color: var(--ink-soft); }
.pick .price, .pick em { grid-column: 2; }
.pick em { font-style: normal; font-weight: 600; }

.form-grid, .meta, .split { display: grid; gap: 12px; }
.form-grid, .meta { grid-template-columns: 1fr 1fr; }
.split { grid-template-columns: 1fr 1fr; align-items: start; }
.field, .check { display: flex; flex-direction: column; gap: 6px; }
.check { flex-direction: row; align-items: center; grid-column: 1 / -1; }
.input, select, textarea, .bare {
  width: 100%;
  border: 1px solid var(--line-strong);
  background: #fff;
  border-radius: 12px;
}
.input { display: flex; align-items: center; gap: 8px; padding: 0 12px; }
.input input, .bare, select, textarea {
  border: 0;
  background: transparent;
  padding: 11px 0;
  width: 100%;
  min-width: 0;
  outline: none;
}
select, textarea, .bare { padding: 11px 12px; }
textarea { min-height: 88px; resize: vertical; }
.input i { font-style: normal; color: var(--ink-soft); font-size: 13px; white-space: nowrap; }
.input:focus-within, select:focus, textarea:focus, .bare:focus, .price:focus {
  outline: 2px solid var(--rust);
  outline-offset: 1px;
}
.fill, .seed { display: flex; flex-wrap: wrap; gap: 10px; align-items: end; margin-bottom: 14px; }
.seed .field { width: min(100%, 220px); }
h1, h2 { overflow-wrap: break-word; }
.fill label { display: flex; flex-direction: column; gap: 6px; min-width: 180px; font-size: 13px; color: var(--ink-soft); }

.table-wrap { overflow: auto; border: 1px solid var(--line); border-radius: var(--radius); background: var(--card); }
table { width: 100%; border-collapse: collapse; min-width: 760px; }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { font-size: 12px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-soft); font-weight: 600; }
td input, td select { width: 100%; }
.price { max-width: 120px; border: 1px solid var(--line-strong); border-radius: 10px; padding: 8px 10px; background: #fff; }
.is-edited { box-shadow: inset 0 0 0 1px var(--rust); }
.chips { display: flex; gap: 6px; overflow: auto; padding-bottom: 4px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.adder-grid { display: grid; grid-template-columns: 1.4fr 1fr .6fr .7fr .7fr auto; gap: 8px; margin-top: 14px; }
.chips button { border: 1px solid var(--line-strong); background: transparent; border-radius: 999px; padding: 7px 12px; white-space: nowrap; }
.chips button.is-on { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.adder { position: relative; margin: 12px 0; }
.hits { display: flex; flex-direction: column; gap: 4px; margin-top: 8px; }
.hits button { text-align: left; border: 1px solid var(--line); background: var(--card); border-radius: 12px; padding: 8px 10px; }

.totals { margin-top: 14px; padding: 8px 16px; }
.totals .grand { font-size: 20px; }
.room-card h3 { margin: 0 0 10px; font-size: 20px; font-family: Fraunces, Georgia, serif; }
.metrics { display: flex; gap: 14px; color: var(--ink-soft); font-size: 14px; }
.timeline { margin-top: 16px; }
.track { position: relative; flex: 1; height: 14px; background: #efe6da; border-radius: 999px; min-width: 80px; }
.track i { position: absolute; top: 0; bottom: 0; border-radius: 999px; background: var(--rust); }
.track i.st-vyksta { background: var(--moss); }
.track i.st-baigta { background: #8a8176; }
.bar-row span { width: 42%; min-width: 120px; }

.disclaimer { margin-top: 22px; font-size: 13px; color: var(--ink-soft); max-width: 48rem; }
.toast {
  position: fixed;
  bottom: 16px;
  right: 16px;
  background: var(--sidebar);
  color: var(--sidebar-text);
  padding: 12px 16px;
  border-radius: 999px;
  z-index: 30;
}
.guide dl { margin: 12px 0 0; }
.guide { box-shadow: none; }

@media (max-width: 1100px) {
  .work, .split, .home-grid, .steps, .guide-list { grid-template-columns: 1fr; }
  .work, .calc-nav, .split, .wrap, .topbar { min-width: 0; max-width: 100%; }
  .calc-nav { position: static; flex-direction: row; overflow: auto; scrollbar-width: none; max-width: 100%; }
  .nav-label { display: none; }
  .calc-nav a { white-space: nowrap; background: rgba(255,255,255,0.45); }
  .result-col { position: static; max-height: none; overflow: visible; }
}
@media (max-width: 860px) {
  .adder-grid { grid-template-columns: 1fr; }
  body { display: block; }
  aside { position: sticky; top: 0; height: auto; z-index: 5; }
  aside nav { flex-direction: row; overflow: auto; }
  aside nav a { white-space: nowrap; }
  .aside-foot { display: none; }
  main { padding: 18px 14px 64px; }
  .topbar { flex-wrap: wrap; align-items: center; }
  .project-pick { flex: 1 1 auto; min-width: 0; max-width: calc(100% - 108px); }
  .form-grid, .meta, .summary { grid-template-columns: 1fr; display: grid; }
  .summary { align-items: start; }
  h1 { font-size: 38px; }
}
@media print {
  aside, .no-print, .toast, .calc-nav, .result-actions, .chips, .adder, .fill { display: none !important; }
  body { display: block; background: white; }
  main { padding: 0; }
  .card, .panel, .rows, .ticket, .table-wrap { box-shadow: none; }
  .ticket, .ticket * { color: black !important; background: white !important; }
  input, select, textarea, .bare { border: none !important; outline: none !important; background: transparent !important; }
  a { color: black; text-decoration: none; }
  @page { margin: 14mm; }
}
