/* Mail admin page — builds on style.css */

body.admin { overflow-y: auto; }

.admin-top {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 24px;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}
.admin-top-right { display: flex; align-items: center; gap: 14px; }

.admin-main { max-width: 920px; margin: 0 auto; padding: 28px 16px 48px; display: grid; gap: 20px; }
.page-error:empty { display: none; }
.admin-card { padding: 28px; display: grid; gap: 18px; min-width: 0; }
.card-title { display: grid; gap: 4px; }
.card-title h2, .card-head h2, .success h2 { font-size: 20px; font-weight: 700; }

/* ---------- create form ---------- */
.create-form { display: grid; gap: 18px; max-width: 640px; }
.optional { color: var(--faint); font-weight: 500; }
.hint { font-size: 12.5px; color: var(--muted); margin: 0; }
.field-block { display: grid; gap: 7px; }
.field-title { font-size: 13.5px; font-weight: 600; color: var(--text-2); }

.address-builder {
  display: flex;
  align-items: stretch;
  border: 1.5px solid var(--line-strong);
  border-radius: 14px;
  background: var(--panel);
  overflow: hidden;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.address-builder:focus-within { border-color: var(--accent); box-shadow: var(--ring); }
.address-builder input,
.address-builder select {
  border: 0;
  border-radius: 0;
  box-shadow: none;
  height: 54px;
  font-size: 17px;
  background: transparent;
}
.address-builder input { flex: 1; min-width: 0; padding: 0 16px; font-weight: 600; }
.address-builder input:focus, .address-builder select:focus { box-shadow: none; }
.address-builder .at {
  display: grid;
  place-items: center;
  padding: 0 4px;
  color: var(--faint);
  font-size: 18px;
  font-weight: 600;
}
.address-builder select {
  width: auto;
  max-width: 55%;
  padding: 0 40px 0 10px;
  font-weight: 600;
  color: var(--accent);
  cursor: pointer;
  appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, currentColor 50%), linear-gradient(135deg, currentColor 50%, transparent 50%);
  background-position: calc(100% - 20px) 50%, calc(100% - 15px) 50%;
  background-size: 5px 5px;
  background-repeat: no-repeat;
}

