/* PlexiOS v2 Inbox — UI w stylu v4 strony (aurora + teal/purple, glassmorphism) */

:root {
  /* v4 palette (z plexisystem.pl styles/v4.css) */
  --bg: #0d1117;
  --bg-2: #141a23;
  --bg-3: #1a2230;
  --ink: #f4f5f7;
  --ink-2: #a8aeb8;
  --ink-dim: #6c7281;
  --line: rgba(255,255,255,.08);
  --line-hover: rgba(255,255,255,.14);
  --acc: #00d1b2;           /* teal — główny */
  --acc-2: #7c5cff;         /* purple */
  --acc-3: #3b82f6;         /* blue */
  --glass: rgba(255,255,255,.04);
  --glass-2: rgba(255,255,255,.08);
  --danger: #ef4444;
  --warn: #f59e0b;
  --ok: #10b981;
  --r: 14px;
  --r-l: 24px;
  --r-s: 8px;
  --f-d: 'Space Grotesk', system-ui, sans-serif;
  --f-b: 'Inter', system-ui, sans-serif;
}

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

html, body {
  height: 100%;
  overflow: hidden;
  font-family: var(--f-b);
  background: var(--bg);
  color: var(--ink);
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
  line-height: 1.5;
}

/* ========== AURORA BG (jak v4 strony) ========== */
.aurora {
  position: fixed; inset: 0; z-index: 0; pointer-events: none; overflow: hidden;
}
.aurora::before, .aurora::after {
  content: ""; position: absolute; width: 900px; height: 900px;
  border-radius: 50%; filter: blur(120px); opacity: .22;
  mix-blend-mode: screen; will-change: transform;
}
.aurora::before {
  background: radial-gradient(circle, #00d1b2, transparent 70%);
  top: -300px; left: -200px;
  animation: drift1 28s ease-in-out infinite;
}
.aurora::after {
  background: radial-gradient(circle, #7c5cff, transparent 70%);
  bottom: -400px; right: -200px;
  animation: drift2 32s ease-in-out infinite;
}
.aurora-3 {
  position: fixed; width: 700px; height: 700px; border-radius: 50%;
  background: radial-gradient(circle, #3b82f6, transparent 70%);
  filter: blur(120px); opacity: .14; mix-blend-mode: screen;
  top: 40%; left: 50%; transform: translate(-50%, -50%);
  animation: drift3 40s ease-in-out infinite;
  z-index: 0; pointer-events: none;
}
@keyframes drift1 {
  0%, 100% { transform: translate(0, 0) scale(1); }
  33%      { transform: translate(40vw, 30vh) scale(1.15); }
  66%      { transform: translate(20vw, 60vh) scale(.9); }
}
@keyframes drift2 {
  0%, 100% { transform: translate(0, 0) scale(1); }
  33%      { transform: translate(-30vw, -40vh) scale(.85); }
  66%      { transform: translate(-50vw, -20vh) scale(1.2); }
}
@keyframes drift3 {
  0%, 100% { transform: translate(-50%, -50%) scale(1); }
  50%      { transform: translate(-30%, -70%) scale(1.3); }
}
@media (prefers-reduced-motion: reduce) {
  .aurora::before, .aurora::after, .aurora-3 { animation: none; }
}

/* ========== APPROVAL BANNER ========== */
.approval-banner {
  background: linear-gradient(90deg, rgba(124, 92, 255, 0.22), rgba(0, 209, 178, 0.14));
  border-bottom: 1px solid var(--acc-2);
  padding: 8px 20px;
  text-align: center;
  font-size: 12px;
  color: var(--ink);
  font-family: var(--f-d);
  letter-spacing: 0.02em;
  position: sticky;
  top: 0;
  z-index: 25;
}
.approval-banner strong { color: var(--acc); font-weight: 700; }

/* ========== TOPBAR (sticky, always visible) ========== */
.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 20px;
  background: rgba(13, 17, 23, 0.72);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border-bottom: 1px solid var(--line);
  height: 56px;
}
.topbar-left { display: flex; align-items: center; gap: 32px; }
.topbar-logo {
  font-family: var(--f-d);
  font-weight: 700;
  font-size: 1.05rem;
  letter-spacing: -0.02em;
  color: var(--ink);
  text-decoration: none;
  white-space: nowrap;
}
.topbar-logo span { color: var(--acc); }

.topbar-nav {
  display: flex;
  gap: 4px;
  align-items: center;
}
.topbar-nav-item {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  border-radius: 100px;
  color: var(--ink-2);
  font-size: 13px;
  font-weight: 500;
  text-decoration: none;
  transition: all 0.18s;
  position: relative;
}
.topbar-nav-item:hover { background: var(--glass); color: var(--ink); }
.topbar-nav-item.active {
  background: rgba(0, 209, 178, 0.12);
  color: var(--acc);
}
.topbar-nav-item .ic { font-size: 14px; opacity: 0.9; }
.topbar-nav-item .nav-dot {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--danger);
  box-shadow: 0 0 6px var(--danger);
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 8px;
}
.topbar-action {
  background: var(--glass);
  border: 1px solid var(--line);
  color: var(--ink-2);
  width: 36px;
  height: 36px;
  border-radius: 100px;
  cursor: pointer;
  font-family: var(--f-d);
  font-size: 11px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.18s;
  padding: 0;
}
.topbar-action:hover {
  background: var(--glass-2);
  border-color: var(--line-hover);
  color: var(--ink);
}
.topbar-action .ic { font-weight: 600; }

#refresh-icon {
  display: inline-block;
  transition: transform 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}
