/* Adminova mobile polish. Loaded after responsive.css by design. */
@media (max-width: 599px), (max-width: 999px) and (max-height: 599px) {
  :root {
    --vk-mobile-nav: 64px;
    --mobile-gutter: 12px;
    --mobile-radius: 14px;
    --mobile-divider: color-mix(in srgb, var(--border) 72%, transparent);
  }

  body {
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
  }

  .app { background: var(--bg2); }

  /* App bar */
  .vk-topbar {
    background: color-mix(in srgb, var(--surface) 94%, transparent) !important;
    border-bottom-color: var(--mobile-divider);
    box-shadow: 0 1px 0 rgba(0,0,0,.08);
    backdrop-filter: saturate(160%) blur(18px);
    -webkit-backdrop-filter: saturate(160%) blur(18px);
  }
  .vk-mark {
    width: 32px; height: 32px; border-radius: 10px;
    box-shadow: 0 2px 8px rgba(0,0,0,.18);
  }
  .vk-topbar-section {
    font-size: 16px; font-weight: 650; letter-spacing: -.18px;
  }
  .vk-topbar-community { padding-right: 10px; }
  .vk-topbar-community-ava {
    width: 32px; height: 32px;
    box-shadow: 0 0 0 1px var(--mobile-divider);
  }

  /* Bottom navigation */
  .sidebar {
    background: color-mix(in srgb, var(--surface) 94%, transparent) !important;
    border-top-color: var(--mobile-divider) !important;
    box-shadow: 0 -8px 28px rgba(0,0,0,.10);
    transition: transform .22s ease, visibility .22s ease;
  }
  .snav { padding-inline: 3px !important; }
  .snav-btn {
    position: relative; color: var(--muted) !important;
    font-size: 10px !important; font-weight: 500 !important;
    letter-spacing: -.05px;
  }
  .snav-btn i {
    width: 38px; height: 28px; border-radius: 15px;
    display: flex; align-items: center; justify-content: center;
    font-size: 21px !important;
    transition: color .16s ease, background .16s ease, transform .16s ease;
  }
  .snav-btn.active { color: var(--accent) !important; background: transparent !important; }
  .snav-btn.active i { background: var(--accent-soft); transform: translateY(-1px); }
  .snav-btn:active i { transform: scale(.92); }
  .snav-badge {
    inset-block-start: 2px !important; inset-inline-start: calc(50% + 7px) !important;
    border: 2px solid var(--surface); line-height: 1;
  }

  /* Dialog list */
  .list-pane { background: var(--surface) !important; }
  .list-pane > div:first-child {
    min-height: 52px; padding: 12px 14px 8px !important;
  }
  .list-pane > div:first-child h1 {
    margin: 0; font-size: 20px !important; font-weight: 700 !important;
    letter-spacing: -.32px;
  }
  .list-pane > div:first-child .icon-btn { width: 36px !important; height: 36px !important; }
  .list-pane > div:nth-child(2) { padding: 0 12px 10px !important; }
  .list-pane > div:nth-child(2) > div {
    min-height: 38px; padding: 8px 12px !important; border-radius: 10px !important;
    box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--border) 42%, transparent);
  }
  #dlgSearchInp { font-size: 16px !important; }
  #dlgFilterRow {
    gap: 7px !important; padding: 0 12px 10px !important;
    border-bottom: 1px solid var(--mobile-divider);
  }
  #dlgFilterRow .ftab {
    min-height: 32px; padding: 6px 12px !important; border-radius: 10px !important;
    background: var(--surface2); color: var(--muted); font-size: 12.5px !important;
  }
  #dlgFilterRow .ftab.active { background: var(--accent-soft); color: var(--accent); }
  .dialog-list { padding: 2px 0 12px !important; }
  .dialog-row {
    min-height: 68px; margin: 0 !important; padding: 9px 12px !important;
    gap: 10px; border-radius: 0 !important; position: relative;
    transition: background .12s ease;
  }
  .dialog-row::after {
    content: ''; position: absolute; inset: auto 12px 0 70px; height: 1px;
    background: var(--mobile-divider);
  }
  .dialog-row:last-child::after { display: none; }
  .dialog-row.active { background: var(--accent-soft) !important; }
  .dlg-photo, .dlg-initials { width: 48px !important; height: 48px !important; }
  .dlg-name { font-size: 14.5px !important; line-height: 1.25; letter-spacing: -.1px; }
  .dlg-preview { margin-top: 4px; color: var(--muted); font-size: 13px !important; }
  .dlg-time { font-size: 11px; }
  .dlg-unread { min-width: 20px; height: 20px; padding-inline: 6px; }
  .dlg-labels { margin-top: 5px; gap: 4px; }
  .dlg-label-tag { padding: 2px 7px; border-radius: 6px; font-size: 10px; }

  /* Conversation */
  .content-pane { background: var(--chat-base) !important; }
  .chat-hdr {
    min-height: 54px; padding: 7px 10px !important; gap: 8px !important;
    background: color-mix(in srgb, var(--surface) 96%, transparent) !important;
    border-bottom-color: var(--mobile-divider) !important;
    backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px);
  }
  .chat-back {
    width: 38px; height: 38px; margin-left: -3px; border-radius: 50%;
    color: var(--accent); background: transparent;
  }
  .chat-back i { font-size: 22px; }
  .chat-hdr-ava { width: 38px !important; height: 38px !important; }
  .chat-hdr-name { font-size: 14.5px !important; font-weight: 650 !important; }
  .chat-hdr-status { font-size: 11.5px !important; }
  .chat-hdr-actions .icon-btn { color: var(--muted); background: transparent; }
  .chat-hdr-actions .icon-btn:active { background: var(--surface2); }
  .chat-history {
    padding: 14px 10px 18px !important;
    scroll-padding-bottom: 16px;
  }
  .chat-inner { gap: 2px; }
  .msg-row { max-width: 84% !important; gap: 0; }
  .msg-ava { display: none; }
  .msg-bubble {
    padding: 8px 11px; border-radius: 17px !important;
    font-size: 14px !important; line-height: 1.36 !important;
    letter-spacing: -.08px;
  }
  .msg-row.in .msg-bubble {
    border-bottom-left-radius: 5px !important;
    box-shadow: 0 1px 2px rgba(0,0,0,.08);
  }
  .msg-row.out .msg-bubble {
    border-bottom-right-radius: 5px !important;
    background: #447bba;
  }
  .msg-meta { margin-left: 6px; font-size: 10px; }
  .msg-photo { width: min(210px, 64vw); height: min(210px, 64vw); border-radius: 12px; }
  .date-separator span {
    padding: 4px 9px; border: 1px solid var(--mobile-divider);
    box-shadow: 0 2px 8px rgba(0,0,0,.08);
  }
  .chat-composer {
    min-height: 58px; padding: 8px 8px max(8px, env(safe-area-inset-bottom, 0px)) !important;
    gap: 5px !important; border-top-color: var(--mobile-divider) !important;
    background: color-mix(in srgb, var(--surface) 96%, transparent) !important;
    backdrop-filter: saturate(150%) blur(18px); -webkit-backdrop-filter: saturate(150%) blur(18px);
  }
  .chat-composer > .tmpl-btn { width: 38px !important; height: 38px !important; }
  .composer-area {
    min-height: 40px; padding: 7px 10px 7px 13px !important;
    border: 1px solid var(--mobile-divider); border-radius: 20px !important;
    background: var(--input-bg) !important;
  }
  .composer-area:focus-within { border-color: color-mix(in srgb, var(--accent) 65%, var(--border)); }
  .composer-inp { font-size: 16px !important; line-height: 1.35; }
  .send-btn { width: 40px !important; height: 40px !important; border-radius: 50% !important; }
  .emoji-panel {
    inset: auto 8px 66px !important; width: auto !important;
    height: min(430px, calc(100% - 82px)); border-radius: 16px !important;
  }
  .attach-panel {
    left: 8px; right: 8px; bottom: 64px; width: auto;
    border-radius: 16px; box-shadow: 0 18px 48px rgba(0,0,0,.32);
  }
  .reply-bar, .pending-area { background: var(--surface); }

  /* Wall and events */
  .wall-head-inner { padding: 12px 12px 10px !important; gap: 9px; }
  .wall-head-bottom { gap: 8px; }
  .wall-tabs { flex: 1; overflow-x: auto; }
  .wtab { min-height: 32px; padding: 6px 11px; border-radius: 10px !important; font-size: 12px; }
  .wall-create-btn { min-height: 34px; padding: 0 11px; white-space: nowrap; }
  .wall-feed { padding: 8px 8px 24px !important; gap: 8px; }
  .wall-card {
    border: 1px solid var(--mobile-divider) !important; border-radius: var(--mobile-radius) !important;
    background: var(--surface) !important; box-shadow: 0 1px 2px rgba(0,0,0,.06);
  }
  .wc-inner { padding: 12px; }
  .wc-ava-wrap { width: 40px; height: 40px; }
  .wall-photos { border-radius: 10px; }
  .notif-head { min-height: 62px; padding: 12px 14px; }
  .notif-scroll { padding: 8px; gap: 7px; }
  .notif-item {
    padding: 12px; border: 1px solid var(--mobile-divider); border-radius: var(--mobile-radius) !important;
    background: var(--surface);
  }

  /* Statistics */
  .stats-head { padding: 12px !important; gap: 9px; }
  .stats-title { font-size: 19px !important; letter-spacing: -.25px; }
  .stats-period-tabs { gap: 5px; }
  .sptab { min-height: 32px; padding: 6px 11px; border-radius: 10px; font-size: 12px; }
  .stats-dl-btn { min-height: 34px; padding-inline: 10px; }
  .stats-cards-row { gap: 8px !important; padding: 10px 10px 2px !important; }
  .stat-card {
    min-height: 78px; padding: 12px !important;
    border: 1px solid var(--mobile-divider); border-radius: var(--mobile-radius);
    background: var(--surface);
  }
  .stat-num { font-size: 20px; }
  .chart-card, .demo-card {
    margin: 8px 8px 0 !important; padding: 13px !important;
    border: 1px solid var(--mobile-divider) !important; border-radius: var(--mobile-radius) !important;
    background: var(--surface);
  }

  /* Settings */
  .settings-pane { gap: 12px; padding-bottom: 18px; }
  .settings-head-bar {
    min-height: 52px; padding: 14px 16px !important;
    font-size: 19px !important; font-weight: 700 !important; letter-spacing: -.25px;
  }
  .settings-pane > .settings-group, .settings-pane > .settings-danger {
    margin: 0 10px !important; border: 1px solid var(--mobile-divider) !important;
    border-radius: var(--mobile-radius) !important; background: var(--surface);
  }
  .settings-pane > .settings-group:first-of-type { margin-top: 2px !important; }
  .settings-group-title { padding: 11px 14px 7px; font-size: 10.5px; }
  .settings-row { min-height: 54px; padding: 10px 14px; }
  .settings-row-label { font-size: 14px; }
  .theme-option { min-height: 60px; padding: 10px 12px; }
  .settings-logout { min-height: 44px; border-radius: 12px; }

  /* Contact and action sheets */
  .profile-pane { background: var(--surface) !important; }
  .profile-close-btn {
    top: 10px; right: 10px; width: 38px; height: 38px; border-radius: 50%;
    background: var(--surface2); z-index: 2;
  }
  .orbit-overlay { background: rgba(0,0,0,.56); backdrop-filter: blur(4px); }
  .orbit-modal { box-shadow: 0 -18px 60px rgba(0,0,0,.35); }

  /* Authentication */
  .login-screen { padding: max(18px, env(safe-area-inset-top)) 16px max(18px, env(safe-area-inset-bottom)); }
  .login-card {
    width: 100%; max-width: 390px; padding: 30px 22px;
    border-radius: 24px; background: color-mix(in srgb, var(--surface) 96%, transparent);
    box-shadow: 0 24px 70px rgba(0,0,0,.28);
  }
  .login-app-name { font-size: 24px; letter-spacing: -.4px; }
  .login-tagline { max-width: 270px; margin-bottom: 24px; font-size: 13px; line-height: 1.45; }
  .login-vk-btn { min-height: 48px; border-radius: 13px; box-shadow: 0 5px 18px rgba(0,119,255,.25); }
}

