/* ============================================
   Temp Mail v4 — Design System & Styles
   ============================================ */

:root {
  --bg: #0a0c10;
  --bg-subtle: #0e1117;
  --surface: #151921;
  --surface-hover: #1c2230;
  --surface-active: #232a38;
  --border: #262d3d;
  --border-focus: #3d4766;

  --text: #e6e8ed;
  --text-secondary: #8b92a5;
  --text-muted: #5c6378;

  --accent: #00d4aa;
  --accent-hover: #00b894;
  --accent-dim: rgba(0, 212, 170, 0.12);
  --accent-glow: rgba(0, 212, 170, 0.25);

  --danger: #ff6b6b;
  --danger-dim: rgba(255, 107, 107, 0.12);
  --danger-border: rgba(255, 107, 107, 0.35);

  --warning: #ffa726;
  --warning-dim: rgba(255, 167, 38, 0.12);

  --radius-sm: 8px;
  --radius: 12px;
  --radius-lg: 16px;
  --radius-xl: 20px;

  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.25);
  --shadow: 0 8px 32px rgba(0, 0, 0, 0.35);
  --shadow-lg: 0 16px 48px rgba(0, 0, 0, 0.5);

  --font-sans: 'Outfit', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: 'JetBrains Mono', 'SF Mono', 'Menlo', monospace;

  --transition: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-bounce: 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);

  --sidebar-width: 220px;
}

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

body {
  font-family: var(--font-sans);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

body::before {
  content: '';
  position: fixed;
  inset: 0;
  background-image:
    radial-gradient(circle at 50% 0%, rgba(0, 212, 170, 0.04) 0%, transparent 50%),
    linear-gradient(rgba(255,255,255,0.015) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,0.015) 1px, transparent 1px);
  background-size: 100% 100%, 60px 60px, 60px 60px;
  pointer-events: none;
  z-index: 0;
}

/* --- Auth Screen --- */
.auth-screen { position: fixed; inset: 0; display: flex; align-items: center; justify-content: center; z-index: 1000; background: var(--bg); }
.auth-card { position: relative; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-xl); padding: 48px 40px; width: 100%; max-width: 420px; text-align: center; box-shadow: var(--shadow-lg); animation: authSlideUp 0.6s cubic-bezier(0.16,1,0.3,1) both; }
.auth-glow { position: absolute; top: -1px; left: 50%; transform: translateX(-50%); width: 200px; height: 3px; background: linear-gradient(90deg, transparent, var(--accent), transparent); border-radius: 2px; }
@keyframes authSlideUp { from { opacity:0; transform: translateY(30px) scale(0.97); } to { opacity:1; transform: translateY(0) scale(1); } }
.auth-icon { font-size: 3rem; margin-bottom: 12px; filter: drop-shadow(0 4px 12px rgba(0,212,170,0.3)); }
.auth-title { font-size: 1.75rem; font-weight: 700; letter-spacing: -0.03em; background: linear-gradient(135deg, #fff 30%, var(--accent) 100%); background-clip: text; -webkit-background-clip: text; -webkit-text-fill-color: transparent; margin-bottom: 6px; }
.auth-subtitle { color: var(--text-secondary); font-size: 0.9rem; margin-bottom: 28px; }
.input-group { position: relative; margin-bottom: 16px; }
.input-group input { width: 100%; padding: 14px 44px 14px 16px; border-radius: var(--radius-sm); border: 1px solid var(--border); background: var(--bg); color: var(--text); font-family: var(--font-mono); font-size: 0.85rem; transition: border-color var(--transition), box-shadow var(--transition); }
.input-group input::placeholder { color: var(--text-muted); }
.input-group input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-dim); }
.btn-icon-inline { position: absolute; right: 8px; top: 50%; transform: translateY(-50%); background: none; border: none; color: var(--text-muted); cursor: pointer; padding: 6px; border-radius: 6px; transition: color var(--transition), background var(--transition); }
.btn-icon-inline:hover { color: var(--text); background: var(--surface-hover); }
.btn-auth { width: 100%; padding: 14px; font-size: 0.95rem; }
.auth-error { color: var(--danger); font-size: 0.85rem; margin-top: 12px; min-height: 20px; }

