:root {
  --bg: #f5f5f5;
  --panel: #ffffff;
  --line: #e7e7e7;
  --line-strong: #d8d8d8;
  --text: #222222;
  --muted: #777777;
  --blue: #2f80ed;
  --green: #2dbf73;
  --orange: #ff9800;
  --purple: #9c27b0;
  --red: #ff4d4f;
  --shadow: 0 4px 18px rgba(0, 0, 0, 0.08);
  --radius-xs: 8px;
  --radius-sm: 10px;
  --radius-md: 12px;
  --radius-lg: 14px;
  --radius-xl: 16px;
  --button-radius: 14px;
  --button-min-height: 40px;
  --shell-width: 1120px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  height: 100vh;
  min-height: 100vh;
  color: var(--text);
  font-family: "Segoe UI", "PingFang SC", sans-serif;
  background: var(--bg);
  opacity: 1;
  overflow: hidden;
}

body.page-enter:not(.page-ready) {
  opacity: 0;
}

body.page-leaving {
  opacity: 0;
}

.console-shell {
  transform: translateY(0);
  opacity: 1;
  transition: transform 0.24s ease, opacity 0.24s ease;
}

body.page-enter:not(.page-ready) .console-shell {
  transform: translateY(10px);
  opacity: 0;
}

body.page-ready .console-shell {
  transform: translateY(0);
  opacity: 1;
}

body.page-ready {
  opacity: 1;
  transition: opacity 0.22s ease;
}

a {
  color: inherit;
  text-decoration: none;
}

button,
input,
textarea,
select {
  font: inherit;
}

input,
textarea,
select {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid #dcdcdc;
  border-radius: var(--radius-sm);
  background: #ffffff;
  color: var(--text);
}

textarea {
  resize: vertical;
}

label span {
  display: block;
  margin-bottom: 6px;
  font-size: 12px;
  color: #444444;
  font-weight: 600;
}

button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: 1px solid transparent;
  border-radius: var(--button-radius);
  min-height: var(--button-min-height);
  padding: 8px 16px;
  cursor: pointer;
  font-size: 12px;
  font-weight: 900;
  line-height: 1.2;
  text-align: center;
  vertical-align: middle;
  white-space: nowrap;
  position: relative;
  overflow: hidden;
  will-change: transform, box-shadow;
  transform: translateY(0) scale(1);
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.06);
  transition:
    transform 0.24s cubic-bezier(0.22, 1, 0.36, 1),
    box-shadow 0.24s cubic-bezier(0.22, 1, 0.36, 1),
    opacity 0.16s ease,
    filter 0.24s ease;
}

button > img,
button > svg,
button .icon,
.button-like > img,
.button-like > svg,
.button-like .icon {
  display: block;
  flex: 0 0 auto;
  width: 1.1em;
  height: 1.1em;
  object-fit: contain;
}

button:hover {
  transform: translateY(-2px) scale(1.01);
  box-shadow: 0 10px 18px rgba(0, 0, 0, 0.12);
}

button:active {
  transform: translateY(1px) scale(0.95);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
  filter: saturate(0.96);
}

button:disabled {
  cursor: wait;
  opacity: 0.72;
  transform: none;
  box-shadow: none;
  filter: grayscale(0.08);
}

button:focus-visible,
.page-tabs a:focus-visible,
.page-tabs [data-app-tab]:focus-visible {
  outline: 2px solid rgba(47, 128, 237, 0.28);
  outline-offset: 2px;
}

.btn-blue,
.primary,
.page-tabs a.active,
.page-tabs [data-app-tab].active {
  background: var(--blue);
  border-color: #256dcc;
  color: #ffffff;
}

.btn-green {
  background: #4caf50;
  border-color: #3f9f43;
  color: #ffffff;
}

.btn-orange {
  background: var(--orange);
  border-color: #dc8500;
  color: #ffffff;
}

.btn-purple {
  background: var(--purple);
  border-color: #81208f;
  color: #ffffff;
}

.btn-danger {
  background: var(--red);
  border-color: #df383a;
  color: #ffffff;
}

.ghost {
  background: #ffffff;
  border-color: #d9e0ea;
  color: #475569;
}

.filter-chip {
  background: #ffffff;
  border: 1px solid #d7d7d7;
  color: #555555;
  border-radius: var(--button-radius);
}

.filter-chip.active {
  background: var(--blue);
  border-color: var(--blue);
  color: #ffffff;
}

[data-preset-edit] {
  background: var(--orange);
  border-color: #dc8500;
  color: #ffffff;
}

[data-preset-delete] {
  background: var(--red);
  border-color: #df383a;
  color: #ffffff;
}

.seek-login {
  display: grid;
  place-items: center;
  padding: 24px;
  background: linear-gradient(180deg, #d5ebff 0%, #c4e0f8 100%);
}

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

.seek-login-card {
  background: rgba(255, 255, 255, 0.96);
  border-radius: var(--radius-xl);
  box-shadow: 0 10px 30px rgba(43, 104, 168, 0.16);
  padding: 28px 32px;
}

.login-title-wrap {
  text-align: center;
  margin-bottom: 22px;
}

.login-title-wrap h1 {
  margin: 0;
  color: #1976d2;
  font-size: 20px;
}

.subtitle,
.helper,
.user-hint,
.status-text,
.status-box small,
.metric-card span,
.entry-meta,
.text-link {
  color: var(--muted);
}

.wide-btn {
  width: 100%;
  padding: 12px 16px;
  font-size: 14px;
}

.stack-form {
  display: grid;
  gap: 16px;
}

.console-shell {
  width: 100%;
  height: 100vh;
  min-height: 100vh;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: 184px minmax(0, 1fr);
  grid-template-rows: auto minmax(0, 1fr);
  align-items: stretch;
  gap: 12px;
  overflow: hidden;
}

.topbar-card,
.status-box,
.metric-card,
.monitor-card,
.entry-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow);
}

.topbar-card {
  grid-column: 1 / -1;
  position: sticky;
  top: 0;
  z-index: 20;
  margin-top: 0;
  padding: 12px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  border-radius: var(--radius-lg);
  box-shadow: 0 10px 24px rgba(28, 39, 60, 0.08);
}

.topbar-copy {
  flex: 1 1 320px;
  min-width: 0;
}

.brand-title {
  margin: 0;
  font-size: 18px;
  font-weight: 800;
  color: #24324a;
}

.emoji-inline {
  margin-right: 10px;
  font-size: 1.15em;
}

.brand-subtitle {
  margin: 4px 0 0;
  font-size: 12px;
  color: #7a8392;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.topbar-actions .user-hint {
  font-size: 12px;
  color: #636f83;
}

