:root {
  color-scheme: dark;
  --bg: #05070c;
  --panel: rgba(13, 18, 29, 0.86);
  --panel-2: rgba(18, 25, 39, 0.9);
  --line: #22304a;
  --line-soft: rgba(114, 132, 168, 0.18);
  --text: #f4f8ff;
  --muted: #98a6bb;
  --blue: #36b7ff;
  --green: #32d583;
  --red: #ff4d5f;
  --amber: #ffbf4d;
  --toxic: #39ff14;
  --uranium: #efff00;
  --hotred: #ff1744;
  --shadow: 0 22px 70px rgba(0, 0, 0, 0.42);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at 18% 0%, rgba(54, 183, 255, 0.16), transparent 28%),
    radial-gradient(circle at 84% 10%, rgba(50, 213, 131, 0.12), transparent 28%),
    linear-gradient(180deg, #070b13 0%, var(--bg) 42%);
  color: var(--text);
  font: 14px/1.45 Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  letter-spacing: 0;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  border: 1px solid rgba(54, 183, 255, 0.35);
  background: linear-gradient(180deg, #168bd0, #0c5d97);
  color: #fff;
  border-radius: 7px;
  min-height: 38px;
  padding: 9px 12px;
  cursor: pointer;
  transition: transform 150ms ease, filter 150ms ease, border-color 150ms ease;
}

button:hover {
  filter: brightness(1.12);
  transform: translateY(-1px);
}

input,
select,
textarea {
  width: 100%;
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: rgba(5, 8, 14, 0.88);
  color: var(--text);
  padding: 9px 11px;
  outline: none;
}

textarea {
  min-height: 96px;
  resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(54, 183, 255, 0.12);
}

label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

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

h1 {
  font-size: clamp(34px, 5vw, 58px);
  line-height: 0.95;
}

h2 {
  font-size: 25px;
}

h3 {
  font-size: 16px;
}

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 270px minmax(0, 1fr);
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 18px;
  border-right: 1px solid var(--line-soft);
  background: rgba(6, 9, 15, 0.88);
  backdrop-filter: blur(18px);
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.brand,
.bot-top,
.section-head,
.button-row,
.metric-row,
.panel-head,
.topbar,
.topbar-meta,
.command-head {
  display: flex;
  align-items: center;
}

.brand {
  gap: 12px;
}

.brand span,
.bot-top p,
.feed-item span,
.feed-item p,
.note,
.status-line,
.empty {
  color: var(--muted);
}

.brand-mark {
  width: 45px;
  height: 45px;
  border-radius: 9px;
  display: grid;
  place-items: center;
  font-weight: 900;
  background: linear-gradient(135deg, #37b8ff, #101724 45%, #35d081);
  border: 1px solid rgba(54, 183, 255, 0.35);
  box-shadow: 0 0 30px rgba(54, 183, 255, 0.18);
}

.nav-groups {
  display: grid;
  gap: 6px;
}

.nav-groups p {
  margin-top: 10px;
  color: #64748b;
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
}

.nav-groups a {
  color: var(--muted);
  text-decoration: none;
  padding: 10px 12px;
  border-radius: 7px;
  border: 1px solid transparent;
}

.nav-groups a.active,
.nav-groups a:hover {
  color: var(--text);
  background: rgba(54, 183, 255, 0.08);
  border-color: rgba(54, 183, 255, 0.22);
}

.sidebar-actions {
  margin-top: auto;
  display: grid;
  gap: 8px;
}

.main {
  padding: 22px;
  display: grid;
  gap: 28px;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 5;
  justify-content: space-between;
  gap: 16px;
  padding: 10px;
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  background: rgba(7, 10, 17, 0.82);
  backdrop-filter: blur(18px);
}

.search-wrap {
  flex: 1;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
}

.topbar-meta {
  gap: 8px;
}

.notification-pill,
.device-pill,
.system-pill,
.metric-chip,
.status-dot {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 7px 10px;
  color: var(--muted);
  background: rgba(10, 14, 22, 0.85);
  white-space: nowrap;
}

.notification-pill.alert {
  color: #ffd7dc;
  border-color: rgba(255, 77, 95, 0.45);
  background: rgba(255, 77, 95, 0.12);
}

.device-pill {
  display: grid;
  gap: 1px;
  border-radius: 8px;
}

.device-pill span {
  color: var(--muted);
  font-size: 11px;
}

.section {
  display: grid;
  gap: 16px;
}

.hero-section {
  min-height: 330px;
  align-content: end;
  grid-template-columns: minmax(0, 1.3fr) minmax(290px, 0.7fr);
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  padding: 24px;
  background:
    linear-gradient(135deg, rgba(54, 183, 255, 0.12), transparent 42%),
    linear-gradient(180deg, rgba(14, 22, 36, 0.92), rgba(9, 13, 22, 0.94));
  box-shadow: var(--shadow);
}

.hero-copy {
  display: grid;
  gap: 12px;
  align-content: end;
}

.hero-subtitle {
  max-width: 680px;
  color: #b9c4d6;
  font-size: 16px;
}

.hero-card {
  align-self: stretch;
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  padding: 16px;
  background: rgba(5, 8, 14, 0.55);
  display: grid;
  align-content: space-between;
}

.sparkline {
  height: 120px;
  display: flex;
  align-items: end;
  gap: 9px;
}

.sparkline span {
  flex: 1;
  border-radius: 6px 6px 0 0;
  background: linear-gradient(180deg, var(--green), rgba(54, 183, 255, 0.25));
}

.sparkline span:nth-child(1) { height: 40%; }
.sparkline span:nth-child(2) { height: 72%; }
.sparkline span:nth-child(3) { height: 55%; }
.sparkline span:nth-child(4) { height: 86%; }
.sparkline span:nth-child(5) { height: 64%; }
.sparkline span:nth-child(6) { height: 92%; }

.kpi-grid {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.kpi-grid article,
.panel,
.bot-card {
  border: 1px solid var(--line-soft);
  background: var(--panel);
  border-radius: 8px;
  box-shadow: 0 16px 50px rgba(0, 0, 0, 0.18);
}

.kpi-grid article {
  padding: 14px;
}

.kpi-grid span,
.metric-row span {
  display: block;
  font-size: 26px;
  font-weight: 900;
}

.kpi-grid small,
.metric-row small {
  color: var(--muted);
  text-transform: uppercase;
  font-size: 11px;
  font-weight: 900;
}

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

.eyebrow {
  color: var(--blue);
  text-transform: uppercase;
  font-size: 12px;
  font-weight: 900;
}

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

.bot-card,
.panel {
  padding: 14px;
}

.bot-top,
.panel-head {
  justify-content: space-between;
  gap: 12px;
}

.status-dot.online {
  color: var(--green);
  border-color: rgba(50, 213, 131, 0.35);
}

.status-dot.offline {
  color: var(--red);
  border-color: rgba(255, 77, 95, 0.35);
}

.gauge {
  height: 10px;
  margin: 14px 0;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.07);
  overflow: hidden;
  position: relative;
}

.gauge::before {
  content: "";
  display: block;
  width: var(--value);
  height: 100%;
  background: linear-gradient(90deg, var(--green), var(--blue));
}

.gauge span {
  position: absolute;
  right: 0;
  top: 14px;
  color: var(--muted);
  font-size: 12px;
}

.bot-stats {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin: 20px 0 14px;
}

.bot-stats span,
.metric-row div,
.setting-field {
  min-width: 0;
  border: 1px solid rgba(114, 132, 168, 0.14);
  border-radius: 7px;
  padding: 9px;
  background: rgba(5, 8, 14, 0.54);
  overflow: hidden;
  text-overflow: ellipsis;
}

.button-row,
.device-actions {
  gap: 8px;
  flex-wrap: wrap;
}

.ghost-button,
.secondary-button,
.key-button {
  background: rgba(255, 255, 255, 0.035);
  border-color: var(--line);
  color: var(--text);
}

.danger-button {
  background: linear-gradient(180deg, #a92537, #65101c);
  border-color: rgba(255, 77, 95, 0.4);
}

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

.settings-shell {
  display: grid;
  grid-template-columns: 235px minmax(0, 1fr);
  gap: 14px;
}

.tabs {
  display: grid;
  gap: 8px;
  align-content: start;
}

.tabs button {
  text-align: left;
  background: rgba(255, 255, 255, 0.035);
  border-color: var(--line-soft);
}

.tabs button.active {
  border-color: rgba(54, 183, 255, 0.5);
  background: rgba(54, 183, 255, 0.12);
}

.settings-panel {
  min-height: 230px;
}

.settings-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 10px;
}

.setting-field {
  display: grid;
  gap: 6px;
}

.setting-field small {
  color: var(--muted);
  text-transform: uppercase;
  font-weight: 900;
}

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

.wide-left {
  grid-template-columns: minmax(0, 1.05fr) minmax(360px, 0.95fr);
}

.security-grid {
  grid-template-columns: minmax(0, 1.2fr) minmax(360px, 0.8fr);
}

.nuclear-panel {
  position: relative;
  overflow: hidden;
}

.nuclear-panel::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(90deg, rgba(57, 255, 20, 0.08), transparent 25%, transparent 75%, rgba(255, 23, 68, 0.08)),
    repeating-linear-gradient(135deg, rgba(239, 255, 0, 0.055) 0 1px, transparent 1px 16px);
  opacity: 0.7;
}

.risk-list {
  position: relative;
  display: grid;
  gap: 10px;
  max-height: 540px;
  overflow: auto;
}

.risk-card {
  border: 1px solid rgba(114, 132, 168, 0.18);
  border-radius: 8px;
  background: rgba(5, 8, 14, 0.72);
  padding: 12px;
  display: grid;
  gap: 10px;
  box-shadow: 0 12px 34px rgba(0, 0, 0, 0.22);
}

.risk-card.high,
.risk-card.critical {
  border-color: rgba(57, 255, 20, 0.74);
  box-shadow:
    0 0 0 1px rgba(239, 255, 0, 0.2) inset,
    0 0 26px rgba(57, 255, 20, 0.22),
    0 22px 70px rgba(255, 23, 68, 0.14);
  animation: nuclearPulse 2.2s ease-in-out infinite;
}

.risk-card.critical {
  border-color: rgba(255, 23, 68, 0.88);
}

.risk-card.medium {
  border-color: rgba(239, 255, 0, 0.52);
  box-shadow: 0 0 24px rgba(239, 255, 0, 0.08);
}

@keyframes nuclearPulse {
  0%, 100% { filter: saturate(1); }
  50% { filter: saturate(1.35) brightness(1.08); }
}

.risk-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.risk-meter {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background:
    radial-gradient(circle at center, rgba(5, 8, 14, 1) 0 52%, transparent 53%),
    conic-gradient(var(--green) var(--risk), rgba(255,255,255,0.08) 0);
  border: 1px solid rgba(255, 255, 255, 0.12);
  font-weight: 900;
}

.risk-meter.medium {
  background:
    radial-gradient(circle at center, rgba(5, 8, 14, 1) 0 52%, transparent 53%),
    conic-gradient(var(--uranium) var(--risk), rgba(255,255,255,0.08) 0);
}

.risk-meter.high,
.risk-meter.critical {
  color: #ffffff;
  text-shadow: 0 0 12px currentColor;
  background:
    radial-gradient(circle at center, rgba(5, 8, 14, 1) 0 52%, transparent 53%),
    conic-gradient(var(--hotred) var(--risk), rgba(57,255,20,0.16) 0);
  box-shadow: 0 0 24px rgba(255, 23, 68, 0.28);
}

.risk-meta,
.reason-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.risk-meta span,
.reason-chips span,
.log-level {
  border: 1px solid var(--line-soft);
  border-radius: 999px;
  padding: 5px 8px;
  color: #cbd5e1;
  background: rgba(255, 255, 255, 0.045);
  font-size: 12px;
}

.risk-card.high .reason-chips span,
.risk-card.critical .reason-chips span {
  border-color: rgba(57, 255, 20, 0.38);
  color: #dbffd8;
  background: rgba(57, 255, 20, 0.09);
}

.metric-row {
  gap: 10px;
  margin: 12px 0;
}

.metric-row div {
  flex: 1;
}

.table-wrap {
  max-height: 455px;
  overflow: auto;
  border: 1px solid var(--line-soft);
  border-radius: 8px;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 640px;
}

th,
td {
  text-align: left;
  padding: 10px;
  border-bottom: 1px solid rgba(114, 132, 168, 0.12);
}

th {
  position: sticky;
  top: 0;
  z-index: 1;
  color: var(--muted);
  background: rgba(7, 10, 17, 0.96);
  text-transform: uppercase;
  font-size: 11px;
}

td {
  font-variant-numeric: tabular-nums;
}

.user-pill {
  display: flex;
  align-items: center;
  gap: 9px;
  min-width: 0;
}

.avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  overflow: hidden;
  background: linear-gradient(135deg, rgba(54, 183, 255, 0.35), rgba(50, 213, 131, 0.18));
  border: 1px solid rgba(255, 255, 255, 0.16);
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  font-weight: 900;
}

.avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.user-pill strong,
.user-pill small {
  display: block;
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.user-pill small {
  color: var(--muted);
}

.inline-form,
.premium-form,
.policy-form {
  display: grid;
  gap: 12px;
  margin-top: 14px;
}

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

.form-actions {
  grid-column: 1 / -1;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.toggle-line {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 9px;
  border: 1px solid var(--line-soft);
  border-radius: 7px;
  background: rgba(5, 8, 14, 0.42);
}

.toggle-line input {
  width: auto;
  min-height: auto;
}

.device-list,
.feed {
  display: grid;
  gap: 8px;
  max-height: 520px;
  overflow: auto;
}

.device-card,
.feed-item {
  border: 1px solid rgba(114, 132, 168, 0.14);
  border-radius: 8px;
  padding: 11px;
  background: rgba(5, 8, 14, 0.52);
  display: grid;
  gap: 8px;
}

.device-card.flagged {
  border-color: rgba(255, 77, 95, 0.42);
  background: rgba(255, 77, 95, 0.08);
}

.device-card span,
.device-card small {
  display: block;
  color: var(--muted);
}

.mini-users {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.log-output {
  min-height: 460px;
  max-height: 720px;
  overflow: auto;
  padding: 14px;
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  background: rgba(2, 4, 8, 0.88);
  color: #d6e4f8;
  white-space: pre-wrap;
}

.log-actions,
.log-filter-grid {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: end;
}

.log-actions select {
  min-width: 180px;
}

.log-filter-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(160px, 1fr));
}

.soft-divider {
  border: 0;
  border-top: 1px solid var(--line-soft);
  margin: 16px 0;
}

.policy-section-title {
  color: var(--uranium);
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.vault-root,
.vault-shell,
.vault-card,
.vault-form,
.vault-secret-list {
  display: grid;
  gap: 14px;
}

.vault-shell {
  position: relative;
}

.vault-status-card,
.vault-card {
  position: relative;
  overflow: hidden;
}

.vault-status-card {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: stretch;
  min-height: 160px;
  padding: 18px;
}

.vault-status-card::before,
.vault-card::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0.55;
  background:
    linear-gradient(110deg, rgba(57, 255, 20, 0.08), transparent 38%, rgba(255, 23, 68, 0.08)),
    repeating-linear-gradient(135deg, rgba(239, 255, 0, 0.045) 0 1px, transparent 1px 18px);
}

.vault-locked {
  border-color: rgba(255, 23, 68, 0.55);
  box-shadow:
    0 0 0 1px rgba(255, 23, 68, 0.12) inset,
    0 0 42px rgba(255, 23, 68, 0.16),
    var(--shadow);
}

.vault-unlocked {
  border-color: rgba(57, 255, 20, 0.5);
  box-shadow:
    0 0 0 1px rgba(57, 255, 20, 0.13) inset,
    0 0 42px rgba(57, 255, 20, 0.14),
    var(--shadow);
}

.vault-status-right,
.vault-card-head {
  position: relative;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.vault-status-right {
  min-width: 230px;
  flex-direction: column;
  align-items: flex-end;
  text-align: right;
}

.vault-status-right small {
  color: var(--muted);
}

.vault-badge {
  border: 1px solid var(--line-soft);
  border-radius: 999px;
  padding: 7px 11px;
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  background: rgba(5, 8, 14, 0.76);
}

.vault-badge.danger {
  color: #ffe1e8;
  border-color: rgba(255, 23, 68, 0.72);
  box-shadow: 0 0 22px rgba(255, 23, 68, 0.25);
}

.vault-badge.safe {
  color: #d9ffd6;
  border-color: rgba(57, 255, 20, 0.72);
  box-shadow: 0 0 22px rgba(57, 255, 20, 0.22);
}

.vault-warning {
  position: relative;
  padding: 12px;
  border: 1px solid rgba(239, 255, 0, 0.38);
  border-radius: 8px;
  color: #fffdd0;
  background: rgba(239, 255, 0, 0.07);
}

.vault-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(320px, 0.85fr);
  gap: 14px;
}

.vault-question-grid {
  display: grid;
  gap: 10px;
}

.vault-question-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 10px;
}

