/* ============================================================
   ULTIMATE MAIL OTP - GIAO DIỆN HIỆN ĐẠI (DARK MODE CAO CẤP)
   Tối ưu 100% cho Mobile & Desktop - Đa Domain
   ============================================================ */

:root {
  --font-sans: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;

  /* Palette Màu Cao Cấp */
  --bg-main:       #090d16;
  --bg-surface:    #0f172a;
  --bg-card:       #131e33;
  --bg-card-hover: #182640;
  --bg-subtle:     #172338;
  --bg-input:      #0b1220;

  --border-subtle: rgba(255, 255, 255, 0.07);
  --border-card:   #1e2d45;
  --border-hover:  #2d4263;
  --border-focus:  #3b82f6;

  --text-main:     #f1f5f9;
  --text-muted:    #94a3b8;
  --text-dim:      #64748b;

  --primary:       #3b82f6;
  --primary-light: #60a5fa;
  --primary-glow:  rgba(59, 130, 246, 0.25);

  --otp-emerald:   #10b981;
  --otp-light:     #34d399;
  --otp-glow:      rgba(16, 185, 129, 0.25);
  --otp-bg:        rgba(16, 185, 129, 0.08);
  --otp-border:    rgba(16, 185, 129, 0.35);

  --danger:        #ef4444;
  --danger-bg:     rgba(239, 68, 68, 0.12);
  --danger-border: rgba(239, 68, 68, 0.3);

  --radius-sm:     8px;
  --radius-md:     12px;
  --radius-lg:     16px;
  --radius-full:   9999px;

  --shadow-sm:     0 2px 8px rgba(0, 0, 0, 0.3);
  --shadow-md:     0 8px 24px rgba(0, 0, 0, 0.4);
  --shadow-glow:   0 0 20px rgba(59, 130, 246, 0.15);

  --tap-target:    44px;
}

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

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  min-height: 100vh;
  min-height: 100dvh;
  background-color: var(--bg-main);
  background-image:
    radial-gradient(1200px 600px at 15% -10%, rgba(37, 99, 235, 0.12) 0%, transparent 60%),
    radial-gradient(900px 500px at 85% 10%, rgba(99, 102, 241, 0.08) 0%, transparent 50%),
    radial-gradient(800px 600px at 50% 100%, rgba(16, 185, 129, 0.05) 0%, transparent 50%);
  background-attachment: fixed;
  color: var(--text-main);
  font-family: var(--font-sans);
  font-size: 14.5px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ============================================================
   TOP NAVIGATION
   ============================================================ */
.top-nav {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 18px;
  padding-top: max(12px, env(safe-area-inset-top));
  background: rgba(9, 13, 22, 0.85);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border-subtle);
}

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

.logo-box {
  width: 40px;
  height: 40px;
  flex: 0 0 auto;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, var(--primary), #6366f1);
  color: #fff;
  display: grid;
  place-items: center;
  box-shadow: 0 4px 14px var(--primary-glow);
}

.admin-logo {
  background: linear-gradient(135deg, #10b981, #059669);
  box-shadow: 0 4px 14px var(--otp-glow);
}

.brand-text {
  min-width: 0;
}

.title-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.title-row h1 {
  font-size: 16px;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: #fff;
  white-space: nowrap;
}

.host-pill {
  display: inline-flex;
  align-items: center;
  font-size: 11px;
  font-weight: 600;
  font-family: var(--font-mono);
  color: var(--primary-light);
  background: rgba(59, 130, 246, 0.14);
  border: 1px solid rgba(59, 130, 246, 0.28);
  padding: 2px 8px;
  border-radius: var(--radius-full);
}

.sub-text {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 1px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 0 0 auto;
}

.live-status {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 6px 12px;
  background: rgba(19, 30, 51, 0.7);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-full);
  font-size: 12px;
  color: var(--text-muted);
}

.pulse-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--otp-emerald);
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.25);
  animation: pulse-live 2s infinite ease-in-out;
  flex: 0 0 auto;
}

