:root {
  --bg: #0f1115;
  --bg-elevated: #161922;
  --card: #1a1e29;
  --border: #272c3a;
  --text: #e8eaf0;
  --muted: #8a92a6;
  --accent: #6c7bff;
  --accent-hover: #818fff;
  --danger: #ef5a6f;
  --danger-hover: #ff7488;
  --radius: 10px;
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.4), 0 8px 24px rgba(0, 0, 0, 0.25);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  padding: 32px 20px 60px;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, sans-serif;
  background:
    radial-gradient(900px 500px at 15% -10%, rgba(108, 123, 255, 0.12), transparent),
    var(--bg);
  color: var(--text);
  line-height: 1.5;
}

.wrap {
  max-width: 880px;
  margin: 0 auto;
}

a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-hover); text-decoration: underline; }

.topbar {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 24px;
}

.topbar .dot {
  width: 10px; height: 10px; border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 12px var(--accent);
  flex: none;
}

.topbar h1 {
  font-size: 1.25rem;
  font-weight: 650;
  margin: 0;
  word-break: break-all;
}

.topbar .back {
  margin-left: auto;
  font-size: 0.85rem;
  color: var(--muted);
}

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

.hint {
  color: var(--muted);
  font-size: 0.88rem;
  margin: 0 0 16px;
}

.hint code {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 5px;
  padding: 1px 6px;
  color: #b9c0ff;
  font-size: 0.85em;
}

form.add {
  display: flex;
  gap: 10px;
}

input[type=text] {
  flex: 1;
  padding: 10px 12px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-size: 0.95rem;
  outline: none;
  transition: border-color 0.15s;
}
input[type=text]:focus { border-color: var(--accent); }
input[type=text]::placeholder { color: var(--muted); }

button {
  padding: 10px 16px;
  border-radius: 8px;
  border: 1px solid transparent;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}

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

.btn-ghost-danger {
  background: transparent;
  border-color: rgba(239, 90, 111, 0.4);
  color: var(--danger);
}
.btn-ghost-danger:hover {
  background: rgba(239, 90, 111, 0.1);
  border-color: var(--danger-hover);
  color: var(--danger-hover);
}

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

th {
  text-align: left;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  font-weight: 600;
  padding: 0 10px 10px;
  border-bottom: 1px solid var(--border);
}

td {
  padding: 12px 10px;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}

tr:last-child td { border-bottom: none; }
tbody tr { transition: background 0.1s; }
tbody tr:hover { background: var(--bg-elevated); }

.meta { color: var(--muted); font-size: 0.82rem; white-space: nowrap; }

.empty {
  color: var(--muted);
  text-align: center;
  padding: 36px 0;
  font-size: 0.92rem;
}

.subject-link {
  color: var(--text);
  font-weight: 500;
}
.subject-link:hover { color: var(--accent); text-decoration: none; }

.headers div { margin: 6px 0; font-size: 0.92rem; }
.label {
  color: var(--muted);
  display: inline-block;
  width: 68px;
  font-size: 0.82rem;
}

.body-html iframe {
  width: 100%;
  min-height: 420px;
  border: none;
  border-radius: 8px;
  background: #fff;
}

.body-text {
  white-space: pre-wrap;
  font-size: 0.92rem;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 14px 16px;
  margin: 0;
}

@media (max-width: 520px) {
  form.add { flex-direction: column; }
  .meta { white-space: normal; }
}
