/* ============================================================
   BreachSec Mail — Proton Mail Inspired Design System
   Dark Carbon (défaut) + Light Theme
   ============================================================ */

:root,
[data-theme="dark"] {
  --bg-chrome: #16141c;
  --bg-sidebar: #16141c;
  --bg-surface: #1f1d28;
  --bg-elevated: #272433;
  --bg-hover: #2d293b;
  --bg-active-row: #31294d;
  --bg-input: #252230;
  --bg-code: #14121b;
  --border: rgba(255, 255, 255, 0.08);
  --border-strong: rgba(255, 255, 255, 0.14);
  --text: #f5f4f8;
  --text-soft: #d5d2e0;
  --muted: #9893aa;
  --proton: #6d4aff;
  --proton-hover: #7c5cff;
  --proton-soft: rgba(109, 74, 255, 0.18);
  --proton-text: #c4b5fd;
  --ok: #1ea885;
  --ok-soft: rgba(30, 168, 133, 0.16);
  --ok-text: #5eead4;
  --warn: #f59e0b;
  --danger: #ec5858;
  --danger-soft: rgba(236, 88, 88, 0.15);
  --shadow-modal: 0 24px 64px rgba(0, 0, 0, 0.65);
  --radius-surface: 16px;
  --radius: 10px;
  --radius-sm: 8px;
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Consolas, monospace;
}

[data-theme="light"] {
  --bg-chrome: #f3f1fb;
  --bg-sidebar: #f3f1fb;
  --bg-surface: #ffffff;
  --bg-elevated: #f8f7fc;
  --bg-hover: #eeebf8;
  --bg-active-row: #ebe6ff;
  --bg-input: #ffffff;
  --bg-code: #f5f4fa;
  --border: rgba(28, 22, 54, 0.09);
  --border-strong: rgba(28, 22, 54, 0.16);
  --text: #1b172b;
  --text-soft: #37324d;
  --muted: #6c6782;
  --proton: #6d4aff;
  --proton-hover: #5b38eb;
  --proton-soft: rgba(109, 74, 255, 0.11);
  --proton-text: #5936e5;
  --ok: #158f70;
  --ok-soft: rgba(21, 143, 112, 0.12);
  --ok-text: #0f766e;
  --warn: #d97706;
  --danger: #dc2626;
  --danger-soft: rgba(220, 38, 38, 0.1);
  --shadow-modal: 0 20px 50px rgba(27, 23, 43, 0.22);
}

* {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  background: var(--bg-chrome);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
}

.hidden { display: none !important; }
code, pre { font-family: var(--font-mono); }
.muted { color: var(--muted); }

/* Scrollbars discrètes façon Proton */
::-webkit-scrollbar { width: 7px; height: 7px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(152, 147, 170, 0.24); border-radius: 999px; }
::-webkit-scrollbar-thumb:hover { background: rgba(152, 147, 170, 0.42); }

/* ==================== SHELL PROTON ==================== */

.proton-shell {
  display: flex;
  height: 100vh;
  overflow: hidden;
  background:
    radial-gradient(600px circle at 0% 0%, rgba(109, 74, 255, 0.12), transparent 55%),
    var(--bg-chrome);
}

/* ==================== SIDEBAR ==================== */

.sidebar {
  width: 262px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  padding: 14px 12px 12px;
  gap: 10px;
  background: transparent;
}

.sidebar-top {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 0 4px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 4px 2px;
}

.proton-logo {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: linear-gradient(145deg, rgba(109, 74, 255, 0.26), rgba(109, 74, 255, 0.08));
  border: 1px solid rgba(151, 126, 255, 0.35);
  display: grid;
  place-items: center;
  flex-shrink: 0;
}

.brand-text {
  display: flex;
  flex-direction: column;
  line-height: 1.2;
}

.brand-title {
  font-size: 15px;
  font-weight: 500;
  letter-spacing: -0.2px;
  color: var(--text);
}

.brand-title strong {
  font-weight: 700;
  color: var(--proton-text);
}

.brand-domain {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--muted);
}