.stats-grid {
  grid-column: 2;
  margin-top: 14px;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 18px;
}

.status-box {
  min-height: 150px;
  padding: 22px 22px 18px;
  border-left: 4px solid #e5e5e5;
  border-radius: var(--radius-lg);
  box-shadow: 0 10px 24px rgba(28, 39, 60, 0.08);
}

.status-green {
  border-left-color: #18c38c;
}

.status-cyan {
  border-left-color: #18c38c;
}

.status-label {
  display: block;
  font-size: 14px;
  margin-bottom: 18px;
  color: #46566f;
  font-weight: 700;
}

.status-box strong {
  display: block;
  margin-top: 0;
  font-size: 22px;
  color: #12c287;
  line-height: 1.35;
  font-weight: 800;
}

.status-box-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.status-icon {
  font-size: 34px;
  line-height: 1;
  filter: grayscale(0.1);
}

.status-box .status-text {
  display: none;
}

.status-box small {
  display: block;
  margin-top: 8px;
  font-size: 14px;
  color: #7c8698;
}

.page-tabs {
  grid-column: 1;
  grid-row: 2;
  position: fixed;
  top: 0;
  left: 0;
  z-index: 6;
  margin-top: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
  border: 0 !important;
  border-radius: 0 !important;
  padding: 0 8px 0 0;
  width: 184px;
  max-height: 100vh;
  overflow-y: auto;
  align-self: start;
  background: transparent !important;
  box-shadow: none !important;
  outline: 0 !important;
}

.app-tabs {
  backdrop-filter: none;
}

.page-tabs a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: var(--button-min-height);
  padding: 10px 16px;
  background: #fafafa;
  border: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  border-radius: var(--button-radius);
  color: #555555;
  font-size: 12px;
  font-weight: 800;
  line-height: 1.2;
  text-align: center;
  white-space: nowrap;
  flex: 1 1 0;
  width: 100%;
  min-width: 0;
  transition:
    transform 0.24s cubic-bezier(0.22, 1, 0.36, 1),
    box-shadow 0.24s cubic-bezier(0.22, 1, 0.36, 1),
    background-color 0.24s ease,
    color 0.24s ease;
}

.page-tabs [data-app-tab] {
  display: inline-flex;
  align-items: center;
  justify-content: flex-start;
  gap: 6px;
  min-height: 64px;
  height: 64px;
  max-height: 64px;
  padding: 0 18px;
  background: #ffffff;
  border: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  border-radius: 8px;
  color: #000000;
  font-size: 16px;
  font-weight: 800;
  line-height: 1;
  text-align: center;
  white-space: nowrap;
  flex: 1 1 0;
  width: 100%;
  min-width: 0;
  cursor: pointer;
  transition:
    transform 0.24s cubic-bezier(0.22, 1, 0.36, 1),
    box-shadow 0.24s cubic-bezier(0.22, 1, 0.36, 1),
    background-color 0.24s ease,
    color 0.24s ease;
}

.page-tabs [data-app-tab].active {
  background: #ffffff;
  border-color: #d8d8d8;
  color: #000000;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.08);
}

.app-tabs [data-app-tab] {
  min-height: 64px !important;
  height: 64px;
  padding-top: 0;
  padding-bottom: 0;
  box-shadow: none;
}

.page-tabs [data-app-tab]::before {
  content: none;
}

.page-tabs a,
.page-tabs [data-app-tab] {
  justify-content: flex-start;
  text-align: left;
  line-height: 1.15;
}

.page-tabs a:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 14px rgba(0, 0, 0, 0.08);
}

.page-tabs [data-app-tab]:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.06);
}

.page-tabs a:active {
  transform: translateY(1px) scale(0.97);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
}

.page-tabs [data-app-tab]:active {
  transform: translateY(1px) scale(0.97);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
}

.page-tabs a + a {
  border-left: 1px solid var(--line);
}

.page-tabs [data-app-tab] + [data-app-tab] {
  border-left: 1px solid var(--line);
}

.section-panel {
  grid-column: 2;
  grid-row: 2;
  height: 100%;
  align-self: stretch;
  min-height: 0;
  margin-top: 0;
  padding: 4px 12px 24px 0;
  background: transparent;
  border: 0;
  box-shadow: none;
  border-radius: 0;
  overflow-y: auto;
}

.overview-stats-grid {
  grid-column: auto;
  margin: 0 0 12px;
  gap: 12px;
}

.overview-workbench {
  --overview-top-card-height: 330px;
  display: grid;
  grid-template-columns: minmax(190px, 0.58fr) minmax(390px, 1.05fr) minmax(520px, 1.85fr);
  grid-auto-rows: var(--overview-top-card-height);
  gap: 12px;
  align-items: stretch;
  margin: 0 0 12px;
}

.overview-primary-card {
  display: flex;
  flex-direction: column;
  min-height: var(--overview-top-card-height);
  height: var(--overview-top-card-height);
  max-height: var(--overview-top-card-height);
}

.overview-primary-card > strong {
  font-size: 36px;
}

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

.overview-primary-counts div {
  padding: 13px 15px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: #fafafa;
}

.overview-primary-counts span {
  display: block;
  color: #7c8698;
  font-size: 13px;
  font-weight: 800;
  line-height: 1.35;
}

.overview-primary-counts strong {
  display: block;
  margin-top: 6px;
  color: #12c287;
  font-size: 26px;
  font-weight: 900;
  line-height: 1.2;
}

.overview-primary-meta {
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.overview-primary-meta span {
  display: block;
  color: #7c8698;
  font-size: 14px;
  font-weight: 800;
  line-height: 1.35;
}

.overview-primary-meta strong {
  display: block;
  margin-top: 6px;
  color: #46566f;
  font-size: 15px;
  font-weight: 800;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.overview-side-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  grid-template-rows: repeat(2, minmax(0, 1fr));
  align-items: stretch;
  gap: 10px;
  min-height: var(--overview-top-card-height);
  height: var(--overview-top-card-height);
  max-height: var(--overview-top-card-height);
}

.overview-stats-grid .status-box,
.overview-workbench .status-box,
.overview-metric-grid .metric-card {
  min-height: 0;
  height: 100%;
  overflow: hidden;
  padding: 13px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow);
}

.overview-stats-grid .status-box,
.overview-workbench .status-box {
  border-left: 1px solid var(--line);
}

.overview-stats-grid .status-box {
  min-height: 124px;
}

.overview-side-grid .status-box {
  min-height: 0;
}

.overview-stats-grid .status-label,
.overview-workbench .status-label,
.overview-metric-grid .metric-card span {
  margin: 0;
  color: #46566f;
  font-size: 14px;
  font-weight: 800;
  line-height: 1.35;
}

