/* Work Orders — adapted from the Shipment Management stylesheet
   (warm stone + amber manager shell, card lists, mobile-first). */
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
body { font-family: -apple-system, "PingFang SC", "Microsoft YaHei", sans-serif; margin: 0; color: #1c1917; background: #fafaf9; }
h1 { font-size: 22px; } h2 { font-size: 19px; margin-top: 4px; }
.sub { color: #78716c; font-size: 13px; }
button { min-height: 40px; padding: 7px 14px; border: 1px solid #e7e5e4; background: #fff; border-radius: 10px; cursor: pointer; font-size: 14px; color: #1c1917; }
button.primary { background: #b45309; border-color: #b45309; color: #fff; }
button.danger { background: #b3261e; border-color: #b3261e; color: #fff; }
button:disabled { opacity: .55; cursor: default; }
label { display: block; margin: 8px 0; font-size: 14px; }
input, select, textarea { display: block; width: 100%; padding: 8px; margin-top: 4px; border: 1px solid #e7e5e4; border-radius: 10px; font-size: 15px; background: #fff; }
label.check input { display: inline; width: auto; }
.form.inline { display: flex; gap: 10px; align-items: end; flex-wrap: wrap; }
.err { color: #b3261e; } .ok { color: #187018; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
.no-records { color: #78716c; padding: 12px 2px; }
.badge { padding: 4px 10px; border-radius: 999px; font-size: 12px; background: #e7e5e4; font-weight: 600; white-space: nowrap; }
.st-running { background: #fef3c7; color: #92400e; }
.st-done { background: #dcfce7; color: #166534; }
.st-cancelled { background: #e7e5e4; color: #78716c; }
.st-active { background: #dcfce7; color: #166534; }
.st-inactive { background: #e7e5e4; color: #78716c; }

/* language toggle */
.lang-toggle { display: inline-flex; border: 1px solid #e7e5e4; border-radius: 999px; overflow: hidden; background: #fff; }
.lang-toggle button { border: 0; border-radius: 0; padding: 7px 10px; min-height: 36px; background: transparent; }
.lang-toggle button + button { border-left: 1px solid #e7e5e4; }
.lang-toggle button.active { background: #b45309; color: #fff; }

/* login */
.login-box { max-width: 360px; margin: 60px auto; background: #fff; padding: 24px; border-radius: 14px; border: 1px solid #e7e5e4; box-shadow: 0 2px 10px rgba(28,25,23,.06); }
.login-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.login-top h1 { margin: 0; }
.login-box .lang-toggle { flex: none; }
.login-box button.primary { width: 100%; }

/* app shell: header row 1 = brand + user pill (left), language + logout
   (right); row 2 = the three view links. Mirrors the shipment shell. */
.mgr-header { background: #fafaf9; padding: 20px 16px 4px; }
.mgr-wrap { max-width: 768px; margin: 0 auto; width: 100%; }
.mgr-topbar { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.mgr-brand { font-size: 20px; font-weight: 800; color: #1c1917; margin-right: 10px; }
.mgr-top-left { display: inline-flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.mgr-top-actions { display: inline-flex; align-items: center; gap: 10px; }
.mgr-user-pill { background: #1c1917; color: #fff; border-radius: 999px; padding: 7px 14px; font-size: 14px; font-weight: 600; white-space: nowrap; }
.mgr-logout { background: transparent; border: 0; border-radius: 999px; color: #44403c; padding: 7px 12px; min-height: 40px; cursor: pointer; font-size: 14px; }
.mgr-logout:hover { background: #fef3c7; }
.mgr-nav { display: flex; flex-wrap: wrap; gap: 2px; margin-top: 12px; }
.mgr-nav button, .ghost-btn { background: transparent; border: 0; border-radius: 999px; color: #44403c; padding: 7px 12px; min-height: 40px; cursor: pointer; font-size: 14px; }
.mgr-nav button:hover, .ghost-btn:hover { background: #fef3c7; }
.mgr-nav button.nav-active { background: #fef3c7; color: #92400e; font-weight: 700; }
.mgr-main { padding: 14px 16px 40px; }
.mgr-main h2 { color: #1c1917; }

/* cards & lists */
.proto-card { background: #fff; border: 1px solid #e7e5e4; border-radius: 10px; padding: 16px 20px; }
.wo-cards { display: grid; gap: 12px; margin-top: 12px; }
.wo-card { border: 1px solid #e7e5e4; border-radius: 10px; padding: 16px; background: #fff; box-shadow: 0 1px 2px rgba(28,25,23,.04); }
.wo-card.cancelled { opacity: .55; }
.wo-card-top { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.wo-card-top strong { font-size: 19px; }
.wo-card-main { margin-top: 8px; font-size: 15px; color: #292524; }
.wo-card-sub { margin-top: 6px; font-size: 13px; color: #78716c; }
.wo-card-notes { margin-top: 6px; font-size: 14px; color: #44403c; }
.wo-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; align-items: center; }
.wo-actions .primary { min-height: 48px; padding: 10px 22px; font-size: 16px; font-weight: 700; }
.start-cta { width: 100%; min-height: 52px; font-size: 17px; font-weight: 700; margin-top: 8px; }
.wo-timer { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 34px; font-weight: 800; color: #b45309; letter-spacing: 1px; margin-top: 8px; }
.row-cards { display: grid; gap: 10px; margin-top: 12px; }
.list-row-card { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 8px; background: #fff; border: 1px solid #e7e5e4; border-radius: 10px; padding: 12px 16px; }
.row-actions { display: inline-flex; gap: 2px; flex-wrap: wrap; }
.section-title { margin-top: 26px; }

/* records filter bar + summary (mirrors the shipment picked-up filter) */
.filter-tabs { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0; }
.filter-tab { border-radius: 999px; padding: 8px 14px; background: #fff; border: 1px solid #e7e5e4; }
.filter-tab.active { background: #fef3c7; border-color: #b45309; color: #92400e; font-weight: 700; }
.rec-filters { display: flex; gap: 8px; flex-wrap: wrap; align-items: end; margin: 4px 0 8px; }
.rec-filters label { margin: 0; flex: 1 1 140px; }
.rec-filters input[type="date"], .rec-filters select { min-height: 44px; }
.summary-bar { font-size: 16px; font-weight: 700; color: #92400e; background: #fef3c7; border: 1px solid #fde68a; border-radius: 10px; padding: 10px 14px; margin: 4px 0 12px; text-align: center; }
.export-row { display: flex; justify-content: flex-end; margin-top: 4px; }

/* ============================ mobile ============================ */
/* Phones are the primary device for this app, so under 720px the
   layout is rebuilt around touch: the header becomes two rows
   (brand + user pill / language + logout, then a full-width
   segmented tab bar), every button is at least 44px tall with
   real gaps between neighbours, and filter/form fields each get
   their own full-width row. Desktop rendering is untouched. */
@media (max-width: 720px) {
  .mgr-header { padding: 12px 12px 2px; }
  .mgr-main { padding: 10px 12px 32px; }

  /* header row 1: brand with the user pill under it on the left,
     language toggle + logout on the right — the pill no longer
     competes with the actions for one squeezed line. */
  .mgr-topbar { align-items: flex-start; row-gap: 8px; }
  .mgr-top-left { flex-direction: column; align-items: flex-start; flex-wrap: nowrap; gap: 6px; min-width: 0; }
  .mgr-brand { font-size: 18px; margin-right: 0; }
  .mgr-user-pill { font-size: 12px; padding: 5px 10px; max-width: 100%; overflow: hidden; text-overflow: ellipsis; }
  .mgr-top-actions { gap: 8px; }
  .lang-toggle button { min-height: 44px; padding: 8px 9px; }
  .mgr-logout { min-height: 44px; padding: 8px 10px; }

  /* header row 2: the three views as one full-width segmented
     tab bar — equal shares, centered labels, no side-scrolling. */
  .mgr-nav { flex-wrap: nowrap; overflow: visible; max-width: 100%; gap: 4px; margin-top: 10px; padding: 4px; background: #fff; border: 1px solid #e7e5e4; border-radius: 999px; }
  .mgr-nav button { flex: 1 1 0; min-width: 0; min-height: 44px; padding: 8px 4px; font-size: 15px; line-height: 1.2; text-align: center; white-space: normal; }

  /* touch targets: every button at least 48px tall (44px for the
     compact header controls above), fields at 16px so iOS does
     not zoom on focus. The ghost-btn class outranks the element
     rule, so it needs its own explicit height here. */
  button { min-height: 48px; padding: 10px 16px; font-size: 16px; }
  .ghost-btn { min-height: 48px; }
  input, select, textarea { font-size: 16px; min-height: 48px; padding: 10px 12px; max-width: 100%; min-width: 0; }
  .form.inline { flex-direction: column; align-items: stretch; }
  .login-box { max-width: none; margin: 24px 12px; padding: 20px; }
  .login-box button.primary { min-height: 52px; font-size: 17px; font-weight: 700; }
  .proto-card { padding: 14px; }

  /* card action rows: buttons share the row equally with 10px
     gaps — End + Cancel, the Manage row actions, and the lone
     Delete can never touch each other or spill off the card. */
  .wo-actions { gap: 10px; }
  .wo-actions > button { flex: 1 1 0; min-width: 0; }
  .wo-actions .primary { padding: 10px 12px; }
  .list-row-card { flex-direction: column; align-items: stretch; gap: 10px; padding: 14px; }
  .row-main { min-width: 0; overflow-wrap: break-word; }
  .row-actions { display: flex; gap: 10px; flex-wrap: wrap; width: 100%; }
  .row-actions:empty { display: none; }
  .row-actions > button { flex: 1 1 0; min-width: 0; }

  /* records filters: preset chips wrap in their own row, the
     date inputs and Client/Type selects each get a full-width
     row, and Export CSV spans the width. */
  .filter-tab { min-height: 48px; }
  .rec-filters { flex-direction: column; align-items: stretch; gap: 10px; }
  .rec-filters label { flex: none; width: 100%; }
  .export-row { justify-content: stretch; }
  .export-row button { width: 100%; }

  /* long client/type names and numbers wrap inside their card
     instead of pushing controls off-screen. */
  .wo-card, .list-row-card, .proto-card { max-width: 100%; }
  .wo-card-top { flex-wrap: wrap; }
  .wo-card-top strong { min-width: 0; overflow-wrap: break-word; }
  .wo-card-main, .wo-card-sub, .wo-card-notes, .summary-bar { overflow-wrap: break-word; }
  .wo-timer { font-size: 30px; }
}
