@font-face {
  font-family: "TWK Lausanne";
  src: url("./fonts/TWKLausanne-200.woff2") format("woff2");
  font-style: normal;
  font-weight: 200;
  font-display: swap;
}

@font-face {
  font-family: "TWK Lausanne";
  src: url("./fonts/TWKLausanne-350.woff2") format("woff2");
  font-style: normal;
  font-weight: 350;
  font-display: swap;
}

:root {
  --bg: #f9f8f3;
  --paper: #fffdf7;
  --ink: #1f2522;
  --muted: #55635c;
  --line: #d9d4c7;
  --accent: #0f766e;
  --accent-soft: #d4f2ee;
  --warn: #c84b31;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "TWK Lausanne", "Segoe UI", sans-serif;
  color: var(--ink);
  background: radial-gradient(circle at 10% 10%, #efe8d2 0, transparent 45%),
    radial-gradient(circle at 90% 20%, #d8ede8 0, transparent 40%), var(--bg);
}

.bg-shape {
  position: fixed;
  border-radius: 999px;
  filter: blur(36px);
  opacity: 0.35;
  pointer-events: none;
  z-index: 0;
}

.bg-shape-a {
  width: 280px;
  height: 280px;
  background: #eebc66;
  top: 40px;
  right: -80px;
}

.bg-shape-b {
  width: 220px;
  height: 220px;
  background: #4cbda9;
  bottom: 80px;
  left: -70px;
}

.layout {
  position: relative;
  z-index: 1;
  max-width: 1260px;
  margin: 0 auto;
  padding: 30px 18px 40px;
}

.hero h1 {
  margin: 0;
  font-family: "TWK Lausanne", "Segoe UI", sans-serif;
  font-weight: 350;
  font-size: clamp(1.8rem, 3.2vw, 2.8rem);
  line-height: 1.05;
}

.brand-logo {
  display: block;
  width: 190px;
  max-width: 45vw;
  height: auto;
  margin-bottom: 8px;
}

.kicker {
  margin: 0 0 6px;
  color: var(--accent);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  font-size: 0.82rem;
  font-weight: 700;
}

.subtitle {
  margin: 8px 0 0;
  color: var(--muted);
}

.controls {
  margin-top: 22px;
  display: grid;
  grid-template-columns: 170px 170px 190px minmax(220px, 1fr) auto auto auto;
  gap: 12px;
  align-items: end;
}

.controls label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 0.82rem;
  color: var(--muted);
  font-weight: 600;
}

.controls input,
.controls select {
  height: 40px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--paper);
  color: var(--ink);
  font: inherit;
}

.controls .check {
  flex-direction: row;
  align-items: center;
  gap: 8px;
  height: 40px;
}

.controls .check input {
  width: 18px;
  height: 18px;
}

.controls .actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  min-height: 40px;
  align-items: center;
}

.controls .actions button {
  height: 40px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--paper);
  color: var(--ink);
  padding: 0 14px;
  font: inherit;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
}

.controls .actions button:hover {
  border-color: #b9b09b;
  background: #faf6ea;
}

.dashboard {
  margin-top: 16px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--paper);
  padding: 14px 14px 10px;
  box-shadow: 0 12px 40px rgba(60, 58, 45, 0.09);
}

.dashboard-header {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: baseline;
  margin-bottom: 10px;
}

.dashboard-header h2 {
  margin: 0;
  font-size: 1rem;
}

.dashboard-header p {
  margin: 0;
  color: var(--muted);
  font-size: 0.82rem;
}

.kpi-cards {
  display: grid;
  grid-template-columns: repeat(6, minmax(130px, 1fr));
  gap: 8px;
  margin-bottom: 12px;
}

.kpi-card {
  border: 1px solid #ece4cf;
  border-radius: 12px;
  background: #fff9e9;
  padding: 8px 10px;
}

