:root {
  color-scheme: light;
  --bg: #f6f7f3;
  --ink: #18201f;
  --muted: #66706d;
  --line: #d9dfd8;
  --panel: #ffffff;
  --green: #27765f;
  --blue: #315f9d;
  --red: #ad514b;
  --amber: #b4782f;
  --soft-green: #e5f1ec;
  --soft-blue: #e8eef8;
  --shadow: 0 18px 50px rgba(30, 43, 39, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 320px;
  background: var(--bg);
  color: var(--ink);
  font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
input,
select {
  font: inherit;
}

button,
select,
input {
  border: 1px solid var(--line);
}

button {
  min-height: 40px;
  padding: 0 16px;
  border-radius: 6px;
  background: var(--green);
  color: #fff;
  cursor: pointer;
}

button.secondary,
.presets button {
  background: #fff;
  color: var(--ink);
}

button:hover {
  filter: brightness(0.96);
}

.shell {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: 34px 0 42px;
}

.topbar {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 24px;
  align-items: end;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--green);
  font-size: 13px;
  font-weight: 700;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: clamp(28px, 4vw, 44px);
  line-height: 1.1;
  letter-spacing: 0;
}

h2 {
  font-size: 17px;
  line-height: 1.25;
}

.filters {
  display: grid;
  grid-template-columns: repeat(2, minmax(136px, 1fr)) repeat(2, auto);
  gap: 10px;
  justify-content: end;
  align-items: end;
}

.filters label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

input,
select {
  height: 40px;
  border-radius: 6px;
  background: #fff;
  color: var(--ink);
  padding: 0 10px;
}

.filters input {
  width: 100%;
}

.presets {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 6px;
  margin: 22px 0;
  max-width: 360px;
}

.presets button {
  min-height: 30px;
  padding: 0 8px;
  font-size: 13px;
  font-weight: 700;
  white-space: nowrap;
}

.metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.metrics article,
.panel,
.tableSection,
.chartBand {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.metrics article {
  min-height: 96px;
  padding: 18px;
  display: grid;
  align-content: space-between;
}

.metrics span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.metrics strong {
  font-size: 30px;
  line-height: 1;
}

.chartBand {
  margin-top: 14px;
  padding: 20px;
}

.sectionTitle {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
  margin-bottom: 16px;
}

.sectionTitle p {
  color: var(--muted);
  font-size: 13px;
}

canvas {
  display: block;
  width: 100%;
  max-width: 100%;
  height: 260px;
}

.grid {
  display: grid;
  grid-template-columns: 0.9fr 1.1fr;
  gap: 14px;
  margin-top: 14px;
}

.panel,
.tableSection {
  padding: 18px;
}

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

.barRow {
  display: grid;
  gap: 7px;
}

.barTop {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  color: var(--muted);
  font-size: 13px;
}

.barTrack,
.barSvg {
  height: 10px;
  overflow: hidden;
  border-radius: 999px;
}

.barSvg {
  display: block;
  width: 100%;
}

.barBase {
  fill: #edf0ee;
}

.barFill {
  fill: var(--blue);
}

.barFill.pending {
  fill: var(--amber);
}

.barFill.resolved {
  fill: var(--green);
}

.barFill.withdrawn {
  fill: var(--red);
}

.tableSection {
  margin-top: 14px;
}

.tableHead {
  align-items: end;
}

.tableWrap {
  width: 100%;
  overflow-x: auto;
}

table {
  width: 100%;
  min-width: 760px;
  border-collapse: collapse;
}

th,
td {
  padding: 12px 10px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  font-size: 14px;
  white-space: nowrap;
}

th {
  color: var(--muted);
  font-size: 12px;
}

.status {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 0 9px;
  border-radius: 999px;
  background: var(--soft-blue);
  color: var(--blue);
  font-size: 12px;
  font-weight: 800;
}

.status.pending {
  background: #fbefd9;
  color: #8b581d;
}

.status.resolved {
  background: var(--soft-green);
  color: var(--green);
}

.status.withdrawn {
  background: #f8e7e5;
  color: var(--red);
}

.syncLine {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-top: 14px;
  color: var(--muted);
  font-size: 13px;
}

.empty,
.error {
  color: var(--muted);
  padding: 18px 0;
}

.error {
  color: var(--red);
}

@media (max-width: 860px) {
  .topbar,
  .grid,
  .metrics {
    grid-template-columns: 1fr;
  }

  .filters {
    justify-content: flex-start;
    width: 100%;
  }

  .metrics article {
    min-height: 82px;
  }
}

@media (max-width: 560px) {
  .shell {
    width: min(100% - 20px, 1180px);
    padding-top: 22px;
  }

  .filters {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 8px;
  }

  .filters button {
    width: 100%;
    min-height: 38px;
    padding: 0 8px;
  }

  .presets {
    max-width: none;
    gap: 5px;
    margin: 16px 0;
  }

  .presets button {
    width: auto;
    min-height: 28px;
    padding: 0 6px;
    font-size: 12px;
  }

  .sectionTitle {
    display: grid;
  }
}
