:root {
  color-scheme: light;
  --ink: #153b31;
  --muted: #70867f;
  --green: #0b5c43;
  --green-dark: #073f30;
  --mint: #e4f2eb;
  --paper: #f4f6f2;
  --card: #ffffff;
  --line: #dce7e0;
  --gold: #d8a443;
  font-family: Inter, 'PingFang SC', 'Microsoft YaHei', sans-serif;
}

* {
  box-sizing: border-box;
}
[hidden] {
  display: none !important;
}
html {
  scroll-behavior: smooth;
}
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
}
button,
input {
  font: inherit;
}
button {
  cursor: pointer;
}

.login-view {
  min-height: 100svh;
  padding: 28px 18px;
  display: grid;
  place-items: center;
  background:
    radial-gradient(
      circle at 85% 12%,
      rgba(221, 181, 91, 0.2),
      transparent 26%
    ),
    linear-gradient(155deg, #0b4b38 0 38%, #f2f5f0 38% 100%);
}
.login-card {
  width: min(100%, 420px);
  padding: 28px 22px 24px;
  border: 1px solid rgba(255, 255, 255, 0.7);
  border-radius: 26px;
  background: rgba(255, 255, 255, 0.97);
  box-shadow: 0 24px 70px rgba(5, 48, 35, 0.22);
}
.brand-mark,
.brand span {
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  border-radius: 15px;
  color: var(--green-dark);
  background: #f1dca9;
  font-size: 20px;
  font-weight: 900;
}
.eyebrow {
  margin: 18px 0 8px;
  color: var(--green);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.14em;
}
.login-card h1 {
  margin: 0;
  font-size: 31px;
  line-height: 1.16;
  letter-spacing: -0.04em;
}
.login-note {
  margin: 12px 0 24px;
  color: var(--muted);
  font-size: 14px;
}
.login-form {
  display: grid;
  gap: 14px;
}
.login-form label {
  display: grid;
  gap: 7px;
  color: var(--ink);
  font-size: 13px;
  font-weight: 700;
}
.login-form input {
  width: 100%;
  min-height: 50px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 13px;
  outline: none;
  color: var(--ink);
  background: #f8faf8;
}
.login-form input:focus {
  border-color: #4f987c;
  box-shadow: 0 0 0 3px rgba(79, 152, 124, 0.12);
}
.login-form button {
  min-height: 52px;
  border: 0;
  border-radius: 14px;
  color: #fff;
  background: var(--green);
  font-weight: 800;
}
.login-form button:disabled {
  cursor: wait;
  opacity: 0.65;
}
.login-error {
  min-height: 18px;
  margin: -3px 0 0;
  color: #b34b3a;
  font-size: 12px;
}
.login-card small {
  display: block;
  margin-top: 18px;
  color: #8a9b95;
  text-align: center;
  font-size: 11px;
}

.app-shell {
  min-height: 100vh;
  padding-bottom: 74px;
}
.sidebar {
  position: sticky;
  z-index: 20;
  top: 0;
  padding: 12px 16px;
  color: #fff;
  background: var(--green-dark);
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
}
.brand span {
  width: 34px;
  height: 34px;
  border-radius: 11px;
  font-size: 15px;
}
.brand strong {
  font-size: 16px;
}
.sidebar > p,
.sidebar > .logout-button {
  display: none;
}
.sidebar nav {
  position: fixed;
  z-index: 30;
  right: 0;
  bottom: 0;
  left: 0;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  padding: 7px max(8px, env(safe-area-inset-right))
    max(7px, env(safe-area-inset-bottom)) max(8px, env(safe-area-inset-left));
  border-top: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(14px);
}
.sidebar a {
  display: grid;
  justify-items: center;
  gap: 3px;
  padding: 4px;
  color: #7a8f87;
  text-decoration: none;
  font-size: 10px;
}
.sidebar a i {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 9px;
  background: #edf3ef;
  font-style: normal;
  font-weight: 800;
}
.sidebar a.active {
  color: var(--green);
  font-weight: 800;
}
.sidebar a.active i {
  color: #fff;
  background: var(--green);
}

main {
  width: 100%;
  max-width: 1450px;
  margin: 0 auto;
  padding: 24px 14px 32px;
}
.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 18px;
}
.page-header .eyebrow {
  margin-top: 0;
}
h1 {
  margin: 0;
  font-size: 30px;
  letter-spacing: -0.04em;
}
.subtitle {
  margin: 7px 0 0;
  color: var(--muted);
  font-size: 13px;
}
.mobile-logout {
  padding: 7px 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--muted);
  background: #fff;
  font-size: 12px;
}

