:root {
  --bg: #f6f8fc;
  --surface: #ffffff;
  --line: #d9dfea;
  --line-soft: #e8edf7;
  --text: #202124;
  --muted: #5f6368;
  --brand: #0b57d0;
  --brand-soft: #d3e3fd;
  --danger: #c5221f;
  --row-hover: #f1f5fe;
  --row-active: #dce8ff;
  --row-unread: #ecf2ff;
  --shadow: 0 1px 2px rgba(60, 64, 67, 0.18), 0 1px 3px rgba(60, 64, 67, 0.1);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  font-family: "Google Sans", "Avenir Next", "Segoe UI", sans-serif;
  color: var(--text);
  background: radial-gradient(circle at top left, #eff4ff 0%, rgba(239, 244, 255, 0) 44%), var(--bg);
}

body.modal-open {
  overflow: hidden;
}

h2,
p {
  margin: 0;
}

.icon-sprite {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
}

.icon {
  width: 1em;
  height: 1em;
  display: inline-block;
  vertical-align: middle;
}

.icon-14 {
  font-size: 14px;
}

.icon-16 {
  font-size: 16px;
}

.icon-18 {
  font-size: 18px;
}

.icon-20 {
  font-size: 20px;
}

.icon-24 {
  font-size: 24px;
}

.mail-shell {
  width: 100%;
  min-height: 100vh;
  padding: 0;
}

.hidden {
  display: none !important;
}

input,
textarea,
button {
  font: inherit;
}

input,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  color: var(--text);
  background: #fff;
}

input:focus,
textarea:focus {
  outline: none;
  border-color: #89b4ff;
  box-shadow: 0 0 0 3px rgba(11, 87, 208, 0.14);
}

textarea {
  resize: vertical;
}

label {
  font-size: 13px;
  color: var(--muted);
}

.muted {
  color: var(--muted);
}

.status {
  min-height: 18px;
  margin-top: 8px;
  font-size: 12px;
  color: var(--muted);
}

.btn {
  border: 0;
  border-radius: 999px;
  padding: 10px 16px;
  background: #e8f0fe;
  color: #174ea6;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-weight: 600;
  cursor: pointer;
}

.btn:hover {
  filter: brightness(0.98);
}

.btn-primary {
  background: var(--brand);
  color: #fff;
}

.btn-danger {
  background: #b3261e;
  color: #fff;
}

.btn-danger:hover {
  background: #8f1e17;
}

.icon-btn {
  width: 38px;
  height: 38px;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: #3f4144;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.icon-btn:hover {
  background: #e9eef7;
}

.icon-btn.danger:hover {
  background: #fce8e6;
  color: var(--danger);
}

.icon-btn.tiny {
  width: 30px;
  height: 30px;
}

.account-switch-wrap {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 6px;
  margin-top: 6px;
}

.account-switch-select {
  width: 100%;
  height: 38px;
  border-radius: 10px;
  padding: 0 10px;
  font-size: 13px;
}

.admin-switch-panel {
  margin-top: 10px;
  border: 1px dashed var(--line);
  border-radius: 12px;
  padding: 10px;
}

.admin-switch-panel .muted {
  font-size: 12px;
  margin-top: 2px;
}

.input-with-icon {
  position: relative;
}

.input-with-icon .icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: #6f7377;
}

.input-with-icon input {
  padding-left: 38px;
}

.password-field input {
  padding-right: 64px;
}

.password-toggle {
  position: absolute;
  top: 50%;
  right: 8px;
  transform: translateY(-50%);
  border: 0;
  background: transparent;
  color: #174ea6;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  border-radius: 8px;
  padding: 5px 8px;
}

.password-toggle:hover {
  background: #edf3fe;
}

.loading-view,
.auth-view {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 18px;
}

.loading-pane,
.auth-pane {
  width: min(500px, 100%);
  background: var(--surface);
  border: 1px solid var(--line-soft);
  border-radius: 18px;
  box-shadow: var(--shadow);
}

.loading-pane {
  display: grid;
  justify-items: center;
  gap: 12px;
  padding: 26px;
}

.loading-spinner {
  width: 56px;
  height: 56px;
  border: 3px solid #dbe7fd;
  border-top-color: var(--brand);
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--brand);
  animation: spin 0.9s linear infinite;
}

.loading-text {
  font-weight: 600;
  color: #4f5662;
}

@keyframes spin {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}

