:root {
  color-scheme: light;
  --bg: #f4f6f9;
  --sidebar: #fafbfc;
  --surface: #ffffff;
  --surface-alt: #f8fafc;
  --surface-hover: #f2f5f9;
  --line: #e4e8ef;
  --line-strong: #d6dce6;
  --text: #172033;
  --text-soft: #374256;
  --muted: #748095;
  --muted-2: #9aa4b4;
  --primary: #4f6bed;
  --primary-strong: #4059d4;
  --primary-soft: #eef2ff;
  --cyan: #149f91;
  --cyan-soft: #e9f8f5;
  --red: #dc5f70;
  --red-soft: #fff0f2;
  --amber: #c78328;
  --amber-soft: #fff7e8;
  --shadow: 0 12px 32px rgba(27, 39, 62, 0.07);
  --shadow-soft: 0 4px 14px rgba(27, 39, 62, 0.045);
  --sidebar-width: 228px;
  --radius-lg: 18px;
  --radius-md: 12px;
  --radius-sm: 9px;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html {
  min-width: 320px;
  background: var(--bg);
}

body {
  min-height: 100vh;
  margin: 0;
  overflow-x: hidden;
  color: var(--text);
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "SF Pro Text", "PingFang SC", "Microsoft YaHei", sans-serif;
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
  background:
    radial-gradient(circle at 88% -12%, rgba(79, 107, 237, 0.09), transparent 28%),
    radial-gradient(circle at 12% 108%, rgba(20, 159, 145, 0.055), transparent 28%),
    var(--bg);
}

button,
input,
select {
  font: inherit;
}

button,
select,
label,
input[type="checkbox"] {
  -webkit-tap-highlight-color: transparent;
}

button:focus-visible,
input:focus-visible,
select:focus-visible {
  outline: 2px solid rgba(79, 107, 237, 0.55);
  outline-offset: 2px;
}

.ambient {
  position: fixed;
  z-index: -1;
  border-radius: 50%;
  filter: blur(110px);
  pointer-events: none;
  opacity: 0.06;
}

.ambient-one {
  width: 360px;
  height: 360px;
  top: 4%;
  right: -180px;
  background: #5472f0;
}

.ambient-two {
  width: 320px;
  height: 320px;
  bottom: -220px;
  left: 15%;
  background: #36b5a8;
}

/* Sidebar */
.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 20;
  width: var(--sidebar-width);
  display: flex;
  flex-direction: column;
  padding: 24px 15px 20px;
  border-right: 1px solid var(--line);
  background: rgba(250, 251, 252, 0.92);
  backdrop-filter: blur(18px);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 8px 28px;
}

.brand-mark {
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  flex: 0 0 40px;
  border-radius: 13px;
  color: #fff;
  font-size: 19px;
  font-weight: 800;
  background: var(--primary);
  box-shadow: 0 9px 22px rgba(79, 107, 237, 0.24);
}

.brand strong {
  display: block;
  color: #182033;
  font-size: 15px;
  letter-spacing: -0.2px;
}

.brand span {
  display: block;
  margin-top: 3px;
  color: var(--muted-2);
  font-size: 10px;
}

.nav-label {
  margin: 0 12px 8px;
  color: #a3acba;
  font-size: 9px;
  font-weight: 750;
  letter-spacing: 1.5px;
}

.sidebar nav {
  display: grid;
  gap: 4px;
}

.nav-item {
  width: 100%;
  min-height: 44px;
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 0 12px;
  border: 1px solid transparent;
  border-radius: 11px;
  color: #6f7b8e;
  text-align: left;
  background: transparent;
  cursor: pointer;
  transition: color 0.16s ease, background 0.16s ease, border-color 0.16s ease;
}

.nav-item:hover {
  color: #334056;
  background: #f1f4f8;
}

.nav-item.active {
  border-color: #dfe5ff;
  color: #314dbd;
  background: #edf1ff;
}

.nav-icon {
  width: 24px;
  height: 24px;
  display: grid;
  place-items: center;
  flex: 0 0 24px;
  color: #8490a3;
  font-size: 17px;
  line-height: 1;
}

.nav-item.active .nav-icon {
  color: var(--primary);
}

.nav-item em {
  min-width: 24px;
  margin-left: auto;
  padding: 3px 7px;
  border-radius: 999px;
  color: #78869c;
  font-size: 10px;
  font-style: normal;
  text-align: center;
  background: #e9edf3;
}

.nav-item.active em {
  color: #4660d4;
  background: #dfe6ff;
}

.sidebar-foot {
  margin-top: auto;
  padding: 18px 10px 0;
  border-top: 1px solid var(--line);
}

.mini-status {
  display: flex;
  align-items: center;
  gap: 9px;
  color: #576478;
  font-size: 12px;
}

.mini-status i,
.connection-pill i {
  width: 8px;
  height: 8px;
  flex: 0 0 8px;
  border-radius: 50%;
  background: #b3bcc9;
}

