:root {
  --sidebar-w: 320px;
}

@media (min-width: 1440px) {
  :root {
    --sidebar-w: 356px;
  }

  .topbar,
  .layout,
  .app-footer {
    width: min(1600px, calc(100vw - 32px));
    margin-inline: auto;
  }

  .topbar {
    padding-inline: 24px;
    margin-top: 16px;
    border: 1px solid color-mix(in srgb, var(--border) 88%, transparent);
    border-radius: 20px 20px 0 0;
    border-bottom: none;
  }

  .layout {
    border-inline: 1px solid color-mix(in srgb, var(--border) 88%, transparent);
    background: color-mix(in srgb, var(--surface) 82%, transparent);
  }

  .app-footer {
    padding-inline: 24px;
    margin-bottom: 16px;
    border: 1px solid color-mix(in srgb, var(--border) 88%, transparent);
    border-top: none;
    border-radius: 0 0 20px 20px;
  }

  .sidebar-header {
    padding: 18px 18px 14px;
  }

  .theme-toggle-fab {
    right: calc(max(16px, (100vw - 1600px) / 2) + 24px);
  }

  .search-box-wrap {
    padding: 14px 18px;
  }

  .inbox-list {
    padding: 10px;
  }

  .mail-search-wrap {
    padding: 14px 24px;
  }

  .mail-list {
    padding: 16px;
  }

  .inbox-viewer-header {
    padding: 16px 24px;
    gap: 12px;
  }

  .inbox-viewer-email {
    font-size: 15px;
  }

  .mail-card {
    padding: 16px 18px;
    margin-bottom: 10px;
    border-radius: 12px;
  }

  .mail-view-modal .email-modal-content {
    max-width: 860px;
  }

  .email-body {
    padding: 1.125rem 1.5rem 1.5rem;
  }
}

@media (min-width: 1680px) {
  .topbar,
  .layout,
  .app-footer {
    width: min(1720px, calc(100vw - 40px));
  }

  .topbar,
  .app-footer {
    padding-inline: 28px;
  }

  .theme-toggle-fab {
    right: calc(max(20px, (100vw - 1720px) / 2) + 28px);
  }

  .sidebar-header,
  .search-box-wrap {
    padding-inline: 20px;
  }

  .mail-search-wrap,
  .inbox-viewer-header {
    padding-inline: 28px;
  }
}

.google-translate-host,
#google_translate_element,
#temp-mail-google-translate-element {
  position: fixed;
  width: 0;
  height: 0;
  overflow: hidden;
  opacity: 0;
  pointer-events: none;
}

body {
  top: 0 !important;
}

.skiptranslate,
.goog-te-banner-frame,
.goog-te-gadget,
.goog-logo-link {
  display: none !important;
}

.goog-te-combo {
  opacity: 0;
  pointer-events: none;
  position: absolute;
}

body > .skiptranslate {
  display: none !important;
}

.theme-toggle-fab {
  bottom: 4.25rem;
}

.topbar {
  position: relative;
  z-index: 10;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  border-bottom: 1px solid var(--border);
  background: color-mix(in srgb, var(--surface) 82%, transparent);
  backdrop-filter: blur(16px);
  flex-shrink: 0;
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.app-mobile-menu-button {
  display: none;
  width: 34px;
  height: 34px;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
  border: 1px solid color-mix(in srgb, var(--accent) 65%, var(--border));
  background: color-mix(in srgb, var(--surface) 96%, transparent);
  color: var(--text);
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  flex-shrink: 0;
}

.topbar-logo {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
  text-decoration: none;
}

.topbar-logo-icon {
  width: 30px;
  height: 30px;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
}

.topbar-logo span {
  color: var(--text);
}

.topbar-logo:hover,
.topbar-logo:visited,
.topbar-logo:active {
  color: var(--text);
  text-decoration: none;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: nowrap;
  justify-content: flex-end;
  min-width: 0;
}

.topbar-language {
  position: static;
  z-index: auto;
}

.topbar-language .language-trigger {
  width: auto;
  box-shadow: var(--shadow-sm);
}

.topbar-language .language-menu {
  top: calc(100% + 0.5rem);
  right: 0;
}

.app-toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.user-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 5px 12px 5px 6px;
  font-size: 13px;
  min-width: 0;
  max-width: min(280px, 34vw);
}

