@media (max-width: 375px) {
  body {
    font-size: 0.8125rem;
  }
  .page,
  .container {
    padding: 0.5rem;
  }
  h1 {
    font-size: 1.3rem;
    margin: 0.5rem 0;
  }
  h2 {
    font-size: 1.1rem;
    margin: 0.375rem 0;
  }
  h3,
  h4,
  h5,
  h6 {
    font-size: 0.95rem;
    margin: 0.25rem 0;
  }
  .form-group {
    margin-bottom: 0.625rem;
  }
  .form-control,
  .form-select,
  select,
  textarea,
  input[type=text],
  input[type=email],
  input[type=password] {
    font-size: 1rem;
    padding: 0.625rem;
    min-height: 2.75rem;
  }
  .btn,
  button {
    min-height: 2.75rem;
    min-width: 2.75rem;
    padding: 0.625rem 0.75rem;
    font-size: 0.8125rem;
    margin: 0.25rem 0.125rem;
  }
  .modal-dialog {
    margin: 0.5rem;
    width: 96vw;
  }
  .modal-body {
    max-height: 60vh;
    overflow-y: auto;
    padding: 0.75rem;
  }
  .modal-header {
    padding: 0.625rem;
  }
  .table {
    font-size: 0.75rem;
    margin-bottom: 0;
  }
  .table thead {
    display: none;
  }
  .table tbody,
  .table tr,
  .table td {
    display: block;
    width: 100%;
  }
  .table tr {
    margin-bottom: 0.75rem;
    border: 1px solid #ddd;
    border-radius: 0.25rem;
    padding: 0.5rem;
  }
  .table td {
    text-align: right;
    padding: 0.5rem 1rem;
    position: relative;
    padding-left: 50%;
  }
  .table td::before {
    content: attr(data-label);
    position: absolute;
    left: 8px;
    font-weight: 600;
  }
  .sidebar-left {
    position: fixed;
    left: -100%;
    top: 0;
    width: 85%;
    height: 100vh;
    z-index: 1000;
    transition: left 0.3s ease;
    background: #fff;
    overflow-y: auto;
  }
  .sidebar-left.active {
    left: 0;
  }
  .sidebar-backdrop {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 999;
  }
  .sidebar-left.active ~ .sidebar-backdrop {
    display: block;
  }
  .mobile-menu-toggle {
    display: block;
    position: fixed;
    top: 10px;
    left: 10px;
    z-index: 1001;
    background: #6c587b;
    color: white;
    border: none;
    padding: 0.5rem 0.75rem;
    border-radius: 4px;
    cursor: pointer;
    font-size: 18px;
  }
}
@media (max-width: 768px) {
  .nav-tabs {
    flex-wrap: wrap;
    gap: 4px;
  }
  .nav-tabs > li {
    flex: 1 1 auto;
    min-width: 100px;
  }
  .datatable-wrapper,
  .table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  .pagination {
    font-size: 12px;
  }
  .pagination > li > a,
  .pagination > li > span {
    padding: 0.375rem 0.5rem;
    min-width: 32px;
    text-align: center;
  }
  .card,
  .panel,
  .dash-panel {
    margin-bottom: 0.5rem;
  }
  .col-md-3,
  .col-md-4,
  .col-md-6 {
    min-height: 1px;
  }
  .alert {
    margin: 0.5rem 0;
    padding: 0.6875rem;
    font-size: 0.8125rem;
  }
  .alert button {
    margin-top: 0.25rem;
    width: 100%;
  }
  .list-group-item {
    padding: 0.6875rem;
    min-height: 2.75rem;
    display: flex;
    align-items: center;
  }
  .dropdown-menu {
    max-width: 90vw;
    max-height: 60vh;
    overflow-y: auto;
  }
  footer {
    padding: 0.75rem;
    font-size: 0.75rem;
  }
}
@media (hover: none) and (pointer: coarse) {
  a,
  button,
  input[type=button],
  input[type=submit],
  input[type=checkbox],
  input[type=radio] {
    min-height: 2.75rem;
    min-width: 2.75rem;
    padding: 0.5rem;
  }
  *:hover {
  }
  button:active,
  a:active {
    opacity: 0.7;
  }
  button:focus,
  a:focus {
    outline: 2px solid #6c587b;
    outline-offset: 2px;
  }
  a,
  button,
  input,
  select,
  textarea {
    touch-action: manipulation;
  }
  * {
    -webkit-tap-highlight-color: transparent;
  }
  .scrollable {
    -webkit-overflow-scrolling: touch;
  }
}
@media (max-width: 768px) {
  body {
    padding-bottom: 60px;
  }
  .mobile-bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 60px;
    background: white;
    border-top: 1px solid #ddd;
    display: flex;
    z-index: 100;
    box-shadow: 0 -2px 8px rgba(0, 0, 0, 0.1);
  }
  .mobile-bottom-nav-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    color: #666;
    font-size: 0.6875rem;
    transition: all 0.2s;
    padding: 4px;
  }
  .mobile-bottom-nav-item:active,
  .mobile-bottom-nav-item.active {
    color: #6c587b;
    background: #f5f5f5;
  }
  .mobile-bottom-nav-item i {
    font-size: 1.25rem;
    margin-top: 0.5rem;
  }
}
@media (display-mode: standalone) {
  body {
    padding-top: max(12px, env(safe-area-inset-top));
    padding-left: max(12px, env(safe-area-inset-left));
    padding-right: max(12px, env(safe-area-inset-right));
    padding-bottom: max(12px, env(safe-area-inset-bottom));
  }
  .web-only {
    display: none;
  }
}
@media (max-height: 500px) and (orientation: landscape) {
  .sidebar-left {
    display: none;
  }
  .mobile-menu-toggle {
    display: block;
  }
  body {
    padding: 4px;
  }
  .btn,
  button {
    padding: 4px 8px;
    font-size: 12px;
  }
  .sidebar-left.active {
    position: fixed;
    left: 0;
    top: 0;
    width: 70%;
    max-height: 100vh;
  }
}
@media print {
  .no-print,
  .mobile-menu-toggle,
  .mobile-bottom-nav,
  .sidebar-left {
    display: none !important;
  }
  body {
    padding: 0.75rem;
  }
  * {
    background: white !important;
    color: black !important;
    text-shadow: none !important;
  }
  a {
    text-decoration: underline;
  }
  a::after {
    content: " (" attr(href) ")";
  }
}
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
  body {
    -webkit-font-smoothing: antialiased;
  }
  * {
    border-width: 1px;
  }
}
@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
