:root {
  color-scheme: dark;
  --paper: #0d0f12;
  --surface: #181b20;
  --ink: #f5f2ea;
  --muted: #a4abb5;
  --line: #30353d;
  --teal: #f2c230;
  --brass: #f2a900;
  --danger: #ff6b5f;
  --focus: #f2c230;
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
}

[hidden] {
  display: none !important;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

button,
input,
select {
  font: inherit;
}

button {
  border: 1px solid var(--line);
  background: #20242a;
  color: var(--ink);
  min-height: 38px;
  padding: 0 14px;
  border-radius: 6px;
  cursor: pointer;
}

button:hover {
  border-color: var(--teal);
}

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

button:focus-visible,
input:focus-visible,
select:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--focus) 28%, transparent);
  outline-offset: 2px;
}

.topbar {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 24px;
  padding: 28px 32px;
  border: 1px solid rgb(255 255 255 / 8%);
  border-radius: 28px;
  background: #15181d;
}

.topbar p:not(.eyebrow) {
  margin: 6px 0 0;
  color: var(--muted);
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--brass);
  font: 700 12px/1.2 ui-monospace, SFMono-Regular, Menlo, monospace;
  text-transform: uppercase;
}

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

h1 {
  margin-bottom: 0;
  font-size: 28px;
  line-height: 1.1;
}

h2 {
  margin-bottom: 6px;
  font-size: 22px;
}

h3 {
  margin-bottom: 12px;
  font-size: 16px;
}

.filters {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  gap: 12px;
}

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

input,
select {
  min-height: 38px;
  min-width: 150px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #101318;
  color: var(--ink);
  padding: 0 10px;
}

.session-actions input {
  width: min(320px, 36vw);
  min-width: 220px;
  border-radius: 999px;
  background: #f4f2ec;
  color: #181b20;
}

.login-screen {
  display: grid;
  min-height: 100vh;
  place-items: center;
  padding: 18px;
  background: radial-gradient(circle at top, #252921, #0d0f12 52%);
  color: #f4f2ec;
}

.login-frame {
  display: grid;
  width: min(440px, 100%);
  border: 1px solid rgb(255 255 255 / 8%);
  border-radius: 28px;
  background: #15181d;
  box-shadow: 0 32px 90px rgb(0 0 0 / 45%);
  padding: 10px;
}

.login-logo {
  display: grid;
  width: 48px;
  height: 48px;
  margin-bottom: 8px;
  place-items: center;
  border-radius: 999px;
  background: #f4c430;
  color: #16191d;
  font-weight: 900;
}

.login-panel {
  display: grid;
  width: 100%;
  gap: 18px;
  border: 1px solid rgb(255 255 255 / 8%);
  border-radius: 24px;
  background: #f4f2ec;
  color: #181b20;
  padding: 34px;
}

.login-panel h1 {
  margin-bottom: 6px;
  color: #181b20;
  font-size: 30px;
}

.login-panel h2 {
  margin: 0;
  font-size: 22px;
}

.login-panel label {
  color: #6d737c;
}

.login-panel input {
  border-color: #d9d5ca;
  background: #fff;
}

.login-panel input,
.login-panel button,
.account-form input {
  width: 100%;
}

.session-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

#appShell {
  min-height: 100vh;
  background: #0d0f12;
  color: var(--ink);
  padding: 24px;
}