.sidebar-cta-group {
  display: flex;
  gap: 7px;
}

.btn-cta {
  flex: 1;
  height: 40px;
  border-radius: var(--radius);
  font-weight: 600;
  font-size: 13.5px;
  box-shadow: 0 6px 20px rgba(109, 74, 255, 0.32);
}

.btn-icon-sq {
  width: 40px;
  height: 40px;
  padding: 0;
  border-radius: var(--radius);
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin-top: 2px;
}

.sidebar-item {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  border: none;
  background: transparent;
  color: var(--text-soft);
  font-family: var(--font-sans);
  font-size: 13.5px;
  font-weight: 500;
  cursor: pointer;
  text-align: left;
  transition: background 0.14s ease, color 0.14s ease;
}

.sidebar-item svg {
  color: var(--muted);
  flex-shrink: 0;
}

.sidebar-item:hover {
  background: var(--bg-hover);
  color: var(--text);
}

.sidebar-item.active {
  background: var(--proton-soft);
  color: var(--text);
  font-weight: 600;
}

.sidebar-item.active svg {
  color: var(--proton-text);
}

.sidebar-item-label {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sidebar-badge {
  background: var(--proton);
  color: #ffffff;
  font-size: 11px;
  font-weight: 700;
  padding: 1px 7px;
  border-radius: 999px;
  min-width: 20px;
  text-align: center;
}

.sidebar-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 10px 4px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.7px;
  color: var(--muted);
  border-top: 1px solid var(--border);
  margin-top: 4px;
}

.sidebar-section-actions {
  display: flex;
  gap: 3px;
}

.mini-icon-btn {
  width: 24px;
  height: 24px;
  border-radius: 6px;
  border: none;
  background: transparent;
  color: var(--muted);
  display: grid;
  place-items: center;
  cursor: pointer;
}

.mini-icon-btn:hover {
  background: var(--bg-hover);
  color: var(--text);
}

.sidebar-inboxes {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding-right: 2px;
}

.inbox-item {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background 0.13s ease;
}

.inbox-item:hover {
  background: var(--bg-hover);
}

.inbox-item.active {
  background: var(--bg-active-row);
}

.inbox-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.inbox-item-main {
  min-width: 0;
  flex: 1;
}

.inbox-item-addr {
  font-size: 12.5px;
  font-weight: 500;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.inbox-item.active .inbox-item-addr {
  font-weight: 600;
  color: var(--proton-text);
}

.inbox-item-sub {
  font-size: 11px;
  color: var(--muted);
  margin-top: 1px;
}

.inbox-item-right {
  display: flex;
  align-items: center;
  gap: 4px;
}

.del-mini-btn {
  opacity: 0;
  background: transparent;
  border: none;
  color: var(--muted);
  cursor: pointer;
  font-size: 15px;
  line-height: 1;
  padding: 3px 5px;
  border-radius: 5px;
  transition: opacity 0.12s ease, background 0.12s ease, color 0.12s ease;
}

.inbox-item:hover .del-mini-btn,
.inbox-item.active .del-mini-btn {
  opacity: 0.8;
}

.del-mini-btn:hover {
  opacity: 1 !important;
  background: var(--danger-soft);
  color: var(--danger);
}

.sidebar-footer {
  padding: 10px 8px 2px;
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 9px;
}

.status-row {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.status-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-family: var(--font-mono);
  padding: 4px 8px;
  border-radius: 999px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  color: var(--muted);
}

.dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
}

.dot-ok { background: var(--ok); box-shadow: 0 0 7px var(--ok); }
.dot-warn { background: var(--warn); }
.dot-err { background: var(--danger); }

.sidebar-meter {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.meter-label {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  color: var(--muted);
}

.meter-track {
  height: 4px;
  border-radius: 999px;
  background: var(--bg-elevated);
  overflow: hidden;
}

.meter-fill {
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--proton), #9f85ff);
  transition: width 0.3s ease;
}

/* ==================== WORKSPACE DROIT ==================== */