.mini-status i.connected,
.connection-pill i.connected {
  background: var(--cyan);
  box-shadow: 0 0 0 5px rgba(20, 159, 145, 0.09);
}

.sidebar-foot small {
  display: block;
  margin-top: 7px;
  color: #a0a9b7;
  font-size: 9px;
}

/* Main shell */
main {
  min-height: 100vh;
  margin-left: var(--sidebar-width);
  padding: 32px 40px 56px;
}

main > header,
.view {
  width: min(100%, 1280px);
  margin-left: auto;
  margin-right: auto;
}

header {
  min-height: 72px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 26px;
}

.eyebrow {
  margin: 0 0 7px;
  color: #8a96a9;
  font-size: 9px;
  font-weight: 750;
  letter-spacing: 1.8px;
  text-transform: uppercase;
}

h1,
h2,
h3,
h4,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 3px;
  color: #151d2d;
  font-size: clamp(25px, 2.2vw, 34px);
  line-height: 1.15;
  letter-spacing: -0.8px;
}

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

.header-actions {
  display: flex;
  align-items: center;
  gap: 9px;
}

.connection-pill {
  height: 39px;
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 11px;
  color: #687589;
  font-size: 11px;
  background: rgba(255, 255, 255, 0.8);
  box-shadow: var(--shadow-soft);
}

.button {
  min-height: 39px;
  padding: 0 15px;
  border: 1px solid transparent;
  border-radius: 10px;
  color: #455166;
  font-size: 11px;
  font-weight: 680;
  white-space: nowrap;
  background: #edf1f5;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}

.button:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 7px 16px rgba(27, 39, 62, 0.09);
}

.button.primary {
  color: #fff;
  background: var(--primary);
  box-shadow: 0 8px 18px rgba(79, 107, 237, 0.2);
}

.button.primary:hover:not(:disabled) {
  background: var(--primary-strong);
}

.button.ghost {
  border-color: var(--line-strong);
  color: #566276;
  background: rgba(255, 255, 255, 0.75);
}

.button.soft {
  border-color: #e0e6ff;
  color: #455fcf;
  background: var(--primary-soft);
}

.button.danger {
  color: var(--red);
}

.button:disabled {
  opacity: 0.42;
  cursor: not-allowed;
  box-shadow: none;
  transform: none;
}

.view {
  display: none;
}

.view.active {
  display: block;
  animation: view-in 0.2s ease-out;
}

@keyframes view-in {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: none; }
}

.panel,
.hero-card,
.metric,
.plugin-card {
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.93);
  box-shadow: var(--shadow);
}

.panel,
.hero-card {
  border-radius: var(--radius-lg);
}

.panel {
  padding: 22px;
}

.panel-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 18px;
}

.panel-head h3 {
  margin: 0;
  color: #202a3c;
  font-size: 16px;
  letter-spacing: -0.2px;
}

.panel-description {
  margin: 7px 0 0;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.6;
}

.tag {
  flex: 0 0 auto;
  padding: 5px 8px;
  border: 1px solid #dce3ee;
  border-radius: 7px;
  color: #687991;
  font-size: 8px;
  font-weight: 700;
  letter-spacing: 0.4px;
  background: #f4f7fa;
}

/* Overview */
.hero-card {
  position: relative;
  min-height: 128px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  overflow: hidden;
  padding: 25px 28px;
  background:
    linear-gradient(105deg, rgba(79, 107, 237, 0.055), transparent 52%),
    rgba(255, 255, 255, 0.96);
}

.hero-card::after {
  content: "";
  position: absolute;
  width: 210px;
  height: 210px;
  top: -164px;
  right: 11%;
  border: 1px solid rgba(79, 107, 237, 0.1);
  border-radius: 50%;
}

.hero-status {
  display: flex;
  align-items: center;
  gap: 17px;
}

.hero-status h2 {
  margin: 0 0 5px;
  color: #1d2638;
  font-size: 20px;
  letter-spacing: -0.35px;
}

.hero-status p {
  margin: 0;
  color: var(--muted);
  font-size: 11px;
}

.pulse-ring {
  width: 46px;
  height: 46px;
  display: grid;
  place-items: center;
  flex: 0 0 46px;
  border: 1px solid #dfe4ec;
  border-radius: 14px;
  background: #f4f6f9;
}

.pulse-ring i {
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: #b4bdca;
}

.pulse-ring i.connected {
  background: var(--cyan);
  box-shadow: 0 0 15px rgba(20, 159, 145, 0.4);
}

.hero-actions {
  z-index: 1;
  display: flex;
  gap: 9px;
}

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

.metric {
  min-width: 0;
  padding: 18px 19px;
  border-radius: 14px;
  box-shadow: var(--shadow-soft);
}

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

.metric strong {
  display: block;
  margin: 8px 0 4px;
  overflow: hidden;
  color: #172033;
  font-size: 22px;
  line-height: 1.15;
  letter-spacing: -0.45px;
  text-overflow: ellipsis;
}

