: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;
  --shell-width: 1120px;
}

* {
  box-sizing: border-box;
}

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

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 {
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  padding: 8px 14px;
  cursor: pointer;
  font-size: 12px;
  font-weight: 600;
  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: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: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,
.page-tabs a.active,
.page-tabs [data-app-tab].active {
  background: var(--blue);
  color: #ffffff;
}

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

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

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

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

.filter-chip {
  background: #ffffff;
  border: 1px solid #d7d7d7;
  color: #555555;
}

.filter-chip.active {
  background: var(--blue);
  border-color: var(--blue);
  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: min(100%, var(--shell-width));
  margin: 0 auto;
  padding: 16px 20px 36px;
}

.topbar-card,
.status-box,
.panel,
.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 {
  margin-top: 8px;
  padding: 26px 22px 24px;
  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: 24px;
  font-weight: 800;
  color: #24324a;
}

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

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

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

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

.stats-grid {
  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 {
  margin-top: 14px;
  display: flex;
  gap: 8px;
  border-bottom: 1px solid var(--line);
  overflow-x: auto;
  padding-bottom: 10px;
  scrollbar-width: thin;
}

.app-tabs {
  position: sticky;
  top: 8px;
  z-index: 6;
  background: rgba(245, 245, 245, 0.92);
  backdrop-filter: blur(8px);
}

.page-tabs a {
  padding: 10px 16px;
  background: #fafafa;
  border: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  border-radius: var(--radius-md);
  color: #555555;
  font-size: 12px;
  white-space: nowrap;
  flex: 0 0 auto;
  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] {
  padding: 10px 16px;
  background: #fafafa;
  border: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  border-radius: var(--radius-md);
  color: #555555;
  font-size: 12px;
  white-space: nowrap;
  flex: 0 0 auto;
  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 a:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 14px rgba(0, 0, 0, 0.08);
}

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

.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 {
  margin-top: 0;
  padding: 16px;
}

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

.text-button {
  border: none;
  background: transparent;
  box-shadow: none;
  padding: 0;
  color: var(--muted);
  font-weight: 600;
}

.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;
}

.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;
}

.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;
}

.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: wrap;
}

.checkbox-inline input {
  width: 16px;
  height: 16px;
}

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

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

.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: 16px;
  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: 14px;
}

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

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

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

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

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

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

.entry-summary-bubble {
  margin-top: 14px;
  padding: 16px 18px;
  border-radius: var(--radius-xl);
  background: #edf3fc;
  border: 1px solid #dde8f8;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.entry-summary {
  margin: 0;
  font-size: 14px;
  line-height: 1.8;
  color: #5d6f89;
  flex: 1 1 auto;
}

.entry-card .entry-summary {
  font-size: 15px;
  font-weight: 700;
}

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

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

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

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

.entry-actions {
  margin-top: 12px;
  display: flex;
  justify-content: flex-end;
}

.entry-actions a {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: var(--radius-md);
  background: #f7f9fc;
  border: 1px solid #dce5f3;
  color: #37517b;
  font-size: 12px;
  font-weight: 700;
  transition: transform 0.22s ease, box-shadow 0.22s ease, background-color 0.22s ease;
}

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

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

.entry-open-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  white-space: nowrap;
  padding: 8px 14px;
  border-radius: var(--radius-md);
  background: #32b56c;
  border: 1px solid #2b9d5e;
  color: #ffffff;
  font-size: 12px;
  font-weight: 700;
  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: 38px;
}

.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: var(--radius-sm);
  font-size: 11px;
  color: #ffffff;
}

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

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

.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;
}

.modal {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  z-index: 20;
}

.modal.hidden {
  display: none;
}

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

.modal-card {
  position: relative;
  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);
}

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

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

.hidden {
  display: none;
}

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

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

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

@media (max-width: 760px) {
  .console-shell {
    width: 100%;
    padding: 10px 10px 28px;
  }

  .stats-grid,
  .metric-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-right: -2px;
    padding-bottom: 8px;
  }

  .page-tabs a,
  .page-tabs [data-app-tab] {
    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%;
  }

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

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

  .entry-summary-bubble {
    flex-direction: column;
    align-items: stretch;
  }

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

  .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;
  }

  .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;
  }
}