.workspace-col {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  padding: 10px 14px 14px 4px;
  gap: 10px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  height: 44px;
  flex-shrink: 0;
}

.search-pill {
  flex: 1;
  max-width: 520px;
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0 13px;
  height: 38px;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.search-pill:focus-within {
  border-color: var(--proton);
  box-shadow: 0 0 0 3px var(--proton-soft);
}

.search-pill svg {
  color: var(--muted);
  flex-shrink: 0;
}

.search-pill input {
  flex: 1;
  background: transparent;
  border: none;
  padding: 0;
  color: var(--text);
  font-size: 13.5px;
  outline: none;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.active-addr-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  padding: 4px 5px 4px 11px;
  height: 38px;
  max-width: 390px;
}

.addr-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--proton);
  flex-shrink: 0;
}

.active-addr-pill code {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pill-copy-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: var(--proton-soft);
  color: var(--proton-text);
  border: none;
  border-radius: 7px;
  padding: 5px 10px;
  font-family: var(--font-sans);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.14s ease;
}

.pill-copy-btn:hover {
  background: var(--proton);
  color: #fff;
}

.pill-copy-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

/* ==================== SURFACE PRINCIPALE ARRONDIE ==================== */

.main-surface {
  flex: 1;
  min-height: 0;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-surface);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.tab-panel {
  display: none;
  flex: 1;
  min-height: 0;
}

.tab-panel.active {
  display: flex;
  flex-direction: column;
}

/* ==================== SPLIT MAIL VIEW (PROTON) ==================== */

.mail-split {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: 365px 1fr;
}

.message-list-pane {
  display: flex;
  flex-direction: column;
  min-height: 0;
  border-right: 1px solid var(--border);
}

.pane-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.toolbar-left, .toolbar-right {
  display: flex;
  align-items: center;
  gap: 6px;
}

.filter-chip {
  border: none;
  background: transparent;
  color: var(--muted);
  font-family: var(--font-sans);
  font-size: 12.5px;
  font-weight: 600;
  padding: 5px 10px;
  border-radius: 7px;
  cursor: pointer;
}

.filter-chip:hover {
  background: var(--bg-hover);
  color: var(--text);
}

.filter-chip.active {
  background: var(--proton-soft);
  color: var(--proton-text);
}

.message-scroll {
  flex: 1;
  overflow-y: auto;
}

/* Ligne email style Proton Mail */
.msg-item {
  display: flex;
  align-items: flex-start;
  gap: 11px;
  padding: 13px 14px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  position: relative;
  transition: background 0.12s ease;
}

.msg-item:hover {
  background: var(--bg-hover);
}

.msg-item.active {
  background: var(--bg-active-row);
}

.msg-item.active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 3px;
  background: var(--proton);
}

.avatar {
  width: 34px;
  height: 34px;
  border-radius: 9px;
  display: grid;
  place-items: center;
  font-weight: 700;
  font-size: 13px;
  color: #fff;
  flex-shrink: 0;
  user-select: none;
}

.msg-body-col {
  min-width: 0;
  flex: 1;
}

.msg-row-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 3px;
}

.msg-sender {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-soft);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 6px;
}

.msg-item.unread .msg-sender,
.msg-item.unread .msg-subject {
  font-weight: 700;
  color: var(--text);
}

.unread-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--proton);
  flex-shrink: 0;
}

.msg-time {
  font-size: 11.5px;
  color: var(--muted);
  white-space: nowrap;
}

.msg-subject {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-soft);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  margin-bottom: 3px;
}

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

.msg-badges {
  display: flex;
  gap: 6px;
  margin-top: 7px;
  flex-wrap: wrap;
}

.badge-otp {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 6px;
  background: var(--ok-soft);
  color: var(--ok-text);
}

.badge-pill {
  display: inline-flex;
  align-items: center;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 6px;
  background: var(--bg-elevated);
  color: var(--muted);
  border: 1px solid var(--border);
}

/* ==================== LECTEUR PROTON ==================== */

.reader-pane {
  display: flex;
  flex-direction: column;
  min-height: 0;
  background: var(--bg-surface);
}

