@font-face {
  font-family: Rubik;
  src: url(assets/Rubik.ttf) format('truetype');
  font-weight: 300 900;
  font-display: swap;
}
:root {
  --ink: #30272a;
  --wine: #652b39;
  --deep: #512432;
  --gold: #c1a05a;
  --cream: #f5f3ef;
  --paper: #fffefb;
  --muted: #6d6565;
  --line: #ded8d0;
  --positive: #286554;
  --danger: #96384d;
  --soft: #efe6e6;
  --radius: 14px;
  color: var(--ink);
  background: var(--cream);
  font:
    16px/1.5 Rubik,
    system-ui,
    sans-serif;
  font-variant-numeric: tabular-nums;
  caret-color: var(--wine);
  scrollbar-color: #afa097 var(--cream);
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
}
button,
select,
input,
textarea {
  font: inherit;
  color: inherit;
}
button,
select,
a {
  touch-action: manipulation;
}
button,
a {
  cursor: pointer;
}
a {
  color: var(--wine);
}
button {
  border: 0;
  background: none;
  padding: 0;
}
button:disabled {
  opacity: 0.48;
  cursor: default;
}
button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
summary:focus-visible {
  outline: 3px solid #936d24;
  outline-offset: 3px;
}
::selection {
  background: #edd8ba;
  color: #382624;
}
button:hover:not(:disabled) {
  filter: brightness(0.94);
}
.skip {
  position: fixed;
  left: -200px;
}
.skip:focus {
  left: 1rem;
  top: 1rem;
  z-index: 5;
  background: white;
  padding: 10px;
}
#layout {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  min-height: 100vh;
}
#rail {
  position: sticky;
  top: 0;
  height: 100dvh;
  background: #eeeae4;
  border-right: 1px solid #dcd4c9;
  padding: 30px 18px;
  display: flex;
  flex-direction: column;
}
.brand {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 11px;
  text-decoration: none;
  margin: 4px 7px 50px;
  color: var(--ink);
}
.brand img {
  width: 79px;
  height: auto;
  mix-blend-mode: multiply;
}
.brand strong {
  padding-left: 10px;
  border-left: 1px solid #b3a698;
  font-size: 18px;
  font-weight: 550;
  letter-spacing: -0.03em;
}
.railfoot {
  margin-top: auto;
  display: grid;
  gap: 2px;
  padding: 24px 12px 0;
  font-size: 0.78rem;
  color: var(--muted);
}
.railfoot span:first-child {
  font-weight: 600;
}
#nav {
  display: grid;
  gap: 4px;
}
#nav a {
  color: #594f50;
  display: flex;
  text-decoration: none;
  gap: 12px;
  align-items: center;
  padding: 11px 13px;
  border-radius: 8px;
  font-weight: 440;
  font-size: 0.93rem;
}
#nav a:hover {
  background: #e4ded6;
}
#nav a[aria-current='page'] {
  color: #fff;
  background: var(--wine);
}
#nav a:last-child {
  margin-top: 20px;
  border-top: 1px solid var(--line);
  border-radius: 0;
  padding-top: 18px;
}
#nav a:last-child[aria-current='page'] {
  border-radius: 8px;
  padding-top: 11px;
}
.ic {
  width: 20px;
  height: 20px;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.55;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.mobile {
  display: none;
}
#main {
  min-width: 0;
}
.top {
  height: 70px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
  padding: 0 clamp(20px, 3.8vw, 70px);
  border-bottom: 1px solid var(--line);
  background: var(--paper);
}
.crumb {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  font-size: 0.88rem;
}
.crumb button {
  color: var(--muted);
}
#project-name {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-weight: 550;
}
#save-state {
  color: var(--positive);
  font-size: 0.83rem;
  text-align: right;
}
#save-state[data-error] {
  color: var(--danger);
}
#view {
  padding: clamp(20px, 3.2vw, 52px) clamp(20px, 3.8vw, 70px) 70px;
  max-width: 1660px;
  margin: auto;
  outline: none;
}
h1,
h2,
h3,
p {
  margin: 0;
}
h1 {
  font-size: clamp(1.9rem, 3.15vw, 3.3rem);
  font-weight: 520;
  letter-spacing: -0.045em;
  line-height: 1.12;
}
h2 {
  font-size: clamp(1.17rem, 1.8vw, 1.6rem);
  font-weight: 550;
  letter-spacing: -0.025em;
  line-height: 1.28;
}
h3 {
  font-size: 1.03rem;
  font-weight: 570;
}
.sub,
.meta {
  color: var(--muted);
}
.sub {
  font-size: 0.96rem;
  margin-top: 8px;
}
.meta {
  font-size: 0.85rem;
}
.heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 26px;
}
.heading > div {
  min-width: 0;
}
.actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 9px;
}
.btn,
select {
  border: 1px solid #cfc7bd;
  background: var(--paper);
  border-radius: 8px;
  padding: 0.58rem 0.85rem;
  min-height: 42px;
  font-size: 0.9rem;
  font-weight: 490;
}
.btn.primary {
  background: var(--wine);
  color: white;
  border-color: var(--wine);
}
.btn.danger {
  color: var(--danger);
}
select {
  max-width: 100%;
}
.selector {
  display: grid;
  gap: 4px;
  color: var(--muted);
  font-size: 0.8rem;
}
.selector select {
  color: var(--ink);
  min-width: 12rem;
}
.panel {
  background: var(--paper);
  border: 1px solid var(--line);
  padding: clamp(17px, 2.1vw, 32px);
  border-radius: var(--radius);
  min-width: 0;
}
.stack {
  display: grid;
  gap: 18px;
}
.metrics {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin: 0 0 20px;
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--line);
  background: var(--paper);
}
.metric {
  padding: clamp(16px, 2vw, 29px);
  min-width: 0;
}
.metric + .metric {
  border-left: 1px solid var(--line);
}
.metric:first-child {
  background: var(--wine);
  color: white;
}
.metric:first-child .meta {
  color: #f0dfe3;
}
.metric .value {
  display: block;
  font-size: clamp(1.36rem, 2.5vw, 2.65rem);
  font-weight: 520;
  line-height: 1.15;
  letter-spacing: -0.035em;
  margin: 10px 0 6px;
  overflow-wrap: anywhere;
}
.metric .value small {
  font-size: 0.48em;
  font-weight: 480;
  letter-spacing: 0;
}
.metric .meta {
  font-size: 0.82rem;
}
.chartgrid {
  display: grid;
  grid-template-columns: minmax(0, 1.65fr) minmax(220px, 0.85fr);
  gap: 18px;
}
.chart-title,
.panel-title,
.row {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: center;
}
.panel-title {
  margin-bottom: 16px;
}
.chart {
  width: 100%;
  display: block;
  height: auto;
  overflow: visible;
  margin-top: 12px;
}
.facts {
  margin: 12px 0 0;
}
.facts > div,
.listrow {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: center;
  padding: 12px 0;
  border-bottom: 1px solid #e9e3dc;
}
.facts > div:last-child,
.listrow:last-child {
  border: 0;
}
.facts dt {
  color: var(--muted);
  font-size: 0.89rem;
}
.facts dd {
  margin: 0;
  text-align: right;
  font-size: 0.94rem;
  font-weight: 530;
}
.chart-legend {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 0.82rem;
}
.chart-legend:before {
  content: '';
  width: 18px;
  height: 3px;
  background: var(--wine);
  border-radius: 2px;
}
.sblock {
  margin-top: 24px;
}
.link {
  color: var(--wine);
  font-weight: 530;
  text-decoration: underline;
  text-underline-offset: 3px;
}
.formgrid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 205px), 1fr));
  gap: 15px 20px;
}
.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  justify-content: flex-end;
  min-width: 0;
  font-size: 0.88rem;
  color: #4d4347;
}
.field input,
.field textarea,
.field select,
dialog input,
dialog select {
  border: 1px solid #bfb7b0;
  border-radius: 7px;
  padding: 9px 11px;
  background: white;
  width: 100%;
  min-height: 43px;
}
.field textarea {
  min-height: 72px;
  resize: vertical;
}
.wide {
  grid-column: 1/-1;
}
details.group {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--paper);
}
details.group > summary {
  padding: 15px 19px;
  cursor: pointer;
  font-weight: 540;
}
details.group > .formgrid,
details.group > .inner {
  padding: 2px 20px 20px;
}
.errors {
  border-left: 4px solid var(--danger);
  padding: 13px 17px;
  background: #f4e9e8;
  margin-bottom: 16px;
}
.errors ul {
  margin: 6px 0 0;
  padding-left: 20px;
}
.errors button {
  text-align: left;
  color: var(--wine);
  text-decoration: underline;
}
.info {
  margin: 14px 0;
  padding: 12px 15px;
  background: #eeeae3;
  border-radius: 8px;
}
.scrolltable {
  overflow: auto;
  max-width: 100%;
}
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
  text-align: right;
}
th,
td {
  padding: 11px 12px;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
th {
  font-weight: 510;
  color: var(--muted);
  font-size: 0.84rem;
  background: #f5f2ed;
}
th:first-child,
td:first-child {
  text-align: left;
}
td.negative {
  color: var(--danger);
}
tr:last-child td {
  border-bottom: 0;
}
.tabs {
  display: flex;
  gap: 7px;
  flex-wrap: wrap;
}
.tabs button {
  padding: 5px 10px;
  border-radius: 5px;
  font-size: 0.84rem;
  color: var(--muted);
}
.tabs button[aria-pressed='true'] {
  background: var(--soft);
  color: var(--wine);
}
.hidden,
[hidden] {
  display: none !important;
}
dialog {
  padding: 24px;
  width: min(450px, 92vw);
  border: 1px solid var(--line);
  border-radius: 12px;
  color: var(--ink);
  background: var(--paper);
}
dialog::backdrop {
  background: #30272a66;
}
dialog form {
  display: grid;
  gap: 16px;
}
dialog .actions {
  justify-content: flex-end;
}
.mobile {
  display: none;
}
#notice {
  position: fixed;
  z-index: 9;
  bottom: 18px;
  right: 18px;
  background: #30272a;
  color: white;
  padding: 12px 18px;
  border-radius: 8px;
  max-width: 90vw;
}
.empty {
  padding: 24px 0;
  color: var(--muted);
}
.only-print {
  display: none;
}
@media (max-width: 1100px) {
  #layout {
    grid-template-columns: 188px minmax(0, 1fr);
  }
  #rail {
    padding: 25px 10px;
  }
  .chartgrid {
    grid-template-columns: minmax(0, 1.45fr) minmax(195px, 0.85fr);
  }
}
@media (max-width: 830px) {
  .chartgrid {
    grid-template-columns: 1fr;
  }
  .metric {
    padding: 15px;
  }
  .metric .value {
    font-size: 1.45rem;
  }
}
@media (max-width: 680px) {
  #layout {
    display: block;
  }
  #rail {
    position: relative;
    display: flex;
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
    height: auto;
    padding: 11px 16px;
    border: 0;
    border-bottom: 1px solid var(--line);
    z-index: 2;
  }
  .brand {
    margin: 0;
  }
  .brand img {
    width: 62px;
  }
  .brand strong {
    font-size: 16px;
  }
  .mobile {
    display: block;
  }
  .railfoot {
    display: none;
  }
  #mobileNav {
    padding: 6px 12px;
    background: var(--paper);
    border: 1px solid var(--line);
    border-radius: 5px;
  }
  #nav {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--paper);
    border-bottom: 1px solid var(--line);
    padding: 10px;
  }
  #nav.open {
    display: grid;
  }
  #nav a:last-child {
    margin-top: 0;
  }
  .top {
    height: 46px;
    padding: 0 16px;
  }
  #view {
    padding: 22px 14px 40px;
  }
  .heading {
    align-items: flex-start;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 16px;
  }
  .selector {
    display: flex;
    align-items: center;
    gap: 10px;
  }
  .selector select {
    min-width: 0;
    min-height: 34px;
  }
  .metrics {
    grid-template-columns: 1fr 1fr;
  }
  .metric:first-child {
    grid-column: 1/-1;
  }
  .metric:first-child .value {
    font-size: 2rem;
  }
  .metric:nth-child(2) {
    border-left: 0;
  }
  .metric {
    padding: 12px 14px;
  }
  .metric .value {
    margin: 3px 0;
    font-size: 1.25rem;
  }
  .chart-title {
    align-items: flex-start;
    flex-direction: column;
  }
  .chartgrid,
  .stack {
    gap: 12px;
  }
  .chart {
    margin-top: 4px;
  }
  .row,
  .listrow {
    flex-wrap: wrap;
  }
  .sub {
    font-size: 0.88rem;
  }
  .panel {
    padding: 16px;
  }
  .crumb,
  #save-state {
    font-size: 0.76rem;
  }
  .btn,
  select {
    font-size: 0.88rem;
  }
  .table td {
    padding: 9px;
  }
  .actions {
    gap: 6px;
  }
}
@media print {
  body {
    background: white;
    color: #222;
    font-size: 11px;
  }
  #layout {
    display: block;
  }
  #rail,
  .top,
  .heading .actions,
  .selector,
  .no-print,
  dialog,
  #notice,
  button,
  .skip {
    display: none !important;
  }
  #view {
    padding: 0;
    max-width: none;
  }
  .only-print {
    display: block;
  }
  .panel,
  .metrics {
    border: 0;
    border-radius: 0;
    padding: 8px 0;
  }
  .metric:first-child,
  .metric,
  .metric:first-child .meta {
    color: var(--ink);
    background: none;
  }
  .metrics,
  .chartgrid {
    display: flex;
  }
  .metric {
    flex: 1;
  }
  .chartgrid > .panel {
    flex: 1;
  }
  .chart {
    max-height: 200px;
  }
  .panel-title,
  h2,
  h3 {
    break-after: avoid;
  }
  tr,
  .metric {
    break-inside: avoid;
  }
  .scrolltable {
    overflow: visible;
  }
  th,
  td {
    white-space: normal;
    padding: 5px;
  }
  .actions {
    display: none;
  }
  .print-logo {
    width: 100px;
    height: auto;
  }
  .heading {
    margin: 12px 0;
  }
  .sblock {
    margin-top: 12px;
  }
  a {
    color: inherit;
    text-decoration: none;
  }
  @page {
    size: A4;
    margin: 14mm;
  }
}
.top-actions {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-shrink: 0;
}
.top-new {
  min-height: 34px;
  padding: 5px 12px;
  border-color: #bda992;
  color: var(--wine);
}
@media (min-width: 681px) and (max-width: 1100px) {
  .brand {
    gap: 6px;
  }
  .brand img {
    width: 65px;
  }
  .brand strong {
    font-size: 16px;
    padding-left: 7px;
  }
}
@media (max-width: 680px) {
  .chart text {
    font-size: 22px;
  }
  .top-actions {
    gap: 8px;
  }
  .top-new {
    font-size: 0.78rem;
    padding: 4px 7px;
    min-height: 30px;
  }
  .crumb {
    flex: 1;
  }
  .top .crumb button {
    display: none;
  }
  .top .crumb > span[aria-hidden] {
    display: none;
  }
}