.pulse-dot.off {
  background: var(--text-dim);
  box-shadow: none;
  animation: none;
}

@keyframes pulse-live {
  0%, 100% { opacity: 1; transform: scale(1); }
  50%      { opacity: 0.4; transform: scale(0.85); }
}

.status-msg {
  white-space: nowrap;
  font-size: 12px;
}

/* ============================================================
   MAIN CONTAINER
   ============================================================ */
.app-wrap {
  width: 100%;
  max-width: 1020px;
  margin: 0 auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.panel {
  background: var(--bg-card);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-lg);
  padding: 18px;
  box-shadow: var(--shadow-sm);
  backdrop-filter: blur(10px);
}

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

.panel-header h2 {
  font-size: 16px;
  font-weight: 700;
  color: #fff;
  letter-spacing: -0.01em;
}

.flex-between {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

/* ============================================================
   FORM CONTROLS & INPUTS
   ============================================================ */
.control-grid {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}

.form-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-muted);
}

.badge-req {
  font-size: 10.5px;
  color: #fbbf24;
  background: rgba(245, 158, 11, 0.12);
  border: 1px solid rgba(245, 158, 11, 0.25);
  padding: 1px 6px;
  border-radius: var(--radius-sm);
}

.badge-opt {
  font-size: 10.5px;
  color: var(--text-dim);
  background: rgba(148, 163, 184, 0.1);
  padding: 1px 6px;
  border-radius: var(--radius-sm);
}

.input-affix-wrapper {
  position: relative;
  display: flex;
  align-items: center;
  width: 100%;
}

.input-icon {
  position: absolute;
  left: 14px;
  display: grid;
  place-items: center;
  color: var(--text-dim);
  pointer-events: none;
  z-index: 2;
}

.form-control {
  width: 100%;
  min-height: var(--tap-target);
  padding: 10px 14px 10px 42px;
  background: var(--bg-input);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-md);
  color: var(--text-main);
  font-family: var(--font-sans);
  font-size: 15px;
  outline: none;
  transition: all 0.2s ease;
  -webkit-appearance: none;
  appearance: none;
}

.form-control:focus {
  border-color: var(--border-focus);
  background: #0d1627;
  box-shadow: 0 0 0 3px var(--primary-glow);
}

.form-control::placeholder {
  color: var(--text-dim);
  font-size: 14px;
}

.form-control.mono, .mono {
  font-family: var(--font-mono);
  font-size: 14px;
  letter-spacing: 0.2px;
}

.btn-addon {
  position: absolute;
  right: 6px;
  background: transparent;
  border: none;
  color: var(--text-dim);
  cursor: pointer;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  display: grid;
  place-items: center;
  transition: color 0.15s;
}

.btn-addon:hover {
  color: var(--text-main);
}

/* Bộ chọn Combo Địa chỉ + Domain */
.addr-select-combo {
  display: flex;
  align-items: stretch;
  width: 100%;
  gap: 8px;
}

.addr-field {
  flex: 1 1 auto;
  min-width: 0;
}

.domain-select-wrapper {
  flex: 0 0 auto;
  min-width: 155px;
}

