/* Shared by the hosted app and Android fallback. Keep editor rules out of print. */
@media screen {
  html body .worklog-modal .worklog-project-field,
  html body .worklog-modal .worklog-project-manual { min-width: 0; }
  html body .worklog-modal #wlProject,
  html body .worklog-modal #wlSite {
    box-sizing: border-box;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    min-height: 46px;
    font-size: 16px;
  }
  html body .worklog-modal .worklog-project-manual { margin-top: 8px; }
  html body .worklog-modal .worklog-project-manual[hidden] { display: none !important; }
  html body .worklog-modal .worklog-project-help {
    display: block;
    margin-top: 5px;
    color: #64748b;
    font-size: 12px;
    line-height: 1.5;
    overflow-wrap: anywhere;
  }
  html body .daily-worklog-head > div:first-child {
    flex: 1;
    min-width: 0;
  }
  html body .daily-worklog-head h3,
  html body .daily-worklog-head .worklog-card-meta { overflow-wrap: anywhere; }
  html body .daily-worklog-head > .actions {
    flex-shrink: 0;
    max-width: 100%;
    flex-wrap: wrap;
  }
  html body .employee-worklog-shortcut {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    min-width: 0;
    margin: 16px 0;
    padding: 18px;
    border: 1px solid #dbe5f1;
    border-radius: 18px;
    background: linear-gradient(115deg, #f4f8ff, #fff 75%);
    box-shadow: 0 4px 16px rgba(30, 64, 110, .04);
  }
  html body .employee-worklog-heading {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
  }
  html body .employee-worklog-heading > div { min-width: 0; }
  html body .employee-worklog-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 44px;
    width: 44px;
    height: 44px;
    border-radius: 13px;
    background: #e6efff;
    color: #3065b2;
  }
  html body .employee-worklog-icon svg { width: 24px; height: 24px; }
  html body .employee-worklog-heading h3 {
    margin: 0;
    color: #23354d;
    font-size: 17px;
    font-weight: 800;
    line-height: 1.4;
  }
  html body .employee-worklog-heading p {
    margin: 5px 0 0;
    color: #68788e;
    font-size: 13px;
    line-height: 1.6;
    overflow-wrap: anywhere;
  }
  html body .employee-worklog-shortcut > button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 14px;
    flex: 0 0 auto;
    min-height: 46px !important;
    padding: 12px 18px;
    border-radius: 12px;
    font-size: 14px;
    font-weight: 800;
    touch-action: manipulation;
  }
  html body .employee-worklog-shortcut > button:focus-visible {
    outline: 3px solid #93b9f5;
    outline-offset: 3px;
  }
  @media (max-width: 640px) {
    html body .daily-worklog-head { flex-wrap: wrap; }
    html body .daily-worklog-head > div:first-child { flex-basis: 100%; }
    html body .employee-worklog-shortcut {
      display: grid;
      grid-template-columns: minmax(0, 1fr);
      gap: 15px;
      padding: 16px;
    }
    html body .employee-worklog-shortcut > button { width: 100%; }
  }
  html body .worklog-modal .worklog-worker-help {
    margin: 0 0 12px;
    color: #64748b;
    font-size: 12px;
    line-height: 1.5;
  }
  html body .worklog-modal .worklog-worker-count {
    flex: 0 0 auto;
    padding: 5px 9px;
    border-radius: 999px;
    background: #dceafe;
    color: #235ba8;
    font-size: 12px;
    font-weight: 800;
    white-space: nowrap;
  }
  html body .worklog-modal .worklog-worker-checks {
    display: grid !important;
    grid-template-columns: repeat(4, minmax(0, 1fr)) !important;
    gap: 9px !important;
  }
  html body .worklog-modal .worklog-worker-checks > label {
    display: grid !important;
    grid-template-columns: 22px minmax(0, 1fr) !important;
    grid-template-rows: auto auto;
    align-content: center;
    align-items: center !important;
    gap: 3px 9px !important;
    min-width: 0 !important;
    min-height: 64px !important;
    margin: 0 !important;
    padding: 10px !important;
    border: 1px solid #dce5f0 !important;
    border-radius: 12px !important;
    background: #fff !important;
    cursor: pointer;
    touch-action: manipulation;
  }
  html body .worklog-modal .worklog-worker-checks > label.is-selected {
    border-color: #76a7e9 !important;
    background: #edf5ff !important;
  }
  html body .worklog-modal .worklog-worker-checks > label:focus-within {
    outline: 2px solid #2563eb;
    outline-offset: 2px;
  }
  html body .worklog-modal .worklog-worker-checks input[type="checkbox"] {
    appearance: auto !important;
    -webkit-appearance: checkbox !important;
    display: block !important;
    position: static !important;
    grid-column: 1;
    grid-row: 1 / 3;
    width: 22px !important;
    min-width: 22px !important;
    max-width: 22px !important;
    height: 22px !important;
    min-height: 22px !important;
    max-height: 22px !important;
    margin: 0 !important;
    padding: 0 !important;
    border-radius: 4px !important;
    box-shadow: none !important;
    accent-color: #2563eb;
    cursor: pointer;
  }
  html body .worklog-modal .worklog-worker-checks span {
    grid-column: 2;
    min-width: 0;
    font-size: 13px !important;
    font-weight: 800;
    line-height: 1.4;
    white-space: normal !important;
    overflow-wrap: anywhere;
  }
  html body .worklog-modal .worklog-worker-checks small {
    grid-column: 2;
    min-width: 0;
    font-size: 11px !important;
    line-height: 1.4;
    color: #64748b;
    white-space: normal !important;
    overflow-wrap: anywhere;
  }
  html body .worklog-modal .wl-remove-row {
    position: static !important;
    float: none !important;
    transform: none !important;
    min-width: 64px !important;
    min-height: 40px !important;
    width: auto !important;
    margin: 0 !important;
    padding: 8px 12px !important;
    white-space: nowrap !important;
    touch-action: manipulation;
  }
}

