:root {
  color-scheme: dark;
  --bg: #08111f;
  --panel: rgba(10, 18, 34, 0.86);
  --panel-strong: #0f1c33;
  --line: rgba(140, 170, 255, 0.16);
  --text: #e9eefb;
  --muted: #8fa1c4;
  --accent: #6ea8ff;
  --accent-2: #6dffd3;
  --danger: #ff768b;
  --warning: #ffce6d;
  --ok: #78f0ab;
  --shadow: 0 24px 80px rgba(0, 0, 0, 0.36);
  font-family: Inter, "PingFang SC", "Microsoft YaHei", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at top left, rgba(90, 138, 255, 0.22), transparent 38%),
    radial-gradient(circle at top right, rgba(83, 255, 210, 0.12), transparent 26%),
    linear-gradient(180deg, #06101c, #08111f 42%, #09101d);
  color: var(--text);
}

button,
input,
select,
textarea {
  font: inherit;
}

a {
  color: inherit;
}

.app-shell {
  display: grid;
  grid-template-columns: 280px 1fr;
  min-height: 100vh;
}

.sidebar {
  padding: 24px;
  border-right: 1px solid var(--line);
  background: rgba(5, 10, 20, 0.8);
  backdrop-filter: blur(20px);
}

.brand {
  padding: 18px;
  border: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(110, 168, 255, 0.16), rgba(8, 14, 27, 0.9));
  border-radius: 22px;
  box-shadow: var(--shadow);
}

.brand h1,
.brand p {
  margin: 0;
}

.brand h1 {
  font-size: 20px;
  font-weight: 700;
}

.brand p {
  margin-top: 8px;
  color: var(--muted);
  line-height: 1.5;
  font-size: 13px;
}

.nav {
  display: grid;
  gap: 10px;
  margin-top: 24px;
}

.nav button {
  width: 100%;
  text-align: left;
  padding: 14px 16px;
  border-radius: 16px;
  border: 1px solid transparent;
  background: rgba(255, 255, 255, 0.02);
  color: var(--text);
  cursor: pointer;
}

.nav button.active {
  background: linear-gradient(90deg, rgba(110, 168, 255, 0.24), rgba(109, 255, 211, 0.12));
  border-color: rgba(110, 168, 255, 0.38);
}

.sidebar-meta {
  margin-top: 28px;
  display: grid;
  gap: 12px;
}

.meta-chip,
.status-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.04);
  color: var(--muted);
  font-size: 12px;
}

.main {
  padding: 28px;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin-bottom: 24px;
}

.topbar h2,
.topbar p {
  margin: 0;
}

.topbar p {
  margin-top: 6px;
  color: var(--muted);
}

.topbar-actions,
.inline-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.btn,
.ghost-btn,
.danger-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 42px;
  padding: 0 16px;
  border-radius: 12px;
  cursor: pointer;
  transition: 0.2s ease;
}

.btn {
  border: 1px solid rgba(110, 168, 255, 0.4);
  background: linear-gradient(135deg, rgba(110, 168, 255, 0.32), rgba(68, 113, 255, 0.18));
  color: white;
}

.ghost-btn {
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
}

.danger-btn {
  border: 1px solid rgba(255, 118, 139, 0.26);
  background: rgba(255, 118, 139, 0.12);
  color: #ffdce2;
}

.btn:hover,
.ghost-btn:hover,
.danger-btn:hover {
  transform: translateY(-1px);
}

.page-grid {
  display: grid;
  gap: 18px;
}

.cards-4 {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 18px;
}

.cards-3 {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
}

.cards-2 {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}

.card,
.panel {
  border-radius: 22px;
  border: 1px solid var(--line);
  background: var(--panel);
  backdrop-filter: blur(20px);
  box-shadow: var(--shadow);
}

.card {
  padding: 20px;
}

.panel {
  padding: 22px;
}

.panel-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 18px;
}

.panel-header h3,
.panel-header p,
.card h3,
.card p {
  margin: 0;
}

.panel-header p,
.card p,
.hint {
  color: var(--muted);
  line-height: 1.5;
}

.big-number {
  font-size: 32px;
  font-weight: 700;
  margin-top: 12px;
}

