:root {
    --ink: #172333;
    --muted: #6c7888;
    --line: #e5e9ee;
    --paper: #f5f7f9;
    --white: #fff;
    --nav: #172330;
    --nav-soft: #243444;
    --teal: #18a689;
    --teal-dark: #0d7d69;
    --mint: #dff6ef;
    --blue: #4d7eff;
    --danger: #d85252;
    --shadow: 0 8px 30px rgba(20, 35, 50, .07);
}

* { box-sizing: border-box; }
html, body { min-height: 100%; }
body { margin: 0; color: var(--ink); background: var(--paper); font-family: "Segoe UI", Arial, sans-serif; }
a { color: var(--teal-dark); text-decoration: none; }
button, input { font: inherit; }
h1, h2, h3, p { margin-top: 0; }
h1, h2, h3 { font-family: "Segoe UI", Arial, sans-serif; }
h1 { margin-bottom: 0; font-size: 29px; letter-spacing: -.6px; }
h2 { margin: 4px 0 0; font-size: 20px; letter-spacing: -.25px; }
h3 { margin-bottom: 8px; font-size: 16px; }

.app-shell { padding-left: 260px; }
.sidebar { position: fixed; inset: 0 auto 0 0; width: 260px; padding: 30px 22px; background: var(--nav); color: #dce5ec; display: flex; flex-direction: column; z-index: 10; }
.brand { display: flex; align-items: center; gap: 12px; color: #fff; font: 700 18px "Manrope", sans-serif; }
.brand small { display: block; margin-top: 2px; color: #8396a7; font: 500 10px "DM Sans", sans-serif; text-transform: uppercase; letter-spacing: 1.5px; }
.brand-mark { width: 38px; height: 38px; border-radius: 12px; display: grid; place-items: center; background: var(--teal); color: white; box-shadow: 0 7px 18px rgba(24, 166, 137, .24); }
.brand-mark img { width: 31px; height: 31px; object-fit: contain; }
.sidebar .brand > span:last-child { font-size: 15px; }
.sidebar nav { margin-top: 44px; display: grid; gap: 7px; }
.sidebar nav a { display: flex; gap: 13px; align-items: center; padding: 12px 14px; border-radius: 9px; color: #aebdca; font-weight: 600; font-size: 14px; }
.sidebar nav a span { width: 20px; color: #7f96a7; font-size: 18px; }
.sidebar nav a:hover, .sidebar nav a.active { background: var(--nav-soft); color: white; }
.sidebar nav a.active { box-shadow: inset 3px 0 var(--teal); }
.nav-label { margin: 28px 14px 8px; color: #617486; text-transform: uppercase; letter-spacing: 1.6px; font-size: 10px; font-weight: 700; }
.sidebar-foot { margin-top: auto; padding: 18px 12px 0; border-top: 1px solid #2b3b49; color: #8295a5; font-size: 12px; }
.status-dot { width: 8px; height: 8px; margin-right: 7px; display: inline-block; border-radius: 50%; background: #3fd3a9; box-shadow: 0 0 0 4px rgba(63, 211, 169, .1); }
.link-button { padding: 16px 0 0; border: 0; color: #aebdca; background: none; cursor: pointer; }
.link-button:hover { color: white; }

.main { min-height: 100vh; }
.topbar { min-height: 104px; padding: 25px 42px; background: white; border-bottom: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; }
.eyebrow { color: #8a95a1; font-size: 10px; text-transform: uppercase; letter-spacing: 1.65px; font-weight: 700; }
.user-chip { display: flex; align-items: center; gap: 10px; font-size: 13px; font-weight: 700; }
.user-chip > span, .table-user > span { width: 38px; height: 38px; display: grid; place-items: center; border-radius: 50%; color: var(--teal-dark); background: var(--mint); }
.user-chip small, .table-user small { display: block; color: var(--muted); font-size: 11px; font-weight: 500; }
.content { max-width: 1500px; margin: auto; padding: 34px 42px 55px; }
.card { padding: 24px; border: 1px solid #e7ebef; border-radius: 14px; background: white; box-shadow: var(--shadow); }
.card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; }
.alert { margin-bottom: 22px; padding: 13px 16px; border-radius: 9px; font-size: 13px; font-weight: 600; }
.alert.success { color: #176e5d; background: #ddf6ee; border: 1px solid #bceadb; }
.alert.error { color: #9a3838; background: #fff0f0; border: 1px solid #f4cece; }
.pill { display: inline-flex; align-items: center; padding: 5px 10px; border-radius: 20px; font-size: 11px; font-weight: 700; }
.pill.good { color: #177a66; background: var(--mint); }
.pill.danger { color: #a63f3f; background: #ffe7e7; }
.pill.warning { color: #8a641d; background: #fff3d6; }
.button { display: inline-flex; min-height: 41px; padding: 10px 17px; align-items: center; justify-content: center; border: 1px solid transparent; border-radius: 8px; font-weight: 700; font-size: 13px; cursor: pointer; }
.button.primary { color: white; background: var(--teal); box-shadow: 0 6px 15px rgba(24, 166, 137, .18); }
.button.primary:hover { background: var(--teal-dark); }
.button.secondary { color: #334454; border-color: #dce2e7; background: white; }
.button.secondary:hover { border-color: #b8c4cc; background: #f9fbfc; }
.button:disabled, .button[aria-disabled="true"] { cursor: not-allowed; opacity: .55; box-shadow: none; }
.button.danger { color: #a63f3f; border-color: #f0caca; background: #fff4f4; }
.button.danger:hover { border-color: #dc9696; background: #ffe9e9; }
.button.wide { width: 100%; }
.nav-count { min-width: 20px; margin-left: auto; padding: 2px 6px; color: #fff; border-radius: 12px; background: var(--danger); text-align: center; font-size: 10px; }

.hero-grid { display: grid; grid-template-columns: minmax(360px, 1.7fr) repeat(3, minmax(160px, 1fr)); gap: 18px; margin-bottom: 18px; }
.quota-card p { margin: 12px 0 0; color: var(--muted); font-size: 12px; }
.progress { height: 8px; margin-top: 20px; overflow: hidden; border-radius: 8px; background: #edf0f2; }
.progress span { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, #20b494, var(--teal)); }
.stat-card { padding: 23px; border: 1px solid #e7ebef; border-radius: 14px; background: white; box-shadow: var(--shadow); display: flex; align-items: center; gap: 18px; }
.stat-icon { flex: 0 0 48px; height: 48px; display: grid; place-items: center; border-radius: 12px; font-size: 20px; font-weight: 700; }
.stat-icon.up { color: #1b8a73; background: #e2f7f1; }
.stat-icon.down { color: #456bd2; background: #eaf0ff; }
.stat-icon.connections { color: #8a641d; background: #fff3d6; }
.stat-card div > span { display: block; color: var(--muted); font-size: 12px; }
.stat-card strong { display: block; margin: 2px 0; font: 700 26px "Manrope", sans-serif; }
.stat-card small { color: #9ba4ae; }
.live-dot { width: 6px; height: 6px; margin-right: 4px; display: inline-block; border-radius: 50%; background: var(--teal); box-shadow: 0 0 0 3px rgba(24, 166, 137, .1); }
.dashboard-grid { display: grid; grid-template-columns: minmax(450px, 1.7fr) minmax(330px, 1fr); gap: 18px; }
.chart-card { min-height: 305px; }
.legend { display: flex; gap: 15px; color: var(--muted); font-size: 11px; }
.legend i { display: inline-block; width: 8px; height: 8px; margin-right: 5px; border-radius: 2px; }
.legend .pub, .bar.pub { background: var(--teal); }
.legend .recv, .bar.recv { background: #91a8b8; }
.chart { height: 205px; padding: 23px 8px 0; display: flex; align-items: flex-end; justify-content: space-around; border-bottom: 1px solid var(--line); background-image: linear-gradient(#f1f3f5 1px, transparent 1px); background-size: 100% 46px; }
.chart-day { width: 12%; text-align: center; }
.bars { height: 140px; display: flex; align-items: flex-end; justify-content: center; gap: 5px; }
.bar { width: 11px; min-height: 3px; border-radius: 4px 4px 0 0; opacity: .94; }
.chart-day strong { display: block; margin-top: 9px; font-size: 11px; }
.chart-day small { color: #9aa4ad; font-size: 9px; }
.connect-card .lock { padding: 5px 8px; color: #167863; background: var(--mint); border-radius: 6px; font-size: 10px; font-weight: 700; letter-spacing: 1px; }
.credentials { margin: 20px 0; }
.credentials div { display: flex; padding: 9px 0; justify-content: space-between; border-bottom: 1px solid #f0f2f4; gap: 15px; }
.credentials dt { color: var(--muted); font-size: 12px; }
.credentials dd { margin: 0; text-align: right; font-size: 12px; font-weight: 700; word-break: break-all; }
code { padding: 2px 5px; color: #236d62; border-radius: 4px; background: #edf8f5; font: 500 12px Consolas, monospace; }
.hint { color: var(--muted); font-size: 11px; line-height: 1.55; }
.connect-card .hint { margin: 13px 0 0; }
.quickstart { margin-top: 18px; display: grid; grid-template-columns: 280px 1fr; align-items: center; gap: 30px; }
pre { margin: 0; padding: 17px; overflow-x: auto; color: #cae3db; border-radius: 10px; background: #1c2a36; line-height: 1.6; }
pre code { padding: 0; color: inherit; background: none; }
.client-examples { margin-top: 18px; }
.client-examples-heading { display: flex; align-items: center; justify-content: space-between; gap: 24px; }
.client-examples-heading p { max-width: 720px; margin: 8px 0 0; color: var(--muted); font-size: 12px; line-height: 1.6; }
.client-examples-heading .button { flex: 0 0 auto; }
.manual-actions { display: flex; flex: 0 0 auto; gap: 8px; }
.client-example-list { margin-top: 22px; border: 1px solid var(--line); border-radius: 11px; overflow: hidden; }
.client-example { background: #fff; }
.client-example + .client-example { border-top: 1px solid var(--line); }
.client-example summary { padding: 15px 18px; cursor: pointer; display: flex; align-items: center; gap: 10px; font-size: 13px; font-weight: 700; list-style-position: inside; }
.client-example summary:hover { background: #f8fafb; }
.client-example summary small { margin-left: auto; color: var(--muted); font-size: 10px; font-weight: 600; }
.client-example-body { padding: 0 18px 18px; }
.client-example-body pre { max-height: 560px; font-size: 12px; }
.client-example-body .hint { margin: 10px 0 0; }
.snippet-setup { min-height: 47px; padding: 9px 0; display: flex; align-items: center; justify-content: space-between; gap: 15px; }
.snippet-setup > code { overflow-wrap: anywhere; }
.copy-button { flex: 0 0 auto; padding: 7px 10px; color: #334454; border: 1px solid #dce2e7; border-radius: 6px; background: white; cursor: pointer; font-size: 11px; font-weight: 700; }
.copy-button:hover { border-color: var(--teal); color: var(--teal-dark); }

.settings-grid { display: grid; grid-template-columns: minmax(380px, 1fr) minmax(380px, 1fr); gap: 20px; align-items: start; }
.form-card { display: grid; gap: 16px; }
label { display: grid; gap: 7px; color: #3c4a58; font-size: 12px; font-weight: 700; }
input { width: 100%; padding: 11px 12px; color: var(--ink); border: 1px solid #dce2e7; border-radius: 7px; outline: none; background: #fff; }
input:focus { border-color: var(--teal); box-shadow: 0 0 0 3px rgba(24, 166, 137, .1); }
.divider { height: 1px; margin: 4px 0; background: var(--line); }
.readonly-field { padding: 13px; border-radius: 8px; background: #f5f7f8; display: flex; align-items: center; justify-content: space-between; font-size: 12px; }
.cert-card { margin-top: 20px; display: flex; align-items: center; gap: 15px; }
.cert-card p { margin: 4px 0 0; color: var(--muted); font-size: 11px; }
.cert-card div { flex: 1; }
.cert-card h3 { margin: 0; }
.cert-icon { width: 42px; height: 42px; display: grid; place-items: center; border-radius: 10px; color: var(--teal-dark); background: var(--mint); font-size: 22px; }
.toggle-row { grid-template-columns: 1fr auto; align-items: center; padding: 13px 0; border-top: 1px solid var(--line); }
.toggle-row span small { display: block; margin-top: 3px; color: var(--muted); font-weight: 400; }
.toggle-row input { width: 18px; height: 18px; accent-color: var(--teal); }
.certificate-overview { margin-bottom: 18px; display: flex; align-items: center; justify-content: space-between; gap: 24px; }
.certificate-overview p { margin: 8px 0 0; color: var(--muted); font-size: 12px; }
.certificate-status-grid, .certificate-mode-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; margin-bottom: 18px; align-items: start; }
.certificate-status-grid .credentials dd { max-width: 68%; }
.certificate-status-grid .credentials code { overflow-wrap: anywhere; }
.certificate-mode-card { height: 100%; }
.mode-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; }
.certificate-warning { padding: 14px; color: #873d25; border: 1px solid #f0c9b8; border-radius: 9px; background: #fff5ef; }
.certificate-warning strong { display: block; margin-bottom: 5px; }
.certificate-warning p { margin: 0; font-size: 12px; line-height: 1.55; }
.confirmation-check { align-items: flex-start; line-height: 1.5; }
.operation-note { margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--line); font-size: 12px; }
.operation-note strong, .operation-note span, .operation-note small { display: block; }
.operation-note span, .operation-note small { margin-top: 4px; color: var(--muted); }
.profile-banner { display: flex; align-items: center; gap: 16px; margin: -24px -24px 5px; padding: 23px; color: white; border-radius: 14px 14px 0 0; background: linear-gradient(135deg, #1b2d3c, #214d50); }
.profile-banner > span { width: 54px; height: 54px; display: grid; place-items: center; border-radius: 50%; background: rgba(255,255,255,.15); font: 700 21px "Manrope"; }
.profile-banner h2, .profile-banner p { margin: 0 0 2px; }
.profile-banner p { color: #bdd0d2; font-size: 12px; }
.profile-banner code { color: #baf0df; background: rgba(0,0,0,.17); }

.table-toolbar { padding-bottom: 20px; display: flex; align-items: center; justify-content: space-between; gap: 20px; }
.search { display: flex; gap: 8px; width: min(430px, 50%); }
.table-wrap { margin: 0 -24px; overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 12px; }
th { padding: 11px 18px; color: #8d98a4; background: #f7f9fa; text-align: left; text-transform: uppercase; letter-spacing: 1px; font-size: 9px; }
td { padding: 14px 18px; border-top: 1px solid #edf0f2; }
.table-user { display: flex; align-items: center; gap: 10px; min-width: 180px; }
.table-user > span { width: 34px; height: 34px; }
.table-user strong { display: block; }
.row-link { white-space: nowrap; font-weight: 700; }
.empty { padding: 40px; color: var(--muted); text-align: center; }
.compact { margin-top: 18px; }
.pagination { margin-top: 18px; font-size: 12px; }
.pagination nav > div:first-child { display: none; }
.pagination nav > div:last-child { display: flex; justify-content: space-between; align-items: center; }
.pagination svg { width: 14px; }
.back-link { color: var(--teal-dark); }

.auth-shell { min-height: 100vh; padding: 55px 24px; background: radial-gradient(circle at 10% 10%, #dff5ef 0, transparent 30%), radial-gradient(circle at 90% 90%, #dfe9f4 0, transparent 35%), #eef2f4; display: grid; place-items: center; }
.auth-wrap { width: min(100%, 1040px); }
.auth-brand { width: max-content; margin: 0 auto 24px; color: var(--ink); }
.auth-card { overflow: hidden; display: grid; grid-template-columns: .9fr 1.1fr; border-radius: 18px; background: white; box-shadow: 0 24px 80px rgba(24, 42, 54, .15); }
.auth-copy { padding: 55px 45px; color: white; background: linear-gradient(145deg, #172938, #1d4d4d); display: flex; flex-direction: column; justify-content: center; }
.auth-copy .eyebrow { color: #77d5bc; }
.auth-copy h1 { max-width: 350px; margin: 10px 0 15px; font-size: 38px; line-height: 1.12; }
.auth-copy p { max-width: 370px; color: #b7c9ce; line-height: 1.7; font-size: 14px; }
.security-note { margin-top: 25px; color: #d4eee8; font-size: 12px; }
.security-note span, .feature-list span { margin-right: 8px; color: #6fe0bd; }
.feature-list { padding: 0; list-style: none; color: #d3e1e4; line-height: 2.2; font-size: 13px; }
.auth-form { padding: 48px; display: grid; align-content: center; gap: 17px; }
.auth-form h2 { margin-bottom: 5px; }
.check { display: flex; align-items: center; gap: 8px; font-weight: 500; }
.check input { width: 16px; accent-color: var(--teal); }
.form-foot { margin: 4px 0 0; color: var(--muted); text-align: center; font-size: 12px; }
.form-foot a { font-weight: 700; }
.form-help { margin-top: -8px; text-align: right; font-size: 11px; font-weight: 700; }
.register-card { grid-template-columns: .72fr 1.28fr; }
.register-card .auth-form { padding: 38px; }
.field-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 15px; }
.verification-card { max-width: 760px; display: grid; grid-template-columns: auto 1fr; align-items: start; gap: 18px; }
.verification-card form { grid-column: 2; }
.domain-add-form { margin: 20px 0; display: grid; grid-template-columns: 1fr auto; gap: 10px; }
.domain-list { border-top: 1px solid var(--line); }
.domain-list > div { padding: 12px 0; display: flex; align-items: center; justify-content: space-between; gap: 15px; border-bottom: 1px solid var(--line); }
.notification-list { border-top: 1px solid var(--line); }
.notification-list article { padding: 17px 4px; display: grid; grid-template-columns: auto 1fr auto; align-items: start; gap: 14px; border-bottom: 1px solid var(--line); }
.notification-list article.unread { background: #fffaf0; }
.notification-list h3 { margin: 0 0 5px; }
.notification-list p { margin: 0 0 5px; color: var(--muted); font-size: 12px; line-height: 1.5; }
.notification-list small { color: #98a2ad; font-size: 10px; }
.notification-icon { width: 30px; height: 30px; display: grid; place-items: center; color: #8a641d; border-radius: 50%; background: #fff3d6; font-weight: 800; }
.token-reveal { margin-bottom: 20px; color: #714d15; border-color: #ecd49a; background: #fffaf0; }
.token-reveal p { margin: 7px 0 16px; color: #826a42; font-size: 12px; }
.token-copy-row { display: grid; grid-template-columns: 1fr auto; gap: 10px; }
.token-copy-row input { color: #27483f; background: #fff; font-family: Consolas, monospace; font-size: 12px; }
.token-guidance { margin-top: 18px; color: var(--muted); font-size: 12px; line-height: 1.65; }
.token-list-card { margin-top: 20px; }
.table-detail { display: block; max-width: 190px; margin-top: 3px; overflow: hidden; color: var(--muted); text-overflow: ellipsis; white-space: nowrap; }

/* MQTT browser testing console */
.mqtt-console { display: grid; gap: 18px; }
.mqtt-console-intro { min-height: 112px; display: flex; align-items: center; justify-content: space-between; gap: 34px; }
.mqtt-console-intro p { max-width: 780px; margin: 8px 0 0; color: var(--muted); font-size: 13px; line-height: 1.65; }
.mqtt-console-state { flex: 0 0 auto; text-align: right; }
.mqtt-console-state small { max-width: 330px; margin-top: 8px; display: block; overflow-wrap: anywhere; color: var(--muted); font: 500 10px Consolas, monospace; }
.mqtt-state { display: inline-flex; align-items: center; padding: 7px 11px; border-radius: 999px; text-transform: uppercase; letter-spacing: 1px; font-size: 9px; font-weight: 800; }
.mqtt-state i { width: 7px; height: 7px; display: inline-block; border-radius: 50%; }
.mqtt-state.disconnected, .mqtt-state.offline { color: #7a4d4d; background: #f8eaea; }
.mqtt-state.disconnected i, .mqtt-state.offline i { background: #d85252; }
.mqtt-state.connecting { color: #795e25; background: #fff3d6; }
.mqtt-state.connecting i { background: #d99a22; animation: mqtt-pulse 1.2s infinite; }
.mqtt-state.connected { color: #176e5d; background: #ddf6ee; }
.mqtt-state.connected i { background: #18a689; box-shadow: 0 0 0 4px rgba(24,166,137,.12); }
@keyframes mqtt-pulse { 50% { opacity: .35; } }

.mqtt-console-layout { display: grid; grid-template-columns: minmax(380px, 440px) minmax(500px, 1fr); align-items: start; gap: 18px; }
.mqtt-console-controls { display: grid; gap: 18px; }
.mqtt-panel { display: grid; gap: 20px; }
.mqtt-panel-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; }
.mqtt-panel-number { width: 34px; height: 34px; display: grid; place-items: center; color: #6d7e89; border-radius: 10px; background: #f0f3f5; font-size: 10px; font-weight: 800; }
.mqtt-panel form { display: grid; gap: 15px; }
.mqtt-panel select, .mqtt-panel textarea { width: 100%; padding: 11px 12px; color: var(--ink); border: 1px solid #dce2e7; border-radius: 7px; outline: none; background: #fff; }
.mqtt-panel textarea { min-height: 126px; resize: vertical; font: 500 12px/1.6 Consolas, monospace; }
.mqtt-panel select:focus, .mqtt-panel textarea:focus { border-color: var(--teal); box-shadow: 0 0 0 3px rgba(24, 166, 137, .1); }
.mqtt-panel input[readonly] { color: #52636f; background: #f6f8f9; }
.mqtt-form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.mqtt-secret-field { display: grid; grid-template-columns: 1fr auto; }
.mqtt-secret-field input { min-width: 0; border-radius: 7px 0 0 7px; }
.mqtt-secret-field button { padding-inline: 12px; color: var(--teal-dark); border: 1px solid #dce2e7; border-left: 0; border-radius: 0 7px 7px 0; background: #f7faf9; cursor: pointer; font-size: 10px; font-weight: 800; }
.mqtt-secret-field button:hover { background: #eaf7f3; }
.mqtt-check { min-height: 32px; }
.mqtt-retain { min-height: 43px; padding: 0 11px; align-self: end; border: 1px solid #e3e8eb; border-radius: 7px; background: #f8fafb; }
.mqtt-button-row { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; }
.mqtt-panel button:disabled { cursor: not-allowed; opacity: .5; box-shadow: none; }
.mqtt-security-note { margin: 0; padding: 13px; color: #61717c; border: 1px solid #e2e8eb; border-radius: 9px; background: #f7f9fa; font-size: 10px; line-height: 1.55; }
.mqtt-security-note span { margin-right: 6px; }
.mqtt-subscription-list { display: grid; gap: 7px; }
.mqtt-subscription-list > p { margin: 0; padding: 12px; color: var(--muted); border-radius: 8px; background: #f7f9fa; text-align: center; font-size: 10px; }
.mqtt-subscription-list > div { padding: 10px 11px; border: 1px solid #e4e9ec; border-radius: 8px; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.mqtt-subscription-list code { overflow-wrap: anywhere; }
.mqtt-subscription-list span { flex: 0 0 auto; color: #177a66; font-size: 9px; font-weight: 800; }

.mqtt-activity-panel { position: sticky; top: 18px; min-height: 620px; height: calc(100vh - 174px); padding: 0; overflow: hidden; display: grid; grid-template-rows: auto auto 1fr; }
.mqtt-activity-head { min-height: 88px; padding: 22px 24px; border-bottom: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; gap: 20px; }
.mqtt-mini-stats { min-height: 73px; padding: 13px 24px; border-bottom: 1px solid var(--line); background: #f8fafb; display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.mqtt-mini-stats div { padding-right: 12px; border-right: 1px solid #e3e8eb; }
.mqtt-mini-stats div:last-child { border: 0; }
.mqtt-mini-stats span, .mqtt-mini-stats strong { display: block; }
.mqtt-mini-stats span { color: var(--muted); text-transform: uppercase; letter-spacing: 1px; font-size: 8px; font-weight: 800; }
.mqtt-mini-stats strong { margin-top: 3px; font-size: 20px; }
.mqtt-activity-log { min-height: 0; padding: 18px; overflow-y: auto; background: #f2f5f6; }
.mqtt-empty-log { height: 100%; min-height: 330px; display: grid; place-items: center; align-content: center; color: #92a0aa; text-align: center; }
.mqtt-empty-log > span { width: 54px; height: 54px; display: grid; place-items: center; color: #67808d; border-radius: 16px; background: #e4eaed; font-size: 24px; }
.mqtt-empty-log strong { margin-top: 17px; color: #596b76; font-size: 13px; }
.mqtt-empty-log p { max-width: 390px; margin: 7px 0 0; font-size: 11px; line-height: 1.6; }
.mqtt-log-entry { margin-bottom: 10px; padding: 14px; border: 1px solid #e0e6e9; border-left: 3px solid #9eabb3; border-radius: 9px; background: #fff; box-shadow: 0 4px 12px rgba(22,38,50,.04); }
.mqtt-log-entry.success { border-left-color: var(--teal); }
.mqtt-log-entry.error { border-left-color: var(--danger); }
.mqtt-log-entry.received { border-left-color: var(--blue); }
.mqtt-log-entry.published { border-left-color: #18a689; }
.mqtt-log-meta { margin-bottom: 8px; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.mqtt-log-kind { color: #657681; text-transform: uppercase; letter-spacing: 1px; font-size: 8px; font-weight: 800; }
.mqtt-log-meta time { color: #99a4ac; font: 500 9px Consolas, monospace; }
.mqtt-log-entry > strong { display: block; margin-bottom: 7px; font-size: 12px; }
.mqtt-log-topic { max-width: 100%; margin-bottom: 9px; display: inline-block; overflow-wrap: anywhere; }
.mqtt-log-entry pre { max-height: 260px; margin: 0 0 8px; font-size: 11px; white-space: pre-wrap; overflow-wrap: anywhere; }
.mqtt-log-entry > small { display: block; color: #82909a; font-size: 9px; line-height: 1.5; }

/* Public landing page */
html { scroll-behavior: smooth; }
.landing-shell { min-height: 100vh; color: var(--ink); background: #fff; }
.landing-container { width: min(1200px, calc(100% - 48px)); margin-inline: auto; }
.landing-header { position: sticky; top: 0; z-index: 30; border-bottom: 1px solid rgba(219, 227, 232, .82); background: rgba(255, 255, 255, .92); backdrop-filter: blur(18px); }
.landing-nav { min-height: 82px; display: flex; align-items: center; justify-content: space-between; gap: 28px; }
.landing-brand { color: var(--ink); font-size: 16px; letter-spacing: -.2px; }
.landing-brand .brand-mark { width: 43px; height: 43px; border: 1px solid #d5eee7; background: #edf9f6; box-shadow: 0 8px 24px rgba(23, 35, 48, .08); }
.landing-brand .brand-mark img { width: 36px; height: 36px; }
.landing-brand small { color: #788895; }
.landing-nav-links { display: flex; align-items: center; gap: 28px; }
.landing-nav-links > a { color: #51606d; font-size: 13px; font-weight: 700; }
.landing-nav-links > a:not(.button):hover { color: var(--teal-dark); }
.landing-nav-links .button { min-height: 40px; color: #fff; }

.landing-hero { position: relative; min-height: 650px; margin-top: 26px; overflow: hidden; border: 1px solid #dce6e9; border-radius: 28px; background: #edf7f5; box-shadow: 0 28px 80px rgba(28, 52, 66, .12); }
.landing-hero-image { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: center; }
.landing-hero-shade { position: absolute; inset: 0; background: linear-gradient(90deg, rgba(255,255,255,.98) 0%, rgba(255,255,255,.96) 30%, rgba(255,255,255,.78) 44%, rgba(255,255,255,.08) 68%, rgba(255,255,255,0) 100%); }
.landing-hero-copy { position: relative; z-index: 2; width: 54%; min-height: 650px; padding: 72px 0 66px 62px; display: flex; flex-direction: column; justify-content: center; }
.landing-kicker { width: max-content; padding: 8px 12px; color: #296256; border: 1px solid #c8e7de; border-radius: 999px; background: rgba(235, 249, 245, .9); text-transform: uppercase; letter-spacing: 1.3px; font-size: 10px; font-weight: 800; }
.landing-kicker i { width: 7px; height: 7px; margin-right: 7px; display: inline-block; border-radius: 50%; background: var(--teal); box-shadow: 0 0 0 4px rgba(24,166,137,.12); }
.landing-hero h1 { max-width: 610px; margin: 23px 0 20px; color: #172330; font-size: clamp(42px, 4.35vw, 64px); line-height: 1.03; letter-spacing: -2.7px; }
.landing-hero h1 em { color: var(--teal-dark); font-style: normal; }
.landing-hero-copy > p { max-width: 550px; margin-bottom: 28px; color: #5d6d79; font-size: 16px; line-height: 1.72; }
.landing-actions { display: flex; align-items: center; gap: 12px; }
.landing-primary { min-height: 50px; padding-inline: 22px; gap: 16px; font-size: 14px; }
.landing-primary span { font-size: 18px; transition: transform .2s ease; }
.landing-primary:hover span { transform: translateX(3px); }
.landing-secondary { min-height: 50px; padding-inline: 22px; background: rgba(255,255,255,.8); }
.landing-protocols { margin-top: 34px; display: flex; flex-wrap: wrap; gap: 20px; color: #6e7b86; font-size: 11px; }
.landing-protocols span { display: flex; align-items: center; gap: 8px; }
.landing-protocols strong { padding: 5px 8px; color: #226a5c; border-radius: 6px; background: #e5f6f1; font: 800 11px Consolas, monospace; }

.landing-intro { padding-top: 112px; display: grid; grid-template-columns: 1.15fr .85fr; align-items: end; gap: 90px; }
.landing-section-label { display: block; margin-bottom: 12px; color: var(--teal-dark); text-transform: uppercase; letter-spacing: 1.7px; font-size: 10px; font-weight: 800; }
.landing-intro h2, .landing-access h2, .landing-cta h2 { margin: 0; color: #172330; font-size: clamp(31px, 3vw, 43px); line-height: 1.12; letter-spacing: -1.25px; }
.landing-intro > p { margin: 0; color: var(--muted); font-size: 14px; line-height: 1.75; }
.landing-feature-grid { padding: 42px 0 112px; display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }
.landing-feature { min-height: 300px; padding: 30px; border: 1px solid #e1e8eb; border-radius: 18px; background: #fff; box-shadow: 0 12px 36px rgba(25, 44, 57, .06); display: flex; flex-direction: column; }
.landing-feature.featured { border-color: #cce7df; background: linear-gradient(155deg, #f7fcfa, #edf8f5); }
.landing-feature-icon { width: 46px; height: 46px; display: grid; place-items: center; color: #147a66; border-radius: 13px; background: #ddf5ee; font: 800 11px "Segoe UI", sans-serif; letter-spacing: .8px; }
.landing-feature-icon.blue { color: #456bd2; background: #e9efff; }
.landing-feature h3 { margin: 29px 0 12px; color: #1e2c39; font-size: 19px; }
.landing-feature p { margin: 0; color: var(--muted); font-size: 13px; line-height: 1.72; }
.landing-feature-tag { margin-top: auto; padding-top: 26px; color: #89949d; text-transform: uppercase; letter-spacing: 1.2px; font-size: 9px; font-weight: 800; }

.landing-access { min-height: 420px; padding: 66px 72px; color: #fff; border-radius: 25px; background: radial-gradient(circle at 18% 5%, rgba(34,181,150,.2), transparent 38%), linear-gradient(130deg, #172330, #1b353f); display: grid; grid-template-columns: .9fr 1.1fr; align-items: center; gap: 90px; box-shadow: 0 25px 70px rgba(17, 33, 45, .17); }
.landing-section-label.light { color: #6ed7bd; }
.landing-access h2 { color: #fff; }
.landing-access-copy p { max-width: 470px; margin: 20px 0 0; color: #b5c5cc; font-size: 14px; line-height: 1.75; }
.landing-steps { margin: 0; padding: 0; list-style: none; display: grid; gap: 13px; }
.landing-steps li { min-height: 83px; padding: 15px 17px; border: 1px solid rgba(255,255,255,.09); border-radius: 13px; background: rgba(255,255,255,.045); display: flex; align-items: center; gap: 17px; }
.landing-steps li > span { flex: 0 0 39px; height: 39px; display: grid; place-items: center; color: #70d7bd; border-radius: 11px; background: rgba(42,192,157,.11); font-weight: 800; }
.landing-steps strong, .landing-steps small { display: block; }
.landing-steps strong { margin-bottom: 5px; font-size: 13px; }
.landing-steps small { color: #99aeb7; font-size: 11px; line-height: 1.45; }

.landing-cta { margin-top: 34px; margin-bottom: 96px; padding: 32px 38px; border: 1px solid #dfe8eb; border-radius: 19px; background: #f6f9fa; display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 24px; }
.landing-cta img { width: 66px; height: 66px; object-fit: contain; }
.landing-cta .landing-section-label { margin-bottom: 7px; }
.landing-cta h2 { font-size: 25px; letter-spacing: -.6px; }
.landing-cta .button { min-height: 47px; }
.landing-footer { color: #93a2ad; background: #14202c; font-size: 11px; }
.landing-footer .landing-container { min-height: 82px; display: flex; align-items: center; justify-content: space-between; gap: 28px; }

@media (max-width: 1350px) {
    .hero-grid { grid-template-columns: 1fr 1fr; }
    .quota-card { grid-column: 1 / -1; }
}
@media (max-width: 1100px) {
    .dashboard-grid, .quickstart { grid-template-columns: 1fr; }
    .mqtt-console-layout { grid-template-columns: 1fr; }
    .mqtt-activity-panel { position: static; height: 700px; }
    .landing-hero-copy { width: 62%; }
    .landing-access { gap: 50px; }
}
@media (max-width: 800px) {
    .app-shell { padding: 0; }
    .sidebar { position: static; width: auto; height: auto; padding: 18px; }
    .sidebar nav { margin-top: 20px; grid-template-columns: 1fr 1fr; }
    .sidebar-foot, .nav-label { display: none; }
    .topbar, .content { padding-left: 20px; padding-right: 20px; }
    .hero-grid, .settings-grid, .certificate-status-grid, .certificate-mode-grid { grid-template-columns: 1fr; }
    .auth-card { grid-template-columns: 1fr; }
    .auth-copy { padding: 35px; }
    .auth-copy h1 { font-size: 30px; }
    .field-grid { grid-template-columns: 1fr; }
    .table-toolbar { align-items: stretch; flex-direction: column; }
    .search { width: 100%; }
    .client-examples-heading { align-items: flex-start; flex-direction: column; }
    .manual-actions { flex-wrap: wrap; }
    .verification-card { grid-template-columns: 1fr; }
    .verification-card form { grid-column: 1; }
    .mqtt-console-intro { align-items: flex-start; flex-direction: column; }
    .mqtt-console-state { text-align: left; }
    .landing-container { width: min(1200px, calc(100% - 32px)); }
    .landing-nav { min-height: 72px; }
    .landing-nav-links { gap: 14px; }
    .landing-nav-links > a[href^="#"] { display: none; }
    .landing-hero { min-height: 680px; margin-top: 16px; }
    .landing-hero-image { object-position: 62% center; opacity: .54; }
    .landing-hero-shade { background: linear-gradient(180deg, rgba(255,255,255,.99) 0%, rgba(255,255,255,.94) 58%, rgba(255,255,255,.44) 100%); }
    .landing-hero-copy { width: 100%; min-height: 680px; padding: 52px 40px; justify-content: flex-start; }
    .landing-hero h1 { max-width: 560px; font-size: 48px; }
    .landing-hero-copy > p { max-width: 570px; }
    .landing-intro { padding-top: 80px; grid-template-columns: 1fr; gap: 22px; }
    .landing-feature-grid { padding-bottom: 80px; grid-template-columns: 1fr; }
    .landing-feature { min-height: 250px; }
    .landing-access { padding: 48px 38px; grid-template-columns: 1fr; gap: 34px; }
    .landing-cta { grid-template-columns: auto 1fr; }
    .landing-cta .button { grid-column: 1 / -1; }
}
@media (max-width: 500px) {
    .topbar { align-items: flex-start; }
    .user-chip div { display: none; }
    .hero-grid { grid-template-columns: 1fr; }
    .quota-card { grid-column: auto; }
    .auth-form { padding: 30px 24px; }
    .auth-copy { display: none; }
    .cert-card { align-items: flex-start; flex-wrap: wrap; }
    .snippet-setup { align-items: flex-start; flex-direction: column; }
    .domain-add-form { grid-template-columns: 1fr; }
    .token-copy-row { grid-template-columns: 1fr; }
    .mqtt-console-intro { padding: 20px; }
    .mqtt-form-row, .mqtt-button-row { grid-template-columns: 1fr; }
    .mqtt-retain { align-self: auto; }
    .mqtt-activity-panel { height: 620px; min-height: 0; }
    .mqtt-activity-head { padding: 18px; align-items: flex-start; flex-direction: column; }
    .mqtt-mini-stats { padding-inline: 18px; }
    .mqtt-activity-log { padding: 11px; }
    .landing-container { width: min(1200px, calc(100% - 22px)); }
    .landing-brand { font-size: 12px; }
    .landing-brand small { font-size: 8px; letter-spacing: .9px; }
    .landing-brand .brand-mark { width: 36px; height: 36px; border-radius: 10px; }
    .landing-brand .brand-mark img { width: 30px; height: 30px; }
    .landing-nav-links > a:not(.button) { display: none; }
    .landing-nav-links .button { min-height: 36px; padding: 8px 11px; font-size: 11px; }
    .landing-hero { min-height: 660px; border-radius: 19px; }
    .landing-hero-copy { min-height: 660px; padding: 38px 22px; }
    .landing-kicker { font-size: 8px; letter-spacing: .9px; }
    .landing-hero h1 { margin-top: 19px; font-size: 39px; letter-spacing: -1.8px; }
    .landing-hero-copy > p { font-size: 14px; line-height: 1.65; }
    .landing-actions { align-items: stretch; flex-direction: column; }
    .landing-actions .button { width: 100%; }
    .landing-protocols { gap: 10px; }
    .landing-intro { padding-top: 68px; }
    .landing-feature-grid { padding-top: 30px; padding-bottom: 68px; }
    .landing-access { padding: 38px 23px; border-radius: 19px; }
    .landing-cta { margin-bottom: 64px; padding: 25px; grid-template-columns: 1fr; text-align: center; }
    .landing-cta img { margin: auto; }
    .landing-footer .landing-container { padding-block: 22px; align-items: flex-start; flex-direction: column; gap: 8px; }
}