.current-user {
  max-width: 240px;
  overflow: hidden;
  color: var(--muted);
  font-size: 14px;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.shell {
  display: grid;
  grid-template-columns: 92px minmax(0, 1fr);
  gap: 24px;
  min-height: calc(100vh - 150px);
}

.rail {
  display: grid;
  align-content: start;
  gap: 14px;
  border: 0;
  border-radius: 28px;
  background: #15181d;
  padding: 18px 12px;
}

.rail-brand {
  display: grid;
  width: 48px;
  height: 48px;
  margin: 0 auto 12px;
  place-items: center;
  border-radius: 999px;
  background: #f4c430;
  color: #16191d;
  font-weight: 900;
}

.rail button {
  width: 100%;
  min-height: 48px;
  overflow: hidden;
  border-color: transparent;
  border-radius: 18px;
  background: transparent;
  color: #a4abb5;
  padding: 0 8px;
  text-align: center;
}

.rail button.is-active {
  background: #242932;
  color: #f4c430;
}

.status,
.muted {
  color: var(--muted);
  font-size: 13px;
}

.workspace {
  min-width: 0;
  padding: 0;
}

.section-head {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
  border: 0;
  padding-bottom: 0;
}

.section-head p {
  margin-bottom: 0;
  color: var(--muted);
}

.filters {
  border: 1px solid rgb(255 255 255 / 8%);
  border-radius: 28px;
  background: #15181d;
  align-items: end;
  margin-bottom: 18px;
  padding: 18px;
}

.filters button,
.login-panel button,
.account-form button[type="submit"] {
  background: var(--teal);
  border-color: var(--teal);
  color: white;
  font-weight: 700;
}

.login-panel button {
  min-height: 46px;
  border: 0;
  border-radius: 999px;
  background: #181b20;
  color: #fff;
}

.account-form {
  display: grid;
  gap: 14px;
}

.account-layout {
  display: grid;
  grid-template-columns: minmax(260px, 360px) minmax(0, 1fr);
  gap: 20px;
}

.form-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 4px;
}

.form-message {
  min-height: 20px;
  margin: 0;
  color: var(--danger);
  font-size: 13px;
}

.small-button {
  min-height: 30px;
  margin-right: 8px;
  padding: 0 10px;
}

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

.message-list {
  display: grid;
  gap: 10px;
}

.message-row {
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--surface);
  padding: 14px;
}

.message-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  color: var(--muted);
  font: 12px/1.4 ui-monospace, SFMono-Regular, Menlo, monospace;
}

.separator {
  color: var(--line);
}

.message-content {
  margin: 8px 0 0;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.pager {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 16px;
}

.summary-output {
  min-height: 240px;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  border: 1px solid var(--line);
  border-radius: 22px;
  background: var(--surface);
  padding: 16px;
  font: 14px/1.7 ui-monospace, SFMono-Regular, Menlo, monospace;
}

.range-fields {
  display: contents;
}

.table-layout {
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  gap: 20px;
}

.workspace > section {
  min-width: 0;
}

.message-list,
.table-layout,
.account-layout,
.summary-output {
  border-radius: 28px;
}

.table-layout,
.account-layout {
  border: 1px solid rgb(255 255 255 / 8%);
  background: #15181d;
  padding: 18px;
}

.table-list {
  display: grid;
  gap: 8px;
  margin-top: 12px;
}

.table-button {
  width: 100%;
  overflow: hidden;
  text-align: left;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.row-toolbar {
  display: flex;
  justify-content: end;
  margin: 12px 0;
}

.table-scroll {
  max-width: 100%;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--surface);
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.data-table th,
.data-table td {
  max-width: 420px;
  border-bottom: 1px solid var(--line);
  padding: 10px;
  overflow-wrap: anywhere;
  text-align: left;
  vertical-align: top;
}

.data-table th {
  position: sticky;
  top: 0;
  background: #20242a;
  color: #f4f2ec;
  font-size: 12px;
}

.empty {
  border: 1px dashed var(--line);
  border-radius: 18px;
  background: #15181d;
  color: var(--muted);
  padding: 18px;
}

@media (max-width: 900px) {
  .login-screen {
    padding: 14px;
  }

  .login-frame {
    padding: 16px;
  }

  .login-panel {
    padding: 24px;
  }

  .topbar,
  .section-head {
    align-items: stretch;
    flex-direction: column;
  }

  #appShell {
    padding: 14px;
  }

  .topbar {
    padding: 22px;
  }

  .shell,
  .table-layout,
  .account-layout {
    grid-template-columns: 1fr;
  }

  .rail {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    border-radius: 24px;
  }

  .rail button {
    flex: 1 1 120px;
    width: auto;
    min-width: 0;
    white-space: nowrap;
  }

  .rail-brand {
    flex: 0 0 auto;
    margin: 0 6px 0 0;
  }

  .session-actions {
    display: grid;
    justify-content: space-between;
  }

  .session-actions input {
    width: 100%;
    min-width: 0;
  }

  .workspace {
    padding: 0;
  }

  .filters {
    display: grid;
    grid-template-columns: 1fr;
  }

  .filters label,
  .filters input,
  .filters select,
  .filters button {
    width: 100%;
    min-width: 0;
  }
}