.auth-pane {
  padding: 20px;
}

.form-grid {
  display: grid;
  gap: 9px;
}

.form-grid h2 {
  font-size: 21px;
  margin-bottom: 2px;
}

.auth-actions {
  margin-top: 10px;
  display: flex;
}

.auth-actions .btn {
  width: 100%;
}

.client-view {
  min-height: 100vh;
  display: grid;
  grid-template-rows: auto 1fr;
}

.gmail-topbar {
  height: 64px;
  padding: 0 16px;
  display: grid;
  grid-template-columns: auto minmax(260px, 1fr) auto;
  align-items: center;
  gap: 16px;
}

.gmail-top-left,
.gmail-top-right {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.gmail-brand {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 16px;
  color: #1f1f1f;
}

.gmail-search {
  height: 48px;
  border-radius: 24px;
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 8px;
  padding: 0 14px;
  background: #eaf1fb;
  border: 1px solid transparent;
}

.gmail-search:focus-within {
  background: #fff;
  border-color: #c8d7f8;
  box-shadow: var(--shadow);
}

.gmail-search input {
  border: 0;
  background: transparent;
  padding: 0;
  box-shadow: none;
}

.gmail-search input:focus {
  box-shadow: none;
}

.account-chip {
  max-width: 280px;
  height: 36px;
  border-radius: 18px;
  border: 1px solid var(--line);
  background: #fff;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 0 12px;
  font-size: 13px;
  font-weight: 600;
}

.account-chip span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.gmail-layout {
  --sidebar-width: 248px;
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(0, var(--sidebar-width)) minmax(320px, 480px) minmax(380px, 1fr);
  gap: 12px;
  padding: 8px 12px 12px;
  align-items: stretch;
  transition: grid-template-columns 0.26s ease, gap 0.26s ease, padding 0.26s ease;
}

.gmail-sidebar,
.gmail-list-panel,
.gmail-reader-panel {
  min-height: 0;
  background: var(--surface);
  border: 1px solid var(--line-soft);
  border-radius: 18px;
}

.gmail-sidebar {
  padding: 12px;
  display: grid;
  align-content: start;
  gap: 12px;
  min-width: 0;
  overflow: hidden;
  transform: translateX(0);
  opacity: 1;
  visibility: visible;
  transform-origin: left center;
  transition: transform 0.24s ease, opacity 0.24s ease, visibility 0.24s ease;
}

.compose-open-btn {
  height: 54px;
  width: 100%;
  border: 0;
  border-radius: 16px;
  background: var(--brand-soft);
  color: #164184;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-weight: 600;
  cursor: pointer;
}

.admin-register-open-btn {
  min-height: 44px;
  width: 100%;
  border: 1px solid #c7d5f3;
  border-radius: 14px;
  background: #fff;
  color: #174ea6;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-weight: 700;
  cursor: pointer;
}

.admin-register-open-btn:hover {
  background: #f4f8ff;
}

.gmail-nav {
  display: grid;
  gap: 2px;
}

.gmail-nav-item {
  height: 36px;
  border: 0;
  background: transparent;
  border-radius: 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 12px;
  color: #1f1f1f;
  cursor: pointer;
  font-weight: 500;
}

.gmail-nav-item.active {
  background: #e8f0fe;
  color: #174ea6;
  font-weight: 700;
}

.gmail-nav-item:disabled {
  opacity: 0.55;
  cursor: default;
}

.mail-count {
  font-size: 12px;
}

.gmail-list-panel {
  display: grid;
  grid-template-rows: auto 1fr;
}

.list-toolbar {
  height: 52px;
  border-bottom: 1px solid var(--line-soft);
  padding: 0 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.toolbar-left {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.toolbar-right {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.toolbar-select-all {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: #5f6368;
}

.toolbar-select-all input {
  width: 14px;
  height: 14px;
}

.list-title {
  font-size: 14px;
  font-weight: 700;
}

.count-pill {
  border-radius: 999px;
  padding: 3px 10px;
  background: #eef3fd;
  font-size: 12px;
  color: #315f9f;
}

.gmail-message-list {
  list-style: none;
  margin: 0;
  padding: 0;
  overflow: auto;
}

.gmail-row {
  min-height: 46px;
  border-bottom: 1px solid #edf0f6;
  display: grid;
  grid-template-columns: 22px 22px minmax(110px, 180px) minmax(160px, 1fr) auto;
  align-items: center;
  gap: 8px;
  padding: 0 12px;
  cursor: pointer;
  transition: background 0.14s ease;
}

.gmail-row:hover {
  background: var(--row-hover);
}

.gmail-row.active {
  background: var(--row-active);
}

.gmail-row.unread {
  background: var(--row-unread);
  font-weight: 700;
}

.gmail-row.is-selected {
  background: #edf4ff;
}

.row-check {
  width: 16px;
  height: 16px;
  border: 2px solid #b3bcc8;
  border-radius: 3px;
}

.row-check-input {
  width: 16px;
  height: 16px;
  margin: 0;
  cursor: pointer;
}

.row-star {
  border: 0;
  background: transparent;
  color: #b0b5bf;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
}

.row-star.is-starred {
  color: #f9ab00;
}

.row-from {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 13px;
}

.row-summary {
  display: flex;
  min-width: 0;
  align-items: baseline;
  gap: 6px;
  font-size: 13px;
}

.row-subject,
.row-preview {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.row-preview {
  color: #6a7178;
  font-weight: 500;
}

.gmail-row.unread .row-preview {
  font-weight: 600;
  color: #4e5359;
}

.row-date {
  font-size: 12px;
  color: #6a7178;
  white-space: nowrap;
}

.gmail-reader-panel {
  display: grid;
  grid-template-rows: auto auto 1fr auto;
  gap: 0;
}

.reader-header {
  min-height: 54px;
  border-bottom: 1px solid var(--line-soft);
  padding: 0 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.reader-header h2 {
  min-width: 0;
  flex: 1;
  font-size: 20px;
  font-weight: 500;
  line-height: 1.3;
  overflow: hidden;
  text-overflow: ellipsis;
}

.detail-action-btn {
  height: 34px;
  border: 1px solid #c8d7f8;
  border-radius: 999px;
  background: #fff;
  color: #174ea6;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 0 12px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  flex: 0 0 auto;
}

.detail-action-btn:hover {
  background: #f4f8ff;
}

.detail-meta {
  display: grid;
  gap: 5px;
  padding: 14px 16px 12px;
  border-bottom: 1px solid var(--line-soft);
  font-size: 12px;
}

.detail-body {
  margin: 0;
  padding: 14px 16px;
  overflow: auto;
  white-space: pre-wrap;
  word-break: break-word;
}

.detail-attachments {
  min-height: 28px;
  padding: 8px 16px 14px;
  color: var(--muted);
  font-size: 12px;
  display: grid;
  gap: 10px;
}

.detail-attachments-title {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.detail-attachments-list {
  display: grid;
  gap: 8px;
}

.detail-attachment-item {
  min-height: 42px;
  border: 1px solid #e3e8f4;
  border-radius: 12px;
  background: #f8faff;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
}

.detail-attachment-main {
  min-width: 0;
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
}

.detail-attachment-actions {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.detail-attachment-action {
  min-width: 54px;
  height: 32px;
  border: 0;
  border-radius: 999px;
  background: #dbe8ff;
  color: #174ea6;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 12px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  transition: filter 0.18s ease, transform 0.18s ease;
}

.detail-attachment-action.secondary {
  background: #edf2fb;
  color: #355175;
}

.detail-attachment-action:hover {
  filter: brightness(0.98);
  transform: translateY(-1px);
}

.attachment-name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 600;
}

.attachment-meta {
  color: #61718b;
  font-size: 12px;
}

.attachment-preview-modal {
  position: fixed;
  inset: 0;
  z-index: 120;
  background: rgba(18, 25, 38, 0.54);
  display: grid;
  place-items: center;
  padding: 18px;
  backdrop-filter: blur(3px);
}

.admin-register-modal {
  position: fixed;
  inset: 0;
  z-index: 110;
  background: rgba(18, 25, 38, 0.42);
  display: grid;
  place-items: center;
  padding: 18px;
  backdrop-filter: blur(3px);
}

.admin-register-dialog {
  width: min(460px, 100%);
  border-radius: 18px;
  border: 1px solid rgba(220, 229, 244, 0.92);
  background: #fff;
  box-shadow: 0 24px 54px rgba(26, 33, 48, 0.22);
  overflow: hidden;
}

.admin-register-head {
  min-height: 58px;
  border-bottom: 1px solid #e6ebf6;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 0 12px 0 16px;
}

.admin-register-heading {
  min-width: 0;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: #25436f;
}

.admin-register-heading strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.admin-register-form {
  display: grid;
  gap: 9px;
  padding: 16px;
}

.mailbox-localpart-field {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  overflow: hidden;
}

.mailbox-localpart-field:focus-within {
  border-color: #89b4ff;
  box-shadow: 0 0 0 3px rgba(11, 87, 208, 0.14);
}

.mailbox-localpart-field input {
  border: 0;
  border-radius: 0;
  box-shadow: none;
}

.mailbox-localpart-field input:focus {
  box-shadow: none;
}

.mailbox-localpart-field span {
  padding: 0 12px;
  color: #61718b;
  font-size: 13px;
  white-space: nowrap;
}

.admin-register-actions {
  margin-top: 8px;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
}

.attachment-preview-dialog {
  width: min(920px, 100%);
  max-height: min(88vh, 860px);
  border-radius: 18px;
  border: 1px solid rgba(220, 229, 244, 0.9);
  background: #fff;
  box-shadow: 0 24px 54px rgba(26, 33, 48, 0.24);
  display: grid;
  grid-template-rows: auto 1fr;
  overflow: hidden;
}

.attachment-preview-head {
  min-height: 58px;
  border-bottom: 1px solid #e6ebf6;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 0 12px 0 16px;
}

.attachment-preview-heading {
  min-width: 0;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: #25436f;
}

.attachment-preview-heading strong {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.attachment-preview-body {
  min-height: 220px;
  padding: 18px;
  display: grid;
  place-items: center;
  background:
    radial-gradient(circle at top left, rgba(229, 238, 255, 0.8), rgba(229, 238, 255, 0) 40%),
    #f7faff;
}

.attachment-preview-image {
  max-width: 100%;
  max-height: min(72vh, 720px);
  object-fit: contain;
  border-radius: 14px;
  box-shadow: 0 18px 30px rgba(42, 56, 87, 0.14);
}

.attachment-preview-media {
  width: min(100%, 760px);
}

.attachment-preview-media.video {
  max-height: min(72vh, 720px);
  border-radius: 14px;
  background: #0f131a;
  box-shadow: 0 18px 30px rgba(42, 56, 87, 0.16);
}

.attachment-preview-media.audio {
  max-width: 680px;
}

.compose-attachments-bar {
  display: grid;
  gap: 8px;
  padding: 10px 12px;
  border-bottom: 1px solid #eef1f6;
}

.compose-attach-label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  width: fit-content;
  color: #174ea6;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}

#compose-attachments {
  border: 0;
  padding: 0;
  background: transparent;
  box-shadow: none;
  font-size: 12px;
  color: var(--muted);
}

#compose-attachments::file-selector-button {
  margin-right: 10px;
  border: 0;
  border-radius: 999px;
  padding: 8px 12px;
  background: #e8f0fe;
  color: #174ea6;
  font-weight: 600;
  cursor: pointer;
}

.compose-attachments-list {
  padding: 0 12px 10px;
  border-bottom: 1px solid #eef1f6;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.compose-attachment-chip {
  max-width: 100%;
  border-radius: 999px;
  background: #eff4ff;
  color: #274677;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 10px;
  font-size: 12px;
}

.compose-attachment-chip span {
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.compose-attachment-chip strong {
  color: #5d6c86;
  font-size: 11px;
}

.compose-attachment-remove {
  width: 24px;
  height: 24px;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: #4f6487;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex: 0 0 auto;
}

.compose-attachment-remove:hover {
  background: rgba(17, 77, 175, 0.1);
  color: #174ea6;
}

.compose-dock {
  position: fixed;
  right: 16px;
  bottom: 0;
  width: min(560px, calc(100vw - 24px));
  border-radius: 12px 12px 0 0;
  border: 1px solid #c7d5f3;
  background: #fff;
  box-shadow: 0 8px 26px rgba(60, 64, 67, 0.28);
  overflow: hidden;
  z-index: 60;
}

.compose-dock.minimized {
  height: auto;
}

.compose-dock.minimized .compose-form {
  display: none;
}

.compose-head {
  height: 44px;
  background: #eff3fb;
  border-bottom: 1px solid #dae4f7;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 10px 0 14px;
  font-size: 13px;
  font-weight: 700;
}

.compose-head-actions {
  display: inline-flex;
  align-items: center;
  gap: 2px;
}

.compose-form {
  display: grid;
}

.compose-reply-context {
  min-height: 34px;
  border-bottom: 1px solid #eef1f6;
  background: #f7faff;
  color: #315f9f;
  display: flex;
  align-items: center;
  padding: 8px 12px;
  font-size: 12px;
  font-weight: 700;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.compose-form input,
.compose-form textarea {
  border: 0;
  border-radius: 0;
  border-bottom: 1px solid #eef1f6;
  padding: 10px 12px;
  box-shadow: none;
}

.compose-form textarea {
  min-height: 180px;
  border-bottom: 0;
}

.compose-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px 12px;
}

.compose-foot .status {
  margin: 0;
  flex: 1;
  text-align: right;
}

.client-view.sidebar-collapsed .gmail-sidebar {
  transform: translateX(-18px);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.client-view.sidebar-collapsed .gmail-layout {
  --sidebar-width: 0px;
}

@media (max-width: 1360px) {
  .gmail-layout {
    --sidebar-width: 232px;
    grid-template-columns: minmax(0, var(--sidebar-width)) minmax(290px, 420px) minmax(320px, 1fr);
  }

  .gmail-row {
    grid-template-columns: 20px 20px minmax(100px, 150px) minmax(140px, 1fr) auto;
  }
}

@media (max-width: 1120px) {
  .gmail-layout {
    --sidebar-width: 220px;
    grid-template-columns: minmax(0, var(--sidebar-width)) minmax(0, 1fr);
  }

  .gmail-reader-panel {
    grid-column: 1 / -1;
    min-height: 340px;
  }
}

@media (max-width: 900px) {
  .gmail-topbar {
    height: auto;
    padding: 10px 10px 8px;
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .gmail-top-left,
  .gmail-top-right {
    justify-content: space-between;
  }

  .gmail-layout {
    --sidebar-width: 0px;
    grid-template-columns: 1fr;
    gap: 8px;
    padding: 8px;
    transition: padding 0.22s ease, gap 0.22s ease;
  }

  .gmail-sidebar {
    position: fixed;
    top: 130px;
    left: 8px;
    bottom: 8px;
    width: min(300px, calc(100vw - 16px));
    z-index: 80;
    box-shadow: 0 16px 40px rgba(45, 55, 78, 0.25);
    transition: transform 0.22s ease, opacity 0.22s ease, visibility 0.22s ease;
  }

  .client-view.sidebar-collapsed .gmail-layout {
    grid-template-columns: 1fr;
  }

  .client-view.sidebar-collapsed .gmail-sidebar {
    transform: translateX(calc(-100% - 12px));
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
  }

  .gmail-reader-panel {
    min-height: 44vh;
  }

  .compose-dock {
    right: 8px;
    width: calc(100vw - 16px);
  }
}

@media (max-width: 640px) {
  .list-toolbar {
    height: auto;
    padding: 8px;
    align-items: flex-start;
    gap: 8px;
    flex-direction: column;
  }

  .toolbar-left,
  .toolbar-right {
    width: 100%;
    flex-wrap: wrap;
  }

  #delete-selected-btn {
    padding: 6px 10px;
    font-size: 12px;
  }

  .auth-actions {
    grid-template-columns: 1fr;
  }

  .detail-attachment-item {
    grid-template-columns: 1fr;
    align-items: stretch;
  }

  .detail-attachment-main {
    grid-template-columns: 18px minmax(0, 1fr);
  }

  .detail-attachment-actions {
    justify-content: flex-start;
    flex-wrap: wrap;
  }

  .gmail-row {
    grid-template-columns: 18px 18px minmax(82px, 120px) minmax(100px, 1fr) auto;
    padding: 0 8px;
    gap: 6px;
  }

  .row-summary {
    font-size: 12px;
  }

  .row-date {
    font-size: 11px;
  }

  .reader-header h2 {
    font-size: 17px;
  }

  .account-chip {
    max-width: 200px;
  }

  .attachment-preview-modal {
    padding: 10px;
  }

  .attachment-preview-head {
    min-height: 52px;
    padding: 0 8px 0 12px;
  }

  .attachment-preview-body {
    padding: 12px;
  }
}

@media (max-width: 600px) and (max-aspect-ratio: 9/16) {
  .gmail-list-panel {
    min-height: 34vh;
  }

  .gmail-reader-panel {
    min-height: 46vh;
  }

  .compose-form textarea {
    min-height: 34vh;
  }
}
