:root {
  --bg: #f3f5f7;
  --surface: #ffffff;
  --surface-muted: #f8fafb;
  --ink: #17212b;
  --muted: #667383;
  --line: #dfe5ea;
  --line-strong: #cbd4dc;
  --nav: #172535;
  --nav-soft: #223447;
  --accent: #b56a18;
  --accent-soft: #fff3e3;
  --green: #18715e;
  --green-soft: #e8f5f0;
  --blue: #2b64a4;
  --blue-soft: #eaf2fb;
  --red: #b73d3d;
  --red-soft: #fff0f0;
  --shadow: 0 1px 2px rgba(16, 31, 46, 0.05);
  --radius: 8px;
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
}

html,
body {
  overflow-x: hidden;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: "Microsoft YaHei", "PingFang SC", "Noto Sans CJK SC", sans-serif;
  font-size: 14px;
  line-height: 1.5;
}

button,
input,
select {
  font: inherit;
}

button {
  color: inherit;
}

.icon-sprite {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
}

.icon {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex: 0 0 auto;
}

.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 20;
  width: 224px;
  padding: 22px 16px 18px;
  background: var(--nav);
  color: #eaf0f5;
  display: flex;
  flex-direction: column;
}

.brand {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 0 6px 24px;
}

.brand-mark {
  width: 38px;
  height: 38px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 8px;
  display: grid;
  place-items: center;
  color: #f3c887;
  background: var(--nav-soft);
}

.brand-mark .icon {
  width: 21px;
  height: 21px;
}

.brand strong,
.brand small {
  display: block;
}

.brand strong {
  font-size: 16px;
  letter-spacing: 0;
}

.brand small {
  margin-top: 1px;
  color: #91a2b3;
  font-size: 11px;
}

.main-nav {
  display: grid;
  gap: 5px;
}

.nav-item {
  width: 100%;
  min-height: 42px;
  border: 0;
  border-radius: 7px;
  padding: 0 12px;
  background: transparent;
  color: #acbbca;
  display: flex;
  align-items: center;
  gap: 11px;
  cursor: pointer;
  text-align: left;
}

.nav-item:hover {
  background: rgba(255, 255, 255, 0.06);
  color: #ffffff;
}

.nav-item.active {
  background: var(--nav-soft);
  color: #ffffff;
  box-shadow: inset 3px 0 0 #f0b966;
}

.nav-count {
  margin-left: auto;
  min-width: 21px;
  height: 20px;
  padding: 0 6px;
  border-radius: 10px;
  display: inline-grid;
  place-items: center;
  background: var(--accent);
  color: #ffffff;
  font-size: 11px;
}

.sidebar-status {
  margin-top: auto;
  padding: 14px 10px 4px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  display: flex;
  align-items: flex-start;
  gap: 9px;
}

.sidebar-user {
  margin-top: 10px;
  padding: 10px 6px 0;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  color: #9babb9;
  font-size: 11px;
}

.sidebar-logout {
  min-height: 28px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 5px;
  padding: 0 7px;
  background: transparent;
  color: #aebdca;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  cursor: pointer;
}

.sidebar-logout:hover {
  background: rgba(255, 255, 255, 0.06);
  color: #ffffff;
}

.sidebar-logout .icon {
  width: 14px;
  height: 14px;
}

.sidebar-status strong,
.sidebar-status small {
  display: block;
}

.sidebar-status strong {
  font-size: 12px;
  color: #d8e1e9;
}

.sidebar-status small {
  margin-top: 2px;
  color: #8293a4;
  font-size: 11px;
}

.status-dot {
  width: 8px;
  height: 8px;
  margin-top: 6px;
  border-radius: 50%;
  background: #5d6b79;
  flex: 0 0 auto;
}

.status-dot.running {
  background: #e1a94d;
  box-shadow: 0 0 0 3px rgba(225, 169, 77, 0.16);
}

.status-dot.online {
  background: #4cb493;
  box-shadow: 0 0 0 3px rgba(76, 180, 147, 0.14);
}

.app-main {
  min-height: 100vh;
  min-width: 0;
  margin-left: 224px;
  padding: 0 28px 36px;
}

.topbar {
  min-height: 102px;
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  border-bottom: 1px solid var(--line);
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--muted);
  font-size: 12px;
}

.topbar h1 {
  margin: 0;
  font-size: 24px;
  line-height: 1.3;
  letter-spacing: 0;
}

.topbar-actions {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 9px;
}