.metric small {
  color: #9aa4b2;
  font-size: 9px;
}

.overview-grid {
  display: grid;
  grid-template-columns: minmax(300px, 0.85fr) minmax(430px, 1.25fr);
  gap: 13px;
}

.connection-panel dl {
  margin: 0;
}

.connection-panel dl div {
  display: grid;
  grid-template-columns: 92px minmax(0, 1fr);
  gap: 16px;
  padding: 10px 0;
  border-bottom: 1px solid #edf0f4;
}

dt {
  color: #8490a2;
  font-size: 10px;
}

dd {
  min-width: 0;
  margin: 0;
  overflow: hidden;
  color: #465267;
  font-size: 10px;
  text-align: right;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.text-button {
  padding: 13px 0 0;
  border: 0;
  color: #4f6bed;
  font-size: 10px;
  background: none;
  cursor: pointer;
}

.text-button.compact {
  padding: 0;
}

.event-list {
  min-height: 190px;
}

.empty-state {
  display: grid;
  place-content: center;
  color: #9aa4b2;
  text-align: center;
}

.empty-state p {
  margin-bottom: 5px;
  color: #718095;
}

.empty-state span {
  font-size: 10px;
}

.event-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  padding: 11px 0;
  border-bottom: 1px solid #edf0f4;
}

.event-row:last-child {
  border-bottom: 0;
}

.event-symbol {
  width: 31px;
  height: 31px;
  display: grid;
  place-items: center;
  border: 1px solid #e0e6ff;
  border-radius: 9px;
  color: #4f6bed;
  font-size: 10px;
  background: #f1f4ff;
}

.event-main {
  min-width: 0;
}