.refreshing #refresh-icon { transform: rotate(360deg); }

.topbar-user {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-left: 4px;
}
.topbar-user .avatar {
  width: 32px;
  height: 32px;
  border-radius: 100px;
  background: linear-gradient(135deg, var(--acc), var(--acc-2));
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 13px;
  color: #001a16;
  font-family: var(--f-d);
}
.topbar-logout {
  background: none;
  border: none;
  color: var(--ink-dim);
  cursor: pointer;
  font-size: 18px;
  padding: 4px 8px;
  border-radius: 6px;
  transition: all 0.18s;
}
.topbar-logout:hover { color: var(--danger); background: var(--glass); }

@media (max-width: 720px) {
  .topbar-nav-item span:not(.ic) { display: none; }
  .topbar-nav-item { padding: 7px 10px; }
  .topbar-logo { font-size: 0.95rem; }
}

.inbox-shell {
  display: grid;
  grid-template-columns: 250px 400px 1fr;
  height: calc(100vh - 56px);
  width: 100vw;
  position: relative;
  z-index: 1;
}

/* ========== LEFT: Sidebar ========== */
.sidebar {
  background: rgba(13, 17, 23, 0.55);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  padding: 18px;
  overflow-y: auto;
}

.sidebar-user {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px;
  background: var(--glass);
  border: 1px solid var(--line);
  border-radius: var(--r);
  margin-bottom: 20px;
  transition: border-color 0.2s;
}
.sidebar-user:hover { border-color: var(--line-hover); }
.sidebar-user .avatar {
  width: 36px; height: 36px;
  border-radius: 100px;
  background: linear-gradient(135deg, var(--acc), var(--acc-2));
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 14px; color: #001a16;
  font-family: var(--f-d);
}
.sidebar-user .name {
  flex: 1;
  font-size: 13px;
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.sidebar-user .role {
  font-size: 10px;
  color: var(--ink-dim);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-family: var(--f-d);
}

.sidebar-section { margin-bottom: 20px; }
.sidebar-section-title {
  font-family: var(--f-d);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  color: var(--ink-dim);
  padding: 6px 10px;
  margin-bottom: 4px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.sidebar-section-title::before {
  content: "";
  width: 16px;
  height: 1px;
  background: var(--acc);
}

.sidebar-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border-radius: var(--r-s);
  cursor: pointer;
  color: var(--ink-2);
  font-size: 13px;
  transition: all 0.2s;
  text-decoration: none;
  position: relative;
}
.sidebar-item:hover { background: var(--glass); color: var(--ink); }
.sidebar-item.active {
  background: linear-gradient(90deg, rgba(0,209,178,.12), rgba(0,209,178,.04));
  color: var(--ink);
  border-left: 2px solid var(--acc);
  padding-left: 10px;
}
.sidebar-item .icon { width: 16px; text-align: center; font-size: 14px; }
.sidebar-item .label { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sidebar-item .badge {
  font-size: 10px;
  font-family: var(--f-d);
  font-weight: 600;
  background: var(--acc);
  color: #001a16;
  padding: 2px 7px;
  border-radius: 100px;
  min-width: 20px;
  text-align: center;
}
.sidebar-item .badge.muted { background: var(--glass-2); color: var(--ink-dim); }
.sidebar-item .badge.warning { background: var(--warn); color: #1a0d00; }
.sidebar-item .badge.error { background: var(--danger); color: #fff; }

/* Toggle (np. "Pokaż załatwione") */
.sidebar-item.toggle {
  font-style: italic;
  opacity: 0.7;
}
.sidebar-item.toggle.on {
  background: rgba(124, 92, 255, 0.1);
  opacity: 1;
  color: var(--acc-2);
  font-style: normal;
}
.sidebar-item.toggle.on .icon {
  color: var(--acc-2);
}

.sidebar-footer {
  margin-top: auto;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}
.kbd-hints {
  font-size: 11px;
  color: var(--ink-dim);
  line-height: 2;
  padding: 0 6px;
}
.kbd-hints div { display: flex; gap: 6px; align-items: center; }

/* ========== MIDDLE: Message List ========== */
.list-pane {
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: rgba(13, 17, 23, 0.4);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
}

.list-header {
  padding: 18px 24px 12px;
  border-bottom: 1px solid var(--line);
  background: rgba(13, 17, 23, 0.5);
}
.list-header-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 10px;
}
.list-header h2 {
  font-family: var(--f-d);
  font-size: 1.4rem;
  font-weight: 600;
  letter-spacing: -0.02em;
}
.list-count {
  font-size: 11px;
  color: var(--ink-dim);
  font-family: var(--f-d);
  letter-spacing: 0.08em;
}
.list-search-wrap {
  position: relative;
  display: flex;
  align-items: center;
}
.list-search-icon {
  position: absolute;
  left: 14px;
  color: var(--ink-dim);
  pointer-events: none;
  font-size: 14px;
}
.list-search {
  width: 100%;
  background: var(--glass);
  border: 1px solid var(--line);
  color: var(--ink);
  padding: 10px 14px 10px 36px;
  border-radius: 100px;
  font-size: 13px;
  font-family: inherit;
  transition: all 0.2s;
}
.list-search::placeholder { color: var(--ink-dim); }
.list-search:focus {
  outline: none;
  border-color: var(--acc);
  background: var(--glass-2);
  box-shadow: 0 0 0 3px rgba(0, 209, 178, 0.1);
}

/* Time section headers */
.time-section-header {
  padding: 14px 24px 6px;
  font-family: var(--f-d);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  color: var(--ink-dim);
  background: rgba(13, 17, 23, 0.3);
  position: sticky;
  top: 0;
  z-index: 2;
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}

/* Thread grouping */
.thread-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 18px;
  padding: 0 6px;
  background: var(--glass-2);
  border: 1px solid var(--line);
  border-radius: 100px;
  font-size: 10px;
  font-family: var(--f-d);
  font-weight: 600;
  color: var(--ink-2);
  margin-left: 4px;
}
.list-item.has-thread .from::after {
  content: "";
  display: inline-block;
  width: 8px;
  height: 8px;
  border-left: 2px solid var(--acc);
  border-bottom: 2px solid var(--acc);
  margin-left: 6px;
  vertical-align: middle;
  opacity: 0.6;
}

/* Skeleton loading */
.skeleton-list { padding: 12px 0; }
.skeleton-item {
  height: 78px;
  margin: 2px 24px;
  border-radius: var(--r);
  background: linear-gradient(90deg, var(--glass) 25%, var(--glass-2) 50%, var(--glass) 75%);
  background-size: 200% 100%;
  animation: skeleton-loading 1.4s ease-in-out infinite;
}
@keyframes skeleton-loading {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

.list-items { flex: 1; overflow-y: auto; }

.list-item {
  padding: 14px 24px;
  border-bottom: 1px solid var(--line);
  cursor: pointer;
  transition: all 0.18s;
  position: relative;
}
.list-item:hover {
  background: var(--glass);
  border-left: 3px solid var(--line-hover);
  padding-left: 21px;
}
.list-item.active {
  background: linear-gradient(90deg, rgba(0,209,178,.08), transparent);
  border-left: 3px solid var(--acc);
  padding-left: 21px;
}
.list-item.unread .subject,
.list-item.unread .from { font-weight: 600; color: var(--ink); }
.list-item.unread::before {
  content: "";
  position: absolute;
  left: 8px;
  top: 50%;
  transform: translateY(-50%);
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--acc);
  box-shadow: 0 0 8px var(--acc);
}
.list-item.quarantined {
  background: linear-gradient(90deg, rgba(239,68,68,.06), transparent);
  border-left: 3px solid var(--danger);
  padding-left: 21px;
}
.list-item.quarantined .from, .list-item.quarantined .subject { color: var(--danger); }

.list-item.done {
  opacity: 0.5;
}
.list-item.done .from, .list-item.done .subject {
  text-decoration: line-through;
  text-decoration-color: rgba(124, 92, 255, 0.5);
}

.list-item-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px;
  margin-bottom: 4px;
}
.list-item .from {
  color: var(--ink);
  font-size: 13px;
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1;
}
.list-item .time {
  font-size: 11px;
  color: var(--ink-dim);
  white-space: nowrap;
  font-family: var(--f-d);
}
.list-item .subject {
  font-size: 13px;
  color: var(--ink-2);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  margin-bottom: 4px;
}
.list-item .preview {
  font-size: 11px;
  color: var(--ink-dim);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.list-item .badges {
  display: flex;
  gap: 5px;
  margin-top: 8px;
  flex-wrap: wrap;
}
.badge-pill {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-size: 9px;
  padding: 3px 8px;
  border-radius: 100px;
  background: var(--glass-2);
  color: var(--ink-2);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-family: var(--f-d);
  font-weight: 500;
  border: 1px solid var(--line);
}
.badge-pill.trusted { background: rgba(16,185,129,.12); color: var(--ok); border-color: rgba(16,185,129,.3); }
.badge-pill.suspicious { background: rgba(245,158,11,.12); color: var(--warn); border-color: rgba(245,158,11,.3); }
.badge-pill.danger { background: rgba(239,68,68,.12); color: var(--danger); border-color: rgba(239,68,68,.3); }
.badge-pill.quote { background: rgba(0,209,178,.12); color: var(--acc); border-color: rgba(0,209,178,.3); }
.badge-pill.attach { background: var(--glass); color: var(--ink-2); }

.list-empty {
  padding: 40px 24px;
  text-align: center;
  color: var(--ink-dim);
  font-size: 13px;
}

/* ========== RIGHT: Preview ========== */
.preview-pane {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: rgba(13, 17, 23, 0.25);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
}

.preview-empty {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: var(--ink-dim);
  font-size: 13px;
}
.preview-empty .big-icon {
  font-size: 72px;
  background: linear-gradient(135deg, var(--acc), var(--acc-2));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  opacity: 0.4;
  margin-bottom: 16px;
  font-family: var(--f-d);
}
.preview-empty .empty-title {
  font-family: var(--f-d);
  font-size: 1.05rem;
  color: var(--ink-2);
  margin-bottom: 6px;
}
.preview-empty .empty-sub {
  font-size: 12px;
  color: var(--ink-dim);
}

/* ========== COMMAND PALETTE ========== */
.cmd-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 100;
  display: none;
  align-items: flex-start;
  justify-content: center;
  padding-top: 12vh;
  animation: cmd-fade 0.15s ease-out;
}
.cmd-overlay.show { display: flex; }
@keyframes cmd-fade {
  from { opacity: 0; backdrop-filter: blur(0); }
  to   { opacity: 1; backdrop-filter: blur(8px); }
}
.cmd-palette {
  width: min(600px, 90vw);
  background: rgba(20, 26, 35, 0.96);
  backdrop-filter: blur(40px);
  -webkit-backdrop-filter: blur(40px);
  border: 1px solid var(--line-hover);
  border-radius: var(--r-l);
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.6), 0 0 0 1px rgba(0, 209, 178, 0.05);
  overflow: hidden;
  animation: cmd-slide 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}
