@media (max-width: 760px) {
  html {
    --app-header-height: calc(58px + env(safe-area-inset-top, 0px));
    min-height: 100%;
    background: #f3f7f5;
    -webkit-text-size-adjust: 100%;
  }

  body {
    min-height: 100vh;
    min-height: 100dvh;
    background: #f3f7f5;
  }

  body.app-ready {
    width: 100%;
    height: auto;
    min-height: 100vh;
    min-height: 100dvh;
    position: relative;
    inset: auto;
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior-y: auto;
  }

  .portal-header {
    min-height: var(--app-header-height);
    position: sticky;
    z-index: 35;
    top: 0;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
    align-items: center;
    gap: 12px;
    padding: env(safe-area-inset-top, 0px) 16px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.09);
    background: rgba(14, 39, 45, 0.98);
    box-shadow: 0 7px 24px rgba(14, 39, 45, 0.14);
    backdrop-filter: saturate(150%) blur(14px);
  }

  /* 两侧等宽，中间列的几何中心才等于视口中心；原先 auto 1fr auto 会按左右宽度差整体偏移 */
  .mobile-app-bar-title {
    min-width: 0;
    display: none;
    justify-self: center;
    gap: 2px;
    color: #ffffff;
    text-align: center;
  }

  .portal-brand {
    min-width: 0;
    justify-self: start;
    gap: 10px;
  }

  .brand-mark {
    width: 34px;
    height: 34px;
    border-radius: 7px;
  }

  .brand-copy {
    gap: 1px;
  }

  .brand-copy strong {
    font-size: 16px;
    line-height: 1.2;
  }

  .brand-copy small {
    color: #a9c0c0;
    font-size: 12px;
    letter-spacing: 0.04em;
  }

  .portal-header .header-actions {
    justify-self: end;
  }

  .app-ready .mobile-app-bar-title {
    min-width: 0;
    display: grid;
    justify-items: center;
    gap: 2px;
    color: #ffffff;
    text-align: center;
  }

  .mobile-app-bar-title strong {
    max-width: 100%;
    overflow: hidden;
    font-size: 13px;
    font-weight: 650;
    line-height: 1.25;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .mobile-app-bar-title span {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    color: #91c9c2;
    font-size: 12px;
    line-height: 1.2;
  }

  .mobile-app-bar-title svg {
    width: 10px;
    height: 10px;
  }

  .portal-header .icon-button {
    width: 38px;
    height: 38px;
    border-radius: 8px;
  }

  .portal-header .connection-state,
  .portal-header .header-link {
    display: none;
  }

  .portal-main {
    width: 100%;
    min-width: 0;
  }

  .login-screen {
    min-height: auto;
    grid-template-columns: 1fr;
    gap: 18px;
    padding: 22px 12px 34px;
  }

  .login-intro {
    padding: 0 4px;
  }

  .login-intro .eyebrow {
    margin-bottom: 7px;
    font-size: 12px;
  }

  .login-intro h1,
  .login-intro h2.panel-heading {
    max-width: 340px;
    font-size: 27px;
    line-height: 1.25;
  }

  .intro-copy {
    max-width: 360px;
    margin-top: 10px;
    font-size: 12px;
    line-height: 1.65;
  }

  .intro-list {
    display: none;
  }

  .login-card {
    width: 100%;
    max-width: none;
    padding: 21px 18px;
    border: 1px solid #dce7e2;
    border-top: 0;
    border-radius: 8px;
    box-shadow: 0 10px 30px rgba(16, 42, 48, 0.075);
  }

  .login-card-head {
    gap: 11px;
    margin-bottom: 21px;
  }

  .card-icon {
    width: 38px;
    height: 38px;
    border-radius: 8px;
  }

  .login-card h2 {
    font-size: 20px;
  }

  .field input,
  .field select,
  .field textarea {
    min-height: 48px;
    padding: 12px 13px;
    border-radius: 8px;
    font-size: 16px;
  }

  .field textarea {
    min-height: 94px;
  }

  .primary-button,
  .quiet-button {
    min-height: 46px;
    border-radius: 8px;
  }

  .login-submit {
    min-height: 48px;
  }

  .login-help {
    margin-top: 19px;
    padding-top: 15px;
  }

  .app-ready .staff-shell {
    width: 100%;
    height: auto;
    min-height: 100vh;
    min-height: 100dvh;
    overflow: visible;
    flex-direction: column;
  }

  .app-ready .portal-main {
    min-height: 0;
    overflow: visible;
    flex: 1 0 auto;
  }

  .app-ready .staff-app {
    height: auto;
    min-height: 0;
    overflow: visible;
    width: 100%;
    padding: 10px 12px 0;
  }

  .app-ready .portal-footer {
    display: none;
  }

  .app-tab-panel {
    height: auto;
    min-height: 0;
    overflow: visible;
    min-width: 0;
    padding-bottom: 0;
    animation: staff-panel-in 180ms ease-out;
  }

  .app-tab-panel::-webkit-scrollbar {
    display: none;
  }

  .mobile-section-tabs {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 3px;
    margin: 0 0 10px;
    padding: 3px;
    border: 1px solid #dce6e2;
    border-radius: 8px;
    background: #eaf0ed;
  }

  .mobile-section-tabs button {
    min-width: 0;
    min-height: 40px;
    padding: 0 8px;
    border: 0;
    border-radius: 6px;
    color: #667876;
    background: transparent;
    font-size: 12px;
    font-weight: 650;
    white-space: nowrap;
  }

  .mobile-section-tabs button.active {
    color: #0f6f67;
    background: #ffffff;
    box-shadow: 0 2px 9px rgba(16, 42, 48, 0.08);
  }

  .app-ready [data-mobile-panel-group] {
    display: none;
  }

  .app-ready [data-mobile-panel-group].mobile-section-active {
    display: block;
  }

  .app-ready .mobile-section-tabs {
    position: sticky;
    z-index: 6;
    top: var(--app-header-height);
    box-shadow: 0 5px 14px rgba(16, 42, 48, 0.07);
  }

  @keyframes staff-panel-in {
    from {
      opacity: 0;
      transform: translateY(4px);
    }
    to {
      opacity: 1;
      transform: translateY(0);
    }
  }

  .app-ready .portal-brand .brand-copy small {
    display: none;
  }

  .employee-profile {
    min-width: 0;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 12px;
    margin: 0 0 12px;
    padding: 13px 14px;
    overflow: hidden;
    border: 0;
    border-radius: 8px;
    background: #12363c;
    box-shadow: 0 10px 24px rgba(16, 42, 48, 0.14);
  }

  .employee-profile-main {
    gap: 12px;
  }

  .employee-avatar {
    width: 42px;
    height: 42px;
    color: #0f6f67;
    border: 1px solid rgba(255, 255, 255, 0.35);
    background: #e9f6f2;
    font-size: 18px;
    box-shadow: 0 5px 14px rgba(0, 0, 0, 0.1);
  }

  .employee-profile-main h1,
  .employee-profile-main h2.panel-heading {
    margin: 2px 0 3px;
    color: #ffffff;
    font-size: 18px;
    line-height: 1.3;
  }

  .employee-profile-main p {
    color: #d1e2df;
    font-size: 12px;
  }

  .employee-profile-main .eyebrow {
    margin-bottom: 4px;
    color: #80d0c5;
    font-size: 12px;
  }

  .employee-profile-main small {
    display: block;
    margin-top: 4px;
    color: #a9c2c1;
    font-size: 12px;
  }

  .employee-profile-actions .primary-button {
    min-height: 44px;
    padding: 0 12px;
    color: #0e5f58;
    border: 1px solid rgba(255, 255, 255, 0.5);
    border-radius: 8px;
    background: #f2fbf8;
    font-size: 12px;
    white-space: nowrap;
    box-shadow: none;
  }

  .employee-profile-actions .primary-button:hover {
    color: #0e5f58;
    background: #ffffff;
    transform: none;
  }

  .employee-profile-actions .primary-button svg {
    width: 15px;
    height: 15px;
  }

  .summary-grid,
  .ledger-summary,
  .attendance-summary {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
    margin: 0 0 12px;
    overflow: visible;
    border: 0;
    border-radius: 0;
    background: transparent;
  }

  .summary-item,
  .ledger-summary .summary-item {
    min-width: 0;
    min-height: 76px;
    align-items: flex-start;
    flex-direction: column;
    justify-content: space-between;
    gap: 5px;
    padding: 9px;
    border: 1px solid #dfe8e4;
    border-radius: 8px;
    background: #ffffff;
    box-shadow: 0 4px 14px rgba(16, 42, 48, 0.035);
  }

  .summary-icon,
  .ledger-summary .summary-icon {
    width: 27px;
    height: 27px;
    border-radius: 7px;
  }

  .summary-icon svg,
  .ledger-summary .summary-icon svg {
    width: 15px;
    height: 15px;
  }

  .summary-item > div,
  .ledger-summary .summary-item > div {
    width: 100%;
    display: block;
  }

  .summary-item span,
  .ledger-summary .summary-item span {
    display: block;
    overflow: hidden;
    color: #758583;
    font-size: 12px;
    line-height: 1.35;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .summary-item strong,
  .ledger-summary .summary-item strong {
    display: block;
    margin-top: 4px;
    color: #16383d;
    font-size: 19px;
    line-height: 1.05;
  }

  .attendance-summary {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 6px;
  }

  .attendance-summary .summary-item strong {
    font-size: 18px;
  }

  .ledger-section {
    margin-bottom: 12px;
    overflow: hidden;
    border: 1px solid #dfe8e4;
    border-radius: 8px;
    background: #ffffff;
    box-shadow: 0 6px 18px rgba(16, 42, 48, 0.035);
  }

  .ledger-toolbar {
    align-items: stretch;
    flex-direction: column;
    gap: 9px;
    padding: 12px 13px;
  }

  .ledger-toolbar h2 {
    margin: 2px 0 4px;
    font-size: 18px;
  }

  .ledger-toolbar p {
    font-size: 12px;
    line-height: 1.6;
  }

  .ledger-toolbar .eyebrow {
    margin-bottom: 5px;
    font-size: 12px;
  }

  .app-ready .ledger-toolbar > div > .eyebrow,
  .app-ready .ledger-toolbar > div > p:not(.eyebrow) {
    display: none;
  }

  .ledger-toolbar .search-control {
    width: 100%;
    min-height: 44px;
    border-radius: 8px;
  }

  .search-control input {
    font-size: 16px;
  }

  .device-ledger {
    grid-template-columns: 1fr;
    gap: 10px;
    padding: 10px;
    background: #f7faf8;
  }

  .employee-device-card,
  .employee-inventory-card,
  .attendance-shift-card {
    border-color: #dfe8e4;
    border-radius: 8px;
    box-shadow: 0 4px 14px rgba(16, 42, 48, 0.035);
  }

  .employee-device-head {
    align-items: flex-start;
    flex-wrap: wrap;
    padding: 14px;
  }

  .device-mark,
  .inventory-device-icon {
    width: 36px;
    height: 36px;
    border-radius: 8px;
  }

  .employee-device-copy strong {
    font-size: 14px;
  }

  .device-add-button {
    min-height: 34px;
    margin-left: 46px;
    padding: 0 11px;
    border-radius: 7px;
    font-size: 12px;
  }

  .app-ready .device-add-button,
  .app-ready .attendance-shift-card > footer button,
  .app-ready .attendance-correction-action .quiet-button,
  .app-ready .attendance-rest-form .primary-button,
  .app-ready .inventory-card-button,
  .app-ready .ledger-empty .quiet-button {
    min-height: 44px;
    padding: 0 14px;
    border-radius: 8px;
    font-size: 12px;
  }

  .ledger-account-row {
    min-height: 61px;
    padding: 12px 14px;
  }

  .ledger-account-copy strong {
    font-size: 13px;
  }

  .ledger-account-copy small {
    font-size: 12px;
  }

  .employee-device-foot {
    padding: 11px 14px;
    font-size: 12px;
  }

  .attendance-shift-grid {
    grid-template-columns: 1fr;
    gap: 10px;
    padding: 10px;
    background: #f7faf8;
  }

  .attendance-shift-card > header {
    padding: 14px;
  }

  .attendance-shift-time {
    padding: 18px 14px 12px;
  }

  .attendance-clock-times,
  .attendance-correction-action,
  .attendance-correction-note {
    margin-right: 14px;
    margin-left: 14px;
  }

  .attendance-shift-card > footer {
    padding: 12px 14px 14px;
  }

  .attendance-rest-form {
    padding: 14px;
  }

  .attendance-rest-item {
    padding: 13px 14px;
  }

  .attendance-history-row {
    padding: 13px 14px;
  }

  .employee-inventory-list {
    grid-template-columns: 1fr;
    gap: 10px;
    padding: 10px;
    background: #f7faf8;
  }

  .inventory-card-head {
    padding: 13px;
  }

  .employee-request-item {
    padding: 13px 14px;
  }

  .profile-panel {
    gap: 12px;
  }

  .profile-card {
    padding: 18px;
    border: 0;
    border-radius: 8px;
    color: #ffffff;
    background: #12363c;
    box-shadow: 0 10px 24px rgba(16, 42, 48, 0.14);
  }

  .profile-avatar {
    width: 56px;
    height: 56px;
    color: #0f6f67;
    border: 1px solid rgba(255, 255, 255, 0.35);
    background: #e9f6f2;
    font-size: 20px;
  }

  .profile-card-copy .eyebrow {
    color: #80d0c5;
  }

  .profile-card-copy h1,
  .profile-card-copy h2.panel-heading {
    color: #ffffff;
  }

  .profile-card-copy p:last-child {
    color: #b7ccca;
  }

  .profile-metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    overflow: visible;
    border: 0;
    border-radius: 0;
    background: transparent;
  }

  .profile-metrics > div {
    padding: 15px;
    border: 1px solid #dfe8e4;
    border-radius: 8px;
    background: #ffffff;
    box-shadow: 0 4px 14px rgba(16, 42, 48, 0.035);
  }

  .profile-metrics span {
    font-size: 12px;
  }

  .profile-metrics strong {
    font-size: 23px;
  }

  .profile-section {
    border-radius: 8px;
    box-shadow: 0 5px 16px rgba(16, 42, 48, 0.035);
  }

  .profile-section-head {
    padding: 15px 16px;
  }

  .profile-info-list {
    padding: 0 16px;
  }

  .profile-logout {
    min-height: 48px;
    border-radius: 8px;
  }

  .app-bottom-nav {
    width: 100%;
    min-height: calc(64px + env(safe-area-inset-bottom, 0px));
    left: 0;
    bottom: 0;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 0;
    padding: 6px 8px calc(6px + env(safe-area-inset-bottom, 0px));
    border: 0;
    border-top: 1px solid rgba(16, 42, 48, 0.12);
    border-radius: 0;
    background: rgba(255, 255, 255, 0.98);
    box-shadow: 0 -8px 30px rgba(16, 42, 48, 0.1);
    transform: none;
    backdrop-filter: saturate(160%) blur(18px);
  }

  .app-nav-item {
    min-width: 0;
    min-height: 52px;
    position: relative;
    gap: 4px;
    padding: 5px 3px;
    border-radius: 8px;
    color: #788987;
    font-size: 12px;
    line-height: 1;
    white-space: nowrap;
  }

  .app-nav-item svg {
    width: 21px;
    height: 21px;
    stroke-width: 1.9;
  }

  .app-nav-item.active {
    color: #0f7169;
    background: #eaf5f2;
  }

  .app-nav-item.active::after {
    content: "";
    position: absolute;
    top: 3px;
    left: 50%;
    width: 18px;
    height: 2px;
    border-radius: 999px;
    background: #0f766e;
    transform: translateX(-50%);
  }

  .toast {
    bottom: calc(84px + env(safe-area-inset-bottom, 0px));
    max-width: calc(100vw - 28px);
    padding: 11px 14px;
    border-radius: 8px;
    font-size: 12px;
  }

  .ledger-dialog {
    max-height: calc(100vh - env(safe-area-inset-top, 0px));
    max-height: calc(100dvh - env(safe-area-inset-top, 0px));
    border-radius: 16px 16px 0 0;
  }

  .dialog-header {
    position: relative;
    padding: 17px 16px 14px;
  }

  .dialog-header::before {
    content: "";
    position: absolute;
    top: 7px;
    left: 50%;
    width: 38px;
    height: 4px;
    border-radius: 999px;
    background: #d7e2de;
    transform: translateX(-50%);
  }

  .dialog-header h2 {
    font-size: 19px;
  }

  .dialog-header .icon-button {
    width: 40px;
    height: 40px;
    border-radius: 8px;
  }

  .dialog-body {
    gap: 18px;
    padding: 17px 16px 20px;
  }

  .dialog-actions {
    padding: 12px 16px calc(12px + env(safe-area-inset-bottom, 0px));
    background: rgba(251, 252, 252, 0.98);
    backdrop-filter: blur(12px);
  }

  .dialog-actions .primary-button,
  .dialog-actions .quiet-button {
    min-height: 48px;
  }

  .inventory-request-device {
    border-radius: 8px;
  }
}