.vault-secret {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  padding: 12px;
  border: 1px solid rgba(114, 132, 168, 0.16);
  border-radius: 8px;
  background: rgba(5, 8, 14, 0.62);
}

.vault-secret strong,
.vault-secret span,
.vault-secret code {
  display: block;
}

.vault-secret span {
  color: var(--muted);
  margin: 2px 0 7px;
}

.vault-secret code {
  max-width: 100%;
  overflow: auto;
  padding: 8px;
  border-radius: 7px;
  border: 1px solid rgba(57, 255, 20, 0.18);
  color: #dbffd8;
  background: rgba(0, 0, 0, 0.26);
  white-space: nowrap;
}

.e2ee-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  border: 1px solid rgba(57, 255, 20, 0.38);
  border-radius: 8px;
  padding: 12px 14px;
  color: #dcffd9;
  background:
    linear-gradient(90deg, rgba(57, 255, 20, 0.11), rgba(54, 183, 255, 0.06)),
    rgba(5, 8, 14, 0.74);
  box-shadow: 0 0 30px rgba(57, 255, 20, 0.09);
}

.e2ee-banner span {
  color: var(--muted);
}

.chat-shell,
.chat-grid,
.chat-main,
.chat-people-list,
.chat-message-list {
  display: grid;
  gap: 12px;
}