/* --- Buttons --- */
.btn-primary { display: inline-flex; align-items: center; gap: 8px; padding: 10px 20px; border: none; border-radius: var(--radius-sm); background: var(--accent); color: var(--bg); font-family: var(--font-sans); font-weight: 600; font-size: 0.875rem; cursor: pointer; transition: background var(--transition), transform 0.15s, box-shadow var(--transition); white-space: nowrap; }
.btn-primary:hover { background: var(--accent-hover); transform: translateY(-1px); box-shadow: 0 4px 16px rgba(0,212,170,0.3); }
.btn-primary:active { transform: translateY(0); }
.btn-primary:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }
.btn-secondary { display: inline-flex; align-items: center; gap: 8px; padding: 10px 16px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface-hover); color: var(--text); font-family: var(--font-sans); font-weight: 500; font-size: 0.875rem; cursor: pointer; transition: background var(--transition), border-color var(--transition), transform 0.15s; white-space: nowrap; }
.btn-secondary:hover { background: var(--surface-active); border-color: var(--accent); transform: translateY(-1px); }
.btn-ghost { display: inline-flex; align-items: center; gap: 6px; padding: 8px 12px; border: none; border-radius: var(--radius-sm); background: transparent; color: var(--text-secondary); font-family: var(--font-sans); font-weight: 500; font-size: 0.8rem; cursor: pointer; transition: color var(--transition), background var(--transition); }
.btn-ghost:hover { color: var(--text); background: var(--surface-hover); }
.btn-sm { padding: 6px 12px; font-size: 0.8rem; }
.btn-icon { display: inline-flex; align-items: center; justify-content: center; padding: 6px; border: none; border-radius: 6px; background: transparent; color: var(--text-secondary); cursor: pointer; transition: color var(--transition), background var(--transition); }
.btn-icon:hover { color: var(--text); background: var(--surface-hover); }
.btn-danger-sm { display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border: 1px solid var(--danger-border); border-radius: 6px; background: transparent; color: var(--danger); font-family: var(--font-sans); font-weight: 500; font-size: 0.78rem; cursor: pointer; transition: background var(--transition), border-color var(--transition); }
.btn-danger-sm:hover { background: var(--danger-dim); border-color: var(--danger); }
.btn-delete-single { display: inline-flex; align-items: center; justify-content: center; width: 24px; height: 24px; border: none; border-radius: 4px; background: transparent; color: var(--text-muted); cursor: pointer; font-size: 0.75rem; flex-shrink: 0; transition: color var(--transition), background var(--transition); opacity: 0; }
.btn-delete-single:hover { color: var(--danger); background: var(--danger-dim); }

/* Copy inline button (next to To:) */
.btn-copy-inline { display: inline-flex; align-items: center; justify-content: center; width: 24px; height: 24px; border: none; border-radius: 4px; background: transparent; color: var(--text-muted); cursor: pointer; transition: all var(--transition); margin-left: 4px; flex-shrink: 0; }
.btn-copy-inline:hover { color: var(--accent); background: var(--accent-dim); }