.overview-stats-grid .status-box strong,
.overview-workbench .status-box strong,
.overview-metric-grid .metric-card strong {
  margin-top: 10px;
  color: #12c287;
  font-size: 22px;
  font-weight: 800;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.overview-stats-grid .status-box small,
.overview-workbench .status-box small {
  margin-top: 8px;
  color: #7c8698;
  font-size: 13px;
  line-height: 1.35;
}

.overview-metric-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.overview-metric-grid .metric-card {
  min-height: 92px;
}

.overview-metric-grid .metric-card strong {
  font-size: 19px;
  overflow-wrap: anywhere;
}

.overview-trend-block {
  background: #ffffff;
}

.overview-trend-card {
  display: flex;
  flex-direction: column;
  min-height: var(--overview-top-card-height);
  height: var(--overview-top-card-height);
  max-height: var(--overview-top-card-height);
  overflow: hidden;
  margin: 0;
  padding-top: 8px;
  background: #ffffff;
  box-shadow: var(--shadow);
}

.forum-trend-panel {
  display: grid;
  grid-template-columns: minmax(120px, 0.35fr) minmax(0, 1fr) minmax(0, 0.85fr);
  gap: 12px;
  align-items: stretch;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

.forum-trend-panel-dense {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.trend-brief {
  display: grid;
  grid-template-rows: minmax(0, 1fr);
  gap: 10px;
  min-height: 0;
  overflow: hidden;
}

.trend-summary,
.trend-group,
.trend-samples {
  min-height: 104px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: #fafafa;
}

.trend-summary {
  display: grid;
  align-content: center;
  gap: 4px;
}

.trend-summary-compact,
.trend-group-compact {
  min-height: auto;
}

.trend-summary strong {
  color: #12c287;
  font-size: 24px;
  line-height: 1;
}

.trend-summary span,
.trend-label {
  color: #46566f;
  font-size: 13px;
  font-weight: 900;
}

.trend-group {
  display: grid;
  align-content: start;
  gap: 10px;
  min-height: 0;
}

.trend-chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.trend-category-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.trend-category-tab {
  min-height: 34px;
  padding: 6px 11px;
  border: 1px solid rgba(45, 191, 115, 0.24);
  border-radius: 999px;
  background: #ffffff;
  color: #137a4b;
  box-shadow: none;
  font-size: 12px;
  font-weight: 900;
}

.trend-category-tab:hover,
.trend-category-tab:active {
  transform: none;
  box-shadow: none;
}

.trend-category-tab.active {
  background: #2dbf73;
  border-color: #2dbf73;
  color: #ffffff;
}

.trend-category-tab small {
  color: inherit;
  opacity: 0.78;
  font-weight: 900;
}

.trend-category-current {
  min-height: 0;
  overflow: hidden;
  padding: 12px;
  border: 1px solid rgba(45, 191, 115, 0.2);
  border-radius: var(--radius-xs);
  background: #ffffff;
}

.trend-category-current div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.trend-category-current strong {
  color: #137a4b;
  font-size: 14px;
  font-weight: 900;
}

.trend-category-current span {
  color: #7c8698;
  font-size: 12px;
  font-weight: 900;
  white-space: nowrap;
}

.trend-category-current ol {
  display: grid;
  gap: 7px;
  max-height: 148px;
  overflow-y: auto;
  margin: 8px 0 0;
  padding-left: 20px;
  color: #46566f;
  font-size: 14px;
  font-weight: 700;
  line-height: 1.35;
}

.trend-category-current li strong {
  display: block;
  color: #10213d;
  font-size: 13px;
  line-height: 1.35;
}

.trend-category-current li span {
  display: block;
  margin-top: 3px;
  color: #46566f;
  font-size: 12px;
  font-weight: 700;
  line-height: 1.35;
  white-space: normal;
}

.trend-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 30px;
  padding: 5px 10px;
  border: 1px solid rgba(47, 128, 237, 0.22);
  border-radius: 999px;
  background: #eef5ff;
  color: #174ea6;
  font-size: 12px;
  font-weight: 900;
}

.trend-chip-soft {
  border-color: rgba(45, 191, 115, 0.24);
  background: #eefbf4;
  color: #137a4b;
}

.trend-chip small {
  color: inherit;
  opacity: 0.72;
  font-weight: 900;
}

.trend-muted {
  color: #7c8698;
  font-size: 13px;
}

.trend-samples {
  margin: 0;
  padding-left: 28px;
  color: #46566f;
}

.trend-samples li + li {
  margin-top: 8px;
}

.trend-samples span {
  display: block;
  font-size: 13px;
  font-weight: 800;
  line-height: 1.35;
}

.trend-samples small {
  display: block;
  margin-top: 3px;
  color: #7c8698;
  font-size: 12px;
}

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

.trend-main-digest {
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
  padding: 14px 16px;
  border: 1px solid rgba(18, 194, 135, 0.28);
  border-radius: var(--radius-sm);
  background: linear-gradient(135deg, #f2fff8 0%, #ffffff 72%);
}

.trend-digest-title {
  margin-bottom: 10px;
  color: #137a4b;
  font-size: 15px;
  font-weight: 900;
}

.trend-digest-list {
  display: grid;
  flex: 1;
  gap: 10px;
  min-height: 0;
  overflow-y: auto;
  margin: 0;
  padding-left: 20px;
  color: #10213d;
}

.trend-digest-list li {
  padding-left: 2px;
}

.trend-digest-list strong {
  display: block;
  color: #10213d;
  font-size: 15px;
  font-weight: 900;
  line-height: 1.35;
}

.trend-digest-list span {
  display: block;
  margin-top: 3px;
  color: #46566f;
  font-size: 14px;
  font-weight: 700;
  line-height: 1.4;
}

.trend-discussion {
  min-height: 98px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: linear-gradient(135deg, #ffffff 0%, #f7fbff 100%);
}

.trend-discussion-main {
  border-color: rgba(18, 194, 135, 0.28);
  background: linear-gradient(135deg, #f2fff8 0%, #ffffff 72%);
}

.trend-discussion-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
}

.trend-discussion-head strong {
  color: #10213d;
  font-size: 13px;
  font-weight: 900;
  line-height: 1.35;
}

.trend-discussion-head span,
.trend-discussion-meta {
  color: #7c8698;
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

.trend-discussion-meta {
  margin-top: 5px;
}

.trend-keywords {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 7px;
}

.trend-keywords span {
  padding: 3px 7px;
  border-radius: 999px;
  background: #eef5ff;
  color: #174ea6;
  font-size: 11px;
  font-weight: 900;
}

.trend-discussion-samples {
  margin: 7px 0 0;
  padding-left: 16px;
  color: #46566f;
  font-size: 12px;
  font-weight: 700;
  line-height: 1.35;
}

.trend-discussion-samples li + li {
  margin-top: 4px;
}

.app-section.hidden {
  display: none;
}

.text-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: auto;
  border: none;
  background: transparent;
  box-shadow: none;
  padding: 0;
  color: var(--muted);
  font-weight: 600;
  line-height: 1.2;
}

.text-button:hover,
.text-button:active {
  transform: none;
  box-shadow: none;
  background: transparent;
}

.section-head,
.block-head,
.toolbar,
.inline-actions,
.button-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

.section-head {
  margin-bottom: 14px;
}

.log-section-head {
  align-items: center;
}

.log-toolbar {
  align-items: flex-end;
  justify-content: flex-end;
}

.section-head h2,
.block-head h3 {
  margin: 0;
  font-size: 14px;
}

.metric-grid,
.card-list,
.entry-list {
  display: grid;
  gap: 10px;
}

.metric-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin-bottom: 14px;
}

#monitorList.card-list {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

#notificationRuleList.entry-list {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.metric-card {
  padding: 14px;
  min-height: 108px;
}

.metric-card strong {
  display: block;
  margin-top: 8px;
  font-size: 18px;
  color: #5265ff;
  line-height: 1.35;
}

.content-block,
.subtle-block {
  margin-bottom: 14px;
  padding: 12px;
  border: 1px solid #eeeeee;
  border-radius: var(--radius-md);
  background: #fafafa;
}

.block-blue {
  border-left: 3px solid var(--blue);
}

.block-yellow {
  border-left: 3px solid var(--orange);
}

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

.notify-card {
  border: 1px solid #e6e6e6;
  background: #ffffff;
  border-radius: var(--radius-md);
  padding: 12px;
  display: grid;
  gap: 10px;
}

.notify-card-wide {
  grid-column: 1 / -1;
}

#telegramSettingsForm .notify-card {
  gap: 18px;
}

.telegram-token-grid {
  grid-template-columns: minmax(320px, 0.5fr);
}

.telegram-control-grid {
  grid-template-columns: minmax(260px, 0.5fr) minmax(320px, 1fr);
  align-items: end;
}

.telegram-control-grid .checkbox-inline {
  min-height: 48px;
  align-self: end;
}

.telegram-settings-actions {
  justify-content: flex-end;
  align-items: center;
}

.telegram-settings-actions button {
  min-width: 156px;
}

.notify-status {
  margin: 0;
  padding: 8px 10px;
  border-radius: var(--radius-md);
  border: 1px solid #e2e8f0;
  background: #f8fafc;
  color: #64748b;
  font-size: 12px;
  font-weight: 700;
  line-height: 1.5;
}

.notify-status-on {
  border-color: #bbf7d0;
  background: #f0fdf4;
  color: #166534;
}

.notify-status-off {
  border-color: #e2e8f0;
  background: #f8fafc;
  color: #64748b;
}

.notify-status-warn {
  border-color: #fed7aa;
  background: #fff7ed;
  color: #9a3412;
}

.notify-rule-box {
  display: grid;
  gap: 6px;
  padding: 12px;
  border: 1px solid #fde68a;
  border-radius: var(--radius-md);
  background: #fffbeb;
  color: #713f12;
  font-size: 12px;
  line-height: 1.5;
}

.notify-rule-box strong {
  font-size: 13px;
  color: #78350f;
}

.block-purple {
  border-left: 3px solid var(--purple);
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

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

.form-grid .span-2 {
  grid-column: span 2;
}

.checkbox-inline {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: #444444;
  flex-wrap: nowrap;
  line-height: 20px;
}

.checkbox-inline input {
  width: 16px;
  height: 16px;
  flex: 0 0 16px;
  margin: 0;
  align-self: center;
  accent-color: var(--blue);
}

.checkbox-inline span {
  display: inline-flex;
  align-items: center;
  min-height: 20px;
  margin-bottom: 0;
  color: inherit;
  font-size: inherit;
  font-weight: inherit;
  line-height: 20px;
}

.checkbox-inline-block {
  width: fit-content;
  max-width: 100%;
}

.monitor-card,
.entry-card {
  padding: 12px;
  overflow-wrap: anywhere;
}

.entry-title-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: nowrap;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 28px;
  padding: 0 10px;
  border-radius: 999px;
  border: 1px solid #d9e5f5;
  background: #f8fbff;
  color: #37517b;
  font-size: 11px;
  font-weight: 800;
  line-height: 1;
  white-space: nowrap;
  flex: 0 0 auto;
}

.status-pill.status-ok {
  border-color: #bbf7d0;
  background: #f0fdf4;
  color: #166534;
}

.status-pill.status-muted {
  border-color: #e2e8f0;
  background: #f8fafc;
  color: #64748b;
}

.global-stats-grid {
  margin-top: 14px;
}

.monitor-card-head,
.entry-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
}