.user-avatar {
  width: 26px;
  height: 26px;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 600;
  color: #fff;
  flex-shrink: 0;
  overflow: hidden;
}

.user-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.user-name {
  max-width: 180px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.btn-logout {
  padding: 6px 14px;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text-muted);
  font: inherit;
  font-size: 13px;
  cursor: pointer;
  transition: all 0.2s;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  white-space: nowrap;
}

.btn-api {
  padding: 6px 12px;
  background: color-mix(in srgb, var(--surface2) 78%, transparent);
  border: 1px solid color-mix(in srgb, var(--accent) 38%, var(--border));
  border-radius: 8px;
  color: var(--text);
  font: inherit;
  font-size: 13px;
  cursor: pointer;
  transition: all 0.2s;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  white-space: nowrap;
}

.btn-api:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.api-modal {
  width: min(760px, calc(100vw - 32px));
  max-height: min(84vh, 760px);
  overflow: auto;
}

.api-modal {
  position: relative;
  padding-top: 34px;
}

.api-modal-close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 32px;
  height: 32px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: color-mix(in srgb, var(--surface2) 88%, transparent);
  color: var(--text-muted);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s;
}

.api-modal-close:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.api-modal-token-row {
  display: flex;
  gap: 8px;
  margin-top: 14px;
  align-items: stretch;
}

.api-token-preview {
  flex: 1;
  min-height: 42px;
  border-radius: 12px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 12px;
}

