:root {
  --bg: #f5f7f6;
  --surface: #ffffff;
  --surface-2: #edf2f0;
  --ink: #18221f;
  --muted: #64716d;
  --line: #dbe3df;
  --green: #157f63;
  --blue: #2766c2;
  --red: #ba3b46;
  --amber: #a86f00;
  --shadow: 0 18px 45px rgba(23, 34, 31, 0.08);
}

* {
  box-sizing: border-box;
}

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

a {
  color: inherit;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 24px 32px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.92);
  position: sticky;
  top: 0;
  z-index: 5;
  backdrop-filter: blur(12px);
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--green);
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2 {
  margin: 0;
  letter-spacing: 0;
}

h1 {
  font-size: clamp(1.45rem, 2.6vw, 2.1rem);
}

h2 {
  font-size: 1.02rem;
}

.user-strip {
  display: flex;
  align-items: center;
  gap: 14px;
  color: var(--muted);
  font-size: 0.92rem;
}

.user-strip a,
button {
  border: 0;
  border-radius: 6px;
  background: var(--ink);
  color: white;
  padding: 10px 14px;
  font-weight: 750;
  text-decoration: none;
  cursor: pointer;
}

.layout {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  gap: 24px;
  padding: 24px 32px 40px;
}

.filters {
  align-self: start;
  position: sticky;
  top: 108px;
  display: grid;
  gap: 14px;
  padding: 18px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 750;
}

input,
select {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: white;
  color: var(--ink);
  padding: 9px 10px;
  font: inherit;
}

.content {
  display: grid;
  gap: 22px;
  min-width: 0;
}

.status {
  min-height: 18px;
  color: var(--muted);
  font-size: 0.88rem;
}

.status.error {
  color: var(--red);
  font-weight: 750;
}

.kpis {
  display: grid;
  grid-template-columns: repeat(4, minmax(150px, 1fr));
  gap: 14px;
}

.kpis article,
.panel,
.login-panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.kpis article {
  display: grid;
  gap: 8px;
  min-height: 118px;
  padding: 16px;
}

.kpis span {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 800;
}

.kpis strong {
  font-size: 1.45rem;
  letter-spacing: 0;
}

.kpis small,
.muted {
  color: var(--muted);
}

.grid {
  display: grid;
  gap: 22px;
}

.grid.two {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.panel {
  min-width: 0;
  padding: 18px;
}

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

.panel-head input {
  max-width: 260px;
}

.chart-box {
  position: relative;
  height: 320px;
}

.table-wrap {
  overflow: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

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

th {
  color: var(--muted);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0;
}

td.amount {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  border-radius: 999px;
  padding: 3px 9px;
  background: var(--surface-2);
  color: var(--ink);
  font-size: 0.78rem;
  font-weight: 800;
}

.badge.ok {
  background: #dff3ec;
  color: #07533f;
}

.badge.warn {
  background: #fff2d2;
  color: #744900;
}

.badge.bad {
  background: #fae1e4;
  color: #822633;
}

.login-body {
  display: grid;
  place-items: center;
  padding: 28px;
  background:
    linear-gradient(135deg, rgba(21, 127, 99, 0.12), rgba(39, 102, 194, 0.1)),
    var(--bg);
}

.login-shell {
  width: min(430px, 100%);
}

.login-panel {
  padding: 30px;
}

.login-form {
  display: grid;
  gap: 16px;
  margin-top: 22px;
}

.alert {
  margin-top: 18px;
  padding: 11px 12px;
  border-radius: 6px;
  background: #fae1e4;
  color: var(--red);
  font-weight: 750;
}

@media (max-width: 1180px) {
  .kpis {
    grid-template-columns: repeat(2, minmax(140px, 1fr));
  }
}

@media (max-width: 860px) {
  .topbar,
  .layout {
    padding-left: 18px;
    padding-right: 18px;
  }

  .layout {
    grid-template-columns: 1fr;
  }

  .filters {
    position: static;
  }

  .grid.two,
  .kpis {
    grid-template-columns: 1fr;
  }

  .panel-head {
    align-items: stretch;
    flex-direction: column;
  }

  .panel-head input {
    max-width: none;
  }
}