.domain-select {
  padding-left: 12px;
  padding-right: 28px;
  background-color: #16243b;
  border-color: #273854;
  color: var(--primary-light);
  font-weight: 600;
  font-family: var(--font-mono);
  font-size: 13.5px;
  cursor: pointer;
  background-image: url("data:image/svg2+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2360a5fa' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 8px center;
  background-size: 14px;
}

.domain-select:hover {
  border-color: var(--primary);
}

/* ============================================================
   BUTTONS
   ============================================================ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: var(--tap-target);
  padding: 10px 18px;
  border-radius: var(--radius-md);
  font-family: var(--font-sans);
  font-size: 14.5px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  border: 1px solid transparent;
  transition: all 0.18s cubic-bezier(0.16, 1, 0.3, 1);
  -webkit-tap-highlight-color: transparent;
  white-space: nowrap;
}

.btn:active {
  transform: scale(0.97);
}

.primary-btn {
  background: linear-gradient(135deg, var(--primary), #2563eb);
  color: #fff;
  box-shadow: 0 3px 12px var(--primary-glow);
}

.primary-btn:hover {
  background: linear-gradient(135deg, var(--primary-light), #3b82f6);
  box-shadow: 0 4px 16px rgba(59, 130, 246, 0.4);
}

.btn.ghost {
  background: rgba(255, 255, 255, 0.05);
  border-color: var(--border-subtle);
  color: var(--text-main);
}

.btn.ghost:hover {
  background: rgba(255, 255, 255, 0.09);
  border-color: var(--border-hover);
}

.btn.small {
  min-height: 36px;
  padding: 6px 14px;
  font-size: 13px;
  border-radius: var(--radius-sm);
}

.btn.tiny {
  min-height: 30px;
  padding: 4px 10px;
  font-size: 12px;
  border-radius: var(--radius-sm);
}

.btn.btn-danger {
  background: var(--danger-bg);
  border-color: var(--danger-border);
  color: #fca5a5;
}

.btn.btn-danger:hover {
  background: rgba(239, 68, 68, 0.22);
}

.btn-danger-ghost:hover {
  color: #f87171 !important;
  border-color: var(--danger-border) !important;
}

.btn.copied {
  background: rgba(16, 185, 129, 0.18) !important;
  border-color: var(--otp-emerald) !important;
  color: var(--otp-light) !important;
}

.btn-block {
  width: 100%;
}

.spin-icon {
  transition: transform 0.3s;
}

.btn.is-loading .spin-icon {
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  from { transform: rotate(0deg); }
  to   { transform: rotate(360deg); }
}

/* ============================================================
   TOOLBAR & TOGGLES
   ============================================================ */
.toolbar-bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--border-subtle);
}

.toolbar-left {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}

.toggle-switch {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  cursor: pointer;
  user-select: none;
}

.toggle-switch input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.toggle-slider {
  width: 38px;
  height: 22px;
  background-color: #202e45;
  border-radius: 20px;
  position: relative;
  transition: background-color 0.2s;
  flex: 0 0 auto;
}