.empty-state {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 40px;
  gap: 10px;
}

.empty-illustration {
  width: 78px;
  height: 78px;
  border-radius: 22px;
  background: var(--proton-soft);
  color: var(--proton-text);
  display: grid;
  place-items: center;
  margin-bottom: 4px;
}

.empty-state h3 {
  margin: 0;
  font-size: 17px;
}

.empty-state p {
  margin: 0;
  max-width: 360px;
  line-height: 1.5;
}

.empty-actions {
  display: flex;
  gap: 8px;
  margin-top: 10px;
}

.reader-content {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.reader-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 20px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.reader-toolbar-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

.source-badge {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 6px;
  background: var(--proton-soft);
  color: var(--proton-text);
}

.segmented-control {
  display: inline-flex;
  background: var(--bg-chrome);
  padding: 3px;
  border-radius: 9px;
  border: 1px solid var(--border);
  gap: 2px;
}

.reader-tab, .lang-btn {
  border: none;
  background: transparent;
  color: var(--muted);
  padding: 5px 12px;
  border-radius: 7px;
  font-family: var(--font-sans);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.14s ease;
}

.reader-tab.active, .lang-btn.active {
  background: var(--bg-elevated);
  color: var(--text);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.2);
}

.reader-header {
  padding: 18px 22px 14px;
  flex-shrink: 0;
}

.reader-subject {
  margin: 0 0 14px;
  font-size: 19px;
  font-weight: 700;
  letter-spacing: -0.2px;
  line-height: 1.3;
}

.sender-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.sender-details {
  flex: 1;
  min-width: 0;
}

.sender-line {
  display: flex;
  align-items: baseline;
  gap: 7px;
  flex-wrap: wrap;
}

.sender-email {
  font-size: 12.5px;
}

.recipient-line {
  font-size: 12px;
  margin-top: 3px;
}

.recipient-line code {
  color: var(--proton-text);
  font-size: 12px;
}

.reader-date {
  font-size: 12px;
  white-space: nowrap;
}

.otp-banner {
  margin: 0 22px 12px;
  padding: 12px 16px;
  background: linear-gradient(90deg, rgba(109, 74, 255, 0.16), rgba(30, 168, 133, 0.12));
  border: 1px solid rgba(139, 108, 255, 0.4);
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  flex-shrink: 0;
}

.otp-left {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
  font-size: 13px;
  color: var(--proton-text);
}

.otp-codes-wrap {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.otp-chip {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  background: var(--bg-chrome);
  border: 1px solid var(--proton);
  color: var(--text);
  border-radius: 8px;
  padding: 6px 12px;
  font-family: var(--font-mono);
  font-size: 17px;
  font-weight: 700;
  letter-spacing: 3px;
  cursor: pointer;
}

.otp-chip span {
  font-family: var(--font-sans);
  font-size: 11px;
  letter-spacing: 0;
  font-weight: 600;
  color: var(--proton-text);
}

.meta-strip {
  margin: 0 22px 10px;
  padding: 9px 13px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  flex-shrink: 0;
}

.meta-strip-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
}

.strip-items {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.link-pill, .att-pill {
  font-size: 12px;
  padding: 4px 10px;
  border-radius: 7px;
  background: var(--proton-soft);
  color: var(--proton-text);
  border: 1px solid rgba(109, 74, 255, 0.26);
  text-decoration: none;
  cursor: pointer;
  max-width: 340px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.reader-body {
  flex: 1;
  min-height: 0;
  padding: 0 22px 20px;
  display: flex;
  flex-direction: column;
}

.html-frame {
  flex: 1;
  width: 100%;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: #ffffff;
}

.code-view {
  flex: 1;
  margin: 0;
  padding: 15px;
  background: var(--bg-code);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-soft);
  font-size: 12.5px;
  line-height: 1.55;
  overflow: auto;
  white-space: pre-wrap;
  word-break: break-word;
}

/* ==================== PAGES INTERNES (KEYS / DOCS / DEPLOY) ==================== */

.page-scroll {
  overflow-y: auto;
}

.page-inner {
  padding: 24px 28px 34px;
  display: flex;
  flex-direction: column;
  gap: 18px;
  max-width: 1280px;
  width: 100%;
  margin: 0 auto;
}

.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 14px;
}