.event-main strong {
  display: block;
  margin-bottom: 3px;
  overflow: hidden;
  color: #3d485b;
  font-size: 10px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.event-main span {
  display: block;
  overflow: hidden;
  color: #8994a4;
  font-size: 9px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.event-time {
  color: #9ba5b3;
  font-size: 9px;
}

/* Toolbars and event detail */
.toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
  padding: 12px;
  box-shadow: var(--shadow-soft);
}

.search {
  min-width: 220px;
  height: 39px;
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #f8fafc;
}

.search span {
  color: #8491a3;
  font-size: 16px;
}

.search input {
  width: 100%;
  min-width: 0;
  height: 100%;
  border: 0;
  outline: 0;
  color: #344055;
  font-size: 11px;
  background: transparent;
}

.search input::placeholder {
  color: #a0a9b7;
}

.toolbar select,
.settings-form select {
  height: 39px;
  padding: 0 34px 0 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  color: #59667a;
  font-size: 10px;
  background: #f8fafc;
}

.full-event-list {
  min-height: 500px;
  padding: 5px 21px;
}

.event-card {
  padding: 20px 2px;
  border-bottom: 1px solid #ebeff4;
}

.event-card:last-child {
  border-bottom: 0;
}

.event-card-head,
.event-title-line {
  display: flex;
  align-items: center;
}

.event-card-head {
  justify-content: space-between;
  gap: 16px;
}

.event-title-line {
  min-width: 0;
  gap: 10px;
}

.source-badge {
  flex: 0 0 auto;
  padding: 4px 7px;
  border: 1px solid #dfe5ff;
  border-radius: 6px;
  color: #4d65cc;
  font-size: 8px;
  background: #f0f3ff;
}

.event-card h4 {
  margin: 0;
  overflow: hidden;
  color: #3b4658;
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.event-card button {
  flex: 0 0 auto;
  padding: 4px 0;
  border: 0;
  color: #4f6bed;
  font-size: 9px;
  background: transparent;
  cursor: pointer;
}

.event-content {
  margin: 18px 0;
  color: #1e2738;
  font-size: 17px;
  font-weight: 650;
  line-height: 1.55;
  white-space: pre-wrap;
}

.event-facts {
  display: grid;
  grid-template-columns: 0.72fr 1.35fr 1.35fr 0.78fr;
  gap: 0;
  overflow: hidden;
  border: 1px solid #e4e9ef;
  border-radius: 12px;
  background: #f8fafc;
}

.event-facts > .event-fact {
  min-width: 0;
  padding: 12px 14px;
  border-right: 1px solid #e4e9ef;
}

.event-facts > .event-fact:last-child {
  border-right: 0;
}

.event-fact > span,
.event-fact > strong,
.event-fact > small {
  display: block;
}

.event-fact > span {
  margin-bottom: 5px;
  color: #98a3b2;
  font-size: 8px;
}

.event-fact > strong {
  color: #4b576b;
  font-size: 10px;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.event-fact > small {
  margin-top: 4px;
  color: #a1aab7;
  font-size: 8px;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.event-id-line {
  display: flex;
  align-items: flex-start;
  gap: 7px;
  margin-top: 6px;
}

.event-id-line code,
.event-technical-id code {
  min-width: 0;
  color: #69768b;
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 8px;
  line-height: 1.5;
  overflow-wrap: anywhere;
  user-select: all;
}

.event-id-line code {
  flex: 1;
}

.event-card .copy-id {
  flex: 0 0 auto;
  padding: 2px 6px;
  border: 1px solid #dce3ef;
  border-radius: 6px;
  color: #536bcc;
  font-size: 7px;
  line-height: 1.55;
  background: #fff;
}

.event-card .copy-id:hover {
  border-color: #bdc9fa;
  background: #f0f3ff;
}

.event-technical-id {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: start;
  gap: 9px;
  margin-top: 9px;
  padding: 9px 12px;
  border: 1px solid #e8ecf1;
  border-radius: 9px;
  background: #fbfcfd;
}

.event-technical-id > span {
  padding-top: 1px;
  color: #9aa4b2;
  font-size: 8px;
  white-space: nowrap;
}

.attachments {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-top: 10px;
}

.attachment {
  padding: 6px 8px;
  border: 1px solid #dfe5f4;
  border-radius: 7px;
  color: #5970ce;
  font-size: 8px;
  background: #f8faff;
}

.event-card pre {
  display: none;
  max-height: 420px;
  margin: 12px 0 0;
  overflow: auto;
  padding: 15px;
  border: 1px solid #dfe4eb;
  border-radius: 11px;
  color: #4e5b70;
  font: 9px/1.65 "SFMono-Regular", Consolas, monospace;
  background: #f6f8fa;
}

.event-card.open pre {
  display: block;
}

/* Logs */
.log-filters {
  display: flex;
  gap: 6px;
}

.chip {
  min-width: 58px;
  height: 33px;
  padding: 0 10px;
  border: 1px solid #dfe4eb;
  border-radius: 9px;
  color: #7a879a;
  font-size: 9px;
  background: #f8fafc;
  cursor: pointer;
}

.chip.active {
  border-color: #c9d3ff;
  color: #445ecb;
  background: #eef2ff;
}

.switch-label {
  display: flex;
  align-items: center;
  gap: 9px;
  margin-left: auto;
  color: #788498;
  font-size: 10px;
  cursor: pointer;
}

.switch-label input {
  display: none;
}

.switch-label > span {
  position: relative;
  width: 32px;
  height: 18px;
  display: block;
  flex: 0 0 32px;
  border: 1px solid #d1d7e0;
  border-radius: 999px;
  background: #e6eaf0;
  transition: 0.2s ease;
}

.switch-label > span::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #929dad;
  transition: 0.2s ease;
}

.switch-label input:checked + span {
  border-color: var(--primary);
  background: var(--primary);
}

.switch-label input:checked + span::after {
  left: 17px;
  background: #fff;
}

.logs {
  height: min(650px, calc(100vh - 190px));
  min-height: 430px;
  overflow: auto;
  padding: 6px 18px;
  background: rgba(255, 255, 255, 0.96);
  font-family: "SFMono-Regular", Consolas, monospace;
}

.log-line {
  display: grid;
  grid-template-columns: 76px 72px minmax(0, 1fr);
  align-items: start;
  gap: 12px;
  padding: 10px 2px;
  border-bottom: 1px solid #edf0f4;
  font-size: 10px;
  line-height: 1.55;
}

.log-time {
  color: #99a3b1;
}

.log-level {
  width: fit-content;
  min-width: 48px;
  padding: 2px 6px;
  border-radius: 5px;
  color: #526bd3;
  text-align: center;
  background: #eef2ff;
}

.log-line.WARNING .log-level {
  color: var(--amber);
  background: var(--amber-soft);
}

.log-line.ERROR .log-level {
  color: var(--red);
  background: var(--red-soft);
}

.log-message {
  min-width: 0;
  color: #536074;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

/* Plugins */
.plugins-shell {
  width: min(100%, 1080px);
}

.plugins-intro {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 13px;
  padding: 20px 22px;
  box-shadow: var(--shadow-soft);
}

.plugins-intro h3 {
  margin-bottom: 6px;
  color: #202a3c;
  font-size: 16px;
}

.plugins-intro > div > p:last-child {
  margin: 0;
  color: var(--muted);
  font-size: 10px;
}

.plugins-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-items: start;
  gap: 13px;
}

.plugins-grid.empty-state {
  min-height: 260px;
  grid-template-columns: 1fr;
  border: 1px dashed #d6dde7;
  border-radius: var(--radius-lg);
  background: rgba(255, 255, 255, 0.45);
}

.plugin-card {
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-self: start;
  padding: 20px;
  border-radius: 16px;
  box-shadow: var(--shadow-soft);
}

.plugin-card-main {
  min-width: 0;
}

.plugin-card-head {
  display: flex;
  align-items: center;
  gap: 11px;
}

.plugin-icon {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  flex: 0 0 38px;
  border: 1px solid #dfe5ff;
  border-radius: 11px;
  color: #4f6bed;
  background: #eef2ff;
}

.plugin-card-head > div:nth-child(2) {
  min-width: 0;
}

.plugin-card-head h3 {
  margin: 0 0 3px;
  overflow: hidden;
  color: #222c3e;
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.plugin-card-head span {
  color: #8b96a6;
  font-size: 9px;
}

.plugin-dot {
  width: 8px;
  height: 8px;
  flex: 0 0 8px;
  border-radius: 50%;
  background: #b2bbc8;
}

.plugin-status {
  display: flex;
  align-items: center;
  gap: 7px;
  flex: 0 0 auto;
  margin-left: auto;
  color: #8b96a6;
  font-size: 8px;
}

.plugin-card.running .plugin-dot {
  background: var(--cyan);
  box-shadow: 0 0 0 5px rgba(20, 159, 145, 0.08);
}

.plugin-card.error .plugin-dot {
  background: var(--red);
}

.plugin-card-main > p {
  min-height: 34px;
  margin: 16px 0 12px;
  color: #7b879a;
  font-size: 10px;
  line-height: 1.7;
}

.plugin-events {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.plugin-events:empty {
  display: none;
}

.plugin-events span {
  max-width: 100%;
  overflow: hidden;
  padding: 4px 6px;
  border: 1px solid #e1e6ed;
  border-radius: 6px;
  color: #738096;
  font-size: 7px;
  text-overflow: ellipsis;
  white-space: nowrap;
  background: #f8fafc;
}

.plugin-error {
  margin-top: 12px;
  padding: 9px;
  border: 1px solid #ffd8dd;
  border-radius: 8px;
  color: #c84e5f;
  font-size: 9px;
  line-height: 1.5;
  background: var(--red-soft);
}

.plugin-actions {
  display: flex;
  justify-content: flex-end;
  gap: 7px;
  margin-top: 17px;
  padding-top: 14px;
  border-top: 1px solid #edf0f4;
}

.plugin-actions .button {
  min-height: 35px;
  padding: 0 12px;
  font-size: 10px;
}

/* Certificates */
.certificate-shell {
  width: min(100%, 1080px);
}

.certificate-summary,
.renewal-panel {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

.certificate-summary h3,
.renewal-panel h3 {
  margin-bottom: 6px;
  color: #202a3c;
  font-size: 16px;
}

.certificate-summary p:last-child,
.renewal-panel p:last-child {
  margin: 0;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.65;
}

.certificate-actions {
  display: flex;
  align-items: center;
  gap: 9px;
}

.certificate-healthy {
  color: #16867b;
  background: var(--cyan-soft);
}

.certificate-warning {
  color: var(--amber);
  background: var(--amber-soft);
}

.certificate-unknown {
  color: #788498;
  background: #eef1f5;
}

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

.certificate-grid > .empty-state {
  min-height: 250px;
  grid-column: 1 / -1;
}

.certificate-card {
  min-width: 0;
}

.certificate-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.certificate-card-head h3 {
  margin: 0;
  color: #263246;
  font-size: 15px;
  overflow-wrap: anywhere;
}

.certificate-card-head > span {
  padding: 5px 8px;
  border-radius: 999px;
  color: #16867b;
  font-size: 8px;
  background: var(--cyan-soft);
}

.certificate-card.warning .certificate-card-head > span {
  color: var(--amber);
  background: var(--amber-soft);
}

.certificate-card.expired .certificate-card-head > span {
  color: var(--red);
  background: var(--red-soft);
}

.certificate-card dl {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin: 22px 0 16px;
}

.certificate-card dl div {
  min-width: 0;
}

.certificate-card dt {
  margin-bottom: 5px;
  color: #9aa4b4;
  font-size: 8px;
}

.certificate-card dd {
  margin: 0;
  color: #526075;
  font-size: 9px;
  line-height: 1.55;
  overflow-wrap: anywhere;
}

.certificate-fingerprint {
  padding-top: 13px;
  border-top: 1px solid #edf0f4;
}

.certificate-fingerprint span,
.certificate-fingerprint code {
  display: block;
}

.certificate-fingerprint span {
  margin-bottom: 6px;
  color: #9aa4b4;
  font-size: 8px;
}

.certificate-fingerprint code {
  color: #6a778c;
  font: 8px/1.55 "SFMono-Regular", Consolas, monospace;
  overflow-wrap: anywhere;
}

.renewal-panel {
  justify-content: flex-start;
}

.renewal-icon {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  flex: 0 0 44px;
  border: 1px solid #d8eee9;
  border-radius: 13px;
  color: var(--cyan);
  font-size: 20px;
  background: var(--cyan-soft);
}

.renewal-panel > div:nth-child(2) {
  flex: 1;
}

.renewal-panel dl {
  display: flex;
  gap: 28px;
  margin: 0;
}

.renewal-panel dt {
  margin-bottom: 5px;
  color: #9aa4b4;
  font-size: 8px;
}

.renewal-panel dd {
  margin: 0;
  color: #526075;
  font-size: 10px;
  white-space: nowrap;
}

/* Settings */
.settings-layout {
  display: grid;
  grid-template-columns: minmax(560px, 1.45fr) minmax(270px, 0.55fr);
  gap: 13px;
}

.settings-form label {
  display: block;
  margin: 16px 0;
  color: #69768a;
  font-size: 10px;
}

.settings-form input,
.settings-form select {
  width: 100%;
  height: 42px;
  margin-top: 7px;
  padding: 0 12px;
  border: 1px solid #dce2ea;
  border-radius: 10px;
  outline: 0;
  color: #344055;
  background: #fafbfd;
  transition: border-color 0.16s ease, box-shadow 0.16s ease, background 0.16s ease;
}

.settings-form input:focus,
.settings-form select:focus {
  border-color: #7c91eb;
  background: #fff;
  box-shadow: 0 0 0 3px rgba(79, 107, 237, 0.09);
}

.settings-form label small {
  display: block;
  margin-top: 6px;
  color: #98a2b1;
  font-size: 8px;
  line-height: 1.55;
}

.settings-form .switch-label {
  width: auto;
  display: flex;
  align-items: center;
  gap: 9px;
  margin: 0;
  color: #788498;
}

.settings-form .switch-label input {
  display: none;
  width: auto;
  height: auto;
  margin: 0;
  padding: 0;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.secret-field {
  position: relative;
}

.secret-field input {
  padding-right: 70px;
}

.secret-field button {
  position: absolute;
  top: 14px;
  right: 7px;
  height: 28px;
  padding: 0 9px;
  border: 0;
  border-radius: 7px;
  color: #687589;
  font-size: 8px;
  background: #edf1f5;
  cursor: pointer;
}

.form-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-top: 22px;
}

.security-card {
  position: sticky;
  top: 24px;
  align-self: start;
  background:
    linear-gradient(145deg, rgba(20, 159, 145, 0.035), transparent 48%),
    rgba(255, 255, 255, 0.94);
}

.security-icon {
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  margin-bottom: 28px;
  border: 1px solid #d8eee9;
  border-radius: 12px;
  color: var(--cyan);
  font-size: 19px;
  background: var(--cyan-soft);
}

.security-card h3 {
  margin-bottom: 10px;
  color: #223044;
  font-size: 18px;
}

.security-card > p:not(.eyebrow) {
  color: #7a8799;
  font-size: 10px;
  line-height: 1.8;
}

.security-card code {
  color: #4c62c4;
}

.security-card ul {
  margin: 16px 0 0;
  padding: 15px 0 0;
  border-top: 1px solid #e9edf2;
  list-style: none;
}

.security-card li {
  padding: 6px 0;
  color: #7d899a;
  font-size: 9px;
  line-height: 1.5;
}

.security-card li::before {
  content: "✓";
  margin-right: 8px;
  color: var(--cyan);
}

.passkey-manager {
  margin-top: 18px;
  padding: 15px;
  border: 1px solid #dfe5ff;
  border-radius: 13px;
  background: #f8faff;
}

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

.passkey-heading strong,
.passkey-heading small {
  display: block;
}

.passkey-heading strong {
  color: #3f4c63;
  font-size: 11px;
}

.passkey-heading small,
.passkey-manager > small {
  margin-top: 4px;
  color: #929daf;
  font-size: 8px;
  line-height: 1.5;
}

.passkey-heading > span {
  min-width: 24px;
  padding: 3px 7px;
  border-radius: 999px;
  color: #4961ca;
  font-size: 9px;
  text-align: center;
  background: #e7ecff;
}

.passkey-list {
  display: grid;
  gap: 7px;
  margin: 12px 0;
}

.passkey-list > p {
  margin: 0;
  color: #8b96a7;
  font-size: 9px;
}

.passkey-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  padding: 9px 10px;
  border: 1px solid #e2e7f1;
  border-radius: 9px;
  background: #fff;
}

.passkey-item strong,
.passkey-item small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.passkey-item strong {
  color: #536074;
  font-size: 9px;
}

.passkey-item small {
  margin-top: 3px;
  color: #a0a9b7;
  font-size: 7px;
}

.passkey-remove {
  padding: 3px 0;
  border: 0;
  color: #c15465;
  font-size: 8px;
  background: transparent;
  cursor: pointer;
}

.passkey-manager .button {
  width: 100%;
  min-height: 35px;
  font-size: 9px;
}

.passkey-manager > small {
  display: block;
  text-align: center;
}

.intent-section {
  margin: 18px 0;
  padding: 15px;
  border: 1px solid #dfe4eb;
  border-radius: 13px;
  background: #f8fafc;
}

.intent-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 11px;
}

.intent-heading strong,
.intent-heading small {
  display: block;
}

.intent-heading strong {
  color: #566276;
  font-size: 10px;
}

.intent-heading small {
  margin-top: 4px;
  color: #9aa4b3;
  font-size: 8px;
}

.intent-heading > div:last-child {
  display: flex;
  gap: 6px;
}

.intent-heading button {
  height: 28px;
  padding: 0 9px;
  border: 1px solid #dce2ea;
  border-radius: 7px;
  color: #67758b;
  font-size: 8px;
  background: #fff;
  cursor: pointer;
}

.intent-heading button:hover {
  border-color: #9daceb;
  color: #485fc5;
}

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

.settings-form .intent-option {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 9px;
  margin: 0;
  padding: 10px;
  border: 1px solid #e3e7ed;
  border-radius: 9px;
  background: #fff;
  cursor: pointer;
  transition: border-color 0.16s ease, background 0.16s ease;
}

.settings-form .intent-option:hover {
  border-color: #cbd3df;
  background: #fbfcfe;
}

.settings-form .intent-option:has(input:checked) {
  border-color: #bdc9fa;
  background: #f1f4ff;
}

.settings-form .intent-option input {
  appearance: none;
  width: 15px;
  height: 15px;
  display: grid;
  place-items: center;
  margin: 0;
  padding: 0;
  border: 1px solid #c3cad5;
  border-radius: 4px;
  background: #fff;
}

.settings-form .intent-option input:checked {
  border-color: var(--primary);
  background: var(--primary);
}

.settings-form .intent-option input:checked::after {
  content: "✓";
  color: #fff;
  font-size: 10px;
}

.intent-option span {
  min-width: 0;
}

.intent-option span strong {
  display: block;
  color: #536074;
  font-size: 9px;
}

.settings-form .intent-option span small {
  display: block;
  margin-top: 3px;
  overflow: hidden;
  color: #9aa4b3;
  font-size: 7px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.intent-option em {
  padding: 3px 5px;
  border-radius: 5px;
  color: #7b8ba2;
  font-size: 6px;
  font-style: normal;
  white-space: nowrap;
  background: #eef2f6;
}

.intent-option em.permission {
  color: #ad742b;
  background: #fff4df;
}

.intent-warning {
  margin: 10px 1px 0;
  color: #9b743d;
  font-size: 8px;
  line-height: 1.6;
}

/* Toast and plugin modal */
.toast {
  position: fixed;
  top: 24px;
  right: 26px;
  z-index: 100;
  max-width: min(420px, calc(100vw - 32px));
  padding: 11px 15px;
  border: 1px solid #dce2ea;
  border-radius: 10px;
  color: #3e4b5f;
  font-size: 10px;
  line-height: 1.5;
  opacity: 0;
  background: #fff;
  box-shadow: 0 16px 40px rgba(27, 39, 62, 0.15);
  pointer-events: none;
  transform: translateY(-10px);
  transition: 0.22s ease;
}

.toast.show {
  opacity: 1;
  transform: none;
}

.toast.error {
  border-color: #f3c5cc;
  color: #c64e5e;
  background: #fff7f8;
}

.plugin-modal {
  position: fixed;
  inset: 0;
  z-index: 90;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 26px;
  background: rgba(39, 48, 66, 0.42);
  backdrop-filter: blur(10px);
}

.plugin-modal.open {
  display: flex;
}

.plugin-modal-shell {
  width: min(1100px, 96vw);
  height: min(820px, 92vh);
  overflow: hidden;
  border: 1px solid #d9dfe7;
  border-radius: 18px;
  background: #fff;
  box-shadow: 0 38px 100px rgba(25, 35, 54, 0.28);
}

.plugin-modal-head {
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 19px;
  border-bottom: 1px solid #e5e9ef;
  background: #fafbfc;
}

.plugin-modal-head span,
.plugin-modal-head strong {
  display: block;
}

.plugin-modal-head span {
  color: #9aa4b2;
  font-size: 7px;
  letter-spacing: 1.5px;
}

.plugin-modal-head strong {
  margin-top: 3px;
  color: #354055;
  font-size: 12px;
}

.plugin-modal-head button {
  width: 32px;
  height: 32px;
  border: 1px solid #dce2ea;
  border-radius: 9px;
  color: #738095;
  font-size: 19px;
  background: #fff;
  cursor: pointer;
}

.plugin-modal iframe {
  width: 100%;
  height: calc(100% - 60px);
  border: 0;
  background: #fff;
}

@media (max-width: 1120px) {
  .sidebar {
    width: 82px;
    padding: 22px 12px 18px;
  }

  .brand {
    justify-content: center;
    padding: 0 0 28px;
  }

  .brand > div:not(.brand-mark),
  .nav-label,
  .nav-item > span:not(.nav-icon),
  .nav-item em,
  .sidebar-foot small,
  .mini-status span {
    display: none;
  }

  .nav-item {
    justify-content: center;
    padding: 0;
  }

  .sidebar-foot {
    padding-left: 0;
    padding-right: 0;
  }

  .mini-status {
    justify-content: center;
  }

  main {
    margin-left: 82px;
    padding: 28px;
  }

  .overview-grid,
  .settings-layout {
    grid-template-columns: 1fr;
  }

  .security-card {
    position: static;
  }
}

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

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

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

  .toolbar {
    flex-wrap: wrap;
  }

  .search {
    flex-basis: 100%;
  }
}

@media (max-width: 700px) {
  body {
    padding-bottom: 74px;
  }

  .sidebar {
    inset: auto 0 0;
    width: 100%;
    height: 66px;
    display: block;
    padding: 8px 10px;
    border-top: 1px solid var(--line);
    border-right: 0;
    background: rgba(250, 251, 252, 0.96);
  }

  .brand,
  .sidebar-foot,
  .nav-label {
    display: none;
  }

  .sidebar nav {
    height: 100%;
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 3px;
  }

  .nav-item {
    min-height: 0;
    height: 100%;
  }

  .nav-icon {
    font-size: 18px;
  }

  main {
    margin-left: 0;
    padding: 20px 14px 28px;
  }

  header {
    align-items: flex-start;
    margin-bottom: 20px;
  }

  .eyebrow,
  .page-description,
  .connection-pill,
  .header-actions .ghost {
    display: none;
  }

  h1 {
    font-size: 25px;
  }

  .hero-card {
    min-height: 0;
    align-items: flex-start;
    flex-direction: column;
    padding: 21px;
  }

  .hero-actions {
    width: 100%;
  }

  .hero-actions .button {
    flex: 1;
  }

  .certificate-summary,
  .renewal-panel {
    align-items: stretch;
    flex-direction: column;
  }

  .certificate-actions {
    justify-content: space-between;
  }

  .renewal-panel dl {
    justify-content: space-between;
  }

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

  .metric {
    padding: 15px;
  }

  .metric strong {
    font-size: 18px;
  }

  .overview-grid,
  .form-row,
  .intent-grid {
    grid-template-columns: 1fr;
  }

  .plugins-intro {
    align-items: flex-start;
  }

  .plugins-intro > div > p:last-child {
    display: none;
  }

  .plugin-card {
    padding: 17px;
  }

  .plugin-actions {
    flex-wrap: wrap;
  }

  .plugin-actions .button {
    flex: 1;
  }

  .event-facts {
    grid-template-columns: 1fr 1fr;
  }

  .event-facts > .event-fact:nth-child(2) {
    border-right: 0;
  }

  .event-facts > .event-fact:nth-child(-n + 2) {
    border-bottom: 1px solid #e4e9ef;
  }

  .event-technical-id {
    grid-template-columns: 1fr auto;
  }

  .event-technical-id > span {
    grid-column: 1 / -1;
  }

  .log-line {
    grid-template-columns: 58px 58px minmax(0, 1fr);
    gap: 7px;
  }

  .logs {
    padding: 5px 10px;
  }

  .settings-form,
  .security-card {
    padding: 18px;
  }
}

@media (max-width: 430px) {
  .header-actions .button.primary {
    padding: 0 12px;
  }

  .toolbar select,
  .toolbar .button {
    flex: 1;
  }

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

  .switch-label {
    margin-left: 0;
  }

  .form-actions {
    align-items: stretch;
    flex-direction: column;
  }
}
body.auth-pending > aside,
body.auth-pending > main,
body.auth-required > aside,
body.auth-required > main,
body.auth-pending > .plugin-modal,
body.auth-required > .plugin-modal {
  display: none;
}

.auth-screen {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: grid;
  place-items: center;
  padding: 24px;
}

.auth-screen[hidden] {
  display: none;
}

.auth-card {
  width: min(420px, 100%);
  padding: 36px;
  border: 1px solid rgba(216, 223, 232, 0.9);
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 28px 80px rgba(25, 38, 58, 0.18);
  backdrop-filter: blur(18px);
}

.auth-card .brand-mark {
  margin-bottom: 24px;
}

.auth-card h1 {
  margin: 6px 0 10px;
  font-size: 28px;
}

.auth-card > p:not(.eyebrow):not(.auth-error) {
  margin: 0 0 24px;
  color: #667085;
}

.auth-card label {
  display: block;
  margin-bottom: 8px;
  color: #344054;
  font-weight: 650;
}

.auth-card input {
  width: 100%;
  margin-bottom: 16px;
}

.auth-card .button {
  width: 100%;
  margin-top: 4px;
}

.auth-divider {
  position: relative;
  margin: 18px 0 10px;
  color: #98a2b3;
  font-size: 11px;
  text-align: center;
}

.auth-divider::before {
  content: "";
  position: absolute;
  top: 50%;
  right: 0;
  left: 0;
  border-top: 1px solid #e5e9ef;
}

.auth-divider span {
  position: relative;
  padding: 0 10px;
  background: #fff;
}

.auth-card > small {
  display: block;
  margin-top: 16px;
  color: #98a2b3;
  text-align: center;
}

.auth-error {
  margin: 0 0 12px;
  color: #b42318;
  font-size: 13px;
}

