:root {
  color-scheme: light;
  --bg: #f6f7f8;
  --panel: #ffffff;
  --ink: #161a1d;
  --muted: #5f6b73;
  --line: #d7dde2;
  --accent: #0f766e;
  --accent-strong: #0b5f59;
  --warn: #b45309;
  --danger: #b42318;
  --ok-bg: #e7f6f2;
  --warn-bg: #fff4df;
  --idle-bg: #eef1f4;
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
}

button,
input {
  font: inherit;
}

.topbar {
  min-height: 88px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 20px clamp(18px, 4vw, 44px);
  background: #ffffff;
  border-bottom: 1px solid var(--line);
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--accent);
  font-size: 0.76rem;
  font-weight: 700;
  text-transform: uppercase;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: clamp(1.35rem, 2vw, 2rem);
  line-height: 1.1;
}

h2 {
  font-size: 1rem;
  line-height: 1.2;
}

.tenant-block {
  display: grid;
  gap: 2px;
  min-width: 180px;
  text-align: right;
}

.tenant-label {
  color: var(--muted);
  font-size: 0.8rem;
}

.workspace {
  display: grid;
  grid-template-columns: minmax(280px, 360px) minmax(0, 1fr);
  grid-template-areas:
    "login modules"
    "blob events";
  gap: 18px;
  padding: 22px clamp(18px, 4vw, 44px) 40px;
}

.login-panel,
.modules-panel,
.blob-panel,
.events-panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 18px;
}

.login-panel {
  grid-area: login;
}

.modules-panel {
  grid-area: modules;
}

.blob-panel {
  grid-area: blob;
}

.events-panel {
  grid-area: events;
  min-height: 340px;
}

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

.status {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 10px;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 700;
  white-space: nowrap;
}

.status-idle {
  color: var(--muted);
  background: var(--idle-bg);
}

.status-ok {
  color: var(--accent-strong);
  background: var(--ok-bg);
}

.status-warn {
  color: var(--warn);
  background: var(--warn-bg);
}

.status-error {
  color: var(--danger);
  background: #fde8e5;
}

.login-form {
  display: grid;
  gap: 12px;
}

label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 700;
}

input {
  width: 100%;
  min-height: 42px;
  padding: 0 12px;
  color: var(--ink);
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 6px;
}

input:focus {
  outline: 3px solid rgba(15, 118, 110, 0.18);
  border-color: var(--accent);
}

button {
  min-height: 42px;
  padding: 0 14px;
  border: 0;
  border-radius: 6px;
  color: #ffffff;
  background: var(--accent);
  font-weight: 800;
  cursor: pointer;
}

button:hover {
  background: var(--accent-strong);
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.56;
}

button.secondary {
  color: var(--ink);
  background: #eef1f4;
}

button.secondary:hover {
  background: #e1e7eb;
}

.session-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
  margin: 16px 0 0;
}

.session-grid div {
  display: grid;
  grid-template-columns: 76px minmax(0, 1fr);
  gap: 8px;
}

dt {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 700;
}

dd {
  min-width: 0;
  margin: 0;
  overflow-wrap: anywhere;
}

.message {
  min-height: 20px;
  margin-top: 14px;
  color: var(--muted);
  font-size: 0.9rem;
}

.module-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 12px;
}

.module-card {
  display: grid;
  gap: 12px;
  min-height: 132px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfd;
}

.module-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.module-title strong {
  text-transform: capitalize;
}

.module-meta {
  color: var(--muted);
  font-size: 0.86rem;
  overflow-wrap: anywhere;
}

.output {
  min-height: 142px;
  max-height: 260px;
  margin: 0;
  padding: 12px;
  overflow: auto;
  border-radius: 6px;
  background: #101518;
  color: #dbe9e6;
  font-size: 0.82rem;
  line-height: 1.45;
}

.event-log {
  display: grid;
  gap: 10px;
  min-height: 268px;
  max-height: 520px;
  margin: 0;
  padding: 0;
  overflow: auto;
  list-style: none;
}

.event-item {
  display: grid;
  gap: 6px;
  padding: 12px;
  border: 1px solid var(--line);
  border-left: 4px solid var(--accent);
  border-radius: 6px;
  background: #fbfcfd;
}

.event-subject {
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: 0.82rem;
  overflow-wrap: anywhere;
}

.event-payload {
  margin: 0;
  color: var(--muted);
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: 0.78rem;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

@media (max-width: 860px) {
  .topbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .tenant-block {
    width: 100%;
    text-align: left;
  }

  .workspace {
    grid-template-columns: 1fr;
    grid-template-areas:
      "login"
      "modules"
      "blob"
      "events";
  }
}