.api-modal-guide {
  margin-top: 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.api-guide-head {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.api-guide-title {
  font-weight: 600;
  color: var(--text);
  margin: 0;
  font-size: 14px;
}

.api-guide-sheet {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.api-guide-card {
  border: 1px solid color-mix(in srgb, var(--border) 92%, transparent);
  background: linear-gradient(
    180deg,
    color-mix(in srgb, var(--surface2) 88%, transparent),
    color-mix(in srgb, var(--surface) 96%, transparent)
  );
  border-radius: 14px;
  padding: 14px;
  box-shadow: var(--shadow-sm);
}

.api-guide-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}

.api-guide-card h4 {
  margin: 0;
  font-size: 12px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--accent);
}

.api-guide-copy {
  padding: 5px 10px;
  font-size: 12px;
}

.api-guide-card pre {
  margin: 0;
  padding: 12px 13px;
  border-radius: 12px;
  border: 1px solid color-mix(in srgb, var(--border) 88%, transparent);
  background: color-mix(in srgb, var(--surface2) 78%, transparent);
  color: var(--text);
  font-size: 12px;
  line-height: 1.6;
  overflow: auto;
  white-space: pre;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}

.api-guide-card:last-child {
  grid-column: 1 / -1;
}

@media (max-width: 760px) {
  .api-guide-sheet {
    grid-template-columns: 1fr;
  }

  .api-modal-token-row {
    flex-direction: column;
  }
}

.btn-logout:hover {
  border-color: var(--danger);
  color: var(--danger);
}

.layout {
  display: flex;
  flex: 1;
  overflow: hidden;
  position: relative;
  z-index: 1;
  min-height: 0;
}

.app-sidebar-backdrop {
  display: none;
}

.app-footer {
  height: 44px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 0 20px;
  padding-bottom: max(0px, env(safe-area-inset-bottom));
  border-top: 1px solid var(--border);
  background: color-mix(in srgb, var(--surface) 78%, transparent);
  backdrop-filter: blur(16px);
  font-size: 12px;
  color: var(--text-muted);
}

.app-footer-copy,
.app-footer-links {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.app-footer-copy {
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.app-footer-sep {
  opacity: 0.5;
}

.app-footer-links a {
  color: var(--text-muted);
  text-decoration: none;
  transition: color 0.2s, opacity 0.2s;
}

.app-footer-links a:hover {
  color: var(--accent);
}

.visitor-badge-wrap {
  display: inline-flex;
  align-items: center;
  min-width: 0;
}

.visitor-badge {
  display: block;
  max-width: 100%;
  height: 20px;
  border-radius: 999px;
}

.sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  background: color-mix(in srgb, var(--surface) 60%, transparent);
  overflow: hidden;
  min-height: 0;
}

.sidebar-header {
  padding: 16px 16px 12px;
  border-bottom: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.sidebar-header-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
}

.sidebar-title {
  font-size: 11px;
  opacity: 0.8;
  letter-spacing: 0.03em;
  font-weight: 600;
  color: var(--text-muted);
}

.sidebar-title-count {
  opacity: 0.5;
  font-weight: 400;
  margin-left: 2px;
}

.sidebar-row {
  display: flex;
  gap: 8px;
  width: 100%;
}

.sidebar-inline-delete {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  transition: color 0.15s;
  padding: 0;
  line-height: 1;
}

.sidebar-inline-delete:hover {
  color: var(--danger);
}

.btn-new,
.btn-test,
.btn-copy,
.btn-refresh,
.btn-inline-danger {
  display: flex;
  align-items: center;
  gap: 5px;
  font: inherit;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-new {
  padding: 7px 12px;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  border: none;
  border-radius: 8px;
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  box-shadow: 0 2px 12px var(--accent-glow);
  white-space: nowrap;
}

.btn-new:hover:not(:disabled) {
  opacity: 0.9;
  transform: translateY(-1px);
}

.btn-new:disabled,
.btn-test:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.search-box-wrap {
  padding: 12px 16px;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.mail-search-wrap {
  padding: 12px 20px;
  border-bottom: 1px solid var(--border);
  background: color-mix(in srgb, var(--surface) 55%, transparent);
}

.search-input {
  width: 100%;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 12px 8px 32px;
  color: var(--text);
  font-size: 13px;
  outline: none;
  transition: border-color 0.2s;
  background-image: url('data:image/svg+xml;utf8,<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"14\" height=\"14\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"%238888aa\" stroke-width=\"2.5\"><circle cx=\"11\" cy=\"11\" r=\"8\"/><line x1=\"21\" y1=\"21\" x2=\"16.65\" y2=\"16.65\"/></svg>');
  background-repeat: no-repeat;
  background-position: 10px center;
}

.search-input:focus {
  border-color: var(--accent);
  background-color: rgba(255, 255, 255, 0.06);
}

.open-email-toggle {
  align-self: flex-start;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  color: var(--text-muted);
  background: transparent;
  border: 1px dashed color-mix(in srgb, var(--border) 90%, transparent);
  border-radius: 8px;
  padding: 5px 8px;
  cursor: pointer;
  transition: all 0.18s;
}

.open-email-toggle:hover {
  color: var(--text);
  border-color: color-mix(in srgb, var(--accent) 55%, var(--border));
  background: color-mix(in srgb, var(--surface2) 65%, transparent);
}

.sidebar-open-row {
  align-items: center;
}

.sidebar-open-row.is-collapsed {
  display: none;
}

.open-email-input {
  padding-left: 12px;
  background-image: none;
  min-width: 0;
}

.btn-inline-secondary {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 7px 10px;
  background: var(--surface2);
  color: var(--text);
  cursor: pointer;
  transition: all 0.18s;
}

.btn-inline-secondary:hover:not(:disabled) {
  border-color: color-mix(in srgb, var(--accent) 60%, var(--border));
}

.btn-open {
  padding: 7px 10px;
}

.sidebar-create-row {
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.sidebar-create-row .btn-new {
  flex-basis: 100%;
  justify-content: center;
}

.create-local-input {
  flex: 1;
  min-width: 0;
  height: 32px;
  box-sizing: border-box;
  padding: 0px 6px;
  background-image: none;
}

.create-at {
  color: var(--text-muted);
  user-select: none;
}

.domain-select {
  flex: 1;
  min-width: 120px;
  margin: 0;
  height: 32px;
  box-sizing: border-box;
  font-size: 12px;
  border-radius: 6px;
  background: var(--surface2);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 0px 6px;
  outline: none;
}

.inbox-list,
.mail-list {
  flex: 1;
  overflow-y: auto;
  min-height: 0;
}

.inbox-list {
  padding: 8px;
}

.mail-list {
  padding: 12px;
}

.inbox-list::-webkit-scrollbar,
.mail-list::-webkit-scrollbar {
  width: 4px;
}

.inbox-list::-webkit-scrollbar-thumb,
.mail-list::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 2px;
}

.inbox-card,
.mail-card {
  border-radius: 10px;
  transition: border-color 0.2s, background 0.2s, transform 0.15s;
}

.inbox-card {
  padding: 12px;
  border: 1px solid transparent;
  cursor: pointer;
  margin-bottom: 4px;
  position: relative;
}

.inbox-card:hover {
  background: var(--surface2);
}

.inbox-card.active {
  background: var(--surface2);
  border-color: var(--accent);
}

.inbox-card-email {
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
  word-break: break-all;
  margin-bottom: 4px;
  padding-right: 28px;
}

.inbox-card-meta {
  display: flex;
  align-items: center;
  gap: 6px;
}

.inbox-card-domain {
  font-size: 11px;
  background: rgba(108, 99, 255, 0.15);
  color: var(--accent);
  padding: 2px 7px;
  border-radius: 4px;
  font-weight: 500;
}

.inbox-badge {
  font-size: 10px;
  border-radius: 999px;
  padding: 2px 6px;
  font-weight: 600;
  line-height: 1.2;
}

.inbox-badge-user {
  background: rgba(59, 130, 246, 0.15);
  color: #60a5fa;
}

.inbox-badge-anon {
  background: rgba(168, 85, 247, 0.16);
  color: #c084fc;
}

.inbox-card-time,
.mail-card-time {
  font-size: 11px;
  color: var(--text-muted);
}

.inbox-card-delete,
.inbox-card-hide,
.mail-card-delete {
  position: absolute;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 6px;
  color: var(--text-muted);
  cursor: pointer;
  opacity: 0;
  transition: all 0.15s;
}

.inbox-card-delete,
.inbox-card-hide {
  top: 10px;
  right: 8px;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  opacity: 1;
  z-index: 3;
  pointer-events: auto;
}

.mail-card-delete {
  bottom: 10px;
  right: 12px;
  padding: 3px 8px;
  font-size: 11px;
}

.inbox-card:hover .inbox-card-delete,
.inbox-card:hover .inbox-card-hide,
.mail-card:hover .mail-card-delete {
  opacity: 1;
}

.inbox-card-delete:hover,
.mail-card-delete:hover {
  border-color: var(--danger);
  color: var(--danger);
  background: rgba(255, 85, 102, 0.1);
}

.inbox-card-hide:hover {
  border-color: #60a5fa;
  color: #60a5fa;
  background: rgba(59, 130, 246, 0.12);
}

.unread-badge {
  background: var(--danger);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 9px;
  display: flex;
  align-items: center;
  justify-content: center;
  position: absolute;
  top: 12px;
  right: 36px;
  box-shadow: 0 0 10px var(--danger-glow);
}

.inbox-card.has-unread {
  border-left: 3px solid var(--danger);
}

.inbox-card.has-unread .inbox-card-email {
  font-weight: 700;
}

.inbox-empty,
.no-mail {
  padding: 32px 16px;
  text-align: center;
  color: var(--text-muted);
  font-size: 13px;
}

.inbox-empty-icon,
.no-mail-icon {
  font-size: 36px;
  margin-bottom: 12px;
}

.inbox-empty-title,
.main-placeholder-title {
  font-weight: 600;
  color: var(--text);
}

.main {
  flex: 1;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.main-placeholder {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 12px;
  color: var(--text-muted);
  font-size: 14px;
  text-align: center;
  padding: 24px;
}

.main-placeholder-icon {
  font-size: 56px;
  opacity: 0.4;
}

.main-placeholder-title {
  font-size: 18px;
  opacity: 0.7;
}

#main-placeholder-body {
  width: min(100%, 46ch);
  margin: 0 auto;
  line-height: 1.65;
}

.main-placeholder-actions {
  display: flex;
  gap: 0.9rem;
  margin-top: 0.5rem;
  flex-wrap: wrap;
}

.placeholder-primary,
.placeholder-secondary {
  text-decoration: none;
}

.placeholder-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
}

.app-shell.guest-mode .search-box-wrap,
.app-shell.guest-mode .mail-search-wrap {
  opacity: 0.55;
}

.app-shell.guest-mode #search-inbox,
.app-shell.guest-mode #search-mail,
.app-shell.guest-mode #domain-select,
.app-shell.guest-mode #open-email-toggle,
.app-shell.guest-mode #open-email-input,
.app-shell.guest-mode #btn-open-email {
  pointer-events: none;
}

.inbox-viewer {
  flex: 1;
  display: none;
  flex-direction: column;
  overflow: hidden;
  min-height: 0;
}

.inbox-viewer-header {
  padding: 14px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 10px;
  background: color-mix(in srgb, var(--surface) 55%, transparent);
  flex-shrink: 0;
}

.inbox-viewer-email {
  font-size: 14px;
  font-weight: 600;
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.btn-copy,
.btn-refresh,
.btn-test,
.btn-inline-danger {
  padding: 5px 10px;
  border-radius: 7px;
  font-size: 12px;
  line-height: 1;
}

.btn-copy,
.btn-refresh {
  background: var(--surface2);
  border: 1px solid var(--border);
  color: var(--text-muted);
}

.btn-copy:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.btn-copy.copied {
  border-color: var(--success);
  color: var(--success);
}

.btn-refresh:hover {
  border-color: var(--accent2);
  color: var(--accent2);
}

.btn-refresh.spinning svg,
.spin-loader {
  animation: spin 0.8s linear infinite;
}

.btn-test {
  background: rgba(80, 250, 123, 0.15);
  border: 1px solid var(--success);
  color: var(--success);
  font-weight: 600;
}

.btn-inline-danger {
  border: 1px solid var(--danger);
  background: rgba(255, 85, 102, 0.1);
  color: var(--danger);
}

.mail-card {
  background: var(--surface);
  border: 1px solid var(--border);
  padding: 14px 16px;
  margin-bottom: 8px;
  cursor: pointer;
  position: relative;
}

.mail-card:hover {
  border-color: rgba(108, 99, 255, 0.3);
  background: var(--surface2);
  transform: translateY(-1px);
}

.mail-card-header {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  justify-content: space-between;
}

.mail-card-copy {
  flex: 1;
  min-width: 0;
}

.mail-card-from {
  font-size: 13px;
  font-weight: 600;
  color: var(--accent2);
  margin-bottom: 2px;
  word-break: break-all;
}

.mail-card-subject {
  font-size: 13px;
  font-weight: 500;
  margin-bottom: 4px;
}

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

.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  padding: 10px 18px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 500;
  z-index: 10050;
  transform: translateY(80px);
  opacity: 0;
  transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  pointer-events: none;
}

.toast.show {
  transform: translateY(0);
  opacity: 1;
}

.toast.ok {
  background: rgba(80, 250, 123, 0.15);
  border: 1px solid rgba(80, 250, 123, 0.35);
  color: var(--success);
}

.toast.err {
  background: rgba(255, 85, 102, 0.12);
  border: 1px solid rgba(255, 85, 102, 0.3);
  color: var(--danger);
}

.modal-bg {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s;
}

.modal-bg.open {
  opacity: 1;
  pointer-events: all;
}

.modal {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px 28px 24px;
  max-width: 380px;
  width: 90%;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.7);
  transform: scale(0.95);
  transition: transform 0.2s;
}

.modal.api-modal {
  width: min(980px, calc(100vw - 32px));
  max-width: min(980px, calc(100vw - 32px));
}

.modal-bg.open .modal {
  transform: scale(1);
}

.modal h3 {
  font-size: 17px;
  margin-bottom: 8px;
}

.modal p {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 20px;
  line-height: 1.5;
}

.modal-em {
  color: var(--text);
  font-weight: 500;
}

.modal-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}