@media screen and (min-width: 901px) {
  html body .worklog-modal .table-wrap {
    overflow-x: auto !important;
    overflow-y: auto !important;
  }
  html body .worklog-modal .worklog-edit-table,
  html body .worklog-modal .worklog-material-table,
  html body .worklog-modal .worklog-request-table {
    min-width: 880px !important;
  }
  html body .worklog-modal .worklog-issue-table {
    min-width: 1000px !important;
  }
  html body .worklog-modal .wl-row-action,
  html body .worklog-modal .worklog-edit-table th:last-child,
  html body .worklog-modal .worklog-material-table th:last-child,
  html body .worklog-modal .worklog-issue-table th:last-child,
  html body .worklog-modal .worklog-request-table th:last-child {
    width: 88px !important;
    min-width: 88px !important;
    padding: 8px !important;
    text-align: center !important;
  }
}

/* The desktop modal class is also present in Android's hosted view.
   Match the app's mobile navigation breakpoint, including landscape phones. */
@media screen and (max-width: 980px) {
  html body .worklog-modal-bg {
    /* Android publishes real system-bar heights; env() alone is zero in WebView. */
    --wl-safe-top: max(var(--system-top, 0px), env(safe-area-inset-top, 0px));
    --wl-safe-bottom: max(var(--system-bottom, 0px), env(safe-area-inset-bottom, 0px));
    box-sizing: border-box !important;
    height: 100vh !important;
    height: 100dvh !important;
    padding: calc(8px + var(--wl-safe-top)) 8px calc(8px + var(--wl-safe-bottom)) !important;
    /* Menus and the drawer have their own high stacking layers. */
    z-index: 2147483500 !important;
    align-items: center !important;
    overflow: hidden !important;
  }
  html body .worklog-modal {
    box-sizing: border-box !important;
    width: calc(100vw - 16px) !important;
    max-width: calc(100vw - 16px) !important;
    min-width: 0 !important;
    max-height: calc(100vh - 16px - var(--wl-safe-top) - var(--wl-safe-bottom)) !important;
    max-height: calc(100dvh - 16px - var(--wl-safe-top) - var(--wl-safe-bottom)) !important;
    padding: 12px !important;
    border-radius: 16px !important;
    overflow-x: hidden !important;
    overflow-y: auto !important;
    overscroll-behavior: contain;
    scroll-padding-block: 16px 92px;
  }
}