.preview {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  border-radius: 14px;
  background: var(--panel-2);
  border: 1px solid var(--line);
}
.preview-icon {
  width: 32px;
  height: 32px;
  flex-shrink: 0;
  display: grid;
  place-items: center;
  border-radius: 50%;
  font-weight: 800;
  background: var(--hover);
  color: var(--faint);
}
.preview-text { display: grid; min-width: 0; }
.preview-text strong { font-size: 16px; overflow-wrap: anywhere; }
.preview-text span { font-size: 13px; color: var(--muted); }
.preview[data-state="empty"] strong { color: var(--faint); }
.preview[data-state="ok"] { background: color-mix(in srgb, #10b981 9%, var(--panel)); border-color: color-mix(in srgb, #10b981 35%, transparent); }
.preview[data-state="ok"] .preview-icon { background: #10b981; color: #fff; }
.preview[data-state="ok"] span { color: #047857; }
.preview[data-state="bad"] { background: color-mix(in srgb, var(--danger) 7%, var(--panel)); border-color: color-mix(in srgb, var(--danger) 30%, transparent); }
.preview[data-state="bad"] .preview-icon { background: var(--danger); color: #fff; }
.preview[data-state="bad"] span { color: var(--danger); }

.google-note {
  display: flex;
  gap: 12px;
  padding: 14px 16px;
  border-radius: 14px;
  background: #fffbeb;
  border: 1px solid #fcd34d;
  color: #78350f;
  font-size: 13.5px;
}
.google-note p { margin: 4px 0 10px; }
.note-icon {
  width: 24px;
  height: 24px;
  flex-shrink: 0;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: #f59e0b;
  color: #fff;
  font-weight: 800;
}
:root[data-theme="dark"] .google-note { background: #2a2210; border-color: #6b5313; color: #fde68a; }

.check-row { display: flex; align-items: flex-start; gap: 10px; font-weight: 500; cursor: pointer; }
.check-row input { margin-top: 2px; flex-shrink: 0; }
.admin-toggle { padding: 12px 14px; border: 1px solid var(--line-strong); border-radius: 12px; }
.admin-toggle:has(input:checked) { border-color: var(--accent); background: var(--accent-softer); }

.password-input { display: flex; gap: 8px; }
.password-input input { flex: 1; min-width: 0; font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; font-size: 15px; letter-spacing: 0.02em; }
.create-btn { justify-self: start; min-width: 240px; }
.create-btn:disabled { background: var(--line-strong); border-color: var(--line-strong); color: var(--muted); box-shadow: none; }

/* ---------- success card ---------- */
.success { display: grid; gap: 14px; justify-items: start; max-width: 640px; }
.success-badge {
  width: 52px;
  height: 52px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: #10b981;
  color: #fff;
  font-size: 26px;
  font-weight: 800;
  box-shadow: 0 6px 18px rgba(16, 185, 129, 0.35);
}
.success h2 { overflow-wrap: anywhere; }
.details {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 10px 20px;
  width: 100%;
  margin: 4px 0;
  padding: 16px 18px;
  border: 1px solid var(--line-strong);
  border-radius: 14px;
  background: var(--panel-2);
}
.details dt { color: var(--muted); font-size: 13px; font-weight: 600; }
.details dd { margin: 0; font-weight: 600; overflow-wrap: anywhere; }
.mono { font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; letter-spacing: 0.02em; }
.success-actions { display: flex; gap: 10px; flex-wrap: wrap; }

/* ---------- list ---------- */
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.list-filters { display: flex; gap: 8px; flex-wrap: wrap; }
.list-filters select, .list-filters input { width: auto; min-width: 180px; }
.table-wrap { overflow-x: auto; margin: 0 -8px; }
.accounts { width: 100%; border-collapse: collapse; font-size: 14px; }
.accounts th { text-align: left; font-size: 12px; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; color: var(--faint); padding: 8px; border-bottom: 1px solid var(--line); }
.accounts td { padding: 12px 8px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.accounts tr:last-child td { border-bottom: 0; }
.accounts td.address { font-weight: 600; overflow-wrap: anywhere; }
.accounts td.address .domain { color: var(--muted); font-weight: 500; }
.accounts td.actions { text-align: right; white-space: nowrap; }
.accounts td.actions .btn { margin-left: 6px; }
.accounts .empty-row td { text-align: center; color: var(--muted); padding: 28px 8px; }
.badge {
  display: inline-block;
  margin-left: 8px;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 11px;
  font-weight: 700;
  vertical-align: 1px;
}

/* ---------- reset password dialog ---------- */
.password-dialog-body { display: grid; gap: 14px; padding: 18px 24px 22px; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 10px; }

@media (max-width: 640px) {
  .admin-top { padding: 10px 14px; }
  #signed-in-as { display: none; }
  .admin-card { padding: 20px 16px; }
  .address-builder { flex-wrap: wrap; }
  .address-builder input { flex-basis: 100%; border-bottom: 1px solid var(--line); }
  .address-builder .at { padding-left: 16px; }
  .address-builder select { flex: 1; max-width: none; }
  .create-btn { width: 100%; }
  .accounts thead { display: none; }
  .accounts tr { display: grid; grid-template-columns: 1fr auto; gap: 2px 10px; padding: 12px 0; border-bottom: 1px solid var(--line); }
  .accounts td { padding: 0; border: 0; }
  .accounts td.col-created, .accounts td.col-size { color: var(--muted); font-size: 12px; }
  .accounts td.actions { grid-column: 1 / -1; text-align: left; padding-top: 8px; }
  .accounts td.actions .btn { margin: 0 6px 0 0; }
  .list-filters, .list-filters select, .list-filters input { width: 100%; }
}
