/* Mobile presentation only. Existing desktop and print styles remain authoritative. */
.pos-mobile-only { display: none; }
@media screen and (max-width: 1100px), screen and (hover: none) and (pointer: coarse) {
    *, *::before, *::after { box-sizing: border-box; }
    body { margin: 0; padding: 8px; }
    body .container { min-width: 0; padding: 16px 12px; }
    h1 { font-size: 24px; overflow-wrap: anywhere; }
    h2 { font-size: 20px; overflow-wrap: anywhere; }
    h3, p, a, td, pre { overflow-wrap: anywhere; }
    input, select, textarea, button { font-family: inherit; font-size: 16px !important; max-width: 100%; }
    input:not([type="hidden"]), select, button, summary { min-height: 46px; }
    button, summary { cursor: pointer; }
    input, select, textarea { min-width: 0; }
    .pos-mobile-only { display: block; }
    .pos-mobile-back { padding: 12px 0; color: #245e8c; }
    .nav-menu { display: flex; flex-wrap: wrap; align-items: start; text-align: left; overflow: visible; }
    .nav-menu > a, .nav-menu .logout-link { float: none; margin: 0; padding: 12px; }
    .pos-mobile-nav { flex: 1; min-width: 75px; }
    .pos-mobile-nav summary { padding: 12px; color: #2c3e50; }
    .pos-mobile-nav a { display: block; margin: 0; }
    .container > div:has(> .search-form-container) { flex-wrap: wrap; }
    .search-form-container, .search-form-container .search-form, .filters-right,
    .filters-form { display: flex !important; flex-wrap: wrap; gap: 10px; width: 100%; margin-left: 0; min-width: 0; }
    .search-form-container .search-form input { width: 100% !important; }
    .filters-right > div, .filters-form > div { flex: 1 1 180px; min-width: 0; }
    .filters-right select, .filters-form input, .filters-form select { width: 100%; }
    .filters-form label { display: block; margin-bottom: 6px; }
    .search-form-container > a, .filters-form a { margin: 0; padding: 12px 0; }
    .filters-form > button { margin-left: 0 !important; }
    .sync-button, .sync-button button { width: 100%; }
    .pos-mobile-sort { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; margin: 16px 0 8px; }
    .pos-mobile-sort label { grid-column: 1 / -1; color: #526171; font-size: 14px; }
    .pos-mobile-sort select { width: 100%; }
    .pos-mobile-sort a { display: flex; align-items: center; justify-content: center; min-width: 72px; padding: 10px; border: 1px solid #bac9d8; border-radius: 5px; color: #24425e; text-decoration: none; }
    body .forma-grid, .stat-grid { grid-template-columns: minmax(0, 1fr) !important; }
    .forma-grid > div, .stat-box { min-width: 0; }
    .forma-grid input, .forma-grid select, .forma-grid button { width: 100%; }
    .forma-grid button, .detalji-sekcija button { height: auto !important; }
    .forma-grid-full > a { display: inline-block; padding: 12px 0; margin-left: 0 !important; }
    .detalji-sekcija, .stat-box { padding: 12px; }
    .detalji-sekcija > form { max-width: 100% !important; min-width: 0; }
    .jid-display { overflow-wrap: anywhere; }
    .stat-box .total { overflow-wrap: anywhere; font-size: 32px; }
    .pos-table-scroll { overflow-x: auto; max-width: 100%; }
    .pos-table-scroll:focus-visible { outline: 2px solid #2877b8; }
    .pos-table-scroll th, .pos-table-scroll td { padding: 8px 5px; }
    .pos-table-hint { margin: 8px 0; font-size: 13px; color: #526171; }
    table.pos-cards, .pos-cards > tbody { display: block; width: 100%; }
    .pos-cards > thead { display: none; }
    .pos-cards > tbody > tr { display: flex; flex-wrap: wrap; gap: 0 12px; border: 1px solid #dce3ea; border-radius: 10px; margin: 12px 0; padding: 12px; background: #fff; }
    body .pos-cards > tbody > tr > td { display: block; width: 100%; min-width: 0; border: 0; padding: 7px 0; font-size: 15px; text-align: left; }
    .pos-cards td[data-mobile-label]::before { content: attr(data-mobile-label); display: block; color: #637282; font-size: 12px; font-weight: 400; margin-bottom: 3px; }
    body .pos-cards td.pos-card-title { order: -4; font-size: 18px; font-weight: 600; }
    .pos-cards td.pos-card-title::before, .pos-cards td.pos-card-status::before,
    .pos-cards td.pos-card-actions::before { display: none; }
    .pos-cards td.pos-card-title span { font-size: 14px !important; }
    body .pos-cards td.pos-card-status { order: -3; }
    body .pos-cards td.pos-card-jid { order: -2; }
    body .pos-cards td.pos-card-date, body .pos-cards td.pos-card-ping { width: calc(50% - 6px); }
    body .pos-cards td.pos-card-secondary { display: none; }
    body .pos-cards tr.pos-expanded > td.pos-card-secondary { display: block; }
    body .pos-cards td.pos-card-actions { display: flex; flex-wrap: wrap; gap: 8px; order: 2; }
    .pos-cards .action-button, .pos-cards .btn-detalji, .pos-card-toggle, .pos-other-actions summary,
    .pos-cards td.pos-card-actions > a { display: block; width: auto; flex: 1 1 120px; min-height: 46px; margin: 0; padding: 12px 8px; border-radius: 6px; text-align: center; font-size: 15px; line-height: 22px; text-decoration: none; }
    .pos-card-toggle, .pos-other-actions summary { border: 1px solid #bac9d8; background: #edf3f8; color: #24425e; font-weight: 500; }
    .pos-other-actions { flex: 1 0 100%; }
    .pos-other-actions summary { min-height: 48px; list-style-position: inside; }
    .pos-other-actions[open] summary { margin-bottom: 8px; }
    .pos-cards td form { flex-wrap: wrap; }
    .pos-cards td form input:not([type="hidden"]), .pos-cards td form button { width: 100%; }
    .pos-cards td pre { white-space: pre-wrap; }
    body .pos-cards td.pos-card-controls { order: 1; }
    .pos-card-controls button { width: 100%; }
    .pos-cards .status, .pos-cards .status-badge { font-size: 14px; }
    /* Compact POS overview: identity/validity left, contact/version right. */
    .pos-cards > tbody > tr.pos-compact-card { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 4px 12px; position: relative; }
    body .pos-cards > tbody > tr.pos-compact-card > td { width: auto; order: 0; padding: 3px 0; }
    body .pos-cards tr.pos-compact-card > td.pos-card-title { grid-column: 1 / -1; grid-row: 1; padding-right: 100px; padding-bottom: 7px; line-height: 1.3; }
    .pos-compact-card .pos-company-link { color: #2c3e50; text-decoration: none; }
    .pos-compact-card .pos-company-link:hover { text-decoration: underline; }
    .pos-compact-card .pos-card-title span { font-weight: 400; color: #7c878e !important; }
    body .pos-cards tr.pos-compact-card > td.pos-card-status { position: absolute; top: 14px; right: 12px; padding: 0; }
    .pos-compact-card .status { font-size: 12px; padding: 5px 8px; }
    .pos-compact-card .pos-card-jid { grid-column: 1; grid-row: 2; }
    .pos-compact-card .pos-card-date { grid-column: 1; grid-row: 3; }
    .pos-compact-card .pos-card-ping { grid-column: 2; grid-row: 2; }
    .pos-compact-card .pos-card-version { grid-column: 2; grid-row: 3; }
    .pos-compact-card .pos-card-ping br { display: none; }
    .pos-compact-card .pos-card-ping br::after { content: ' '; }
    .pos-compact-card td[data-mobile-label]::before { margin-bottom: 2px; }
    body .pos-cards tr.pos-compact-card > td.pos-card-actions { grid-column: 1 / -1; order: 10; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 6px; padding-top: 8px; align-items: start; }
    .pos-compact-card .pos-card-actions > a { grid-row: 1; }
    .pos-compact-card .pos-card-actions > a:only-of-type { grid-column: 1 / -1; }
    .pos-compact-card .pos-card-toggle { grid-column: 1; grid-row: 2; }
    .pos-compact-card .pos-other-actions { grid-column: 2; grid-row: 2; min-width: 0; }
    .pos-compact-card .pos-other-actions a { margin-top: 6px; }
    .pos-compact-card .pos-card-toggle, .pos-compact-card .pos-other-actions summary,
    .pos-cards .pos-compact-card .action-button, .pos-cards .pos-compact-card .btn-detalji { padding: 10px 5px; min-height: 44px; font-size: 14px !important; }
    .pos-compact-card .ping-version-info { min-height: 28px; min-width: 28px; margin: -4px 0; }
    .pagination { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; }
    .pagination a, .pagination span { display: inline-flex; align-items: center; min-height: 44px; margin: 0; }
    .results-summary { text-align: left; line-height: 1.5; }
    body:has(.login-container) { min-height: 100dvh; padding: 16px; }
    .login-container { width: 100%; max-width: 380px; padding: 24px; }
    .login-container .form-group input { width: 100%; }
    button:focus-visible, summary:focus-visible, a:focus-visible { outline: 3px solid #2877b8; outline-offset: 2px; }
}