@media screen and (max-width: 900px) {
  html body .worklog-modal .worklog-modal-title-row {
    flex-wrap: wrap !important;
    gap: 8px !important;
  }
  html body .worklog-modal .worklog-modal-title-row h3 {
    font-size: 20px !important;
  }
  html body .worklog-modal .worklog-sheet-form {
    min-width: 0 !important;
    gap: 12px !important;
  }
  html body .worklog-modal .worklog-basic-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 10px !important;
    padding: 10px !important;
  }
  html body .worklog-modal .worklog-basic-grid .span-2 {
    grid-column: 1 / -1 !important;
  }
  html body .worklog-modal .worklog-entry-section {
    min-width: 0 !important;
    padding: 10px !important;
  }
  html body .worklog-modal .worklog-section-head {
    flex-wrap: wrap !important;
    gap: 8px !important;
    margin: -10px -10px 10px !important;
    padding: 10px !important;
  }
  html body .worklog-modal .worklog-section-head .wl-add-btn {
    min-height: 40px !important;
    padding: 8px 10px !important;
    font-size: 12px !important;
  }
  html body .worklog-modal .worklog-material-grid {
    grid-template-columns: minmax(0, 1fr) !important;
    gap: 12px !important;
  }
  html body .worklog-modal .table-wrap {
    width: 100% !important;
    min-width: 0 !important;
    max-width: 100% !important;
    overflow: visible !important;
    border: 0 !important;
    border-radius: 0 !important;
    background: transparent !important;
  }
  html body .worklog-modal .worklog-edit-table,
  html body .worklog-modal .worklog-material-table,
  html body .worklog-modal .worklog-issue-table,
  html body .worklog-modal .worklog-request-table {
    display: block !important;
    width: 100% !important;
    min-width: 0 !important;
    max-width: 100% !important;
    margin: 0 !important;
    border: 0 !important;
    table-layout: auto !important;
    background: transparent !important;
  }
  html body .worklog-modal .worklog-entry-section table thead {
    display: none !important;
  }
  html body .worklog-modal .worklog-entry-section table tbody {
    display: grid !important;
    width: 100% !important;
    min-width: 0 !important;
    gap: 10px !important;
  }
  html body .worklog-modal .wl-mobile-row {
    display: grid !important;
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 10px !important;
    width: 100% !important;
    min-width: 0 !important;
    max-width: 100% !important;
    padding: 10px !important;
    border: 1px solid #dce6f0 !important;
    border-radius: 12px !important;
    background: #f8fafc !important;
    box-sizing: border-box !important;
  }
  html body .worklog-modal .wl-mobile-row > td {
    display: block !important;
    position: static !important;
    width: auto !important;
    min-width: 0 !important;
    max-width: 100% !important;
    padding: 0 !important;
    border: 0 !important;
    background: transparent !important;
    white-space: normal !important;
  }
  html body .worklog-modal .wl-mobile-row > td::before {
    content: attr(data-label);
    display: block !important;
    margin-bottom: 5px;
    color: #53657b;
    font-size: 12px;
    font-weight: 700;
    line-height: 1.4;
  }
  html body .worklog-modal .wl-mobile-row .wl-row-no,
  html body .worklog-modal .wl-mobile-row .wl-area-cell,
  html body .worklog-modal .wl-mobile-row .wl-detail-cell,
  html body .worklog-modal .wl-mobile-row .wl-time-cell,
  html body .worklog-modal .wl-mobile-row .wl-item-cell,
  html body .worklog-modal .wl-mobile-row .wl-note-cell,
  html body .worklog-modal .wl-mobile-row .wl-wide-cell,
  html body .worklog-modal .wl-mobile-row .wl-row-action {
    grid-column: 1 / -1 !important;
  }
  html body .worklog-modal .wl-mobile-row .wl-row-no {
    justify-self: start;
    padding: 3px 9px !important;
    border-radius: 999px !important;
    background: #e1ebf7 !important;
    color: #28577f !important;
    font-size: 12px !important;
    font-weight: 800;
  }
  html body .worklog-modal .wl-mobile-row .wl-row-no::before,
  html body .worklog-modal .wl-mobile-row .wl-row-action::before {
    display: none !important;
  }
  html body .worklog-modal .wl-mobile-row .wl-row-action {
    display: flex !important;
    justify-content: flex-end !important;
    align-items: center !important;
    margin: 2px 0 0 !important;
    padding-top: 9px !important;
    border-top: 1px solid #e1e8f0 !important;
  }
  html body .worklog-modal .wl-entry {
    box-sizing: border-box !important;
    width: 100% !important;
    min-width: 0 !important;
    max-width: 100% !important;
    min-height: 44px !important;
    padding: 10px 8px !important;
    font-size: 14px !important;
  }
  html body .worklog-modal .worklog-time-pair {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr) !important;
    align-items: center !important;
    width: 100% !important;
    gap: 6px !important;
  }
  html body .worklog-modal .wl-remove-row {
    min-height: 44px !important;
    min-width: 76px !important;
    font-size: 12px !important;
  }
  html body .worklog-modal .worklog-worker-checks {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  }
  html body .worklog-modal .external-entry-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  }
  html body .worklog-modal .modal-actions {
    position: sticky !important;
    bottom: -12px !important;
    z-index: 8 !important;
    display: flex !important;
    gap: 10px !important;
    margin: 12px -12px -12px !important;
    /* System-bar clearance belongs to the outer overlay, not the scrolling footer. */
    padding: 10px 12px !important;
    background: #fff !important;
    border-top: 1px solid #e3e9f0 !important;
  }
  html body .worklog-modal .modal-actions .btn {
    flex: 1 1 0 !important;
    min-width: 0 !important;
    min-height: 46px !important;
    margin: 0 !important;
  }
}

@media screen and (max-width: 380px) {
  html body .worklog-modal .worklog-basic-grid,
  html body .worklog-modal .external-entry-grid {
    grid-template-columns: minmax(0, 1fr) !important;
  }
  html body .worklog-modal .worklog-time-pair {
    grid-template-columns: minmax(0, 1fr) !important;
  }
  html body .worklog-modal .worklog-time-pair > span {
    text-align: center;
    line-height: 1;
  }
}

/* Keep body-level dialogs above the fixed desktop sidebar and menus. */
@media screen { html body > .modal-bg { z-index: 2147483500 !important; } }