.button {
  min-height: 38px;
  border: 1px solid transparent;
  border-radius: 7px;
  padding: 0 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  cursor: pointer;
  white-space: nowrap;
}

.button:disabled {
  opacity: 0.45;
  cursor: default;
}

.button-primary {
  background: var(--green);
  color: #ffffff;
}

.button-primary:hover:not(:disabled) {
  background: #125c4c;
}

.button-secondary {
  border-color: var(--line-strong);
  background: var(--surface);
  color: var(--ink);
}

.button-secondary:hover:not(:disabled),
.button-quiet:hover:not(:disabled) {
  border-color: #aebbc6;
  background: #f7f9fa;
}

.button-quiet {
  border-color: var(--line);
  background: transparent;
  color: var(--muted);
}

.button-small {
  min-height: 32px;
  padding: 0 10px;
  font-size: 12px;
}

.button-small .icon {
  width: 15px;
  height: 15px;
}

.icon-button {
  width: 30px;
  height: 30px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
  color: var(--muted);
  display: inline-grid;
  place-items: center;
  cursor: pointer;
}

.icon-button:hover {
  color: var(--ink);
  border-color: var(--line-strong);
}

.icon-button .icon {
  width: 15px;
  height: 15px;
}

.view {
  min-width: 0;
  display: none;
  padding-top: 24px;
}

.view.active {
  display: block;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 13px;
  margin-bottom: 18px;
}

.metric {
  min-height: 96px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 17px;
  background: var(--surface);
  box-shadow: var(--shadow);
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 12px;
}

.metric-icon {
  width: 38px;
  height: 38px;
  border-radius: 8px;
  display: grid;
  place-items: center;
}

.metric-icon.accent {
  background: var(--accent-soft);
  color: var(--accent);
}

.metric-icon.green {
  background: var(--green-soft);
  color: var(--green);
}

.metric-icon.blue {
  background: var(--blue-soft);
  color: var(--blue);
}

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

.metric span {
  display: block;
  color: var(--muted);
  font-size: 12px;
}

.metric strong {
  display: block;
  margin-top: 2px;
  font-size: 25px;
  line-height: 1.2;
  letter-spacing: 0;
}

.metric > small {
  grid-column: 2;
  margin-top: -6px;
  color: #8b96a2;
  font-size: 11px;
}

.dashboard-grid {
  min-width: 0;
  display: grid;
  grid-template-columns: minmax(0, 2.25fr) minmax(285px, 0.85fr);
  gap: 16px;
  align-items: start;
}

.dashboard-aside {
  display: grid;
  gap: 16px;
}

.panel {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.panel-header {
  min-height: 70px;
  padding: 16px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  border-bottom: 1px solid var(--line);
}

.panel-header.compact {
  min-height: 62px;
}

.panel-header h2 {
  margin: 0;
  font-size: 15px;
  line-height: 1.4;
  letter-spacing: 0;
}

.panel-header p {
  margin: 3px 0 0;
  color: var(--muted);
  font-size: 11px;
}

.table-wrap {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  overflow: auto;
}

.table-wrap.tall {
  min-height: 420px;
  max-height: calc(100vh - 270px);
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  table-layout: auto;
}

.data-table th {
  height: 38px;
  padding: 0 12px;
  border-bottom: 1px solid var(--line);
  background: var(--surface-muted);
  color: var(--muted);
  font-size: 11px;
  font-weight: 500;
  text-align: left;
  white-space: nowrap;
}

.data-table td {
  padding: 12px;
  border-bottom: 1px solid #edf0f3;
  vertical-align: middle;
}

.data-table tbody tr:last-child td {
  border-bottom: 0;
}

.data-table tbody tr:hover {
  background: #fbfcfd;
}

.status-col {
  width: 22px;
}

.action-col {
  width: 42px;
  text-align: right !important;
}

.unread-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent);
  display: inline-block;
}

.read-dot {
  width: 7px;
  height: 7px;
  display: inline-block;
}

.cell-title {
  max-width: 420px;
}

