:root {
  color-scheme: light;
  --bg: #f4f6f8;
  --panel: #ffffff;
  --text: #17202a;
  --muted: #637083;
  --line: #d9e0e8;
  --brand: #176b87;
  --green: #2f8f5b;
  --amber: #b46b12;
  --red: #b33939;
  --shadow: 0 10px 28px rgba(22, 32, 42, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, Segoe UI, Arial, sans-serif;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 22px 32px;
  background: rgba(244, 246, 248, 0.92);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(12px);
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: 24px;
  font-weight: 760;
}

h2 {
  font-size: 16px;
  font-weight: 720;
}

.topbar p,
.panel-head span {
  color: var(--muted);
  font-size: 13px;
  margin-top: 5px;
}

.actions {
  display: flex;
  gap: 10px;
}

.actions form {
  margin: 0;
}

select,
button {
  height: 38px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--panel);
  color: var(--text);
  font: inherit;
  padding: 0 12px;
}

button {
  background: var(--brand);
  border-color: var(--brand);
  color: #fff;
  cursor: pointer;
}

button.secondary {
  background: var(--panel);
  color: var(--text);
}

button:disabled {
  cursor: wait;
  opacity: 0.7;
}

main {
  padding: 24px 32px 40px;
}

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(150px, 1fr));
  gap: 14px;
}

.kpi,
.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.kpi {
  padding: 16px;
  min-height: 104px;
}

.kpi span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.kpi strong {
  display: block;
  margin-top: 10px;
  font-size: 24px;
}

.kpi small {
  display: block;
  margin-top: 8px;
  color: var(--muted);
}

.layout {
  display: grid;
  gap: 16px;
  margin-top: 16px;
}

.layout.two {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.layout.three {
  grid-template-columns: 1.2fr 0.8fr 0.9fr;
}

.panel {
  padding: 18px;
  min-width: 0;
}

.panel-head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
}

canvas {
  display: block;
  width: 100%;
  max-height: 260px;
}

.funnel {
  display: grid;
  gap: 10px;
}

.funnel-row {
  display: grid;
  grid-template-columns: 130px 1fr 70px;
  align-items: center;
  gap: 10px;
  font-size: 13px;
}

.bar {
  height: 18px;
  overflow: hidden;
  background: #edf1f5;
  border-radius: 5px;
}

.bar i {
  display: block;
  height: 100%;
  background: var(--brand);
}

.table-wrap {
  overflow: auto;
  margin-top: 12px;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

th,
td {
  padding: 10px 8px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  white-space: nowrap;
}

th {
  color: var(--muted);
  font-weight: 650;
}

.user {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.user b {
  font-weight: 680;
}

.user span {
  color: var(--muted);
  font-size: 12px;
}

@media (max-width: 1180px) {
  .kpi-grid {
    grid-template-columns: repeat(3, minmax(150px, 1fr));
  }

  .layout.three {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 760px) {
  .topbar {
    align-items: stretch;
    flex-direction: column;
    padding: 18px;
  }

  main {
    padding: 18px;
  }

  .kpi-grid,
  .layout.two {
    grid-template-columns: 1fr;
  }
}

.login-page {
  min-height: 100vh;
  background:
    linear-gradient(180deg, rgba(23, 107, 135, 0.08), rgba(244, 246, 248, 0)),
    var(--bg);
}

.login-shell {
  display: grid;
  min-height: 100vh;
  place-items: center;
  padding: 24px;
}

.login-panel {
  display: grid;
  width: min(100%, 390px);
  gap: 16px;
  padding: 26px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.login-panel p {
  color: var(--muted);
  margin-top: 6px;
}

.login-panel label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 13px;
}

.login-panel input {
  width: 100%;
  height: 42px;
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 0 12px;
  color: var(--text);
  font: inherit;
}

.login-message {
  min-height: 18px;
  color: var(--red);
  font-size: 13px;
}