.chat-grid {
  grid-template-columns: 330px minmax(0, 1fr);
}

.chat-people {
  align-content: start;
  min-height: 620px;
}

.chat-security-state {
  display: grid;
  gap: 3px;
  padding: 11px;
  border-radius: 8px;
  border: 1px solid var(--line-soft);
  background: rgba(5, 8, 14, 0.62);
}

.chat-security-state.safe {
  border-color: rgba(57, 255, 20, 0.42);
  color: #dcffd9;
}

.chat-security-state.danger {
  border-color: rgba(255, 23, 68, 0.48);
  color: #ffe1e8;
}

.chat-security-state span,
.chat-window-head span {
  color: var(--muted);
  font-size: 12px;
}

.chat-person {
  width: 100%;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
  text-align: left;
  background: rgba(255, 255, 255, 0.035);
  border-color: var(--line-soft);
}

.chat-person.active {
  border-color: rgba(57, 255, 20, 0.48);
  background: rgba(57, 255, 20, 0.08);
}

.chat-person small {
  grid-column: 1 / -1;
  color: var(--muted);
}

.presence-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #475569;
  box-shadow: 0 0 0 3px rgba(71, 85, 105, 0.15);
}

.presence-dot.online {
  background: var(--green);
  box-shadow: 0 0 16px rgba(50, 213, 131, 0.55);
}

