:root{
  --ops-pad-lg: 28px;
  --ops-pad-md: 22px;
  --ops-pad-sm: 18px;
  --ops-pad-xs: 16px;
  --ops-card-pad-lg: 16px;
  --ops-card-pad-md: 14px;
  --ops-card-pad-sm: 13px;
  --ops-card-pad-xs: 12px;
}

@media (max-width: 1200px){
  .container{ width: calc(100% - var(--ops-pad-lg)); }
  .page{ padding: 14px 0 50px; }
  h1{ font-size: 30px; line-height: 1.12; letter-spacing: -0.4px; }
  .muted{ font-size: 14px; line-height: 1.35; }
  .card{ border-radius: 14px; }
  .btn, .btn-primary, .btn-link{ border-radius: 12px; }
}

@media (max-width: 1024px){
  .container{ width: calc(100% - var(--ops-pad-md)); }

  .topbar-inner{
    height: auto;
    padding: 12px 0 10px;
    gap: 12px;
    align-items: flex-start;
  }

  .brand{
    font-size: 16px;
    line-height: 2.2;
    white-space: nowrap;
  }

  .nav{
    width: 100%;
    flex-wrap: nowrap;
    gap: 8px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 6px;
  }

  .nav a{
    font-size: 14px;
    padding: 8px 10px;
    border-radius: 10px;
    white-space: nowrap;
    flex: 0 0 auto;
  }

  .nav-item.dropdown{
    position: relative;
    flex: 0 0 auto;
  }

  .dropdown-menu{
    position: absolute;
    left: 0;
    top: calc(100% + 8px);
    min-width: 210px;
    max-width: min(320px, calc(100vw - 24px));
  }

  .nav-item.dropdown:hover .dropdown-menu{ display: none; }
  .nav-item.dropdown:focus-within .dropdown-menu{ display: block; }

  h1{ font-size: 28px; }
  .page{ padding: 12px 0 46px; }

  .card{
    padding: var(--ops-card-pad-lg);
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  input, select, textarea{
    font-size: 14px;
    padding: 11px 12px;
    border-radius: 12px;
  }

  .btn, .btn-primary, .btn-link{
    min-height: 42px;
    padding: 10px 14px;
    border-radius: 12px;
  }

  .wl-page-head{
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
    margin-bottom: 12px;
  }

  .wl-grid-2{
    grid-template-columns: 1fr;
    gap: 14px;
  }

  .dash-kpis{
    grid-template-columns: 1fr 1fr;
    gap: 10px;
  }

  .dash-actions{
    flex-wrap: wrap;
    gap: 10px;
  }

  .dash-actions .btn{
    flex: 1 1 auto;
    min-width: 170px;
  }

  .dash-chip{
    padding: 8px 10px;
    border-radius: 999px;
  }

  .ops-table{
    min-width: 780px;
  }

  .ops-table thead th{
    font-size: 11px;
  }

  .ops-table tbody td{
    font-size: 13px;
  }

  .ops-table .scan-ts,
  .ops-table td.scan-ts{
    white-space: nowrap;
  }

  .badge{
    height: 20px;
    padding: 0 8px;
    font-size: 11px;
  }

  .pagination{
    gap: 10px;
    flex-wrap: wrap;
  }

  .pagination a,
  .pagination span{
    min-height: 38px;
    padding: 8px 12px;
    border-radius: 12px;
  }

  pre, code{
    font-size: 12px;
    line-height: 1.45;
  }
}

@media (max-width: 900px){
  .container{ width: calc(100% - var(--ops-pad-sm)); }

  .dash-kpis{ grid-template-columns: 1fr; }
  .dash-kpi-value{ font-size: 22px; }

  .dash-actions .btn{
    width: 100%;
    min-width: 0;
  }

  .form-row{
    display: grid !important;
    grid-template-columns: 1fr !important;
    gap: 12px !important;
  }

  .actions{
    margin-left: 0 !important;
    width: 100%;
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    align-items: center;
  }

  .actions .btn,
  .actions .btn-primary,
  .actions .btn-link{
    flex: 1 1 auto;
    text-align: center;
  }

  form[method="get"][action="/admin/scans"]{
    grid-template-columns: 1fr 1fr !important;
  }

  form[method="get"][action="/admin/scans"] > div{
    min-width: 0;
  }

  form[method="get"][action="/admin/scans"] input,
  form[method="get"][action="/admin/scans"] select{
    width: 100%;
    min-width: 0;
  }

  form[method="get"][action="/admin/scans"] > div:last-child{
    justify-content: flex-start !important;
  }

  .forums-page form{
    display: grid !important;
    grid-template-columns: 1fr !important;
    gap: 12px !important;
    align-items: stretch !important;
    justify-content: stretch !important;
  }

  .forums-page form select,
  .forums-page form button{
    width: 100% !important;
    max-width: none !important;
  }

  .lora-page form{
    display: grid !important;
    grid-template-columns: 1fr !important;
    gap: 12px !important;
    align-items: stretch !important;
  }

  .lora-page form input,
  .lora-page form select{
    width: 100% !important;
    min-width: 0 !important;
  }

  .lora-page form .actions{
    margin-left: 0 !important;
    margin-bottom: 0 !important;
    justify-content: stretch !important;
  }

  .lora-page form .actions .btn-primary,
  .lora-page form .actions .btn-link{
    width: 100%;
  }

  .support-list-page .support-filters-form{
    display: grid;
    grid-template-columns: 1fr;
    gap: 12px;
    align-items: stretch;
  }

  .support-list-page .support-filters-form input,
  .support-list-page .support-filters-form select{
    width: 100%;
    min-width: 0;
  }

  .support-list-page .support-filters-form .actions{
    margin-left: 0;
    justify-content: flex-start;
  }
}

@media (max-width: 768px){
  .container{ width: calc(100% - var(--ops-pad-sm)); }

  form[method="get"][action="/admin/scans"]{
    grid-template-columns: 1fr !important;
  }

  form[method="get"][action="/admin/scans"] > div:last-child{
    flex-direction: column;
    align-items: stretch !important;
    gap: 10px !important;
  }

  form[method="get"][action="/admin/scans"] > div:last-child > div{
    width: 100%;
  }

  form[method="get"][action="/admin/scans"] > div:last-child select{
    width: 100%;
  }

  .kv{
    display: grid;
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .kv .v{
    word-break: break-word;
  }

  .wl-json{
    white-space: pre-wrap;
    word-break: break-word;
  }
}

@media (max-width: 640px){
  .container{ width: calc(100% - var(--ops-pad-xs)); }

  .topbar-inner{
    padding: 10px 0 8px;
    gap: 10px;
  }

  .brand{ font-size: 15px; }

  .nav a{
    font-size: 13px;
    padding: 7px 9px;
    border-radius: 9px;
  }

  .dropdown-menu{
    min-width: 200px;
  }

  h1{ font-size: 24px; }
  .muted{ font-size: 13px; }

  .page{ padding: 10px 0 40px; }

  .card{
    padding: var(--ops-card-pad-sm);
    border-radius: 14px;
  }

  .ops-table{
    min-width: 760px;
  }

  .ops-table thead th{
    font-size: 11px;
    padding: 2px 10px 10px 10px;
  }

  .ops-table tbody td{
    font-size: 13px;
    padding: 11px 10px;
  }

  .pagination{
    width: 100%;
    justify-content: space-between;
  }

  .pagination a,
  .pagination span{
    flex: 1 1 auto;
    text-align: center;
  }

  .nav{
    flex-wrap: wrap;
    overflow-x: visible;
    padding-bottom: 0;
  }

  .nav a{
    flex: 0 1 auto;
  }

  .support-filters{
    padding: 12px;
  }

  .support-list-page .support-filters-form{
    gap: 10px;
  }

  .support-list-page .support-filters-form .form-row label{
    font-size: 11px;
    margin-bottom: 4px;
  }

  .support-list-page .support-filters-form input,
  .support-list-page .support-filters-form select{
    padding: 9px 10px;
    min-height: 38px;
  }

  .support-list-page .support-filters-form .actions .btn{
    min-height: 38px;
    padding: 9px 12px;
  }

}

@media (max-width: 640px){
  .wrap{ padding: 18px; }
  .wrap .card{ width: 100%; }
}

@media (max-width: 640px){
  .card:has(.ops-table){
    position: relative;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .card:has(.ops-table)::after{
    content: "Swipe →";
    position: absolute;
    bottom: 10px;
    right: 12px;
    font-size: 11px;
    font-weight: 800;
    color: var(--muted);
    background: rgba(255,255,255,.85);
    border: 1px solid var(--border);
    border-radius: 999px;
    padding: 4px 8px;
    pointer-events: none;
    z-index: 5;
  }

  .ops-table{
    min-width: 760px;
    width: 100%;
  }

  .ops-table th,
  .ops-table td{
    white-space: nowrap;
  }

  .ops-table td:nth-child(3),
  .ops-table td.details-cell{
    white-space: normal;
    min-width: 260px;
    max-width: 420px;
  }

  .ops-table thead th:first-child,
  .ops-table tbody td:first-child{
    position: sticky;
    left: 0;
    background: var(--card);
  }

  .ops-table thead th:first-child{ z-index: 4; }
  .ops-table tbody td:first-child{ z-index: 3; }

  .ops-table thead th:first-child,
  .ops-table tbody td:first-child{
    position: relative;
  }

  .ops-table thead th:first-child::after,
  .ops-table tbody td:first-child::after{
    content: "";
    position: absolute;
    top: 0;
    right: -1px;
    width: 1px;
    height: 100%;
    background: var(--border);
  }
}

@media (max-width: 900px){
  .ops-thread{
    display: block;
  }

  .sidebar .card{
    position: static;
    top: auto;
  }

  .maincol,
  .sidebar{
    width: 100%;
  }
}

@media (max-width: 640px){
  .msg-top{
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
  }

  .msg-from{
    width: 100%;
    flex-wrap: wrap;
  }

  .msg-time{
    white-space: normal;
    overflow-wrap: anywhere;
    word-break: break-word;
  }
}

form[method="get"][action="/admin/scans"]{
  grid-template-columns: 1fr 1fr !important;
  gap: 10px !important;
}

form[method="get"][action="/admin/scans"] > div:first-child{
  grid-column: 1 / -1;
}

form[method="get"][action="/admin/scans"] > div:last-child{
  grid-column: 1 / -1;
}

form[method="get"][action="/admin/scans"] label{
  font-size: 11px;
  margin-bottom: 4px;
}

form[method="get"][action="/admin/scans"] input,
form[method="get"][action="/admin/scans"] select{
  padding: 9px 10px;
  min-height: 38px;
}

@media (max-width: 1100px){
  .sidebar{
    display:flex;
    flex-direction:column;
    gap:14px;
  }

  .sidebar .card:first-child{ order: 2; }
  .sidebar .card:last-child{ order: 1; }
}

@media (max-width: 900px){
  .sidebar .card{
    padding: 12px;
  }

  .sidebar label{
    font-size: 11px;
  }

  .sidebar input,
  .sidebar select{
    padding: 10px 12px;
  }
}

@media (max-width: 640px){
  .msg-top{
    flex-wrap: wrap;
    align-items: flex-start;
    gap: 8px;
  }

  .msg-from{
    min-width: 0;
    flex: 1 1 100%;
  }

  .msg-time{
    white-space: normal;
    width: 100%;
    text-align: left;
    overflow-wrap: anywhere;
  }
}

