:root {
  font-family: Inter, 'Segoe UI', sans-serif;
  color: #232735;
  background: #f5f6fa;
  --bg: #f5f6fa;
  --panel: #fff;
  --ink: #232735;
  --muted: #7a8093;
  --line: #ebedf3;
  --accent: #4256d6;
  --soft: #eef0ff;
  --hover: #f7f8fd;
  --danger: #b8324c;
  --shadow: 0 16px 60px #17214b14;
  color-scheme: light;
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
}
body.dark {
  --bg: #141720;
  --panel: #1d2230;
  --ink: #e8eaf4;
  --muted: #9da6bd;
  --line: #303749;
  --accent: #98a6ff;
  --soft: #2b3458;
  --hover: #252c3d;
  --danger: #ff91a5;
  color-scheme: dark;
  background: var(--bg);
  color: var(--ink);
}
button,
input,
textarea,
select {
  font: inherit;
}
button,
a {
  touch-action: manipulation;
}
button {
  cursor: pointer;
  border: 0;
  background: none;
  color: inherit;
  border-radius: 9px;
  padding: 9px 12px;
}
button:hover {
  background: var(--hover);
}
button:disabled {
  opacity: 0.5;
  cursor: default;
}
a {
  color: var(--accent);
}
button.primary {
  background: #4256d6;
  color: white;
  font-weight: 600;
}
button.primary:hover {
  background: #3548c2;
}
button.danger {
  color: var(--danger);
}
input,
textarea,
select {
  width: 100%;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--ink);
  border-radius: 9px;
  padding: 11px 13px;
  outline: none;
}
input:focus,
textarea:focus,
select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px #4256d618;
}
input[type='checkbox'] {
  width: 17px;
  height: 17px;
  accent-color: #4256d6;
}
label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  margin: 15px 0 7px;
}
label.inline {
  display: flex;
  gap: 10px;
  align-items: center;
  font-weight: 400;
}
h1,
h2,
h3,
p {
  margin-top: 0;
}
h1 {
  font-size: 26px;
  letter-spacing: -0.7px;
}
h2 {
  font-size: 21px;
  letter-spacing: -0.3px;
}
h3 {
  font-size: 15px;
}
.muted {
  color: var(--muted);
}
.small {
  font-size: 12px;
}
.row {
  display: flex;
  align-items: center;
  gap: 12px;
}
.between {
  justify-content: space-between;
}
.wrap {
  flex-wrap: wrap;
}
.spacer {
  flex: 1;
}
.icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  flex-shrink: 0;
}
.icon svg {
  width: 19px;
  height: 19px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.icon-button {
  padding: 9px;
  display: inline-flex;
  align-items: center;
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: Georgia, serif;
  font-size: 25px;
  letter-spacing: -0.6px;
  color: var(--accent);
  font-weight: bold;
}
.brand img {
  width: 35px;
  height: 35px;
}
.brand small {
  font-family: 'Segoe UI', sans-serif;
  font-size: 10px;
  letter-spacing: 2px;
  display: block;
  color: var(--muted);
  margin-top: 2px;
}
.shell {
  height: 100dvh;
  display: grid;
  grid-template-columns: 236px 1fr;
  grid-template-rows: 79px 1fr;
  overflow: hidden;
  padding: 0 22px 20px 0;
}
.topbar {
  grid-column: 1/-1;
  display: flex;
  align-items: center;
  padding: 0 6px 0 26px;
  gap: 25px;
}
.topbar .brand {
  width: 211px;
  flex-shrink: 0;
}
.search {
  max-width: 620px;
  flex: 1;
  display: flex;
  align-items: center;
  background: #eaeef5;
  padding: 0 16px;
  border-radius: 12px;
  color: var(--muted);
}
.dark .search {
  background: var(--panel);
}
.search input {
  background: transparent;
  border: none;
  box-shadow: none;
  padding: 13px;
}
.avatar {
  width: 36px;
  height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: #dddffc;
  color: #3d47a5;
  font-weight: 700;
  font-size: 12px;
  flex-shrink: 0;
}
.sidebar {
  padding: 9px 20px 14px 16px;
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: auto;
}
.compose-button {
  display: flex;
  gap: 12px;
  align-items: center;
  margin: 0 0 26px 4px;
  padding: 16px 22px !important;
  box-shadow: 0 5px 12px #4256d620;
}
.nav-item {
  display: flex;
  width: 100%;
  align-items: center;
  gap: 14px;
  padding: 11px 15px;
  text-align: left;
  font-size: 13px;
  margin: 2px 0;
  color: var(--muted);
}
.nav-item.active {
  background: #e6eafe;
  color: #3449c8;
  font-weight: 650;
}
.dark .nav-item.active {
  background: var(--soft);
  color: var(--accent);
}
.nav-item .count {
  margin-left: auto;
  font-size: 11px;
}
.nav-caption {
  font-size: 10px;
  letter-spacing: 1.7px;
  color: var(--muted);
  padding: 23px 15px 10px;
  font-weight: 700;
}
.dot {
  height: 8px;
  width: 8px;
  background: #8997ea;
  border-radius: 3px;
  display: inline-block;
}
.storage {
  margin-top: auto;
  padding: 26px 14px 0;
  font-size: 11px;
  color: var(--muted);
}
.meter {
  height: 5px;
  border-radius: 5px;
  background: var(--line);
  overflow: hidden;
  margin: 12px 0;
}
.meter span {
  display: block;
  height: 100%;
  background: #6879e4;
}
.main {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 16px;
  overflow: auto;
  min-width: 0;
  position: relative;
}
.main-heading {
  padding: 28px 28px 18px;
  display: flex;
  align-items: center;
  gap: 14px;
}
.main-heading h1 {
  margin: 0;
}
.pill {
  font-size: 10px;
  color: var(--accent);
  background: var(--soft);
  padding: 5px 8px;
  border-radius: 6px;
  font-weight: 600;
  white-space: nowrap;
}
.local-banner {
  font-size: 11px;
  color: var(--muted);
  padding: 10px 28px;
  border-bottom: 1px solid var(--line);
  background: var(--hover);
}
.toolbar {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 9px 24px;
  border-bottom: 1px solid var(--line);
  min-height: 52px;
}
.toolbar .small {
  margin-left: 8px;
}
.mail-row {
  display: grid;
  grid-template-columns: 22px 28px 38px 170px minmax(100px, 1fr) 76px;
  align-items: center;
  gap: 10px;
  padding: 17px 25px;
  border-bottom: 1px solid var(--line);
  font-size: 12px;
  cursor: pointer;
  min-height: 78px;
}
.mail-row:hover {
  background: var(--hover);
}
.mail-row.unread {
  background: color-mix(in srgb, var(--soft) 35%, var(--panel));
}
.mail-row.unread .sender,
.mail-row.unread .subject {
  font-weight: 650;
}
.mail-row.selected {
  background: var(--soft);
}
.mail-row .sender {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.mail-row .subject {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 13px;
  margin-bottom: 5px;
}
.mail-row .snippet {
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.mail-row .date {
  font-size: 11px;
  color: var(--muted);
  text-align: right;
}
.star {
  color: var(--muted);
  padding: 3px;
}
.star.on {
  color: #d99b23;
}
.empty {
  max-width: 430px;
  text-align: center;
  margin: 85px auto;
  padding: 25px;
}
.empty .empty-icon {
  width: 72px;
  height: 72px;
  background: var(--soft);
  color: var(--accent);
  border-radius: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 24px;
}
.empty .icon,
.empty svg {
  width: 30px;
  height: 30px;
}
.empty p {
  font-size: 13px;
  line-height: 1.8;
  color: var(--muted);
}
.content-pad {
  padding: 28px;
}
.message-head {
  padding: 28px;
  border-bottom: 1px solid var(--line);
}
.message-head h1 {
  line-height: 1.4;
}
.message-body {
  padding: 24px 28px;
}
.message-body iframe {
  width: 100%;
  min-height: 430px;
  border: none;
  background: white;
  border-radius: 8px;
}
.attachment {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  margin: 8px 8px 0 0;
  font-size: 12px;
  text-decoration: none;
}
.thread-item {
  display: block;
  width: 100%;
  text-align: left;
  border-bottom: 1px solid var(--line);
  padding: 15px;
}
.auth {
  min-height: 100dvh;
  display: grid;
  grid-template-columns: 1fr 1fr;
}
.auth-art {
  background: #1e2b75;
  color: white;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 64px;
  position: relative;
  overflow: hidden;
}
.auth-art:after {
  content: '';
  position: absolute;
  width: 600px;
  height: 600px;
  border: 1px solid #ffffff20;
  border-radius: 50%;
  right: -290px;
  bottom: -100px;
  box-shadow:
    0 0 0 70px #ffffff05,
    0 0 0 140px #ffffff05;
}
.auth-art .brand {
  color: white;
}
.auth-art h1 {
  font-family: Georgia, serif;
  font-size: 58px;
  line-height: 1.12;
  font-weight: 400;
  position: relative;
  z-index: 1;
  max-width: 440px;
}
.auth-art p {
  max-width: 350px;
  color: #c3cbee;
  line-height: 1.8;
  font-size: 14px;
}
.auth-panel {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 32px;
}
.auth-form {
  width: 100%;
  max-width: 370px;
}
.auth-form h2 {
  font-size: 28px;
}
.auth-form .primary {
  width: 100%;
  margin-top: 22px;
  padding: 13px;
}
.auth-form .qr {
  width: 210px;
  display: block;
  margin: 15px auto;
}
.auth-form code {
  display: block;
  word-break: break-all;
  background: var(--soft);
  padding: 10px;
  font-size: 12px;
}
.error {
  color: var(--danger);
  font-size: 13px;
  line-height: 1.6;
  margin-top: 12px;
}
.notice {
  background: var(--soft);
  padding: 14px;
  border-radius: 9px;
  font-size: 12px;
  line-height: 1.7;
  margin: 15px 0;
}
.modal-overlay {
  position: fixed;
  inset: 0;
  background: #11182b70;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  backdrop-filter: blur(4px);
  animation: overlayIn 0.18s ease-out forwards;
}
@keyframes overlayIn {
  from { opacity: 0; }
  to { opacity: 1; }
}
.modal {
  width: 680px;
  max-width: 100%;
  max-height: 92dvh;
  overflow: auto;
  background: var(--panel);
  border-radius: 16px;
  box-shadow: var(--shadow);
  animation: modalIn 0.22s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}
@keyframes modalIn {
  from {
    opacity: 0;
    transform: scale(0.95) translateY(6px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}
.modal header {
  padding: 20px 24px;
  border-bottom: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.modal header h2 {
  margin: 0;
  font-size: 17px;
}
.modal section {
  padding: 0 24px 24px;
}
.modal footer {
  padding: 16px 24px;
  border-top: 1px solid var(--line);
  display: flex;
  align-items: center;
  gap: 8px;
}
.compose-fields input,
.compose-fields select {
  border: 0;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
}
.compose-fields label {
  display: flex;
  align-items: center;
  margin: 0;
  font-weight: 400;
  color: var(--muted);
}
.compose-fields label span {
  width: 55px;
}
.editor {
  min-height: 220px;
  padding: 16px 0;
  outline: none;
  font-size: 14px;
  line-height: 1.7;
}
.editor:empty:before {
  content: 'Write your message…';
  color: var(--muted);
}
.formatbar {
  display: flex;
  gap: 2px;
  background: var(--hover);
  padding: 3px;
  border-radius: 8px;
}
.tabs {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
  margin-bottom: 24px;
  border-bottom: 1px solid var(--line);
  padding-bottom: 14px;
}
.tabs button {
  font-size: 12px;
}
.tabs button.active {
  background: var(--soft);
  color: var(--accent);
}
.cards {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin-bottom: 28px;
}
.card {
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: 12px;
}
.card strong {
  display: block;
  font-size: 30px;
  margin: 8px 0;
}
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}
.data-table th {
  text-align: left;
  color: var(--muted);
  font-size: 10px;
  letter-spacing: 0.8px;
  text-transform: uppercase;
  padding: 14px 10px;
  border-bottom: 1px solid var(--line);
}
.data-table td {
  padding: 16px 10px;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
  word-break: break-word;
}
.data-table td button {
  font-size: 11px;
}
.table-wrap {
  overflow: auto;
}
.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0 20px;
}
.settings-form {
  max-width: 700px;
}
.badge-good {
  color: #268461;
  background: #e7f5ee;
}
.badge-warn {
  color: #a16a20;
  background: #fff3de;
}
#toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translate(-50%, 16px);
  opacity: 0;
  pointer-events: none;
  background: #243153;
  color: white;
  padding: 12px 22px;
  border-radius: 12px;
  box-shadow: 0 10px 30px rgba(17, 24, 43, 0.28);
  font-size: 13.5px;
  font-weight: 500;
  z-index: 1000;
  transition: opacity 0.25s cubic-bezier(0.16, 1, 0.3, 1), transform 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  display: flex;
  align-items: center;
  gap: 8px;
}
#toast.show {
  opacity: 1;
  pointer-events: auto;
  transform: translate(-50%, 0);
}
#toast.error {
  background: #991b1b;
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.15);
}
#toast.success {
  background: #14532d;
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.15);
}
.mobile-only {
  display: none;
}
.loading {
  padding: 60px;
  color: var(--muted);
}
.full-logo {
  width: 230px;
  max-width: 100%;
  object-fit: contain;
  display: block;
  background: white;
  border-radius: 10px;
  padding: 12px;
  margin-bottom: 30px;
}
.skeleton {
  padding: 50px;
  text-align: center;
  color: var(--muted);
}
@media (max-width: 1100px) {
  .mail-row {
    grid-template-columns: 20px 24px 32px 120px minmax(100px, 1fr) 58px;
    gap: 8px;
  }
  .shell {
    grid-template-columns: 205px 1fr;
  }
  .topbar .brand {
    width: 180px;
  }
  .sidebar {
    padding-right: 12px;
  }
  .cards {
    grid-template-columns: 1fr 1fr;
  }
  .auth-art {
    padding: 40px;
  }
  .auth-art h1 {
    font-size: 44px;
  }
}
@media (max-width: 760px) {
  .shell {
    display: flex;
    flex-direction: column;
    padding: 0;
    height: 100dvh;
  }
  .topbar {
    height: 67px;
    padding: 10px 14px;
    gap: 8px;
    flex-shrink: 0;
  }
  .topbar .brand {
    font-size: 0;
    width: auto;
  }
  .brand small {
    display: none;
  }
  .topbar .brand img {
    width: 30px;
    height: 30px;
  }
  .search {
    border-radius: 9px;
  }
  .search input {
    padding: 10px;
    font-size: 12px;
  }
  .sidebar {
    display: none;
    position: absolute;
    z-index: 8;
    top: 67px;
    bottom: 0;
    width: 240px;
    background: var(--bg);
    box-shadow: var(--shadow);
  }
  .sidebar.open {
    display: flex;
  }
  .main {
    flex: 1;
    border-radius: 0;
    border-width: 1px 0 0;
  }
  .mobile-only {
    display: inline-flex;
  }
  .mail-row {
    grid-template-columns: 18px 28px 1fr 52px;
    padding: 15px 14px;
    gap: 8px;
    min-height: 92px;
  }
  .mail-row .avatar {
    display: none;
  }
  .mail-row .sender {
    grid-column: 3;
    grid-row: 1;
  }
  .mail-row .preview {
    grid-column: 3/5;
    grid-row: 2;
  }
  .mail-row .date {
    grid-column: 4;
    grid-row: 1;
  }
  .mail-row input {
    grid-row: 1/3;
  }
  .mail-row .star {
    grid-row: 1/3;
  }
  .mail-row .snippet {
    font-size: 11px;
  }
  .main-heading {
    padding: 24px 18px 12px;
  }
  .toolbar {
    padding: 8px 12px;
    flex-wrap: wrap;
  }
  .local-banner {
    padding: 9px 18px;
  }
  .content-pad,
  .message-body,
  .message-head {
    padding: 20px 16px;
  }
  .auth {
    display: block;
  }
  .auth-art {
    min-height: 210px;
    padding: 26px;
  }
  .auth-art h1 {
    font-size: 30px;
    margin: 30px 0 5px;
  }
  .auth-art p,
  .auth-art .small {
    display: none;
  }
  .auth-panel {
    padding: 32px 24px;
  }
  .modal-overlay {
    padding: 8px;
  }
  .modal {
    max-height: 97dvh;
  }
  .cards {
    grid-template-columns: 1fr;
  }
  .card {
    padding: 16px;
  }
  .form-grid {
    grid-template-columns: 1fr;
  }
  .data-table {
    min-width: 540px;
  }
  .topbar .profile-name {
    display: none;
  }
  .empty {
    margin: 45px auto;
  }
  .compose-button {
    margin-top: 12px;
  }
  .message-body iframe {
    min-height: 350px;
  }
}

.search {
  min-width: 0;
}
.search input {
  min-width: 0;
}
@media (max-width: 760px) {
  .topbar > .spacer {
    display: none;
  }
  .search {
    max-width: none;
  }
  .search > span.small {
    display: none;
  }
}
