/* Mobile application shell. Desktop keeps its existing layout. */
.mobile-header,.mobile-tabs,.mobile-close,.mobile-backdrop { display:none; }
.mobile-overview,.mobile-primary-actions,.mobile-site-menu { display:none; }
:focus-visible { outline:2px solid var(--accent); outline-offset:3px; }
@media (max-width: 800px) {
  body { -webkit-text-size-adjust:100%; }
  .layout { display:block; min-height:100dvh; }
  .mobile-header { display:flex; align-items:center; gap:10px; position:sticky; top:0; z-index:70; padding:10px 16px; padding-top:max(10px,env(safe-area-inset-top)); background:rgba(255,255,255,.97); border-bottom:1px solid var(--line); }
  .mobile-header strong { color:var(--accent-ink); font-size:12px; letter-spacing:.06em; }
  .mobile-header small { display:block; font-size:10px; font-weight:500; letter-spacing:0; color:var(--dim); }
  .mobile-header .mobile-menu-btn { margin-left:auto; }
  .mobile-menu-btn,.mobile-close { border:0; background:var(--accent-soft); color:var(--accent-ink); border-radius:12px; min-width:44px; min-height:44px; display:grid; place-content:center; }
  .mobile-tabs { display:flex; position:fixed; bottom:0; inset-inline:0; padding:6px 8px max(6px,env(safe-area-inset-bottom)); background:#fff; border-top:1px solid var(--line); box-shadow:0 -4px 24px #0f1f1708; z-index:75; }
  .mobile-tabs a,.mobile-tabs button { flex:1; min-width:0; min-height:54px; display:flex; flex-direction:column; justify-content:center; align-items:center; gap:4px; font-size:11px; font-weight:600; color:var(--dim); border:0; border-radius:12px; background:transparent; }
  .mobile-tabs .ic { width:21px; height:21px; }
  .mobile-tabs .active { color:var(--accent-ink); background:var(--accent-soft); }
  .main { width:100%; padding:20px 16px calc(88px + env(safe-area-inset-bottom)); }
  body .sidebar,body.nav-folded .sidebar { position:fixed; top:0; left:0; height:100dvh; width:min(320px,88vw); padding:20px 16px max(20px,env(safe-area-inset-bottom)); z-index:100; overflow-y:auto; overscroll-behavior:contain; visibility:hidden; transform:translateX(-100%); transition:transform .2s,visibility .2s; }
  body.mobile-nav-open { overflow:hidden; }
  body.mobile-nav-open .sidebar { visibility:visible; transform:translateX(0); }
  body.nav-folded .brand { justify-content:flex-start; padding:2px 8px 22px; }
  body.nav-folded .brand>div { display:block; }
  body.nav-folded .sidebar nav a,body.nav-folded .sidebar-foot a { justify-content:flex-start; font-size:14px; padding:12px; gap:11px; }
  body.nav-folded .sidebar .badge-red { position:static; font-size:11px; padding:1px 7px; }
  body.nav-folded .sidebar .who { display:inline; font-size:11px; overflow-wrap:anywhere; }
  body.nav-folded .lang-switch { justify-content:flex-start; }
  .sidebar .nav-toggle { display:none; }
  .mobile-close { display:grid; position:absolute; right:12px; top:16px; }
  .sidebar .brand { padding-right:40px; }
  .sidebar nav a,.sidebar-foot a { min-height:44px; }
  .sidebar-foot { padding-top:20px; }
  .mobile-backdrop:not([hidden]) { display:block; position:fixed; inset:0; z-index:90; border:0; background:#0b231980; backdrop-filter:blur(3px); }
  .page-head { margin-bottom:20px; gap:16px; }
  .page-head h1 { font-size:26px; }
  .page-head p { font-size:13px; }
  .head-actions,.card-tools { width:100%; flex-wrap:wrap; gap:8px; }
  .head-actions form { flex:1; }
  .head-actions form .btn { width:100%; justify-content:center; }
  .head-search,.head-search input,.search-input { width:100%; }
  .btn,.btn-xs,.page-btn,.dim-tab,.sel-sm { min-height:44px; }
  .btn { justify-content:center; }
  input:not([type=checkbox]):not([type=radio]),select,textarea { font-size:16px!important; max-width:100%; min-height:44px; }
  .card { padding:14px; border-radius:16px; }
  .card-head { gap:12px; }
  .two-col,.two-col .grow { width:100%; }
  .hero-grid,.hero-grid.bots,.stat-grid { grid-template-columns:repeat(2,minmax(0,1fr)); gap:10px; }
  .hero { padding:14px; min-height:126px; gap:8px; flex-wrap:wrap; align-content:center; }
  .hero .hero-ico { width:30px; height:30px; }
  .hero strong { font-size:30px; }
  .hero small { white-space:normal; font-size:11px; }
  .hero .ring { display:none; }
  .hero .chip { font-size:10px; }
  .stat-card { padding:12px; gap:8px; flex-wrap:wrap; }
  .stat-card strong { font-size:24px; }
  .settings-grid,.shot-grid { grid-template-columns:minmax(0,1fr); }
  .add-form-row { flex-direction:column; }
  .add-form-row input { flex:auto; width:100%; }
  .filter-bar { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:12px; }
  .fb-item { min-width:0; }
  .fb-range input { width:calc(50% - 8px); min-width:0; }
  .pager-pages { flex-wrap:wrap; }
  .page-btn { min-width:36px; }
  .table-wrap { max-width:100%; overscroll-behavior-x:contain; }
  .sites-edit,.sites-edit tbody { display:block; }
  .sites-edit thead { display:none; }
  .sites-edit tbody tr { display:block; border:1px solid var(--line); border-radius:14px; padding:12px; margin-bottom:12px; background:#fafcfb; }
  .sites-edit td { display:block; border:0; padding:6px 0; overflow-wrap:anywhere; }
  .sites-edit .site-cell { max-width:100%; font-size:15px; }
  .sites-edit .inline-edit { display:grid; grid-template-columns:minmax(0,1fr) 64px; gap:8px; }
  .sites-edit .inline-edit input { width:100%; min-width:0; height:44px; }
  .sites-edit .ie-url,.sites-edit .ie-group { grid-column:1/-1; }
  .sites-edit .btn-save { grid-column:1/-1; }
  .sites-edit td.row-actions { display:flex; justify-content:flex-end; gap:8px; margin-top:8px; border-top:1px solid var(--line); padding-top:12px; }
  .sites-edit .row-actions .btn-xs { width:44px; height:44px; }
  .sites-edit .row-actions form { margin:0; }
  .at-foot { flex-wrap:wrap; gap:12px; }
  .at-meta { margin-right:0; padding-right:12px; min-width:0; }
  .at-head,.at-site { min-width:0; overflow-wrap:anywhere; }
  .login-card { width:calc(100% - 32px); max-width:400px; padding:24px; }
  .menu { max-width:calc(100vw - 40px); }
  body.readonly .sites-edit td.row-actions { display:none; }
}
.mobile-sort { display:none; }
@media (max-width:800px) {
  .hero-stack,.hero-total { grid-column:1/-1; }
  .mobile-sort { display:flex; align-items:center; gap:12px; font-size:12px; font-weight:600; color:var(--dim); margin:0 0 14px; }
  .mobile-sort select { flex:1; min-width:0; border:1px solid var(--line); border-radius:10px; background:#fff; padding:8px; color:var(--ink); }
  #sites-table,#sites-table tbody { display:block; }
  #sites-table thead { display:none; }
  #sites-table tbody tr { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); border:1px solid var(--line); border-radius:14px; padding:12px; margin-bottom:12px; gap:10px; }
  #sites-table td { display:block; min-width:0; border:0; padding:0; overflow-wrap:anywhere; }
  #sites-table td.row-num { display:none; }
  #sites-table td:nth-child(2),#sites-table td:nth-child(3),#sites-table td[data-col=check],#sites-table td.row-actions { grid-column:1/-1; }
  #sites-table td[data-col]::before { content:attr(data-mobile-label); display:block; font-size:10px; text-transform:uppercase; letter-spacing:.04em; font-weight:600; color:var(--dim); margin-bottom:4px; }
  #sites-table .site-cell { max-width:100%; }
  #sites-table .site-link { display:inline; font-size:15px; }
  #sites-table .site-link .ic { display:none; }
  #sites-table .row-actions .btn { min-width:44px; }
  #sites-table .row-actions { border-top:1px solid var(--line); padding-top:10px; text-align:right; }
  .add-panel.card { padding:0; }
  .hero-stack .row { flex-wrap:wrap; }
}
@media (max-width:800px) {
  .hero .chip { max-width:100%; white-space:normal; overflow-wrap:anywhere; }
  .hero-body { min-width:70px; }
}
@media (min-width:801px) and (max-width:1400px) {
  .hero-grid { grid-template-columns:repeat(2,minmax(0,1fr)); }
  .hero-stack .row { flex-wrap:wrap; }
}
.mobile-row-toggle,.mobile-refine-toggle { display:none; }
.mobile-refinements { display:contents; }
@media(max-width:800px) {
  .fleet-card.card { padding:0; border:0; background:transparent; box-shadow:none; }
  .fleet-card>.card-head { margin-bottom:12px; }
  .fleet-card .card-tools { display:grid; grid-template-columns:minmax(0,1fr) auto; gap:8px; }
  .fleet-card .head-search input { width:100%; padding-left:32px; box-shadow:none; }
  .mobile-refine-toggle { display:flex; padding:8px 12px; font-size:12px; box-shadow:none; }
  .mobile-refine-toggle[aria-expanded=true] { background:var(--accent-soft); border-color:var(--accent); }
  .mobile-refinements { display:none; }
  .mobile-refinements.expanded { display:flex; flex-wrap:wrap; gap:8px; padding:12px; background:white; border:1px solid var(--line); border-radius:12px; margin-bottom:12px; }
  .mobile-refinements .filter-bar,.mobile-refinements .mobile-sort { width:100%; margin:0; }
  .mobile-refinements .mobile-sort { margin-top:4px; }
  #sites-table tbody tr { grid-template-columns:repeat(4,minmax(0,1fr)); gap:10px 8px; padding:14px 14px 0; margin-bottom:10px; border-radius:14px; background:white; }
  #sites-table td:nth-child(2) { grid-column:1/-1; }
  #sites-table td:nth-child(3) { grid-column:1/-1; }
  #sites-table td[data-col] { font-size:16px; font-weight:600; }
  #sites-table td[data-col]::before { font-size:9px; letter-spacing:.01em; margin-bottom:3px; font-weight:500; text-transform:none; }
  #sites-table .site-link { font-size:15px; font-weight:700; }
  #sites-table .flag { width:18px; height:18px; margin-right:8px; }
  #sites-table .pill { font-size:10px; padding:2px 8px; }
  #sites-table .http-code { font-size:10px; }
  #sites-table .light { width:7px; height:7px; box-shadow:none; }
  #sites-table td[data-col=traffic] .spark { display:none; }
  #sites-table tbody tr:not(.details-open) td:is([data-col=shot],[data-col=check],.row-actions) { display:none; }
  #sites-table td.mobile-row-toggle { display:block; grid-column:1/-1; border-top:1px solid var(--line); }
  .site-details-btn { width:100%; min-height:44px; border:0; background:transparent; color:var(--dim); text-align:left; padding:0; font-size:11px; font-weight:600; }
  #sites-table tr.details-open td[data-col=shot] { grid-column:1/3; }
  #sites-table tr.details-open td[data-col=check] { grid-column:3/5; font-size:11px; font-weight:400; align-self:center; }
  #sites-table tr.details-open td.row-actions { grid-column:1/-1; padding-top:8px; }
  #sites-table .thumb { width:100%; max-width:130px; height:68px; }
  .fleet-card .pager { background:#fff; padding:12px; border:1px solid var(--line); border-radius:12px; }
}
@media (max-width:800px) {
  body { background:#f8fbfa; }
  .main { padding:18px 16px calc(88px + env(safe-area-inset-bottom)); }
  .mobile-header { min-height:64px; gap:10px; background:#fff; box-shadow:0 2px 12px #0f1f1708; }
  .mobile-header>img { width:38px; height:38px; }
  .mobile-header strong { font-size:14px; line-height:1.2; }
  .mobile-header small { font-size:11px; margin-top:2px; }
  .mobile-header-bell,.mobile-avatar { display:grid; place-items:center; min-width:44px; min-height:44px; color:var(--accent-ink); }
  .mobile-header-bell { margin-left:auto; }
  .mobile-header-bell .ic { width:23px; height:23px; }
  .mobile-avatar { border-radius:50%; background:var(--accent-soft); font-weight:700; }
  .mobile-header>.mobile-menu-btn { display:none; }
  .page-head { margin-bottom:16px; }
  .page-head h1 { font-size:28px; line-height:1.15; }
  .page-head p { font-size:14px; line-height:1.4; }
  .page-head .head-actions { display:none; }
  .mobile-overview { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:8px; margin-bottom:14px; }
  .mobile-overview-card { min-width:0; display:grid; grid-template-columns:32px 1fr; grid-template-rows:auto auto; align-items:center; gap:0 6px; padding:12px 8px; background:#fff; border:1px solid #dce5e1; border-radius:13px; box-shadow:var(--shadow-card); }
  .mobile-overview-card .ic,.mobile-overview-dot { grid-row:1/3; width:30px; height:30px; padding:7px; border-radius:50%; background:#e8f5ee; color:var(--accent); }
  .mobile-overview-card:nth-child(3) .ic { background:#fff2d9; color:var(--orange); }
  .mobile-overview-dot::after { content:''; display:block; width:14px; height:14px; border-radius:50%; background:var(--accent); }
  .mobile-overview-card strong { font-size:20px; line-height:1.1; font-weight:800; }
  .mobile-overview-card span:last-child { font-size:11px; color:var(--dim); white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
  .mobile-primary-actions { display:grid; grid-template-columns:50px; justify-content:end; position:relative; margin-bottom:16px; }
  .mobile-more-btn { min-height:50px; font-size:24px; line-height:1; justify-content:center; }
  .mobile-run-actions { position:absolute; z-index:60; right:0; top:54px; width:210px; padding:6px; background:#fff; border:1px solid var(--line); border-radius:12px; box-shadow:0 10px 30px #0f1f1726; }
  .mobile-run-actions[hidden] { display:none; }
  .mobile-run-actions button { display:flex; align-items:center; gap:10px; width:100%; min-height:44px; padding:8px 10px; border:0; background:transparent; text-align:left; color:var(--ink); }
  .mobile-run-actions button:hover { background:var(--accent-soft); }
  .fleet-card>.card-head { margin-bottom:12px; }
  .fleet-card .card-head h2 { font-size:20px; }
  .fleet-card .count-chip { background:var(--accent-soft); color:var(--accent-ink); border-radius:999px; }
  .fleet-card .card-tools { grid-template-columns:minmax(0,1fr) 48px; }
  .fleet-card .head-search input { min-height:48px; border-color:#dce5e1; border-radius:12px; background:#fff; }
  .mobile-refine-toggle { min-width:48px; min-height:48px; padding:0; justify-content:center; }
  .mobile-refine-toggle .ic { width:22px; height:22px; }
  #sites-table tbody tr { position:relative; grid-template-columns:repeat(4,minmax(0,1fr)); gap:8px 10px; padding:14px 14px 0; margin-bottom:12px; border:1px solid #dce5e1; border-radius:16px; background:#fff; box-shadow:0 3px 14px #0f1f1709; }
  #sites-table tbody tr[data-status=issues] { border-color:#efc86e; background:#fffdfa; }
  #sites-table tbody tr[data-status=offline] { border-color:#edb7b7; background:#fffafa; }
  #sites-table td:nth-child(2) { display:flex; align-items:center; gap:8px; min-height:38px; }
  #sites-table .site-cell { min-width:0; }
  #sites-table .flag { width:24px; height:24px; margin-right:8px; border-radius:50%; object-fit:cover; }
  #sites-table .site-link { font-size:15px; font-weight:700; overflow-wrap:anywhere; }
  .mobile-site-menu { display:grid; place-items:center; margin-left:auto; flex-shrink:0; width:44px; height:44px; border:0; background:transparent; color:var(--dim); font-size:25px; line-height:1; }
  #sites-table td:nth-child(3) { padding-bottom:3px; }
  #sites-table .status-cell { gap:6px; flex-wrap:wrap; }
  #sites-table .pill { border-radius:999px; font-size:11px; padding:3px 9px; }
  #sites-table .issue-reason { display:block; flex-basis:100%; padding-left:14px; font-size:12px; color:var(--dim); }
  #sites-table td[data-col]::before { color:var(--dim); font-size:11px; margin-bottom:2px; }
  #sites-table td[data-col=traffic] .traffic-num { color:#a64c00; font-weight:800; }
  #sites-table td[data-col] { font-size:16px; }
  #sites-table td.mobile-row-toggle { padding:0; margin-top:5px; border-top:1px solid #dce5e1; }
  .site-details-btn { min-height:48px; color:var(--ink); font-size:13px; font-weight:700; }
  .site-details-btn::after { content:'›'; float:right; font-size:24px; font-weight:400; line-height:20px; }
  #sites-table tr.menu-open td.row-actions { display:flex!important; position:absolute; right:10px; top:55px; z-index:10; width:auto; grid-column:auto; margin:0; padding:6px; background:#fff; border:1px solid var(--line); border-radius:12px; box-shadow:0 8px 20px #0f1f1726; }
  #sites-table tr.menu-open td.row-actions form { margin:0; }
  #sites-table tr.menu-open td.row-actions .btn { width:44px; height:44px; }
  .mobile-tabs { padding:6px 8px max(6px,env(safe-area-inset-bottom)); }
  .mobile-tabs a,.mobile-tabs button { min-height:58px; font-size:12px; }
}
@media(max-width:800px) {
  .mobile-header { background:#fff; }
  .fleet-card { scroll-margin-top:80px; }
  #sites-table td[data-col]::before { font-size:10px; }
  #sites-table .pill { font-size:11px; }
  .site-details-btn { font-size:13px; }
}