.btn-cancel,
.btn-confirm-del {
  padding: 8px 16px;
  border-radius: 8px;
  font: inherit;
  font-size: 13px;
  cursor: pointer;
}

.btn-cancel {
  background: var(--surface2);
  border: 1px solid var(--border);
  color: var(--text-muted);
}

.btn-confirm-del {
  background: rgba(255, 85, 102, 0.15);
  border: 1px solid var(--danger);
  color: var(--danger);
  font-weight: 600;
}

.skeleton {
  background: linear-gradient(90deg, var(--surface2) 25%, var(--surface3) 50%, var(--surface2) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.2s infinite;
  border-radius: 6px;
}

.sk-card {
  height: 68px;
  border-radius: 10px;
  margin-bottom: 4px;
}

.sk-mail {
  height: 72px;
  border-radius: 10px;
  margin-bottom: 8px;
}

.spin-loader {
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top-color: #fff;
  border-radius: 50%;
}

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

@keyframes shimmer {
  0% {
    background-position: 200% 0;
  }

  100% {
    background-position: -200% 0;
  }
}

@media (max-width: 880px) {
  .app-toolbar {
    display: flex;
    align-items: center;
    gap: 8px;
  }

  .topbar-right {
    gap: 8px;
    flex-wrap: nowrap;
  }

  .user-chip {
    display: none;
  }

  .app-toolbar .btn-logout,
  #logout-button.btn-logout {
    width: 34px;
    min-width: 34px;
    height: 34px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
  }

  .app-toolbar .btn-logout span,
  #logout-button.btn-logout span {
    display: none;
  }
}