.toggle-slider::before {
  content: "";
  position: absolute;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  left: 3px;
  top: 3px;
  background-color: #fff;
  transition: transform 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.toggle-switch input:checked + .toggle-slider {
  background-color: var(--primary);
}

.toggle-switch input:checked + .toggle-slider::before {
  transform: translateX(16px);
}

.toggle-label {
  font-size: 13px;
  color: var(--text-muted);
}

.btn-link {
  background: none;
  border: none;
  color: var(--text-dim);
  font-size: 13px;
  cursor: pointer;
  padding: 4px 0;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.btn-link:hover {
  color: var(--text-main);
}

/* Key Info Badge */
.keyinfo-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 5px 12px;
  background: rgba(16, 185, 129, 0.1);
  border: 1px solid rgba(16, 185, 129, 0.25);
  border-radius: var(--radius-full);
  font-size: 12.5px;
}

.key-label {
  color: var(--text-muted);
  font-size: 12px;
}

.key-prefix {
  color: var(--otp-light);
  font-family: var(--font-mono);
  font-weight: 700;
}

.btn-inline-copy {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: rgba(16, 185, 129, 0.18);
  border: 1px solid rgba(16, 185, 129, 0.35);
  color: var(--otp-light);
  font-size: 11.5px;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background 0.15s;
}

.btn-inline-copy:hover {
  background: rgba(16, 185, 129, 0.3);
}

/* ============================================================
   MAIL LIST & MAIL CARDS
   ============================================================ */
.mail-list-panel {
  background: var(--bg-surface);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

.list-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  background: #0d1524;
  border-bottom: 1px solid var(--border-subtle);
  flex-wrap: wrap;
  gap: 8px;
}

.list-title-group {
  display: flex;
  align-items: center;
  gap: 10px;
}

.list-title-group h2 {
  font-size: 14.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
}

.badge-count {
  font-size: 12px;
  font-weight: 600;
  color: var(--primary-light);
  background: rgba(59, 130, 246, 0.12);
  padding: 2px 9px;
  border-radius: var(--radius-full);
}

.list-domain-note {
  font-size: 12.5px;
  color: var(--text-dim);
}

.list-domain-note b {
  color: var(--text-muted);
}

.mail-list {
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.mail-list:empty {
  display: none;
}

/* Thẻ Email */
.mail {
  background: var(--bg-card);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-md);
  padding: 16px;
  transition: border-color 0.2s, box-shadow 0.2s, transform 0.15s;
}

.mail:hover {
  border-color: var(--border-hover);
  background: var(--bg-card-hover);
}

.mail.fresh {
  border-color: var(--otp-emerald);
  box-shadow: 0 0 16px var(--otp-glow);
  animation: slide-in 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes slide-in {
  from { opacity: 0; transform: translateY(-8px) scale(0.98); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

.mail-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 6px;
}

.to-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(59, 130, 246, 0.1);
  border: 1px solid rgba(59, 130, 246, 0.2);
  padding: 4px 10px;
  border-radius: var(--radius-full);
  min-width: 0;
}

.to-badge svg {
  color: var(--primary-light);
  flex: 0 0 auto;
}

.mail-to {
  font-family: var(--font-mono);
  font-weight: 600;
  font-size: 13px;
  color: var(--primary-light);
  word-break: break-all;
}

.mail-time {
  font-size: 12px;
  color: var(--text-dim);
  white-space: nowrap;
  flex: 0 0 auto;
}

.mail-from {
  font-size: 12.5px;
  color: var(--text-muted);
  margin-bottom: 8px;
  word-break: break-all;
}

.mail-subject {
  font-size: 15px;
  font-weight: 600;
  color: #fff;
  margin-bottom: 12px;
  line-height: 1.4;
}

/* Khối Mã OTP Siêu To & Nổi Bật */
.otp-interactive-box {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  width: 100%;
  margin: 12px 0;
  padding: 12px 18px;
  background: var(--otp-bg);
  border: 1px dashed var(--otp-border);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all 0.2s ease;
  -webkit-tap-highlight-color: transparent;
  outline: none;
}

.otp-interactive-box:hover {
  background: rgba(16, 185, 129, 0.14);
  border-color: var(--otp-emerald);
  box-shadow: 0 0 16px var(--otp-glow);
}

.otp-interactive-box:active {
  transform: scale(0.985);
}

.otp-interactive-box.copied {
  background: rgba(16, 185, 129, 0.22);
  border-style: solid;
  border-color: var(--otp-light);
}

.otp-meta {
  display: flex;
  flex-direction: column;
  gap: 2px;
  text-align: left;
}

.otp-label-tag {
  font-size: 11px;
  font-weight: 700;
  color: var(--otp-light);
  text-transform: uppercase;
  letter-spacing: 0.8px;
}

.otp-digits {
  font-family: var(--font-mono);
  font-size: 28px;
  font-weight: 800;
  letter-spacing: 4px;
  color: #fff;
  text-shadow: 0 0 12px rgba(16, 185, 129, 0.6);
  line-height: 1.15;
}

.otp-action-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  background: rgba(16, 185, 129, 0.22);
  border: 1px solid rgba(16, 185, 129, 0.4);
  color: #a7f3d0;
  font-size: 12.5px;
  font-weight: 600;
  border-radius: var(--radius-sm);
  flex: 0 0 auto;
  transition: background 0.15s;
}

.otp-interactive-box:hover .otp-action-pill {
  background: rgba(16, 185, 129, 0.35);
}

/* Thân Thư */
.mail-body {
  font-size: 13.5px;
  color: #cbd5e1;
  line-height: 1.6;
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 96px;
  overflow: hidden;
  position: relative;
  margin-top: 6px;
}

.mail-body:not(.open)::after {
  content: "";
  position: absolute;
  left: 0; right: 0; bottom: 0;
  height: 38px;
  background: linear-gradient(transparent, var(--bg-card));
  pointer-events: none;
}

.mail-body.open {
  max-height: none;
}

.mail-body mark {
  background: rgba(16, 185, 129, 0.25);
  color: var(--otp-light);
  font-weight: 700;
  padding: 1px 4px;
  border-radius: 4px;
}

.btn-toggle-body {
  margin-top: 8px;
  background: none;
  border: none;
  color: var(--primary-light);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  padding: 4px 0;
}

.btn-toggle-body:hover {
  text-decoration: underline;
}

/* Empty State */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 48px 24px;
  text-align: center;
  gap: 14px;
}