.spinner { display: inline-block; width: 18px; height: 18px; border: 2px solid rgba(0,0,0,0.2); border-top-color: var(--bg); border-radius: 50%; animation: spin 0.6s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* --- App Shell --- */
.app-shell { position: relative; z-index: 1; display: flex; height: 100vh; overflow: hidden; }

/* --- Sidebar --- */
.sidebar { width: var(--sidebar-width); flex-shrink: 0; background: var(--surface); border-right: 1px solid var(--border); display: flex; flex-direction: column; padding: 20px 12px; gap: 6px; }
.sidebar-brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px 20px; }
.sidebar-logo { font-size: 1.5rem; filter: drop-shadow(0 2px 8px rgba(0,212,170,0.3)); }
.sidebar-title { font-size: 1.15rem; font-weight: 700; letter-spacing: -0.02em; background: linear-gradient(135deg, #fff 30%, var(--accent) 100%); background-clip: text; -webkit-background-clip: text; -webkit-text-fill-color: transparent; }
.sidebar-nav { display: flex; flex-direction: column; gap: 4px; flex: 1; }
.sidebar-link { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border: none; border-radius: var(--radius-sm); background: transparent; color: var(--text-secondary); font-family: var(--font-sans); font-size: 0.9rem; font-weight: 500; cursor: pointer; transition: all var(--transition); width: 100%; text-align: left; }
.sidebar-link:hover { color: var(--text); background: var(--surface-hover); }
.sidebar-link.active { color: var(--accent); background: var(--accent-dim); }
.sidebar-link.active svg { stroke: var(--accent); }
.sidebar-link--danger { color: var(--text-muted); }
.sidebar-link--danger:hover { color: var(--danger); background: var(--danger-dim); }
.sidebar-footer { display: flex; flex-direction: column; gap: 10px; padding-top: 12px; border-top: 1px solid var(--border); }

/* User info in sidebar */
.user-info { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border: none; background: transparent; cursor: pointer; border-radius: var(--radius-sm); transition: background var(--transition); text-align: left; width: 100%; outline: none; }
.user-info:hover { background: var(--surface-hover); }
.user-avatar { width: 32px; height: 32px; border-radius: 50%; background: var(--accent-dim); color: var(--accent); display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 0.85rem; flex-shrink: 0; }
.user-details { display: flex; flex-direction: column; min-width: 0; }
.user-name-text { font-size: 0.85rem; font-weight: 600; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; line-height: 1.2; }
.user-role-badge { display: inline-block; font-size: 0.65rem; font-weight: 700; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.06em; padding: 2px 6px; border-radius: 6px; align-self: flex-start; margin-top: 2px; }
.user-role-badge.role-admin { background: var(--warning-dim); color: var(--warning); }

/* --- Main Content --- */
.main-content { flex: 1; overflow-y: auto; padding: 20px; min-width: 0; display: flex; flex-direction: column; }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-sm); }
.view { display: none; flex-direction: column; gap: 16px; flex: 1; min-height: 0; }
.view.active { display: flex; }

/* --- Email Bar --- */
.email-bar { padding: 16px 20px; flex-shrink: 0; }
.email-form { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.email-input-group { display: flex; align-items: center; gap: 0; flex: 1; min-width: 280px; background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius-sm); overflow: hidden; transition: border-color var(--transition), box-shadow var(--transition); }
.email-input-group:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-dim); }
.email-input-group input { flex: 1; min-width: 100px; padding: 11px 4px 11px 14px; border: none; background: transparent; color: var(--text); font-family: var(--font-mono); font-size: 0.875rem; outline: none; }
.email-input-group input::placeholder { color: var(--text-muted); }
.at-symbol { color: var(--accent); font-family: var(--font-mono); font-weight: 600; font-size: 0.9rem; padding: 0 2px; flex-shrink: 0; }

/* Domain selector */
.domain-select-wrapper { position: relative; display: flex; align-items: center; }
.select-domain { padding: 11px 28px 11px 8px; border: none; background: transparent; color: var(--text); font-family: var(--font-mono); font-size: 0.875rem; cursor: pointer; outline: none; appearance: none; -webkit-appearance: none; min-width: 130px; }
.select-domain option { background: var(--surface); color: var(--text); }
.domain-chevron { position: absolute; right: 8px; pointer-events: none; color: var(--text-muted); }
.email-actions { display: flex; gap: 8px; }

/* Auto-refresh */
.auto-refresh-bar { display: flex; align-items: center; gap: 16px; margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--border); font-size: 0.8rem; color: var(--text-secondary); }
.toggle-label { display: flex; align-items: center; gap: 8px; cursor: pointer; user-select: none; }
.toggle-label input { display: none; }
.toggle-slider { position: relative; width: 34px; height: 18px; background: var(--border); border-radius: 10px; transition: background var(--transition); }
.toggle-slider::after { content: ''; position: absolute; top: 2px; left: 2px; width: 14px; height: 14px; background: var(--text-secondary); border-radius: 50%; transition: transform var(--transition), background var(--transition); }
.toggle-label input:checked + .toggle-slider { background: var(--accent-dim); }
.toggle-label input:checked + .toggle-slider::after { transform: translateX(16px); background: var(--accent); }
.countdown { font-family: var(--font-mono); font-size: 0.75rem; color: var(--text-muted); }

/* Loading */
.loading-bar { height: 3px; background: var(--border); border-radius: 2px; overflow: hidden; flex-shrink: 0; }
.loading-progress { height: 100%; width: 30%; background: linear-gradient(90deg, var(--accent), var(--accent-hover)); border-radius: 2px; animation: loadingSlide 1.2s ease-in-out infinite; }
@keyframes loadingSlide { 0% { transform: translateX(-100%); width: 30%; } 50% { width: 60%; } 100% { transform: translateX(400%); width: 30%; } }