@keyframes cmd-slide {
  from { opacity: 0; transform: translateY(-12px) scale(0.98); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}
.cmd-search-wrap {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--line);
}
.cmd-icon {
  color: var(--ink-dim);
  font-size: 18px;
}
.cmd-search {
  flex: 1;
  background: none;
  border: none;
  color: var(--ink);
  font-size: 16px;
  font-family: inherit;
  outline: none;
}
.cmd-search::placeholder { color: var(--ink-dim); }
.cmd-results {
  max-height: 400px;
  overflow-y: auto;
  padding: 8px 0;
}
.cmd-section {
  padding: 6px 20px;
  font-family: var(--f-d);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  color: var(--ink-dim);
}
.cmd-result {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 20px;
  cursor: pointer;
  transition: background 0.1s;
}
.cmd-result:hover, .cmd-result.active {
  background: var(--glass-2);
}
.cmd-result .ic {
  width: 24px;
  font-size: 16px;
  text-align: center;
  color: var(--ink-2);
}
.cmd-result .main { flex: 1; overflow: hidden; }
.cmd-result .title {
  font-size: 14px;
  color: var(--ink);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.cmd-result .sub {
  font-size: 12px;
  color: var(--ink-dim);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.cmd-result .shortcut {
  font-size: 10px;
  color: var(--ink-dim);
  font-family: var(--f-d);
  letter-spacing: 0.05em;
}
.cmd-footer {
  display: flex;
  gap: 16px;
  padding: 10px 20px;
  border-top: 1px solid var(--line);
  font-size: 11px;
  color: var(--ink-dim);
  justify-content: flex-end;
}
.cmd-footer span { display: flex; align-items: center; gap: 4px; }
.cmd-empty {
  padding: 40px 20px;
  text-align: center;
  color: var(--ink-dim);
  font-size: 13px;
}

/* ========== COMPOSE MODAL ========== */
.compose-box {
  width: min(720px, 94vw);
  max-height: 90vh;
  background: rgba(20, 26, 35, 0.98);
  backdrop-filter: blur(40px);
  -webkit-backdrop-filter: blur(40px);
  border: 1px solid var(--line-hover);
  border-radius: var(--r-l);
  box-shadow: 0 24px 80px rgba(0,0,0,0.6);
  display: flex;
  flex-direction: column;
  animation: cmd-slide 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}
.compose-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px;
  border-bottom: 1px solid var(--line);
}
.compose-header h3 {
  font-family: var(--f-d);
  font-size: 1.05rem;
  font-weight: 600;
}
.compose-body {
  padding: 16px 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  flex: 1;
  overflow-y: auto;
}
.compose-row {
  display: flex;
  align-items: center;
  gap: 10px;
  border-bottom: 1px solid var(--line);
  padding-bottom: 8px;
}
.compose-row label {
  min-width: 44px;
  color: var(--ink-dim);
  font-size: 12px;
  font-family: var(--f-d);
  text-transform: uppercase;
  letter-spacing: 0.1em;
}
.compose-input {
  flex: 1;
  background: transparent;
  border: none;
  color: var(--ink);
  font-size: 14px;
  font-family: inherit;
  padding: 6px 4px;
}
.compose-input:focus { outline: none; }
select.compose-input option { background: var(--bg-2); color: var(--ink); }
.compose-textarea {
  flex: 1;
  min-height: 260px;
  width: 100%;
  background: transparent;
  border: none;
  color: var(--ink);
  font-family: inherit;
  font-size: 14px;
  line-height: 1.6;
  padding: 10px 4px;
  resize: vertical;
}
.compose-textarea:focus { outline: none; }
.cc-toggle {
  background: var(--glass);
  border: 1px solid var(--line);
  color: var(--ink-dim);
  padding: 4px 10px;
  border-radius: 100px;
  font-size: 11px;
  cursor: pointer;
  font-family: var(--f-d);
}
.cc-toggle:hover { background: var(--glass-2); color: var(--ink); }
.compose-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 20px;
  border-top: 1px solid var(--line);
  background: rgba(13,17,23,0.4);
}
.btn-primary {
  background: var(--acc);
  color: #001a16;
  border: none;
  padding: 10px 24px;
  border-radius: 100px;
  font-family: var(--f-d);
  font-weight: 600;
  font-size: 13px;
  cursor: pointer;
  transition: all 0.2s;
}
.btn-primary:hover { background: var(--acc-hover, #3bdcc5); transform: translateY(-1px); box-shadow: 0 8px 24px rgba(0,209,178,.35); }
.btn-primary:disabled { opacity: 0.5; cursor: not-allowed; }
.draft-status {
  font-size: 11px;
  color: var(--ink-dim);
  font-family: var(--f-d);
}
#compose-attachments {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}
#compose-attachments .pending-att {
  background: var(--glass);
  border: 1px solid var(--line);
  padding: 6px 10px;
  border-radius: var(--r);
  font-size: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
}
#compose-attachments .pending-att button {
  background: transparent; border: none; color: var(--ink-dim); cursor: pointer; font-size: 14px;
}
#compose-attachments .pending-att button:hover { color: var(--danger); }