@media (max-width: 767px), (max-width: 999px) and (max-height: 599px) {
  html.preview-iphone {
    --iphone-safe-top: 0px;
    --iphone-safe-bottom: 0px;
    --iphone-safe-left: 0px;
    --iphone-safe-right: 0px;
    --vk-topbar: calc(48px + var(--iphone-safe-top));
  }
  html.preview-iphone .vk-topbar { padding-top: var(--iphone-safe-top); }
  html.preview-iphone .vk-topbar { padding-inline: var(--iphone-safe-left) var(--iphone-safe-right); }
  html.preview-iphone .app,
  html.preview-iphone .app.profile-open {
    padding-bottom: calc(var(--vk-mobile-nav) + var(--iphone-safe-bottom));
  }
  html.preview-iphone .sidebar {
    height: calc(var(--vk-mobile-nav) + var(--iphone-safe-bottom)) !important;
    padding-bottom: var(--iphone-safe-bottom) !important;
  }
  html.preview-iphone .content-pane,
  html.preview-iphone .profile-pane {
    inset-block-end: calc(var(--vk-mobile-nav) + var(--iphone-safe-bottom)) !important;
  }
  html.preview-iphone .app.mobile-detail-open .content-pane,
  html.preview-iphone .app.mobile-detail-open .profile-pane { inset-block-end: 0 !important; }
  html.preview-iphone .chat-composer { padding-bottom: var(--iphone-safe-bottom) !important; }
  html.preview-iphone .list-pane,
  html.preview-iphone .content-pane,
  html.preview-iphone .profile-pane {
    inset-inline-start: var(--iphone-safe-left) !important;
    inset-inline-end: var(--iphone-safe-right) !important;
    width: auto !important;
  }
}