.monitor-card h3,
.entry-card h3 {
  margin: 0 0 8px;
  font-size: 13px;
}

.entry-card {
  border-radius: var(--radius-lg);
  padding: 12px;
  border-left-width: 4px;
  box-shadow: 0 10px 24px rgba(34, 48, 74, 0.08);
}

.entry-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.entry-main {
  min-width: 0;
  flex: 1 1 auto;
}

.entry-side {
  display: grid;
  justify-items: end;
  align-content: start;
  gap: 8px;
  flex: 0 0 auto;
  min-width: 420px;
}

.entry-head-top {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  flex-wrap: wrap;
}

.entry-title-wrap {
  min-width: 0;
  flex: 1 1 auto;
}

.entry-title {
  margin: 0;
  font-size: 15px;
  line-height: 1.35;
  font-weight: 800;
  color: #1b2b47;
}

.entry-meta-line {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 12px;
  margin-top: 8px;
  font-size: 12px;
  color: #6e7c92;
}

.entry-card .entry-meta-line {
  font-size: 12px;
  font-weight: 700;
}

.entry-chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

.entry-chip-row-side {
  margin-top: 0;
  justify-content: flex-end;
  max-width: none;
  flex-wrap: nowrap;
  align-items: center;
}

.entry-chip-row-side .entry-chip,
.entry-chip-row-side .badge,
.entry-chip-row-side .premium-badge {
  white-space: nowrap;
  flex: 0 0 auto;
}

.entry-chip {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 0 10px;
  border-radius: 999px;
  border: 1px solid #d9e5f5;
  background: #f7faff;
  color: #3c5375;
  font-size: 11px;
  font-weight: 700;
  line-height: 1.2;
  vertical-align: middle;
}