/* ========== HELP MODAL ========== */
.help-modal { width: min(680px, 90vw); padding: 20px; }
.help-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}
.help-header h3 {
  font-family: var(--f-d);
  font-size: 1.1rem;
  font-weight: 600;
}
.help-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 20px;
}
.help-group-title {
  font-family: var(--f-d);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  color: var(--acc);
  margin-bottom: 10px;
}
.help-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 0;
  font-size: 12px;
  color: var(--ink-2);
}
.help-row span { flex: 1; }

.preview-header {
  padding: 24px 28px 18px;
  border-bottom: 1px solid var(--line);
  background: rgba(13, 17, 23, 0.4);
}
.preview-header h2 {
  font-family: var(--f-d);
  font-size: 1.4rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  margin-bottom: 12px;
  line-height: 1.25;
}
.preview-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 13px;
  color: var(--ink-2);
}
.preview-from {
  display: flex;
  align-items: center;
  gap: 10px;
}
.preview-from .avatar-sm {
  width: 32px; height: 32px;
  border-radius: 100px;
  background: linear-gradient(135deg, var(--acc-2), var(--acc-3));
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 13px; color: white;
  font-family: var(--f-d);
}

.preview-actions {
  display: flex;
  gap: 8px;
  padding: 12px 28px;
  border-bottom: 1px solid var(--line);
  background: rgba(13, 17, 23, 0.3);
}
.preview-actions button {
  background: var(--glass);
  border: 1px solid var(--line);
  color: var(--ink);
  padding: 8px 14px;
  border-radius: 100px;
  font-size: 12px;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  gap: 5px;
  font-weight: 500;
}
.preview-actions button:hover {
  background: var(--glass-2);
  border-color: var(--line-hover);
  transform: translateY(-1px);
}
.preview-actions button.primary {
  background: var(--acc);
  border-color: var(--acc);
  color: #001a16;
  font-weight: 600;
}
.preview-actions button.primary:hover {
  background: var(--acc);
  box-shadow: 0 8px 24px rgba(0,209,178,.35);
}
.preview-actions button.danger:hover {
  background: rgba(239,68,68,.12);
  border-color: var(--danger);
  color: var(--danger);
}