.cell-title a {
  color: var(--ink);
  font-weight: 500;
  text-decoration: none;
  display: -webkit-box;
  overflow: hidden;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.cell-title a:hover {
  color: var(--green);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.cell-title small,
.cell-meta {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 11px;
}

.cell-title small {
  display: -webkit-box;
  overflow: hidden;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.cell-meta {
  margin-top: 0;
  white-space: nowrap;
}

.compact-date {
  color: var(--muted);
  font-size: 11px;
  white-space: nowrap;
}

.badge {
  min-height: 22px;
  border-radius: 4px;
  padding: 2px 7px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  white-space: nowrap;
}

.badge-new {
  background: var(--accent-soft);
  color: #96540f;
}

.badge-content {
  background: var(--blue-soft);
  color: #245a94;
}

.badge-attachment {
  background: #eff0f8;
  color: #5b5c8b;
}

.badge-official {
  background: var(--green-soft);
  color: var(--green);
}

.badge-nonofficial {
  background: var(--accent-soft);
  color: var(--accent);
}

.badge-pending {
  background: var(--accent-soft);
  color: #96540f;
}

.badge-active {
  background: var(--green-soft);
  color: var(--green);
}

.badge-paused,
.badge-rejected {
  background: #edf0f3;
  color: #5f6b77;
}

.badge-failed {
  background: var(--red-soft);
  color: var(--red);
}

.badge-completed {
  background: var(--green-soft);
  color: var(--green);
}

.badge-running {
  background: var(--accent-soft);
  color: var(--accent);
}

.type-list {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  max-width: 230px;
}

.type-chip {
  padding: 2px 6px;
  border: 1px solid var(--line);
  border-radius: 4px;
  color: #52606d;
  background: #fafbfc;
  font-size: 10px;
  white-space: nowrap;
}

.source-link {
  color: var(--ink);
  text-decoration: none;
  font-weight: 500;
  display: inline-flex;
  align-items: flex-start;
  gap: 6px;
  max-width: 300px;
}

.source-link:hover {
  color: var(--green);
}

.source-link .icon {
  width: 13px;
  height: 13px;
  margin-top: 3px;
}

.source-url {
  display: block;
  max-width: 310px;
  margin-top: 4px;
  color: var(--muted);
  font-size: 10px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.rationale {
  max-width: 260px;
  color: var(--muted);
  font-size: 11px;
  display: -webkit-box;
  overflow: hidden;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.empty-row,
.empty-message {
  padding: 34px 18px !important;
  color: var(--muted);
  text-align: center;
}

.run-summary {
  padding: 16px 18px 18px;
  display: grid;
  gap: 13px;
}

.run-line {
  display: grid;
  grid-template-columns: 74px minmax(0, 1fr);
  align-items: start;
  gap: 10px;
}

.run-line > span {
  color: var(--muted);
  font-size: 11px;
}

.run-line strong {
  display: block;
  font-size: 12px;
  font-weight: 500;
}

.run-line small {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 10px;
}

.health-list {
  padding: 7px 18px 10px;
}

.health-item {
  padding: 10px 0;
  border-bottom: 1px solid #edf0f3;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.health-item:last-child {
  border-bottom: 0;
}

.health-item strong {
  display: block;
  font-size: 12px;
  font-weight: 500;
}

.health-item small {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 10px;
}

.health-state {
  flex: 0 0 auto;
  color: var(--green);
  font-size: 11px;
}

.health-state.bad {
  color: var(--red);
}

.skeleton-line {
  height: 15px;
  border-radius: 4px;
  background: #edf1f4;
}

.skeleton-line.short {
  width: 65%;
}

.filter-bar {
  padding: 13px 18px;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  gap: 9px;
  flex-wrap: wrap;
}

.search-field {
  min-width: 235px;
  min-height: 35px;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  padding: 0 10px;
  background: var(--surface);
  display: flex;
  align-items: center;
  gap: 7px;
}

.search-field .icon {
  width: 15px;
  height: 15px;
  color: var(--muted);
}

.search-field input {
  width: 100%;
  min-width: 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--ink);
}

.filter-bar select {
  min-height: 35px;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  padding: 0 28px 0 10px;
  background: var(--surface);
  color: var(--ink);
}

.check-field {
  min-height: 35px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
}

.check-field input {
  accent-color: var(--green);
}

.pagination {
  min-height: 52px;
  padding: 0 18px;
  border-top: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  color: var(--muted);
  font-size: 11px;
}

.source-filter-bar {
  justify-content: space-between;
}

.segmented {
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  padding: 2px;
  display: inline-flex;
  background: var(--surface-muted);
}

.segmented button {
  min-height: 29px;
  border: 0;
  border-radius: 4px;
  padding: 0 11px;
  background: transparent;
  color: var(--muted);
  font-size: 11px;
  cursor: pointer;
}

.segmented button.active {
  background: var(--surface);
  color: var(--ink);
  box-shadow: 0 1px 2px rgba(18, 35, 50, 0.12);
}

.segmented span {
  margin-left: 3px;
  color: var(--accent);
}

.action-group {
  display: flex;
  justify-content: flex-end;
  gap: 5px;
}

.toast {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 50;
  max-width: min(420px, calc(100vw - 48px));
  border: 1px solid #bfcbd5;
  border-radius: 7px;
  padding: 11px 14px;
  background: #1d2b39;
  color: #ffffff;
  box-shadow: 0 10px 30px rgba(17, 32, 47, 0.25);
  opacity: 0;
  transform: translateY(10px);
  pointer-events: none;
  transition: opacity 160ms ease, transform 160ms ease;
}

.toast.visible {
  opacity: 1;
  transform: translateY(0);
}

.query-summary-bar {
  min-height: 62px;
  padding: 12px 18px;
  border-bottom: 1px solid var(--line);
  background: #fbfcfd;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}

.query-summary-bar strong,
.query-summary-bar span {
  display: block;
}

.query-summary-bar strong {
  font-size: 13px;
  font-weight: 500;
}

.query-summary-bar > div > span {
  margin-top: 3px;
  color: var(--muted);
  font-size: 10px;
}

.query-coverage {
  display: flex;
  gap: 6px;
  flex: 0 0 auto;
}

.query-coverage span {
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 3px 7px;
  background: var(--surface);
  color: #52606d;
  font-size: 10px;
}

.query-table .cell-title {
  max-width: 280px;
}

.query-name {
  color: var(--ink);
  font-weight: 500;
  text-decoration: none;
}

.query-name:hover {
  color: var(--green);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.query-description {
  max-width: 330px;
  color: #52606d;
  font-size: 11px;
  line-height: 1.55;
}

.method-badge {
  background: var(--blue-soft);
  color: var(--blue);
}

.query-category {
  max-width: 190px;
  font-weight: 500;
  line-height: 1.55;
}

.query-direct {
  margin-top: 6px;
  display: block;
  color: var(--muted);
  font-size: 10px;
}

.query-entry-list {
  min-width: 280px;
  display: grid;
  gap: 8px;
}

.query-entry {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr) 24px;
  align-items: start;
  gap: 7px;
}

.query-level {
  min-height: 20px;
  border-radius: 4px;
  display: inline-grid;
  place-items: center;
  font-size: 10px;
}

.query-level.city {
  background: var(--green-soft);
  color: var(--green);
}

.query-level.district {
  background: var(--accent-soft);
  color: var(--accent);
}

.query-entry-main {
  min-width: 0;
}

.query-entry-main .query-name {
  display: block;
  font-size: 11px;
  line-height: 1.45;
}

.query-entry-main small {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-size: 10px;
}

.query-open {
  width: 24px;
  height: 24px;
  border: 1px solid var(--line);
  border-radius: 5px;
  color: var(--muted);
  display: grid;
  place-items: center;
}

.query-open:hover {
  color: var(--green);
  border-color: var(--line-strong);
}

.query-open .icon {
  width: 13px;
  height: 13px;
}

.filter-count {
  margin-left: auto;
  color: var(--muted);
  font-size: 11px;
}

.keyword-editor {
  padding: 18px;
  border-bottom: 1px solid var(--line);
  background: var(--surface-muted);
}

.keyword-editor[hidden] {
  display: none;
}

.keyword-editor-header {
  margin-bottom: 15px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.keyword-editor-header h3 {
  margin: 0;
  font-size: 14px;
  letter-spacing: 0;
}

.keyword-editor-header p {
  margin: 3px 0 0;
  color: var(--muted);
  font-size: 10px;
}

.keyword-form-grid {
  display: grid;
  grid-template-columns: minmax(260px, 2fr) minmax(110px, 0.5fr) auto;
  gap: 10px;
  align-items: end;
}

.form-field {
  display: grid;
  gap: 5px;
  color: var(--muted);
  font-size: 11px;
}

.form-field input,
.form-field textarea {
  width: 100%;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  padding: 7px 9px;
  background: var(--surface);
  color: var(--ink);
  outline: none;
}

.form-field input {
  min-height: 35px;
}

.form-field textarea {
  resize: vertical;
}

.form-field input:focus,
.form-field textarea:focus {
  border-color: #8ca3b7;
  box-shadow: 0 0 0 2px rgba(43, 100, 164, 0.08);
}

.editor-check {
  min-height: 35px;
  padding-bottom: 7px;
}

.keyword-category-fieldset {
  margin: 14px 0;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 10px 12px 12px;
  background: var(--surface);
}

.keyword-category-fieldset legend {
  padding: 0 5px;
  color: var(--muted);
  font-size: 11px;
}

.keyword-category-options {
  display: flex;
  flex-wrap: wrap;
  gap: 7px 14px;
}

.keyword-category-options label {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: #4f5e6b;
  font-size: 11px;
}

.keyword-category-options input {
  accent-color: var(--green);
}

.keyword-form-actions {
  margin-top: 13px;
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.keyword-text {
  min-width: 150px;
  color: var(--ink);
  font-weight: 500;
}

.keyword-table .type-list {
  max-width: 390px;
}

.keyword-status {
  min-height: 22px;
  display: inline-flex;
  align-items: center;
}

.keyword-status.enabled {
  color: var(--green);
}

.keyword-status.disabled {
  color: var(--muted);
}

.login-page {
  min-height: 100vh;
  background: #edf1f4;
}

.login-shell {
  min-height: 100vh;
  padding: 28px;
  display: grid;
  place-items: center;
}

.login-panel {
  width: min(410px, 100%);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 30px;
  background: var(--surface);
  box-shadow: 0 16px 44px rgba(22, 37, 52, 0.12);
}

.login-brand {
  display: flex;
  align-items: center;
  gap: 11px;
}

.login-mark {
  color: #f3c887;
  background: var(--nav);
}

.login-brand strong,
.login-brand small {
  display: block;
}

.login-brand strong {
  font-size: 17px;
  letter-spacing: 0;
}

.login-brand small {
  margin-top: 2px;
  color: var(--muted);
  font-size: 11px;
}

.login-heading {
  margin: 28px 0 22px;
}

.login-heading h1 {
  margin: 0;
  font-size: 23px;
  letter-spacing: 0;
}

.login-heading p {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.login-form {
  display: grid;
  gap: 15px;
}

.login-form .form-field span {
  color: #4b5966;
  font-size: 12px;
}

.login-form .form-field input {
  min-height: 42px;
  font-size: 14px;
}

.login-error {
  min-height: 18px;
  margin: -4px 0 0;
  color: var(--red);
  font-size: 11px;
}

.login-submit {
  width: 100%;
  min-height: 42px;
}

.login-footnote {
  margin: 24px 0 0;
  padding-top: 16px;
  border-top: 1px solid var(--line);
  color: #8a96a2;
  font-size: 10px;
  text-align: center;
}

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

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

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

@media (max-width: 820px) {
  .sidebar {
    position: static;
    width: auto;
    padding: 12px 16px;
  }

  .brand {
    padding: 0 0 12px;
  }

  .main-nav {
    grid-template-columns: repeat(6, minmax(0, 1fr));
  }

  .nav-item {
    min-height: 38px;
    justify-content: center;
    padding: 0 8px;
  }

  .nav-item.active {
    box-shadow: inset 0 -3px 0 #f0b966;
  }

  .nav-count {
    display: none;
  }

  .sidebar-status {
    display: none;
  }

  .sidebar-user {
    margin-top: 8px;
    padding: 9px 0 0;
  }

  .app-main {
    margin-left: 0;
    padding: 0 16px 28px;
  }

  .topbar {
    min-height: 94px;
  }

  .dashboard-aside {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  .brand small,
  .nav-item span:not(.nav-count),
  .topbar-actions .button span {
    display: none;
  }

  .brand {
    justify-content: center;
  }

  .nav-item {
    min-height: 40px;
  }

  .topbar {
    min-height: 86px;
  }

  .topbar h1 {
    font-size: 21px;
  }

  .button {
    min-width: 38px;
    padding: 0 10px;
  }

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

  .metric {
    min-height: 82px;
  }

  .filter-bar {
    align-items: stretch;
  }

  .search-field,
  .filter-bar select {
    width: 100%;
  }

  .source-filter-bar {
    display: grid;
  }

  .query-summary-bar {
    align-items: flex-start;
  }

  .query-filter-bar {
    align-items: stretch;
  }

  .keyword-form-grid {
    grid-template-columns: 1fr;
  }

  .keyword-category-options {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .login-shell {
    padding: 18px;
  }

  .login-panel {
    padding: 24px 20px;
  }

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

  .segmented button {
    flex: 1 0 auto;
  }

  .table-wrap.tall {
    max-height: none;
  }
}