.kpi-label {
  color: var(--muted);
  font-size: 13px;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.form-grid-3 {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.field {
  display: grid;
  gap: 8px;
}

.field label {
  font-size: 13px;
  color: var(--muted);
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid rgba(140, 170, 255, 0.18);
  border-radius: 14px;
  background: rgba(4, 8, 18, 0.75);
  color: var(--text);
  padding: 12px 14px;
}

textarea {
  min-height: 140px;
  resize: vertical;
}

.toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
}

.segmented {
  display: inline-flex;
  padding: 4px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.04);
}

.segmented button {
  border: 0;
  background: transparent;
  color: var(--muted);
  border-radius: 999px;
  padding: 8px 14px;
  cursor: pointer;
}

.segmented button.active {
  background: rgba(110, 168, 255, 0.22);
  color: white;
}

.table-wrap {
  overflow: auto;
  border-radius: 18px;
  border: 1px solid var(--line);
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 760px;
}

th,
td {
  padding: 14px;
  border-bottom: 1px solid rgba(140, 170, 255, 0.09);
  vertical-align: top;
  text-align: left;
}

th {
  font-size: 12px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  background: rgba(255, 255, 255, 0.02);
}

tr:last-child td {
  border-bottom: 0;
}

pre.raw-box {
  margin: 0;
  border-radius: 18px;
  border: 1px solid var(--line);
  background: rgba(4, 9, 18, 0.92);
  padding: 18px;
  overflow: auto;
  max-height: 540px;
  color: #d7e4ff;
}

.tag-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(110, 168, 255, 0.12);
  border: 1px solid rgba(110, 168, 255, 0.18);
  color: #dbe7ff;
  font-size: 12px;
}

.tag.ok {
  background: rgba(120, 240, 171, 0.12);
  border-color: rgba(120, 240, 171, 0.18);
}

.tag.warn {
  background: rgba(255, 206, 109, 0.12);
  border-color: rgba(255, 206, 109, 0.2);
}

.tag.danger {
  background: rgba(255, 118, 139, 0.12);
  border-color: rgba(255, 118, 139, 0.2);
}

.timeline {
  display: grid;
  gap: 12px;
}

.message {
  padding: 14px 16px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--line);
}

.message.outbound {
  border-color: rgba(110, 168, 255, 0.22);
}

.message-header {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 12px;
}

.split {
  display: grid;
  grid-template-columns: 1.2fr 0.8fr;
  gap: 18px;
}

.empty-state {
  padding: 38px 20px;
  text-align: center;
  color: var(--muted);
  border-radius: 20px;
  border: 1px dashed rgba(140, 170, 255, 0.18);
}

.login-screen {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.login-card {
  width: min(960px, 100%);
  display: grid;
  grid-template-columns: 1.2fr 0.8fr;
  border-radius: 28px;
  overflow: hidden;
  border: 1px solid var(--line);
  background: rgba(5, 9, 19, 0.88);
  box-shadow: var(--shadow);
}

.login-hero,
.login-form {
  padding: 38px;
}

.login-hero {
  background:
    radial-gradient(circle at top left, rgba(110, 168, 255, 0.22), transparent 34%),
    linear-gradient(180deg, rgba(7, 14, 27, 0.92), rgba(10, 18, 34, 0.98));
}

.login-hero h1,
.login-hero p,
.login-form h3 {
  margin: 0;
}

.login-hero p {
  margin-top: 12px;
  color: var(--muted);
  line-height: 1.7;
}

.feature-list {
  margin-top: 22px;
  display: grid;
  gap: 10px;
}

.feature-item {
  padding: 12px 14px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--line);
}

.notice-stack {
  position: fixed;
  right: 20px;
  bottom: 20px;
  display: grid;
  gap: 10px;
  z-index: 30;
}

.notice {
  min-width: 260px;
  padding: 14px 16px;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: rgba(8, 14, 27, 0.94);
  box-shadow: var(--shadow);
}

.notice.success {
  border-color: rgba(120, 240, 171, 0.24);
}

.notice.error {
  border-color: rgba(255, 118, 139, 0.24);
}

.muted {
  color: var(--muted);
}

.mono {
  font-family: "Cascadia Code", Consolas, monospace;
}

@media (max-width: 1280px) {
  .cards-4,
  .cards-3,
  .cards-2,
  .split,
  .form-grid,
  .form-grid-3,
  .login-card {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 980px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }
}