.page-header h2 {
  margin: 0 0 4px;
  font-size: 21px;
  font-weight: 700;
}

.page-header p {
  margin: 0;
}

.kpi-row {
  display: flex;
  gap: 10px;
}

.kpi-card {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 16px;
  min-width: 112px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.kpi-card strong {
  font-size: 19px;
  font-family: var(--font-mono);
  color: var(--proton-text);
}

.kpi-card span {
  font-size: 11.5px;
  color: var(--muted);
}

.card {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 20px;
}

.card-flush {
  padding: 0;
  overflow: hidden;
}

.card h3 {
  margin: 0 0 12px;
  font-size: 15px;
  font-weight: 600;
}

.two-col-grid {
  display: grid;
  grid-template-columns: 1.15fr 0.85fr;
  gap: 16px;
}

.card-head-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.card-head-row h3 { margin: 0; }

.inline-form {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.inline-form input[type="text"] {
  flex: 1;
  min-width: 240px;
}

.checkbox-label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  cursor: pointer;
}

.table-wrap { overflow-x: auto; }

.data-table {
  width: 100%;
  border-collapse: collapse;
}

.data-table th, .data-table td {
  text-align: left;
  padding: 13px 16px;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
}

.data-table tr:last-child td {
  border-bottom: none;
}

.data-table th {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.7px;
  color: var(--muted);
  background: rgba(0, 0, 0, 0.08);
}

.key-cell {
  display: flex;
  align-items: center;
  gap: 7px;
  flex-wrap: wrap;
}

.key-code {
  background: var(--bg-code);
  border: 1px solid var(--border);
  padding: 4px 9px;
  border-radius: 6px;
  font-size: 12px;
  color: var(--proton-text);
}

.code-block-wrap { position: relative; }
.copy-code-btn { position: absolute; top: 10px; right: 10px; z-index: 2; }
.code-snippet { max-height: 310px; }

.endpoint-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.endpoint-item {
  display: grid;
  grid-template-columns: 58px minmax(190px, auto) 1fr;
  align-items: center;
  gap: 10px;
  padding: 8px 11px;
  background: var(--bg-code);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 12.5px;
}

.endpoint-item span:last-child { color: var(--muted); }

.method {
  display: inline-block;
  text-align: center;
  font-family: var(--font-mono);
  font-size: 10.5px;
  font-weight: 700;
  padding: 3px 6px;
  border-radius: 5px;
}

.method.get { background: var(--proton-soft); color: var(--proton-text); }
.method.post { background: var(--ok-soft); color: var(--ok-text); }
.method.del { background: var(--danger-soft); color: var(--danger); }

.playground-controls { display: flex; gap: 10px; }
.playground-controls select { flex: 1; }
.pg-meta { display: flex; align-items: center; gap: 10px; font-size: 12px; }
.pg-output { min-height: 340px; max-height: 500px; }

.active-key-selector {
  display: flex;
  align-items: center;
  gap: 9px;
  font-size: 12.5px;
  color: var(--muted);
}

/* ==================== BUTTONS, INPUTS, MODALS ==================== */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 9px 15px;
  border-radius: var(--radius-sm);
  font-family: var(--font-sans);
  font-weight: 600;
  font-size: 13px;
  border: 1px solid transparent;
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.btn-sm { padding: 6px 12px; font-size: 12.5px; }
.btn-xs { padding: 4px 9px; font-size: 11.5px; }
.btn-full { width: 100%; }

.btn-primary {
  background: var(--proton);
  color: #ffffff;
}

.btn-primary:hover {
  background: var(--proton-hover);
}

.btn-secondary {
  background: var(--bg-elevated);
  color: var(--text);
  border-color: var(--border-strong);
}

.btn-secondary:hover {
  background: var(--bg-hover);
}

.btn-ghost {
  background: transparent;
  color: var(--muted);
  border-color: var(--border);
}

.btn-ghost:hover {
  background: var(--bg-hover);
  color: var(--text);
}

.btn-danger-ghost {
  background: var(--danger-soft);
  color: var(--danger);
  border-color: transparent;
}

.btn-danger-ghost:hover {
  filter: brightness(1.1);
}

.icon-btn {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg-surface);
  color: var(--muted);
  cursor: pointer;
  display: grid;
  place-items: center;
  font-size: 17px;
}