.chat-window {
  min-height: 620px;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  background:
    linear-gradient(135deg, rgba(57, 255, 20, 0.055), transparent 36%),
    var(--panel);
}

.chat-window-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line-soft);
}

.chat-message-list {
  align-content: end;
  max-height: 520px;
  overflow: auto;
  padding: 12px 2px;
}

.chat-bubble {
  width: min(680px, 82%);
  justify-self: start;
  display: grid;
  gap: 8px;
  padding: 11px;
  border: 1px solid rgba(114, 132, 168, 0.16);
  border-radius: 8px;
  background: rgba(5, 8, 14, 0.72);
}

.chat-bubble.mine {
  justify-self: end;
  border-color: rgba(54, 183, 255, 0.28);
  background: rgba(12, 93, 151, 0.24);
}

.chat-bubble.secret {
  border-color: rgba(239, 255, 0, 0.4);
  box-shadow: 0 0 24px rgba(239, 255, 0, 0.08);
}

.chat-bubble p {
  color: #edf6ff;
  overflow-wrap: anywhere;
}

.chat-bubble code {
  display: block;
  overflow: auto;
  padding: 9px;
  border-radius: 7px;
  border: 1px solid rgba(239, 255, 0, 0.22);
  background: rgba(0, 0, 0, 0.24);
  color: #fffdd0;
  white-space: nowrap;
}

