:root {
  --bg: #f4f7fb;
  --paper: #fff;
  --line: #e6eaf0;
  --text: #142033;
  --muted: #667085;
  --primary: #3157d5;
  --primary-dark: #2445b7;
  --danger: #d92d20;
  --danger-bg: #fff3f2;
  --ok: #027a48;
  --ok-bg: #ecfdf3;
  --warn: #b54708;
  --warn-bg: #fff8ed;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(15, 23, 42, .04), 0 8px 24px rgba(15, 23, 42, .05);
  --font: "Segoe UI", ui-sans-serif, system-ui, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
html { font-size: 15px; }
body {
  margin: 0;
  color: var(--text);
  font-family: var(--font);
  background: var(--bg);
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; }
button, input, select { font: inherit; color: inherit; }

.skip {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
.skip:focus {
  position: fixed;
  left: 8px;
  top: 8px;
  width: auto;
  height: auto;
  margin: 0;
  clip: auto;
  z-index: 40;
  background: var(--text);
  color: #fff;
  padding: 8px 12px;
  border-radius: 8px;
}

svg.icon {
  width: 18px !important;
  height: 18px !important;
  max-width: 18px;
  max-height: 18px;
  flex: 0 0 18px;
  display: block;
  overflow: hidden;
}

.mark {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  color: #fff;
  background: var(--primary);
  overflow: hidden;
  flex: 0 0 36px;
}
.mark svg.icon { width: 18px !important; height: 18px !important; }

.topbar {
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 0 24px;
  background: var(--paper);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 20;
  overflow: hidden;
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--text);
  min-width: 0;
}
.brand-text { display: flex; flex-direction: column; line-height: 1.15; }
.brand-text strong { font-size: 15px; letter-spacing: -.02em; }
.brand-text small { color: var(--muted); font-size: 12px; margin-top: 2px; }
.topbar-end { display: flex; align-items: center; gap: 12px; }
.topbar-domain {
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
  max-width: 240px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.main { max-width: 1080px; margin: 0 auto; padding: 28px 24px 64px; }
.main.narrow { max-width: 640px; }

.panel {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.panel-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 20px 22px 0;
}
.panel-head h1 {
  margin: 0;
  font-size: 22px;
  letter-spacing: -.03em;
}
.meta { margin: 4px 0 0; color: var(--muted); font-size: 13px; }
.back {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--primary);
  text-decoration: none;
  font-size: 13px;
  font-weight: 650;
  margin-bottom: 8px;
}
.panel-alerts { padding: 12px 22px 0; }
.panel-alerts .notice { margin-bottom: 0; }
.form-panel { padding-bottom: 22px; }
.form-panel .panel-head { padding-bottom: 8px; }
.form-panel form { padding: 8px 22px 0; }

.toolbar {
  display: grid;
  grid-template-columns: 220px 1fr auto;
  gap: 12px;
  align-items: end;
  padding: 18px 22px;
  border-bottom: 1px solid var(--line);
}
.toolbar .grow { min-width: 0; }

.field { display: flex; flex-direction: column; gap: 6px; }
.field label {
  font-size: 12px;
  font-weight: 700;
  color: #475467;
}
.field input,
.field select {
  height: 42px;
  width: 100%;
  border: 1px solid #d8dee8;
  border-radius: 10px;
  padding: 0 12px;
  background: #fff;
  outline: none;
}
.field input:focus,
.field select:focus { border-color: #7b93e6; box-shadow: 0 0 0 3px rgba(49, 87, 213, .12); }
.field input[readonly] { background: #f7f8fb; color: #344054; }

.search-wrap,
.password-wrap { position: relative; }
.search-wrap svg.icon {
  position: absolute;
  left: 12px;
  top: 13px;
  width: 16px !important;
  height: 16px !important;
  color: #98a2b3;
  pointer-events: none;
}
.search-wrap input { padding-left: 36px; }
.password-wrap input { padding-right: 42px; }

.mailbox-list { list-style: none; margin: 0; padding: 0; }
.mailbox-list li { list-style: none; }
.mailbox-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  align-items: center;
  padding: 12px 22px;
  border-top: 1px solid #eef1f5;
}
.mailbox-row:first-child { border-top: 0; }
.mailbox-row:hover { background: #fafbfd; }
.mailbox-row[hidden],
.mailbox-list[hidden],
.empty[hidden],
.pager[hidden] { display: none !important; }

.mailbox { display: flex; align-items: center; gap: 12px; min-width: 0; }
.avatar {
  width: 36px;
  height: 36px;
  border-radius: 9px;
  display: grid;
  place-items: center;
  background: #eef2ff;
  color: var(--primary);
  font-weight: 800;
  font-size: 12px;
  flex: 0 0 auto;
}
.email-cell {
  font-weight: 650;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.badge {
  display: inline-flex;
  margin-left: 8px;
  padding: 2px 7px;
  border-radius: 999px;
  background: #eef2ff;
  color: var(--primary);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .04em;
  text-transform: uppercase;
  vertical-align: 1px;
}
.row-actions { display: flex; gap: 8px; }

.btn {
  height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  border: 1px solid transparent;
  border-radius: 10px;
  padding: 0 14px;
  background: #eef1f6;
  color: #344054;
  text-decoration: none;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
}
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.primary { background: var(--primary); color: #fff; }
.btn.primary:hover { background: var(--primary-dark); }
.btn.ghost { background: #fff; border-color: #dfe4ec; }
.btn.ghost:hover { background: #f8fafc; }
.btn.danger { background: #fff; border-color: #f0c8c4; color: var(--danger); }
.btn.danger:hover { background: var(--danger-bg); }
.btn.sm { height: 34px; padding: 0 10px; font-size: 12px; }
.btn.block { width: 100%; height: 42px; }
.icon-btn {
  position: absolute;
  right: 4px;
  top: 4px;
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border: 0;
  background: transparent;
  color: #667085;
  cursor: pointer;
  border-radius: 8px;
}
.icon-btn svg.icon { width: 16px !important; height: 16px !important; }
.link-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  border: 0;
  background: none;
  color: var(--primary);
  font-weight: 700;
  font-size: 12px;
  cursor: pointer;
  padding: 0;
}

.notice {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 14px;
  border-radius: 10px;
  margin-bottom: 16px;
  font-size: 13px;
  font-weight: 650;
}
.notice.ok { background: var(--ok-bg); color: var(--ok); border: 1px solid #abefc6; }
.notice.danger { background: var(--danger-bg); color: #9d241b; border: 1px solid #f7c9c4; }
.notice.warn { background: var(--warn-bg); color: var(--warn); border: 1px solid #f5d8a8; }
.notice-close {
  margin-left: auto;
  border: 0;
  background: transparent;
  color: inherit;
  cursor: pointer;
}
.empty {
  padding: 48px 20px;
  text-align: center;
  color: var(--muted);
}
.empty strong { display: block; color: #344054; margin-bottom: 4px; }

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}
.full { grid-column: 1 / -1; }
.generate-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}
.email-input { display: flex; }
.email-input input { border-radius: 10px 0 0 10px; flex: 1; min-width: 0; }
.email-input span {
  display: flex;
  align-items: center;
  background: #f5f7fa;
  border: 1px solid #d8dee8;
  border-left: 0;
  padding: 0 12px;
  color: var(--muted);
  border-radius: 0 10px 10px 0;
  white-space: nowrap;
  font-weight: 650;
}
.password-meter {
  height: 4px;
  border-radius: 999px;
  background: #edf0f5;
  overflow: hidden;
}
.password-meter i { display: block; height: 100%; width: 0; background: var(--primary); }
.password-meter.is-weak i { background: var(--danger); }
.password-meter.is-ok i { background: #d97706; }
.password-meter.is-strong i { background: var(--ok); }
.hint { font-size: 12px; color: var(--muted); }
.hint.is-ok { color: var(--ok); }
.hint.is-bad { color: var(--danger); }
.form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding-top: 4px;
}

.modal {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, .5);
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 50;
}
.modal.is-open { display: flex; }
.modal-box {
  width: min(420px, 100%);
  background: #fff;
  border-radius: 14px;
  padding: 22px;
  box-shadow: 0 24px 70px rgba(0, 0, 0, .18);
}
.modal-box h2 { margin: 0; font-size: 18px; }
.modal-box p { color: var(--muted); line-height: 1.5; }
.modal-target {
  background: #f6f8fb;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 11px 12px;
  font-weight: 700;
  word-break: break-all;
}
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 18px; }

.pager {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  padding: 12px 22px;
  border-top: 1px solid var(--line);
  background: #fafbfd;
}
.pager-status { color: var(--muted); font-size: 13px; }
.pager-controls { display: flex; align-items: center; gap: 6px; }
.pager-pages { display: flex; align-items: center; gap: 4px; }
.pager .btn.is-current {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}
.pager-ellipsis { color: var(--muted); padding: 0 4px; }

.auth {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background: radial-gradient(circle at 50% 0, #eaf0ff 0, var(--bg) 42%);
}
.auth-card {
  width: min(400px, 100%);
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: var(--shadow);
  padding: 28px;
}
.auth-card h1 { margin: 16px 0 0; font-size: 24px; letter-spacing: -.03em; }
.auth-card .lede { color: var(--muted); margin: 6px 0 22px; }
.auth-card .field { margin-bottom: 16px; }

@media (max-width: 800px) {
  .toolbar { grid-template-columns: 1fr 1fr; }
  .toolbar-refresh { grid-column: 1 / -1; }
}
@media (max-width: 640px) {
  .topbar { padding: 0 14px; }
  .topbar-domain, .brand-text small { display: none; }
  .main { padding: 18px 14px 48px; }
  .panel-head { display: block; padding: 16px 16px 0; }
  .panel-head .btn { width: 100%; margin-top: 12px; }
  .toolbar { grid-template-columns: 1fr; padding: 14px 16px; }
  .mailbox-row { grid-template-columns: 1fr; padding: 12px 16px; }
  .row-actions { justify-content: stretch; }
  .row-actions .btn { flex: 1; }
  .form-grid { grid-template-columns: 1fr; }
  .form-panel form { padding: 8px 16px 0; }
  .form-actions { display: grid; grid-template-columns: 1fr; }
  .form-actions .btn { width: 100%; }
  .pager { padding: 12px 16px; }
  .pager-controls { width: 100%; justify-content: space-between; }
}