.entry-chip-category {
  background: #eef8ff;
  border-color: #cfe4f8;
  color: #25537b;
}

.entry-chip-keyword {
  background: #f2fbf5;
  border-color: #cfead8;
  color: #256144;
}

.entry-meta-line .entry-chip,
.entry-meta-line .badge,
.entry-meta-line .premium-badge {
  margin-top: -2px;
}

.entry-meta-line .badge,
.entry-meta-line .premium-badge {
  min-height: 26px;
}

.monitor-entry-head {
  align-items: center;
}

.monitor-entry-meta {
  margin-top: 0;
  flex: 1 1 auto;
}

.entry-summary-bubble {
  margin-top: 8px;
  padding: 10px 12px;
  border-radius: var(--radius-md);
  background: #edf3fc;
  border: 1px solid #dde8f8;
  display: grid;
  gap: 6px;
}

.entry-summary {
  margin: 0;
  font-size: 13px;
  line-height: 1.65;
  color: #5d6f89;
  min-width: 0;
  overflow-wrap: anywhere;
}

.entry-card .entry-summary {
  font-size: 13px;
  font-weight: 600;
}

.entry-ai-note {
  margin: 0;
  font-size: 11px;
  line-height: 1.45;
  color: #62748f;
}

.entry-ai-raw-box {
  margin-top: 8px;
  padding: 10px 12px;
  border: 1px solid #d8e1ee;
  border-radius: var(--radius-xs);
  background: #f8fafc;
}

.entry-ai-raw-title {
  margin-bottom: 6px;
  color: #46566f;
  font-size: 11px;
  font-weight: 800;
}

.entry-ai-raw-content {
  margin: 0;
  white-space: pre-wrap;
  word-break: break-word;
  color: #10213d;
  font-size: 12px;
  line-height: 1.5;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

.entry-action-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  justify-content: flex-end;
  margin-top: 0;
  flex: 0 0 auto;
}

#historyList .entry-title,
#recentEntries .entry-title {
  font-size: 18px;
  line-height: 1.3;
  font-weight: 800;
}

#historyList .entry-summary,
#recentEntries .entry-summary {
  font-size: 13px;
  line-height: 1.65;
  font-weight: 500;
}

.monitor-inline-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  flex: 0 0 auto;
}

.toolbar-wrap button,
.button-row button,
.history-search-actions button,
.entry-action-row > button,
.entry-action-row > a,
.entry-actions > button,
.entry-actions > a,
.monitor-inline-actions button {
  min-height: 40px;
  height: 40px;
  padding: 0 14px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 800;
  line-height: 1;
}

.monitor-inline-actions button {
  min-width: 86px;
}

#monitorList .entry-card {
  display: grid;
  align-content: space-between;
  min-height: 170px;
  padding: 14px;
  overflow: hidden;
}

#monitorList .monitor-entry-head {
  align-items: center;
  gap: 8px;
  flex-wrap: nowrap;
}

#monitorList .monitor-entry-meta {
  flex: 1 1 auto;
  min-width: 0;
  font-size: 12px;
  line-height: 1.3;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

#monitorList .badge {
  flex: 0 0 auto;
  min-width: 54px;
  min-height: 34px;
  padding: 0 10px;
  border-radius: 10px;
  font-size: 12px;
  font-weight: 800;
  justify-self: end;
}

#monitorList .entry-summary-bubble {
  grid-template-columns: 1fr;
  padding: 12px;
  border-radius: 12px;
}

#monitorList .entry-card .entry-summary {
  font-size: 14px;
  line-height: 1.35;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

#monitorList .monitor-inline-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  width: 100%;
}

#monitorList .monitor-inline-actions button {
  min-height: 34px;
  min-width: 0;
  width: 100%;
  padding: 0 10px;
  border-radius: 10px;
  font-size: 12px;
}

.monitor-modal .form-grid {
  gap: 14px;
}

.monitor-modal textarea {
  min-height: 136px;
}

.monitor-modal-actions {
  align-items: center;
  justify-content: space-between;
}

.monitor-modal-actions .toolbar button {
  height: 42px;
  min-height: 42px;
  padding: 0 16px;
}

.entry-actions {
  margin-top: 12px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  width: 100%;
}

.entry-actions a,
.entry-actions button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-width: 0;
  width: 100%;
  background: #f7f9fc;
  border: 1px solid #dce5f3;
  color: #37517b;
  text-align: center;
  transition: transform 0.22s ease, box-shadow 0.22s ease, background-color 0.22s ease;
}

.entry-actions a:hover,
.entry-actions button:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 14px rgba(0, 0, 0, 0.08);
  background: #ffffff;
}

.entry-actions a:active,
.entry-actions button:active {
  transform: translateY(1px) scale(0.97);
}

#notificationRuleList .entry-card {
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  gap: 14px;
  min-height: 228px;
  padding: 14px;
}

#notificationRuleList .entry-main {
  display: grid;
  gap: 8px;
  min-width: 0;
}

#notificationRuleList .entry-title {
  margin: 0;
}

#notificationRuleList .entry-summary,
#notificationRuleList .entry-meta {
  margin: 0;
}

#notificationRuleList .entry-summary {
  line-height: 1.55;
}

#notificationRuleList .entry-actions {
  align-self: end;
}

.entry-open-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  white-space: nowrap;
  min-height: var(--button-min-height);
  padding: 8px 16px;
  border-radius: var(--button-radius);
  background: #32b56c;
  border: 1px solid #2b9d5e;
  color: #ffffff;
  font-size: 12px;
  line-height: 1.2;
  font-weight: 800;
  font-family: inherit;
  text-align: center;
  text-decoration: none;
  transition: transform 0.22s ease, box-shadow 0.22s ease, filter 0.22s ease;
  flex: 0 0 auto;
}

.entry-open-link:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 14px rgba(22, 92, 55, 0.26);
  filter: saturate(1.03);
}

.entry-open-link:active {
  transform: translateY(1px) scale(0.97);
}

.monitor-keywords {
  margin: 8px 0;
  font-size: 12px;
  color: #4d6fff;
}

.button-row {
  justify-content: flex-end;
}

.monitor-action-row {
  justify-content: center;
  align-items: center;
  min-height: 44px;
  margin-top: 10px;
}

.monitor-action-row button {
  min-width: 86px;
}

.toolbar-wrap {
  justify-content: flex-end;
}

.toolbar-wrap button,
.button-row button {
  min-height: var(--button-min-height);
}

.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 2px 8px;
  border-radius: var(--radius-sm);
  font-size: 11px;
  color: #ffffff;
  line-height: 1.2;
  white-space: nowrap;
}

