:root {
  --ink: #1f2a37;
  --paper: #f4f5f7;
  --card: #ffffff;
  --line: #d9dee5;
  --muted: #5d6b7a;
  --accent: #b45309;
  --accent-dark: #92400e;
  --ok: #166534;
  --ok-bg: #dcfce7;
  --warn: #92400e;
  --warn-bg: #fef3c7;
  --danger: #b91c1c;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --mono: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  min-height: 100%;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 15px;
}

button, input { font: inherit; color: inherit; }
button { cursor: pointer; }

input[type=text], input[type=email], input[type=password], input[type=search] {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  padding: 8px 10px;
}

input:focus, button:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

label { display: grid; gap: 4px; font-size: 13px; color: var(--muted); }

.primary {
  border: 0;
  border-radius: 6px;
  background: var(--accent);
  color: #fff;
  padding: 9px 16px;
  font-weight: 600;
}
.primary:hover { background: var(--accent-dark); }
.primary:disabled { opacity: 0.6; cursor: default; }

.ghost {
  border: 1px solid var(--line);
  border-radius: 6px;
  background: transparent;
  padding: 6px 12px;
}

.danger {
  border: 1px solid transparent;
  border-radius: 6px;
  background: transparent;
  color: var(--danger);
  padding: 4px 8px;
}
.danger:hover { border-color: var(--danger); }

.link {
  border: 0;
  background: none;
  padding: 0;
  color: inherit;
  text-decoration: underline;
}

.muted { color: var(--muted); }
.error { color: var(--danger); min-height: 1.2em; margin: 0; }

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 18px;
}

h1, h2 { margin: 0 0 12px; }
h1 { font-size: 22px; }
h2 { font-size: 17px; }
h2 .muted { font-weight: 400; font-size: 14px; }

.login {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 16px;
}
.login form { width: min(360px, 100%); display: grid; gap: 12px; }
.login label { color: var(--ink); font-size: 14px; }

.top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 12px 20px;
  background: var(--ink);
  color: #f3f4f6;
}
.brand { display: flex; gap: 10px; align-items: baseline; }
.brand strong { font-size: 18px; }
.brand span, .who span { color: #c3cad3; font-size: 13px; }
.who { display: flex; gap: 10px; align-items: center; }
.who .ghost { border-color: #4b5563; color: #f3f4f6; }

.content {
  max-width: 900px;
  margin: 0 auto;
  padding: 20px 16px 40px;
  display: grid;
  gap: 16px;
}

.note {
  margin: 0;
  padding: 12px 14px;
  border-radius: 8px;
  background: var(--warn-bg);
  color: var(--warn);
  font-size: 14px;
  line-height: 1.45;
}

.create, .alias-fields {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px 12px;
}
.create .wide, .alias-fields .wide { grid-column: 1 / -1; }
.create .actions { grid-column: 1 / -1; display: flex; justify-content: flex-end; }

.created { margin: 12px 0 0; font-size: 14px; }

.address {
  border: 0;
  background: none;
  padding: 0;
  font-family: var(--mono);
  font-size: 15px;
  font-weight: 600;
  color: var(--ink);
  text-align: left;
  overflow-wrap: anywhere;
}
.address:hover { text-decoration: underline; }

.list-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 8px;
}
.list-head h2 { margin: 0; }
.list-head input { width: min(320px, 100%); }

.aliases { list-style: none; margin: 0; padding: 0; display: grid; }
.alias {
  display: grid;
  gap: 10px;
  padding: 14px 0;
  border-top: 1px solid var(--line);
}
.alias.off .address { color: var(--muted); text-decoration: line-through; }

.alias-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.switch { display: flex; gap: 6px; align-items: center; font-size: 13px; white-space: nowrap; }
.switch input { margin: 0; }

.alias-foot {
  display: flex;
  gap: 16px;
  align-items: center;
  flex-wrap: wrap;
  font-size: 12px;
}
.alias-foot .danger { margin-left: auto; font-size: 13px; }

.badge {
  display: inline-block;
  border-radius: 999px;
  padding: 1px 8px;
  font-size: 12px;
}
.badge.ok { background: var(--ok-bg); color: var(--ok); }
.badge.warn { background: var(--warn-bg); color: var(--warn); }

.toast {
  position: fixed;
  left: 50%;
  bottom: 20px;
  transform: translateX(-50%);
  max-width: calc(100% - 32px);
  padding: 10px 16px;
  border-radius: 8px;
  background: var(--ink);
  color: #fff;
  font-size: 14px;
  z-index: 10;
}
.toast.hidden { display: none; }

@media (max-width: 640px) {
  .create, .alias-fields { grid-template-columns: 1fr; }
  .top { flex-wrap: wrap; padding: 12px 16px; }
  .who span { display: none; }
}
