:root {
  --bg: #f7f9fd;
  --card: #ffffff;
  --line: #dfe7f2;
  --text: #0f172a;
  --muted: #64748b;
  --blue: #2563eb;
  --blue-2: #60a5fa;
  --green: #16a34a;
  --shadow: 0 14px 40px rgba(15, 23, 42, 0.08);
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  min-height: 100vh;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
  background: radial-gradient(circle at top left, #ffffff 0, var(--bg) 44%, #f8fbff 100%);
  color: var(--text);
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

select {
  font: inherit;
}

a,
button,
input,
select {
  transition: border-color 0.18s ease, background-color 0.18s ease, color 0.18s ease, box-shadow 0.18s ease, transform 0.18s ease, opacity 0.18s ease;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.62;
}

button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible {
  outline: 3px solid rgba(37, 99, 235, 0.18);
  outline-offset: 2px;
}

.topbar {
  height: 76px;
  padding: 0 28px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.88);
  backdrop-filter: blur(18px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
  height: 40px;
  font-size: 30px;
  font-weight: 850;
  line-height: 1;
  letter-spacing: 0;
}

.brand-link,
.nav-btn {
  text-decoration: none;
}

.brand > span {
  display: inline-flex;
  align-items: center;
  height: 40px;
  line-height: 1;
  padding-bottom: 1px;
}

.brand span span {
  color: var(--blue);
}

.brand-icon {
  flex: 0 0 auto;
  width: 40px;
  height: 40px;
  border-radius: 9px;
  color: #ffffff;
  background: linear-gradient(145deg, #60a5fa, #2563eb);
  display: grid;
  place-items: center;
  box-shadow: 0 10px 18px rgba(37, 99, 235, 0.25);
}

.brand-icon svg {
  width: 22px;
  height: 22px;
  display: block;
}

.main-nav {
  display: flex;
  align-items: center;
  gap: 10px;
}

.auth-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 750;
}

.auth-actions button,
.table-actions button,
.group-card button,
.expiry-control button {
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 9px;
  color: #1e293b;
  background: #ffffff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 12px;
  font-weight: 800;
}

.auth-actions button:hover,
.table-actions button:hover,
.group-card button:hover,
.expiry-control button:hover {
  color: var(--blue);
  border-color: #bfdbfe;
  background: #eff6ff;
  transform: translateY(-1px);
}

.auth-actions svg,
.table-actions svg,
.group-card svg,
.expiry-control svg {
  width: 17px;
  height: 17px;
}

.auth-shell {
  width: min(100% - clamp(20px, 4vw, 48px), 360px);
  margin: clamp(28px, 8vw, 76px) auto;
}

.auth-card {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #ffffff;
  box-shadow: 0 10px 28px rgba(15, 23, 42, 0.08);
  padding: 24px 22px 28px;
  animation: panelIn 0.24s ease both;
}

.auth-brand {
  margin-bottom: 28px;
  text-align: center;
}

.auth-brand-icon {
  width: 48px;
  height: 48px;
  margin: 0 auto 10px;
  border-radius: 10px;
  color: #ffffff;
  background: linear-gradient(145deg, #60a5fa, #2563eb);
  display: grid;
  place-items: center;
  box-shadow: 0 10px 18px rgba(37, 99, 235, 0.22);
}

.auth-brand-icon svg {
  width: 26px;
  height: 26px;
}

.auth-brand strong {
  color: #172554;
  font-size: 28px;
  font-weight: 900;
  line-height: 1;
  letter-spacing: 0;
}

.auth-brand strong span {
  color: var(--blue);
}

.auth-brand p {
  margin-top: 9px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.auth-form,
.admin-form {
  margin-top: 0;
  display: grid;
  gap: 13px;
}

.auth-form label,
.admin-form label,
.group-card label,
.expiry-control label {
  display: grid;
  gap: 6px;
  color: #1e3a5f;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.02em;
}

.label-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.label-row a {
  color: var(--blue);
  font-size: 11px;
  font-weight: 750;
  text-decoration: none;
}

.auth-form input,
.admin-form input,
.admin-form select,
.group-card input,
.expiry-control input,
.admin-table select,
.admin-search input {
  width: 100%;
  min-height: 38px;
  border: 1px solid #cfd8e3;
  border-radius: 6px;
  color: var(--text);
  background: #ffffff;
  padding: 0 11px;
  outline: none;
}

.auth-form input:focus,
.admin-form input:focus,
.admin-form select:focus,
.group-card input:focus,
.expiry-control input:focus,
.admin-table select:focus,
.admin-search input:focus {
  border-color: #93c5fd;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.password-field {
  position: relative;
  display: block;
}

.password-field input {
  padding-right: 50px;
}

.password-field button {
  position: absolute;
  top: 50%;
  right: 7px;
  width: 30px;
  height: 30px;
  transform: translateY(-50%);
  border: 0;
  border-radius: 6px;
  color: #475569;
  background: transparent;
  display: grid;
  place-items: center;
}

.password-field button:hover {
  color: var(--blue);
  background: #eff6ff;
}

.password-field svg {
  width: 17px;
  height: 17px;
}

.password-strength {
  height: 5px;
  border-radius: 999px;
  background: #e2e8f0;
  overflow: hidden;
}

.password-strength span {
  display: block;
  height: 100%;
  width: 0;
  border-radius: inherit;
  overflow: hidden;
  text-indent: -999px;
  transition: 0.2s ease;
}

.password-strength .lemah {
  width: 34%;
  background: #ef4444;
}

.password-strength .sedang {
  width: 68%;
  background: #f59e0b;
}

.password-strength .kuat {
  width: 100%;
  background: #22c55e;
}

.auth-switch {
  margin-top: 16px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.55;
  text-align: center;
}

.auth-switch button,
.auth-switch a {
  border: 0;
  color: var(--blue);
  background: transparent;
  font-weight: 850;
  text-decoration: none;
}

.auth-switch button:hover,
.auth-switch a:hover,
.label-row a:hover {
  color: #1d4ed8;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.admin-card {
  padding: 24px;
  margin-bottom: 18px;
  animation: panelIn 0.24s ease both;
}

.admin-card .section-title h2,
.admin-section-head h2 {
  color: #0f172a;
}

.admin-card .section-title p {
  color: #475569;
}

.admin-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.admin-stats {
  margin-top: 22px;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.stat-card {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #f8fbff;
  padding: 16px;
  display: grid;
  gap: 4px;
  transition: 0.18s ease;
}

.stat-card strong {
  font-size: 28px;
  line-height: 1;
}

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

.admin-search {
  position: relative;
  width: min(100%, 280px);
}

.admin-search svg {
  position: absolute;
  top: 50%;
  left: 12px;
  width: 18px;
  height: 18px;
  color: #64748b;
  transform: translateY(-50%);
}

.admin-search input {
  padding-left: 40px;
}

.admin-section-head h2 {
  font-size: 20px;
}

.admin-form {
  grid-template-columns: repeat(6, minmax(120px, 1fr)) auto;
  align-items: end;
}

.admin-form .generate-btn {
  min-width: 0;
  height: 38px;
  white-space: nowrap;
}

.group-settings {
  margin-top: 18px;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.group-card {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #f8fbff;
  padding: 16px;
  display: grid;
  gap: 12px;
  transition: 0.18s ease;
}

.group-card:hover,
.stat-card:hover {
  border-color: #bfdbfe;
  transform: translateY(-1px);
  box-shadow: 0 12px 24px rgba(15, 23, 42, 0.06);
}

.group-card h3 {
  font-size: 17px;
}

.admin-table-wrap {
  margin-top: 16px;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 12px;
}

.admin-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 920px;
  background: #ffffff;
}

.admin-table th,
.admin-table td {
  border-bottom: 1px solid var(--line);
  padding: 12px;
  text-align: left;
  vertical-align: middle;
  color: #1e293b;
  font-size: 14px;
}

.admin-table th {
  color: #334155;
  background: #f8fbff;
  font-weight: 850;
}

.admin-table tbody tr {
  transition: background-color 0.16s ease;
}

.admin-table tbody tr:hover {
  background: #f8fbff;
}

.admin-table td:nth-child(2),
.admin-table td:nth-child(3) {
  color: #334155;
}

.status-pill {
  display: inline-flex;
  min-width: 78px;
  justify-content: center;
  border-radius: 999px;
  padding: 6px 10px;
  color: #475569;
  background: #e2e8f0;
  font-size: 12px;
  font-weight: 850;
}

.status-pill.approved {
  color: #15803d;
  background: #dcfce7;
}

.status-pill.pending {
  color: #a16207;
  background: #fef3c7;
}

.status-pill.blocked {
  color: #b91c1c;
  background: #fee2e2;
}

.table-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.table-actions button {
  min-width: 78px;
}

.table-actions .danger {
  color: #b91c1c;
  border-color: #fecaca;
}

.expiry-control {
  min-width: 210px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.expiry-control input {
  width: 132px;
  padding: 0 8px;
}

.expiry-control button {
  color: var(--blue);
  background: #eff6ff;
  padding: 0 10px;
}

@keyframes panelIn {
  from {
    opacity: 0;
    transform: translateY(8px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.nav-btn {
  height: 42px;
  padding: 0 14px;
  border: 1px solid transparent;
  border-radius: 10px;
  color: #334155;
  background: transparent;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-weight: 800;
  cursor: pointer;
  transition: 0.18s ease;
}

.nav-btn:hover,
.nav-btn.active {
  color: var(--blue);
  border-color: #dbeafe;
  background: #eff6ff;
}

.nav-btn:hover {
  transform: translateY(-1px);
}

.nav-btn svg {
  width: 18px;
  height: 18px;
}

.page-shell {
  width: min(100% - clamp(20px, 4vw, 48px), 1480px);
  margin: clamp(12px, 2vw, 22px) auto;
}

.view-page {
  display: none;
}

.view-page.active {
  display: block;
}

.email-card,
.history-card,
.inbox-card {
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: var(--shadow);
}

.email-card {
  min-height: 166px;
  padding: 30px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 32px;
}

.email-identity {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 28px;
}

.mail-avatar {
  position: relative;
  flex: 0 0 auto;
  width: 104px;
  height: 104px;
  border-radius: 999px;
  color: var(--blue);
  background: linear-gradient(145deg, #eaf3ff, #f5f8ff);
  display: grid;
  place-items: center;
}

.mail-avatar svg {
  width: 58px;
  height: 58px;
  stroke-width: 1.8;
  filter: drop-shadow(0 8px 12px rgba(37, 99, 235, 0.2));
}

.online-dot {
  position: absolute;
  right: 8px;
  bottom: 12px;
  width: 18px;
  height: 18px;
  border-radius: 999px;
  border: 4px solid #eff6ff;
  background: #22c55e;
}

.email-copy {
  min-width: 0;
}

.email-copy p,
.section-title p,
.empty-list p,
.empty-preview p {
  color: var(--muted);
}

.email-copy p {
  margin-bottom: 8px;
  font-size: 14px;
  font-weight: 650;
  color: #1e293b;
}

.email-line {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 12px;
}

#emailAddr {
  overflow-wrap: anywhere;
  font-size: clamp(21px, 2.1vw, 29px);
  font-weight: 850;
  letter-spacing: 0;
}

.mini-copy {
  flex: 0 0 auto;
  width: 38px;
  height: 38px;
  border: 1px solid var(--line);
  border-radius: 9px;
  color: #334155;
  background: #ffffff;
  display: grid;
  place-items: center;
  transition: 0.18s ease;
}

.mini-copy:hover,
.mini-copy.copied {
  color: #ffffff;
  border-color: transparent;
  background: var(--blue);
  transform: translateY(-1px);
}

.ready-status {
  margin-top: 10px;
  color: #64748b;
  font-size: 14px;
  font-weight: 750;
  display: flex;
  align-items: center;
  gap: 7px;
}

.ready-status.is-ready {
  color: var(--green);
}

.ready-status svg {
  width: 16px;
  height: 16px;
}

.email-actions {
  flex: 0 1 390px;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 14px;
  max-width: 390px;
}

.email-actions button,
.see-all-btn,
.refresh-info button,
.filter-btn {
  border: 1px solid var(--line);
  background: #ffffff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.email-actions button {
  flex: 1 1 178px;
  min-width: 170px;
  height: 48px;
  padding: 0 18px;
  border-radius: 8px;
  gap: 10px;
  white-space: nowrap;
  line-height: 1;
  font-weight: 800;
  box-shadow: 0 10px 18px rgba(15, 23, 42, 0.04);
  transition: transform 0.18s ease, box-shadow 0.18s ease, filter 0.18s ease;
}

.email-actions button:hover,
.see-all-btn:hover,
.refresh-info button:hover,
.filter-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 12px 22px rgba(15, 23, 42, 0.08);
}

.email-actions button:active,
.see-all-btn:active,
.refresh-info button:active,
.filter-btn:active,
.table-actions button:active,
.group-card button:active,
.expiry-control button:active,
.bulk-delete-btn:active,
.bulk-copy-btn:active {
  transform: translateY(0);
}

.email-actions button.is-busy {
  filter: saturate(0.8);
  opacity: 0.76;
}

.email-actions button svg {
  flex: 0 0 auto;
  width: 21px;
  height: 21px;
}

.qr-btn {
  border-color: transparent;
  color: #ffffff;
  background: linear-gradient(135deg, #22c55e, #16a34a) !important;
}

.generate-btn {
  border-color: transparent;
  color: #ffffff;
  background: linear-gradient(135deg, #2563eb, #1d7df2) !important;
}

.auth-form .generate-btn {
  width: 100%;
  min-height: 42px;
  margin-top: 2px;
  border-radius: 7px;
  box-shadow: 0 8px 18px rgba(37, 99, 235, 0.24);
}

.auth-form .generate-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 12px 24px rgba(37, 99, 235, 0.28);
}

.history-card {
  position: relative;
  margin-top: 28px;
  min-height: 112px;
  padding: 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 20px;
}

.section-title,
.inbox-title {
  display: flex;
  align-items: center;
}

.section-title {
  gap: 26px;
}

.section-icon,
.inbox-icon {
  color: var(--blue);
  background: #dbeafe;
  display: grid;
  place-items: center;
}

.section-icon {
  width: 62px;
  height: 62px;
  border-radius: 999px;
}

.section-title h2,
.inbox-title h2 {
  font-size: 20px;
  line-height: 1.2;
}

.section-title p {
  margin-top: 10px;
  font-size: 16px;
}

.see-all-btn {
  height: 44px;
  padding: 0 15px 0 18px;
  border-radius: 9px;
  color: #2563eb;
  gap: 8px;
  font-weight: 800;
}

.history-list {
  flex: 0 0 100%;
  display: grid;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 12px;
  color: inherit;
  pointer-events: auto;
  transition: 0.2s ease;
}

.history-row {
  display: grid;
  grid-template-columns: minmax(240px, 1.3fr) minmax(170px, 0.7fr) minmax(430px, auto);
  align-items: center;
  gap: 16px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.78);
  transition: 0.18s ease;
}

.history-row:last-child {
  border-bottom: 0;
}

.history-row:hover {
  background: #f8fbff;
}

.history-mail {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 14px;
}

.history-mail strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.history-mail-icon {
  flex: 0 0 auto;
  width: 40px;
  height: 40px;
  border: 1px solid var(--line);
  border-radius: 9px;
  color: var(--blue);
  background: #f8fbff;
  display: grid;
  place-items: center;
}

.history-date {
  color: #475569;
}

.history-actions-row {
  display: grid;
  grid-template-columns: 1fr 1.08fr 0.72fr;
  gap: 14px;
}

.history-actions-row button {
  height: 44px;
  border: 1px solid var(--line);
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-weight: 800;
  white-space: nowrap;
  cursor: pointer;
  transition: 0.18s ease;
}

.history-actions-row button:hover {
  transform: translateY(-1px);
  box-shadow: 0 12px 22px rgba(15, 23, 42, 0.08);
}

.history-use-btn {
  color: #334155;
  background: #ffffff;
}

.history-otp-btn {
  border-color: transparent !important;
  color: #ffffff;
  background: linear-gradient(135deg, #2563eb, #1d7df2);
}

.history-delete-btn {
  border-color: transparent !important;
  color: #ffffff;
  background: linear-gradient(135deg, #ef4444, #dc2626);
}

.history-empty {
  padding: 18px;
  color: var(--muted);
}

.bulk-card {
  align-items: flex-start;
}

.bulk-progress {
  flex: 0 0 100%;
  height: 10px;
  overflow: hidden;
  border-radius: 999px;
  background: #e2e8f0;
}

.bulk-progress-bar {
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(135deg, #22c55e, #2563eb);
  transition: width 0.25s ease;
}

.bulk-result-list {
  flex: 0 0 100%;
  display: grid;
  gap: 10px;
}

.bulk-result {
  min-height: 50px;
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr) auto 40px auto;
  align-items: center;
  gap: 12px;
  background: #ffffff;
}

.bulk-result.success {
  cursor: pointer;
}

.bulk-result.success:hover {
  border-color: #bfdbfe;
  background: #f8fbff;
}

.bulk-result strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.bulk-result small {
  color: var(--muted);
  white-space: nowrap;
}

.bulk-result-icon {
  width: 34px;
  height: 34px;
  border-radius: 9px;
  display: grid;
  place-items: center;
}

.bulk-result.success .bulk-result-icon {
  color: #16a34a;
  background: #dcfce7;
}

.bulk-result.failed .bulk-result-icon {
  color: #dc2626;
  background: #fee2e2;
}

.bulk-delete-btn {
  height: 36px;
  padding: 0 12px;
  border: 0;
  border-radius: 8px;
  color: #ffffff;
  background: linear-gradient(135deg, #ef4444, #dc2626);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-weight: 800;
  transition: 0.18s ease;
}

.bulk-delete-btn:hover {
  filter: brightness(1.03);
  transform: translateY(-1px);
}

.bulk-copy-btn {
  width: 36px;
  height: 36px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: #334155;
  background: #ffffff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: 0.18s ease;
}

.bulk-copy-btn:hover {
  color: #ffffff;
  border-color: transparent;
  background: var(--blue);
}

.bulk-copy-btn svg {
  width: 17px;
  height: 17px;
}

.bulk-delete-btn svg {
  width: 16px;
  height: 16px;
}

.bulk-inbox-card {
  margin-top: 28px;
}

.history-expanded .see-all-btn svg {
  transform: rotate(90deg);
}

.inbox-card {
  margin-top: 28px;
  overflow: hidden;
}

.inbox-header {
  min-height: 82px;
  padding: 0 24px;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.inbox-title {
  gap: 12px;
}

.inbox-icon {
  width: 32px;
  height: 32px;
  border-radius: 9px;
}

.inbox-icon svg {
  width: 20px;
  height: 20px;
}

.inbox-title span {
  min-width: 24px;
  height: 24px;
  padding: 0 7px;
  border-radius: 999px;
  color: var(--blue);
  background: #dbeafe;
  font-size: 13px;
  font-weight: 850;
  display: grid;
  place-items: center;
}

.refresh-info {
  display: flex;
  align-items: center;
  gap: 10px;
  color: #0f172a;
  font-size: 15px;
}

.refresh-info > span {
  width: 9px;
  height: 9px;
  border-radius: 999px;
  background: #22c55e;
}

.refresh-info button {
  width: 42px;
  height: 42px;
  border-radius: 9px;
  color: #334155;
}

.refresh-info button:first-of-type {
  margin-left: 18px;
}

.inbox-layout {
  min-height: 474px;
  display: grid;
  grid-template-columns: minmax(340px, 448px) minmax(0, 1fr);
}

.inbox-sidebar {
  border-right: 1px solid var(--line);
  background: linear-gradient(180deg, #ffffff 0%, #f9fbff 100%);
}

.search-row {
  padding: 18px 24px;
  display: grid;
  grid-template-columns: 1fr 44px;
  gap: 12px;
}

.search-box {
  min-width: 0;
  height: 44px;
  padding: 0 16px;
  border: 1px solid #e6edf7;
  border-radius: 9px;
  color: #334155;
  background: #f1f5f9;
  display: flex;
  align-items: center;
  gap: 12px;
  transition: 0.18s ease;
}

.search-box:focus-within {
  border-color: #93c5fd;
  background: #ffffff;
  box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.09);
}

.search-box input {
  min-width: 0;
  width: 100%;
  border: 0;
  outline: 0;
  color: #0f172a;
  background: transparent;
}

.search-box input::placeholder {
  color: #64748b;
}

.filter-btn {
  height: 44px;
  border-radius: 9px;
  color: #334155;
  transition: 0.18s ease;
}

.inbox-list {
  min-height: 372px;
  padding: 18px 24px 26px;
}

.empty-list,
.empty-preview {
  height: 100%;
  min-height: 330px;
  color: #0f172a;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
}

.empty-list-art,
.empty-preview-art {
  color: var(--blue);
  display: grid;
  place-items: center;
}

.empty-list-art {
  width: 108px;
  height: 108px;
}

.empty-list-art svg {
  width: 76px;
  height: 76px;
  stroke-width: 1.3;
  filter: drop-shadow(0 14px 20px rgba(37, 99, 235, 0.18));
}

.empty-list h3,
.empty-preview h3 {
  margin-top: 16px;
  font-size: 22px;
}

.empty-list p,
.empty-preview p {
  margin-top: 10px;
  max-width: 380px;
  font-size: 16px;
  line-height: 1.55;
}

.email-item {
  position: relative;
  margin-bottom: 12px;
  padding: 15px 15px 15px 28px;
  border: 1px solid #e6edf7;
  border-radius: 10px;
  background: #ffffff;
  cursor: pointer;
  box-shadow: 0 8px 16px rgba(15, 23, 42, 0.04);
  transition: 0.18s ease;
}

.email-item:hover {
  border-color: #bfdbfe;
  background: #f8fbff;
  transform: translateY(-1px);
}

.email-dot {
  position: absolute;
  top: 20px;
  left: 12px;
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: var(--blue);
}

.email-item-body {
  min-width: 0;
}

.email-item-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.email-item-top strong,
.email-item-body b,
.email-item-body p {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.email-item-top strong {
  min-width: 0;
}

.email-item-top time,
.email-item-body p {
  color: #64748b;
}

.email-item-body b {
  display: block;
  margin-top: 6px;
}

.email-item-body p {
  margin-top: 6px;
  font-size: 14px;
}

.email-item[hidden] {
  display: none;
}

.email-preview {
  min-width: 0;
  padding: 36px;
  overflow-y: auto;
  line-height: 1.8;
}

.preview-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
  padding-bottom: 22px;
  border-bottom: 1px solid var(--line);
}

.preview-header h3 {
  font-size: 22px;
}

.preview-header p,
.preview-header time {
  color: #475569;
}

.preview-body {
  padding-top: 26px;
}

.empty-preview-art {
  width: 214px;
  height: 214px;
  border-radius: 999px;
  background: linear-gradient(145deg, #eef6ff, #e8f1ff);
}

.empty-preview-art svg {
  width: 92px;
  height: 92px;
  stroke-width: 1.2;
  filter: drop-shadow(0 16px 22px rgba(37, 99, 235, 0.22));
}

.qr-popup {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(15, 23, 42, 0.45);
  backdrop-filter: blur(4px);
}

.qr-popup.show {
  display: flex;
}

.qr-popup-content {
  position: relative;
  width: 430px;
  max-width: 100%;
  padding: 34px 30px;
  border-radius: 20px;
  background: #ffffff;
  text-align: center;
  box-shadow: 0 24px 70px rgba(15, 23, 42, 0.2);
}

.close-qr {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 40px;
  height: 40px;
  border: 0;
  border-radius: 999px;
  color: #334155;
  background: #f1f5f9;
  display: grid;
  place-items: center;
}

.qr-popup-content h3 {
  font-size: 28px;
}

.qr-subtitle {
  margin: 10px 0 24px;
  color: var(--muted);
  line-height: 1.5;
}

.qr-box {
  margin-bottom: 18px;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #f8fafc;
  display: flex;
  justify-content: center;
}

.qr-email {
  color: var(--blue);
  font-weight: 800;
  overflow-wrap: anywhere;
}

#toastNotification {
  position: fixed;
  top: 28px;
  right: 28px;
  z-index: 99999;
  max-width: calc(100vw - 56px);
  padding: 14px 20px;
  border-radius: 11px;
  color: #ffffff;
  background: #0f172a;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-16px);
  transition: 0.2s ease;
  box-shadow: 0 18px 40px rgba(15, 23, 42, 0.24);
}

#toastNotification.show {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

@media (max-width: 1100px) {
  .email-card {
    align-items: flex-start;
    flex-direction: column;
    gap: 24px;
  }

  .email-actions {
    width: 100%;
    max-width: none;
    justify-content: flex-start;
    gap: 12px;
  }

  .email-actions button {
    flex: 1 1 220px;
  }

  .inbox-layout {
    grid-template-columns: minmax(300px, 360px) minmax(0, 1fr);
  }

  .history-row {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .history-actions-row {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 960px) {
  .email-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .email-actions button {
    width: 100%;
    min-width: 0;
    padding: 0 12px;
    font-size: 14px;
  }

  .generate-btn {
    min-width: 0 !important;
  }

  .inbox-layout {
    grid-template-columns: 1fr;
  }

  .inbox-sidebar {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .inbox-list {
    min-height: 260px;
  }

  .email-preview {
    min-height: 360px;
  }
}

@media (max-width: 820px) {
  .topbar {
    height: auto;
    padding: 14px 18px;
    align-items: flex-start;
    flex-direction: column;
  }

  .main-nav {
    width: 100%;
  }

  .nav-btn {
    flex: 1;
  }

  .page-shell {
    width: min(100% - 28px, 1480px);
    margin: 14px auto;
  }

  .email-card,
  .history-card {
    padding: 20px;
  }

  .email-card,
  .inbox-card,
  .history-card {
    border-radius: 14px;
  }

  .email-identity,
  .section-title {
    gap: 16px;
    align-items: flex-start;
  }

  .mail-avatar {
    width: 76px;
    height: 76px;
  }

  .mail-avatar svg {
    width: 42px;
    height: 42px;
  }

  .email-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .history-card,
  .inbox-header {
    flex-direction: column;
    align-items: stretch;
  }

  .email-actions button,
  .see-all-btn {
    width: 100%;
    min-width: 0;
  }

  .history-list {
    margin-top: 12px;
  }

  .inbox-header {
    padding: 18px;
    gap: 16px;
  }

  .refresh-info {
    justify-content: space-between;
  }

  .inbox-layout {
    grid-template-columns: 1fr;
  }

  .email-preview {
    padding: 28px 18px;
  }
}

@media (max-width: 700px) {
  .email-card {
    min-height: auto;
  }

  .email-actions {
    grid-template-columns: 1fr;
  }

  .history-card {
    min-height: auto;
  }

  .search-row {
    grid-template-columns: 1fr;
  }

  .filter-btn {
    width: 100%;
  }

  .history-actions-row {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 560px) {
  .topbar {
    padding: 12px 14px;
    height: auto;
    flex-wrap: wrap;
  }

  .brand {
    height: 36px;
    gap: 10px;
    font-size: 24px;
  }

  .brand > span {
    height: 36px;
  }

  .brand-icon {
    width: 36px;
    height: 36px;
  }

  .main-nav {
    width: 100%;
    order: 3;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  }

  .nav-btn {
    width: 100%;
    padding: 0 8px;
    font-size: 13px;
  }

  .auth-actions {
    margin-left: auto;
    max-width: 100%;
  }

  .auth-actions span {
    max-width: 138px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .auth-shell {
    width: min(100% - 20px, 360px);
    margin: 16px auto;
  }

  .auth-card {
    padding: 22px 18px 24px;
  }

  .admin-card {
    padding: 16px;
  }

  .admin-form,
  .group-settings {
    grid-template-columns: 1fr;
  }

  .admin-stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .admin-section-head {
    align-items: stretch;
    flex-direction: column;
  }

  .admin-search {
    width: 100%;
  }

  .page-shell {
    width: min(100% - 20px, 1480px);
    margin: 10px auto;
  }

  .email-card,
  .history-card {
    padding: 16px;
  }

  .email-identity {
    width: 100%;
    gap: 12px;
  }

  .mail-avatar {
    width: 58px;
    height: 58px;
  }

  .mail-avatar svg {
    width: 32px;
    height: 32px;
  }

  .online-dot {
    right: 2px;
    bottom: 5px;
    width: 15px;
    height: 15px;
    border-width: 3px;
  }

  .email-line {
    align-items: flex-start;
    gap: 8px;
  }

  #emailAddr {
    font-size: 19px;
    line-height: 1.25;
  }

  .mini-copy {
    width: 34px;
    height: 34px;
  }

  .ready-status {
    align-items: flex-start;
    font-size: 13px;
    line-height: 1.35;
  }

  .email-actions {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .email-actions button {
    height: 46px;
  }

  .section-icon {
    width: 48px;
    height: 48px;
  }

  .section-title h2,
  .inbox-title h2 {
    font-size: 18px;
  }

  .section-title p {
    font-size: 14px;
    line-height: 1.45;
  }

  .see-all-btn {
    height: 42px;
  }

  .inbox-header {
    min-height: auto;
    padding: 16px;
  }

  .refresh-info {
    display: grid;
    grid-template-columns: 9px 1fr 40px 40px;
    gap: 10px;
    font-size: 14px;
  }

  .refresh-info button {
    width: 40px;
    height: 40px;
    margin-left: 0;
  }

  .refresh-info button:first-of-type {
    margin-left: 0;
  }

  .search-row {
    padding: 14px;
    grid-template-columns: 1fr 42px;
    gap: 10px;
  }

  .search-box,
  .filter-btn {
    height: 42px;
  }

  .inbox-list {
    min-height: 220px;
    padding: 14px;
  }

  .empty-list,
  .empty-preview {
    min-height: 220px;
  }

  .empty-list-art {
    width: 76px;
    height: 76px;
  }

  .empty-list-art svg {
    width: 54px;
    height: 54px;
  }

  .empty-preview-art {
    width: 128px;
    height: 128px;
  }

  .empty-preview-art svg {
    width: 62px;
    height: 62px;
  }

  .empty-list h3,
  .empty-preview h3 {
    margin-top: 12px;
    font-size: 18px;
  }

  .empty-list p,
  .empty-preview p {
    font-size: 14px;
  }

  .email-preview {
    min-height: 300px;
    padding: 22px 14px;
  }

  .history-row {
    padding: 12px;
  }

  .history-mail {
    gap: 10px;
  }

  .preview-header {
    flex-direction: column;
    gap: 10px;
  }

  .qr-popup {
    padding: 14px;
  }

  .qr-popup-content {
    padding: 30px 18px 22px;
    border-radius: 16px;
  }

  .bulk-result {
    grid-template-columns: 34px minmax(0, 1fr);
  }

  .bulk-result small {
    grid-column: 2;
    white-space: normal;
  }

  .bulk-delete-btn {
    grid-column: 1 / -1;
    width: 100%;
  }

  .bulk-copy-btn {
    grid-column: 1 / -1;
    width: 100%;
  }
}

@media (max-width: 380px) {
  .email-identity {
    flex-direction: column;
  }

  .email-line {
    width: 100%;
  }

  .mini-copy {
    margin-top: -4px;
  }

  .refresh-info {
    grid-template-columns: 9px 1fr;
  }

  .refresh-info button {
    grid-column: 1 / -1;
    width: 100%;
  }
}
