/* ------------------------- MOBILE FIRST OPTIMIZATION ------------------------- */

@media (max-width: 1100px) {
  .operation-cards {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 820px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: relative;
    height: auto;
    flex-direction: column;
    align-items: stretch;
    justify-content: flex-start;
    gap: 12px;
    padding: calc(12px + var(--safe-top)) calc(14px + var(--safe-right)) 12px calc(14px + var(--safe-left));
  }

  .nav {
    flex-direction: row;
    gap: 8px;
    width: 100%;
  }

  .brand {
    padding: 0;
    justify-content: center;
  }

  .brand-logo-image {
    width: 120px;
  }

  .license-card {
    margin-top: 0;
    max-width: none;
    width: 100%;
    padding: 10px;
    gap: 6px;
  }

  .nav-btn {
    flex: 1;
    text-align: center;
    padding: 10px 12px;
    font-size: 0.9rem;
  }

  .license-card p {
    display: none;
  }

  .license-card .btn {
    padding: 8px 10px;
    font-size: 0.84rem;
  }

  .main-content {
    padding: 16px calc(14px + var(--safe-right)) calc(20px + var(--safe-bottom)) calc(14px + var(--safe-left));
  }

  .topbar {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
  }

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

  /* BITNO: import/export više nije dominantan */
  .topbar-actions .btn,
  .topbar-actions .import-label {
    flex: 1;
    justify-content: center;
    font-size: 0.85rem;
    padding: 10px;
  }

  .search-input {
    width: 100%;
  }

  .home-shortcuts-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .clients-toolbar-actions {
    width: 100%;
  }

  .clients-toolbar-actions .btn,
  .clients-toolbar-actions .import-label {
    flex: 1;
    justify-content: center;
  }

  .panel-head-row {
    flex-direction: column;
    gap: 10px;
  }

  .panel-tools {
    width: 100%;
  }

  .panel-tools .btn,
  .panel-tools .import-label {
    flex: 1;
    justify-content: center;
  }

  .hero-summary-grid,
  .summary-grid,
  .summary-grid-4 {
    grid-template-columns: 1fr;
  }

  .timeline-item {
    grid-template-columns: 1fr;
    gap: 4px;
  }

  .timeline-date {
    font-size: 0.78rem;
  }
}

@media (max-width: 520px) {
  .modal-content {
    margin: 20px auto;
    width: 94%;
    max-height: calc(100vh - 40px);
    border-radius: 18px;
  }

  .drawer-panel {
    width: 100%;
  }

  .app-shell {
    max-width: 100%;
  }

  .panel {
    border-radius: 18px;
  }

  .home-shortcuts-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .home-shortcut-card {
    min-height: 96px;
    padding: 12px;
  }

  .home-shortcut-value {
    font-size: 1.7rem;
  }

  .brand-logo-image {
    width: 104px;
  }

  .license-card {
    max-width: none;
    min-width: 0;
  }

  .license-card .btn {
    font-size: 0.8rem;
    padding: 8px 8px;
  }

  .main-content {
    padding: 14px calc(10px + var(--safe-right)) calc(18px + var(--safe-bottom)) calc(10px + var(--safe-left));
  }

  .panel {
    padding: 14px;
  }

  .clients-mode-bar {
    flex-direction: column;
    align-items: stretch;
  }

  .card-actions {
    flex-direction: column;
  }

  .card-actions .btn {
    width: 100%;
  }

  .btn {
    min-height: 44px;
  }
}
