:root {
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: #172033;
  background: #f7f8fb;
}
* { box-sizing: border-box; }
body { margin: 0; }
header { background: white; border-bottom: 1px solid #e4e7ec; }
nav { max-width: 1100px; margin: 0 auto; padding: 16px 22px; display: flex; align-items: center; justify-content: space-between; }
.brand { font-weight: 800; font-size: 20px; color: #172033; text-decoration: none; }
main { max-width: 1100px; margin: 0 auto; padding: 48px 22px 72px; }
.hero { max-width: 760px; padding: 50px 0; }
h1 { font-size: clamp(38px, 7vw, 66px); line-height: 1.02; margin: 0 0 20px; letter-spacing: -0.035em; }
h2 { margin-top: 0; }
h3 { margin: 0 0 6px; }
p { line-height: 1.6; color: #526070; }
button, .button {
  border: 0;
  border-radius: 9px;
  background: #172033;
  color: white;
  padding: 11px 16px;
  font: inherit;
  font-weight: 650;
  cursor: pointer;
  text-decoration: none;
  display: inline-block;
}
button.secondary { background: white; color: #172033; border: 1px solid #cfd5df; }
button.danger { background: white; color: #8b1d1d; border: 1px solid #e5b8b8; }
button:disabled { opacity: .55; cursor: default; }
.card { background: white; border: 1px solid #e1e5eb; border-radius: 14px; padding: 24px; margin: 18px 0; box-shadow: 0 3px 16px rgba(20,30,50,.04); }
.card-title-row { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; }
.card-title-row p { margin: 2px 0 0; }
.key-row { display: grid; grid-template-columns: 1fr auto; gap: 10px; margin: 10px 0; }
.add-row { display: grid; grid-template-columns: 1fr auto; gap: 10px; margin-top: 14px; }
input, select {
  width: 100%;
  border: 1px solid #cfd5df;
  border-radius: 8px;
  padding: 11px;
  font: 14px system-ui, sans-serif;
  background: #fbfcfe;
  color: #172033;
}
input.key-input { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
.actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 14px; }
.small { font-size: 13px; color: #6b7280; }
.muted { color: #6b7280; }
code { background: #eef1f5; border-radius: 5px; padding: 2px 5px; }
.dashboard-heading { display: flex; justify-content: space-between; gap: 20px; align-items: flex-start; }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid #dce1e8; margin: 20px 0 24px; }
button.tab { background: transparent; color: #586477; border-radius: 8px 8px 0 0; padding: 12px 18px; border-bottom: 3px solid transparent; }
button.tab.active { color: #172033; border-bottom-color: #172033; }
.tab-panel[hidden] { display: none; }
.instance-card { position: relative; }
.instance-name-row { display: grid; grid-template-columns: 1fr auto; gap: 10px; margin: 12px 0 18px; }
.section-label { margin: 20px 0 5px; font-weight: 700; color: #334155; }
.status-pill { display: inline-block; border-radius: 999px; padding: 4px 9px; font-size: 12px; font-weight: 700; background: #eef1f5; color: #526070; }
.status-pill.private { background: #f5f0e8; color: #735c33; }
.status-pill.public { background: #eaf4ec; color: #356341; }
.parent-card { border-style: dashed; }
.logs-toolbar { display: grid; grid-template-columns: minmax(260px, 420px) 1fr; gap: 24px; align-items: end; }
.field-group label { display: block; font-size: 13px; font-weight: 700; margin-bottom: 6px; color: #334155; }
.read-status { font-size: 14px; color: #526070; padding-bottom: 8px; overflow-wrap: anywhere; }
.table-scroll { overflow-x: auto; }
.logs-table { width: 100%; border-collapse: collapse; min-width: 700px; }
.logs-table th, .logs-table td { text-align: left; padding: 11px 10px; border-bottom: 1px solid #e3e6eb; vertical-align: top; }
.logs-table th:first-child, .logs-table td:first-child { white-space: nowrap; width: 210px; }
.logs-table th:nth-child(2), .logs-table td:nth-child(2) { width: 180px; }
.logs-table td.message { white-space: pre-wrap; word-break: break-word; }
.empty-row td { color: #6b7280; font-style: italic; }
.log-table-card { min-height: 240px; }
@media (max-width: 720px) {
  .key-row, .add-row, .instance-name-row, .logs-toolbar { grid-template-columns: 1fr; }
  .card-title-row { display: block; }
  main { padding-top: 32px; }
}

.action-list { display: grid; gap: 10px; margin: 10px 0; }
.action-row { display: grid; grid-template-columns: 1fr auto; gap: 16px; align-items: start; border: 1px solid #e3e6eb; border-radius: 10px; padding: 13px; background: #fbfcfe; }
.compact-actions { margin-top: 0; justify-content: flex-end; }
.action-error { color: #8b1d1d; margin-top: 4px; }
.modal-backdrop { position: fixed; inset: 0; background: rgba(15,23,42,.48); z-index: 1000; padding: 24px; overflow-y: auto; }
.modal-backdrop[hidden] { display: none; }
.modal-card { max-width: 720px; margin: 40px auto; background: white; border-radius: 14px; padding: 24px; box-shadow: 0 20px 70px rgba(0,0,0,.25); }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-top: 18px; }
.action-config { margin-top: 18px; padding-top: 18px; border-top: 1px solid #e3e6eb; }
textarea { width: 100%; border: 1px solid #cfd5df; border-radius: 8px; padding: 11px; font: 14px system-ui, sans-serif; background: #fbfcfe; color: #172033; resize: vertical; }
.checkbox-row { display: flex; align-items: center; gap: 8px; font-size: 14px; font-weight: 650; }
.checkbox-row input { width: auto; }
.modal-actions { justify-content: flex-end; margin-top: 22px; }
.command-card { min-height: 170px; }
@media (max-width: 720px) {
  .action-row, .form-grid { grid-template-columns: 1fr; }
  .compact-actions { justify-content: flex-start; }
  .modal-backdrop { padding: 10px; }
}


/* QR codes --------------------------------------------------------------- */
.qr-panel {
  display: grid;
  grid-template-columns: 240px minmax(0, 1fr);
  gap: 18px;
  align-items: center;
  margin: 14px 0 18px;
  padding: 16px;
  border: 1px solid #dce2ea;
  border-radius: 12px;
  background: #fbfcfe;
}
.qr-heading {
  grid-column: 1 / -1;
  font-size: 13px;
  font-weight: 800;
  color: #334155;
}
.qr-body {
  width: 220px;
  min-height: 220px;
  display: grid;
  place-items: center;
  border: 1px solid #e3e6eb;
  border-radius: 10px;
  background: white;
  overflow: hidden;
}
.qr-image {
  display: block;
  width: 220px;
  height: 220px;
  max-width: 100%;
}
.qr-placeholder {
  padding: 18px;
  color: #6b7280;
  text-align: center;
  font-size: 13px;
}
.qr-placeholder.error { color: #8b1d1d; }
.qr-details p { margin-top: 0; }
.qr-download { margin-top: 4px; }

/* --------------------------------------------------------------------------
   Home page
   -------------------------------------------------------------------------- */
.home-page { background: #f5f7fb; color: #142033; }
.site-header { position: sticky; top: 0; z-index: 20; background: rgba(255,255,255,.94); backdrop-filter: blur(10px); }
.nav-actions { display: flex; align-items: center; gap: 18px; }
.nav-link, .text-link { color: #334155; text-decoration: none; font-weight: 650; }
.nav-link:hover, .text-link:hover { text-decoration: underline; }
.secondary-link { background: white; color: #172033; border: 1px solid #cfd5df; padding: 9px 14px; }
.home-main { max-width: 1160px; padding-top: 0; }
.home-hero { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(360px, .9fr); gap: 64px; align-items: center; min-height: 650px; padding: 76px 0 70px; }
.hero-copy { max-width: 680px; }
.eyebrow { display: inline-block; margin-bottom: 16px; text-transform: uppercase; letter-spacing: .12em; font-size: 12px; font-weight: 800; color: #526070; }
.hero-lede { font-size: 20px; line-height: 1.65; max-width: 650px; margin-bottom: 26px; }
.hero-actions { display: flex; align-items: center; gap: 20px; flex-wrap: wrap; }
.home-primary { padding: 13px 19px; border-radius: 10px; }
.trust-row { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 28px; }
.trust-row span { background: white; border: 1px solid #dce2ea; padding: 7px 10px; border-radius: 999px; font-size: 12px; font-weight: 700; color: #526070; }
.hero-demo { display: grid; gap: 16px; }
.demo-window { background: #111a2b; color: #f8fafc; border-radius: 18px; padding: 24px; box-shadow: 0 26px 70px rgba(15,23,42,.18); }
.demo-window code { display: block; background: #202b3d; color: #e8eef7; border-radius: 9px; padding: 14px; overflow-wrap: anywhere; line-height: 1.5; }
.demo-dots { display: flex; gap: 6px; margin-bottom: 22px; }
.demo-dots span { width: 9px; height: 9px; border-radius: 50%; background: #617087; }
.demo-label { font-size: 12px; text-transform: uppercase; letter-spacing: .1em; color: #aab5c5; font-weight: 800; margin-bottom: 9px; }
.demo-arrow { text-align: center; color: #9ca9bb; padding: 12px 0; }
.demo-result { display: flex; justify-content: space-between; gap: 16px; background: #172438; padding: 14px; border-radius: 9px; }
.demo-result span { color: #b7c1cf; font-size: 13px; }
.compact-demo { background: white; color: #172033; border: 1px solid #dce2ea; box-shadow: 0 12px 34px rgba(15,23,42,.07); }
.compact-demo .demo-label { color: #64748b; }
.compact-demo code { background: #eef2f7; color: #172033; }
.compact-demo p { margin-bottom: 0; font-size: 13px; }
.home-section { padding: 72px 0; border-top: 1px solid #dfe4eb; }
.value-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
.feature-card { background: white; border: 1px solid #dfe4eb; border-radius: 16px; padding: 26px; }
.feature-card h2 { font-size: 20px; margin: 10px 0; }
.feature-number { font: 700 12px ui-monospace, monospace; color: #7b8797; }
.section-heading { font-size: clamp(30px, 4vw, 44px); line-height: 1.08; letter-spacing: -.025em; margin: 0; }
.split-section { display: grid; grid-template-columns: .85fr 1.15fr; gap: 70px; align-items: start; }
.steps { display: grid; gap: 0; }
.step { padding: 20px 0; border-bottom: 1px solid #dfe4eb; }
.step:first-child { padding-top: 0; }
.step p { margin-bottom: 0; }
.action-key-feature { display: grid; grid-template-columns: 1fr 1fr; gap: 60px; align-items: center; }
.compare-card { background: #111a2b; color: white; border-radius: 18px; overflow: hidden; box-shadow: 0 24px 60px rgba(15,23,42,.15); }
.compare-row { padding: 20px 22px; border-bottom: 1px solid #2a3548; }
.compare-row:last-child { border-bottom: 0; }
.compare-row span { display: block; font-size: 12px; font-weight: 800; text-transform: uppercase; letter-spacing: .08em; color: #aeb9c8; margin-bottom: 9px; }
.compare-row code { display: block; background: #202b3d; color: #f8fafc; padding: 11px; overflow-wrap: anywhere; }
.compare-row small { display: block; color: #b5c0cf; margin-top: 9px; line-height: 1.5; }
.compare-row.preferred { background: #172438; }
.security-section { display: grid; grid-template-columns: .85fr 1.15fr; gap: 70px; }
.security-list p { margin-top: 0; padding-bottom: 16px; border-bottom: 1px solid #dfe4eb; }
.home-cta { margin: 40px 0 80px; background: #172033; color: white; border-radius: 20px; padding: 34px; display: flex; justify-content: space-between; align-items: center; gap: 28px; }
.home-cta h2 { font-size: 30px; margin: 0 0 6px; }
.home-cta p { margin: 0; color: #c6cfdb; }
.home-cta .home-primary { background: white; color: #172033; white-space: nowrap; }
.site-footer { max-width: 1160px; margin: 0 auto; padding: 26px 22px 48px; border-top: 1px solid #dfe4eb; display: flex; justify-content: space-between; gap: 20px; color: #6b7280; font-size: 13px; }

/* Action-token dashboard controls */
.action-key-list { display: grid; gap: 12px; margin: 10px 0; }
.action-key-row { border: 1px solid #dce2ea; background: #fbfcfe; border-radius: 12px; padding: 14px; }
.action-key-row .key-row { margin-bottom: 0; }
.key-message { margin-top: 5px; white-space: pre-wrap; overflow-wrap: anywhere; color: #526070; }
.key-security-note { margin-top: 18px; box-shadow: none; background: #f8fafc; }
.key-security-note p { margin-bottom: 0; }
.form-grid.single-column { grid-template-columns: 1fr; }

@media (max-width: 820px) {
  .home-hero, .action-key-feature, .split-section, .security-section { grid-template-columns: 1fr; gap: 36px; }
  .home-hero { min-height: 0; padding: 58px 0; }
  .value-grid { grid-template-columns: 1fr; }
  .nav-link { display: none; }
  .home-cta { align-items: flex-start; flex-direction: column; }
}

@media (max-width: 720px) {
  .qr-panel { grid-template-columns: 1fr; }
  .qr-heading { grid-column: 1; }
  .qr-body { width: min(220px, 100%); }
}


/* Log sorting and filtering ------------------------------------------------ */
.logs-filter-grid {
  display: grid;
  grid-template-columns: minmax(240px, 2fr) minmax(150px, .8fr) minmax(150px, .8fr) minmax(150px, .8fr) auto;
  gap: 14px;
  align-items: end;
}
.log-search-field { min-width: 0; }
.filter-help { margin-top: 5px; color: #6b7280; font-size: 12px; }
.filter-actions { display: flex; gap: 8px; align-items: center; padding-bottom: 1px; }
#logFilterSummary { margin: 12px 0 0; }
@media (max-width: 980px) {
  .logs-filter-grid { grid-template-columns: 1fr 1fr; }
  .log-search-field { grid-column: 1 / -1; }
  .filter-actions { grid-column: 1 / -1; }
}
@media (max-width: 620px) {
  .logs-filter-grid { grid-template-columns: 1fr; }
  .log-search-field, .filter-actions { grid-column: 1; }
}
