      /* Keep floating actions inside the usable browser viewport. */
      .app-layout, .account-workspace, .account-list-workspace { min-width: 0; max-width: 100%; }
      #noti-flyout-panel, #option-menu-dropdown, #rank-popover {
        position: fixed; box-sizing: border-box;
        inset: auto; right: auto !important;
        max-width: calc(100vw - 24px); max-height: calc(100dvh - 24px);
        transform: none !important; animation: none !important;
        overscroll-behavior: contain;
      }
      #option-menu-dropdown { width: min(320px, calc(100vw - 24px)) !important; overflow: hidden; }
      #noti-flyout-panel .noti-flyout-header, #option-menu-dropdown .option-menu-header { flex: 0 0 auto; flex-wrap: wrap; gap: 8px; }
      #noti-flyout-panel .noti-flyout-title { min-width: 0; flex: 1 1 150px; overflow-wrap: anywhere; }
      #noti-flyout-panel .noti-flyout-list, #option-menu-dropdown .option-menu-list {
        min-height: 0; flex: 1 1 auto; max-height: none; overflow-y: auto;
        overscroll-behavior: contain;
      }
      #rank-popover { overflow-y: auto; }
      .noti-item-content, .option-item-content { min-width: 0; overflow-wrap: anywhere; }
      .noti-item-card { flex-shrink: 0; }
      .modal-overlay { padding: 12px; }
      .modal-card:not(.modal-card-analytics) { max-width: min(380px, 100%); max-height: calc(100dvh - 24px); }
      @media (max-width: 600px) {
        header, .header-brand, .header-brand-info, .header-action-group { min-width: 0; }
        .header-brand h1 { flex-wrap: wrap; }
        .header-brand h1 #brand-typewriter-text { white-space: normal !important; overflow-wrap: anywhere; }
        .storage-switcher-bar { gap: 8px 18px; }
        .storage-tab-title { white-space: normal; }
        .add-target-pill-group { flex-wrap: wrap; max-width: 100%; }
        .btn-target-pill { white-space: normal; }
        .modal-overlay { padding: 8px; }

      }
      /* Unified compact sizes for notices, forms, flyouts and status messages. */
      :root {
        --dialog-small: 380px;
        --dialog-medium: 460px;
        --dialog-large: 640px;
        --overlay-gap: 16px;
      }
      .modal-overlay { padding: var(--overlay-gap); backdrop-filter: blur(4px); }
      .modal-card:not(.modal-card-analytics) {
        width: 100%; min-width: 0; max-width: var(--dialog-small);
        max-height: calc(100dvh - 32px); padding: 22px;
        border-radius: 14px; overflow-y: auto; overscroll-behavior: contain;
        overflow-wrap: anywhere; font-size: .85rem; line-height: 1.55;
      }
      #custom-modal > .modal-card, #pin-modal > .modal-card { max-width: var(--dialog-small) !important; }
      #name-modal > .modal-card, #tele-modal > .modal-card,
      #cloud-modal > .modal-card { max-width: var(--dialog-medium) !important; }
      #device-modal > .modal-card { max-width: var(--dialog-large) !important; }
      .modal-icon { font-size: 1.9rem; margin-bottom: 10px; animation: none; }
      .modal-title { font-size: 1rem; line-height: 1.5; font-weight: 700; }
      .modal-msg { font-size: .84rem; line-height: 1.65; margin-top: 8px; }
      .modal-btns { gap: 8px; margin-top: 18px; flex-wrap: wrap; }
      .modal-btn-act { min-height: 36px; padding: 8px 14px; border-radius: 8px; font-size: .82rem; }
      .modal-card input, .modal-card textarea, .modal-card select { max-width: 100%; min-width: 0; box-sizing: border-box; }
      .welcome-banner-card, .welcome-name-card, .device-gate-card {
        width: min(100%, 460px); max-width: calc(100vw - 32px);
        max-height: calc(100dvh - 32px); overflow-y: auto;
        padding: 22px; border-radius: 14px; overscroll-behavior: contain;
        overflow-wrap: anywhere;
      }
      #noti-flyout-panel { --floating-max-height: 480px; width: min(360px, calc(100vw - 24px)); max-height: min(480px, calc(100dvh - 24px)); border-radius: 12px; }
      #option-menu-dropdown { --floating-max-height: 480px; max-height: min(480px, calc(100dvh - 24px)); border-radius: 12px; padding: 8px; }
      #rank-popover { --floating-max-height: 300px; max-height: min(300px, calc(100dvh - 24px)); border-radius: 10px; }
      #noti-flyout-panel .noti-flyout-header { padding: 10px 12px; gap: 6px; }
      #noti-flyout-panel .noti-flyout-title { font-size: .8rem; font-weight: 600; flex-basis: 135px; }
      #noti-flyout-panel .noti-flyout-list { padding: 8px; gap: 7px; scrollbar-gutter: stable; }
      .noti-item-card { padding: 9px 10px; gap: 8px; border-radius: 9px; box-shadow: none; }
      .noti-item-avatar { width: 28px; height: 28px; flex: 0 0 28px; font-size: .9rem; border-radius: 7px; }
      .noti-item-top { gap: 5px; flex-wrap: wrap; }
      .noti-item-user { font-size: .78rem; font-weight: 600; overflow-wrap: anywhere; }
      .noti-item-time { font-size: .65rem; }
      .noti-item-desc { font-size: .75rem; line-height: 1.5; }
      .noti-item-badge-cat { font-size: .63rem; padding: 2px 5px; margin-top: 4px; }
      .noti-item-del-btn, .btn-noti-close, .option-menu-close { min-width: 28px; min-height: 28px; }
      .option-menu-item { padding: 10px; border-radius: 8px; gap: 10px; }
      .option-item-title { font-size: .83rem; font-weight: 600; }
      .option-item-sub { font-size: .73rem; line-height: 1.5; }
      .option-item-icon { width: 32px; height: 32px; flex: 0 0 32px; font-size: 1rem; border-radius: 8px; }
      #toast {
        min-width: 0; width: max-content; max-width: min(360px, calc(100vw - 32px));
        max-height: calc(100dvh - 32px); overflow-y: auto; overflow-wrap: anywhere;
        padding: 18px 22px; border-radius: 12px; gap: 8px;
        box-shadow: 0 12px 36px #0006;
      }
      #toast .tick-done-circle, #toast .tick-done-svg { width: 38px; height: 38px; flex-shrink: 0; }
      .toast-center-title { font-size: .95rem; line-height: 1.5; }
      .toast-center-sub { font-size: .8rem; line-height: 1.5; }
      .activity-toast-container {
        width: min(320px, calc(100vw - 32px)); max-width: none;
        left: 16px; bottom: 16px; gap: 8px;
        max-height: min(360px, calc(100dvh - 32px)); overflow-y: auto;
        overscroll-behavior: contain;
      }
      .activity-toast-item { flex-shrink: 0; padding: 10px 12px; border-radius: 10px; box-shadow: 0 8px 24px #0004; overflow-wrap: anywhere; }
      @media (max-width: 600px) {
        :root { --overlay-gap: 12px; }
        .modal-card:not(.modal-card-analytics), .welcome-banner-card, .welcome-name-card, .device-gate-card {
          padding: 18px; max-height: calc(100dvh - 24px);
        }
        #custom-modal > .modal-card { max-width: min(380px, calc(100vw - 24px)) !important; }
        .modal-btn-act, .toast-center-action-btn { min-height: 44px; }
        .btn-noti-close, .btn-noti-clear, .option-menu-close { min-height: 36px; }
        #analytics-modal { padding: 0; }
      }
      /* Mobile: reduce compositing and decorative animation work. */
      @media (pointer: coarse), (prefers-reduced-motion: reduce) {
        .modal-overlay, .modal-card, .welcome-banner-overlay, .welcome-banner-card,
        .m-row-card, .rank-group-banner, #toast, #noti-flyout-panel,
        #option-menu-dropdown, .activity-toast-item {
          backdrop-filter: none !important; -webkit-backdrop-filter: none !important;
        }
        .m-row-card, .rank-group-banner, .row-newly-added-glow,
        .badge-just-unbanned, .emergency-banner, .btn-emergency,
        .status-dot-active, .modal-icon { animation: none !important; }
        .m-row-card, .acc-row-item { transition: background-color .15s, border-color .15s !important; }
      }
      /* Make storage choices recognizable and keep the selected destination explicit. */
      .storage-picker-heading { display: flex; align-items: baseline; flex-wrap: wrap; gap: 6px 14px; margin: 8px 0 10px; }
      .storage-picker-heading strong { font-size: .88rem; font-weight: 600; }
      .storage-picker-heading span { font-size: .76rem; color: var(--text-sub); }
      #storage-switcher-bar {
        display: grid; grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 12px; max-width: 840px; border: 0; margin: 0 0 24px;
      }
      #storage-switcher-bar .storage-tab-btn {
        width: 100%; min-height: 88px; margin: 0; padding: 14px 16px;
        background: var(--bg-surface); border: 1px solid #3b475d;
        border-radius: 10px; gap: 12px; box-shadow: none; transform: none;
        flex-wrap: wrap; transition: background-color .15s, border-color .15s;
      }
      #storage-switcher-bar .storage-tab-text-wrap { flex: 1 1 170px; }
      #storage-switcher-bar .storage-tab-title { font-size: .9rem; color: var(--text-main); font-weight: 600; }
      #storage-switcher-bar .storage-tab-sub { display: block; white-space: normal; font-size: .74rem; color: var(--text-sub); margin-top: 3px; }
      #storage-switcher-bar .storage-tab-icon { font-size: 1.25rem; }
      #storage-switcher-bar .storage-tab-pill { margin-left: auto; padding: 2px 7px; color: var(--text-sub); background: #202a3b; }
      #storage-switcher-bar .storage-tab-btn::after { content: "Chọn kho →"; font-size: .73rem; color: var(--text-sub); white-space: nowrap; }
      #storage-switcher-bar .storage-tab-btn:hover { background: #202b40; border-color: #a99bff; }
      #storage-switcher-bar .storage-tab-btn.active {
        background: #292342; border: 2px solid #a99bff; padding: 13px 15px;
      }
      #storage-switcher-bar .storage-tab-btn.active .storage-tab-title { color: #e2dbff; }
      #storage-switcher-bar .storage-tab-btn.active::after { content: "✓ Đang chọn"; color: #ded5ff; font-weight: 600; }
      @media (max-width: 600px) {
        #storage-switcher-bar { gap: 8px; }
        #storage-switcher-bar .storage-tab-btn { padding: 12px; gap: 8px; align-content: start; }

        #storage-switcher-bar .storage-tab-text-wrap { flex: 1 1 100%; order: 2; }

        #storage-switcher-bar .storage-tab-sub { font-size: .7rem; }
        #storage-switcher-bar .storage-tab-btn::after { order: 3; }
        #storage-switcher-bar .storage-tab-pill { margin-left: auto; }
      }
      /* Pointer feedback only: no continuous animation or movement on touch screens. */
      @media (hover: hover) and (pointer: fine) {
        .option-menu-item, .noti-item-card, .m-row-card,
        .rank-group-banner, .btn, .btn-card-collapse, .btn-change-user-name,
        .rank-nav-chip, .btn-target-pill, .btn-quick-paste-purple,
        .btn-copy-action, .analytics-kpi-card, .analytics-section-card {
          transition: background-color .16s ease, border-color .16s ease, box-shadow .16s ease;
        }
        #storage-switcher-bar .storage-tab-btn:hover {
          background: #252e45; border-color: #b8aaff;
          box-shadow: 0 3px 12px #0003, inset 0 0 0 1px #a99bff33;
        }
        #storage-switcher-bar .storage-tab-btn.active:hover { background: #352b53; }
        .option-menu-item:hover, .noti-item-card:hover, .m-row-card:hover {
          background: #202c40 !important; border-color: #716693;
          box-shadow: inset 0 0 0 1px #a99bff26;
        }
        .acc-table tbody tr.acc-row-item:hover {
          background: #202d43 !important;
          box-shadow: inset 3px 0 0 #a99bff !important;
        }
        .acc-table tbody tr.acc-row-item.is-banned:hover { background: #3a2232 !important; box-shadow: inset 3px 0 0 #f18b9e !important; }
        .m-row-card.is-banned:hover { background: #3a2232 !important; }
        .acc-table tbody tr.acc-group-header-row:hover td, .rank-group-banner:hover {
          filter: brightness(1.1); box-shadow: inset 0 0 0 1px #a99bff55 !important;
        }
        .btn:not(:disabled):hover, .btn-card-collapse:hover, .btn-change-user-name:hover,
        .btn-target-pill:hover, .btn-quick-paste-purple:hover {
          border-color: #a99bff; box-shadow: inset 0 0 0 1px #a99bff33;
        }
        .quick-rank-nav .rank-nav-chip:hover { background: #28334a; border-color: #716693 !important; color: #fff !important; }
        .quick-rank-nav .rank-nav-chip.active:hover { background: #382d55 !important; }
        .btn-copy-action:not(:disabled):not(.btn-copy-locked):hover {
          background: #443668 !important; border-color: #b8aaff !important;
          box-shadow: inset 0 0 0 1px #b8aaff33 !important;
        }
        #analytics-modal .analytics-kpi-card:hover { border-color: #716693; background: #1d293d; }
        #analytics-modal .analytics-table tr:hover td { background: #202c40; }
        .btn:disabled, .btn-copy-action:disabled { cursor: not-allowed; }
      }
      @media (hover: hover) and (pointer: fine) and (prefers-reduced-motion: no-preference) {
        #storage-switcher-bar .storage-tab-btn { transition: background-color .16s ease, border-color .16s ease, box-shadow .16s ease, transform .16s ease; }
        #storage-switcher-bar .storage-tab-btn:hover { transform: translateY(-2px); }
        #storage-switcher-bar .storage-tab-btn:active { transform: translateY(0); }
      }
      /* Separate mobile account cards without changing the desktop table. */
      @media (max-width: 1100px) {
        .mobile-card-list { gap: 16px; }
        .mobile-card-list .m-row-card {
          background: #161f30 !important;
          border: 1px solid #354158; border-radius: 12px;
          padding: 15px 14px; gap: 12px;
          margin: 0;
          box-shadow: none !important;
        }
        .mobile-card-list .m-row-card:last-child { margin-bottom: 0; }
        .mobile-card-list .m-row-card.is-banned { background: #2b1d2a !important; }
        .mobile-card-list .m-row-card.is-just-unbanned { background: #142b28 !important; }
        .mobile-card-list .m-card-top-row { gap: 10px; flex-wrap: wrap; }
        .mobile-card-list .m-history-row {
          background: transparent; border: 0; border-radius: 0;
          border-bottom: 1px solid #2c374b; padding: 0 0 10px;
          margin: 0; line-height: 1.5;
        }
        .mobile-card-list .m-creds-row { gap: 10px; }
        .mobile-card-list .m-creds-row .tbl-input { min-height: 36px; }
        .mobile-card-list .m-action-row { gap: 8px; padding-top: 2px; }
        .mobile-card-list .m-btn-copy { min-height: 40px; border-radius: 8px; }
        .mobile-card-list .rank-group-banner { margin-top: 8px; margin-bottom: 0; }
        .mobile-card-list .rank-group-banner:first-child { margin-top: 0; }
      }
      /* Balanced full-width storage navigation and aligned working controls. */
      .storage-picker-heading { justify-content: space-between; margin-bottom: 12px; }
      #storage-switcher-bar { max-width: none; gap: 16px; }
      #storage-switcher-bar .storage-tab-btn {
        display: grid; grid-template-columns: 42px minmax(0, 1fr) auto;
        grid-template-rows: auto auto; column-gap: 14px; row-gap: 4px;
        min-height: 94px; padding: 16px 20px; align-items: center;
        text-align: left; position: relative;
      }
      #storage-switcher-bar .storage-tab-btn.active { padding: 15px 19px; }
      #storage-switcher-bar .storage-tab-icon {
        grid-column: 1; grid-row: 1 / 3; width: 42px; height: 42px;
        display: flex; align-items: center; justify-content: center;
        border-radius: 10px; background: #ffffff08; font-size: 1.3rem;
      }
      #storage-switcher-bar .storage-tab-text-wrap { grid-column: 2; grid-row: 1 / 3; min-width: 0; }
      #storage-switcher-bar .storage-tab-title { font-size: .94rem; }
      #storage-switcher-bar .storage-tab-sub { margin-top: 4px; font-size: .76rem; }
      #storage-switcher-bar .storage-tab-pill {
        grid-column: 3; grid-row: 1; margin: 0; justify-self: end;
        padding: 2px 9px; font-size: .8rem; line-height: 1.5;
        font-variant-numeric: tabular-nums;
      }
      #storage-switcher-bar .storage-tab-btn::after { grid-column: 3; grid-row: 2; justify-self: end; font-size: .72rem; }
      .account-list-workspace .quick-rank-nav { align-items: center; gap: 12px 20px; }
      .account-list-workspace .quick-rank-nav .filter-actions { margin-left: auto; }
      @media (max-width: 600px) {
        .storage-picker-heading { align-items: flex-start; gap: 4px; }
        .storage-picker-heading span { flex-basis: 100%; }

        #storage-switcher-bar .storage-tab-btn {
          grid-template-columns: minmax(0, 1fr) auto; grid-template-rows: auto 1fr auto;
          min-height: 154px; padding: 12px; gap: 10px 6px; align-items: start;
        }

        #storage-switcher-bar .storage-tab-icon { grid-column: 1; grid-row: 1; width: 30px; height: 30px; font-size: 1rem; border-radius: 8px; }
        #storage-switcher-bar .storage-tab-pill { grid-column: 2; grid-row: 1; align-self: center; font-size: .72rem; }
        #storage-switcher-bar .storage-tab-text-wrap { grid-column: 1 / -1; grid-row: 2; }

        #storage-switcher-bar .storage-tab-sub { font-size: .7rem; line-height: 1.5; }
        #storage-switcher-bar .storage-tab-btn::after { grid-column: 1 / -1; grid-row: 3; justify-self: start; }
        .account-list-workspace .quick-rank-nav { gap: 10px; }
      }
      /* Destructive action: distinct color and its own row on mobile. */
      .btn-del-action, .m-btn-del {
        background: #3a1f2b; color: #fda4af;
        border: 1px solid #ad4c62; border-radius: 8px;
        min-width: 32px; min-height: 36px;
      }
      .btn-del-action:hover, .m-btn-del:hover {
        background: #542334; color: #ffe4e6; border-color: #fb7185;
        transform: none; box-shadow: none;
      }
      .btn-del-action:focus-visible, .m-btn-del:focus-visible {
        outline: 2px solid #fb7185; outline-offset: 3px;
      }
      @media (max-width: 1100px) {
        .mobile-card-list .m-action-row:not(.mode-chungsuc) {
          grid-template-columns: minmax(0, .8fr) minmax(0, .8fr) minmax(0, 1fr) minmax(84px, 1.5fr);
        }
        .mobile-card-list .m-action-row.mode-chungsuc { grid-template-columns: minmax(0, 1fr) !important; }
        .mobile-card-list .m-btn-del {
          grid-column: 1 / -1; justify-self: end;
          width: auto; min-height: 44px; height: auto;
          margin-top: 6px; padding: 9px 14px; gap: 6px;
          font-size: .78rem; font-weight: 600;
        }
      }
      /* Compact centered storage picker. */
      .storage-picker-heading {
        max-width: 760px; margin: 8px auto 10px;
        justify-content: center; text-align: center; gap: 4px 12px;
      }
      #storage-switcher-bar { width: 100%; max-width: 760px; margin: 0 auto 24px; gap: 12px; }
      #storage-switcher-bar .storage-tab-btn,
      #storage-switcher-bar .storage-tab-btn.active,
      #storage-switcher-bar .storage-tab-btn.active#storage-tab-chungsuc {
        border-radius: 10px;
      }
      #storage-switcher-bar .storage-tab-btn {
        min-height: 80px; padding: 12px 14px;
        grid-template-columns: 34px minmax(0, 1fr) auto; column-gap: 10px;
      }
      #storage-switcher-bar .storage-tab-btn.active { padding: 11px 13px; }
      #storage-switcher-bar .storage-tab-icon { width: 34px; height: 34px; font-size: 1.1rem; }
      #storage-switcher-bar .storage-tab-title { font-size: .86rem; }
      #storage-switcher-bar .storage-tab-sub { font-size: .7rem; }
      @media (max-width: 600px) {
        .storage-picker-heading { gap: 4px; }
        #storage-switcher-bar { gap: 10px; }
        #storage-switcher-bar .storage-tab-btn {
          grid-template-columns: minmax(0, 1fr) auto;
          grid-template-rows: auto 1fr auto; min-height: 142px;
          padding: 12px; column-gap: 6px;
        }
        #storage-switcher-bar .storage-tab-btn.active { padding: 11px; }
        #storage-switcher-bar .storage-tab-title { font-size: .8rem; }
        #storage-switcher-bar .storage-tab-icon { width: 30px; height: 30px; }
      }
      @media (max-width: 600px) {
        .storage-picker-heading { margin: 4px auto 8px; gap: 2px; }
        .storage-picker-heading span { display: none; }
        #storage-switcher-bar { margin-bottom: 16px; gap: 8px; }
        #storage-switcher-bar .storage-tab-btn {
          min-height: 86px; padding: 10px;
          grid-template-columns: minmax(0, 1fr) auto;
          grid-template-rows: auto auto auto; gap: 5px 6px;
        }
        #storage-switcher-bar .storage-tab-btn.active { padding: 9px; }
        #storage-switcher-bar .storage-tab-icon {
          width: auto; height: auto; background: transparent;
          justify-content: flex-start; font-size: .9rem;
        }
        #storage-switcher-bar .storage-tab-title { font-size: .76rem; line-height: 1.4; }
        #storage-switcher-bar .storage-tab-sub { display: none; }
        #storage-switcher-bar .storage-tab-pill { font-size: .65rem; padding: 1px 6px; }
        #storage-switcher-bar .storage-tab-btn::after { font-size: .65rem; line-height: 1.4; }
      }
      .sync-status-bar { display: flex; align-items: center; justify-content: flex-end; flex-wrap: wrap; gap: 6px 10px; margin: -8px 0 14px; font-size: .74rem; color: var(--text-sub); }
      .sync-status-bar[data-state="error"], .sync-status-bar[data-state="offline"] { color: #f6c57b; }
      .sync-status-bar[data-state="saved"] { color: #78cdb1; }
      #sync-retry { padding: 5px 10px; border: 1px solid #86683e; border-radius: 7px; background: #332a1d; color: #ffe0ad; font: inherit; cursor: pointer; }
      #sync-retry:focus-visible { outline: 2px solid var(--border-focus); outline-offset: 3px; }
      @media (max-width: 600px) {
        .sync-status-bar { justify-content: flex-start; margin: 0 0 14px; }
        #sync-retry { min-height: 36px; }
        .m-creds-row { grid-template-columns: repeat(2, minmax(0, 1fr)); }
        .m-creds-row > *, .m-action-row > *, .m-history-row > * { min-width: 0; }
        .m-history-row { flex-wrap: wrap; gap: 5px 10px; }
        .m-history-row span { overflow-wrap: anywhere; }
        input:focus, textarea:focus, select:focus { scroll-margin-top: 20px; scroll-margin-bottom: 80px; }
        .modal-card input, .modal-card textarea, .modal-card select,
        #rawInput, #search-account-input, #defaultRank, #defaultUnlock, #defaultUyTin,
        .m-creds-row .tbl-input:focus, .m-action-row .tbl-input:focus { font-size: 16px !important; }
        .modal-overlay { top: var(--mobile-viewport-top, 0px); bottom: auto; height: var(--mobile-viewport-height, 100dvh); }
        .modal-overlay .modal-card:not(.modal-card-analytics) { max-height: calc(var(--mobile-viewport-height, 100dvh) - 24px); }
        #analytics-modal .modal-card-analytics { height: 100%; }
      }

/* Backup preview and mobile accessibility. */
.backup-version-select {width:100%; margin:12px 0; padding:10px; color:var(--text-main); background:var(--bg-card); border:1px solid var(--border-color); border-radius:8px; font-size:16px;}
#modal-msg {overflow-wrap:anywhere; text-align:left;}
#modal-msg p + p {margin-top:10px;}
#modal-msg ul {padding-left:20px; margin-top:8px;}
.backup-warning {color:#fbbf24;}
@media (max-width:600px) {
  .modal-overlay {padding:12px max(12px,env(safe-area-inset-right)) 12px max(12px,env(safe-area-inset-left));}
  .modal-btn-act {min-height:44px;}
  .option-menu-item {min-height:44px;}
}

@media (max-width: 600px) {
  .welcome-banner-overlay, .welcome-name-overlay, .device-gate-overlay {
    top:var(--mobile-viewport-top,0px); bottom:auto;
    height:var(--mobile-viewport-height,100dvh);
    padding:12px; overflow-y:auto;
  }
  .welcome-banner-card, .welcome-name-card, .device-gate-card {
    max-height:calc(var(--mobile-viewport-height,100dvh) - 24px);
    flex-shrink:0;
  }
  .welcome-banner-card input, .welcome-name-card input {font-size:16px;}
  .m-btn-copy, .btn-target-pill {min-height:44px;}
}

/* Keep overlays inside visualViewport on tablets and desktop zoom as well. */
.modal-overlay, .welcome-banner-overlay, .device-gate-overlay {
  top:var(--mobile-viewport-top,0px); bottom:auto;
  height:var(--mobile-viewport-height,100dvh);
}
.modal-overlay .modal-card:not(.modal-card-analytics), .welcome-banner-card, .device-gate-card {
  max-height:calc(var(--mobile-viewport-height,100dvh) - 24px);
}
#analytics-modal .modal-card-analytics {max-height:var(--mobile-viewport-height,100dvh);}

/* Primary add action: static gloss, with a single sweep on interaction. */
#input-container #btn-add {
  --add-top: #7663f1;
  --add-bottom: #4730c4;
  --add-shadow: #292060;
  position: relative;
  isolation: isolate;
  overflow: hidden;
  min-height: 44px;
  background: linear-gradient(180deg, var(--add-top), var(--add-bottom)) !important;
  border: 1px solid #bcb2ff !important;
  border-bottom: 1px solid var(--add-shadow) !important;
  box-shadow: 0 3px 0 var(--add-shadow), 0 5px 14px #0003, inset 0 1px 0 #ffffff70 !important;
  color: #fff !important;
  text-shadow: 0 1px 2px #0006;
  transform: none !important;
  filter: none !important;
  transition: filter .18s ease, transform .12s ease;
}
#input-container .add-form-grid.mode-chungsuc #btn-add {
  --add-top: #ca7a14;
  --add-bottom: #99500a;
  --add-shadow: #653607;
  border-color: #f5c574 !important;
}
#input-container #btn-add::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 48%;
  background: linear-gradient(180deg, #ffffff38, #ffffff05);
  border-radius: 9px 9px 45% 45%;
  pointer-events: none;
  z-index: 1;
}
#input-container #btn-add::after {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: auto;
  width: 55%;
  height: 100%;
  background: linear-gradient(100deg, transparent, #ffffff66, transparent);
  transform: translateX(-190%) skewX(-20deg);
  opacity: 0;
  pointer-events: none;
  z-index: 2;
  animation: none !important;
}
#input-container #btn-add:focus-visible {
  outline: 3px solid #e0d9ff;
  outline-offset: 4px;
}
#input-container #btn-add:active {
  transform: translateY(1px) !important;
  filter: brightness(.96) !important;
}
@keyframes addActionShine {
  0% { transform: translateX(-190%) skewX(-20deg); opacity: 0; }
  15% { opacity: .85; }
  85% { opacity: .85; }
  100% { transform: translateX(280%) skewX(-20deg); opacity: 0; }
}
@media (hover: hover) and (pointer: fine) {
  #input-container #btn-add:hover { filter: brightness(1.06) !important; }
}
@media (prefers-reduced-motion: no-preference) {
  #input-container #btn-add:is(:focus-visible, :active)::after {
    animation: addActionShine .75s ease-out 1 !important;
  }
}
@media (hover: hover) and (pointer: fine) and (prefers-reduced-motion: no-preference) {
  #input-container #btn-add:hover::after { animation: addActionShine .75s ease-out 1 !important; }
}
@media (prefers-reduced-motion: reduce) {
  #input-container #btn-add { transition: none; }
  #input-container #btn-add::after { animation: none !important; }
}
/* Mobile account entry: double the original 72px input height. */
@media (max-width: 600px) {
  #input-container #rawInput { height: 144px; min-height: 144px; }
}

