@media (max-width: 1180px) {
  .app-page {
    @apply p-2;
  }

  .app-shell {
    @apply rounded-xl;
    height: calc(100vh - 16px);
  }

  .app-main {
    grid-template-columns: 1fr;
  }

  .app-side {
    @apply grid items-start gap-2;
    border-right: none;
    border-bottom: 1px solid #d9e0ea;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    align-self: start;
    height: fit-content;
  }

  .app-side > .side-link {
    @apply min-h-0;
  }

  .vault-grid {
    grid-template-columns: 1fr;
    @apply h-auto;
  }
  .sidebar {
    @apply max-h-[280px];
  }
  .totp-grid,
  .field-grid {
    grid-template-columns: 1fr;
  }

  .totp-copy-btn {
    justify-self: start;
  }

  .import-export-panels,
  .backup-browser-row {
    grid-template-columns: 1fr;
  }

  .settings-twofactor-grid {
    grid-template-columns: 1fr;
  }

  .standalone-title {
    @apply text-2xl;
  }

  .standalone-footer {
    @apply text-xs leading-[1.4];
  }
}

@media (max-width: 1180px) {
  .auth-page {
    @apply items-start p-3.5;
  }

  .standalone-shell {
    @apply w-full max-w-[460px] gap-2.5 pt-3;
  }

  .standalone-brand-outside {
    @apply justify-start;
  }

  .standalone-brand-logo {
    @apply h-11 w-11;
  }

  .auth-card {
    @apply rounded-[18px] px-4 py-5;
  }

  .btn.full {
    @apply h-12 text-lg;
  }

  .auth-support-row {
    @apply flex-row items-center;
  }

  .app-page {
    @apply p-0;
    background: transparent;
  }

  .app-shell {
    --mobile-topbar-height: 58px;
    --mobile-tabbar-height: 70px;
    @apply h-dvh max-w-none rounded-none border-0;
    border: none;
    box-shadow: none;
  }

  .topbar {
    @apply relative z-20 px-3;
    height: var(--mobile-topbar-height);
  }

  .brand {
    @apply min-w-0 gap-2.5 text-lg;
  }

  .brand-logo {
    @apply h-[34px] w-[34px];
  }

  .brand-wordmark {
    @apply hidden;
  }

  .mobile-page-title {
    @apply inline;
  }

  .topbar-actions .user-chip,
  .topbar-actions > .btn:not(.mobile-sidebar-toggle):not(.mobile-lock-btn),
  .topbar-actions > .theme-switch-wrap {
    @apply hidden;
  }

  .mobile-sidebar-toggle,
  .mobile-lock-btn {
    @apply inline-flex h-9 w-9 min-w-9 justify-center gap-0 p-0 text-[0];
  }

  .mobile-sidebar-toggle .btn-icon,
  .mobile-lock-btn .btn-icon {
    @apply m-0;
  }

  .mobile-theme-btn {
    @apply inline-flex items-center;
  }

  .mobile-theme-btn .theme-switch {
    transform: scale(0.8);
    transform-origin: center;
  }

  .app-main {
    @apply flex min-h-0 flex-col;
  }

  .app-side {
    @apply hidden;
  }

  .content {
    @apply min-h-0 flex-1;
    -webkit-overflow-scrolling: touch;
  }

  .mobile-tabbar {
    @apply grid items-center gap-1.5;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    min-height: var(--mobile-tabbar-height);
    padding: 8px 10px calc(8px + env(safe-area-inset-bottom));
    border-top: 1px solid var(--line);
    background: rgba(248, 251, 255, 0.92);
  }

  .mobile-tab {
    @apply grid justify-items-center gap-1 rounded-xl px-1 py-1.5 text-[11px] font-bold no-underline;
    color: #64748b;
    transition:
      transform 220ms var(--ease-out-soft),
      background-color var(--dur-fast) var(--ease-smooth),
      color var(--dur-fast) var(--ease-smooth);
  }

  .mobile-tab:hover {
    transform: translateY(-1px);
  }

  .mobile-tab.active {
    color: var(--primary-strong);
    background: linear-gradient(135deg, rgba(37, 99, 235, 0.16), rgba(59, 130, 246, 0.08));
    box-shadow: 0 8px 18px rgba(37, 99, 235, 0.08);
  }

  .vault-grid {
    @apply gap-2.5 p-0;
  }

  .sidebar {
    @apply hidden;
  }

  .mobile-sidebar-sheet {
    @apply fixed left-2.5 right-2.5 z-[55] block overflow-auto rounded-[18px] p-3 opacity-0;
    top: calc(var(--mobile-topbar-height) + 10px);
    bottom: auto;
    max-height: calc(100dvh - 145px);
    border: 1px solid #d8dee8;
    background: #fff;
    box-shadow: 0 18px 40px rgba(15, 23, 42, 0.16);
    visibility: hidden;
    pointer-events: none;
    transform: translate3d(0, 10px, 0) scale(0.98);
    transition:
      opacity 220ms var(--ease-smooth),
      transform 240ms var(--ease-out-soft),
      visibility 220ms var(--ease-smooth);
  }

  .mobile-sidebar-sheet.open {
    @apply opacity-100;
    visibility: visible;
    pointer-events: auto;
    transform: translate3d(0, 0, 0) scale(1);
  }

  .mobile-sidebar-head {
    @apply mb-2.5 flex items-center justify-between gap-2.5;
  }

  .mobile-sidebar-title {
    @apply text-base font-extrabold;
    color: #0f172a;
  }

  .mobile-sidebar-close {
    @apply inline-grid h-[34px] w-[34px] cursor-pointer place-items-center rounded-full p-0;
    border: 1px solid #d7dde6;
    background: #fff;
    color: #0f172a;
    transition:
      transform var(--dur-fast) var(--ease-out-soft),
      background-color var(--dur-fast) var(--ease-smooth),
      border-color var(--dur-fast) var(--ease-smooth);
  }

  .mobile-sidebar-close:hover {
    transform: scale(1.05);
  }

  .mobile-sidebar-sheet .sidebar-block {
    @apply m-0 rounded-none border-0 p-0;
    border: none;
    background: transparent;
    box-shadow: none;
  }

  .mobile-sidebar-sheet .tree-btn {
    @apply mb-0.5;
  }

  .mobile-sidebar-sheet .folder-row {
    @apply items-stretch gap-1;
  }

  .mobile-sidebar-sheet .folder-row .tree-btn {
    @apply min-h-[42px];
  }

  .mobile-sidebar-sheet .sidebar-title,
  .mobile-sidebar-sheet .sidebar-title-row {
    @apply mb-0 pb-1.5;
  }

  .mobile-sidebar-sheet .tree-btn {
    @apply rounded-[10px] px-2;
  }

  .mobile-sidebar-sheet .tree-btn.active {
    background: #eef4ff;
  }

  .mobile-sidebar-sheet .folder-delete-btn {
    @apply h-[42px] w-7 rounded-lg;
  }

  .list-col {
    @apply max-w-none;
  }

  .list-head {
    @apply grid items-center gap-2;
    grid-template-columns: minmax(0, 1fr) auto auto auto;
  }

  .list-count {
    grid-column: auto;
    @apply w-auto whitespace-nowrap text-xs;
  }

  .list-head .search-input-wrap {
    @apply w-full min-w-0;
  }

  .list-head .search-input {
    @apply h-[42px] w-full min-w-0 rounded-[14px];
  }

  .list-icon-btn {
    @apply w-auto min-w-0 gap-1.5 whitespace-nowrap px-3 py-0 text-[13px];
  }

  .toolbar.actions {
    @apply justify-end overflow-visible pb-0.5;
    flex-wrap: unset;
    gap: var(--actions-gap);
  }

  .actions {
    gap: var(--actions-gap);
  }

  .toolbar.actions .btn.small {
    @apply h-[34px] w-auto min-w-0 gap-1.5 whitespace-nowrap rounded-full px-3 py-0 text-[13px];
  }

  .mobile-fab-wrap {
    @apply fixed right-3.5 z-[45];
    bottom: calc(14px + var(--mobile-tabbar-height) + env(safe-area-inset-bottom));
  }

  .mobile-fab-trigger {
    @apply h-14 w-9 gap-0 rounded-full p-0 text-[0];
    box-shadow: 0 14px 30px rgba(37, 99, 235, 0.28);
  }

  .mobile-fab-trigger .btn-icon {
    @apply m-0 h-5 w-5;
  }

  .mobile-fab-wrap .create-menu {
    left: auto;
    right: 0;
    top: auto;
    bottom: calc(100% + 10px);
  }

  .list-panel {
    @apply overflow-visible rounded-2xl;
  }

  .list-item {
    @apply rounded-[14px] p-3;
  }

  .row-check {
    @apply h-[18px] w-[18px];
  }

  .vault-grid.mobile-panel-detail .sidebar,
  .vault-grid.mobile-panel-detail .list-col,
  .vault-grid.mobile-panel-edit .sidebar,
  .vault-grid.mobile-panel-edit .list-col {
    display: none;
    @apply hidden;
  }

  .mobile-detail-sheet {
    @apply fixed left-0 right-0 z-[35] block overflow-auto opacity-0;
    top: calc(var(--mobile-topbar-height) + env(safe-area-inset-top));
    bottom: calc(var(--mobile-tabbar-height) + env(safe-area-inset-bottom));
    background: transparent;
    padding: 0 0 18px;
    visibility: hidden;
    pointer-events: none;
    transform: translate3d(0, 18px, 0);
    transition:
      opacity 220ms var(--ease-smooth),
      transform 260ms var(--ease-out-soft),
      visibility 220ms var(--ease-smooth);
  }

  .mobile-detail-sheet.open {
    @apply opacity-100;
    visibility: visible;
    pointer-events: auto;
    transform: translate3d(0, 0, 0);
  }

  .mobile-panel-head {
    @apply mb-2.5 ml-2.5 mr-2.5 flex items-center;
  }

  .mobile-panel-back {
    @apply min-h-10;
  }

  .mobile-detail-sheet > .detail-switch-stage,
  .mobile-detail-sheet > .card,
  .mobile-detail-sheet > .empty {
    @apply ml-2.5 mr-2.5;
  }

  .detail-col .card,
  .import-export-panel,
  .settings-subcard {
    @apply rounded-2xl;
  }

  .card {
    @apply p-3.5;
  }

  .section-head {
    @apply flex-col items-start gap-2.5;
  }

  .detail-actions {
    flex-direction: column;
    align-items: stretch;
    gap: 5px;
  }

  .detail-actions .actions {
    width: 100%;
  }

  .detail-actions .actions .btn,
  .detail-delete-btn {
    width: 100%;
  }

  .kv-row {
    grid-template-columns: minmax(64px, 80px) minmax(0, 1fr) auto;
    align-items: center;
  }

  .kv-line {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
  }

  .kv-actions {
    width: auto;
    justify-content: flex-end;
    flex-wrap: nowrap;
  }

  .kv-actions .btn.small {
    width: 34px;
    min-width: 34px;
    height: 34px;
    padding: 0;
    font-size: 0;
    gap: 0;
    border-radius: 999px;
  }

  .kv-actions .btn.small .btn-icon {
    margin: 0;
  }

  .import-export-panels,
  .settings-twofactor-grid {
    gap: 10px;
  }

  .settings-modules-grid,
  .password-settings-grid {
    grid-template-columns: 1fr;
  }

  .import-export-panel .actions .btn,
  .settings-subcard .actions .btn,
  .section-head .actions .btn {
    width: 100%;
  }

  .totp-grid {
    gap: 10px;
  }

  .totp-qr {
    min-height: 180px;
  }

  .totp-qr svg,
  .totp-qr img {
    width: 160px;
    height: 160px;
  }

  .invite-toolbar {
    align-items: stretch;
  }

  .mobile-settings-card {
    min-height: calc(100dvh - 170px);
    display: flex;
    flex-direction: column;
    gap: 12px;
  }

  .mobile-settings-subhead {
    display: flex;
    align-items: center;
  }

  .mobile-settings-back {
    min-height: 38px;
  }

  .mobile-settings-links {
    display: grid;
    gap: 8px;
    align-content: start;
  }

  .mobile-settings-link {
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 46px;
    padding: 0 12px;
    border: 1px solid #dbe2ec;
    border-radius: 14px;
    background: #f8fafc;
    color: #0f172a;
    text-decoration: none;
    font-weight: 700;
  }

  .mobile-settings-link.active {
    background: #e8f0ff;
    border-color: #b9cff6;
    color: #175ddc;
  }

  .mobile-settings-logout {
    width: 100%;
    margin-top: auto;
  }

  .stack,
  .import-export-page,
  .totp-codes-page,
  .detail-col {
    min-height: auto;
  }

  .invite-create-group {
    align-items: stretch;
    width: 100%;
  }

  .input.small {
    width: 100%;
  }

  .table,
  .table tbody,
  .table tr,
  .table td {
    display: block;
    width: 100%;
  }

  .table thead {
    display: none;
  }

  .table tr {
    border: 1px solid var(--line);
    border-radius: 14px;
    background: #fff;
    padding: 10px 12px;
    margin-bottom: 10px;
  }

  .table td {
    border-bottom: 1px solid #edf1f6;
    padding: 10px 0;
  }

  .table td:last-child {
    border-bottom: none;
    padding-bottom: 0;
  }

  .table td::before {
    display: block;
    content: attr(data-label);
    margin-bottom: 4px;
    color: #64748b;
    font-size: 12px;
    font-weight: 700;
  }

  .dialog-mask {
    align-items: center;
    justify-items: center;
    padding: 16px;
  }

  .dialog-card {
    width: 90%;
    max-width: 460px;
    max-height: calc(100dvh - 10px);
    overflow: auto;
    border-radius: 22px;
    padding: 18px 16px calc(18px + env(safe-area-inset-bottom));
  }

  .dialog-card.warning {
    max-width: 520px;
  }

  .dialog-warning-strip {
    margin: -18px -16px 16px;
  }

  .dialog-title {
    font-size: 24px;
  }

  .dialog-btn {
    height: 46px;
    font-size: 16px;
  }

.toast-stack {
  top: 10px;
  left: 10px;
  right: 10px;
  width: auto;
}
}

@media (max-width: 1180px) {
  .backup-grid {
    grid-template-columns: 1fr;
  }

  .backup-operations-sidebar,
  .backup-destination-sidebar {
    position: static;
  }
}

@media (max-width: 640px) {
  .backup-interval-row {
    grid-template-columns: 1fr;
  }

  .backup-browser-row,
  .field-grid {
    grid-template-columns: 1fr;
  }

  .backup-destination-top {
    align-items: flex-start;
    flex-direction: column;
  }

  .backup-add-chooser {
    flex-direction: column;
  }

  .backup-name-row {
    grid-template-columns: 1fr;
  }

  .backup-option-field {
    align-items: flex-start;
  }

  .backup-help-bubble {
    left: 0;
    transform: translate(0, -4px);
  }

  .backup-help-bubble::before {
    left: 16px;
    transform: rotate(45deg);
  }

  .backup-help-wrap:hover .backup-help-bubble,
  .backup-help-wrap:focus-within .backup-help-bubble,
  .backup-help-wrap.open .backup-help-bubble {
    transform: translate(0, 0);
  }
}