/* --- Mail Layout (full height) --- */
.mail-layout { display: grid; grid-template-columns: 340px 1fr; gap: 16px; flex: 1; min-height: 0; }
.mail-list { display: flex; flex-direction: column; overflow: hidden; }
.mail-content { display: flex; flex-direction: column; overflow: hidden; }

.list-header { display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-bottom: 1px solid var(--border); flex-shrink: 0; }
.list-title { display: flex; align-items: center; gap: 6px; font-weight: 600; font-size: 0.85rem; color: var(--text-secondary); }
.mail-count { font-size: 0.72rem; font-weight: 600; padding: 2px 8px; background: var(--accent-dim); color: var(--accent); border-radius: 10px; font-family: var(--font-mono); }
.list-actions { display: flex; gap: 6px; margin-left: auto; }

.email-list { list-style: none; overflow-y: auto; flex: 1; scrollbar-width: thin; scrollbar-color: var(--border) transparent; }
.email-list::-webkit-scrollbar { width: 6px; }
.email-list::-webkit-scrollbar-track { background: transparent; }
.email-list::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
.email-list li { display: flex; align-items: flex-start; gap: 8px; padding: 12px 16px; border-bottom: 1px solid var(--border); cursor: pointer; transition: background var(--transition); font-size: 0.85rem; position: relative; }
.email-list li:hover { background: var(--surface-hover); }
.email-list li:hover .btn-delete-single { opacity: 1; }
.email-list li.active { background: var(--accent-dim); border-left: 3px solid var(--accent); padding-left: 13px; }
.email-list li.active .btn-delete-single { opacity: 0.7; }
.mail-meta { flex: 1; min-width: 0; }
.mail-subject { font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-bottom: 4px; }
.mail-from { color: var(--text-secondary); font-size: 0.78rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-bottom: 2px; }
.mail-date { color: var(--text-muted); font-size: 0.75rem; font-family: var(--font-mono); }
.email-list li.email-placeholder { display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 40px 20px; text-align: center; color: var(--text-muted); cursor: default !important; border: none !important; }
.email-list li.email-placeholder:hover { background: transparent !important; }
.placeholder-icon { font-size: 2.5rem; margin-bottom: 12px; opacity: 0.7; }
.email-list li.email-placeholder p { font-size: 0.85rem; line-height: 1.6; }

/* Mail detail */
.detail-header { padding: 16px 20px; border-bottom: 1px solid var(--border); flex-shrink: 0; }
.detail-subject { font-size: 1.1rem; font-weight: 600; letter-spacing: -0.01em; margin-bottom: 10px; }
.detail-meta { display: flex; flex-direction: column; gap: 4px; font-size: 0.8rem; }
.detail-meta-row { display: flex; align-items: center; gap: 6px; }
.detail-label { color: var(--text-muted); font-weight: 500; flex-shrink: 0; }
.detail-from { color: var(--accent); font-weight: 500; }
.detail-to { color: var(--text-secondary); font-family: var(--font-mono); font-size: 0.78rem; }
.detail-date { color: var(--text-muted); font-family: var(--font-mono); font-size: 0.75rem; margin-top: 4px; }
.email-content-body { flex: 1; overflow-y: auto; padding: 20px; line-height: 1.7; font-size: 0.92rem; scrollbar-width: thin; scrollbar-color: var(--border) transparent; }
.email-content-body::-webkit-scrollbar { width: 6px; }
.email-content-body::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
.email-content-body img { max-width: 100%; height: auto; border-radius: var(--radius-sm); }
.email-content-body a { color: var(--accent); text-decoration: none; transition: opacity var(--transition); }
.email-content-body a:hover { opacity: 0.8; text-decoration: underline; }
.content-placeholder { display: flex; flex-direction: column; align-items: center; justify-content: center; height: 100%; min-height: 200px; color: var(--text-muted); }
.content-placeholder p { font-size: 0.9rem; }

/* =========================================
   Links View
   ========================================= */