/* Account entry: destination-colored boundary. */
#input-container {
  --entry-border: #24738a;
  --entry-accent: #22b8d6;
  --entry-surface: #101e2b;
}
#input-container:has(#btn-add-store-chungsuc.active) {
  --entry-border: #8b682a;
  --entry-accent: #f0b642;
  --entry-surface: #241f17;
}
.account-workspace > #input-container,
.account-workspace.has-admin-tools > #input-container {
  border: 1px solid var(--entry-border);
  border-radius: 12px;
  background: var(--entry-surface);
  box-shadow: inset 3px 0 0 var(--entry-accent);
  padding: 18px;
}
#input-container .add-box-content { padding-bottom: 0; }
@media (max-width: 600px) {
  .account-workspace > #input-container,
  .account-workspace.has-admin-tools > #input-container { padding: 14px; }
}
/* Transfer is a separate admin action, distinct from copy and delete. */
.btn-transfer-account {
  display:inline-flex; justify-content:center; align-items:center;
  max-width:100%; min-height:36px; padding:5px 7px; margin-bottom:6px;
  border:1px solid #86632e; border-radius:8px;
  background:#302719; color:#f5ce87; font-size:.68rem; font-weight:700;
  line-height:1.4; white-space:normal; overflow-wrap:anywhere; cursor:pointer;
}
.btn-transfer-account:focus-visible {outline:2px solid #f5ce87; outline-offset:3px;}
@media (hover:hover) and (pointer:fine) {
  .btn-transfer-account:hover {background:#47351e; border-color:#d6a44f;}
}
/* Primary mobile copy action shares a footer with the separate delete action. */
.mobile-card-list .m-admin-actions {
  grid-column:1 / -1; display:flex; align-items:stretch; justify-content:flex-end;
  gap:8px; min-width:0; padding-top:10px; margin-top:2px;
  border-top:1px solid var(--border-color);
}
.mobile-card-list .m-admin-actions .m-btn-copy {
  flex:1 1 0; width:auto; min-width:0; min-height:44px; height:auto;
  margin:0; padding:10px 12px; font-size:.84rem; font-weight:800;
}
.mobile-card-list .m-admin-actions .m-btn-copy:not(.btn-copy-locked):not(.copied) {
  background:linear-gradient(180deg,#6957e6,#4731b8) !important;
  border:1px solid #9c8cf2; box-shadow:inset 0 1px 0 #ffffff30;
}
.mobile-card-list .m-btn-transfer-compact {
  width:44px; min-width:44px; height:44px; min-height:44px;
  justify-self:end; align-self:center; margin:0; padding:0;
  font-size:1rem; line-height:1; background:transparent; border-color:#455167; color:#a9b5c8;
}
@media (max-width:1100px) {
  .mobile-card-list .m-action-row:not(.mode-chungsuc):not(.no-admin) {
    grid-template-columns:repeat(3,minmax(0,1fr)) 44px;
    align-items:center;
  }
}
.mobile-card-list .m-admin-actions .m-btn-del,
.mobile-card-list .m-admin-actions .m-btn-remove-recent {
  flex:0 0 auto; width:auto; min-height:44px; height:auto;
  margin:0; padding:8px 10px; font-size:.74rem;
  display:inline-flex; align-items:center; justify-content:center; gap:5px;
}


/* Desktop column actions share the space freed from rank and metadata. */
.desktop-admin-actions {display:flex; align-items:center; justify-content:center; gap:6px; min-width:0;}
.desktop-admin-actions .btn-transfer-account {
  flex:0 0 32px; width:32px; min-width:32px; min-height:36px;
  margin:0; padding:0; font-size:1rem; line-height:1;
  background:transparent; border-color:#455167; color:#a9b5c8;
}
@media (hover:hover) and (pointer:fine) {
  .desktop-admin-actions .btn-transfer-account:hover {background:#263044; border-color:#8492aa; color:#fff;}
}
.desktop-admin-actions .btn-del-action, .desktop-admin-actions .btn-remove-recent {flex:0 0 auto;}
@media (min-width:1101px) {
  .desktop-table-wrap .acc-table .btn-copy-action {width:100%; min-height:36px; padding:7px 6px;}
}

/* Explicit physical-device groups retain separate browser permissions. */
.device-groups {display:flex; flex-direction:column; gap:12px;}
.device-physical-group {border:1px solid #46536b; border-radius:10px; padding:10px; display:flex; flex-direction:column; gap:8px; min-width:0;}
.device-group-heading {display:flex; flex-wrap:wrap; align-items:center; gap:8px; font-size:.76rem; color:#aab8cd;}
.device-group-heading label {display:flex; align-items:center; gap:8px; min-height:40px; color:#eef2ff; cursor:pointer; overflow-wrap:anywhere;}
.device-group-select {width:20px; height:20px; flex-shrink:0; accent-color:#8b7bec;}
.physical-device-name {display:block; width:100%; margin:8px 0; padding:10px; border:1px solid #66748e; border-radius:8px; background:#111b2c; color:#fff; font-size:16px;}
#device-modal #device-modal-stat {overflow-wrap:anywhere;}

#device-modal .modal-card > div:has(> #device-modal-stat) {flex-wrap:wrap; gap:8px;}
#device-modal-stat + div {flex-wrap:wrap;}

/* Admin history is separate from customer activity notifications. */
#admin-audit-modal > .audit-card {width:100%; max-width:min(760px,calc(100vw - 24px)) !important; text-align:left;}
.audit-heading,.audit-entry-title {display:flex; justify-content:space-between; align-items:center; gap:10px; flex-wrap:wrap;}
.audit-description,#admin-audit-status {color:var(--text-sub); font-size:.76rem; margin:10px 0;}
.audit-tools {display:flex; flex-wrap:wrap; gap:8px; margin:12px 0;}
.audit-tools input,.audit-tools select {min-width:0; max-width:100%; padding:9px; border:1px solid #48566e; background:#111b2b; color:#fff; border-radius:8px;}
.audit-tools input {flex:1 1 220px;}
.audit-list {display:flex; flex-direction:column; gap:10px;}
.audit-entry {padding:12px; border:1px solid #35445c; border-radius:10px; background:#101a2b; overflow-wrap:anywhere; font-size:.78rem;}
.audit-entry p {margin-top:5px; color:#b6c4d9;}
.audit-entry time {font-size:.7rem; color:#a3b2c8;}
@media(max-width:600px){.audit-tools input,.audit-tools select{font-size:16px;}.audit-tools>*{min-height:44px;}}

/* Gentle entrance: once per document, independent of list and cloud updates. */
@keyframes pageContentReveal {
  from { opacity: 0; }
  to { opacity: 1; }
}
@keyframes greetingContentReveal {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}
@media (prefers-reduced-motion: no-preference) {
  .page-ready .app-layout > header {
    animation: pageContentReveal 280ms ease-out 0ms 1 backwards;
  }
  .page-ready .app-layout > #user-greeting-bar {
    animation: greetingContentReveal 300ms ease-out 30ms 1 backwards;
  }
  .page-ready .app-layout > #account-workspace {
    animation: pageContentReveal 320ms ease-out 50ms 1 backwards;
  }
  .page-ready .app-layout > .app-footer {
    animation: pageContentReveal 300ms ease-out 70ms 1 backwards;
  }
}
/* Selected header 01: cyan silk aurora, without clipping fixed menus. */
.app-layout > header {
  position:relative; background:linear-gradient(110deg,#0b192c,#102c39 55%,#131a2c);
  border:1px solid #285365; border-radius:14px; padding:18px 20px;
}
#header-aurora {position:absolute;inset:0;width:100%;height:100%;border-radius:13px;pointer-events:none;z-index:0;}
.app-layout > header > :not(#header-aurora):not(.header-combined-motion) {position:relative;z-index:1;}
@media(max-width:600px){.app-layout > header {padding:14px 12px;}}

/* Compact rank-group counts: total first, then remaining unban notes. */
.rank-group-total,.rank-group-unban-note {
  display:inline-flex; align-items:center; justify-content:center; gap:5px;
  padding:3px 7px; border-radius:6px; line-height:1.4;
  font-size:.7rem; white-space:nowrap;
}
.rank-group-total {background:#0a112780; color:#c9d4e5; font-weight:700;}
.rank-group-unban-note {background:#15443788; color:#a0e6c9; border:1px solid #36756380; font-weight:500;}
.rank-group-unban-note b {font-weight:800; color:#bdffe0; font-variant-numeric:tabular-nums;}
.rank-group-heading {flex-wrap:wrap; gap:7px 12px;}
.rank-group-status-summary {flex-wrap:wrap; min-width:0; margin-left:auto; justify-content:flex-end;}
.rank-group-heading .rank-group-title {min-width:0; flex-wrap:wrap;}
.mobile-card-list .clickable-group-banner {flex-wrap:wrap; gap:7px;}
@media(max-width:600px){.rank-group-total,.rank-group-unban-note {font-size:.65rem; padding:3px 6px;}}

/* Server backup adds a third action; let the row wrap on narrow dialogs. */
#cloud-modal .cloud-backup-actions{flex-wrap:wrap}
#cloud-modal .cloud-backup-actions>.btn{flex:1 1 150px!important;min-width:0;max-width:100%;white-space:normal;overflow-wrap:anywhere;min-height:44px}