.range-form {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 9px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #fff;
  box-shadow: 0 7px 24px rgba(19, 59, 48, 0.05);
}
.range-form label {
  display: grid;
  gap: 5px;
  color: var(--muted);
  font-size: 10px;
}
.range-form input {
  min-width: 0;
  width: 100%;
  padding: 10px 8px;
  border: 0;
  border-radius: 9px;
  color: var(--ink);
  background: #f3f6f3;
  font-size: 12px;
}
.range-form button {
  grid-column: 1 / -1;
  min-height: 42px;
  border: 0;
  border-radius: 11px;
  color: #fff;
  background: var(--green);
  font-weight: 800;
}
.status {
  margin: 12px 0 20px;
  padding: 10px 12px;
  border-radius: 11px;
  color: #88651f;
  background: #fff1cc;
  font-size: 12px;
}
.status.success {
  color: #276348;
  background: #e1f0e7;
}
.status.error {
  color: #a14634;
  background: #fde8e2;
}

.section-heading,
.panel-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.section-heading > div {
  display: flex;
  align-items: center;
  gap: 9px;
}
.section-heading p {
  margin: 0;
  color: var(--gold);
  font-weight: 900;
}
h2 {
  margin: 0;
  font-size: 18px;
}
.section-heading span,
.panel-heading p {
  color: var(--muted);
  font-size: 10px;
}
.panel-heading p {
  margin: 5px 0 0;
}

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin: 13px 0 20px;
}
.kpi {
  min-height: 126px;
  padding: 16px 14px;
  border: 1px solid var(--line);
  border-radius: 17px;
  background: #fff;
  display: flex;
  flex-direction: column;
  box-shadow: 0 8px 24px rgba(22, 63, 52, 0.04);
}
.kpi.primary {
  color: #fff;
  border-color: var(--green);
  background: var(--green);
}
.kpi p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
}
.kpi.primary p,
.kpi.primary span {
  color: #c6ddd5;
}
.kpi strong {
  margin: 11px 0;
  font-size: 30px;
  line-height: 1;
}
.kpi span {
  margin-top: auto;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.4;
}

.panel {
  margin-top: 14px;
  padding: 18px 14px;
  border: 1px solid var(--line);
  border-radius: 19px;
  background: #fff;
  box-shadow: 0 8px 26px rgba(22, 63, 52, 0.045);
}
.panel-heading > strong {
  padding: 6px 8px;
  border-radius: 9px;
  color: var(--green);
  background: var(--mint);
  font-size: 11px;
}
.legend {
  white-space: nowrap;
  color: var(--muted);
  font-size: 10px;
}
.legend span {
  display: inline-block;
  width: 14px;
  height: 3px;
  margin: 0 3px 3px 7px;
  border-radius: 3px;
}
.legend .uv {
  background: var(--green);
}
.legend .login {
  background: var(--gold);
}
.trend-chart {
  min-height: 220px;
  margin-top: 14px;
  overflow-x: auto;
}
.trend-chart svg {
  display: block;
  width: 100%;
  min-width: 600px;
  height: 220px;
}
.trend-chart line {
  stroke: #dce6df;
}
.trend-chart path {
  fill: none;
  stroke-width: 3;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.trend-chart .area {
  fill: rgba(30, 130, 94, 0.09);
  stroke: none;
}
.trend-chart .uv-line {
  stroke: var(--green);
}
.trend-chart .login-line {
  stroke: var(--gold);
}
.trend-chart text {
  fill: var(--muted);
  font-size: 10px;
}

.funnel {
  margin-top: 17px;
  display: grid;
  gap: 14px;
}
.funnel-row {
  display: grid;
  grid-template-columns: 28px minmax(110px, 1fr) 46px;
  align-items: center;
  gap: 9px;
}
.funnel-row .step {
  display: grid;
  place-items: center;
  width: 27px;
  height: 27px;
  border-radius: 50%;
  color: #fff;
  background: var(--green);
  font-size: 11px;
  font-weight: 800;
}
.funnel-copy strong {
  display: block;
  margin-bottom: 6px;
  font-size: 12px;
}
.bar {
  height: 8px;
  overflow: hidden;
  border-radius: 8px;
  background: #edf2ee;
}
.bar i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #0d6247, #55a47f);
}
.funnel-row b {
  text-align: right;
  font-size: 16px;
}
.funnel-row em {
  display: none;
}