.chat-bubble-meta,
.chat-message-actions,
.chat-compose {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.chat-bubble-meta {
  justify-content: space-between;
  color: var(--muted);
  font-size: 12px;
}

.chat-message-actions {
  opacity: 0.72;
}

.chat-compose {
  padding-top: 12px;
  border-top: 1px solid var(--line-soft);
}

.chat-compose input {
  flex: 1;
  min-width: 240px;
}

.chat-key-panel {
  margin-bottom: 12px;
}

.staff-password-box {
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  padding: 10px;
  background: rgba(5, 8, 14, 0.46);
}

.staff-password-box summary {
  cursor: pointer;
  color: var(--text);
  font-weight: 900;
}

.command-palette {
  width: min(680px, calc(100vw - 26px));
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(9, 13, 22, 0.98);
  color: var(--text);
  box-shadow: var(--shadow);
  padding: 14px;
}

.command-palette::backdrop {
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(5px);
}

.command-head {
  justify-content: space-between;
  margin-bottom: 10px;
}

.command-list {
  display: grid;
  gap: 8px;
  margin-top: 10px;
}

.command-list button {
  text-align: left;
  background: rgba(255, 255, 255, 0.04);
  border-color: var(--line-soft);
}

.toast {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 30;
  background: #0d2318;
  border: 1px solid rgba(50, 213, 131, 0.45);
  color: #e5fff0;
  padding: 12px 14px;
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.toast.danger {
  background: #2a1016;
  border-color: rgba(255, 77, 95, 0.5);
  color: #ffe1e5;
}

.login-body {
  min-height: 100vh;
  display: grid;
  place-items: center;
  background:
    radial-gradient(circle at 18% 0%, rgba(54, 183, 255, 0.18), transparent 30%),
    var(--bg);
}

.login-shell {
  width: min(430px, calc(100vw - 28px));
}

.login-panel {
  border: 1px solid var(--line-soft);
  background: var(--panel);
  border-radius: 8px;
  padding: 24px;
  display: grid;
  gap: 14px;
  box-shadow: var(--shadow);
}

.login-panel .brand-mark {
  width: 56px;
  height: 56px;
}

.login-panel button {
  width: 100%;
}

.error-line {
  color: var(--red);
}

@media (max-width: 1080px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
    height: auto;
  }

  .nav-groups {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .nav-groups p {
    grid-column: 1 / -1;
  }

  .hero-section,
  .settings-shell,
  .split-grid,
  .security-grid,
  .wide-left,
  .vault-grid,
  .chat-grid {
    grid-template-columns: 1fr;
  }

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

@media (max-width: 680px) {
  .main {
    padding: 12px;
  }

  .topbar,
  .topbar-meta,
  .section-head,
  .metric-row,
  .vault-status-card,
  .e2ee-banner,
  .chat-window-head {
    align-items: stretch;
    flex-direction: column;
  }

  .kpi-grid,
  .form-grid,
  .nav-groups,
  .vault-question-row,
  .vault-secret {
    grid-template-columns: 1fr;
  }

  .vault-status-right {
    align-items: stretch;
    text-align: left;
  }
}