/* Reassign dropdown */
.reassign-wrap {
  position: relative;
  display: inline-block;
}
.reassign-menu {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  min-width: 160px;
  background: rgba(20, 26, 35, 0.96);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border: 1px solid var(--line-hover);
  border-radius: var(--r);
  padding: 6px;
  display: none;
  z-index: 30;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.4);
  flex-direction: column;
  gap: 2px;
}
.reassign-menu.open { display: flex; }
.reassign-menu button {
  background: transparent !important;
  border: none !important;
  width: 100%;
  text-align: left;
  padding: 8px 12px !important;
  border-radius: 6px !important;
  justify-content: flex-start !important;
  color: var(--ink) !important;
}
.reassign-menu button:hover {
  background: var(--glass-2) !important;
  transform: none !important;
}
.reassign-menu::before {
  content: "Przekaż do…";
  font-family: var(--f-d);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  color: var(--ink-dim);
  padding: 8px 12px 4px;
  display: block;
}

/* ========== ENTERPRISE VIRUS BANNER (dla Doroty) ========== */
.danger-banner {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  padding: 20px 24px;
  background: linear-gradient(135deg, rgba(239, 68, 68, 0.25), rgba(220, 38, 38, 0.15));
  border: 2px solid var(--danger);
  border-left: 6px solid var(--danger);
  margin: 0;
  position: relative;
  animation: danger-pulse 2s ease-in-out infinite;
}
.warn-banner {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  padding: 16px 24px;
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.18), rgba(245, 158, 11, 0.08));
  border: 1px solid var(--warn);
  border-left: 4px solid var(--warn);
}
.db-icon {
  font-size: 36px;
  line-height: 1;
  color: var(--danger);
  flex-shrink: 0;
  animation: danger-shake 0.5s ease-in-out 2;
}
.warn-banner .db-icon { color: var(--warn); animation: none; font-size: 24px; }
.db-content { flex: 1; }
.db-title {
  font-family: var(--f-d);
  font-size: 17px;
  font-weight: 700;
  color: var(--danger);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  line-height: 1.3;
}
.warn-banner .db-title { color: var(--warn); font-size: 14px; }

