:root {
  --bg: #0f1419;
  --surface: #1a2332;
  --card: #222c3c;
  --border: #2d3a4f;
  --text: #e8edf5;
  --muted: #8b9cb3;
  --accent: #5865f2;
  --accent-dim: #4752c4;
  --ok: #3ba55d;
  --err: #ed4245;
  --radius: 10px;
  --font: "Segoe UI Variable", "Segoe UI", system-ui, sans-serif;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
}

body {
  padding-bottom: 32px;
}

.top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px;
  border-bottom: 1px solid var(--border);
  background: rgba(26, 35, 50, 0.92);
  backdrop-filter: blur(8px);
  position: sticky;
  top: 0;
  z-index: 40;
}

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

.logo {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--accent), #9b59ff);
  display: grid;
  place-items: center;
  font-weight: 700;
  font-size: 14px;
}

.title {
  font-weight: 600;
  font-size: 16px;
}

.sub {
  font-size: 11px;
  color: var(--muted);
}

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

.badge {
  font-size: 12px;
  color: var(--muted);
  max-width: 200px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.shell {
  max-width: 920px;
  margin: 0 auto;
  padding: 20px 16px;
}

.login {
  display: flex;
  justify-content: center;
  padding: 48px 0;
}

.lcard {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px 32px;
  max-width: 440px;
  text-align: center;
}

.lcard h1 {
  margin: 0 0 12px;
  font-size: 22px;
}

.muted {
  color: var(--muted);
  line-height: 1.5;
}

.small {
  font-size: 12px;
}

.hidden {
  display: none !important;
}

.btn {
  font: inherit;
  cursor: pointer;
  border-radius: 8px;
  padding: 8px 16px;
  border: none;
  font-weight: 600;
  font-size: 13px;
}

.btn.bp {
  background: var(--accent);
  color: #fff;
}

.btn.bp:hover {
  background: var(--accent-dim);
}

.btn.bd {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--border);
}

.btn.bd:hover {
  border-color: var(--muted);
}

.app .nav {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 18px;
}

.n {
  font: inherit;
  cursor: pointer;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--muted);
  padding: 8px 12px;
  border-radius: 999px;
  font-size: 12px;
}

.n.on {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.pages .page {
  display: none;
}

.pages .page.on {
  display: block;
}

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 20px;
  margin-bottom: 14px;
}

.hero h2 {
  margin-top: 0;
}

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

@media (max-width: 600px) {
  .grid2 {
    grid-template-columns: 1fr;
  }
}

.mini h3 {
  margin: 0 0 6px;
  font-size: 12px;
  color: var(--muted);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.mono {
  font-family: ui-monospace, monospace;
  font-size: 12px;
  word-break: break-all;
}

.form label {
  display: block;
  font-size: 12px;
  color: var(--muted);
  margin: 10px 0 4px;
}

.form input[type="text"],
.form input[type="search"],
.form input[type="number"],
.form input[type="datetime-local"] {
  width: 100%;
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font: inherit;
}

.row {
  display: flex;
  gap: 8px;
  align-items: center;
}

.row input {
  flex: 1;
}

.row.end {
  justify-content: flex-end;
  margin-top: 16px;
}

.chk {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 12px;
  font-size: 13px;
  color: var(--muted);
  cursor: pointer;
}

.chatbox {
  display: flex;
  flex-direction: column;
  min-height: 420px;
  padding: 0;
  overflow: hidden;
}

.msgs {
  flex: 1;
  padding: 16px;
  overflow-y: auto;
  max-height: 52vh;
}

.msg {
  margin-bottom: 12px;
  padding: 10px 14px;
  border-radius: 12px;
  font-size: 14px;
  line-height: 1.45;
  max-width: 92%;
}

.msg .who {
  font-size: 11px;
  font-weight: 700;
  color: var(--muted);
  margin-bottom: 4px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.msg.u {
  margin-left: auto;
  background: #2c3558;
  border: 1px solid var(--border);
}

.msg.b {
  background: var(--surface);
  border: 1px solid var(--border);
}

.chatbar {
  display: flex;
  gap: 8px;
  padding: 12px;
  border-top: 1px solid var(--border);
  background: rgba(15, 20, 25, 0.5);
}

.chatbar input {
  flex: 1;
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font: inherit;
}

.list .mi,
.list .scard,
.list .pcard {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 10px;
}

.mi .icon {
  font-size: 22px;
}

.mi .l {
  flex: 1;
  min-width: 0;
}

.mi .subj {
  font-weight: 600;
  font-size: 14px;
}

.mi .meta {
  font-size: 12px;
  color: var(--muted);
  margin-top: 4px;
}

.tag {
  display: inline-block;
  font-size: 10px;
  padding: 2px 6px;
  border-radius: 4px;
  background: var(--surface);
}

.tag.tg {
  color: #5b9fd4;
}

.mi a {
  color: var(--accent);
  font-weight: 600;
  font-size: 12px;
  text-decoration: none;
}

.mi a:hover {
  text-decoration: underline;
}

.scard {
  align-items: stretch;
}

.scard .conf {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  font-weight: 700;
  font-size: 12px;
  flex-shrink: 0;
}

.conf.high {
  background: rgba(59, 165, 93, 0.2);
  color: var(--ok);
}

.conf.med {
  background: rgba(240, 178, 50, 0.15);
  color: #f0b232;
}

.conf.low {
  background: rgba(237, 66, 69, 0.15);
  color: var(--err);
}

.scard .det {
  flex: 1;
  min-width: 0;
  font-size: 13px;
}

.pcard .av {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: var(--surface);
  display: grid;
  place-items: center;
  font-size: 13px;
  font-weight: 700;
  flex-shrink: 0;
}

.pcard .info {
  flex: 1;
  min-width: 0;
}

.pcard .nm {
  font-weight: 600;
}

.pcard .em {
  font-size: 12px;
  color: var(--muted);
}

.toolbar {
  margin-bottom: 10px;
}

.loadbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  z-index: 100;
  pointer-events: none;
}

.loadbar .lb {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), #9b59ff);
  animation: slide 1s ease infinite;
  width: 40%;
}

@keyframes slide {
  0% {
    transform: translateX(-100%);
  }
  100% {
    transform: translateX(350%);
  }
}

.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  padding: 12px 20px;
  border-radius: 8px;
  font-size: 13px;
  z-index: 200;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
}

.toast.ok {
  background: #1e3d2a;
  color: #b6f0c8;
  border: 1px solid var(--ok);
}

.toast.err {
  background: #3d1e1e;
  color: #f0b6b6;
  border: 1px solid var(--err);
}

.modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  display: grid;
  place-items: center;
  z-index: 150;
  padding: 20px;
}

.modal-panel {
  width: 100%;
  max-width: 400px;
  margin: 0;
}

.modal-panel h2 {
  margin-top: 0;
}
