/* Royal Atelier Online — phone-only layout layer (site-side copy only).
   Applies at phone widths (<=767px) only. Desktop view, colors, and the
   Windows program are untouched. */
@media (max-width: 767px) {

  /* ===== Top bar order: menu top-right, user chip + theme top-left, search full-width below ===== */
  .top-navbar {
    flex-direction: row !important;
    align-items: center !important;
    justify-content: space-between !important;
    flex-wrap: wrap !important;
    gap: 8px !important;
    padding: 8px 12px !important;
  }
  .top-navbar > .top-right-tools { order: 1; flex: 0 0 auto; }
  .top-navbar > .top-left-tools  { order: 2; flex: 0 0 auto; display: flex; align-items: center; gap: 6px; }
  .top-navbar > div:not(.top-right-tools):not(.top-left-tools) {
    order: 3;
    flex: 1 1 100% !important;
    width: 100%;
    margin: 0 !important;
  }
  .top-navbar .global-search {
    width: 100% !important;
    max-width: 100% !important;
    margin: 0 !important;
  }
  #current-user-display { max-width: 150px !important; }

  /* ===== Buttons: never break a word across lines on phones, never clip text ===== */
  .section-container .btn-neon,
  .section-container .dropdown > button,
  .section-container .panel-header button {
    white-space: nowrap !important;
    width: auto !important;
    min-width: max-content !important;
    flex: 0 0 auto !important;
  }

  /* ===== Action rows stay on one line, scroll sideways if ever needed ===== */
  .section-container .dropdown,
  .btn-row,
  .actions-row {
    flex-wrap: nowrap !important;
    gap: 8px;
  }

  /* ===== General phone tidy ===== */
  .section-container > h2,
  .panel-header h2 { font-size: 17px !important; }
  .dashboard-cards { gap: 10px; }
  .table-responsive, .table-wrap, .tables-container {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
}

/* treasury: long descriptions wrap inside the card on phones */
@media (max-width: 768px) {
  #treasury-table-body td { white-space: normal !important; overflow-wrap: anywhere; word-break: break-word; min-width: 0; }
}
