/* Employee browser workspace. Desktop styles remain in styles.css. */
.mobile-bottom-nav,
.mobile-menu-toggle,
.mobile-login-brand,
.mobile-order-row {
  display: none;
}

.mobile-menu-group h4 {
  margin: 22px 0 10px;
  color: var(--ink-500);
  font-size: 14px;
}
.mobile-menu-group > div {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}
.mobile-menu-group a {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 54px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--ink-900);
  text-decoration: none;
}
.mobile-menu-group a[aria-current] {
  background: var(--blue-100);
  border-color: var(--blue-600);
}
.mobile-menu-group svg,
.mobile-bottom-nav svg,
.mobile-menu-toggle svg {
  width: 22px;
  height: 22px;
  flex-shrink: 0;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
}
.mobile-employee-profile {
  display: grid;
  gap: 6px;
}
.mobile-employee-profile span {
  color: var(--ink-500);
  font-size: 14px;
}
.mobile-menu-logout {
  width: 100%;
  margin-top: 24px;
}

@media screen and (max-width: 1024px) {
  html,
  body {
    min-width: 0;
    width: 100%;
  }
  .app-shell {
    display: block;
    min-height: 100dvh;
    padding-top: calc(112px + env(safe-area-inset-top, 0px));
    padding-bottom: calc(72px + env(safe-area-inset-bottom, 0px));
  }
  .sidebar,
  .workspace-tabs {
    display: none;
  }
  .topbar {
    left: 0;
    height: auto;
    min-height: 112px;
    padding: calc(8px + env(safe-area-inset-top, 0px)) 12px 8px;
    display: grid;
    grid-template-columns: 44px minmax(0, 1fr);
    gap: 4px 10px;
  }
  .mobile-menu-toggle {
    display: grid;
    place-items: center;
    width: 44px;
    height: 44px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: white;
    color: var(--navy-900);
  }
  .breadcrumb {
    min-width: 0;
    font-size: 16px;
  }
  .breadcrumb > span {
    display: none;
  }
  .breadcrumb strong {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .topbar-actions {
    grid-column: 1 / -1;
    min-width: 0;
    width: 100%;
    gap: 8px;
  }
  #topbar-management-scope {
    flex: 1;
    min-width: 0;
  }
  .transport-group-switcher {
    min-width: 0;
    max-width: 100%;
    padding: 4px 10px;
    min-height: 44px;
  }
  .transport-group-switcher label,
  .transport-group-switcher div {
    min-width: 0;
    flex: 1;
  }
  .transport-group-switcher select {
    max-width: 100%;
    width: 100%;
    min-width: 0;
    font-size: 16px;
  }
  .transport-group-switcher strong {
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .environment-badge,
  .user-meta,
  .user-menu .avatar {
    display: none;
  }
  .logout-btn {
    width: 44px;
    height: 44px;
  }
  .main-content {
    padding: 16px 12px 24px;
    min-width: 0;
  }
  .mobile-bottom-nav {
    display: flex;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 30;
    padding: 6px max(6px, env(safe-area-inset-right, 0px))
      calc(6px + env(safe-area-inset-bottom, 0px)) max(6px, env(safe-area-inset-left, 0px));
    background: #fff;
    border-top: 1px solid var(--line);
    box-shadow: 0 -3px 18px #102a430b;
  }
  .mobile-bottom-nav > a,
  .mobile-bottom-nav > button {
    flex: 1;
    min-width: 0;
    min-height: 54px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    border: 0;
    border-radius: 10px;
    color: var(--ink-700);
    background: transparent;
    text-decoration: none;
    font-size: 13px;
  }
  .mobile-bottom-nav > a[aria-current] {
    background: var(--blue-100);
    color: var(--blue-700);
    font-weight: 700;
  }
  body:has(.modal-backdrop) {
    overflow: hidden;
  }
  .page-header,
  .page-heading {
    gap: 12px;
  }
  .page-header {
    flex-direction: column;
    margin-bottom: 16px;
  }
  .page-heading h1 {
    font-size: 22px;
  }
  .page-heading p {
    font-size: 13px;
    line-height: 1.6;
  }
  .page-title-icon {
    width: 42px;
    height: 42px;
    flex-shrink: 0;
  }
  .page-actions {
    width: 100%;
    flex-wrap: wrap;
    gap: 8px;
  }
  .btn,
  .btn-sm,
  .page-button,
  .icon-btn,
  .modal-close {
    min-height: 44px;
    font-size: 14px;
  }
  .icon-btn,
  .modal-close {
    min-width: 44px;
  }
  .link-btn {
    min-height: 44px;
    font-size: 14px;
    padding: 8px 6px;
  }
  input:not([type='checkbox']):not([type='radio']):not([type='hidden']):not([type='file']),
  select,
  textarea,
  .form-control,
  .form-select,
  .order-form-section .form-control,
  .order-form-section .form-select {
    font-size: 16px;
    min-height: 44px;
    max-width: 100%;
  }
  .form-label,
  .form-field > span {
    font-size: 14px;
  }
  .stats-grid,
  .status-hall-metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }
  .stat-card {
    min-width: 0;
    padding: 14px 12px;
    gap: 10px;
  }
  .stat-value {
    font-size: 24px;
  }
  .stat-label {
    font-size: 13px;
  }
  .status-hall-metric {
    padding: 14px;
  }
  .status-hall-metric:first-child {
    grid-column: 1 / -1;
  }
  .status-hall-order-lookup {
    width: 100%;
    min-width: 0;
  }
  .status-hall-order-lookup label {
    min-width: 0;
    flex: 1;
  }
  .status-hall-order-lookup input {
    width: 100%;
    min-width: 0;
  }
  .status-hall-updated {
    font-size: 12px;
  }
  .order-tabs {
    overflow-x: auto;
    flex-wrap: nowrap;
    padding: 0 8px;
  }
  .order-tab {
    flex-shrink: 0;
    min-height: 48px;
    font-size: 14px;
  }
  .order-filter,
  .status-hall-filter {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    padding: 12px;
    gap: 10px;
  }
  .order-filter > *,
  .status-hall-filter > * {
    min-width: 0;
    width: 100%;
  }
  .order-filter .filter-keyword {
    grid-column: 1 / -1;
  }
  .filter-keyword input {
    min-width: 0;
    width: 100%;
  }
  .filter-separator {
    display: none;
  }
  .order-date {
    width: 100%;
  }
  .order-table-toolbar,
  .order-table-toolbar-main {
    flex-wrap: wrap;
    min-width: 0;
    gap: 10px;
  }
  .order-table-toolbar {
    padding: 12px;
  }
  .order-table-toolbar-main {
    width: 100%;
  }
  .order-batch-actions {
    display: flex;
    flex-wrap: wrap;
    width: 100%;
    gap: 8px;
  }
  .order-batch-actions > button {
    flex: 1 1 auto;
  }
  .order-table-scroll-hint,
  #order-column-settings,
  #status-hall-column-settings {
    display: none;
  }
  .order-batch-print-actions {
    display: none;
  }
  .order-table-toolbar:has(.order-batch-print-actions):not(:has(#order-export-excel)) {
    display: none;
  }
  .order-list-panel .order-table-scroll,
  .status-hall-table-wrap {
    max-height: none;
    height: auto;
    overflow: visible;
  }
  .order-table:has([data-order-empty-cell]) {
    min-width: 0 !important;
    width: 100%;
  }
  .my-terminal-table-wrap {
    max-height: none;
  }
  /* Only tables with the shared card renderer switch layout. Other sheets keep scoped scrolling. */
  .order-table:has(.mobile-order-row) {
    display: block;
    width: 100%;
    min-width: 0 !important;
    table-layout: auto;
  }
  .order-table:has(.mobile-order-row) > tbody,
  .order-table:has(.mobile-order-row) > thead,
  .order-table:has(.mobile-order-row) > thead > tr {
    display: block;
    width: 100%;
  }
  .order-table:has(.mobile-order-row) > tbody > tr:not(.mobile-order-row),
  .order-table:has(.mobile-order-row) > thead th:not([data-order-column='orderInfo']) {
    display: none !important;
  }
  .order-table:has(.mobile-order-row) > thead th[data-order-column='orderInfo'] {
    display: block;
    position: static;
    min-width: 0 !important;
    width: 100%;
    padding: 10px 14px;
    text-align: left;
  }
  .order-table:has(.mobile-order-row) > tbody > .mobile-order-row {
    display: block;
    margin: 0;
    padding: 6px 10px;
  }
  .order-table .mobile-order-row > td {
    display: block;
    position: static;
    padding: 0;
    width: 100%;
    min-width: 0;
    border: 0;
    background: transparent;
    white-space: normal;
  }
  .mobile-order-card {
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 14px;
    background: white;
    font-size: 14px;
    overflow-wrap: anywhere;
  }
  .order-located .mobile-order-card {
    border-color: var(--orange-600);
    box-shadow: 0 0 0 2px var(--orange-100);
  }
  .mobile-order-card > header {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
  }
  .mobile-order-card .order-no-link {
    flex: 1;
    min-width: 0;
    min-height: 44px;
    white-space: normal;
    text-align: left;
    font-size: 16px;
  }
  .mobile-order-card .status-badge {
    font-size: 13px;
  }
  .order-select-control {
    min-width: 44px;
    min-height: 44px;
    justify-content: center;
  }
  .mobile-order-route {
    padding: 10px 0;
    color: var(--blue-700);
    font-weight: 700;
    line-height: 1.5;
  }
  .mobile-order-address {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 10px 0;
    border-top: 1px solid var(--line);
  }
  .mobile-order-address > b {
    display: grid;
    place-items: center;
    width: 26px;
    height: 26px;
    flex-shrink: 0;
    border-radius: 7px;
    background: var(--blue-100);
    color: var(--blue-700);
  }
  .mobile-order-address.is-receiver > b {
    background: var(--orange-100);
    color: #a95009;
  }
  .mobile-order-address > div {
    min-width: 0;
    flex: 1;
  }
  .mobile-order-address strong {
    font-size: 15px;
  }
  .mobile-order-address p {
    margin: 6px 0;
    line-height: 1.6;
  }
  .mobile-order-address span {
    color: var(--ink-700);
  }
  .mobile-phone {
    display: inline-flex;
    align-items: center;
    min-height: 44px;
    color: var(--blue-700);
    text-decoration: none;
  }
  .mobile-order-goods {
    padding: 10px;
    background: var(--canvas);
    border-radius: 8px;
    line-height: 1.8;
  }
  .mobile-order-breakdown summary {
    padding: 14px 0;
    color: var(--blue-700);
    cursor: pointer;
  }
  .mobile-order-breakdown p,
  .mobile-order-remark {
    line-height: 1.6;
  }
  .mobile-order-card > footer {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    color: var(--ink-500);
    padding: 12px 0 4px;
    font-size: 12px;
  }
  .mobile-order-card .order-row-actions,
  .mobile-order-card .order-row-action-line {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    width: 100%;
    min-width: 0;
    white-space: normal;
  }
  .mobile-order-card .order-row-actions {
    margin-top: 10px;
    border-top: 1px solid var(--line);
    padding-top: 10px;
  }
  .mobile-order-card .link-btn {
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 8px 12px;
    background: #fff;
  }
  .mobile-order-card .manbang-call-trigger {
    background: var(--blue-100);
    border-color: #bdd8ee;
    font-weight: 700;
  }
  .pagination,
  .order-pagination-summary {
    flex-wrap: wrap;
    gap: 12px;
  }
  .pagination {
    padding: 14px 12px;
  }
  .page-buttons {
    max-width: 100%;
    overflow-x: auto;
  }
  .page-button {
    flex-shrink: 0;
    min-width: 40px;
  }
  .data-table-wrap,
  .load-planning-table-wrap,
  .load-planning-spreadsheet-wrap {
    max-width: 100%;
    overflow-x: auto;
    overscroll-behavior-x: contain;
  }
  .mobile-record-table {
    display: block;
    width: 100%;
    min-width: 0;
  }
  .mobile-record-table > thead {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
  }
  .mobile-record-table > tbody {
    display: block;
  }
  .mobile-record-table > tbody > tr {
    display: block;
    padding: 10px 14px;
    border-bottom: 8px solid var(--canvas);
  }
  .mobile-record-table > tbody > tr > td {
    display: block;
    position: static;
    width: 100%;
    min-width: 0;
    max-width: none;
    padding: 10px 0;
    border: 0;
    border-bottom: 1px solid var(--line);
    white-space: normal;
    overflow-wrap: anywhere;
    font-size: 14px;
  }
  .mobile-record-table td[data-mobile-label]::before {
    content: attr(data-mobile-label);
    display: block;
    margin-bottom: 5px;
    color: var(--ink-500);
    font-size: 12px;
    font-weight: 400;
  }
  .mobile-record-table .table-actions {
    flex-wrap: wrap;
  }
  .modal-backdrop,
  .modal-backdrop:has(.manbang-call-form),
  .modal-backdrop:has(.manbang-call-detail) {
    padding: 0;
  }
  .modal,
  .modal.modal-lg,
  .modal.modal-xl,
  .modal.modal-xxl,
  .modal:has(.order-detail-head),
  .modal:has(.manbang-call-form),
  .modal:has(.manbang-call-detail) {
    width: 100%;
    max-width: 100%;
    height: 100dvh;
    max-height: 100dvh;
    border-radius: 0;
    display: flex;
    flex-direction: column;
  }
  .modal-header {
    padding: calc(8px + env(safe-area-inset-top, 0px)) 12px 8px;
    flex-shrink: 0;
    min-height: 60px;
    gap: 8px;
  }
  .modal-header-title-row {
    flex-wrap: wrap;
  }
  .modal-header-actions {
    flex-wrap: wrap;
  }
  .modal-header h3 {
    font-size: 17px;
    overflow-wrap: anywhere;
  }
  #modal-form {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
  }
  .modal .modal-body,
  .modal.modal-xxl .modal-body,
  .modal:has(.order-detail-head) .modal-body {
    flex: 1;
    min-height: 0;
    max-height: none;
    padding: 16px 12px;
    overflow: auto;
    overscroll-behavior: contain;
  }
  .modal-footer {
    flex-shrink: 0;
    flex-wrap: wrap;
    padding: 10px 12px calc(10px + env(safe-area-inset-bottom, 0px));
    gap: 8px;
  }
  .modal-footer-start {
    width: 100%;
  }
  .modal-footer-actions {
    display: flex;
    width: 100%;
    flex-wrap: wrap;
    gap: 8px;
  }
  .modal-footer-actions .btn {
    flex: 1 1 auto;
  }
  .form-grid,
  .form-grid-3,
  .form-grid-4,
  .contact-form-grid,
  .create-order-layout,
  .detail-grid,
  .manbang-form-layout,
  .driver-assignment-layout,
  .load-planning-group-list,
  .order-edit-grid,
  .order-edit-party-grid,
  .order-edit-routing-layout,
  .order-edit-service-grid,
  .my-terminal-detail-grid,
  .my-terminal-detail-head,
  .my-terminal-tracking-meta,
  .permission-layout,
  .data-scope-layout,
  .customer-push-layout {
    grid-template-columns: minmax(0, 1fr);
  }
  .contact-form-grid > .sender-card,
  .contact-form-grid > .receiver-cards {
    grid-column: auto;
  }
  .form-grid > *,
  .form-grid-3 > *,
  .form-grid-4 > * {
    min-width: 0;
    grid-column: auto !important;
  }
  .create-order-main {
    min-width: 0;
  }
  .order-form-body,
  .contact-form-card,
  .order-form-section > header {
    padding: 14px;
  }
  .order-form-section .form-label {
    font-size: 14px;
  }
  .order-form-section > header p {
    font-size: 12px;
    line-height: 1.6;
  }
  .pickup-toggle button,
  .contact-select-btn {
    min-height: 44px;
    font-size: 14px;
  }
  .cargo-item-row {
    grid-template-columns: 1fr;
    padding: 12px;
  }
  .order-summary {
    position: static;
  }
  .detail-route {
    grid-template-columns: minmax(0, 1fr) 36px minmax(0, 1fr);
    padding: 12px;
  }
  .order-detail-head h4 {
    font-size: 20px;
    overflow-wrap: anywhere;
  }
  .detail-card p,
  .detail-card h5,
  .detail-remark p {
    font-size: 14px;
  }
  .manbang-fields,
  .manbang-fields-three,
  .manbang-fields-four,
  .manbang-summary {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .manbang-caller-contact,
  .manbang-designated-row {
    grid-template-columns: 1fr;
  }
  .manbang-quote,
  .manbang-call-status,
  .manbang-detail-actions,
  .manbang-panel-title {
    flex-wrap: wrap;
    gap: 10px;
  }
  .manbang-vehicle-options {
    max-width: 100%;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .manbang-vehicle-options label {
    min-height: 44px;
    font-size: 14px;
  }
  .manbang-address-input {
    grid-template-columns: minmax(0, 1fr) auto;
  }
  .manbang-footer-note {
    display: block;
    font-size: 12px;
  }
  .manbang-contract-preview {
    min-height: 60dvh;
  }
  .load-planning-contract-actions,
  .load-planning-group > header,
  .load-planning-group-actions {
    flex-wrap: wrap;
  }
  .load-planning-contract-signatures,
  .load-planning-contract-arrival-fields {
    flex-wrap: wrap;
    gap: 12px;
  }
  .load-planning-group-title {
    min-width: 0;
  }
  .load-planning-group-title strong {
    white-space: normal;
  }
  .load-planning-linehaul-platform-fields {
    grid-template-columns: minmax(0, 1fr);
  }
  .load-planning-linehaul-footer,
  .load-planning-linehaul-picker-actions,
  .load-planning-linehaul-platform-actions {
    flex-wrap: wrap;
  }
  .finance-filter-toolbar,
  .finance-create-summary,
  .finance-date-grid,
  .finance-receipt-grid,
  .finance-detail-columns {
    grid-template-columns: minmax(0, 1fr);
  }
  .finance-filter-toolbar .form-select,
  .finance-filter-toolbar .search-input {
    width: 100%;
  }
  .transport-tracking-metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .transport-tracking-map {
    height: 360px;
    max-height: 55dvh;
  }
  .toolbar,
  .panel-header,
  .driver-toolbar {
    flex-wrap: wrap;
    gap: 10px;
  }
  .search-input {
    min-width: 0;
    max-width: 100%;
  }
  .toast-root {
    left: 12px;
    right: 12px;
    top: calc(12px + env(safe-area-inset-top, 0px));
    width: auto;
    max-width: none;
  }
  .toast {
    width: 100%;
    max-width: 100%;
  }
  .login-page {
    display: block;
    min-height: 100dvh;
  }
  .login-visual {
    display: none;
  }
  .login-panel {
    min-height: 100dvh;
    padding: 32px 20px;
  }
  .login-card {
    width: 100%;
    max-width: 420px;
  }
  .login-card h2 {
    font-size: 26px;
  }
  .mobile-login-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 30px;
    color: var(--navy-900);
  }
  .mobile-login-brand img {
    width: 48px;
    height: 48px;
    object-fit: contain;
  }
  :focus-visible {
    outline: 3px solid var(--blue-600);
    outline-offset: 3px;
  }
}

@media screen and (max-width: 380px) {
  .manbang-fields,
  .manbang-fields-three,
  .manbang-fields-four {
    grid-template-columns: 1fr;
  }
  .mobile-menu-group > div {
    grid-template-columns: 1fr;
  }
}

@media print {
  .mobile-bottom-nav,
  .mobile-menu-toggle,
  .mobile-order-row {
    display: none !important;
  }
}
