:root {
  --bg: #f5f7fa;
  --panel: #ffffff;
  --line: #d9e0e8;
  --text: #18212b;
  --muted: #667587;
  --blue: #2563eb;
  --green: #0f9f6e;
  --amber: #b7791f;
  --red: #c24135;
  --soft-red: #fff1f0;
  --soft-amber: #fff7e6;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  font-size: 15px;
}

body {
  margin: 0;
  min-height: 100%;
  color: var(--text);
  background: var(--bg);
  font-family: "Segoe UI", Arial, sans-serif;
}

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

.topbar {
  background: #101820;
  color: white;
  border-bottom: 1px solid #263442;
}

.topbar-inner {
  min-height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.brand {
  color: white;
  font-size: 1.2rem;
  font-weight: 700;
  text-decoration: none;
}

.host {
  color: #b8c4d0;
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 16px;
}

.logout {
  color: white;
  text-decoration: none;
  font-weight: 600;
}

.page-head {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 16px;
  padding: 28px 0 18px;
}

.import-actions {
  display: flex;
  gap: 10px;
  align-items: center;
}

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

h1 {
  font-size: 1.9rem;
}

h2 {
  font-size: 1rem;
}

p {
  margin: 6px 0 0;
  color: var(--muted);
}

.filters,
.metrics,
.panel,
.notice,
.empty {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.filters {
  display: flex;
  align-items: end;
  gap: 14px;
  padding: 14px;
  margin-bottom: 16px;
}

label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: .86rem;
}

select,
input {
  min-width: 220px;
  height: 38px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: white;
  color: var(--text);
}

.button {
  height: 38px;
  padding: 0 16px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: white;
  color: var(--text);
  font-weight: 600;
  cursor: pointer;
}

.button.primary {
  border-color: var(--blue);
  background: var(--blue);
  color: white;
}

.metrics {
  display: grid;
  grid-template-columns: repeat(5, minmax(130px, 1fr)) minmax(320px, 2fr);
  gap: 1px;
  overflow: hidden;
  margin-bottom: 16px;
}

.metric {
  padding: 16px;
  background: white;
}

.metric span {
  display: block;
  color: var(--muted);
  font-size: .86rem;
  margin-bottom: 8px;
}

.metric strong {
  display: block;
  font-size: 1.45rem;
}

.metric small {
  display: block;
  margin-top: 8px;
  color: var(--muted);
  overflow-wrap: anywhere;
}

.metric.warn {
  background: var(--soft-amber);
}

.metric.danger {
  background: var(--soft-red);
}

.grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  margin: 16px 0;
}

.panel {
  overflow: hidden;
  margin-bottom: 16px;
}

.panel-head {
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
}

.bars {
  display: grid;
  gap: 8px;
  padding: 14px 16px 16px;
}

.bar-row {
  display: grid;
  grid-template-columns: 50px minmax(120px, 1fr) 120px 100px 70px;
  align-items: center;
  gap: 12px;
}

.bar-label,
.bar-value,
.bar-hits,
.bar-error {
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.bar-track {
  height: 14px;
  background: #edf1f5;
  border-radius: 999px;
  overflow: hidden;
}

.bar-fill {
  height: 100%;
  background: var(--green);
}

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

th,
td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

th {
  color: var(--muted);
  font-weight: 600;
  background: #fbfcfd;
}

.url {
  max-width: 620px;
  overflow-wrap: anywhere;
}

.notice,
.empty {
  padding: 12px 14px;
  margin-bottom: 16px;
}

.notice.error {
  color: #8f2018;
  background: var(--soft-red);
  border-color: #f1bbb5;
}

.login-shell {
  min-height: calc(100vh - 56px);
  display: grid;
  place-items: center;
  padding: 32px 0;
}

.login-panel {
  width: min(420px, 100%);
  display: grid;
  gap: 14px;
  padding: 24px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.login-panel h1 {
  font-size: 1.6rem;
}

.login-panel input,
.login-panel .button {
  width: 100%;
}

@media (max-width: 900px) {
  .page-head,
  .filters {
    align-items: stretch;
    flex-direction: column;
  }

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

  select {
    width: 100%;
    min-width: 0;
  }

  .bar-row {
    grid-template-columns: 44px minmax(80px, 1fr) 108px;
  }

  .bar-hits,
  .bar-error {
    display: none;
  }
}