@media print {
  #view:has(.print-header) > .heading { display: none; }
  .print-header { display:flex; align-items:center; gap:20px; padding-bottom:12px; border-bottom:1.5pt solid var(--wine); }
  .print-header > div { border-left:1px solid var(--gold); padding-left:16px; }
  .print-header p { font-size:10pt; color:var(--wine); }
  .print-header h2 { font-size:19pt; }
}

.report-note { margin: 1rem 0; }
.report-note p { white-space: pre-wrap; overflow-wrap: anywhere; margin: .35rem 0; }
@media print {
  .facts > div { padding: 3pt 0; break-inside: avoid; }
  .facts dd, .print-header > div, #view th, #view td { min-width: 0; overflow-wrap: anywhere; }
  .print-header .print-logo { flex: none; }
  .report-note { margin: 6pt 0; }
  #view table { table-layout: fixed; font-size: 8.5pt; }
  #view th { font-size: 8pt; }
  #view thead { display: table-header-group; }
  #view p { orphans: 2; widows: 2; }
}
@page {
  margin-bottom: 19mm;
  @bottom-left { content: "SYL Proje Fizibilite"; font: 8pt Rubik, sans-serif; color: #62595b; }
  @bottom-right { content: counter(page) " / " counter(pages); font: 8pt Rubik, sans-serif; color: #62595b; }
}