.url-warn-banner {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 14px 24px;
  background: linear-gradient(135deg, rgba(239, 68, 68, 0.15), rgba(220, 38, 38, 0.08));
  border-left: 4px solid var(--danger);
  border-bottom: 1px solid var(--line);
  color: var(--ink);
}
.url-warn-banner .db-icon { font-size: 24px; }
.url-warn-banner .db-title { font-family: var(--f-d); font-weight: 600; font-size: 13px; color: var(--danger); margin-bottom: 6px; }
.url-warn-banner .db-sub { font-size: 12px; color: var(--ink-2); word-break: break-all; }
.url-warn-banner .db-sub div { margin-bottom: 3px; }
.db-sub {
  font-size: 13px;
  color: var(--ink);
  margin-bottom: 10px;
  line-height: 1.5;
}
.db-rules {
  font-size: 12px;
  color: var(--ink-2);
  padding-top: 8px;
  border-top: 1px solid rgba(239, 68, 68, 0.3);
}
.db-rules strong { color: var(--ink); }
@keyframes danger-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.4); }
  50%      { box-shadow: 0 0 24px 4px rgba(239, 68, 68, 0.25); }
}
@keyframes danger-shake {
  0%, 100% { transform: translateX(0); }
  25%      { transform: translateX(-3px); }
  75%      { transform: translateX(3px); }
}