@media (max-width: 640px) {
  :root {
    --sidebar-w: 100%;
  }

  .main-placeholder-actions {
    flex-direction: column;
  }

  .placeholder-primary,
  .placeholder-secondary {
    width: 100%;
  }

  .layout {
    flex-direction: column;
  }

  .app-mobile-menu-button {
    display: inline-flex;
  }

  .topbar-logo-icon {
    display: none;
  }

  .topbar-logo span {
    font-size: 16px;
  }

  .app-sidebar-backdrop {
    display: block;
    position: fixed;
    inset: 0;
    border: none;
    background: rgba(15, 23, 42, 0.36);
    z-index: 39;
  }

  .app-sidebar-backdrop.hidden {
    display: none;
  }

  .sidebar {
    position: fixed;
    top: 56px;
    left: 0;
    bottom: 0;
    width: min(360px, calc(100vw - 24px));
    max-height: none;
    border-right: 1px solid var(--border);
    border-bottom: none;
    background: color-mix(in srgb, var(--surface) 94%, transparent);
    box-shadow: var(--shadow-xl);
    transform: translateX(-110%);
    transition: transform 0.22s ease;
    z-index: 40;
  }

  body.app-sidebar-mobile-open .sidebar {
    transform: translateX(0);
  }

  .main {
    min-height: 0;
  }

  .topbar {
    padding: 0 12px;
  }

  .topbar-right {
    flex-wrap: nowrap;
    justify-content: flex-end;
  }

  .topbar-language .language-trigger {
    min-width: 0;
    width: 38px;
    height: 34px;
    padding: 6px;
    border-radius: 10px;
    justify-content: center;
    gap: 0;
  }

  .topbar-language .language-trigger i {
    display: none;
  }

  .topbar-language [data-language-current] {
    display: inline-block;
    width: 1.25em;
    overflow: hidden;
    white-space: nowrap;
    font-size: 18px;
    line-height: 1;
  }

  .app-footer {
    height: auto;
    padding: 10px 12px calc(10px + env(safe-area-inset-bottom));
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }

  .app-footer-copy,
  .app-footer-links {
    flex-wrap: wrap;
    white-space: normal;
  }

  .theme-toggle-fab {
    bottom: calc(5.75rem + env(safe-area-inset-bottom));
  }
}