.section-title { font-size: 1.1rem; font-weight: 600; }
.links-toolbar { display: flex; align-items: center; justify-content: space-between; padding: 16px 20px; flex-wrap: wrap; gap: 12px; flex-shrink: 0; }
.links-toolbar-left { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.links-filter { display: flex; align-items: center; gap: 8px; }
.filter-label { font-size: 0.8rem; color: var(--text-muted); white-space: nowrap; }
.filter-input { padding: 6px 12px; border: 1px solid var(--border); border-radius: 6px; background: var(--bg); color: var(--text); font-size: 0.8rem; width: 220px; outline: none; transition: border-color var(--transition); }
.filter-input:focus { border-color: var(--accent); }
.filter-input::placeholder { color: var(--text-muted); }

/* Link create/edit form */
.link-form-card { padding: 20px; flex-shrink: 0; }
.link-form-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; }
.link-form-title { font-size: 1rem; font-weight: 600; }
.link-form-body { display: flex; flex-direction: column; gap: 12px; }
.form-row { display: flex; flex-direction: column; gap: 4px; }
.form-label { font-size: 0.8rem; font-weight: 500; color: var(--text-secondary); }
.form-hint { color: var(--text-muted); font-weight: 400; }
.form-input { padding: 10px 14px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--bg); color: var(--text); font-size: 0.85rem; outline: none; transition: border-color var(--transition), box-shadow var(--transition); }
.form-input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-dim); }
.form-input::placeholder { color: var(--text-muted); }
.form-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 4px; }

/* Links table */
.links-table-wrap { flex: 1; min-height: 0; overflow: auto; }
.links-table, .admin-table { width: 100%; border-collapse: collapse; font-size: 0.85rem; }
.links-table thead, .admin-table thead { position: sticky; top: 0; z-index: 1; }
.links-table th, .admin-table th { text-align: left; padding: 10px 16px; background: var(--bg-subtle); color: var(--text-muted); font-weight: 600; font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.04em; border-bottom: 1px solid var(--border); white-space: nowrap; }
.links-table td, .admin-table td { padding: 10px 16px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.links-table tbody tr:hover, .admin-table tbody tr:hover { background: var(--surface-hover); }
.links-table th.th-actions, .admin-table th.th-actions { text-align: left; }
.table-empty { text-align: center; padding: 40px 16px !important; color: var(--text-muted); font-size: 0.9rem; }

.td-short-url { font-family: var(--font-mono); font-size: 0.82rem; color: var(--accent); }
.td-short-url a { color: var(--accent); text-decoration: none; }
.td-short-url a:hover { text-decoration: underline; }
.td-target { max-width: 300px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--text-secondary); font-size: 0.82rem; }
.td-email { font-family: var(--font-mono); font-size: 0.78rem; color: var(--text-muted); }
.td-date { font-family: var(--font-mono); font-size: 0.75rem; color: var(--text-muted); white-space: nowrap; }
.links-table td.td-actions, .admin-table td.td-actions { text-align: left; white-space: nowrap; }
.td-actions button { margin-right: 4px; }

/* Status badges */
.status-badge { display: inline-block; padding: 2px 8px; border-radius: 10px; font-size: 0.72rem; font-weight: 600; }
.status-active { background: var(--accent-dim); color: var(--accent); }
.status-inactive { background: var(--danger-dim); color: var(--danger); }
.role-badge { display: inline-block; padding: 2px 8px; border-radius: 10px; font-size: 0.72rem; font-weight: 600; text-transform: uppercase; }
.role-admin { background: var(--warning-dim); color: var(--warning); }
.role-user { background: rgba(139,146,165,0.12); color: var(--text-secondary); }

.td-key { font-family: var(--font-mono); font-size: 0.75rem; color: var(--text-muted); max-width: 200px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; cursor: pointer; }
.td-key:hover { color: var(--accent); }

/* =========================================
   Admin View
   ========================================= */
.admin-tabs { display: flex; gap: 8px; margin-bottom: 24px; border-bottom: 1px solid var(--border); padding-bottom: 1px; }
.admin-tab { padding: 10px 20px; border: none; background: transparent; color: var(--text-secondary); font-family: var(--font-sans); font-size: 0.95rem; font-weight: 500; cursor: pointer; transition: all var(--transition); border-bottom: 2px solid transparent; margin-bottom: -1px; }
.admin-tab:hover { color: var(--text); background: var(--surface-hover); border-radius: var(--radius-sm) var(--radius-sm) 0 0; }
.admin-tab.active { color: var(--accent); border-bottom-color: var(--accent); }