.blocked-url {
  background: rgba(239, 68, 68, 0.1);
  border: 1px dashed var(--danger);
  color: var(--danger);
  padding: 2px 6px;
  border-radius: 4px;
  font-family: monospace;
  font-size: 12px;
  cursor: not-allowed;
  text-decoration: line-through;
}

/* Security panel */
.security-panel {
  padding: 12px 28px;
  background: rgba(13, 17, 23, 0.4);
  border-bottom: 1px solid var(--line);
  font-size: 12px;
}
.security-panel.ok { border-left: 3px solid var(--ok); background: linear-gradient(90deg, rgba(16,185,129,.06), rgba(13,17,23,.3)); }
.security-panel.suspicious { border-left: 3px solid var(--warn); background: linear-gradient(90deg, rgba(245,158,11,.06), rgba(13,17,23,.3)); }
.security-panel.danger { border-left: 3px solid var(--danger); background: linear-gradient(90deg, rgba(239,68,68,.08), rgba(13,17,23,.3)); }

.security-panel-row {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
}
.security-panel .verdict {
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  font-size: 10px;
  font-family: var(--f-d);
  padding: 3px 10px;
  border-radius: 100px;
  background: var(--glass-2);
}
.security-panel.ok .verdict { color: var(--ok); background: rgba(16,185,129,.15); }
.security-panel.suspicious .verdict { color: var(--warn); background: rgba(245,158,11,.15); }
.security-panel.danger .verdict { color: var(--danger); background: rgba(239,68,68,.15); }
.security-panel .auth-check {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  color: var(--ink-2);
  font-family: var(--f-d);
  letter-spacing: 0.05em;
}
.auth-check .pass { color: var(--ok); }
.auth-check .fail { color: var(--danger); }
.security-panel .reasoning {
  width: 100%;
  margin-top: 8px;
  color: var(--ink-2);
  font-style: italic;
  font-size: 11px;
  line-height: 1.5;
}

.preview-body {
  flex: 1;
  overflow-y: auto;
  padding: 24px 28px;
  font-size: 14px;
  line-height: 1.65;
  color: var(--ink);
}
.preview-body p { margin-bottom: 14px; }
.preview-body a {
  color: var(--acc);
  text-decoration: underline;
  word-break: break-all;
  text-decoration-color: rgba(0,209,178,.4);
  text-underline-offset: 3px;
}
.preview-body a:hover { text-decoration-color: var(--acc); }