.icon-btn-sm {
  width: 30px;
  height: 30px;
  background: transparent;
  border-color: transparent;
}

.icon-btn:hover {
  background: var(--bg-hover);
  color: var(--text);
}

input, select, textarea {
  background: var(--bg-input);
  color: var(--text);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  padding: 9px 12px;
  font-family: var(--font-sans);
  font-size: 13.5px;
  outline: none;
  transition: border-color 0.14s ease, box-shadow 0.14s ease;
}

input:focus, select:focus, textarea:focus {
  border-color: var(--proton);
  box-shadow: 0 0 0 3px var(--proton-soft);
}

.overlay {
  position: fixed;
  inset: 0;
  background: rgba(12, 10, 20, 0.72);
  backdrop-filter: blur(8px);
  display: grid;
  place-items: center;
  z-index: 50;
  padding: 16px;
}

.modal {
  width: 100%;
  max-width: 480px;
  background: var(--bg-surface);
  border: 1px solid var(--border-strong);
  border-radius: 16px;
  padding: 22px;
  box-shadow: var(--shadow-modal);
}

.modal-sm { max-width: 390px; }

.login-brand {
  text-align: center;
  margin-bottom: 18px;
}

.proton-logo-lg {
  width: 52px;
  height: 52px;
  margin: 0 auto 10px;
  border-radius: 14px;
  background: var(--proton-soft);
  border: 1px solid rgba(151, 126, 255, 0.35);
  display: grid;
  place-items: center;
}

.login-brand h2 { margin: 0 0 4px; }
.login-brand p { margin: 0; font-size: 13px; }

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.modal-header h3 { margin: 0; font-size: 16px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 6px; }
.stack-md { display: flex; flex-direction: column; gap: 14px; }
.stack-sm { display: flex; flex-direction: column; gap: 10px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

.field { display: flex; flex-direction: column; gap: 6px; }
.field > span { font-size: 12.5px; font-weight: 600; color: var(--text-soft); }

.email-composer-row { display: flex; align-items: center; gap: 8px; }
.email-composer-row input { flex: 1; }
.at-sign { font-family: var(--font-mono); font-weight: 700; color: var(--proton-text); }

.error-banner {
  background: var(--danger-soft);
  color: var(--danger);
  border-radius: var(--radius-sm);
  padding: 9px 12px;
  font-size: 12.5px;
}

.toast-container {
  position: fixed;
  right: 20px;
  bottom: 20px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 100;
}

.toast {
  background: var(--bg-elevated);
  color: var(--text);
  border: 1px solid var(--border-strong);
  border-left: 3px solid var(--proton);
  padding: 11px 16px;
  border-radius: 10px;
  font-size: 13px;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.35);
  animation: toastPop 0.18s ease;
}

.toast.toast-error { border-left-color: var(--danger); }

@keyframes toastPop {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ==================== RESPONSIVE ==================== */

@media (max-width: 1120px) {
  .mail-split { grid-template-columns: 290px 1fr; }
  .two-col-grid { grid-template-columns: 1fr; }
}

@media (max-width: 880px) {
  .proton-shell { flex-direction: column; height: auto; min-height: 100vh; overflow: visible; }
  .sidebar { width: 100%; }
  .workspace-col { padding: 10px; }
  .topbar { height: auto; flex-wrap: wrap; }
  .mail-split { grid-template-columns: 1fr; }
  .message-list-pane { max-height: 360px; border-right: none; border-bottom: 1px solid var(--border); }
}