@media (max-width: 767px), (max-width: 999px) and (max-height: 599px) {
  html.platform-android {
    --mobile-radius: 18px;
    font-family: Roboto, "Noto Sans", "Segoe UI", sans-serif;
  }
  html.platform-android .vk-mark,
  html.platform-android .vk-topbar-community-ava { border-radius: 50%; }
  html.platform-android .snav-btn i { border-radius: 18px; }
  html.platform-android .snav-btn.active i { width: 44px; background: color-mix(in srgb,var(--accent) 20%,transparent); }
  html.platform-android .dialog-row:active,
  html.platform-android .settings-row:active,
  html.platform-android .notif-item:active { background: var(--surface2); }
  html.platform-android .composer-area { border-radius: 24px !important; }
  html.platform-android .send-btn { border-radius: 14px !important; }
  html.platform-android .orbit-modal { border-radius: 28px 28px 0 0; }
  html.platform-android .chat-back { touch-action: manipulation; }

  html.preview-android {
    --android-safe-top: 28px;
    --android-safe-bottom: 24px;
    --vk-topbar: calc(48px + var(--android-safe-top));
  }
  html.preview-android.android-nav-buttons { --android-safe-bottom: 48px; }
  html.preview-android .vk-topbar { padding-top: var(--android-safe-top); }
  html.preview-android .app,
  html.preview-android .app.profile-open {
    padding-bottom: calc(var(--vk-mobile-nav) + var(--android-safe-bottom));
  }
  html.preview-android .sidebar {
    height: calc(var(--vk-mobile-nav) + var(--android-safe-bottom)) !important;
    padding-bottom: var(--android-safe-bottom) !important;
  }
  html.preview-android.android-nav-buttons .sidebar {
    background: color-mix(in srgb,var(--surface) 86%,transparent) !important;
  }
  html.preview-android .content-pane,
  html.preview-android .profile-pane {
    inset-block-end: calc(var(--vk-mobile-nav) + var(--android-safe-bottom)) !important;
  }
  html.preview-android .app.mobile-detail-open .content-pane,
  html.preview-android .app.mobile-detail-open .profile-pane { inset-block-end: 0 !important; }
  html.preview-android .chat-composer { padding-bottom: var(--android-safe-bottom) !important; }
}

@media (max-width: 370px) {
  .snav-btn { font-size: 9px !important; }
  .snav-btn i { width: 34px; }
  .chat-hdr-actions #chatMenuBtn { display: none !important; }
  .chat-composer > #tmplToggleBtn { display: none !important; }
  .wall-create-btn { font-size: 0; width: 36px; padding: 0; justify-content: center; }
  .wall-create-btn i { font-size: 16px; }
}

@media (max-width: 999px) and (max-height: 500px) and (orientation: landscape) {
  :root { --vk-mobile-nav: 50px; }
  .snav-btn i { height: 34px; }
  .chat-history { padding-block: 8px !important; }
  .chat-composer { min-height: 50px; padding-block: 5px !important; }
}