.body-plain { white-space: pre-wrap; word-break: break-word; }
.body-plain.dangerous { filter: grayscale(0.3); opacity: 0.85; }
.body-html {
  word-break: break-word;
}
.body-html img { max-width: 100%; height: auto; border-radius: 8px; }
.body-html table { border-collapse: collapse; margin: 12px 0; }
.body-html td, .body-html th { padding: 6px 10px; border: 1px solid var(--line); }
.body-html blockquote {
  border-left: 3px solid var(--acc);
  padding-left: 14px;
  margin: 12px 0;
  color: var(--ink-2);
  font-style: italic;
}
.body-html pre, .body-html code {
  background: var(--glass-2);
  padding: 2px 6px;
  border-radius: 4px;
  font-family: monospace;
  font-size: 12px;
}
.body-html .remote-image-blocked {
  display: inline-block;
  padding: 12px 20px;
  background: var(--glass);
  border: 1px dashed var(--line-hover);
  border-radius: 8px;
  color: var(--ink-dim);
  font-size: 12px;
  margin: 8px 0;
}

.body-plain-toggle {
  margin-top: 24px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
  font-size: 11px;
  color: var(--ink-dim);
}
.body-plain-toggle summary {
  cursor: pointer;
  padding: 4px 0;
}
.body-plain-toggle pre {
  white-space: pre-wrap;
  font-family: monospace;
  font-size: 11px;
  color: var(--ink-2);
  padding: 12px;
  background: var(--glass);
  border-radius: 6px;
  margin-top: 8px;
}

.attachments-list {
  padding: 14px 28px;
  border-top: 1px solid var(--line);
  background: rgba(13, 17, 23, 0.4);
}
.attachments-list .att-header {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  color: var(--ink-dim);
  margin-bottom: 10px;
  font-family: var(--f-d);
}
.att-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  background: var(--glass);
  border: 1px solid var(--line);
  border-radius: var(--r);
  margin-bottom: 4px;
  font-size: 13px;
  transition: all 0.2s;
}
.att-item:hover { background: var(--glass-2); border-color: var(--line-hover); }
.att-item .icon { font-size: 20px; }
.att-item .filename { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.att-item .size { color: var(--ink-dim); font-size: 11px; font-family: var(--f-d); }
.att-item.blocked { border-color: var(--danger); color: var(--danger); }
.att-item.blocked .filename::after { content: " · ZABLOKOWANE"; color: var(--danger); font-size: 10px; letter-spacing: 0.1em; }

/* Link (downloadable) wygląda jak div */
a.att-item { text-decoration: none; color: inherit; }
a.att-item:hover { background: var(--glass-2); border-color: var(--acc); }

.att-verdict {
  font-size: 10px;
  padding: 2px 8px;
  border-radius: 100px;
  font-family: var(--f-d);
  letter-spacing: 0.05em;
  margin-left: auto;
  white-space: nowrap;
}
.att-verdict.clean { background: rgba(16,185,129,.14); color: var(--ok); border: 1px solid rgba(16,185,129,.3); }
.att-verdict.infected { background: rgba(239,68,68,.18); color: var(--danger); border: 1px solid var(--danger); font-weight: 700; }
.att-verdict.err { background: var(--glass-2); color: var(--ink-dim); border: 1px solid var(--line); }

/* Keyboard hint */
.kbd {
  display: inline-block;
  padding: 2px 6px;
  background: var(--glass-2);
  border: 1px solid var(--line);
  border-radius: 4px;
  font-size: 10px;
  color: var(--ink-2);
  font-family: 'Space Grotesk', monospace;
  font-weight: 500;
}

/* Toast */
.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: rgba(20, 26, 35, 0.95);
  backdrop-filter: blur(20px);
  border: 1px solid var(--line);
  padding: 14px 18px;
  border-radius: var(--r);
  color: var(--ink);
  font-size: 13px;
  box-shadow: 0 16px 48px rgba(0,0,0,.4);
  opacity: 0;
  transform: translateY(12px);
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  z-index: 100;
  max-width: 420px;
}
.toast.show { opacity: 1; transform: translateY(0); }
.toast.success { border-left: 3px solid var(--acc); }
.toast.error { border-left: 3px solid var(--danger); }

/* Mobile responsive */
@media (max-width: 900px) {
  .inbox-shell { grid-template-columns: 1fr; }
  .sidebar, .list-pane { display: none; }
  .sidebar.mobile-show, .list-pane.mobile-show { display: flex; }
}

/* Scrollbar */
::-webkit-scrollbar { width: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--line-hover); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--ink-dim); }