.empty-icon-wrap {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-subtle);
  display: grid;
  place-items: center;
  color: var(--text-dim);
}

.empty-text h3 {
  font-size: 16px;
  font-weight: 650;
  color: #fff;
  margin-bottom: 6px;
}

.empty-text p {
  font-size: 13.5px;
  color: var(--text-muted);
  max-width: 420px;
}

.empty-text b {
  color: var(--primary-light);
}

.hidden {
  display: none !important;
}

/* ============================================================
   FOOTER
   ============================================================ */
.app-footer {
  padding: 16px;
  padding-bottom: max(16px, env(safe-area-inset-bottom));
  text-align: center;
  border-top: 1px solid var(--border-subtle);
  margin-top: auto;
}

.footer-content {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  flex-wrap: wrap;
  font-size: 12px;
  color: var(--text-dim);
}

.sep {
  opacity: 0.4;
}

/* ============================================================
   ADMIN DASHBOARD & STYLES
   ============================================================ */
.admin-page {
  background-color: var(--bg-main);
}

.admin-wrap {
  max-width: 1080px;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 14px;
}

.stat-card {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px;
  background: var(--bg-card);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
}

.stat-icon {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-md);
  display: grid;
  place-items: center;
  flex: 0 0 auto;
}

.icon-key  { background: rgba(59, 130, 246, 0.15); color: var(--primary-light); }
.icon-mail { background: rgba(16, 185, 129, 0.15); color: var(--otp-light); }
.icon-call { background: rgba(245, 158, 11, 0.15); color: #fbbf24; }
.icon-dom  { background: rgba(168, 85, 247, 0.15); color: #c084fc; }

.stat-info {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.stat-val {
  font-size: 22px;
  font-weight: 750;
  color: #fff;
  line-height: 1.2;
}

.stat-lbl {
  font-size: 12px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Keycard Grid Admin */
.keycards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 14px;
}

.admin-keycard {
  background: #111a2c;
  border: 1px solid var(--border-card);
  border-radius: var(--radius-md);
  padding: 16px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 14px;
  transition: border-color 0.15s;
}

.admin-keycard:hover {
  border-color: var(--border-hover);
}

.admin-keycard.card-inactive {
  opacity: 0.65;
  border-style: dashed;
}

.card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.card-title strong {
  font-size: 15px;
  color: #fff;
  font-weight: 650;
}

.card-id {
  font-size: 11.5px;
  color: var(--text-dim);
  margin-left: 4px;
}

.date-created {
  display: block;
  font-size: 11.5px;
  color: var(--text-dim);
  margin-top: 2px;
}

.status-badge {
  font-size: 11.5px;
  font-weight: 600;
  padding: 2px 9px;
  border-radius: var(--radius-full);
  white-space: nowrap;
  border: 1px solid;
}

.badge-on {
  background: rgba(16, 185, 129, 0.12);
  border-color: rgba(16, 185, 129, 0.3);
  color: var(--otp-light);
}

.badge-off {
  background: rgba(239, 68, 68, 0.12);
  border-color: rgba(239, 68, 68, 0.3);
  color: #fca5a5;
}

.card-body {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

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

.prop-label {
  font-size: 11.5px;
  font-weight: 600;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  flex: 0 0 65px;
}

.prop-value {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1 1 auto;
  min-width: 0;
  justify-content: flex-end;
}

.prefix-tag {
  font-family: var(--font-mono);
  font-weight: 700;
  color: var(--primary-light);
  background: rgba(59, 130, 246, 0.12);
  padding: 2px 7px;
  border-radius: var(--radius-sm);
  font-size: 13px;
}

.dim-key {
  color: var(--text-muted);
  font-size: 13px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.domain-copy-chips {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.chip-btn {
  background: #19273f;
  border: 1px solid #2a3d5e;
  color: #93c5fd;
  font-family: var(--font-mono);
  font-size: 11.5px;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.15s;
}

.chip-btn:hover {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}

.card-metrics {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  padding-top: 10px;
  border-top: 1px solid var(--border-subtle);
  text-align: center;
}

.metric-item {
  display: flex;
  flex-direction: column;
}

.metric-val {
  font-size: 13.5px;
  font-weight: 700;
  color: #fff;
}

.metric-lbl {
  font-size: 11px;
  color: var(--text-dim);
}

.card-footer {
  display: flex;
  align-items: center;
  gap: 8px;
  padding-top: 10px;
  border-top: 1px solid var(--border-subtle);
}

.action-form {
  flex: 1 1 50%;
  display: flex;
}

.action-btn {
  width: 100%;
}

.btn-warn {
  background: rgba(245, 158, 11, 0.12);
  border-color: rgba(245, 158, 11, 0.28);
  color: #fde68a;
}

.btn-warn:hover {
  background: rgba(245, 158, 11, 0.22);
}

.btn-active-key {
  background: rgba(16, 185, 129, 0.12);
  border-color: rgba(16, 185, 129, 0.3);
  color: #a7f3d0;
}

.btn-active-key:hover {
  background: rgba(16, 185, 129, 0.22);
}

/* Alert Boxes */
.alert-box {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-radius: var(--radius-md);
  font-size: 13.5px;
  border: 1px solid;
}

.alert-error {
  background: var(--danger-bg);
  border-color: var(--danger-border);
  color: #fca5a5;
}

.alert-success {
  background: var(--otp-bg);
  border-color: var(--otp-border);
  color: var(--otp-light);
}

/* Login Panel */
.login-panel {
  max-width: 420px;
  margin: 36px auto;
  text-align: center;
}

.login-header {
  margin-bottom: 20px;
}

.login-badge {
  width: 52px;
  height: 52px;
  margin: 0 auto 12px;
  border-radius: 50%;
  background: rgba(59, 130, 246, 0.15);
  color: var(--primary-light);
  display: grid;
  place-items: center;
}

.login-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
  text-align: left;
}

/* New Key Created Panel */
.newkey-panel {
  border-color: var(--otp-emerald);
  box-shadow: 0 0 20px var(--otp-glow);
}

.badge-new-key {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 700;
  color: var(--otp-light);
  text-transform: uppercase;
  margin-bottom: 6px;
}

.copy-input-row {
  display: flex;
  gap: 8px;
  margin-top: 6px;
}

.copy-input-row .form-control {
  padding-left: 14px;
}

.domain-samples-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 10px;
  margin-top: 8px;
}

.sample-box {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 10px 14px;
  background: #0c1422;
  border: 1px solid var(--border-card);
  border-radius: var(--radius-md);
}

.sample-domain-tag {
  font-size: 11.5px;
  font-weight: 700;
  color: var(--primary-light);
  font-family: var(--font-mono);
}

.sample-email {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-muted);
}

.hint-text {
  font-size: 12.5px;
  color: var(--text-dim);
  margin-top: 10px;
}

.hint-text code {
  color: var(--primary-light);
  background: rgba(59, 130, 246, 0.12);
  padding: 2px 6px;
  border-radius: var(--radius-sm);
  font-family: var(--font-mono);
}

/* Form tạo key */
.create-key-form {
  display: flex;
  gap: 12px;
  align-items: flex-end;
  flex-wrap: wrap;
}

.flex-grow {
  flex: 1 1 260px;
}

.create-submit-btn {
  flex: 0 0 auto;
}

/* Docs & Code blocks */
.docs-block {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.doc-desc {
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 6px;
}

.code-box {
  padding: 12px 14px;
  background: #09101c;
  border: 1px solid var(--border-card);
  border-radius: var(--radius-md);
  font-size: 13px;
  line-height: 1.6;
}

.code-box code {
  color: var(--otp-light);
  font-family: var(--font-mono);
}

.code-pre {
  padding: 14px;
  background: #09101c;
  border: 1px solid var(--border-card);
  border-radius: var(--radius-md);
  color: #93c5fd;
  font-family: var(--font-mono);
  font-size: 12.5px;
  line-height: 1.5;
  overflow-x: auto;
  white-space: pre;
}

/* ============================================================
   TOAST NOTIFICATION FLOATING
   ============================================================ */
.toast-container {
  position: fixed;
  top: 20px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 9999;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  pointer-events: none;
}

.toast-msg {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 18px;
  background: rgba(15, 23, 42, 0.95);
  border: 1px solid var(--otp-emerald);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5), 0 0 15px var(--otp-glow);
  backdrop-filter: blur(12px);
  color: #fff;
  border-radius: var(--radius-full);
  font-size: 13.5px;
  font-weight: 600;
  animation: toast-in 0.3s cubic-bezier(0.16, 1, 0.3, 1), toast-out 0.3s ease 1.7s forwards;
  pointer-events: auto;
}

.toast-msg svg {
  color: var(--otp-light);
}

@keyframes toast-in {
  from { opacity: 0; transform: translateY(-12px) scale(0.9); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes toast-out {
  from { opacity: 1; transform: translateY(0) scale(1); }
  to   { opacity: 0; transform: translateY(-10px) scale(0.95); }
}

/* ============================================================
   RESPONSIVE DESIGN (DESKTOP & MOBILE)
   ============================================================ */

/* Desktop view: Grid layout cho bộ lọc */
@media (min-width: 768px) {
  .control-grid {
    display: grid;
    grid-template-columns: 1.1fr 1.3fr auto;
    align-items: flex-end;
    gap: 14px;
  }

  .submit-group {
    min-width: 120px;
  }
}

/* Mobile & Tablet view */
@media (max-width: 767px) {
  .desktop-only {
    display: none;
  }

  .addr-select-combo {
    flex-direction: column;
    gap: 8px;
  }

  .domain-select-wrapper {
    width: 100%;
  }

  .control-grid {
    gap: 12px;
  }

  .btn-block {
    width: 100%;
  }

  .toolbar-bottom {
    flex-direction: column;
    align-items: stretch;
  }

  .toolbar-left, .toolbar-right {
    justify-content: space-between;
    width: 100%;
  }

  .keyinfo-badge {
    width: 100%;
    justify-content: space-between;
  }

  .otp-digits {
    font-size: 24px;
    letter-spacing: 3px;
  }
}

@media (max-width: 480px) {
  .app-wrap {
    padding: 10px;
    gap: 12px;
  }

  .panel {
    padding: 14px;
  }

  .top-nav {
    padding: 10px 14px;
  }

  .title-row h1 {
    font-size: 15px;
  }

  .otp-digits {
    font-size: 21px;
    letter-spacing: 2px;
  }

  .otp-interactive-box {
    padding: 10px 12px;
  }

  .otp-action-pill {
    padding: 6px 10px;
    font-size: 11.5px;
  }

  .stats-grid {
    grid-template-columns: 1fr;
  }

  .keycards-grid {
    grid-template-columns: 1fr;
  }
}
