:root {
  color-scheme: dark;
  --bg: #07100f;
  --panel: rgba(17, 31, 31, 0.72);
  --panel-strong: rgba(20, 37, 38, 0.9);
  --line: rgba(171, 255, 240, 0.14);
  --line-strong: rgba(210, 255, 247, 0.28);
  --text: #effffc;
  --muted: #9ab5b1;
  --accent: #48f0c0;
  --accent-2: #6fd7ff;
  --danger: #ff637c;
  --warning: #ffd166;
  --ok: #35e6a8;
  --shadow: 0 30px 90px rgba(0, 0, 0, 0.34);
  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:
    radial-gradient(circle at 15% 0%, rgba(72, 240, 192, 0.16), transparent 34%),
    radial-gradient(circle at 85% 10%, rgba(111, 215, 255, 0.12), transparent 28%),
    linear-gradient(135deg, #07100f 0%, #0b1515 48%, #081111 100%);
  color: var(--text);
}

a {
  color: inherit;
  text-decoration: none;
}

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

.app-shell {
  display: grid;
  grid-template-columns: 260px 1fr;
  min-height: 100vh;
}

.sidebar {
  padding: 24px 18px;
  border-right: 1px solid var(--line);
  background: rgba(6, 14, 14, 0.72);
  backdrop-filter: blur(22px);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 28px;
  font-weight: 800;
  letter-spacing: 0;
}

.brand-mark {
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  background: linear-gradient(145deg, rgba(72, 240, 192, 0.22), rgba(111, 215, 255, 0.14));
}

.nav {
  display: grid;
  gap: 7px;
}

.nav a,
.nav button {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 12px;
  border: 1px solid transparent;
  border-radius: 8px;
  color: var(--muted);
  background: transparent;
  cursor: pointer;
  text-align: left;
}

.nav a.active,
.nav a:hover,
.nav button:hover {
  color: var(--text);
  border-color: var(--line);
  background: rgba(255, 255, 255, 0.05);
}

.main {
  padding: 28px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 22px;
}

.page-title h1 {
  margin: 0;
  font-size: 28px;
  letter-spacing: 0;
}

.page-title p {
  margin: 6px 0 0;
  color: var(--muted);
}

.glass {
  border: 1px solid var(--line);
  background: var(--panel);
  box-shadow: var(--shadow);
  backdrop-filter: blur(24px);
}

.card {
  border-radius: 8px;
  padding: 18px;
}

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

.metrics {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.metric {
  min-height: 108px;
}

.metric .label {
  color: var(--muted);
  font-size: 13px;
}

.metric .value {
  margin-top: 12px;
  font-size: 30px;
  font-weight: 800;
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  gap: 10px;
  margin-bottom: 16px;
}

.field {
  display: grid;
  gap: 7px;
}

.field span {
  color: var(--muted);
  font-size: 12px;
}

.input,
.select,
textarea {
  min-height: 42px;
  min-width: 180px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  background: rgba(255, 255, 255, 0.07);
  color: var(--text);
  outline: none;
}

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

.button {
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  min-height: 42px;
  padding: 10px 14px;
  color: var(--text);
  background: rgba(255, 255, 255, 0.08);
  cursor: pointer;
}

.button.primary {
  color: #06221c;
  border-color: transparent;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  font-weight: 800;
}

.button.danger {
  border-color: rgba(255, 99, 124, 0.5);
  color: #ffe8ec;
  background: rgba(255, 99, 124, 0.16);
}

.button:disabled {
  opacity: 0.42;
  cursor: not-allowed;
}

.table-card {
  overflow: hidden;
  border-radius: 8px;
}

table {
  width: 100%;
  border-collapse: collapse;
}

th,
td {
  padding: 13px 14px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: middle;
  font-size: 14px;
}

th {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
}

tr:hover td {
  background: rgba(255, 255, 255, 0.035);
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 24px;
  padding: 3px 9px;
  border-radius: 999px;
  border: 1px solid var(--line);
  color: var(--muted);
  background: rgba(255, 255, 255, 0.05);
  font-size: 12px;
  font-weight: 700;
}

.pill.ok { color: var(--ok); border-color: rgba(53, 230, 168, 0.32); }
.pill.warn { color: var(--warning); border-color: rgba(255, 209, 102, 0.34); }
.pill.danger { color: var(--danger); border-color: rgba(255, 99, 124, 0.34); }
.pill.info { color: var(--accent-2); border-color: rgba(111, 215, 255, 0.34); }

.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.login-page {
  display: grid;
  place-items: center;
  min-height: 100vh;
  padding: 24px;
}

.login-card {
  width: min(440px, 100%);
  border-radius: 8px;
  padding: 28px;
}

.login-card h1 {
  margin: 0 0 8px;
}

.stack {
  display: grid;
  gap: 14px;
}

.split {
  display: grid;
  grid-template-columns: 1.15fr 0.85fr;
  gap: 16px;
}

.detail-shell {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  gap: 16px;
  align-items: start;
}

.detail-main {
  min-width: 0;
}

.unsent-rail {
  position: sticky;
  top: 20px;
}

.unsent-list {
  display: grid;
  gap: 8px;
  max-height: 66vh;
  overflow: auto;
  padding-right: 4px;
}

.unsent-item {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 10px;
  align-items: start;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.04);
}

.unsent-item.active {
  border-color: var(--line-strong);
  background: rgba(72, 240, 192, 0.09);
}

.unsent-item input {
  min-width: 0;
  min-height: 0;
  width: 16px;
  height: 16px;
  margin-top: 4px;
}

.unsent-item a {
  display: grid;
  gap: 5px;
}

.unsent-item span {
  color: var(--muted);
  font-size: 12px;
}

.lines {
  display: grid;
  gap: 10px;
}

.line-item {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.045);
}

.muted {
  color: var(--muted);
}

.notice {
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.06);
}

.notice.error {
  color: #ffe8ec;
  border-color: rgba(255, 99, 124, 0.36);
  background: rgba(255, 99, 124, 0.12);
}

.notice.success {
  color: #e2fff6;
  border-color: rgba(53, 230, 168, 0.36);
  background: rgba(53, 230, 168, 0.1);
}

.code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px;
}

@media (max-width: 980px) {
  .app-shell {
    grid-template-columns: 1fr;
  }
  .sidebar {
    position: static;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }
  .metrics,
  .split,
  .detail-shell {
    grid-template-columns: 1fr;
  }
  .unsent-rail {
    position: static;
  }
}