.badge-green {
  background: #4caf50;
}

.badge-gray {
  background: #9e9e9e;
}

.premium-badge {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  padding: 2px 9px;
  border-radius: var(--radius-sm);
  font-size: 11px;
  font-weight: 800;
  white-space: nowrap;
}

.premium-badge-high {
  background: #fee2e2;
  color: #b42318;
}

.premium-badge-low {
  background: #dcfce7;
  color: #166534;
}

.premium-badge-neutral {
  background: #e0f2fe;
  color: #075985;
}

.premium-badge-error {
  background: #f1f5f9;
  color: #64748b;
}

.entry-card.matched {
  border-left: 3px solid var(--blue);
}

.entry-card.unmatched {
  border-left: 3px solid #c9d3df;
}

.empty-state {
  padding: 20px;
  text-align: center;
  color: #888888;
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius-md);
  background: #fcfcfc;
}

.log-list {
  display: grid;
  gap: 10px;
}

.log-row {
  display: grid;
  gap: 6px;
  padding: 10px 12px;
  border: 1px solid #e6eaf0;
  border-radius: var(--radius-sm);
  background: #ffffff;
  color: #263247;
}

.log-row strong {
  font-size: 12px;
  color: #5265ff;
}

.log-row span,
.log-row small {
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.log-row pre,
.log-text {
  margin: 0;
  padding: 12px;
  max-height: 420px;
  overflow: auto;
  border: 1px solid #e0e7ef;
  border-radius: var(--radius-sm);
  background: #111827;
  color: #d1e7ff;
  font: 12px/1.55 Consolas, "SFMono-Regular", monospace;
  white-space: pre-wrap;
}

.log-error {
  border-color: rgba(255, 77, 79, 0.32);
  background: #fff7f7;
}

.modal {
  position: fixed;
  inset: 0;
  display: block;
  z-index: 1000;
  animation: modalFadeIn 160ms ease both;
}

.modal.hidden {
  display: none;
}

.modal.is-closing {
  animation: modalFadeOut 160ms ease both;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  z-index: 1000;
  background: rgba(0, 0, 0, 0.28);
}

.modal-card {
  position: fixed;
  top: 50%;
  left: 50%;
  z-index: 1001;
  width: min(92vw, 380px);
  max-height: min(80vh, 640px);
  overflow-y: auto;
  padding: 18px;
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.14);
  animation: modalCardIn 180ms cubic-bezier(0.22, 1, 0.36, 1) both;
  transform-origin: center;
}

.modal.is-closing .modal-card {
  animation: modalCardOut 140ms ease both;
}

.modal-card-wide {
  width: min(94vw, 860px);
  max-height: min(86vh, 760px);
}

@keyframes modalFadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes modalFadeOut {
  from { opacity: 1; }
  to { opacity: 0; }
}

@keyframes modalCardIn {
  from {
    opacity: 0;
    transform: translate(-50%, calc(-50% + 8px)) scale(0.985);
  }
  to {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
  }
}

@keyframes modalCardOut {
  from {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
  }
  to {
    opacity: 0;
    transform: translate(-50%, calc(-50% + 6px)) scale(0.99);
  }
}

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

.modal-head h3 {
  margin: 0;
}

.icon-close-btn {
  width: 34px;
  height: 34px;
  padding: 0;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  background: #ffffff;
  color: #637083;
  font-size: 22px;
  line-height: 1;
  display: inline-grid;
  place-items: center;
}

.icon-close-btn:hover {
  background: #f5f7fb;
  color: #1c2b44;
}

.notification-rule-modal .inline-actions {
  margin-bottom: 10px;
}

.notification-rule-modal {
  padding: 22px;
}

.notification-rule-modal .form-grid {
  gap: 14px;
  margin-bottom: 14px;
}

.notification-rule-modal input,
.notification-rule-modal select {
  border-radius: 12px;
  border-color: #d9e0ea;
}

.notification-rule-modal input:focus,
.notification-rule-modal select:focus {
  outline: 2px solid rgba(47, 128, 237, 0.18);
  border-color: #7aa7f7;
}

.rule-toggle {
  display: inline-grid;
  grid-template-columns: 18px auto;
  align-items: center;
  justify-content: center;
  column-gap: 8px;
  flex-wrap: nowrap;
  min-height: 42px;
  padding: 0 12px;
  border: 1px solid #d9e0ea;
  border-radius: 999px;
  background: #f8fbff;
  color: #1f2a44;
  font-weight: 700;
  line-height: 1;
  position: relative;
}

.rule-section-title {
  margin: 12px 0 8px !important;
  color: #475569 !important;
  font-weight: 700;
}

.rule-pill-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(118px, 1fr));
  gap: 10px;
}

.rule-channel-grid {
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
}

.backup-channel-grid {
  margin-top: 6px;
}

.rule-pill {
  display: grid;
  grid-template-columns: 18px minmax(0, auto);
  align-items: center;
  justify-content: center;
  justify-items: center;
  column-gap: 8px;
  min-height: 42px;
  padding: 0 12px;
  border: 1px solid #d9e0ea;
  border-radius: 999px;
  background: #ffffff;
  color: #2b374d;
  font-weight: 700;
  cursor: pointer;
  line-height: 1;
  flex-wrap: nowrap;
  text-align: center;
  position: relative;
  transition: border-color 0.18s ease, background 0.18s ease, color 0.18s ease, box-shadow 0.18s ease, transform 0.18s ease;
}

.rule-pill:hover {
  transform: translateY(-1px);
  border-color: #8fb7fb;
  box-shadow: 0 8px 18px rgba(47, 128, 237, 0.12);
}

.rule-pill input {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: 0;
  opacity: 0;
  pointer-events: none;
}

.rule-toggle input {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: 0;
  opacity: 0;
  pointer-events: none;
}

.rule-pill::before,
.rule-toggle::before {
  content: "";
  grid-column: 1;
  grid-row: 1;
  display: grid;
  place-items: center;
  width: 16px;
  height: 16px;
  box-sizing: border-box;
  border: 2px solid #b8c3d3;
  border-radius: 5px;
  background: #ffffff;
  color: #ffffff;
  font-family: Arial, "Microsoft YaHei", sans-serif;
  font-size: 12px;
  font-weight: 900;
  line-height: 1;
}

.rule-pill:has(input:focus-visible)::before,
.rule-toggle:has(input:focus-visible)::before {
  outline: 2px solid rgba(47, 128, 237, 0.28);
  outline-offset: 2px;
}

.rule-pill:has(input:checked)::before,
.rule-toggle:has(input:checked)::before {
  content: "\2713";
  border-color: var(--blue);
  background: var(--blue);
}

