:root {
  --font: "Plus Jakarta Sans", "Segoe UI", ui-sans-serif, sans-serif;
  --bg: #f3f4f6;
  --pane: #fff;
  --line: #e8ecf1;
  --text: #111827;
  --muted: #6b7280;
  --ink: #111827;
}
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; font-family: var(--font); background: var(--bg); color: var(--text); }
.hidden { display: none !important; }
body.dark {
  --bg: #0f1115; --pane: #171a21; --line: #262b36; --text: #e5e7eb; --muted: #9ca3af; --ink: #e5e7eb;
  background: var(--bg); color: var(--text);
}

.login-wrap {
  min-height: 100vh; display: grid; place-items: center; padding: 1.5rem;
  background: radial-gradient(ellipse 50% 40% at 50% 0%, rgba(17,24,39,.08), transparent), var(--bg);
}
.login-card {
  width: min(400px, 100%); background: var(--pane); border: 1px solid var(--line);
  border-radius: 18px; padding: 1.5rem; box-shadow: 0 12px 40px rgba(15,23,42,.08);
  display: flex; flex-direction: column; gap: .75rem;
}
.login-brand { font-size: 1.35rem; font-weight: 800; letter-spacing: -.02em; }
.login-sub { margin: 0; color: var(--muted); font-size: .85rem; }
.login-card label { display: flex; flex-direction: column; gap: .35rem; font-size: .78rem; font-weight: 600; color: var(--muted); }
.login-card input, .compose-dlg input, .compose-dlg textarea {
  border: 1px solid var(--line); border-radius: 12px; padding: .7rem .85rem; font: inherit; font-size: .9rem;
  background: var(--pane); color: var(--text);
}
.login-card button[type=submit], .compose {
  border: 0; background: #111827; color: #fff; font-weight: 700; font-size: .85rem;
  border-radius: 12px; padding: .7rem 1rem; cursor: pointer; font-family: inherit;
}
body.dark .login-card button[type=submit], body.dark .compose { background: #e5e7eb; color: #111827; }
.login-err { color: #dc2626; font-size: .8rem; min-height: 1.2em; margin: 0; }

.app {
  display: flex; gap: 12px; padding: 12px; height: 100vh; box-sizing: border-box; overflow: hidden;
}
.side, .list, .read, .suite-pane {
  background: var(--pane); border: 1px solid var(--line); border-radius: 18px;
  box-shadow: 0 10px 30px rgba(15,23,42,.05); display: flex; flex-direction: column; min-height: 0; overflow: hidden;
}
.side {
  width: 56px;
  flex: 0 0 56px;
  padding: 8px 4px 10px;
  align-items: stretch;
  overflow: visible;
  z-index: 30;
}
.side .brand {
  justify-content: center;
  padding: 4px;
  margin-bottom: 4px;
  background: transparent;
  border: 0;
}
.side .brand .mark {
  width: 30px;
  height: 30px;
  border-radius: 9px;
  font-size: .68rem;
}
.side .brand > div:last-child { display: none; }
.side .search { display: none; }
.side > .label {
  text-align: center;
  padding: 2px 0 4px;
  font-size: .52rem;
  letter-spacing: .08em;
}
.side .nav {
  overflow: visible;
  align-items: center;
  gap: 0;
  padding: 0;
  flex: 1 1 auto;
  min-height: 0;
  scrollbar-width: none;
}
.side .nav::-webkit-scrollbar { width: 0; height: 0; }
.side .app-btn {
  position: relative;
  justify-content: center;
  width: 40px;
  height: 30px;
  padding: 0;
  border-radius: 8px;
  gap: 0;
  background: transparent !important;
}
.side .app-btn:hover,
.side .app-btn.is-active {
  background: #f3f4f6 !important;
}
body.dark .side .app-btn:hover,
body.dark .side .app-btn.is-active {
  background: #252b38 !important;
}
/* Hide in-button title; floating tip is used instead (avoids overflow clipping) */
.side .app-btn .title {
  display: none !important;
}
.side .app-btn .badge {
  position: absolute;
  top: 0;
  right: 2px;
  z-index: 2;
  min-width: .9rem;
  height: .9rem;
  font-size: .55rem;
}
.side .app-btn .ico {
  width: 20px;
  height: 20px;
  min-width: 20px;
  border-radius: 0;
  background: transparent !important;
}
.side .app-btn .ico svg { width: 18px; height: 18px; }
.side .subs { display: none; }
.side .foot {
  align-items: center;
  gap: 6px;
  padding-top: 6px;
  margin-top: 4px;
}
.side .dark-row {
  flex-direction: column;
  gap: 4px;
  padding: 0;
  font-size: 0;
}
.side .dark-row::before {
  content: "Theme";
  font-size: .5rem;
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: #9ca3af;
}
.side .dark-row .switch {
  width: 32px;
  height: 18px;
}
.side .dark-row .switch span {
  width: 14px;
  height: 14px;
}
.side .dark-row .switch.is-on span { transform: translateX(14px); }
.side .profile {
  justify-content: center;
  padding: 2px;
  width: 36px;
  border: 0;
  background: transparent;
  position: relative;
}
.side .profile .av {
  width: 28px;
  height: 28px;
  font-size: .62rem;
}
.side .profile > div:last-child { display: none !important; }
.side .linkish {
  width: 40px;
  text-align: center;
  padding: 4px 0;
  font-size: 0;
  position: relative;
}
.side .linkish::after { display: none !important; }
.side .linkish::before {
  content: "⎋";
  font-size: .85rem;
  color: var(--muted);
}

/* Floating hover tip for icon rail (fixed, never clipped) */
.rs-app-tip {
  position: fixed;
  z-index: 9999;
  padding: 6px 10px;
  border-radius: 8px;
  background: #111827;
  color: #fff;
  font-size: .74rem;
  font-weight: 700;
  line-height: 1.2;
  white-space: nowrap;
  pointer-events: none;
  box-shadow: 0 8px 24px rgba(15, 23, 42, .22);
  opacity: 0;
  transform: translateY(-50%) translateX(-4px);
  transition: opacity .12s ease, transform .12s ease;
}
.rs-app-tip.is-on {
  opacity: 1;
  transform: translateY(-50%) translateX(0);
}
.rs-app-tip::before {
  content: "";
  position: absolute;
  left: -4px;
  top: 50%;
  width: 7px;
  height: 7px;
  background: #111827;
  transform: translateY(-50%) rotate(45deg);
}
body.dark .rs-app-tip,
body.dark .rs-app-tip::before { background: #e5e7eb; color: #111827; }
body.dark .rs-app-tip { color: #111827; }

.mail-cols {
  flex: 1 1 auto; min-width: 0; display: flex; gap: 12px; min-height: 0;
}
.list { width: 360px; flex: 0 0 360px; max-width: 38vw; }
.read { flex: 1 1 auto; min-width: 280px; }
.suite-pane { flex: 1 1 auto; min-width: 0; }
.app.is-suite .mail-cols { display: none; }
.app.is-suite .suite-pane {
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
}

.brand {
  display: flex; gap: 10px; align-items: center; padding: 10px 12px; border-radius: 14px;
  background: #f8fafc; border: 1px solid #eef2f7; margin-bottom: 12px; flex-shrink: 0;
}
body.dark .brand { background: #1f2430; border-color: #2a3140; }
.mark {
  width: 38px; height: 38px; border-radius: 11px; background: linear-gradient(145deg,#111827,#374151);
  color: #fff; display: grid; place-items: center; font-weight: 800; font-size: .8rem; flex-shrink: 0;
}
.brand strong { display: block; font-size: .9rem; font-weight: 800; }
.brand span { font-size: .7rem; color: var(--muted); }

.search {
  display: flex; height: 38px; padding: 0 12px; margin-bottom: 10px; border-radius: 12px;
  background: #f3f4f6; align-items: center; flex-shrink: 0;
}
body.dark .search { background: #1f2430; }
.search input { border: 0; outline: 0; background: transparent; width: 100%; font: inherit; font-size: .8rem; color: inherit; }
.label {
  font-size: .65rem; font-weight: 700; letter-spacing: .05em; text-transform: uppercase;
  color: #9ca3af; padding: 0 8px 6px; flex-shrink: 0;
}
.nav {
  flex: 1 1 auto; min-height: 0; overflow-y: auto; display: flex; flex-direction: column; gap: 2px;
  scrollbar-width: thin;
}
.nav::-webkit-scrollbar { width: 6px; }
.nav::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 999px; }

.app-btn {
  display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 11px;
  border: 0; background: transparent; color: inherit; font: inherit; font-size: .84rem; font-weight: 600;
  cursor: pointer; text-align: left; width: 100%;
}
.app-btn:hover { background: #f9fafb; }
body.dark .app-btn:hover { background: #252b38; }
.app-btn.is-active { background: #f3f4f6; font-weight: 700; }
body.dark .app-btn.is-active { background: #252b38; }
.ico {
  width: 28px; height: 28px; min-width: 28px; border-radius: 8px; display: grid; place-items: center;
}
.ico svg { width: 14px; height: 14px; stroke: currentColor; fill: none; stroke-width: 1.85; stroke-linecap: round; stroke-linejoin: round; }
.ico.c-mail { background: #fee2e2; color: #dc2626; }
.ico.c-contacts { background: #dbeafe; color: #2563eb; }
.ico.c-calendar { background: #ffedd5; color: #ea580c; }
.ico.c-tasks { background: #dcfce7; color: #16a34a; }
.ico.c-reminders { background: #fef3c7; color: #d97706; }
.ico.c-cloud { background: #e0f2fe; color: #0284c7; }
.ico.c-shared-space { background: #ede9fe; color: #7c3aed; }
.ico.c-crm, .ico.c-rscrm { background: #fce7f3; color: #db2777; }
.ico.c-office, .ico.c-docs { background: #e0e7ff; color: #4f46e5; }
.ico.c-notes { background: #fef9c3; color: #ca8a04; }
.ico.c-whiteboard { background: #f3e8ff; color: #9333ea; }
.ico.c-meet, .ico.c-video { background: #cffafe; color: #0891b2; }
.ico.c-voice { background: #ecfeff; color: #06b6d4; }
.ico.c-vault { background: #ecfccb; color: #65a30d; }
.ico.c-billing { background: #ffedd5; color: #c2410c; }
.ico.c-analytics, .ico.c-seller { background: #dbeafe; color: #1d4ed8; }
.ico.c-support, .ico.c-desk { background: #ffe4e6; color: #e11d48; }
.ico.c-user { background: #e0f2fe; color: #0369a1; }
.ico.c-hr { background: #fce7f3; color: #be185d; }
.ico.c-projects { background: #e0e7ff; color: #4338ca; }
.ico.c-accounting { background: #d1fae5; color: #047857; }
.ico.c-admin { background: #e2e8f0; color: #334155; }
.ico.c-chat, .ico.c-talk { background: #ccfbf1; color: #0f766e; }
.ico.c-groups { background: #ede9fe; color: #6d28d9; }
.ico.c-files { background: #e0f2fe; color: #0369a1; }
.ico.c-ai { background: #f3e8ff; color: #7c3aed; }
.ico.c-remote-pc { background: #cffafe; color: #0e7490; }
.ico.c-gaming-flow { background: #ffedd5; color: #ea580c; }
.ico.c-backup { background: #ecfccb; color: #4d7c0f; }
.ico.c-default { background: #e0e7ff; color: #4f46e5; }
.ico.c-folder { background: #f1f5f9; color: #475569; }
.title { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.badge {
  min-width: 1.2rem; height: 1.2rem; padding: 0 .32rem; border-radius: 999px; background: #ef4444;
  color: #fff; font-size: .65rem; font-weight: 800; display: inline-grid; place-items: center;
}
.subs { margin: 2px 0 8px 38px; display: flex; flex-direction: column; gap: 1px; }
.subs button {
  border: 0; background: transparent; text-align: left; padding: 5px 10px; border-radius: 8px;
  font-size: .76rem; font-weight: 550; color: var(--muted); cursor: pointer; font-family: inherit;
}
.subs button:hover, .subs button.is-active { background: #f3f4f6; color: var(--text); }
body.dark .subs button.is-active { background: #252b38; }

.foot { flex-shrink: 0; border-top: 1px solid var(--line); padding-top: 10px; margin-top: 8px; display: flex; flex-direction: column; gap: 8px; }
.dark-row { display: flex; align-items: center; justify-content: space-between; padding: 4px 8px; font-size: .78rem; font-weight: 600; }
.switch {
  width: 38px; height: 21px; border-radius: 999px; border: 0; background: #e5e7eb; position: relative; cursor: pointer; padding: 0;
}
.switch.is-on { background: #111827; }
body.dark .switch.is-on { background: #e5e7eb; }
.switch span {
  position: absolute; top: 2px; left: 2px; width: 17px; height: 17px; border-radius: 50%; background: #fff; transition: transform .15s;
}
.switch.is-on span { transform: translateX(17px); }
.profile {
  display: flex; gap: 10px; align-items: center; padding: 10px; border-radius: 14px;
  background: #f8fafc; border: 1px solid #eef2f7;
}
body.dark .profile { background: #1f2430; border-color: #2a3140; }
.av {
  width: 34px; height: 34px; border-radius: 999px; background: linear-gradient(145deg,#f97316,#ea580c);
  color: #fff; display: grid; place-items: center; font-weight: 800; font-size: .72rem;
}
.pname { font-weight: 700; font-size: .8rem; }
.pmail { font-size: .68rem; color: var(--muted); overflow: hidden; text-overflow: ellipsis; }
.linkish {
  border: 0; background: transparent; color: var(--muted); font: inherit; font-size: .75rem; font-weight: 600;
  cursor: pointer; text-align: left; padding: 4px 8px;
}

.list-head {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 12px;
  padding: 16px; border-bottom: 1px solid var(--line); flex-shrink: 0;
}
.list-head h2 { margin: 0; font-size: 1.4rem; font-weight: 800; letter-spacing: -.02em; }
.list-head p { margin: 4px 0 0; font-size: .78rem; color: var(--muted); }
.msgs { flex: 1 1 auto; min-height: 0; overflow-y: auto; scrollbar-width: thin; }
.msg {
  display: grid; grid-template-columns: 40px 1fr auto; gap: 10px; padding: 12px 14px;
  border-bottom: 1px solid var(--line); cursor: pointer; align-items: start;
}
.msg:hover { background: #f9fafb; }
body.dark .msg:hover { background: #252b38; }
.msg.is-active { background: #f3f4f6; }
body.dark .msg.is-active { background: #252b38; }
.msg.is-unread .msub { font-weight: 800; }
.logo {
  width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; color: #fff;
  font-weight: 800; font-size: .72rem;
}
.mfrom { font-size: .82rem; font-weight: 700; }
.msub { font-size: .8rem; margin-top: 2px; }
.mprev { font-size: .72rem; color: var(--muted); margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mdate { font-size: .68rem; color: #9ca3af; white-space: nowrap; }
.empty, .loading { padding: 2rem 1.25rem; color: var(--muted); font-size: .85rem; text-align: center; }

.read-head { padding: 16px 20px; border-bottom: 1px solid var(--line); flex-shrink: 0; }
.read-head h1 { margin: 0 0 10px; font-size: 1.35rem; font-weight: 800; letter-spacing: -.02em; }
.meta { font-size: .8rem; color: var(--muted); line-height: 1.5; }
.body { flex: 1 1 auto; min-height: 0; overflow: auto; padding: 20px; font-size: .92rem; line-height: 1.6; }
.body img { max-width: 100%; height: auto; }
.atts { padding: 12px 20px 20px; border-top: 1px solid var(--line); flex-shrink: 0; }
.att {
  display: flex; gap: 10px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 12px;
  margin-top: 8px; font-size: .8rem;
}

.compose-dlg {
  border: 0; border-radius: 18px; padding: 0; width: min(520px, 92vw);
  box-shadow: 0 20px 50px rgba(15,23,42,.2); background: var(--pane); color: var(--text);
}
.compose-dlg::backdrop { background: rgba(15,23,42,.4); }
.compose-dlg form { display: flex; flex-direction: column; gap: .65rem; padding: 1.25rem; }
.compose-dlg h3 { margin: 0; font-size: 1.1rem; font-weight: 800; }
.compose-dlg label { display: flex; flex-direction: column; gap: .3rem; font-size: .75rem; font-weight: 600; color: var(--muted); }
.compose-actions { display: flex; gap: .75rem; align-items: center; }

/* Live suite apps (contacts / calendar / tasks) */
.suite-head {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 12px;
  padding: 16px 18px; border-bottom: 1px solid var(--line); flex-shrink: 0;
}
.suite-head h2 { margin: 0; font-size: 1.35rem; font-weight: 800; letter-spacing: -.02em; }
.suite-head p { margin: 4px 0 0; font-size: .78rem; color: var(--muted); }
.suite-body { flex: 1 1 auto; min-height: 0; overflow: auto; padding: 16px 18px; }
.suite-body.suite-frame-wrap { padding: 0; overflow: hidden; display: flex; }
.suite-frame {
  flex: 1 1 auto; width: 100%; min-height: 0; border: 0; background: #fff;
}
.suite-split { display: grid; grid-template-columns: minmax(240px, 320px) 1fr; gap: 14px; height: 100%; min-height: 0; }
.suite-card {
  border: 1px solid var(--line); border-radius: 14px; padding: 12px 14px; background: var(--pane);
  cursor: pointer; transition: border-color .15s, box-shadow .15s;
}
.suite-card:hover { border-color: #cbd5e1; box-shadow: 0 6px 18px rgba(15,23,42,.06); }
.suite-card.is-active { border-color: #94a3b8; background: #f8fafc; }
body.dark .suite-card.is-active { background: #1f2430; border-color: #475569; }
.suite-form { display: flex; flex-direction: column; gap: .65rem; }
.suite-form label { display: flex; flex-direction: column; gap: .3rem; font-size: .75rem; font-weight: 600; color: var(--muted); }
.suite-form input, .suite-form textarea, .suite-form select {
  border: 1px solid var(--line); border-radius: 12px; padding: .65rem .8rem; font: inherit; font-size: .88rem;
  background: var(--pane); color: var(--text);
}
.suite-actions { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; }
.btn-ghost {
  border: 1px solid var(--line); background: transparent; color: var(--text); border-radius: 10px;
  padding: .55rem .85rem; font: inherit; font-size: .8rem; font-weight: 650; cursor: pointer;
}
.btn-danger { border-color: #fecaca; color: #dc2626; }
.cal-grid {
  display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px;
}
.cal-dow { font-size: .68rem; font-weight: 700; color: var(--muted); text-align: center; padding: 4px; }
.cal-day {
  min-height: 84px; border: 1px solid var(--line); border-radius: 12px; padding: 6px; background: #fafafa;
  display: flex; flex-direction: column; gap: 3px;
}
body.dark .cal-day { background: #1a1f29; }
.cal-day.muted { opacity: .45; }
.cal-day.today { border-color: #f97316; box-shadow: inset 0 0 0 1px rgba(249,115,22,.25); }
.cal-day .n { font-size: .72rem; font-weight: 750; }
.cal-pill {
  font-size: .62rem; font-weight: 700; padding: 2px 5px; border-radius: 6px;
  background: #ffedd5; color: #c2410c; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.task-row {
  display: grid; grid-template-columns: 28px 1fr auto; gap: 10px; align-items: start;
  padding: 12px 14px; border: 1px solid var(--line); border-radius: 14px; margin-bottom: 8px;
}
.task-row.done { opacity: .55; }
.task-row.done .ttitle { text-decoration: line-through; }
.pri {
  font-size: .65rem; font-weight: 800; text-transform: uppercase; letter-spacing: .04em;
  padding: 2px 7px; border-radius: 999px;
}
.pri.high { background: #fee2e2; color: #dc2626; }
.pri.medium { background: #fef3c7; color: #d97706; }
.pri.low { background: #dcfce7; color: #16a34a; }
.contact-av {
  width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center;
  color: #fff; font-weight: 800; font-size: .75rem; flex-shrink: 0; object-fit: cover;
}
.contact-av.img { padding: 0; background: #e5e7eb; }
.contact-row { display: flex; gap: 12px; align-items: center; }
.ctag {
  display: inline-block; margin-top: 4px; font-size: .62rem; font-weight: 750;
  padding: 2px 7px; border-radius: 999px; background: #eef2ff; color: #4338ca;
}
.contact-toolbar {
  display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 12px;
}
.contact-toolbar input[type=search] {
  flex: 1; min-width: 160px; border: 1px solid var(--line); border-radius: 12px;
  padding: .55rem .8rem; font: inherit; font-size: .85rem; background: var(--pane); color: var(--text);
}
.check.tiny { font-size: .75rem; font-weight: 600; color: var(--muted); display: flex; gap: 6px; align-items: center; }
.check { font-size: .8rem; font-weight: 600; color: var(--muted); display: flex; gap: 8px; align-items: center; }
.csec {
  border: 1px solid var(--line); border-radius: 14px; margin-bottom: 10px; overflow: hidden; background: var(--pane);
}
.csec > summary {
  list-style: none; cursor: pointer; padding: 10px 12px; font-size: .8rem; font-weight: 750;
  background: #f8fafc; border-bottom: 1px solid transparent;
}
body.dark .csec > summary { background: #1f2430; }
.csec[open] > summary { border-bottom-color: var(--line); }
.csec > summary::-webkit-details-marker { display: none; }
.csec-body { padding: 12px; display: flex; flex-direction: column; gap: .65rem; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: .65rem; }
.rep-row { display: grid; grid-template-columns: 1fr 110px 36px; gap: 6px; align-items: center; }
.rep-row input, .rep-row select {
  border: 1px solid var(--line); border-radius: 10px; padding: .55rem .7rem; font: inherit; font-size: .85rem;
  background: var(--pane); color: var(--text);
}
.avatar-row { display: flex; gap: 12px; align-items: center; }
.avatar-preview {
  width: 72px; height: 72px; border-radius: 14px; object-fit: cover; border: 1px solid var(--line);
  display: grid; place-items: center; font-size: .65rem; font-weight: 700; color: var(--muted); background: #f8fafc;
}
.avatar-preview.placeholder { text-align: center; padding: 8px; }
.dropzone {
  border: 1.5px dashed #cbd5e1; border-radius: 14px; padding: 22px; text-align: center;
  font-size: .85rem; color: var(--muted); background: #fafafa;
}
body.dark .dropzone { background: #1a1f29; border-color: #334155; }
.dropzone.drag { border-color: #f97316; background: #fff7ed; }
.map-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.map-grid label { font-size: .72rem; }
.map-grid select {
  margin-top: 4px; width: 100%; border: 1px solid var(--line); border-radius: 10px;
  padding: .45rem .55rem; font: inherit; background: var(--pane); color: var(--text);
}
.csv-preview { margin-top: 10px; font-size: .75rem; }
.csv-preview pre {
  margin: 6px 0 0; padding: 8px; border-radius: 10px; background: #f8fafc; overflow: auto;
  border: 1px solid var(--line); white-space: pre-wrap;
}
body.dark .csv-preview pre { background: #1a1f29; }
.add-contact-btn {
  display: inline-grid; place-items: center; width: 22px; height: 22px; margin-left: 6px;
  border: 0; border-radius: 7px; background: #dbeafe; color: #2563eb; font-weight: 800;
  cursor: pointer; vertical-align: middle; font-size: .85rem; line-height: 1;
}
.add-contact-btn:hover { background: #2563eb; color: #fff; }
.from-text { cursor: default; border-bottom: 1px dotted transparent; }
.from-text:hover { border-bottom-color: var(--muted); }
.hover-card {
  position: fixed; z-index: 80; width: 240px; padding: 12px; border-radius: 14px;
  background: var(--pane); border: 1px solid var(--line); box-shadow: 0 16px 40px rgba(15,23,42,.18);
  display: flex; flex-direction: column; gap: 8px;
}
.hover-card .hc-email { font-size: .75rem; color: var(--muted); word-break: break-all; }
.ctx-menu {
  position: fixed; z-index: 90; min-width: 180px; background: var(--pane); border: 1px solid var(--line);
  border-radius: 12px; box-shadow: 0 12px 30px rgba(15,23,42,.16); padding: 4px; overflow: hidden;
}
.ctx-menu button {
  display: block; width: 100%; text-align: left; border: 0; background: transparent;
  padding: 10px 12px; font: inherit; font-size: .82rem; font-weight: 650; cursor: pointer; color: var(--text);
  border-radius: 8px;
}
.ctx-menu button:hover { background: #f3f4f6; }
body.dark .ctx-menu button:hover { background: #252b38; }
.rs-toast {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%) translateY(20px);
  background: #111827; color: #fff; padding: 10px 16px; border-radius: 999px; font-size: .8rem; font-weight: 700;
  opacity: 0; pointer-events: none; transition: .2s; z-index: 100;
}
.rs-toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
body.dark .rs-toast { background: #e5e7eb; color: #111827; }

.notes-area {
  width: 100%; min-height: 360px; border: 1px solid var(--line); border-radius: 14px;
  padding: 14px; font: inherit; font-size: .92rem; line-height: 1.55; resize: vertical;
  background: var(--pane); color: var(--text);
}

/* Calendar suite */
.cal-page .cal-shell {
  display: grid;
  grid-template-columns: 240px minmax(0, 1fr) 300px;
  gap: 12px;
  align-items: stretch;
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
}
.cal-rail, .cal-editor {
  max-height: 100%;
  overflow: auto;
  scrollbar-width: thin;
  -webkit-overflow-scrolling: touch;
}
.cal-main {
  min-height: 0;
  max-height: 100%;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.cal-main .cal-views { flex-shrink: 0; }
.fc-root {
  flex: 1 1 auto;
  min-height: 360px;
  height: 100%;
  overflow: auto;
  scrollbar-width: thin;
  -webkit-overflow-scrolling: touch;
}
.fc-root .fc {
  height: 100%;
}
.fc .fc-scroller,
.fc .fc-scroller-liquid-absolute {
  overflow: auto !important;
  scrollbar-width: thin;
}
.cal-views { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }
.cal-view-btn {
  border: 1px solid #e5e7eb; background: #fff; border-radius: 999px; padding: .4rem .75rem;
  font: inherit; font-size: .75rem; font-weight: 700; cursor: pointer; color: #374151;
}
.cal-view-btn.on { background: #2563eb; border-color: #2563eb; color: #fff; }
body.dark .cal-view-btn { background: #171a21; border-color: #2a3140; color: var(--text); }
.cal-cal-row {
  display: flex; align-items: center; gap: 8px; font-size: .8rem; font-weight: 600;
  padding: 4px 0; cursor: pointer;
}
.swatch { width: 12px; height: 12px; border-radius: 4px; flex-shrink: 0; }
.fc .fc-toolbar-title { font-size: 1.1rem !important; font-weight: 800; }
.fc .fc-button { border-radius: 8px !important; font-weight: 700 !important; }
.fc-event { border-radius: 6px !important; font-weight: 650 !important; border: 0 !important; }
.cal-remind { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; font-size: .78rem; }
.cal-book { font-size: .75rem; }
.ics-rsvp {
  margin: 0 20px 12px; padding: 10px 12px; border-radius: 12px; background: #eff6ff;
  border: 1px solid #bfdbfe; display: flex; flex-wrap: wrap; gap: 8px; align-items: center;
  font-size: .82rem;
}
body.dark .ics-rsvp { background: #1e293b; border-color: #334155; }
.add-contact-btn.cal { background: #ffedd5; color: #ea580c; }
.cal-side {
  width: 220px; flex: 0 0 220px; padding: 12px; position: relative; align-self: stretch;
  max-height: 100%; overflow: auto;
}
.cal-side.collapsed { width: 36px; flex-basis: 36px; padding: 8px 4px; }
.cal-side.collapsed #calSidePanel { display: none; }
.cal-side-toggle {
  position: absolute; top: 8px; right: 8px; border: 0; background: #f3f4f6; border-radius: 8px;
  width: 28px; height: 28px; cursor: pointer; font-size: .9rem;
}
.cal-mini-head { font-size: .78rem; font-weight: 800; margin-bottom: 8px; padding-right: 28px; }
.cal-mini-ev {
  border-left: 4px solid #2563eb; padding: 8px 10px; margin-bottom: 8px;
  background: #f8fafc; border-radius: 0 10px 10px 0; font-size: .75rem;
}
.cal-mini-ev strong { display: block; font-size: .8rem; margin-bottom: 2px; }
body.dark .cal-mini-ev { background: #1a1f29; }

@media (max-width: 1200px) {
  .cal-page .cal-shell { grid-template-columns: 200px minmax(0, 1fr); }
  .cal-editor { grid-column: 1 / -1; }
  .cal-side { display: none; }
}

/* Tasks suite */
.tasks-page .tasks-shell {
  display: grid; grid-template-columns: 230px minmax(0, 1fr) 300px; gap: 12px; align-items: start;
}
.tasks-rail, .tasks-editor { max-height: calc(100vh - 140px); overflow: auto; }
.smart-btn, .list-btn {
  display: flex; align-items: center; gap: 8px; width: 100%; text-align: left;
  border: 0; background: transparent; border-radius: 10px; padding: .45rem .55rem;
  font: inherit; font-size: .8rem; font-weight: 650; cursor: pointer; color: var(--text);
}
.smart-btn:hover, .list-btn:hover { background: #f3f4f6; }
.smart-btn.on, .list-btn.on { background: #eff6ff; color: #1d4ed8; }
.smart-btn.overdue.on { background: #fef2f2; color: #b91c1c; }
.list-btn em { margin-left: auto; font-style: normal; color: var(--muted); font-size: .72rem; }
.tasks-modes { display: flex; gap: 6px; flex-wrap: wrap; }
.tasks-list-head { font-size: .85rem; margin-bottom: 10px; color: var(--muted); }
.task-card {
  display: grid; grid-template-columns: 18px 18px minmax(0,1fr) auto auto; gap: 8px; align-items: start;
  padding: 10px 12px; border: 1px solid #e5e7eb; border-radius: 12px; margin-bottom: 8px;
  background: #fff; cursor: pointer;
}
body.dark .task-card { background: #171a21; border-color: #2a3140; }
.task-card.done { opacity: .55; }
.task-card.done .ttitle { text-decoration: line-through; }
.task-card.overdue-task { border-color: #fecaca; background: #fff7f7; }
body.dark .task-card.overdue-task { background: #2a1515; border-color: #7f1d1d; }
.drag-h { color: #9ca3af; cursor: grab; font-size: .75rem; line-height: 1.4; user-select: none; }
.ttitle { font-weight: 750; font-size: .88rem; }
.tmeta { font-size: .72rem; color: var(--muted); margin-top: 2px; }
.tsubs { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 6px; }
.chip { font-size: .68rem; background: #f3f4f6; border-radius: 999px; padding: .15rem .45rem; }
.chip.done { text-decoration: line-through; opacity: .6; }
.stars { color: #ca8a04; font-size: .75rem; white-space: nowrap; }
.kanban { display: grid; grid-template-columns: repeat(4, minmax(180px, 1fr)); gap: 10px; overflow-x: auto; }
.kanban-col { background: #f8fafc; border-radius: 14px; padding: 10px; min-height: 360px; }
body.dark .kanban-col { background: #12151c; }
.kanban-head { font-weight: 800; font-size: .8rem; margin-bottom: 8px; display: flex; justify-content: space-between; }
.kanban-head em { font-style: normal; color: var(--muted); }
.kanban-body { min-height: 80px; }
.sub-row { display: flex; gap: 8px; align-items: center; font-size: .8rem; margin: 4px 0; }
.add-contact-btn.task { background: #dcfce7; color: #16a34a; }
.add-contact-btn.flag { background: #fef3c7; color: #d97706; }
.add-contact-btn.snooze { background: #e0e7ff; color: #4338ca; }
.add-contact-btn.follow { background: #fce7f3; color: #db2777; }
.check { display: flex; gap: 8px; align-items: center; font-size: .78rem; margin: 6px 0; cursor: pointer; }
.compose-noreply { margin: 10px 0; flex-wrap: wrap; }
.compose-noreply select { margin-left: 4px; border-radius: 8px; border: 1px solid var(--line); padding: .25rem .4rem; font: inherit; }

/* Reminders suite */
.rem-page .rem-shell {
  display: grid; grid-template-columns: 260px minmax(0, 1fr) 280px; gap: 12px; align-items: start;
}
.rem-rail, .rem-editor { max-height: calc(100vh - 140px); overflow: auto; }
.rem-list-head { font-size: .85rem; color: var(--muted); margin-bottom: 10px; }
.rem-card {
  border: 1px solid #e5e7eb; border-radius: 12px; padding: 10px 12px; margin-bottom: 8px;
  background: #fff; cursor: pointer;
}
body.dark .rem-card { background: #171a21; border-color: #2a3140; }
.rem-card.done { opacity: .55; }
.rem-kind {
  display: inline-block; font-size: .65rem; font-weight: 800; text-transform: uppercase;
  letter-spacing: .04em; color: #d97706; background: #fef3c7; border-radius: 6px; padding: .1rem .4rem; margin-bottom: 4px;
}
.preset-chip {
  font-size: .75rem; padding: .35rem .55rem; border-radius: 8px; background: #f3f4f6; margin-bottom: 6px;
}
body.dark .preset-chip { background: #1a1f29; }

.rem-modal {
  position: fixed; inset: 0; z-index: 80; display: flex; align-items: center; justify-content: center;
  background: rgba(15, 23, 42, .45); padding: 16px;
}
.rem-modal.hidden { display: none; }
.rem-modal-card {
  width: min(420px, 100%); background: #fff; border-radius: 18px; padding: 22px;
  box-shadow: 0 20px 60px rgba(0,0,0,.2);
}
body.dark .rem-modal-card { background: #171a21; color: var(--text); }
.rem-modal-badge {
  display: inline-block; font-size: .7rem; font-weight: 800; color: #b45309; background: #fef3c7;
  border-radius: 999px; padding: .2rem .6rem; margin-bottom: 8px;
}
.rem-modal-card h3 { margin: 0 0 8px; font-size: 1.15rem; }
.rem-modal-card p { margin: 0 0 16px; color: var(--muted); font-size: .9rem; white-space: pre-wrap; }
.rem-modal-actions { display: flex; flex-wrap: wrap; gap: 8px; }

.rem-sticky {
  position: fixed; right: 20px; bottom: 20px; z-index: 60; width: 52px; height: 52px;
  border: 0; border-radius: 16px; background: linear-gradient(145deg, #f59e0b, #ea580c);
  color: #fff; font-size: 1.35rem; cursor: pointer;
  box-shadow: 0 10px 28px rgba(234, 88, 12, .35);
}
.rem-sticky-panel {
  position: fixed; right: 20px; bottom: 84px; z-index: 61; width: 280px;
  background: #fff; border: 1px solid #e5e7eb; border-radius: 16px; padding: 14px;
  box-shadow: 0 16px 40px rgba(15,23,42,.12);
}
body.dark .rem-sticky-panel { background: #171a21; border-color: #2a3140; }
.rem-sticky-panel.hidden { display: none; }
.rem-sticky-presets { display: flex; gap: 6px; margin-top: 8px; }
.rem-sticky-presets button {
  flex: 1; border: 1px solid #e5e7eb; background: #f8fafc; border-radius: 8px;
  padding: .4rem; font: inherit; font-size: .72rem; font-weight: 700; cursor: pointer;
}

@media (max-width: 1200px) {
  .rem-page .rem-shell { grid-template-columns: 220px minmax(0, 1fr); }
  .rem-editor { grid-column: 1 / -1; }
}

@media (max-width: 1200px) {
  .tasks-page .tasks-shell { grid-template-columns: 200px minmax(0, 1fr); }
  .tasks-editor { grid-column: 1 / -1; }
  .kanban { grid-template-columns: repeat(2, minmax(160px, 1fr)); }
}

.contact-list-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 10px;
}
.crm-body { padding: 0 !important; overflow: auto; background: #f6f7f9; -webkit-overflow-scrolling: touch; }
body.dark .crm-body { background: #0f1115; }
.suite-body.crm-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
  scrollbar-width: thin;
}
.cal-scroll-host {
  padding: 0 !important;
  height: 100%;
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
}
.crm-page { padding: 18px 20px 28px; min-height: 100%; }
.cal-page {
  display: flex;
  flex-direction: column;
  min-height: min(100%, calc(100vh - 24px));
  height: auto;
  max-height: none;
  box-sizing: border-box;
  overflow: visible;
}
.cal-page .crm-top { flex-shrink: 0; }
.crm-top {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 16px;
  margin-bottom: 16px;
}
.crm-crumb { font-size: .72rem; color: var(--muted); font-weight: 600; margin-bottom: 4px; }
.crm-title { margin: 0; font-size: 1.45rem; font-weight: 800; letter-spacing: -.02em; color: #111827; }
body.dark .crm-title { color: var(--text); }
.crm-sub { margin: 4px 0 0; font-size: .8rem; color: var(--muted); }
.crm-top-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.crm-btn {
  border-radius: 10px; padding: .65rem 1rem; font: inherit; font-size: .82rem; font-weight: 700;
  cursor: pointer; border: 1px solid #e5e7eb; background: #fff; color: #111827;
}
.crm-btn.primary { background: #2563eb; border-color: #2563eb; color: #fff; }
.crm-btn.primary:hover { background: #1d4ed8; }
.crm-btn.ghost { background: #fff; }
.crm-btn.ghost:hover { background: #f9fafb; }
.crm-btn.ghost.danger { color: #dc2626; border-color: #fecaca; }
.crm-btn.sm { padding: .45rem .75rem; font-size: .75rem; display: inline-block; }
body.dark .crm-btn.ghost { background: #171a21; border-color: #2a3140; color: var(--text); }
.crm-layout {
  display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 14px; align-items: start;
}
.crm-card {
  background: #fff; border: 1px solid #e8ecf1; border-radius: 16px; padding: 18px;
  box-shadow: 0 1px 2px rgba(15,23,42,.04);
}
body.dark .crm-card { background: #171a21; border-color: #2a3140; }
.crm-card.side { padding: 14px; }
.crm-upload { display: flex; gap: 14px; align-items: center; margin-bottom: 18px; }
.crm-avatar {
  width: 72px; height: 72px; border-radius: 50%; object-fit: cover; flex-shrink: 0;
  border: 1px solid #e5e7eb; background: #f3f4f6;
}
.crm-avatar.placeholder { display: grid; place-items: center; color: #9ca3af; }
.crm-upload-title { font-size: .88rem; font-weight: 750; }
.crm-upload-hint { font-size: .72rem; color: var(--muted); margin: 4px 0 8px; }
.crm-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 12px 14px; margin-bottom: 12px;
}
.crm-field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 12px; }
.crm-grid .crm-field { margin-bottom: 0; }
.crm-label { font-size: .75rem; font-weight: 650; color: #4b5563; }
body.dark .crm-label { color: #9ca3af; }
.crm-input {
  width: 100%; border: 1px solid #e5e7eb; border-radius: 10px; padding: .7rem .85rem;
  font: inherit; font-size: .88rem; background: #fff; color: #111827; outline: none; box-sizing: border-box;
}
.crm-input:focus { border-color: #93c5fd; box-shadow: 0 0 0 3px rgba(37,99,235,.12); }
body.dark .crm-input { background: #0f1115; border-color: #2a3140; color: var(--text); }
.crm-phone { display: grid; grid-template-columns: 118px 1fr; gap: 8px; }
.crm-rte {
  border: 1px solid #e5e7eb; border-radius: 12px; overflow: hidden; background: #fff;
}
body.dark .crm-rte { border-color: #2a3140; background: #0f1115; }
.crm-rte-bar {
  display: flex; flex-wrap: wrap; gap: 10px; padding: 8px 10px; border-bottom: 1px solid #eef2f7;
  font-size: .75rem; color: #6b7280; background: #fafafa;
}
body.dark .crm-rte-bar { background: #1a1f29; border-color: #2a3140; }
.crm-rte .crm-input.rte {
  border: 0; border-radius: 0; box-shadow: none; resize: vertical; min-height: 110px;
}
.crm-side { display: flex; flex-direction: column; gap: 12px; }
.crm-side-title { font-size: .88rem; font-weight: 800; margin-bottom: 8px; }
.crm-link {
  border: 0; background: transparent; color: #2563eb; font: inherit; font-size: .78rem;
  font-weight: 700; cursor: pointer; padding: 4px 0; text-align: left;
}
.crm-link:hover { text-decoration: underline; }

@media (max-width: 1100px) {
  .list { width: 320px; flex-basis: 320px; }
  .suite-split { grid-template-columns: 1fr; }
  .crm-layout { grid-template-columns: 1fr; }
  .crm-grid { grid-template-columns: 1fr; }
}
@media (max-width: 860px) {
  .app { flex-direction: column; height: auto; min-height: 100vh; overflow: auto; }
  .side {
    width: 100%;
    max-width: none;
    flex: none;
    min-height: auto;
    flex-direction: row;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    overflow-x: auto;
  }
  .side .brand { margin: 0; }
  .side > .label { display: none; }
  .side .nav {
    flex-direction: row;
    flex: 1 1 auto;
    overflow-x: auto;
    overflow-y: hidden;
    min-height: 0;
  }
  .side .app-btn {
    width: 40px;
    height: 30px;
  }
  .side .app-btn .title {
    display: none !important;
  }
  .side .app-btn .title::before {
    display: none;
  }
  .side .app-btn:hover .title,
  .side .app-btn:focus-visible .title {
    opacity: 0;
  }
  .side .foot {
    flex-direction: row;
    border-top: 0;
    margin: 0;
    padding: 0;
    border-left: 1px solid var(--line);
    padding-left: 8px;
  }
  .side .dark-row::before,
  .side .profile > div:last-child,
  .side .linkish::after { display: none; }
  .list, .read, .suite-pane, .mail-cols { width: 100%; max-width: none; flex: none; min-height: 40vh; }
  .mail-cols { flex-direction: column; }
}

/* ── Mail UI (folders, threads, compose, settings) ───────────────────── */
:root {
  --mail-accent: #2563eb;
  --mail-accent-soft: #eff6ff;
}
.folders-pane {
  width: 200px; flex: 0 0 200px; background: var(--pane); border: 1px solid var(--line);
  border-radius: 18px; box-shadow: 0 10px 30px rgba(15,23,42,.05);
  display: flex; flex-direction: column; min-height: 0; overflow: hidden; padding: 10px 8px;
}
.folders-pane-head { flex-shrink: 0; padding: 4px 6px 8px; }
.folder-tree { flex: 1 1 auto; min-height: 0; overflow-y: auto; scrollbar-width: thin; }
.folder-tree-head {
  display: flex; align-items: center; justify-content: space-between;
  font-size: .65rem; font-weight: 700; letter-spacing: .05em; text-transform: uppercase;
  color: #9ca3af; padding: 4px 8px 8px;
}
.folder-add {
  width: 22px; height: 22px; border: 0; border-radius: 7px; background: var(--mail-accent-soft);
  color: var(--mail-accent); font-weight: 800; cursor: pointer; line-height: 1;
}
.folder-tree-list { display: flex; flex-direction: column; gap: 1px; }
.folder-item {
  display: flex; align-items: center; gap: 8px; width: 100%; text-align: left;
  border: 0; background: transparent; border-radius: 10px; padding: 7px 8px;
  font: inherit; font-size: .78rem; font-weight: 600; color: var(--text); cursor: pointer;
}
.folder-item:hover { background: #f9fafb; }
body.dark .folder-item:hover { background: #252b38; }
.folder-item.is-active { background: var(--mail-accent-soft); color: #1d4ed8; font-weight: 750; }
body.dark .folder-item.is-active { background: #1e293b; color: #93c5fd; }
.folder-ico {
  width: 28px; height: 28px; border-radius: 9px; flex-shrink: 0;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: .85rem;
}
.folder-ico svg { width: 15px; height: 15px; display: block; }
.folder-ico.fi-inbox { background: #dbeafe; color: #2563eb; }
.folder-ico.fi-sent { background: #ede9fe; color: #7c3aed; }
.folder-ico.fi-drafts { background: #fef3c7; color: #d97706; }
.folder-ico.fi-trash { background: #ffe4e6; color: #e11d48; }
.folder-ico.fi-junk { background: #ffedd5; color: #ea580c; }
.folder-ico.fi-archive { background: #ccfbf1; color: #0f766e; }
.folder-ico.fi-folder { background: #e2e8f0; color: #475569; }
.folder-ico.fi-label {
  background: color-mix(in srgb, var(--lc, #5b7cff) 16%, #fff);
  color: var(--lc, #5b7cff);
}
body.dark .folder-ico.fi-inbox { background: #1e3a5f; color: #93c5fd; }
body.dark .folder-ico.fi-sent { background: #2e1065; color: #c4b5fd; }
body.dark .folder-ico.fi-drafts { background: #422006; color: #fbbf24; }
body.dark .folder-ico.fi-trash { background: #4c0519; color: #fb7185; }
body.dark .folder-ico.fi-junk { background: #431407; color: #fb923c; }
body.dark .folder-ico.fi-archive { background: #134e4a; color: #5eead4; }
body.dark .folder-ico.fi-folder { background: #1e293b; color: #94a3b8; }
body.dark .folder-ico.fi-label {
  background: color-mix(in srgb, var(--lc, #5b7cff) 28%, #0f172a);
}
.folder-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.folder-badge {
  min-width: 1.1rem; height: 1.1rem; padding: 0 .3rem; border-radius: 999px;
  background: #ef4444; color: #fff; font-size: .62rem; font-weight: 800;
  display: inline-flex; align-items: center; justify-content: center;
}
.labels-section {
  margin-top: 14px; padding-top: 10px; border-top: 1px solid var(--line);
}
.label-dot {
  width: 8px; height: 8px; border-radius: 999px; flex-shrink: 0;
  box-shadow: 0 0 0 2px rgba(255,255,255,.8);
}
.label-create-dlg {
  position: fixed; inset: 0; z-index: 80; background: rgba(15,23,42,.35);
  display: flex; align-items: center; justify-content: center; padding: 16px;
}
.label-create-card {
  width: min(360px, 100%); background: var(--pane); border: 1px solid var(--line);
  border-radius: 16px; padding: 18px; box-shadow: 0 20px 50px rgba(15,23,42,.18);
}
.label-create-card h3 { margin: 0 0 12px; font-size: 1rem; }
.label-create-field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 12px; font-size: .78rem; font-weight: 650; color: var(--muted); }
.label-create-field input {
  border: 1px solid var(--line); border-radius: 10px; padding: 9px 11px;
  font: inherit; font-size: .85rem; color: var(--text); background: var(--bg, #fff);
}
.label-swatches { display: flex; flex-wrap: wrap; gap: 8px; }
.label-swatch {
  width: 26px; height: 26px; border-radius: 999px; border: 2px solid transparent;
  cursor: pointer; padding: 0;
}
.label-swatch.is-on { border-color: #0f172a; box-shadow: 0 0 0 2px #fff inset; }
body.dark .label-swatch.is-on { border-color: #e2e8f0; }
.label-create-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 4px; }
  display: inline-grid; place-items: center;
}
.folder-empty { padding: 12px; font-size: .75rem; color: var(--muted); text-align: center; }

.mail-search-row { padding: 0 14px 10px; flex-shrink: 0; }
.mail-search-row input {
  width: 100%; border: 1px solid var(--line); border-radius: 12px; padding: .55rem .85rem;
  font: inherit; font-size: .8rem; background: #f8fafc; color: var(--text); outline: none;
}
.mail-search-row input:focus { border-color: #93c5fd; box-shadow: 0 0 0 3px rgba(37,99,235,.12); background: var(--pane); }
body.dark .mail-search-row input { background: #1a1f29; }

.mail-toolbar {
  display: flex; flex-wrap: wrap; gap: 6px; padding: 0 14px 10px; flex-shrink: 0;
  border-bottom: 1px solid var(--line);
}
.btn-ghost.sm { padding: .35rem .65rem; font-size: .72rem; border-radius: 8px; }
.btn-ghost.sm.danger, .linkish.danger { color: #dc2626; }
.btn-ghost.danger { border-color: #fecaca; color: #dc2626; }

.msg-main { min-width: 0; }
.msg.is-unread .mfrom, .msg.is-unread .msub { font-weight: 800; }
.flag-dot { color: #ca8a04; margin-left: 6px; font-size: .75rem; }
.label-chips { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; }
.label-chip {
  font-size: .62rem; font-weight: 750; padding: 2px 7px; border-radius: 999px;
  background: #eff6ff; color: var(--lc, #2563eb); border: 1px solid #bfdbfe;
}
.thread-group { border-bottom: 1px solid var(--line); }
.thread-group .msg { border-bottom: 0; }
.thread-toggle {
  margin-left: 6px; border: 0; background: #e0e7ff; color: #3730a3; border-radius: 999px;
  font-size: .65rem; font-weight: 800; padding: 1px 6px; cursor: pointer; vertical-align: middle;
}
.thread-children { padding: 0 14px 8px 54px; display: flex; flex-direction: column; gap: 2px; }
.thread-child {
  display: grid; grid-template-columns: 1fr 1.4fr auto; gap: 8px; align-items: center;
  border: 0; background: #f8fafc; border-radius: 10px; padding: 7px 10px; text-align: left;
  font: inherit; font-size: .72rem; cursor: pointer; color: var(--text);
}
body.dark .thread-child { background: #1a1f29; }
.thread-child.is-unread { font-weight: 750; }
.thread-child.is-active { background: var(--mail-accent-soft); }
.tc-from { font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tc-sub, .tc-date { color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.read-toolbar {
  display: flex; flex-wrap: wrap; gap: 6px; align-items: center;
  padding: 10px 16px; border-bottom: 1px solid var(--line); flex-shrink: 0;
}
.tb-sep { width: 1px; height: 18px; background: var(--line); margin: 0 2px; }
.read-labels { margin-bottom: 8px; }
.mail-body { word-break: break-word; }
.atts .att {
  display: flex; gap: 10px; width: 100%; text-align: left; cursor: pointer;
  border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; margin-top: 8px;
  background: var(--pane); color: inherit; font: inherit; font-size: .8rem;
}
.atts .att:hover { border-color: #93c5fd; background: var(--mail-accent-soft); }
.label-picker {
  position: absolute; right: 20px; top: 56px; z-index: 20; width: 220px;
  background: var(--pane); border: 1px solid var(--line); border-radius: 14px;
  box-shadow: 0 16px 40px rgba(15,23,42,.16); padding: 12px;
}
.read { position: relative; }
.label-picker-head { font-size: .78rem; font-weight: 800; margin-bottom: 8px; }
.label-pick-row {
  display: flex; align-items: center; gap: 8px; font-size: .78rem; font-weight: 600;
  padding: 4px 0; cursor: pointer;
}
.label-pick-row .swatch { width: 12px; height: 12px; border-radius: 4px; flex-shrink: 0; }

.compose-dlg-wide { width: min(640px, 94vw); }
.compose-dlg select {
  border: 1px solid var(--line); border-radius: 12px; padding: .65rem .8rem;
  font: inherit; font-size: .88rem; background: var(--pane); color: var(--text);
}
.compose-tools-row {
  display: flex; flex-wrap: wrap; gap: 10px; align-items: center;
}
.compose-tools-row select { flex: 1; min-width: 140px; }
.sched-label {
  display: flex; flex-direction: column; gap: .25rem; font-size: .72rem; font-weight: 650; color: var(--muted);
}
.sched-label input { font-size: .8rem !important; }
.editor-wrap {
  border: 1px solid var(--line); border-radius: 14px; overflow: hidden; background: var(--pane);
}
.editor-toolbar {
  display: flex; flex-wrap: wrap; gap: 4px; padding: 6px 8px; border-bottom: 1px solid var(--line);
  background: #f8fafc;
}
body.dark .editor-toolbar { background: #1a1f29; }
.editor-toolbar button {
  border: 0; background: transparent; border-radius: 8px; padding: .35rem .55rem;
  font: inherit; font-size: .78rem; font-weight: 700; cursor: pointer; color: var(--text);
}
.editor-toolbar button:hover { background: #e5e7eb; }
body.dark .editor-toolbar button:hover { background: #252b38; }
.compose-editor {
  min-height: 200px; max-height: 360px; overflow: auto; padding: 12px 14px;
  font: inherit; font-size: .9rem; line-height: 1.55; outline: none;
}
.compose-editor .rs-quote {
  margin: 8px 0 0; padding: 8px 12px; border-left: 3px solid #93c5fd;
  color: var(--muted); background: #f8fafc;
}
body.dark .compose-editor .rs-quote { background: #1a1f29; }
.compose-sig-note, .compose-draft-status {
  margin: 0; font-size: .72rem; color: var(--muted); min-height: 1em;
}
.compose.sm { padding: .4rem .75rem; font-size: .75rem; border-radius: 10px; }

.undo-toast {
  position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%);
  z-index: 120; display: flex; align-items: center; gap: 14px;
  background: #111827; color: #fff; padding: 12px 16px; border-radius: 14px;
  box-shadow: 0 16px 40px rgba(15,23,42,.28); font-size: .85rem; font-weight: 650;
}
body.dark .undo-toast { background: #e5e7eb; color: #111827; }

.mail-settings .settings-tabs {
  display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 14px;
}
.settings-tab {
  border: 1px solid var(--line); background: var(--pane); border-radius: 999px;
  padding: .4rem .75rem; font: inherit; font-size: .75rem; font-weight: 700;
  cursor: pointer; color: var(--muted);
}
.settings-tab.is-active { background: var(--mail-accent); border-color: var(--mail-accent); color: #fff; }
.settings-panel { max-width: 720px; }
.settings-list { display: flex; flex-direction: column; gap: 8px; margin-bottom: 16px; }
.settings-card {
  border: 1px solid var(--line); border-radius: 14px; padding: 12px 14px; background: var(--pane);
}
.settings-form {
  display: flex; flex-direction: column; gap: .65rem;
  border: 1px solid var(--line); border-radius: 14px; padding: 14px; background: #f8fafc;
}
body.dark .settings-form { background: #1a1f29; }
.settings-form h4 { margin: 0 0 4px; font-size: .9rem; font-weight: 800; }
.settings-form label {
  display: flex; flex-direction: column; gap: .3rem; font-size: .75rem; font-weight: 600; color: var(--muted);
}
.settings-form input, .settings-form textarea, .settings-form select {
  border: 1px solid var(--line); border-radius: 12px; padding: .65rem .8rem;
  font: inherit; font-size: .88rem; background: var(--pane); color: var(--text);
}
.muted { color: var(--muted); }
.muted.small, .small { font-size: .75rem; }
.quota-bar {
  height: 10px; border-radius: 999px; background: #e5e7eb; overflow: hidden; margin: 8px 0;
}
body.dark .quota-bar { background: #2a3140; }
.quota-fill {
  height: 100%; border-radius: 999px; background: linear-gradient(90deg, #2563eb, #0ea5e9);
  transition: width .25s ease;
}
.alias-list { margin: 0; padding-left: 1.1rem; font-size: .85rem; }
.dns-grid { display: flex; flex-direction: column; gap: 8px; }
.dns-row {
  display: grid; grid-template-columns: 64px 1fr; gap: 10px; align-items: start;
  font-size: .78rem; padding: 8px 10px; border: 1px solid var(--line); border-radius: 10px;
}
.dns-row code { word-break: break-all; color: var(--muted); font-size: .72rem; }

/* ── Enterprise UI ───────────────────────────────────────────────────── */
.rs-ent-nav {
  margin-top: auto; padding: 10px 6px 4px; border-top: 1px solid var(--line);
  display: flex; flex-direction: column; gap: 2px;
}
.rs-ent-nav-label {
  font-size: .65rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase;
  color: var(--muted); padding: 4px 8px 6px;
}
.rs-ent-nav-btn {
  border: 0; background: transparent; text-align: left; font: inherit; font-size: .78rem;
  font-weight: 600; color: var(--text); padding: .4rem .65rem; border-radius: 8px; cursor: pointer;
}
.rs-ent-nav-btn:hover { background: var(--mail-accent-soft); color: #1d4ed8; }
.when-tz, .cal-tz, .cal-mini-when {
  font-variant-numeric: tabular-nums;
}
.cal-tz {
  font-size: .68rem; font-weight: 650; color: var(--muted); letter-spacing: 0;
  text-transform: none; margin-left: 2px;
}
.cal-mini-when { font-size: .72rem; color: var(--muted); margin-top: 2px; }
.rs-smart-chip[data-draft] { border-style: dashed; }

.rs-priority-tabs {
  display: flex; gap: 4px; padding: 0 14px 8px; flex-wrap: wrap;
}
.rs-pri-tab {
  border: 1px solid var(--line); background: var(--pane); color: var(--muted);
  font: inherit; font-size: .72rem; font-weight: 650; padding: .28rem .65rem;
  border-radius: 8px; cursor: pointer;
}
.rs-pri-tab.is-active {
  background: #0A7CFF; border-color: #0A7CFF; color: #fff;
}
body.dark .rs-pri-tab.is-active { background: #1d4ed8; border-color: #1d4ed8; }

.rs-auth-badges { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 8px; }
.rs-auth-pill {
  font-size: .65rem; font-weight: 700; letter-spacing: .02em;
  padding: .18rem .45rem; border-radius: 6px; border: 1px solid transparent;
}
.rs-auth-pill.pass { background: #ecfdf5; color: #047857; border-color: #a7f3d0; }
.rs-auth-pill.warn { background: #fffbeb; color: #b45309; border-color: #fde68a; }
.rs-auth-pill.fail { background: #fef2f2; color: #b91c1c; border-color: #fecaca; }
body.dark .rs-auth-pill.pass { background: #064e3b; color: #6ee7b7; border-color: #065f46; }
body.dark .rs-auth-pill.warn { background: #78350f; color: #fcd34d; border-color: #92400e; }
body.dark .rs-auth-pill.fail { background: #7f1d1d; color: #fca5a5; border-color: #991b1b; }

.rs-priority-chip {
  display: inline-block; margin-left: 8px; vertical-align: middle;
  font-size: .68rem; font-weight: 750; padding: .15rem .5rem; border-radius: 6px;
  background: #eff6ff; color: #1d4ed8; border: 1px solid #bfdbfe;
}
body.dark .rs-priority-chip { background: #1e3a8a; color: #93c5fd; border-color: #1d4ed8; }

.rs-smart-replies {
  display: flex; flex-wrap: wrap; align-items: center; gap: 6px;
  padding: 8px 20px; border-bottom: 1px solid var(--line);
}
.rs-smart-label { font-size: .72rem; font-weight: 700; color: var(--muted); margin-right: 4px; }
.rs-smart-chip {
  border: 1px solid #bfdbfe; background: #eff6ff; color: #1d4ed8;
  font: inherit; font-size: .72rem; font-weight: 650; padding: .3rem .7rem;
  border-radius: 999px; cursor: pointer;
}
.rs-smart-chip:hover { background: #0A7CFF; border-color: #0A7CFF; color: #fff; }
body.dark .rs-smart-chip { background: #1e3a8a; border-color: #1d4ed8; color: #93c5fd; }

.rs-team-notes {
  border-top: 1px solid var(--line); padding: 12px 16px 16px; background: #f8fafc;
  max-height: 280px; overflow: auto; flex-shrink: 0;
}
body.dark .rs-team-notes { background: #12151c; }
.rs-team-notes-head {
  display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px;
}
.rs-comments { display: flex; flex-direction: column; gap: 8px; margin-bottom: 10px; }
.rs-comment {
  padding: 8px 10px; border: 1px solid var(--line); border-radius: 10px; background: var(--pane);
}
.rs-comment strong { font-size: .78rem; margin-right: 6px; }
.rs-comment p { margin: 4px 0 0; font-size: .82rem; white-space: pre-wrap; }
.rs-comment-form { display: flex; flex-direction: column; gap: 6px; }
.rs-comment-form textarea {
  border: 1px solid var(--line); border-radius: 10px; padding: .55rem .7rem;
  font: inherit; font-size: .82rem; resize: vertical; background: var(--pane); color: var(--text);
}
.rs-claim-row { margin-top: 10px; display: flex; flex-direction: column; gap: 6px; }
.rs-claim-item {
  display: flex; align-items: center; gap: 8px; font-size: .78rem; flex-wrap: wrap;
}

.compose-ent-row {
  display: flex; flex-wrap: wrap; gap: 10px 14px; align-items: center;
  padding: 4px 0 8px; font-size: .78rem;
}
.rs-tone-label, .rs-secure-attach {
  display: flex; align-items: center; gap: 6px; font-weight: 600; color: var(--muted);
}
.rs-tone-label select, .rs-days-input {
  border: 1px solid var(--line); border-radius: 8px; padding: .35rem .5rem;
  font: inherit; font-size: .78rem; background: var(--pane); color: var(--text);
}
.rs-days-input { width: 3.2rem; }
.rs-att-view { margin-left: 6px; }

.rs-ent-modal {
  border: 1px solid var(--line); border-radius: 16px; padding: 0; width: min(560px, 92vw);
  background: var(--pane); color: var(--text); box-shadow: 0 20px 50px rgba(15,23,42,.18);
}
.rs-ent-modal::backdrop { background: rgba(15, 23, 42, .35); }
.rs-ent-modal-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 16px; border-bottom: 1px solid var(--line);
}
.rs-ent-modal-head h3 { margin: 0; font-size: 1rem; font-weight: 800; }
.rs-ent-modal-body { padding: 14px 16px 18px; max-height: 70vh; overflow: auto; }
.rs-ent-modal-body h4 { margin: 12px 0 6px; font-size: .85rem; color: #1d4ed8; }
.rs-ent-modal-body ul { margin: 0; padding-left: 1.1rem; font-size: .85rem; }
.rs-viewer-frame {
  width: 100%; height: min(60vh, 480px); border: 1px solid var(--line); border-radius: 10px; margin-top: 8px;
}

.rs-ent-suite { padding: 16px 20px 24px; overflow: auto; }
.rs-ent-suite h4 { margin: 18px 0 8px; font-size: .9rem; }
.rs-ent-list { display: flex; flex-direction: column; gap: 8px; margin-bottom: 12px; }
.rs-ent-card {
  border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; background: var(--pane);
}
.rs-ent-card-actions { display: flex; gap: 8px; margin-top: 8px; }

.rs-analytics { max-width: 720px; }
.rs-an-stat {
  display: inline-flex; flex-direction: column; gap: 2px; margin: 0 16px 14px 0;
  min-width: 100px;
}
.rs-an-stat strong { font-size: 1.25rem; font-weight: 800; color: #0A7CFF; }
.rs-bars { display: flex; flex-direction: column; gap: 6px; margin-bottom: 18px; }
.rs-bar-row {
  display: grid; grid-template-columns: 110px 1fr 40px; gap: 8px; align-items: center;
  font-size: .75rem;
}
.rs-bar-row span {
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--muted); font-weight: 600;
}
.rs-bar {
  height: 10px; border-radius: 999px; background: #e5e7eb; overflow: hidden;
}
body.dark .rs-bar { background: #2a3140; }
.rs-bar i {
  display: block; height: 100%; border-radius: 999px;
  background: linear-gradient(90deg, #0A7CFF, #1d4ed8);
}
.rs-bar-row em { font-style: normal; font-weight: 700; text-align: right; }

.rs-legal-card {
  max-width: 520px; border: 1px solid var(--line); border-radius: 14px; padding: 16px 18px;
}
.rs-legal-grid {
  display: grid;
  gap: 14px;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  align-items: start;
}
.rs-legal-grid .rs-legal-card { max-width: none; }
.rs-legal-status {
  font-weight: 800; font-size: 1rem; margin-bottom: 8px;
}
.rs-legal-status.on { color: #b45309; }
.rs-legal-status.off { color: #047857; }
.rs-legal-note {
  margin-top: 12px; padding: 10px 12px; border-radius: 10px;
  background: #fffbeb; border: 1px solid #fde68a;
}
body.dark .rs-legal-note { background: #451a03; border-color: #92400e; }
.rs-legal-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
/* Enterprise inbox chrome */
.ent-inbox-chrome {
  display: flex; flex-wrap: wrap; gap: 8px 14px; align-items: center;
  padding: 6px 14px 10px; border-bottom: 1px solid var(--line);
}
.ent-cat-tabs { display: flex; gap: 4px; flex-wrap: wrap; }
.ent-cat-tab {
  border: 0; background: transparent; padding: 6px 12px; border-radius: 999px;
  font: 650 0.82rem var(--font); color: var(--muted); cursor: pointer;
}
.ent-cat-tab.is-active { background: var(--mail-accent-soft, #dbeafe); color: #1d4ed8; }
.ent-layout-controls { display: flex; gap: 10px; align-items: center; margin-left: auto; flex-wrap: wrap; }
.ent-ctrl { font-size: 0.78rem; color: var(--muted); display: flex; gap: 6px; align-items: center; }
.ent-ctrl select { font-size: 0.78rem; border: 1px solid var(--line); border-radius: 8px; padding: 4px 6px; }
.ent-offline-pill {
  font-size: 0.72rem; font-weight: 700; padding: 3px 8px; border-radius: 999px;
  background: #ecfdf5; color: #047857;
}
.ent-offline-pill.is-offline { background: #fff7ed; color: #c2410c; }
.msg.ent-msg { position: relative; }
.ent-hover-actions {
  display: none; position: absolute; right: 10px; top: 50%; transform: translateY(-50%);
  gap: 4px; background: rgba(255,255,255,0.96); border: 1px solid var(--line);
  border-radius: 10px; padding: 4px; box-shadow: 0 4px 14px rgba(15,23,42,0.08); z-index: 3;
}
.msg.ent-msg:hover .ent-hover-actions { display: flex; }
.ent-hover-actions button {
  border: 0; background: #f3f4f6; border-radius: 8px; padding: 4px 8px;
  font-size: 0.72rem; font-weight: 700; cursor: pointer;
}
.ent-hover-actions button:hover { background: #e5e7eb; }
.ent-nudge {
  grid-column: 1 / -1; font-size: 0.75rem; color: #b45309; font-weight: 650;
  padding: 0 12px 6px 56px;
}
body.density-comfortable .msg { padding-top: 14px; padding-bottom: 14px; }
body.density-compact .msg { padding-top: 6px; padding-bottom: 6px; }
body.density-compact .mprev, body.density-compact .label-chips { display: none; }
body.density-default .msg .att-chip {
  display: inline-block; margin-left: 6px; font-size: 0.7rem; padding: 1px 6px;
  border-radius: 6px; background: #eef2ff; color: #4338ca;
}
#mailCols.split-vertical { flex-direction: row; }
#mailCols.split-horizontal { flex-direction: column; }
#mailCols.split-horizontal .list, #mailCols.split-horizontal .read {
  width: 100%; max-width: none; flex: 1 1 42%; min-height: 280px;
}
#mailCols.split-none .read { display: none; }
#mailCols.split-none .list { flex: 1 1 auto; max-width: none; }
.ent-sec-banner, .ent-unsub-banner {
  margin: 8px 14px; padding: 10px 12px; border-radius: 10px; font-size: 0.85rem; line-height: 1.4;
}
.ent-sec-banner.warn { background: #fef2f2; border: 1px solid #fecaca; color: #991b1b; font-weight: 650; }
.ent-sec-banner.ok { background: #ecfdf5; border: 1px solid #a7f3d0; color: #065f46; }
.ent-unsub-banner {
  background: #eff6ff; border: 1px solid #bfdbfe; color: #1e40af;
  display: flex; gap: 10px; align-items: center; flex-wrap: wrap;
}
.ent-compose-hint { margin-top: 4px; }
.ent-compose-ghost { min-height: 1.1em; color: #94a3b8; font-size: 0.85rem; margin-top: 2px; }
.ent-conf-toggle { display: flex; gap: 8px; align-items: center; font-size: 0.85rem; margin: 8px 0; }
.rs-edi-form { display: flex; flex-direction: column; gap: 8px; margin: 10px 0; }
.rs-edi-form input { padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; }
.rs-edi-row { display: flex; gap: 8px; }
.rs-edi-row input { flex: 1; }
.rs-edi-export { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.rs-arch-row, .rs-audit-row {
  display: flex; flex-direction: column; gap: 2px;
  padding: 8px 0; border-bottom: 1px solid var(--line); font-size: 0.88rem;
}
.rs-arch-row { flex-direction: row; flex-wrap: wrap; align-items: center; gap: 8px; }
.rs-arch-row span:first-of-type { flex: 1; min-width: 140px; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 0.78rem; }

@media (max-width: 1200px) {
  .folders-pane { width: 168px; flex-basis: 168px; }
}
@media (max-width: 960px) {
  .folders-pane { width: 100%; flex: none; max-height: 220px; }
}