.table-wrap {
  overflow-x: auto;
  margin-top: 14px;
}
table {
  width: 100%;
  min-width: 550px;
  border-collapse: collapse;
  font-size: 12px;
}
th {
  color: var(--muted);
  text-align: left;
  font-size: 10px;
  font-weight: 600;
}
th,
td {
  padding: 12px 9px;
  border-bottom: 1px solid #edf1ee;
}
.rate {
  padding: 4px 7px;
  border-radius: 7px;
  color: var(--green);
  background: var(--mint);
  font-weight: 800;
}
.empty {
  padding: 32px;
  text-align: center;
  color: var(--muted);
}
footer {
  padding: 24px 2px 0;
  color: #879891;
  text-align: center;
  font-size: 10px;
}

@media (min-width: 700px) {
  main {
    padding: 34px 28px;
  }
  .range-form {
    grid-template-columns: 1fr 1fr auto;
    max-width: 520px;
  }
  .range-form button {
    grid-column: auto;
    min-width: 90px;
  }
  .kpi-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
  .funnel-row {
    grid-template-columns: 32px minmax(200px, 1fr) 70px 70px;
    gap: 14px;
  }
  .funnel-row em {
    display: block;
    color: var(--muted);
    font-size: 11px;
    font-style: normal;
  }
}

@media (min-width: 980px) {
  .app-shell {
    display: grid;
    grid-template-columns: 238px 1fr;
    padding-bottom: 0;
  }
  .sidebar {
    position: sticky;
    top: 0;
    height: 100vh;
    padding: 30px 24px;
    display: flex;
    flex-direction: column;
  }
  .brand span {
    width: 42px;
    height: 42px;
    border-radius: 14px;
    font-size: 18px;
  }
  .brand strong {
    font-size: 19px;
  }
  .sidebar > p {
    display: block;
    margin: 10px 0 40px 52px;
    color: #9ebbb1;
    font-size: 12px;
  }
  .sidebar nav {
    position: static;
    display: grid;
    grid-template-columns: 1fr;
    gap: 7px;
    padding: 0;
    border: 0;
    background: transparent;
    backdrop-filter: none;
  }
  .sidebar a {
    grid-template-columns: 30px 1fr;
    justify-items: start;
    align-items: center;
    gap: 10px;
    padding: 10px;
    color: #afc7be;
    font-size: 13px;
  }
  .sidebar a i {
    width: 30px;
    height: 30px;
    color: #b8cec6;
    background: rgba(255, 255, 255, 0.08);
  }
  .sidebar a.active {
    color: #fff;
  }
  .sidebar > .logout-button {
    display: block;
    margin-top: auto;
    padding: 11px;
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 11px;
    color: #c8d9d3;
    background: transparent;
  }
  .mobile-logout {
    display: none;
  }
  main {
    padding: 42px 46px 30px;
  }
  .page-header {
    align-items: flex-end;
  }
  h1 {
    font-size: 40px;
  }
  .range-form {
    margin: -92px 0 30px auto;
  }
  .kpi-grid {
    grid-template-columns: repeat(6, minmax(110px, 1fr));
    gap: 13px;
  }
  .kpi {
    min-height: 145px;
    padding: 19px;
  }
  .panel {
    padding: 24px;
  }
  .trend-chart svg {
    min-width: 700px;
    height: 260px;
  }
}