.admin-section { display: none; flex-direction: column; gap: 12px; }
.admin-section.active { display: flex; }
.admin-section + .admin-section { margin-top: 0; }
.admin-section-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.table-card { overflow: auto; }

/* =========================================
   Dialog
   ========================================= */
.glass-dialog { margin: auto; padding: 0; border: 1px solid var(--border); border-radius: var(--radius-lg); background: rgba(21, 25, 33, 0.85); box-shadow: var(--shadow-lg); color: var(--text); max-width: 90vw; width: 480px; backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); }
.glass-dialog::backdrop { background: rgba(0,0,0,0.6); backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px); }
.dialog-content { padding: 24px; display: flex; flex-direction: column; gap: 12px; }
.dialog-header { display: flex; justify-content: space-between; align-items: center; }
.dialog-title { margin: 0; font-size: 1.15rem; font-weight: 600; }
.btn-close-dialog { background: transparent; border: none; color: var(--text-muted); cursor: pointer; padding: 4px; border-radius: 4px; display: flex; transition: all 0.2s; }
.btn-close-dialog:hover { color: var(--danger); background: var(--danger-dim); }
.dialog-context { display: flex; align-items: center; gap: 8px; font-size: 0.82rem; color: var(--text-muted); padding: 8px 12px; background: rgba(0,212,170,0.05); border-radius: 6px; border: 1px solid rgba(0,212,170,0.1); }
.dialog-context strong { color: var(--accent); font-family: var(--font-mono); font-size: 0.8rem; }
.dialog-url-box { background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 10px 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dialog-url-text { font-family: var(--font-mono); font-size: 0.82rem; color: var(--text-secondary); }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 16px; }

/* Dialog Forms */
.dialog-form { display: flex; flex-direction: column; gap: 12px; }

/* --- Toast --- */
.toast { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%) translateY(100px); background: var(--surface); color: var(--text); padding: 12px 24px; border-radius: var(--radius-sm); border: 1px solid var(--border); box-shadow: var(--shadow); font-weight: 500; font-size: 0.875rem; opacity: 0; transition: transform 0.35s cubic-bezier(0.34,1.56,0.64,1), opacity 0.35s; z-index: 2000; pointer-events: none; }
.toast.show { transform: translateX(-50%) translateY(0); opacity: 1; }
.toast.toast-success { border-color: var(--accent); background: linear-gradient(135deg, var(--surface), rgba(0,212,170,0.08)); }
.toast.toast-error { border-color: var(--danger); background: linear-gradient(135deg, var(--surface), rgba(255,107,107,0.08)); }

/* --- Responsive --- */
@media (max-width: 900px) {
  .sidebar { width: 60px; padding: 12px 6px; }
  .sidebar-brand { justify-content: center; padding: 4px 0 16px; }
  .sidebar-title, .sidebar-link span, .user-details { display: none; }
  .sidebar-link { justify-content: center; padding: 10px; }
  .user-info { justify-content: center; }
  .mail-layout { grid-template-columns: 1fr; }
  .mail-list { max-height: 40vh; }
  .mail-content { max-height: 50vh; }
}
@media (max-width: 768px) {
  .main-content { padding: 12px; }
  .email-form { flex-direction: column; align-items: stretch; }
  .email-input-group { min-width: auto; }
  .email-actions { justify-content: stretch; }
  .email-actions button { flex: 1; justify-content: center; }
}

/* --- Animations --- */
@keyframes fadeIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }
.email-list li { animation: fadeIn 0.25s ease both; }
.email-list li:nth-child(2) { animation-delay: 0.03s; }
.email-list li:nth-child(3) { animation-delay: 0.06s; }
.email-list li:nth-child(4) { animation-delay: 0.09s; }
.email-list li:nth-child(5) { animation-delay: 0.12s; }
.email-list li:nth-child(n+6) { animation-delay: 0.15s; }
.btn-icon.spinning svg { animation: spin 0.8s linear infinite; }
@keyframes pulse { 0%, 100% { box-shadow: none; } 50% { box-shadow: inset 0 0 0 1px var(--accent); } }
.email-list li.new-email { animation: pulse 1s ease-in-out, fadeIn 0.25s ease both; }
.input-mono { font-family: var(--font-mono); }