.rule-pill span,
.rule-toggle span {
  grid-column: 2;
  grid-row: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 20px;
  line-height: 20px;
  white-space: nowrap;
}

.rule-pill:has(input:checked),
.rule-toggle:has(input:checked) {
  border-color: rgba(47, 128, 237, 0.55);
  background: #eef5ff;
  color: #174ea6;
  box-shadow: inset 0 0 0 1px rgba(47, 128, 237, 0.12);
}

.notification-rule-modal .toolbar {
  margin-top: 16px;
  gap: 10px;
  align-items: center;
}

.notification-rule-modal .toolbar button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 42px;
  min-height: 42px;
  padding: 0 16px;
  border-radius: var(--button-radius);
  border-width: 1px;
  font-size: 12px;
  font-weight: 800;
  line-height: 1;
  white-space: nowrap;
}

.ai-auto-scope {
  display: grid;
  gap: 10px;
  padding: 14px;
  border: 1px solid rgba(47, 128, 237, 0.14);
  border-radius: 12px;
  background: #f8fbff;
}

.ai-auto-scope > .checkbox-inline {
  font-size: 15px;
  line-height: 1.45;
}

.ai-auto-scope > .checkbox-inline input {
  width: 18px;
  height: 18px;
  flex-basis: 18px;
}

.ai-auto-scope .helper {
  margin: 0;
}

.notification-rule-modal .toolbar .btn-blue {
  border-color: transparent;
}

.notification-rule-modal .toolbar .btn-orange {
  border-color: transparent;
}

.notification-rule-modal .toolbar .ghost {
  border-color: transparent;
  background: #ffffff;
  color: #475569;
}

#notificationRuleList .entry-actions .btn-blue,
#notificationRuleList .entry-actions .btn-danger,
#notificationRuleList .entry-actions .ghost {
  border-color: transparent;
}

#notificationRuleList .entry-actions .btn-blue {
  background: var(--blue);
  color: #ffffff;
}

#notificationRuleList .entry-actions .btn-danger {
  background: var(--red);
  color: #ffffff;
}

.modal-card h3 {
  margin: 0 0 8px;
  font-size: 16px;
}

.modal-card .modal-head h3 {
  margin: 0;
}

.modal-card p {
  margin: 0 0 14px;
  white-space: pre-wrap;
  color: #666666;
  line-height: 1.6;
}

.modal-password-input {
  width: 100%;
  min-height: 42px;
  margin-top: 12px;
  padding: 8px 10px;
  border: 1px solid #d2dbea;
  border-radius: var(--radius-md);
  background: #ffffff;
  color: #10213d;
  font: inherit;
}

.hidden {
  display: none;
}

@media (max-width: 1160px) {
  .overview-workbench {
    grid-template-columns: minmax(240px, 0.8fr) minmax(300px, 1fr);
  }

  .overview-trend-card {
    grid-column: 1 / -1;
  }

  .forum-trend-panel-dense {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .trend-discussion-grid {
    grid-column: 1 / -1;
  }
}

@media (max-width: 1080px) {
  .console-shell {
    grid-template-columns: 168px minmax(0, 1fr);
    gap: 10px;
  }

  .page-tabs {
    padding: 8px;
  }

  .app-tabs {
    width: 168px;
  }

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

  .overview-workbench {
    grid-template-columns: 1fr;
    grid-auto-rows: auto;
  }

  .overview-side-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    grid-template-rows: none;
    height: auto;
    max-height: none;
  }

  .overview-primary-card,
  .overview-trend-card {
    height: auto;
    max-height: none;
  }

  #monitorList.card-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  #notificationRuleList.entry-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

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

  .overview-metric-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

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

  .telegram-token-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .telegram-control-grid {
    grid-template-columns: minmax(220px, 0.65fr) minmax(280px, 1fr);
  }
}

@media (max-width: 760px) {
  body {
    height: auto;
    overflow: auto;
  }

  .console-shell {
    width: 100%;
    height: auto;
    padding: 10px;
    display: block;
    overflow: visible;
  }

  .stats-grid,
  .metric-grid,
  #monitorList.card-list,
  #notificationRuleList.entry-list,
  .telegram-token-grid,
  .telegram-control-grid,
  .form-grid,
  .notify-grid {
    grid-template-columns: 1fr;
  }

  .topbar-card,
  .section-head,
  .block-head,
  .toolbar,
  .inline-actions,
  .button-row {
    flex-direction: column;
    align-items: stretch;
  }

  .page-tabs {
    margin-top: 12px;
    margin-right: -2px;
    padding-bottom: 8px;
    min-height: auto;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    position: static;
    width: 100%;
    max-height: none;
    overflow: visible;
  }

  .section-panel {
    min-height: auto;
    padding-right: 0;
    padding-bottom: 0;
    overflow: visible;
  }

  .page-tabs a,
  .page-tabs [data-app-tab] {
    justify-content: center;
    text-align: center;
  }

  .toolbar-wrap button,
  .button-row button,
  .topbar-actions button {
    width: 100%;
  }

  .checkbox-inline-block {
    width: 100%;
  }

  .topbar-actions {
    width: 100%;
    justify-content: stretch;
  }

  .topbar-actions .user-hint {
    width: 100%;
  }

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

  .history-search-actions {
    grid-template-columns: 1fr 1fr;
    width: 100%;
  }

  .metric-card,
  .status-box {
    min-height: auto;
  }

  .overview-side-grid,
  .overview-metric-grid,
  .forum-trend-panel {
    grid-template-columns: minmax(0, 1fr);
  }

  .trend-discussion-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .entry-head,
  .entry-actions {
    flex-direction: column;
    align-items: stretch;
  }

  .entry-side {
    min-width: 0;
    justify-items: start;
  }

  .entry-chip-row-side {
    justify-content: flex-start;
    flex-wrap: wrap;
    max-width: none;
  }

  .entry-action-row {
    justify-content: flex-start;
  }

  .entry-summary-bubble {
    grid-template-columns: 1fr;
    align-items: stretch;
  }

  .entry-open-link {
    align-self: flex-end;
  }

  .entry-action-row {
    justify-content: flex-end;
    min-width: 0;
  }

  .monitor-inline-actions {
    justify-content: stretch;
  }

  .monitor-inline-actions button {
    width: 100%;
  }

  .entry-title {
    font-size: 17px;
  }

  .entry-summary {
    font-size: 13px;
  }

  #historyList .entry-title,
  #recentEntries .entry-title {
    font-size: 17px;
  }

  #historyList .entry-summary,
  #recentEntries .entry-summary {
    font-size: 12px;
  }

  .modal-card {
    width: min(94vw, 420px);
    padding: 16px;
  }
}