.kpi-card .kpi-label {
  display: block;
  font-size: 0.74rem;
  text-transform: uppercase;
  color: #5d655f;
  letter-spacing: 0.03em;
}

.kpi-card .kpi-value {
  display: block;
  margin-top: 4px;
  font-weight: 700;
  font-size: 0.95rem;
}

.kpi-card .kpi-var {
  display: block;
  margin-top: 2px;
  font-size: 0.74rem;
  color: var(--muted);
}

.dashboard-table-wrap {
  border: 1px solid #eee7d4;
  border-radius: 10px;
  overflow: auto;
}

#dashboard-table {
  width: max(920px, 100%);
  border-collapse: collapse;
}

#dashboard-table th,
#dashboard-table td {
  border-bottom: 1px solid #f2eddf;
  padding: 8px;
  text-align: right;
  font-size: 0.8rem;
  white-space: nowrap;
}

#dashboard-table th:first-child,
#dashboard-table td:first-child {
  text-align: left;
  min-width: 180px;
  font-weight: 600;
}

#dashboard-table thead th {
  background: #f7f1de;
  position: sticky;
  top: 0;
  z-index: 1;
}

.table-wrap {
  margin-top: 16px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--paper);
  overflow: auto;
  box-shadow: 0 12px 40px rgba(60, 58, 45, 0.09);
}

table {
  width: max(1100px, 100%);
  border-collapse: separate;
  border-spacing: 0;
}

thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: #f2eee2;
  color: #34403b;
  border-bottom: 1px solid var(--line);
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  text-align: right;
  padding: 10px 8px;
}

thead th.sticky-left {
  left: 0;
  z-index: 3;
  text-align: left;
}

thead th.sticky-left-2 {
  left: 190px;
  z-index: 3;
  text-align: left;
}

tbody tr {
  animation: rowIn 0.32s ease both;
}

tbody td {
  border-bottom: 1px solid #efece2;
  padding: 8px 8px;
  font-size: 0.83rem;
  text-align: right;
  white-space: nowrap;
  background: #fffdf7;
}

tbody td.sticky-left {
  position: sticky;
  left: 0;
  z-index: 1;
  text-align: left;
  min-width: 190px;
  max-width: 190px;
  background: #fcf9f1;
}

tbody td.sticky-left-2 {
  position: sticky;
  left: 190px;
  z-index: 1;
  text-align: left;
  min-width: 340px;
  max-width: 340px;
  background: #fffdf7;
}

tbody tr.section td {
  background: #ecf5f2;
  font-weight: 700;
}

tbody tr.group td {
  background: #f9f6ec;
  font-weight: 600;
}

tbody tr.account td.sticky-left-2 {
  font-weight: 500;
}

.twisty {
  display: inline-grid;
  place-items: center;
  width: 20px;
  height: 20px;
  margin-right: 6px;
  border: 1px solid #c5bfae;
  border-radius: 6px;
  background: #fff8e6;
  color: #44514b;
  font-size: 12px;
  line-height: 1;
  cursor: pointer;
  vertical-align: middle;
}

.twisty-spacer {
  display: inline-block;
  width: 20px;
  margin-right: 6px;
}

.val-neg {
  color: var(--warn);
}

.val-pos {
  color: #17603a;
}

.legend {
  margin: 10px 4px 0;
  color: var(--muted);
  font-size: 0.8rem;
}

@keyframes rowIn {
  from {
    opacity: 0;
    transform: translateY(4px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 880px) {
  .controls {
    grid-template-columns: 1fr 1fr;
    align-items: stretch;
  }

  .kpi-cards {
    grid-template-columns: repeat(2, minmax(120px, 1fr));
  }

  thead th.sticky-left-2,
  tbody td.sticky-left-2 {
    left: 150px;
    min-width: 240px;
    max-width: 240px;
  }

  thead th.sticky-left,
  tbody td.sticky-left {
    min-width: 150px;
    max-width: 150px;
  }
}
