:root {
  color-scheme: dark;
  --bg: #0d1117;
  --panel: #151a23;
  --panel-2: #1b2230;
  --line: #2a3344;
  --text: #edf2f7;
  --muted: #97a3b6;
  --brand: #e6524b;
  --brand-2: #ff716b;
  --good: #39b980;
  --bad: #ff6a6a;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

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

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

.sidebar {
  border-right: 1px solid var(--line);
  background: #10151d;
  padding: 24px 18px;
  display: flex;
  flex-direction: column;
  gap: 26px;
  position: sticky;
  top: 0;
  height: 100vh;
}

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

.brand-mark {
  width: 38px;
  height: 38px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  background: var(--brand);
  font-weight: 800;
}

.brand-title {
  font-weight: 800;
  line-height: 1.2;
}

.brand-subtitle {
  color: var(--muted);
  font-size: 12px;
  margin-top: 3px;
}

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

.nav-link {
  padding: 11px 12px;
  border-radius: 8px;
  color: var(--muted);
}

.nav-link.active,
.nav-link:hover {
  background: var(--panel-2);
  color: var(--text);
}

.sidebar-footer {
  margin-top: auto;
}

.main {
  padding: 28px;
  max-width: 1480px;
  width: 100%;
}

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

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

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

.status-pill {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 8px 12px;
  color: var(--muted);
  white-space: nowrap;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(120px, 1fr));
  gap: 12px;
  margin-bottom: 18px;
}

.stat-card,
.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.stat-card {
  padding: 16px;
}

.stat-card span {
  color: var(--muted);
  display: block;
  font-size: 13px;
}

.stat-card strong {
  display: block;
  font-size: 26px;
  margin-top: 6px;
}

.panel {
  padding: 18px;
  margin-bottom: 16px;
}

.panel-header {
  margin-bottom: 14px;
}

.panel-header.row {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
}

.header-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.panel h2 {
  margin: 0;
  font-size: 18px;
}

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

.two-column {
  display: grid;
  grid-template-columns: minmax(280px, 420px) 1fr;
  gap: 16px;
}

.form-stack {
  display: grid;
  gap: 12px;
}

.form-row,
.filters {
  display: grid;
  grid-template-columns: repeat(4, minmax(140px, 1fr));
  gap: 12px;
  align-items: end;
}

label span {
  display: block;
  color: var(--muted);
  font-size: 13px;
  margin-bottom: 6px;
}

input,
textarea,
select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #0f141d;
  color: var(--text);
  padding: 11px 12px;
  font: inherit;
}

textarea {
  resize: vertical;
}

.checkbox-line,
.inline-options {
  color: var(--muted);
}

.inline-options {
  display: flex;
  gap: 18px;
  flex-wrap: wrap;
}

.button {
  border: 1px solid var(--line);
  background: #111824;
  color: var(--text);
  border-radius: 8px;
  padding: 10px 14px;
  font: inherit;
  cursor: pointer;
}

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

.button.primary {
  background: var(--brand);
  border-color: var(--brand);
  color: #fff;
  font-weight: 700;
}

.button.danger {
  color: var(--bad);
}

.button.ghost {
  background: transparent;
}

.full {
  width: 100%;
}

.actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 14px;
}

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

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

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

th {
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
  background: #101722;
}

tr:last-child td {
  border-bottom: 0;
}

.strong {
  font-weight: 700;
}

.secret-cell {
  max-width: 240px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 13px;
  white-space: normal;
  overflow-wrap: anywhere;
  color: var(--text);
}

.tag {
  display: inline-flex;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 3px 8px;
  color: var(--muted);
}

.tag.good {
  color: var(--good);
  border-color: rgba(57, 185, 128, 0.4);
}

.tag.bad {
  color: var(--bad);
  border-color: rgba(255, 106, 106, 0.4);
}

.notice {
  border: 1px solid rgba(230, 82, 75, 0.4);
  background: rgba(230, 82, 75, 0.12);
  padding: 12px 14px;
  border-radius: 8px;
  margin-bottom: 14px;
}

.notice.danger {
  color: var(--bad);
}

.empty {
  min-height: 160px;
  display: grid;
  place-items: center;
  color: var(--muted);
  border: 1px dashed var(--line);
  border-radius: 8px;
  padding: 24px;
  text-align: center;
}

.mail-layout {
  display: grid;
  grid-template-columns: 380px 1fr;
  gap: 16px;
  margin-top: 14px;
}

.mail-list {
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: auto;
  max-height: 720px;
}

.mail-item {
  display: grid;
  gap: 6px;
  padding: 13px 14px;
  border-bottom: 1px solid var(--line);
}

.mail-item.active,
.mail-item:hover {
  background: var(--panel-2);
}

.mail-item span,
.mail-item small {
  color: var(--muted);
}

.mail-detail {
  min-height: 520px;
}

.detail-head {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
  margin-bottom: 12px;
}

.detail-head h2 {
  margin: 0;
}

.setting-summary {
  display: grid;
  gap: 16px;
}

.setting-summary div {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #101722;
}

.setting-summary span {
  display: block;
  color: var(--muted);
  font-size: 13px;
  margin-bottom: 6px;
}

.setting-summary strong {
  display: block;
  font-size: 18px;
}

.setting-summary p {
  margin: 0;
  color: var(--muted);
  line-height: 1.6;
}

.link-box {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  margin-bottom: 12px;
}

.link-box h3 {
  margin: 0 0 10px;
}

.extracted-link {
  display: block;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  margin-top: 8px;
  color: var(--brand-2);
}

.mail-frame {
  width: 100%;
  height: 620px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.log-list {
  display: grid;
  gap: 10px;
}

.log-item {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
}

.log-item span {
  display: block;
  color: var(--muted);
  font-size: 13px;
  margin-bottom: 5px;
}

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

.login-panel {
  width: min(440px, 100%);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 24px;
}

.login-brand {
  margin-bottom: 22px;
}

@media (max-width: 980px) {
  .shell {
    grid-template-columns: 1fr;
  }
  .sidebar {
    position: static;
    height: auto;
  }
  .nav {
    grid-template-columns: repeat(2, 1fr);
  }
  .two-column,
  .mail-layout,
  .form-row,
  .filters {
    grid-template-columns: 1fr;
  }
  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}