@media (max-width: 420px) {
  body {
    font-size: 14px;
  }

  .entry-action-row {
    flex-wrap: wrap;
  }

  .entry-open-link {
    flex: 1 1 100%;
  }

  .brand-title {
    font-size: 15px;
  }

  .brand-subtitle {
    font-size: 12px;
  }

  .section-panel,
  .content-block,
  .subtle-block,
  .monitor-card,
  .entry-card,
  .metric-card,
  .status-box {
    padding-left: 12px;
    padding-right: 12px;
  }
}


.history-search-field {
  flex: 1 1 320px;
}

.history-search-form {
  display: grid;
  grid-template-columns: minmax(280px, 1fr) minmax(180px, 226px) auto;
  align-items: end;
  gap: 12px;
}

.history-search-form label {
  display: grid;
  gap: 8px;
}

.history-search-form label span {
  margin-bottom: 0;
  line-height: 18px;
}

.history-search-field input[type="search"] {
  width: 100%;
  height: 48px;
  min-height: 48px;
  padding: 0 16px;
  font-size: 14px;
  line-height: 48px;
}

.history-category-field {
  flex: 0 1 226px;
}

.history-category-field select {
  width: 100%;
  height: 48px;
  min-height: 48px;
  padding: 0 16px;
  font-size: 14px;
  line-height: 48px;
}

.log-category-field,
.log-type-field {
  display: grid;
  gap: 6px;
  min-width: 224px;
}

.log-category-field span,
.log-type-field span {
  margin-bottom: 0;
  font-size: 12px;
  line-height: 18px;
  color: #64748b;
  font-weight: 700;
}

.log-category-field select,
.log-type-field select {
  height: 52px;
  min-height: 52px;
  padding: 0 16px;
  font-size: 14px;
}

.log-toolbar #refreshLogsBtn {
  height: 52px;
  min-height: 52px;
  padding: 0 22px;
}

.history-search-actions {
  align-self: end;
  display: grid;
  grid-template-columns: repeat(2, minmax(72px, 1fr));
  gap: 12px;
  min-height: 48px;
  align-items: center;
}

.history-search-actions button {
  height: 44px;
  min-height: 44px;
  padding: 0 18px;
}


.ai-analysis-panel {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin: 8px 0;
  padding: 10px 12px;
  border: 1px solid rgba(59, 130, 246, 0.25);
  background: rgba(59, 130, 246, 0.08);
  border-radius: 8px;
  font-size: 13px;
}

.ai-analysis-panel span {
  font-weight: 700;
}

.ai-analysis-panel small {
  flex-basis: 100%;
  color: #475569;
}

.ai-profile-panel {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) minmax(220px, 1fr);
  gap: 14px;
  align-items: end;
  padding: 16px;
  border: 1px solid rgba(124, 58, 237, 0.18);
  background: rgba(124, 58, 237, 0.06);
  border-radius: 12px;
}

.ai-profile-current-text,
.ai-profile-panel .checkbox-inline,
.ai-profile-panel .helper,
.ai-profile-panel .ai-profile-list,
.ai-profile-panel .toolbar {
  grid-column: 1 / -1;
}

.ai-profile-panel .toolbar {
  align-items: center;
  gap: 12px;
}

.ai-profile-panel .toolbar button {
  min-height: 42px;
  padding: 0 16px;
  border-radius: var(--button-radius);
  border-width: 1px;
  white-space: nowrap;
  font-size: 12px;
  font-weight: 800;
}

.ai-profile-current-text {
  min-height: 46px;
  padding: 12px 14px;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  border: 1px solid rgba(124, 58, 237, 0.2);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.72);
  color: #1f2a44;
  font-size: 14px;
  font-weight: 700;
  line-height: 1.5;
  overflow-wrap: anywhere;
}

.ai-profile-list {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.ai-profile-item {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 12px;
  align-items: start;
  justify-content: stretch;
  text-align: left;
  padding: 14px;
  border: 1px solid rgba(124, 58, 237, 0.2);
  border-radius: 8px;
  background: #fff;
  color: #172033;
  cursor: grab;
  line-height: 1.35;
  white-space: normal;
  width: 100%;
  box-shadow: 0 8px 18px rgba(15, 23, 42, 0.05);
}

.ai-profile-order {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 58px;
  min-height: 30px;
  padding: 0 10px;
  border-radius: 999px;
  background: #eef5ff;
  color: #174ea6;
  border: 1px solid rgba(37, 99, 235, 0.22);
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

.ai-profile-item strong,
.ai-profile-item span,
.ai-profile-item em {
  overflow-wrap: anywhere;
}

.ai-profile-card-main {
  display: grid;
  gap: 6px;
}

.ai-profile-item span {
  color: #64748b;
  font-size: 13px;
}

.ai-profile-item small {
  color: #2563eb;
  font-size: 12px;
  font-weight: 700;
}

.ai-profile-card-actions {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.ai-profile-card-actions button {
  min-height: 40px;
  padding: 0 12px;
}

.ai-profile-item.is-active {
  background: rgba(37, 99, 235, 0.08);
  border-color: rgba(37, 99, 235, 0.45);
  box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.10);
}

.notification-config-list {
  margin-bottom: 14px;
}

.notification-config-item {
  cursor: default;
}

.notification-config-modal .notify-card {
  grid-column: 1 / -1;
}

.ai-profile-item.is-active .ai-profile-order {
  background: #2563eb;
  border-color: #2563eb;
  color: #ffffff;
}

.ai-profile-item.is-dragging {
  opacity: 0.58;
  cursor: grabbing;
}

.ai-profile-modal .form-grid {
  gap: 14px;
}

.ai-profile-modal .form-grid-full {
  grid-column: 1 / -1;
  display: grid;
  gap: 8px;
}

.field-label {
  display: block;
  margin-bottom: 0;
  font-size: 12px;
  color: #444444;
  font-weight: 700;
}

.ai-profile-modal-actions {
  margin-top: 16px;
  justify-content: flex-end;
}

.ai-profile-modal-actions button {
  height: 42px;
  min-height: 42px;
  padding: 0 16px;
}

@media (max-width: 760px) {
  .ai-profile-panel {
    grid-template-columns: 1fr;
  }

  .ai-profile-list {
    grid-template-columns: 1fr;
  }
}

@media (min-width: 761px) and (max-width: 1040px) {
  .ai-profile-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}


.entry-ai-button {
  border: 1px solid #2b9d5e;
  cursor: pointer;
  appearance: none;
  min-height: var(--button-min-height);
  border-radius: var(--button-radius);
}