@media (max-width: 380px) {
  .app-ready .staff-app {
    padding-right: 10px;
    padding-left: 10px;
  }

  .employee-profile {
    grid-template-columns: minmax(0, 1fr);
  }

  .employee-profile-actions {
    width: 100%;
  }

  .employee-profile-actions .primary-button {
    width: 100%;
  }

  .summary-item,
  .ledger-summary .summary-item {
    min-height: 87px;
    padding: 10px;
  }

  .summary-item strong,
  .ledger-summary .summary-item strong {
    font-size: 20px;
  }

  .app-nav-item {
    font-size: 12px;
  }

  .app-nav-item svg {
    width: 20px;
    height: 20px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .app-tab-panel {
    animation: none;
  }
}
@media (min-width: 761px) {
  .mobile-app-bar-title,
  .mobile-section-tabs {
    display: none;
  }
}
@media (max-width: 760px) {
  .daily-panel {
    gap: 10px;
  }

  .daily-hero {
    padding: 17px 16px;
    border-radius: 8px;
  }

  .daily-hero h1,
  .daily-hero h2.panel-heading {
    font-size: 22px;
  }

  .daily-hero p:last-child {
    max-width: 260px;
    font-size: 12px;
  }

  .daily-status-pill {
    min-height: 27px;
    padding: 0 9px;
    font-size: 12px;
  }

  .daily-window-card {
    grid-template-columns: 1fr;
    gap: 12px;
    padding: 15px;
  }

  .daily-window-copy strong {
    font-size: 14px;
  }

  .daily-window-times {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 7px;
  }

  .daily-window-times > span {
    min-width: 0;
    padding: 9px 10px;
  }

  .daily-submit-button {
    width: 100%;
    min-height: 46px;
  }

  .daily-summary-grid {
    gap: 7px;
  }

  .daily-summary-grid article {
    min-width: 0;
    padding: 12px 10px;
  }

  .daily-summary-grid span,
  .daily-summary-grid small {
    display: block;
    /* 原先 nowrap+ellipsis：字号一大就直接裁字，改成换行 */
    white-space: normal;
    line-height: 1.45;
  }

  .daily-summary-grid strong {
    font-size: 21px;
  }

  .daily-device-preview {
    grid-template-columns: 1fr;
    padding: 12px;
  }

  .daily-device-preview-card > header {
    padding: 11px 12px;
  }

  .daily-device-accounts {
    padding: 9px 12px;
  }

  .daily-history-row {
    padding: 12px 13px;
  }

  .daily-history-row .daily-history-icon {
    width: 32px;
    height: 32px;
  }

  .daily-report-dialog {
    width: 100%;
  }

  .daily-dialog-window {
    gap: 6px;
  }

  .daily-dialog-window > div {
    padding: 9px 8px;
  }

  .daily-select-head {
    align-items: flex-start;
  }

  .daily-select-all {
    min-width: 58px;
    min-height: 38px;
    justify-content: center;
  }

  .daily-check-card {
    min-height: 58px;
    padding: 10px 11px;
  }

  .daily-check-copy {
    flex: 1;
  }

  .daily-notice {
    align-items: flex-start;
    padding: 11px 12px;
  }

  .daily-notice button {
    min-height: 40px;
  }
}

@media (max-width: 380px) {
  .daily-window-times > span {
    padding-inline: 8px;
  }

  .daily-summary-grid span,
  .daily-summary-grid small {
    /* 次要说明文字档：11px（规范 §3.1），12px 在 320px 三列布局下放不下 */
    font-size: 11px;
  }

  .daily-history-row {
    align-items: flex-start;
    flex-wrap: wrap;
  }

  .daily-history-status {
    margin-left: 44px;
  }
}

