/* Telemar Astra — corporate look: navy #162C42, cyan #06A1CE, IBM Plex Sans */
@font-face { font-family: "IBM Plex Sans"; font-weight: 400; src: url("../vendor/fonts/ibm-plex-sans-400.0ceb759015a6.woff2") format("woff2"); }
@font-face { font-family: "IBM Plex Sans"; font-weight: 500; src: url("../vendor/fonts/ibm-plex-sans-500.767677e47513.woff2") format("woff2"); }
@font-face { font-family: "IBM Plex Sans"; font-weight: 600; src: url("../vendor/fonts/ibm-plex-sans-600.e78568807d10.woff2") format("woff2"); }

:root {
  --navy: #162C42; --cyan: #06A1CE; --cyan-dark: #0587ad; --bg: #f3f5f8; --card: #fff; --line: #dde3ea;
  --text: #1d2733; --muted: #6b7785; --ok: #2f9e44; --warn: #f08c00; --danger: #e03131; --radius: 8px;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { font-family: "IBM Plex Sans", system-ui, sans-serif; font-size: 14px; color: var(--text); background: var(--bg); }
a { color: var(--cyan-dark); text-decoration: none; }
h1 { font-size: 20px; font-weight: 500; margin: 0; }
h2 { font-size: 16px; font-weight: 600; margin: 16px 0 8px; }
h3 { font-size: 14px; font-weight: 600; margin: 12px 0 6px; }
.muted { color: var(--muted); }
.icon { flex: none; vertical-align: middle; }

/* top bar */
.topbar { display: flex; align-items: center; gap: 18px; background: var(--navy); color: #fff; height: 52px; padding: 0 16px; position: sticky; top: 0; z-index: 20; }
.brand { display: flex; align-items: center; gap: 10px; color: #fff; flex: none; }
.brand img { height: 26px; display: block; }
/* M01: TELEMAR logo | ASTRA rev1.0 (uppercase spaced, like the TELEMAR logotype) */
.brand-product { font-weight: 600; font-size: 15px; letter-spacing: .12em; text-transform: uppercase; line-height: 1;
  padding-left: 10px; border-left: 1px solid rgba(255,255,255,.35); white-space: nowrap; }
.brand-product small { margin-left: 6px; font-size: 11px; font-weight: 400; letter-spacing: .02em; text-transform: none; color: #9fd8ea; }
.app-version { padding: 8px 8px 2px; font-size: 12px; color: var(--muted); }
.module-nav { display: flex; align-items: center; gap: 4px; overflow-x: auto; flex: 1; scrollbar-width: none; }
.module-name { display: inline-flex; align-items: center; gap: 6px; font-weight: 600; margin-right: 10px; white-space: nowrap; }
.module-nav a { color: #cfe3f1; padding: 6px 10px; border-radius: 6px; white-space: nowrap; }
.module-nav a:hover, .module-nav a.active { background: rgba(255,255,255,.12); color: #fff; }
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 12px; }
.icon-btn { color: #fff; position: relative; display: inline-flex; }
.badge { position: absolute; top: -6px; right: -8px; background: var(--danger); color: #fff; font-size: 10px; border-radius: 9px; padding: 1px 5px; }
.lang-switch { display: flex; border: 1px solid rgba(255,255,255,.3); border-radius: 6px; overflow: hidden; }
.lang-switch button { background: none; border: 0; color: #cfe3f1; padding: 4px 8px; cursor: pointer; font: inherit; font-size: 12px; }
.lang-switch button.active { background: var(--cyan); color: #fff; }
.user-menu { position: relative; }
.user-menu summary { cursor: pointer; list-style: none; color: #fff; }
.user-menu .dropdown { position: absolute; right: 0; top: 30px; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 6px; min-width: 180px; box-shadow: 0 6px 20px rgba(0,0,0,.12); }
.user-menu .dropdown a, .user-menu .dropdown button { display: block; width: 100%; text-align: left; padding: 8px; color: var(--text); background: none; border: 0; font: inherit; cursor: pointer; border-radius: 6px; }
.user-menu .dropdown a:hover, .user-menu .dropdown button:hover { background: var(--bg); }

.trail { display: flex; align-items: center; gap: 10px; padding: 6px 20px; background: #fff; border-bottom: 1px solid var(--line); font-size: 13px; position: sticky; top: 52px; z-index: 15; overflow-x: auto; white-space: nowrap; }
.trail-back { border: 1px solid var(--line); background: #fff; border-radius: 6px; width: 34px; height: 28px; font-size: 18px; line-height: 1; cursor: pointer; color: var(--navy); flex: none; }
.trail-back:hover:not([disabled]) { border-color: var(--cyan); color: var(--cyan-dark); }
.trail-back[disabled] { opacity: .35; cursor: default; }
.trail-items a { color: var(--muted); } .trail-items a:hover { color: var(--cyan-dark); }
.trail-items strong { color: var(--navy); font-weight: 500; }
.page { padding: 16px 20px 40px; max-width: 1500px; margin: 0 auto; }
.page.popup { padding: 8px; }

/* home (M02): equal tiles in balanced rows (--cols comes from the view), last row centred, the whole block
   centred — vertically too when it fits (auto margins never cut it on small screens) */
.home-wrap { display: flex; flex-direction: column; min-height: calc(100vh - 150px); min-height: calc(100svh - 150px); }
.home-wrap > :first-child { margin-top: auto; }
.home-wrap > :last-child { margin-bottom: auto; }
.tiles { --tile: 133px; --gap: 14px; display: flex; flex-wrap: wrap; justify-content: center; gap: var(--gap);
  width: 100%; max-width: calc(var(--cols, 5) * var(--tile) + (var(--cols, 5) - 1) * var(--gap)); margin: 0 auto; }
/* square tiles in nautical dress (owner, 30/10/2026): the module drawn in nautical terms (Module.art) behind a brass
   porthole whose glass is the module's colour (--c, from the template), framed with its label in the middle of a card
   with a layered shadow and a wave of that colour at its foot. Pointed at, the card rises, its wave drifts and the
   sea moves behind the glass (no movement for whoever asks the system for less) */
.tile { --c: var(--cyan); position: relative; isolation: isolate; flex: 0 0 var(--tile); aspect-ratio: 1 / 1;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 9px; padding: 10px 8px 12px;
  background: linear-gradient(180deg, #fff 0%, #f4f8fb 100%); border: 1px solid rgba(22,44,66,.09); border-radius: 18px;
  color: var(--navy); text-align: center; overflow: hidden;
  box-shadow: 0 1px 2px rgba(16,42,67,.07), 0 10px 22px -8px rgba(16,42,67,.22);
  transition: border-color .2s, box-shadow .2s, transform .2s ease; }
.tile::after { content: ""; position: absolute; z-index: -1; left: -25%; right: -25%; bottom: 0; height: 30%;
  background: var(--c); opacity: .13; transition: opacity .2s, transform .8s ease;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 60 24' preserveAspectRatio='none'%3E%3Cpath d='M0 9Q15 0 30 9T60 9V24H0z'/%3E%3C/svg%3E") left bottom / 60px 100% repeat-x;
          mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 60 24' preserveAspectRatio='none'%3E%3Cpath d='M0 9Q15 0 30 9T60 9V24H0z'/%3E%3C/svg%3E") left bottom / 60px 100% repeat-x; }
.tile:hover, .tile:focus-visible { border-color: color-mix(in srgb, var(--c) 45%, transparent); transform: translateY(-3px);
  box-shadow: 0 2px 4px rgba(16,42,67,.08), 0 18px 32px -10px rgba(16,42,67,.38); outline: 0; }
.tile:hover::after, .tile:focus-visible::after { opacity: .22; transform: translateX(12%); }
/* the porthole: a brass ring with eight rivets around the glass */
.porthole { --size: 68px; position: relative; display: block; width: var(--size); height: var(--size); flex: none; padding: 5px;
  border-radius: 50%; color: #fff;
  background: conic-gradient(from 200deg, #f8e7bd, #c99a4b 18%, #8c6326 32%, #d9b56d 48%, #fbecc6 60%, #b6873e 78%, #f8e7bd);
  box-shadow: 0 7px 12px -4px rgba(10,30,50,.45), 0 0 0 1px rgba(98,68,22,.45), inset 0 0 0 1px rgba(255,255,255,.6);
  transition: transform .45s cubic-bezier(.3,1.5,.5,1); }
.porthole::before { content: ""; position: absolute; inset: 0; z-index: 2; border-radius: 50%; pointer-events: none;
  background:
    radial-gradient(circle at 50% 3.8%, #fff6d8 0 .7px, #7a5520 1.2px 1.8px, transparent 2.2px),
    radial-gradient(circle at 82.7% 17.3%, #fff6d8 0 .7px, #7a5520 1.2px 1.8px, transparent 2.2px),
    radial-gradient(circle at 96.2% 50%, #fff6d8 0 .7px, #7a5520 1.2px 1.8px, transparent 2.2px),
    radial-gradient(circle at 82.7% 82.7%, #fff6d8 0 .7px, #7a5520 1.2px 1.8px, transparent 2.2px),
    radial-gradient(circle at 50% 96.2%, #fff6d8 0 .7px, #7a5520 1.2px 1.8px, transparent 2.2px),
    radial-gradient(circle at 17.3% 82.7%, #fff6d8 0 .7px, #7a5520 1.2px 1.8px, transparent 2.2px),
    radial-gradient(circle at 3.8% 50%, #fff6d8 0 .7px, #7a5520 1.2px 1.8px, transparent 2.2px),
    radial-gradient(circle at 17.3% 17.3%, #fff6d8 0 .7px, #7a5520 1.2px 1.8px, transparent 2.2px); }
/* the glass: the module's colour, lit from the top left, with the sea at the bottom and a glare */
.porthole-glass { position: relative; display: flex; align-items: center; justify-content: center; width: 100%; height: 100%;
  border-radius: 50%; overflow: hidden; background: var(--c);
  background: radial-gradient(circle at 34% 26%, color-mix(in srgb, var(--c) 52%, #fff) 0%, var(--c) 46%,
                              color-mix(in srgb, var(--c) 62%, #04121f) 100%);
  box-shadow: inset 0 3px 7px rgba(0,0,0,.4), inset 0 -1px 1px rgba(255,255,255,.3); }
.porthole-glass::before { content: ""; position: absolute; z-index: 2; top: 8%; left: 15%; width: 44%; height: 24%; border-radius: 50%;
  background: linear-gradient(180deg, rgba(255,255,255,.5), rgba(255,255,255,0)); transform: rotate(-28deg); pointer-events: none; }
.porthole-glass::after { content: ""; position: absolute; left: 0; width: calc(100% + 20px); bottom: -1px; height: 30%;
  background: rgba(255,255,255,.22);
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 10' preserveAspectRatio='none'%3E%3Cpath d='M0 4Q5 0 10 4T20 4V10H0z'/%3E%3C/svg%3E") left top / 20px 100% repeat-x;
          mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 10' preserveAspectRatio='none'%3E%3Cpath d='M0 4Q5 0 10 4T20 4V10H0z'/%3E%3C/svg%3E") left top / 20px 100% repeat-x; }
.porthole .icon { position: relative; z-index: 1; width: 33px; height: 33px; stroke-width: 1.75;
  filter: drop-shadow(0 1px 1.2px rgba(0,0,0,.4)); }
.tile:hover .porthole, .tile:focus-visible .porthole { transform: translateY(-2px) scale(1.05); }
.tile:hover .porthole-glass::after, .tile:focus-visible .porthole-glass::after { animation: porthole-sea 1.4s linear infinite; }
@keyframes porthole-sea { to { transform: translateX(-20px); } }
/* the label always takes two lines, a one-line label centred in them: a label that wraps never lifts its porthole,
   so every porthole of a row is level */
.tile-label { display: flex; align-items: center; justify-content: center; min-height: 2.5em; font-size: 13px; font-weight: 600;
  line-height: 1.25; letter-spacing: .1px; }
.tile-label > span { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.home-widgets { width: 100%; max-width: 760px; margin: 28px auto 0; }
@media (prefers-reduced-motion: reduce) {
  .tile, .tile::after, .porthole { transition: none; }
  .tile:hover, .tile:focus-visible, .tile:hover::after, .tile:focus-visible::after,
  .tile:hover .porthole, .tile:focus-visible .porthole { transform: none; }
  .tile:hover .porthole-glass::after, .tile:focus-visible .porthole-glass::after { animation: none; }
}
/* home background: a ship's bow at sea, fixed behind the tiles (a fixed layer, not background-attachment: fixed,
   which phones ignore); the bow stays in view at every width (anchored at the bottom centre) */
body.home { background: #e9eff5; }
body.home::before { content: ""; position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background: #e9eff5 url("img/home-sea.e1fcfb55e90c.jpg") center bottom / cover no-repeat; }
body.home .trail { background: rgba(255,255,255,.82); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); }
body.home .widget { background: rgba(255,255,255,.88); border-color: rgba(22,44,66,.10);
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); box-shadow: 0 2px 10px rgba(22,44,66,.06); }
/* over the sea: frosted cards, shadows a little deeper so they float above the water */
body.home .tile { background: linear-gradient(180deg, rgba(255,255,255,.95) 0%, rgba(240,247,251,.88) 100%);
  border-color: rgba(255,255,255,.7); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  box-shadow: 0 1px 2px rgba(10,30,50,.10), 0 12px 26px -10px rgba(10,30,50,.45); }
body.home .tile:hover, body.home .tile:focus-visible { background: #fff; border-color: color-mix(in srgb, var(--c) 50%, #fff);
  box-shadow: 0 2px 4px rgba(10,30,50,.12), 0 20px 36px -12px rgba(10,30,50,.55); }
.widget { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; margin-bottom: 14px; }
.widget h2 { margin-top: 0; }

/* buttons */
.btn { display: inline-flex; align-items: center; gap: 6px; border: 1px solid transparent; border-radius: 6px; padding: 7px 14px; font: inherit; font-weight: 500; cursor: pointer; line-height: 1.2; white-space: nowrap; }
.btn.primary { background: var(--cyan); color: #fff; }
.btn.primary:hover { background: var(--cyan-dark); }
.btn.secondary { background: #fff; color: var(--navy); border-color: var(--line); }
.btn.secondary:hover { border-color: var(--cyan); }
.btn.success { background: var(--ok); color: #fff; }
.btn.warning { background: var(--warn); color: #fff; }
.btn.ghost { background: none; color: var(--navy); }
.btn.ghost:hover { background: rgba(22,44,66,.06); }
.btn.danger { color: var(--danger); }
.btn.danger:not(.ghost) { background: var(--danger); color: #fff; }
.btn.small { padding: 4px 10px; font-size: 13px; }
.btn.wide { width: 100%; justify-content: center; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }

/* control bar */
.control-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin-bottom: 12px; }
.cb-left, .cb-right { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.cb-right { margin-left: auto; }
.cb-search { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.search-box { display: flex; align-items: center; gap: 6px; background: #fff; border: 1px solid var(--line); border-radius: 6px; padding: 0 8px; }
.search-box input { border: 0; outline: 0; padding: 7px 0; width: 240px; font: inherit; background: none; }
.cb-search select { padding: 6px; border: 1px solid var(--line); border-radius: 6px; background: #fff; font: inherit; max-width: 220px; }
.check { display: inline-flex; align-items: center; gap: 4px; color: var(--muted); }
.crumbs { font-size: 18px; margin-right: 8px; }
.crumbs a { color: var(--muted); }
.chips { display: flex; gap: 6px; margin-bottom: 10px; flex-wrap: wrap; }
.chip { background: #e3f4fa; color: var(--navy); border-radius: 14px; padding: 3px 10px; }
.chip a { margin-left: 6px; color: var(--navy); font-weight: 600; }

/* lists */
.table-wrap { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); overflow-x: auto; }
table.list { width: 100%; border-collapse: collapse; }
table.list th { text-align: left; font-weight: 600; font-size: 13px; color: var(--muted); padding: 9px 10px; border-bottom: 1px solid var(--line); background: #fafbfc; white-space: nowrap; }
table.list th a { color: inherit; }
table.list td { padding: 8px 10px; border-bottom: 1px solid #eef1f4; }
table.list tr.clickable { cursor: pointer; }
table.list tr.clickable:hover td { background: #f0f9fc; }
table.list td.num, table.list th.num { text-align: right; font-variant-numeric: tabular-nums; }
table.list tfoot td { font-weight: 600; background: #fafbfc; }
.empty { text-align: center; color: var(--muted); padding: 30px !important; }
.pager { display: flex; justify-content: flex-end; align-items: center; gap: 8px; margin-top: 10px; }

/* record form */
.sheet { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 22px; }
.sheet.narrow { max-width: 520px; }
.statusbar { display: flex; justify-content: flex-end; gap: 0; margin: -6px 0 12px; flex-wrap: wrap; }
.statusbar .step { padding: 5px 14px; border: 1px solid var(--line); margin-left: -1px; color: var(--muted); font-size: 13px; background: #fafbfc; }
.statusbar .step:first-child { border-radius: 6px 0 0 6px; }
.statusbar .step:last-child { border-radius: 0 6px 6px 0; }
.statusbar .step.current { background: var(--cyan); color: #fff; border-color: var(--cyan); }
.statusbar .step.clickable { cursor: pointer; font: inherit; font-size: 13px; color: var(--navy); }
.statusbar .step.clickable:hover { background: #e3f4fa; border-color: var(--cyan); color: var(--cyan-dark); position: relative; z-index: 1; }
.smart-buttons { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; margin-bottom: 12px; }
.smart { border: 1px solid var(--line); border-radius: 6px; padding: 6px 12px; color: var(--navy); background: #fff; }
.smart:hover { border-color: var(--cyan); }
.smart strong { color: var(--cyan-dark); margin-right: 4px; }
.field-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px 32px; }
.field-grid.main { margin-bottom: 18px; }
.field { display: grid; grid-template-columns: 170px minmax(0, 1fr); align-items: start; gap: 8px; }
.field.wide { grid-column: 1 / -1; }
.field > label { color: var(--muted); padding-top: 7px; font-size: 13px; }
.field .req { color: var(--danger); }
.field.readonly .control { padding-top: 7px; }
.control input:not([type=checkbox]):not([type=radio]):not([type=file]), .control select, .control textarea, table.lines input:not([type=checkbox]), table.lines select, table.lines textarea {
  width: 100%; border: 0; border-bottom: 1px solid var(--line); padding: 6px 2px; font: inherit; background: transparent; border-radius: 0;
}
.control input:focus, .control select:focus, .control textarea:focus, table.lines input:focus, table.lines select:focus { outline: 0; border-bottom-color: var(--cyan); }
.control textarea { border: 1px solid var(--line); border-radius: 6px; padding: 6px 8px; resize: vertical; }
.control input[type=checkbox] { margin-top: 9px; width: 16px; height: 16px; }
.help { display: block; color: var(--muted); font-size: 12px; }
.error { display: block; color: var(--danger); font-size: 12px; }
.has-error input, .has-error select { border-bottom-color: var(--danger) !important; }

/* tabs */
.tabs { margin-top: 8px; }
.tab-heads { display: flex; gap: 2px; border-bottom: 1px solid var(--line); overflow-x: auto; }
.tab-head { background: none; border: 1px solid transparent; border-bottom: 0; padding: 8px 14px; font: inherit; cursor: pointer; color: var(--muted); border-radius: 6px 6px 0 0; white-space: nowrap; }
.tab-head.active { border-color: var(--line); background: #fff; color: var(--navy); font-weight: 500; margin-bottom: -1px; }
.tab-body { display: none; padding: 14px 2px; }
.tab-body.active { display: block; }

/* lines */
table.lines { width: 100%; border-collapse: collapse; }
table.lines th { text-align: left; font-size: 12px; color: var(--muted); font-weight: 600; padding: 6px 4px; border-bottom: 1px solid var(--line); }
table.lines td { padding: 2px 4px; border-bottom: 1px solid #eef1f4; vertical-align: top; }
table.lines td.del, table.lines th.del { width: 44px; text-align: center; }
table.lines tr.has-error td { background: #fff5f5; }
/* M06: remove a line with the bin. The hidden box is Django's DELETE: nothing is deleted until Save; the line is
   struck through meanwhile and the arrow (↺) keeps it. */
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.trash-toggle { position: relative; display: inline-flex; align-items: center; justify-content: center; width: 34px; height: 34px; border-radius: 8px; color: var(--muted); cursor: pointer; border: 0; background: none; padding: 0; }
.trash-toggle:hover { color: var(--danger); background: #fff5f5; }
.trash-toggle input { position: absolute; width: 1px; height: 1px; opacity: 0; margin: 0; pointer-events: none; }
.trash-toggle:focus-within, button.trash-toggle:focus-visible { outline: 2px solid var(--cyan); outline-offset: 1px; }
.trash-toggle .tt-restore { display: none; }
.trash-toggle input:checked ~ .tt-remove { display: none; }
.trash-toggle input:checked ~ .tt-restore { display: inline-flex; color: var(--cyan-dark); }
tr:has(> td.del .trash-toggle input:checked) > td:not(.del) { opacity: .45; text-decoration: line-through; pointer-events: none; }
tr:has(> td.del .trash-toggle input:checked) :is(input, select, textarea) { text-decoration: line-through; }
figure:has(.trash-toggle input:checked) img { opacity: .35; outline: 2px dashed var(--danger); }
.del-hint { display: none; margin-top: 4px; }
form:has(.trash-toggle input:checked) .del-hint { display: block; }

/* chatter */
.chatter { margin-top: 18px; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 22px; }
.chatter-actions { display: flex; gap: 12px; align-items: flex-start; flex-wrap: wrap; }
.note-form { display: flex; gap: 8px; flex: 1; align-items: flex-start; }
.note-form textarea { flex: 1; border: 1px solid var(--line); border-radius: 6px; padding: 6px 8px; font: inherit; }
.attachments { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }
.attachment { display: inline-flex; flex-direction: column; border: 1px solid var(--line); border-radius: 6px; padding: 6px 10px; color: var(--navy); }
.attachment small { color: var(--muted); }
.history { list-style: none; padding: 0; margin: 0; }
.history > li { border-left: 3px solid var(--line); padding: 6px 12px; margin-bottom: 8px; }
.history > li.h-note { border-left-color: var(--cyan); background: #f5fbfd; }
.history > li.h-state { border-left-color: var(--ok); }
.h-meta { font-size: 12px; color: var(--muted); }
.h-changes { margin: 4px 0 0; padding-left: 16px; font-size: 13px; }
.h-changes .old { color: var(--muted); text-decoration: line-through; }

/* autocomplete */
.ac { position: relative; display: flex; align-items: center; }
.ac .ac-text { flex: 1; }
.ac-new { border: 1px solid var(--line); background: #fff; border-radius: 4px; width: 26px; height: 26px; cursor: pointer; margin-left: 4px; color: var(--cyan-dark); font-weight: 600; flex: none; }
.ac-menu { position: absolute; top: 100%; left: 0; right: 30px; background: #fff; border: 1px solid var(--line); border-radius: 6px; box-shadow: 0 6px 18px rgba(0,0,0,.12); z-index: 30; max-height: 280px; overflow-y: auto; }
.ac-menu div { padding: 7px 10px; cursor: pointer; }
.ac-menu div:hover, .ac-menu div.sel { background: #e3f4fa; }
.ac-menu .ac-create { color: var(--cyan-dark); border-top: 1px solid var(--line); }

/* messages */
.messages { margin-bottom: 12px; }
.msg { padding: 9px 14px; border-radius: 6px; margin-bottom: 6px; background: #e7f5ff; color: #1864ab; }
.msg.success { background: #ebfbee; color: #2b8a3e; }
.msg.error { background: #fff5f5; color: #c92a2a; }
.msg.warning { background: #fff9db; color: #a5590c; }
.notif-list { list-style: none; padding: 0; margin: 0; }
.notif-list li a { display: flex; flex-direction: column; padding: 10px; border-bottom: 1px solid var(--line); color: var(--text); }
.notif-list li.unread a { background: #f0f9fc; }
.notif-list small { color: var(--muted); }

/* tags & status pills */
.pill { display: inline-block; padding: 2px 9px; border-radius: 10px; font-size: 12px; background: #eef1f4; color: var(--navy); }
.pill.ok { background: #ebfbee; color: #2b8a3e; } .pill.warn { background: #fff9db; color: #a5590c; } .pill.bad { background: #fff5f5; color: #c92a2a; } .pill.info { background: #e3f4fa; color: #0b7285; }

/* login */
.login-body { display: flex; align-items: center; justify-content: center; min-height: 100vh; background: linear-gradient(135deg, var(--navy) 0%, #1d4a6b 100%); }
.login-card { background: #fff; padding: 32px; border-radius: 12px; width: min(340px, calc(100vw - 32px)); display: flex; flex-direction: column; gap: 14px; box-shadow: 0 10px 40px rgba(0,0,0,.3); }
.login-logo { width: 220px; margin: 0 auto 10px; }
.login-product { margin: -6px 0 4px; text-align: center; font-size: 22px; font-weight: 600; letter-spacing: .14em; text-transform: uppercase; color: var(--navy); }
.login-product small { font-size: 12px; font-weight: 400; letter-spacing: .03em; text-transform: none; color: var(--muted); }
.login-card label { display: flex; flex-direction: column; gap: 4px; color: var(--muted); font-size: 13px; }
.login-card input { padding: 9px; border: 1px solid var(--line); border-radius: 6px; font: inherit; }

/* phone menu (drawer) — only shown on narrow screens, see the responsive block below */
.nav-toggle, .nav-drawer, .nav-backdrop { display: none; }
.x-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; max-width: 100%; }

/* responsive (technicians on phones/tablets) */
@media (max-width: 800px) {
  html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
  body { font-size: 16px; line-height: 1.4; overflow-wrap: break-word; }
  h1 { font-size: 20px; line-height: 1.25; }
  h2 { font-size: 17px; }
  h3 { font-size: 16px; }
  img, video { max-width: 100%; }

  /* top bar: menu button + logo + bell; the rest lives in the drawer */
  .topbar { gap: 8px; height: calc(52px + env(safe-area-inset-top)); padding: env(safe-area-inset-top) max(8px, env(safe-area-inset-right)) 0 max(8px, env(safe-area-inset-left)); }
  .nav-toggle { display: inline-flex; align-items: center; justify-content: center; width: 44px; height: 44px; border: 0; background: none; color: #fff; border-radius: 8px; cursor: pointer; flex: none; padding: 0; }
  .nav-toggle:active, .nav-toggle:focus-visible { background: rgba(255,255,255,.14); outline: 0; }
  .brand img { height: 22px; }
  .module-nav, .topbar .lang-switch, .topbar .user-menu { display: none; }
  .topbar-right { gap: 4px; }
  .icon-btn { width: 44px; height: 44px; align-items: center; justify-content: center; }
  .badge { top: 4px; right: 2px; }
  .nav-backdrop:not([hidden]) { display: block; position: fixed; inset: 0; background: rgba(10,20,30,.45); z-index: 40; }
  .nav-drawer:not([hidden]) { display: flex; flex-direction: column; position: fixed; top: 0; bottom: 0; left: 0; width: min(86vw, 330px); background: #fff; z-index: 41; overflow-y: auto; -webkit-overflow-scrolling: touch; overscroll-behavior: contain;
    padding: env(safe-area-inset-top) 0 calc(16px + env(safe-area-inset-bottom)) env(safe-area-inset-left); box-shadow: 4px 0 24px rgba(0,0,0,.25); }
  body.nav-open { overflow: hidden; }
  .drawer-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; background: var(--navy); color: #fff; padding: 4px 4px 4px 16px; min-height: 56px; }
  .drawer-user { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .drawer-close { width: 44px; height: 44px; border: 0; background: none; color: #fff; font-size: 30px; line-height: 1; cursor: pointer; flex: none; }
  .drawer-section { display: flex; align-items: center; gap: 8px; padding: 14px 16px 4px; font-size: 13px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .03em; border-top: 1px solid var(--line); margin-top: 6px; }
  .drawer-links { display: flex; flex-direction: column; padding: 4px 0; }
  .drawer-links a, .drawer-links button { display: flex; align-items: center; gap: 10px; min-height: 48px; padding: 10px 16px; color: var(--text); font: inherit; font-size: 16px; background: none; border: 0; text-align: left; width: 100%; cursor: pointer; }
  .drawer-links a.active { background: #e3f4fa; color: var(--navy); font-weight: 600; box-shadow: inset 4px 0 0 var(--cyan); }
  .drawer-links a:active, .drawer-links button:active { background: var(--bg); }
  .drawer-lang { display: flex; gap: 8px; padding: 8px 16px; }
  .drawer-lang button { flex: 1; min-height: 44px; border: 1px solid var(--line); background: #fff; border-radius: 8px; font: inherit; font-weight: 600; color: var(--navy); cursor: pointer; }
  .drawer-lang button.active { background: var(--cyan); border-color: var(--cyan); color: #fff; }
  .drawer-account { border-top: 1px solid var(--line); margin-top: 10px; }

  /* trail: back arrow + current screen only */
  .trail { top: calc(52px + env(safe-area-inset-top)); padding: 4px max(10px, env(safe-area-inset-right)) 4px max(10px, env(safe-area-inset-left)); gap: 8px; overflow: hidden; font-size: 14px; }
  .trail-back { width: 44px; height: 40px; font-size: 20px; }
  .trail-items { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .trail-items > :not(:last-child) { display: none; }

  .page { padding: 12px max(12px, env(safe-area-inset-right)) calc(40px + env(safe-area-inset-bottom)) max(12px, env(safe-area-inset-left)); }

  /* touch-friendly controls; 16px text stops iOS from zooming into fields */
  input, select, textarea, button { font-size: 16px; }
  .btn { min-height: 44px; padding: 9px 16px; justify-content: center; }
  .btn.small { min-height: 40px; padding: 7px 12px; font-size: 15px; }
  .control input:not([type=checkbox]):not([type=radio]):not([type=file]), .control select,
  table.lines input:not([type=checkbox]):not([type=radio]), table.lines select { min-height: 44px; font-size: 16px; }
  .control textarea, table.lines textarea { font-size: 16px; min-height: 88px; }
  input[type=checkbox], input[type=radio] { width: 22px; height: 22px; accent-color: var(--cyan); }
  .control input[type=checkbox] { margin-top: 6px; width: 22px; height: 22px; }
  input[type=file] { max-width: 100%; font-size: 15px; padding: 8px 0; }
  input[type=file]::file-selector-button { min-height: 44px; padding: 8px 14px; margin-right: 10px; border: 1px solid var(--line); border-radius: 8px; background: #fff; color: var(--navy); font: inherit; font-weight: 500; }
  .safety-table td.c, .safety-table th:not(:first-child) { width: 56px; }
  .safety-table label.tap { display: flex; align-items: center; justify-content: center; min-height: 44px; cursor: pointer; }
  .safety-table tr.sec th label { display: inline-flex; align-items: center; gap: 4px; min-height: 40px; }
  .photo-grid { gap: 8px; }
  label.check { min-height: 40px; gap: 8px; }

  /* control bars: title + actions wrap, nothing overflows */
  .control-bar { gap: 10px; }
  .cb-left, .cb-right { width: 100%; gap: 8px; }
  .cb-right { margin-left: 0; }
  .cb-right .btn, .cb-left .btn { flex: 1 1 auto; }
  .cb-search { width: 100%; }
  .search-box { flex: 1 1 100%; min-height: 44px; }
  .search-box input { width: 100%; min-width: 0; padding: 10px 0; }
  /* a long option ("(without service type)") never widens the page: the box shrinks, its text is cut */
  .cb-search select { flex: 1 1 140px; min-width: 0; max-width: 100%; min-height: 44px; }
  .crumbs { font-size: 17px; width: 100%; margin: 0; }
  .chip { padding: 6px 12px; } .chip a { padding: 4px; }
  .pager { justify-content: center; }
  .pager .btn { min-width: 52px; }

  /* record form: one column, labels above */
  .field-grid { grid-template-columns: 1fr; gap: 10px; }
  .field { grid-template-columns: 1fr; gap: 2px; }
  .field > label { padding-top: 0; font-size: 14px; }
  .field.readonly .control { padding-top: 0; }
  .sheet { padding: 12px; }
  .statusbar { justify-content: flex-start; gap: 6px; margin: 0 0 12px; }
  .statusbar .step, .statusbar .step:first-child, .statusbar .step:last-child { margin: 0; border-radius: 18px; min-height: 36px; padding: 6px 14px; display: inline-flex; align-items: center; font-size: 14px; }
  .statusbar .step.clickable { min-height: 44px; font-size: 14px; }
  .smart-buttons { justify-content: flex-start; }
  .smart { min-height: 44px; display: inline-flex; align-items: center; flex: 1 1 auto; justify-content: center; }
  .tab-heads { scrollbar-width: none; -webkit-overflow-scrolling: touch; margin: 0 -12px; padding: 0 12px; }
  .tab-heads::-webkit-scrollbar { display: none; }
  .tab-head { min-height: 46px; padding: 10px 14px; font-size: 15px; }
  .ac-new { width: 40px; height: 40px; font-size: 20px; }
  .ac-menu { right: 0; }
  .ac-menu div { padding: 12px; }

  /* chatter */
  .chatter { padding: 12px; }
  .note-form { flex-direction: column; align-items: stretch; width: 100%; }
  .note-form textarea { min-height: 80px; font-size: 16px; }

  /* dropdown in the user menu (still used inside popups) */
  .user-menu .dropdown a, .user-menu .dropdown button { min-height: 44px; }

  .widget { padding: 12px; }
  /* M01: the version is hidden on phones (TELEMAR | ASTRA) */
  .brand-product { font-size: 13px; padding-left: 8px; }
  .brand-product small { display: none; }
  .trash-toggle { width: 44px; height: 44px; }

  /* misc wide bits */
  .wide-input { width: 100%; min-height: 44px; }
  .inline-form { display: flex; max-width: 100%; }
  .inline-form > * { max-width: 100%; min-width: 0; }
  input[type=file] { width: 100%; }
  .contract-banner form { flex-wrap: wrap; }
  .quote-notes { min-width: 0; }
  table.totals { min-width: 0; width: 100%; }
  table.totals td.num, table.totals .num { white-space: nowrap; }
  .kpi { flex: 1 1 140px; min-width: 0; }
  .two-cols { grid-template-columns: 1fr; }
  .report-cards { grid-template-columns: 1fr; }
  .job-card { padding: 10px 12px; }
  .jc-col > div > span:first-child { flex-basis: 96px; }
  .photos img { width: 96px; height: 96px; }
  .notif-list li a { padding: 12px 10px; min-height: 56px; }
  .login-card { padding: 24px 20px; }
  .login-card input { min-height: 46px; }
  body .mx-defs dl { grid-template-columns: 1fr; }
  body .mx-select { max-width: 100%; }
}

/* lists and inline lines as cards on phones (cells are labelled by erp.js) */
@media (max-width: 640px) {
  .table-wrap.has-cards { border: 0; background: none; overflow: visible; }
  table.list.cards, table.list.cards > tbody, table.list.cards > tfoot, table.list.cards tr, table.list.cards td { display: block; width: 100%; }
  table.list.cards > thead { display: none; }
  table.list.cards > tbody > tr, table.list.cards > tfoot > tr { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 14px; margin-bottom: 10px; }
  table.list.cards tr.clickable:active { border-color: var(--cyan); background: #f0f9fc; }
  table.list.cards tr.clickable:hover td { background: none; }
  table.list.cards td { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; padding: 3px 0; border: 0; text-align: right; min-height: 26px;
    overflow-wrap: anywhere; }  /* a long email or reference wraps instead of widening the page */
  table.list.cards td::before { content: attr(data-label); flex: 0 0 auto; max-width: 45%; color: var(--muted); font-size: 14px; text-align: left; }
  table.list.cards td:first-child { font-weight: 600; font-size: 17px; text-align: left; color: var(--navy); padding-bottom: 6px; }
  table.list.cards td:first-child::before, table.list.cards td[data-label=""]::before, table.list.cards td.span::before { display: none; }
  table.list.cards td.span, table.list.cards td[data-label=""] { justify-content: flex-start; text-align: left; }
  table.list.cards td.blank { display: none; }
  table.list.cards td.empty { display: block; text-align: center; }
  table.list.cards td.num { text-align: right; }
  table.list.cards td input:not([type=checkbox]):not([type=radio]), table.list.cards td select { max-width: 60%; min-height: 40px; font-size: 16px; text-align: right; }
  table.list.cards td .btn { flex: none; }
  /* a list inside a form tab: lighter cards */
  .tab-body table.list.cards > tbody > tr, .sheet table.list.cards > tbody > tr { box-shadow: none; }

  table.lines.cards, table.lines.cards > tbody, table.lines.cards tr, table.lines.cards td { display: block; width: 100%; }
  table.lines.cards > thead { display: none; }
  table.lines.cards > tbody > tr { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: 14px; border: 1px solid var(--line); border-radius: var(--radius); padding: 8px 12px; margin-bottom: 10px; background: #fff; }
  table.lines.cards > tbody > tr.has-error { border-color: var(--danger); }
  table.lines.cards td { border: 0; padding: 4px 0; grid-column: 1 / -1; min-width: 0; }
  table.lines.cards td.half { grid-column: auto; }
  table.lines.cards td::before { content: attr(data-label); display: block; color: var(--muted); font-size: 13px; }
  table.lines.cards td[data-label=""]::before { display: none; }
  table.lines.cards td.del { width: auto; text-align: left; padding-top: 8px; }
  table.lines.cards td.blank { display: none; }
}
/* home on phones: 3 tiles per row (15 → 5 × 3, 14 → 4 × 3 + 2 centred, 6 → 2 × 3) */
@media (max-width: 640px) {
  .home-wrap { min-height: calc(100vh - 130px); min-height: calc(100svh - 130px); }
  .tiles { --gap: 10px; max-width: none; }
  .tile { flex-basis: calc((100% - 2 * var(--gap)) / 3); padding: 8px 4px; gap: 6px; border-radius: 16px; }
  .porthole { --size: clamp(42px, 13vw, 52px); padding: 4px; }
  .porthole .icon { width: 26px; height: 26px; }
  .tile-label { font-size: 12.5px; }
}
@media (max-width: 340px) { .tile { flex-basis: calc((100% - var(--gap)) / 2); } }
@media print { .topbar, .trail, .nav-drawer, .control-bar, .chatter { display: none; } .sheet { border: 0; } }

/* ---- job card (Work Order) ---- */
.job-card { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 28px; background: #f5fbfd; border: 1px solid #cfe9f3; border-radius: var(--radius); padding: 12px 16px; margin-bottom: 16px; }
.jc-col { display: flex; flex-direction: column; gap: 4px; }
.jc-col > div { display: flex; gap: 8px; align-items: baseline; }
.jc-col > div > span:first-child { flex: 0 0 105px; color: var(--muted); font-size: 12px; }
.jc-wide div > span:first-child { color: var(--muted); font-size: 12px; }
@media (max-width: 800px) { .job-card { grid-template-columns: 1fr; } }
.jc-wide { grid-column: 1 / -1; display: flex; flex-direction: column; gap: 6px; border-top: 1px solid #cfe9f3; padding-top: 8px; }
.jc-wide div > span:first-child { display: block; }
/* ---- profit ---- */
.kpis { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 12px; }
.kpi { background: #fafbfc; border: 1px solid var(--line); border-radius: var(--radius); padding: 8px 14px; min-width: 140px; }
.kpi span { display: block; color: var(--muted); font-size: 12px; }
.kpi strong { font-size: 16px; font-weight: 600; }
.kpi.good strong { color: var(--ok); } .kpi.bad strong { color: var(--danger); }
.narrow-table { max-width: 520px; }
table.compact td, table.compact th { padding: 5px 8px; }
/* ---- contract banner ---- */
.contract-banner { border-radius: var(--radius); padding: 10px 14px; margin-bottom: 12px; border: 1px solid; }
.contract-banner.pending { background: #fff9db; border-color: #fcc419; }
.contract-banner.ok { background: #ebfbee; border-color: #b2f2bb; }
.contract-banner .cb-title { margin-bottom: 6px; }
.contract-banner .cb-body { font-size: 13px; display: flex; flex-direction: column; gap: 2px; margin-bottom: 8px; }
.contract-banner form { display: flex; gap: 10px; align-items: center; }
/* ---- service / supply line editor ---- */
.svc-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.quote-lines .w-product { width: 24%; } .quote-lines .w-num { width: 8%; text-align: right; }
.quote-form h2 { margin-top: 22px; }
.lines-scroll { overflow-x: auto; }
.quote-lines tr.is-note td { background: #fafbfc; font-style: italic; }
.price-note { color: var(--muted); }
.line-buttons { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 4px; }
.quote-bottom { display: flex; gap: 30px; justify-content: space-between; align-items: flex-start; margin-top: 16px; flex-wrap: wrap; }
.quote-notes { flex: 1; min-width: 280px; display: flex; flex-direction: column; gap: 4px; }
table.totals { min-width: 260px; border-collapse: collapse; }
table.totals td { padding: 4px 8px; } table.totals .num { text-align: right; }
table.totals tr.grand td { border-top: 2px solid var(--navy); font-weight: 600; font-size: 15px; }
/* a subcontracted service is offered its Sub/ concepts (catalog.subcontract, quotation.js), in the subcontractors'
   colour of the calendar: a note above the lines and a suggestion under each line that has one; never forced */
.sub-hint { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; margin: 0 0 10px; padding: 10px 12px; border: 1px solid #e3d5cc; border-left: 4px solid #8D6E63; border-radius: 8px; background: #faf6f3; color: #4e342e; font-size: 13px; }
.sub-hint[hidden], .sub-hint [hidden] { display: none; }
.sub-hint > span:not(.sub-hint-tag) { flex: 1 1 320px; }
.sub-hint .btn { max-width: 100%; white-space: normal; text-align: left; }
.sub-hint-tag { flex: none; padding: 1px 8px; border-radius: 9px; background: #8D6E63; color: #fff; font-size: 11px; font-weight: 700; letter-spacing: .06em; }
.sub-chip { display: inline-flex; align-items: center; max-width: 100%; margin-top: 4px; padding: 2px 9px; border: 1px dashed #8D6E63; border-radius: 12px; background: #fff; color: #5d4037; font: inherit; font-size: 12px; text-align: left; cursor: pointer; }
.sub-chip:hover { background: #efebe9; }
.sub-chip:focus-visible { outline: 2px solid var(--cyan); outline-offset: 2px; }
/* ---- scheduling, service report ---- */
.call-info { background: #f5fbfd; border: 1px solid #cfe9f3; border-radius: var(--radius); padding: 10px 14px; margin-bottom: 12px; display: flex; gap: 14px; flex-wrap: wrap; }
.checklist ul { list-style: none; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: 6px 18px; }
.sr-form h2 { border-bottom: 1px solid var(--line); padding-bottom: 4px; margin-top: 22px; color: var(--navy); }
.photo-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.photos { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 8px; }
.photos figure { margin: 0; display: flex; flex-direction: column; align-items: center; font-size: 12px; }
.photos img { width: 110px; height: 110px; object-fit: cover; border-radius: 6px; border: 1px solid var(--line); }
.safety-table th { background: #e9ecef; text-align: left; } .safety-table td.c, .safety-table th:not(:first-child) { text-align: center; width: 70px; }
.safety-table tr.sec th { padding: 6px; }
.sr-after { margin-top: 16px; }
.correct-box { margin-top: 12px; } .correct-box summary { cursor: pointer; color: var(--warn); }
.wide-input { width: 60%; padding: 6px; border: 1px solid var(--line); border-radius: 6px; font: inherit; }
@media (max-width: 800px) { .photo-grid { grid-template-columns: 1fr; } }
/* ---- misc ---- */
.eqlist-actions, .row-actions { display: flex; flex-wrap: wrap; gap: 8px; margin: 8px 0; }
.report-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; }
.report-cards .widget { color: var(--text); } .report-cards .widget:hover { border-color: var(--cyan); }
.two-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 900px) { .two-cols { grid-template-columns: 1fr; } }
table.report tr.group td { background: #f3f6f9; }
table.report tr.sub td:first-child { padding-left: 24px; color: var(--muted); }
table.report td.neg, .neg { color: var(--danger); }
.inline-form { display: inline-flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.bank-line.done { opacity: .7; }
.bl-head { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.bl-amount { margin-left: auto; font-weight: 600; font-size: 15px; }
.bl-match { display: flex; flex-direction: column; gap: 4px; margin: 8px 0; }
.upcoming { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 6px; }
.upcoming a { color: var(--text); }
input.incomplete { background: #fff9db; }
/* Bulk selection on lists */
.bulk-bar { position: sticky; top: 0; z-index: 30; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px 16px; margin: 0 0 12px; padding: 10px 14px; background: #e7f5fb; border: 1px solid #b6e0f0; border-radius: var(--radius); box-shadow: 0 4px 14px rgba(22,44,66,.08); }
.bulk-bar[hidden] { display: none; }
.bulk-count { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; }
.bulk-controls { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.bulk-controls select, .bulk-controls input { min-width: 180px; padding: 6px 8px; border: 1px solid var(--line); border-radius: 6px; background: #fff; font: inherit; min-height: 36px; }
.linklike { background: none; border: 0; padding: 0; color: var(--cyan); cursor: pointer; font: inherit; text-decoration: underline; }
table.list th.sel, table.list td.sel { width: 36px; text-align: center; padding-left: 10px; padding-right: 4px; }
table.list td.sel input, table.list th.sel input { width: 18px; height: 18px; cursor: pointer; }
table.list tr.selected td { background: #eef8fc; }
@media (max-width: 640px) {
  /* three rows over the cards, not six: count + Excel, status + Apply, field + Apply (its value box below) */
  .bulk-bar { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; align-items: center; padding: 8px 10px; }
  .bulk-controls { display: contents; }
  .bulk-count { grid-row: 1; grid-column: 1; }
  .bulk-controls [data-bulk-excel] { grid-row: 1; grid-column: 2; padding-left: 12px; padding-right: 12px; }
  .bulk-controls [data-bulk-excel] .bulk-excel-text { display: none; }  /* the icon alone; its name is read aloud */
  /* finger-sized targets (the selects would keep their 36 px desktop rule, which is more specific than "> *") */
  .bulk-controls > *, .bulk-controls select, .bulk-controls input { min-width: 0; min-height: 44px; font-size: 16px; }
  .bulk-controls select, .bulk-controls input { width: 100%; }
  .bulk-controls [data-bulk-value] { grid-column: 1 / -1; order: 1; }
  table.list.cards.selectable > tbody > tr { position: relative; padding-right: 52px; }
  table.list.cards td.sel { position: absolute; top: 8px; right: 6px; width: 44px; height: 44px; display: flex; align-items: center; justify-content: center; padding: 0; }
  table.list.cards td.sel::before { display: none; }
  table.list.cards td.sel input { width: 24px; height: 24px; }
  table.list.cards.selectable td.sel + td { font-weight: 600; font-size: 17px; text-align: left; color: var(--navy); padding-bottom: 6px; justify-content: flex-start; }
  table.list.cards.selectable td.sel + td::before { display: none; }
  table.list.cards tr.selected { border-color: var(--cyan); background: #eef8fc; }
}

/* People: same colour everywhere (apps/core/people.py) */
.pchip { display: inline-flex; align-items: center; gap: 5px; white-space: nowrap; }
.pdot { width: 9px; height: 9px; border-radius: 50%; flex: 0 0 9px; display: inline-block; }
.avatar { display: inline-flex; align-items: center; justify-content: center; width: 24px; height: 24px; border-radius: 50%; color: #fff; font-size: 11px; font-weight: 600; letter-spacing: .02em; vertical-align: middle; }

/* Search fields work as drop-downs: arrow opens the whole list (apps/core/widgets/autocomplete.html) */
.ac-toggle { border: 1px solid var(--line); background: #fff; border-radius: 4px; width: 26px; height: 26px; cursor: pointer; margin-left: 4px; color: var(--muted); flex: none; font-size: 13px; line-height: 1; }
.ac-toggle:hover { color: var(--navy); border-color: var(--cyan); }
.ac-menu { max-height: 340px; }
.ac-menu div.current { font-weight: 600; }
.ac-menu .ac-more { color: var(--cyan-dark); text-align: center; border-top: 1px dashed var(--line); }
.ac-menu .ac-none { color: var(--muted); cursor: default; }
@media (max-width: 800px) { .ac-toggle { width: 40px; height: 40px; font-size: 16px; } }
.ac-menu.floating { position: fixed; right: auto; z-index: 1000; }

/* Column filters of the lists (M03, apps/core/listfilters.py): a row under the column titles; on phones behind
   the "Filters" button */
/* as specific as `table.list th` and more, so the boxes are not drawn semi-bold like the column titles */
table.list tr.col-filters th { padding: 4px 6px; background: #fafbfc; border-bottom: 1px solid var(--line); font-weight: 400; }
.col-filters input, .col-filters select { width: 100%; min-width: 70px; padding: 4px 6px; border: 1px solid var(--line); border-radius: 5px; background: #fff; font: inherit; font-size: 13px; }
.col-filters input:focus, .col-filters select:focus { outline: 0; border-color: var(--cyan); }
.col-filters input.invalid { border-color: var(--danger); background: #fff5f5; }
.col-hint { display: none; }
.col-filters-toggle { display: none; }
.col-chip { background: #fff4e0; }
.wo-ref { white-space: nowrap; }
.wo-ref a { font-weight: 600; }
@media (max-width: 640px) {
  .col-filters-toggle { display: inline-flex; }
  .table-wrap.has-cards table.list.cards > thead { display: block; }
  table.list.cards > thead > tr { display: none; }
  table.list.cards > thead > tr.col-filters.open { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 10px; background: none; }
  table.list.cards > thead tr.col-filters th { display: block; padding: 0; border: 0; background: none; }
  table.list.cards > thead tr.col-filters th:empty { display: none; }
  .col-filters input, .col-filters select { min-height: 44px; font-size: 16px; }
  .col-hint { display: block; margin-top: 2px; font-size: 12px; line-height: 1.3; color: var(--muted); }  /* no tooltips on phones */
}

/* Pop-up dialog (a[data-dialog] → core/dialog_frame.html): full screen on phones with the buttons always visible */
.erp-dialog { width: min(760px, calc(100vw - 32px)); max-height: calc(100vh - 48px); padding: 0; border: 0; border-radius: 12px; box-shadow: 0 18px 50px rgba(10,20,30,.35); color: var(--text); background: #fff; }
.erp-dialog::backdrop { background: rgba(10,20,30,.45); }
.dialog-frame { display: flex; flex-direction: column; max-height: calc(100vh - 48px); }
.dialog-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 16px; border-bottom: 1px solid var(--line); }
.dialog-title { margin: 0; font-size: 17px; }
.dialog-close { width: 44px; height: 44px; border: 0; background: none; font-size: 28px; line-height: 1; color: var(--muted); cursor: pointer; border-radius: 8px; flex: none; }
.dialog-close:hover { color: var(--navy); background: var(--bg); }
.dialog-body { padding: 14px 16px; overflow-y: auto; }
.dialog-foot { position: sticky; bottom: -14px; display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; margin: 14px -16px -14px; padding: 12px 16px; background: #fff; border-top: 1px solid var(--line); }
@media (max-width: 640px) {
  .erp-dialog { width: 100vw; max-width: 100vw; height: 100%; max-height: 100%; margin: 0; border-radius: 0; }
  .dialog-frame { height: 100%; max-height: 100%; }
  .dialog-body { flex: 1; padding: 12px 16px calc(12px + env(safe-area-inset-bottom)); }
  .dialog-foot { margin: 14px -16px calc(-12px - env(safe-area-inset-bottom)); padding-bottom: calc(12px + env(safe-area-inset-bottom)); }
  .dialog-foot .btn { flex: 1 1 auto; min-height: 44px; }
}

/* Technician chip (core.people.tech_chip): the person's colour, readable ink, bold code + name; outline = helper */
.tchip { display: inline-flex; align-items: center; gap: 6px; max-width: 100%; padding: 2px 10px 2px 4px; border-radius: 14px; background: var(--tc, #868E96); color: var(--tc-ink, #fff); font-size: 13px; line-height: 20px; white-space: nowrap; overflow: hidden; vertical-align: middle; border: 1.5px solid var(--tc, #868E96); }
.tchip b { display: inline-flex; align-items: center; justify-content: center; flex: none; min-width: 22px; height: 20px; padding: 0 5px; border-radius: 10px; background: rgba(255,255,255,.25); font-weight: 700; letter-spacing: .02em; }
.tchip-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }  /* long names end in "…" */
.tchip.outline { background: #fff; color: var(--text); }
.tchip.outline b { background: var(--tc, #868E96); color: var(--tc-ink, #fff); }
@media (max-width: 800px) { .tchip { font-size: 14px; line-height: 24px; } .tchip b { height: 24px; } }

/* Upload component (M12/M18, core/partials/upload_buttons.html + core/upload.js): camera only on touch screens */
.upload-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.upload-bar input[type=file] { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); border: 0; opacity: 0; }
.upload-bar label.btn { position: relative; cursor: pointer; }
.upload-bar label.btn:focus-within { outline: 2px solid var(--cyan); outline-offset: 2px; }
.upload-camera { display: none; }
.upload-status { font-size: 13px; color: var(--muted); }
.upload-previews { display: flex; flex-wrap: wrap; gap: 8px; width: 100%; }
.upload-preview { position: relative; display: inline-flex; align-items: center; }
.upload-previews img { width: 64px; height: 64px; object-fit: cover; border-radius: 6px; border: 1px solid var(--line); }
.upload-file { display: inline-block; max-width: 180px; padding: 6px 30px 6px 10px; border: 1px solid var(--line); border-radius: 6px; background: #fafbfc; font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* × takes a file out of the list before saving: a round button on the corner, its touch area 44 px */
.upload-remove { position: absolute; top: -8px; right: -8px; width: 26px; height: 26px; padding: 0; border: 0; border-radius: 50%; background: var(--navy); color: #fff; font-size: 17px; line-height: 26px; text-align: center; cursor: pointer; box-shadow: 0 1px 3px rgba(10,20,30,.3); }
.upload-remove::after { content: ""; position: absolute; inset: -9px; }
.upload-remove:focus-visible { outline: 2px solid var(--cyan); outline-offset: 2px; }
.upload-file + .upload-remove { top: 50%; right: 4px; margin-top: -13px; }
.upload-retry { display: inline-flex; align-items: center; margin-left: 6px; }  /* after "The upload failed." */
@media (pointer: coarse) { .upload-camera { display: inline-flex; } .upload-hint { display: none; } }
@media (max-width: 800px) { .upload-bar label.btn, .upload-retry { min-height: 44px; } .upload-previews img { width: 76px; height: 76px; } }
[data-dropzone] { position: relative; border-radius: var(--radius); transition: background .15s, outline-color .15s; outline: 2px dashed transparent; outline-offset: 4px; }
[data-dropzone].is-dragover { outline-color: var(--cyan); background: #f0f9fc; }
.attachments-block { margin-top: 12px; }
.attachments-block .attachments { margin-top: 10px; }
.attachments .attachment { gap: 2px; max-width: 220px; }
.attachments .attachment > a { display: inline-flex; align-items: center; gap: 6px; color: var(--navy); min-width: 0; }
.attachments .attachment.is-image > a { flex-direction: column; align-items: flex-start; }
.attachments .attachment img { width: 120px; height: 90px; object-fit: cover; border-radius: 6px; border: 1px solid var(--line); background: var(--bg); }
.att-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 190px; }
.att-expense { margin-top: 2px; }
.att-expense .linklike { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; }
@media (max-width: 800px) { .att-expense .linklike { min-height: 44px; padding: 0 6px; font-size: 14px; } }  /* a main action of technicians */
@media (max-width: 640px) { .attachments .attachment { max-width: calc(50% - 4px); } .attachments .attachment img { width: 100%; height: 110px; } }

/* Area sections (Telemar Astra rev1.0): each step adds its rules only inside its own section below */
/* ---- calendar & WO boxes ---- */
/* Calendar page (M24, planning/calendar.html; owner 02/11/2026: the calendar first, a professional look): the
   technicians' slots on top (a radar each: sweeping while he has jobs, pinging while one is not opened yet, still when
   he has none; today and his next 14 days), a slot opening his Work Order box (M09) below them; the tools (search, go
   to a date, print, shortcuts), the people and the legend; then the calendar, which takes the page (month, week, the
   Team view, the agenda). A person is always drawn in his colour: --p (colour), --ink (readable text on it), --tex
   (texture lines over it), --p-soft (light fill), all computed by core.people. What kind of entry it is is told by its
   texture, never by a colour. Tokens only (--card, --line, --text, --muted): a dark theme only has to redefine them.
   The box is also the home widget "My Work Orders". */
.cal-page { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.cal-page > .control-bar { margin-bottom: 0; }
.wo-boxes { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.wo-boxes.is-empty { display: none; }
/* the slots: one per technician, sharing the row (as many in a row as fit); a technician's only slot keeps a slot's
   width */
.wo-slots { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(260px, 100%), 1fr)); gap: 10px; }
.wo-slots:has(> .wo-slot:only-child) { grid-template-columns: minmax(0, 440px); }
.wo-slot { --p: #868E96; --ink: #fff; --p-soft: #868E9640; position: relative; display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: center; gap: 8px 12px; min-width: 0; padding: 11px 12px 9px 10px; border: 1px solid var(--line); border-radius: 14px; background: linear-gradient(180deg, #fff 0%, #f6f9fc 100%); color: var(--text); font: inherit; text-align: left; cursor: pointer; box-shadow: 0 1px 2px rgba(22,44,66,.06), 0 8px 18px -12px rgba(22,44,66,.28); transition: transform .15s ease, box-shadow .15s ease, border-color .15s ease; }
.wo-slot::before { content: ""; position: absolute; left: 14px; right: 14px; top: -1px; height: 3px; border-radius: 0 0 3px 3px; background: var(--p); }
.wo-slot:hover { transform: translateY(-1px); border-color: #c5d0db; box-shadow: 0 2px 4px rgba(22,44,66,.08), 0 14px 26px -14px rgba(22,44,66,.38); }
.wo-slot[aria-expanded="true"] { background: #fff; border-color: var(--p); box-shadow: 0 0 0 3px var(--p-soft), 0 12px 24px -14px rgba(22,44,66,.4); }
.wo-slot:focus-visible { outline: 2px solid var(--cyan); outline-offset: 3px; }
.wo-slot.is-idle { background: #f8fafc; }
.wo-slot.is-idle::before { opacity: .45; }
/* the radar scope: rings and a cross on a dark sea, his code on it in his colour */
.radar { position: relative; flex: none; display: grid; place-items: center; width: 54px; height: 54px; }
.radar-scope { position: absolute; inset: 0; overflow: hidden; border-radius: 50%; background: repeating-radial-gradient(circle, transparent 0 8px, rgba(159,216,234,.17) 8px 9px), linear-gradient(transparent calc(50% - .5px), rgba(159,216,234,.2) 0 calc(50% + .5px), transparent 0), linear-gradient(90deg, transparent calc(50% - .5px), rgba(159,216,234,.2) 0 calc(50% + .5px), transparent 0), radial-gradient(circle, #13405f 0%, #0a2238 75%); box-shadow: inset 0 0 12px rgba(0,0,0,.5), 0 0 0 2px #fff, 0 0 0 4px var(--p); }
.wo-slot.is-idle .radar-scope { opacity: .5; filter: grayscale(1); box-shadow: inset 0 0 12px rgba(0,0,0,.5), 0 0 0 2px #fff, 0 0 0 4px #cfd6de; }
/* the beam: a bright leading edge and a fading trail, one turn in 3.6 s */
.radar-sweep { position: absolute; inset: 0; border-radius: 50%; background: conic-gradient(transparent 0 250deg, var(--p-soft) 300deg, var(--p) 359deg, transparent 360deg); background: conic-gradient(transparent 0 250deg, color-mix(in srgb, var(--p) 22%, transparent) 300deg, color-mix(in srgb, var(--p) 75%, #fff) 359deg, transparent 360deg); animation: radar-sweep 3.6s linear infinite; }
/* a blip per job (up to three), lit as the beam passes over it */
.radar-blip { position: absolute; width: 5px; height: 5px; margin: -2.5px 0 0 -2.5px; border-radius: 50%; background: #effcff; box-shadow: 0 0 5px 2px var(--p); opacity: 0; animation: radar-blip 3.6s linear infinite; }
.radar-blip:nth-child(2) { left: 73%; top: 31%; animation-delay: .5s; }
.radar-blip:nth-child(3) { left: 58%; top: 73%; animation-delay: 1.6s; }
.radar-blip:nth-child(4) { left: 18%; top: 56%; animation-delay: 2.6s; }
/* a job not opened yet: echoes leave the scope (one every 1.2 s, far below 3 flashes a second, WCAG 2.3.1) */
.radar-ping { position: absolute; inset: 0; border-radius: 50%; border: 2px solid var(--p); opacity: 0; pointer-events: none; animation: radar-ping 2.4s cubic-bezier(.2,.6,.3,1) infinite; }
.radar-ping + .radar-ping { animation-delay: 1.2s; }
@keyframes radar-sweep { to { transform: rotate(1turn); } }
@keyframes radar-blip { 0% { opacity: 1; transform: scale(1.3); } 55% { opacity: .15; transform: scale(1); } 100% { opacity: 0; } }
@keyframes radar-ping { 0% { opacity: .9; transform: scale(.9); } 80%, 100% { opacity: 0; transform: scale(1.6); } }
.radar .wo-avatar { position: relative; z-index: 1; min-width: 30px; height: 22px; padding: 0 6px; border-radius: 11px; font-size: 12px; box-shadow: 0 1px 3px rgba(0,0,0,.5), 0 0 0 1.5px rgba(255,255,255,.9); }
.wo-slot.is-idle .radar .wo-avatar { background: #fff; color: #5c6b7a; box-shadow: 0 1px 2px rgba(0,0,0,.25), inset 0 0 0 2px var(--p); }
.wo-slot-body { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.wo-slot-name { overflow: hidden; color: var(--navy); font-size: 14.5px; font-weight: 600; text-overflow: ellipsis; white-space: nowrap; }
.wo-slot-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 6px; color: var(--muted); font-size: 12px; }
.wo-slot-today { display: flex; align-items: center; gap: 6px; min-width: 0; font-size: 12.5px; }
.wo-slot-today-text { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wo-slot-dot { flex: none; width: 8px; height: 8px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 0 2px rgba(47,158,68,.18); }
.wo-slot-today.k-job .wo-slot-dot, .wo-slot-today.k-activity .wo-slot-dot { background: var(--p); box-shadow: 0 0 0 2px var(--p-soft); }
.wo-slot-today.k-absence .wo-slot-dot, .wo-slot-today.k-tentative .wo-slot-dot { background: #868E96; box-shadow: 0 0 0 2px #dee2e6; }
.wo-slot-today.k-clash .wo-slot-dot { background: var(--danger); box-shadow: 0 0 0 2px rgba(224,49,49,.2); }
.wo-slot-today.k-clash { color: #c92a2a; font-weight: 600; }
/* his next 14 days: a job in his colour, an absence striped, a requested one dashed, an activity light, a job on a
   day he is absent red; today has a dot under it (each day says what it is on pointing at it) */
.wo-strip { grid-column: 1 / -1; display: grid; grid-template-columns: repeat(14, minmax(0, 1fr)); gap: 2px; padding-bottom: 5px; }
.wo-day { position: relative; height: 8px; border-radius: 2px; background: #e8edf2; }
.wo-day.is-weekend { background: #f1f4f7; }
.wo-day.k-job { background: var(--p); }
.wo-day.k-absence { background: repeating-linear-gradient(135deg, var(--p) 0 2px, #fff 2px 4px); box-shadow: inset 0 0 0 1px var(--p); }
.wo-day.k-tentative { background: var(--p-soft); outline: 1px dashed var(--p); outline-offset: -1px; }
.wo-day.k-activity { background: var(--p-soft); box-shadow: inset 0 0 0 1px var(--p); }
.wo-day.k-clash { background: var(--danger); }
.wo-day.is-today::after { content: ""; position: absolute; left: 50%; bottom: -5px; width: 4px; height: 4px; margin-left: -2px; border-radius: 50%; background: var(--navy); }
/* the box of the slot opened, under the slots: his cards side by side */
.tech-box { --p: #868E96; --ink: #fff; --p-soft: #868E9640; min-width: 0; max-height: 440px; overflow: auto; padding: 10px 12px 12px; background: var(--card); border: 1px solid var(--line); border-top: 4px solid var(--p); border-radius: var(--radius); }
.tech-box.is-drawer { display: none; max-height: none; overflow: visible; padding: 12px 14px 14px; border-radius: 14px; box-shadow: 0 14px 34px -18px rgba(22,44,66,.45); }
.tech-box.is-drawer.active { display: block; }
.tech-box.is-opening { animation: drawer-in .22s ease-out; }
@keyframes drawer-in { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }
.tech-box.is-drawer .wo-cards, .my-work-orders .tech-box .wo-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(300px, 100%), 1fr)); }
.tech-box-head { display: flex; align-items: center; gap: 8px; margin: 0 0 8px; min-width: 0; }
.tech-box-name { font-weight: 600; font-size: 15px; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tech-box-count { margin-left: auto; display: inline-flex; align-items: center; gap: 6px; flex: none; font-size: 12px; color: var(--muted); white-space: nowrap; }
.tech-box-close { flex: none; width: 34px; height: 34px; border: 0; border-radius: 8px; background: none; color: var(--muted); font: inherit; font-size: 22px; line-height: 1; cursor: pointer; }
.tech-box-close:hover { background: rgba(22,44,66,.06); color: var(--navy); }
.tech-box-close:focus-visible { outline: 2px solid var(--cyan); outline-offset: 1px; }
.wo-avatar { display: inline-flex; align-items: center; justify-content: center; flex: none; min-width: 30px; height: 30px; padding: 0 7px; border-radius: 15px; background: var(--p); color: var(--ink); font-size: 13px; font-weight: 700; letter-spacing: .03em; line-height: 1; }
.wo-badge { display: inline-flex; align-items: center; padding: 1px 7px; border-radius: 9px; background: var(--p); color: var(--ink); font-size: 11px; font-weight: 600; line-height: 16px; text-transform: uppercase; letter-spacing: .03em; white-space: nowrap; }
.wo-cards { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.wo-empty { margin: 4px 0; font-size: 13px; }
/* a card: the whole of it opens the Work Order (the title link is stretched over it), its buttons sit above */
.wo-card { position: relative; min-width: 0; padding: 8px 10px; background: var(--card); border: 1px solid var(--line); border-left: 4px solid var(--p); border-radius: 6px; }
.wo-card:hover { border-color: var(--p); }
.wo-card-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 6px; min-width: 0; }
.wo-card-link { font-weight: 600; color: var(--navy); min-width: 0; overflow-wrap: anywhere; }
.wo-card-no { white-space: nowrap; }  /* "P26-0014-01 ·" never broken, the title wraps after it */
.wo-card-link::after { content: ""; position: absolute; inset: 0; border-radius: 5px; }
.wo-card-link:focus-visible { outline: 0; }
.wo-card-link:focus-visible::after { outline: 2px solid var(--cyan); outline-offset: 1px; }
.wo-card-line { display: flex; flex-wrap: wrap; align-items: center; gap: 2px 8px; margin-top: 3px; min-width: 0; font-size: 13px; color: var(--muted); overflow-wrap: anywhere; }
.wo-card-line .wo-where { color: var(--text); }
.wo-tbd { color: #a5590c; }
.wo-chips { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 6px; margin-top: 6px; }
.wo-chips .pill { white-space: nowrap; }
.wo-card-actions { position: relative; z-index: 1; display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 8px; }
.wo-card-actions:empty { display: none; }
.wo-card-actions form { margin: 0; }
.wo-sr-done { position: relative; z-index: 1; }
.wo-recent { margin-top: 10px; }
.wo-recent > summary { cursor: pointer; min-height: 32px; display: flex; align-items: center; gap: 6px; color: var(--muted); font-size: 13px; }
/* "▸ Recently reported", "▸ Legend": a flex summary loses its marker, so the arrow is drawn (turned when open) */
.wo-recent > summary, .cal-legend > summary { list-style: none; }
.wo-recent > summary::-webkit-details-marker, .cal-legend > summary::-webkit-details-marker { display: none; }
.wo-recent > summary::before, .cal-legend > summary::before { content: "▸"; content: "▸" / ""; display: inline-block; flex: none; width: 1em; text-align: center; transition: transform .15s; }
.wo-recent[open] > summary::before, .cal-legend[open] > summary::before { transform: rotate(90deg); }
.wo-recent .wo-cards { margin-top: 6px; }
.wo-recent .wo-card { border-left-style: dotted; }
/* home widget "My Work Orders" (planning/widget_my_work_orders.html): his own box, whole */
.my-work-orders .tech-box { max-height: none; overflow: visible; padding: 8px 0 0; border: 0; border-top: 4px solid var(--p); border-radius: 0; }
.my-wo-more { margin: 8px 0 0; text-align: right; }
/* "his technician has not seen it yet": a slow halo (1.6 s, far below 3 flashes a second, WCAG 2.3.1); with reduced
   motion only the NEW badge stays */
@keyframes wo-pulse {
  0%, 100% { box-shadow: 0 0 0 1px var(--p), 0 0 0 2px var(--p-soft); }
  50% { box-shadow: 0 0 0 1px var(--p), 0 0 0 8px var(--p-soft); }
}
.wo-card.unseen { animation: wo-pulse 1.6s ease-in-out infinite; }
.tech-box.has-unseen > .tech-box-head .wo-avatar { animation: wo-pulse 1.6s ease-in-out infinite; }
/* reduced motion: nothing moves; a busy radar keeps its beam and blips still, a job not opened yet a ring */
@media (prefers-reduced-motion: reduce) {
  .wo-card.unseen, .tech-box.has-unseen > .tech-box-head .wo-avatar { animation: none; }
  .radar-sweep, .radar-blip, .radar-ping, .tech-box.is-opening { animation: none; }
  .radar-blip { opacity: 1; }
  .wo-slot.has-unseen .radar-scope { box-shadow: inset 0 0 12px rgba(0,0,0,.5), 0 0 0 2px #fff, 0 0 0 4px var(--p), 0 0 0 8px var(--p-soft); }
  .wo-slot { transition: none; }
  .wo-slot:hover { transform: none; }
  .wo-recent > summary::before, .cal-legend > summary::before { transition: none; }
}
/* the tools: search (what does not match fades), go to a date, print, keyboard shortcuts */
.cal-tools { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px; min-width: 0; }
.cal-search { position: relative; display: flex; align-items: center; flex: 1 1 280px; max-width: 480px; min-width: 0; }
.cal-search > .icon { position: absolute; left: 12px; color: var(--muted); pointer-events: none; }
.cal-search input { width: 100%; height: 38px; margin: 0; padding: 0 96px 0 34px; border: 1px solid var(--line); border-radius: 19px; background: #fff; color: var(--text); font: inherit; box-shadow: inset 0 1px 2px rgba(22,44,66,.05); }
.cal-search input:focus { outline: 0; border-color: var(--cyan); box-shadow: 0 0 0 3px rgba(6,161,206,.18); }
.cal-found { position: absolute; right: 14px; max-width: 84px; overflow: hidden; color: var(--muted); font-size: 12px; text-overflow: ellipsis; white-space: nowrap; pointer-events: none; }
.cal-goto { display: inline-flex; align-items: center; gap: 6px; height: 38px; padding: 0 6px 0 12px; border: 1px solid var(--line); border-radius: 19px; background: #fff; color: var(--muted); font-size: 13px; cursor: pointer; }
.cal-goto:focus-within { border-color: var(--cyan); box-shadow: 0 0 0 3px rgba(6,161,206,.18); }
.cal-goto input { height: 34px; margin: 0; padding: 0 4px; border: 0; background: none; color: var(--text); font: inherit; }
.cal-goto input:focus { outline: 0; }
.cal-tools-end { display: flex; align-items: center; gap: 4px; margin-left: auto; }
.cal-tools-end .btn { min-height: 38px; }
/* searching: the entries that do not match fade, the ones that do get a ring */
.cal-grid .ev.is-dimmed { opacity: .16; filter: grayscale(.7); }
.fc .fc-list-event.is-dimmed { opacity: .3; }
.fc a.ev.is-match { z-index: 3; box-shadow: 0 0 0 2px #fff, 0 0 0 4px var(--cyan); }
/* the preview card of an entry (a mouse pointing at it, or the keyboard on it) */
.cal-peek { --p: #868E96; position: fixed; z-index: 40; display: flex; flex-direction: column; gap: 3px; min-width: 200px; max-width: 340px; padding: 10px 14px 10px 18px; background: #fff; border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 16px 36px -10px rgba(22,44,66,.4); color: var(--muted); font-size: 12.5px; line-height: 1.4; pointer-events: none; }
.cal-peek[hidden] { display: none; }
.cal-peek::before { content: ""; position: absolute; left: 6px; top: 9px; bottom: 9px; width: 4px; border-radius: 2px; background: var(--p); }
.cal-peek strong { color: var(--navy); font-size: 13.5px; font-weight: 600; }
/* the keyboard shortcuts ("?") */
.cal-dialog { width: min(440px, calc(100vw - 32px)); padding: 0; border: 0; border-radius: 14px; box-shadow: 0 24px 60px -12px rgba(22,44,66,.45); color: var(--text); }
.cal-dialog::backdrop { background: rgba(10,25,40,.45); }
.cal-dialog form { margin: 0; padding: 14px 18px 18px; }
.cal-dialog header { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 10px; }
.cal-dialog h2 { margin: 0; }
.cal-keys-list { display: grid; grid-template-columns: auto 1fr; align-items: center; gap: 8px 16px; margin: 0; }
.cal-keys-list dt { white-space: nowrap; }
.cal-keys-list dd { margin: 0; color: var(--muted); }
.cal-dialog kbd { display: inline-block; min-width: 26px; padding: 2px 6px; border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 6px; background: #f8fafc; color: var(--navy); font-family: inherit; font-size: 12px; font-weight: 600; text-align: center; }
/* toolbar: the people (toggles, kept per viewer) and the legend */
.cal-toolbar { display: flex; flex-wrap: wrap; align-items: flex-start; gap: 8px 18px; min-width: 0; }
.pfilters { display: flex; flex-wrap: wrap; gap: 6px; min-width: 0; }
.pfilter { --p: #868E96; --ink: #fff; display: inline-flex; align-items: center; gap: 6px; max-width: 100%; min-height: 34px; padding: 2px 10px 2px 3px; border: 1px solid var(--line); border-radius: 17px; background: var(--card); color: var(--text); font: inherit; font-size: 13px; cursor: pointer; }
.pfilter .wo-avatar { min-width: 26px; height: 26px; font-size: 12px; }
.pfilter-name { min-width: 0; max-width: 15em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }  /* his whole HR name, cut */
.pfilter[aria-pressed="false"] { color: var(--muted); border-style: dashed; }
.pfilter[aria-pressed="false"] .wo-avatar { background: transparent; color: var(--muted); box-shadow: inset 0 0 0 2px var(--p); }
.pfilter:focus-visible { outline: 2px solid var(--cyan); outline-offset: 2px; }
.cal-legend { font-size: 13px; color: var(--muted); }
.cal-legend > summary { cursor: pointer; min-height: 34px; display: flex; align-items: center; gap: 6px; }
.cal-legend ul { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 4px 14px; }
.cal-legend li { display: inline-flex; align-items: center; gap: 6px; }
.cal-swatch { --p: #5C6B7A; --tex: rgba(255,255,255,.42); --p-soft: #5C6B7A40; display: inline-block; flex: none; width: 26px; height: 16px; border-radius: 3px; background-color: var(--p); border: 1px solid var(--p); }
.cal-swatch.is-tentative { background-color: var(--p-soft); border: 2px dashed var(--p); }
/* the calendar: a card with depth, FullCalendar in the corporate look (its own variables, then a few rules) */
.cal-grid { min-width: 0; padding: 14px; background: var(--card); border: 1px solid var(--line); border-radius: 14px; box-shadow: 0 1px 2px rgba(22,44,66,.05), 0 14px 34px -22px rgba(22,44,66,.4); }
.fc { --fc-border-color: #e3e9ef; --fc-page-bg-color: #fff; --fc-neutral-bg-color: #f5f7fa; --fc-today-bg-color: rgba(6,161,206,.06); --fc-now-indicator-color: var(--danger); --fc-button-text-color: var(--navy); --fc-button-bg-color: #fff; --fc-button-border-color: var(--line); --fc-button-hover-bg-color: #f1f5f9; --fc-button-hover-border-color: #c5d0db; --fc-button-active-bg-color: var(--navy); --fc-button-active-border-color: var(--navy); }
.fc .fc-toolbar.fc-header-toolbar { margin-bottom: 14px; }
.fc .fc-toolbar-title { color: var(--navy); font-size: 21px; font-weight: 600; letter-spacing: -.01em; }
.fc .fc-toolbar-title::first-letter { text-transform: uppercase; }
.fc .fc-button { padding: 6px 13px; border-radius: 8px; font: inherit; font-size: 13px; font-weight: 500; text-transform: none; box-shadow: none; }
.fc .fc-button-primary:not(:disabled).fc-button-active, .fc .fc-button-primary:not(:disabled):active { color: #fff; box-shadow: inset 0 1px 2px rgba(0,0,0,.2); }
.fc .fc-button-primary:not(:disabled).fc-button-active:focus, .fc .fc-button-primary:not(:disabled):active:focus, .fc .fc-button-primary:focus { box-shadow: none; }
.fc .fc-button:focus-visible { outline: 2px solid var(--cyan); outline-offset: 2px; }
.fc .fc-button-primary:disabled { opacity: .45; }
.fc .fc-button-group > .fc-button:not(:first-child) { margin-left: -1px; }
.fc .fc-col-header-cell { background: #f8fafc; }
.fc .fc-col-header-cell-cushion { padding: 8px 4px; color: var(--muted); font-size: 11.5px; font-weight: 600; letter-spacing: .07em; text-transform: uppercase; }
.fc .fc-daygrid-day-number { padding: 5px 8px; color: var(--text); font-size: 13px; }
.fc .fc-day-sat, .fc .fc-day-sun { background-color: #fafbfd; }
.fc .fc-day-other .fc-daygrid-day-top { opacity: .4; }
.fc .fc-daygrid-day.fc-day-today { background-color: var(--fc-today-bg-color); }
.fc .fc-daygrid-day.fc-day-today .fc-daygrid-day-number { display: inline-flex; align-items: center; justify-content: center; min-width: 26px; height: 26px; margin: 3px 4px; padding: 0 7px; border-radius: 13px; background: var(--cyan); color: #fff; font-weight: 600; }
.fc .fc-daygrid-week-number { padding: 2px 6px; border-radius: 0 0 6px 0; background: #eef2f6; color: var(--muted); font-size: 11px; }
.fc .fc-scrollgrid-section-sticky > * { top: 93px; }  /* under the top bar and the trail */
.fc .fc-list-day-cushion { background: #f4f7fa; }
.fc .fc-list-day-text, .fc .fc-list-day-side-text { color: var(--navy); font-weight: 600; }
/* calendar entries (FullCalendar, eventDisplay block): the label sits on a solid pill of the person's colour, so the
   texture never runs under the letters */
.fc a.ev, .fc .fc-list-event.ev { --p: #868E96; --ink: #fff; --tex: rgba(255,255,255,.42); --p-soft: #868E9640; }
/* the hand only on what opens: an absence opens for HR and the person himself only (its bar has no href for the rest) */
.fc a.ev[href] { cursor: pointer; }
.fc a.ev:not([href]):not(.fc-event-draggable) { cursor: default; }
.fc .fc-list-event .ev-link:focus-visible { outline: 2px solid var(--cyan); outline-offset: 2px; border-radius: 2px; }
.fc a.ev .fc-event-main { padding: 1px 2px; color: var(--ink); }
/* the label (calendar.js): [code] [⏳ / ✓] [the rest, cut with "…"]; the code and the flags never shrink, so the
   hourglass stays visible on a one-day bar; the pill always leaves a textured tail of the bar uncovered */
.ev-label { display: inline-flex; align-items: baseline; gap: .3em; max-width: 100%; padding: 0 5px; border-radius: 3px; background: var(--p); color: var(--ink); font-size: 12px; line-height: 18px; white-space: nowrap; overflow: hidden; vertical-align: top; }
.ev-label::before { order: -2; flex: none; }
.ev-code, .ev-flag, .ev-sep { flex: none; }
.ev-code { font-weight: 600; }
.ev-text { flex: 0 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.fc a.ev .ev-label { max-width: calc(100% - 12px); }
.fc .fc-list-event.ev .ev-label { display: inline; background: none; color: var(--text); padding: 0; white-space: normal; font-size: inherit; }
.fc .fc-list-event.ev .ev-text { overflow: visible; }
.fc .fc-list-event.ev .fc-list-event-dot { display: inline-block; width: 18px; height: 12px; border: 0; border-radius: 3px; background-color: var(--p); vertical-align: middle; }
.fc a.ev.tex-stripes, .fc .fc-list-event.tex-stripes .fc-list-event-dot, .cal-swatch.tex-stripes { background-image: repeating-linear-gradient(135deg, var(--tex) 0 3px, transparent 3px 9px); }
.fc a.ev.tex-dots, .fc .fc-list-event.tex-dots .fc-list-event-dot, .cal-swatch.tex-dots { background-image: radial-gradient(circle, var(--tex) 1.5px, transparent 1.8px); background-size: 7px 7px; }
.fc a.ev.tex-grid, .fc .fc-list-event.tex-grid .fc-list-event-dot, .cal-swatch.tex-grid { background-image: linear-gradient(var(--tex) 1px, transparent 1px), linear-gradient(90deg, var(--tex) 1px, transparent 1px); background-size: 8px 8px; }
.fc a.ev.tex-lines, .fc .fc-list-event.tex-lines .fc-list-event-dot, .cal-swatch.tex-lines { background-image: repeating-linear-gradient(0deg, var(--tex) 0 2px, transparent 2px 6px); }
.fc a.ev.tex-crosshatch, .fc .fc-list-event.tex-crosshatch .fc-list-event-dot, .cal-swatch.tex-crosshatch { background-image: repeating-linear-gradient(45deg, var(--tex) 0 1px, transparent 1px 6px), repeating-linear-gradient(-45deg, var(--tex) 0 1px, transparent 1px 6px); }
.fc a.ev.tex-checker, .fc .fc-list-event.tex-checker .fc-list-event-dot, .cal-swatch.tex-checker { background-image: conic-gradient(var(--tex) 25%, transparent 0 50%, var(--tex) 0 75%, transparent 0); background-size: 8px 8px; }
/* requested absence: same texture drawn in the person's colour over a light fill, and a dashed outline; a finished
   job has a light fill of its colour with a ✓, its label stays readable; ⏳ = the departure is not known yet (a dashed
   end) */
.fc a.ev.is-tentative { --tex: var(--p) !important; background-color: var(--p-soft) !important; border: 2px dashed var(--p) !important; }
.fc a.ev.is-tentative .ev-label { background: rgba(255,255,255,.88); color: var(--text); }
.fc .fc-list-event.is-tentative .fc-list-event-dot, .cal-swatch.is-tentative { --tex: var(--p); }
.fc .fc-list-event.is-tentative .fc-list-event-dot { background-color: var(--p-soft); box-shadow: inset 0 0 0 2px var(--p); }
.fc a.ev.is-done { background-color: var(--p-soft) !important; }
.fc a.ev.is-done .ev-label { opacity: .85; }
.fc .fc-list-event.is-done .fc-list-event-dot { opacity: .55; }
.fc a.ev.is-hourglass { border-right: 3px dashed var(--ink) !important; }
/* the Team view (calendar.js): two weeks, one row per person (his load: days with a job of the working days), the
   bars in lanes; weekends shaded, today tinted, a job on a day he is absent hatched red; a free day of a person opens
   a new activity for him ("+" on pointing at it). Wider than a phone: it scrolls sideways inside its frame, the names
   staying */
.team-scroll { overflow-x: auto; border: 1px solid var(--fc-border-color, #e3e9ef); border-radius: 10px; scrollbar-width: thin; -webkit-overflow-scrolling: touch; }
.team { --who: 220px; --lane: 24px; min-width: calc(var(--who) + var(--days, 14) * 46px); }
.team-row { display: grid; grid-template-columns: var(--who) minmax(0, 1fr); border-top: 1px solid #e9eef3; }
.team-head { border-top: 0; background: #f8fafc; }
.team-who { position: sticky; left: 0; z-index: 2; display: flex; align-items: center; gap: 8px; min-width: 0; padding: 6px 10px; background: #fff; border-right: 1px solid #e3e9ef; }
.team-head .team-who { background: #f8fafc; color: var(--muted); font-size: 11.5px; font-weight: 600; letter-spacing: .07em; text-transform: uppercase; }
.team-who .wo-avatar { min-width: 28px; height: 24px; font-size: 11.5px; }
.team-name { flex: 1 1 auto; min-width: 0; overflow: hidden; font-size: 13px; font-weight: 600; text-overflow: ellipsis; white-space: nowrap; }
.team-load { display: inline-flex; flex: none; flex-direction: column; align-items: flex-end; gap: 3px; color: var(--muted); font-size: 11px; font-variant-numeric: tabular-nums; }
.team-load-bar { width: 38px; height: 4px; border-radius: 2px; background: linear-gradient(90deg, var(--p) calc(var(--load, 0) * 100%), #e3e9ef 0); }
.team-days { display: grid; grid-template-columns: repeat(var(--days, 14), minmax(0, 1fr)); min-width: 0; }
.team-day { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 6px 2px; border-left: 1px solid #eef2f5; color: var(--muted); font-size: 11px; text-transform: uppercase; }
.team-day.is-weekend { background: #f1f4f8; }
.team-num { display: inline-grid; place-items: center; min-width: 24px; height: 24px; padding: 0 4px; border-radius: 12px; color: var(--text); font-size: 13px; font-weight: 600; }
.team-day.is-today .team-num { background: var(--cyan); color: #fff; }
.team-lanes { position: relative; grid-template-rows: repeat(var(--lanes, 1), var(--lane)); row-gap: 3px; align-content: center; min-height: 46px; padding: 6px 0; }
.team-cell { grid-row: 1 / -1; margin: -6px 0; border-left: 1px solid #eef2f5; }
.team-cell.is-weekend { background: #f7f9fb; }
.team-cell.is-today { background: rgba(6,161,206,.07); }
.team-cell.is-clash { background: repeating-linear-gradient(135deg, rgba(224,49,49,.2) 0 4px, transparent 4px 8px); box-shadow: inset 0 0 0 1px rgba(224,49,49,.55); }
.team-cell.is-free { display: grid; place-items: center; cursor: copy; }
.team-cell.is-free:hover { background: rgba(6,161,206,.09); }
.team-cell.is-free:hover::after { content: "+"; color: var(--cyan-dark); font-size: 18px; font-weight: 600; }
.fc a.ev.team-bar { position: relative; z-index: 1; display: flex; align-items: center; min-width: 0; margin: 0 2px; overflow: hidden; border: 1px solid var(--p); border-radius: 5px; background-color: var(--p); color: var(--ink); text-decoration: none; }
.fc a.ev.team-bar .ev-label { margin-left: 2px; max-width: calc(100% - 12px); }
.fc a.ev.team-bar.is-cut-start { margin-left: 0; border-top-left-radius: 0; border-bottom-left-radius: 0; }
.fc a.ev.team-bar.is-cut-end { margin-right: 0; border-top-right-radius: 0; border-bottom-right-radius: 0; }
.fc a.ev.team-bar:focus-visible { outline: 2px solid var(--cyan); outline-offset: 1px; }
.team-empty { margin: 0; padding: 18px; text-align: center; }
@media (forced-colors: active) {
  .fc a.ev, .fc .fc-list-event-dot, .cal-swatch { background-image: none !important; }
  .ev-label[data-glyph]::before, .cal-swatch[data-glyph]::before { content: attr(data-glyph) " "; }
  .cal-swatch { width: auto; height: auto; border: 0; background: none; }
  .wo-card.unseen { outline: 2px solid CanvasText; }
  /* the open slot: its coloured border and shadow are gone here, a Highlight ring says which box is shown */
  .wo-slot[aria-expanded="true"] { outline: 3px solid Highlight; outline-offset: -3px; }
  .wo-slot[aria-expanded="true"]:focus-visible { outline-offset: 2px; }
  .wo-slot.has-unseen .radar .wo-avatar { outline: 2px solid CanvasText; outline-offset: 2px; }
  .team-cell.is-clash { background: none; outline: 2px solid CanvasText; outline-offset: -2px; }
}
@media (max-width: 800px) {
  .cal-page { gap: 10px; }
  .cal-grid { padding: 6px; margin: 0 -4px; border-radius: 10px; }
  .tech-box { max-height: none; overflow: visible; }
  .tech-box-close { width: 44px; height: 44px; }
  .wo-card { padding: 10px 12px; }
  .wo-card-link { font-size: 15px; }
  .wo-card-line { font-size: 14px; }
  .wo-card-actions .btn, .wo-card-actions form { flex: 1 1 auto; }
  .wo-card-actions form .btn { width: 100%; }
  .wo-card-actions .btn, .wo-sr-done { min-height: 44px; }  /* every target at least 44 px (d4 §2.2) */
  .wo-sr-done { display: inline-flex; align-items: center; }
  .wo-recent > summary { min-height: 44px; font-size: 14px; }
  .pfilter { min-height: 44px; font-size: 14px; }
  .cal-legend > summary { min-height: 44px; font-size: 14px; }
  .cal-search { flex-basis: 100%; max-width: none; }
  .cal-search input, .cal-goto { height: 44px; border-radius: 22px; }
  .cal-tools-end .btn { min-height: 44px; }
  /* a day is about 44 px wide: a textured bar shows its type glyph (a solid one is a job, the default: no glyph; ⏳ /
     ✓ only jobs have), then the code and the text, no "·" between them (the gap is enough: a cut label reads
     "K AG…", never "K ·"); a textured tail of 10 px stays beside the pill */
  .fc a.ev .fc-event-main { padding: 1px 0 1px 1px; }
  .fc a.ev .ev-label { max-width: calc(100% - 10px); padding: 0 3px; gap: .2em; }
  .fc a.ev:not(.tex-solid) .ev-label[data-glyph]::before { content: attr(data-glyph); }
  .fc a.ev .ev-sep { display: none; }
  .fc a.ev .ev-label.has-flag::before { content: none; }
  .fc a.ev .ev-flag { order: -1; }
  /* a job whose dates are incomplete: the code first, then the ⏳, over the whole bar (its dashed end takes the place
     of the tail: a job is solid), so a one-day bar reads "RO ⏳", never "⏳ R" */
  .fc a.ev.is-hourglass .ev-label { max-width: 100%; padding: 0 2px; gap: .1em; }
  .fc a.ev.is-hourglass .ev-flag { order: 0; }
  .fc .fc-daygrid-more-link { font-weight: 600; }
  /* FullCalendar's toolbar: the title on its own line, finger-sized buttons */
  .fc .fc-header-toolbar.fc-toolbar { flex-wrap: wrap; gap: 8px; margin-bottom: 10px; }
  .fc .fc-header-toolbar .fc-toolbar-chunk:nth-child(2) { order: -1; flex: 1 1 100%; text-align: center; }
  .fc .fc-toolbar-title { font-size: 18px; }
  .fc .fc-button { min-height: 44px; padding: 6px 10px; font-size: 14px; }
  .fc .fc-list-event td { padding: 10px 8px; }
  .fc .fc-list-event-title { white-space: normal; }
  .fc .fc-scrollgrid-section-sticky > * { top: 0; }
  .team { --who: 118px; --lane: 26px; }
  .team-load { display: none; }
  .team-who { padding: 6px; gap: 6px; }
  .team-name { font-size: 12px; }
}
/* a narrow phone: compact slots side by side (the radar, the counts, the strip; the name in the box when opened), the
   names of the chips hidden (their code says who) */
@media (max-width: 480px) {
  .wo-slots { grid-template-columns: repeat(auto-fit, minmax(104px, 1fr)); gap: 8px; }
  .wo-slot { grid-template-columns: minmax(0, 1fr); justify-items: center; gap: 6px; padding: 10px 8px 6px; text-align: center; }
  .wo-slot-body { align-items: center; width: 100%; }
  .wo-slot-name { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
  .wo-slot-meta { justify-content: center; }
  .wo-slot-today { justify-content: center; width: 100%; font-size: 12px; }
  .wo-strip { width: 100%; gap: 1px; }
  .wo-day { height: 7px; }
  .pfilter-name { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
  .pfilter { padding: 3px; }
  .cal-goto-label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  .cal-tools-end .btn span:not(.sr-only) { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  /* a card's news ("NEW JOB", "PIEZAS EN SU FURGONETA") on its own line above the title: the title keeps the whole
     width of the card instead of a narrow column beside the badge */
  .wo-card-top { flex-wrap: wrap; row-gap: 4px; }
  .wo-card-top .wo-badge { order: -1; }
  .wo-card-top .wo-card-link { flex: 1 1 100%; }
}
/* printing the calendar: only the calendar, landscape, in its colours */
@media print {
  .topbar, .trail, .wo-boxes, .cal-tools, .pfilters, .cal-page > .control-bar .cb-right, #cal-notice, .cal-peek, .cal-dialog, .fc .fc-button-group, .fc .fc-today-button { display: none !important; }
  .cal-grid { padding: 0; border: 0; box-shadow: none; }
  .fc a.ev, .fc .fc-list-event-dot, .cal-swatch, .team-bar, .team-cell, .fc .fc-daygrid-day-number { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .fc .fc-scrollgrid-section-sticky > * { position: static; }
  .team-scroll { overflow: visible; }
  .team { min-width: 0; --who: 150px; }
}
/* ---- service card / WO brief ---- */
/* services of the project page (sales/project_services.html): one card per service, its Work Order inside */
.services-block { margin-top: 14px; }
.services-block .svc-head { justify-content: space-between; gap: 10px; }
.services-block .svc-head h2 { margin: 0; }
.svc-actions, .svc-card-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: flex-start; }
.svc-card { border: 1px solid var(--line); border-left: 4px solid #f59f00; border-radius: 8px; padding: 10px 12px; margin-top: 12px; background: #fff; scroll-margin-top: 110px; }
.svc-card.state-confirmed { border-left-color: #2f9e44; }
.svc-card.state-cancelled { border-left-color: #c92a2a; opacity: .75; }
.svc-card:target { box-shadow: 0 0 0 2px rgba(6,161,206,.35); }
.svc-card-head { display: flex; justify-content: space-between; gap: 10px; align-items: baseline; }
.svc-title { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; min-width: 0; }
.svc-title > a { min-width: 0; overflow-wrap: anywhere; }
.svc-num { display: inline-flex; width: 22px; height: 22px; border-radius: 50%; background: var(--navy, #162c42); color: #fff; font-size: 12px; align-items: center; justify-content: center; flex: none; }
.svc-amount { font-weight: 600; white-space: nowrap; }
.svc-desc { margin: 6px 0 2px; font-size: 14px; }
.svc-lines { margin: 8px 0; width: 100%; border-collapse: collapse; font-size: 13.5px; }
.svc-lines td { padding: 4px 6px; border-top: 1px solid var(--line); vertical-align: top; }
.svc-lines td.num { text-align: right; white-space: nowrap; }
.svc-cancel summary { list-style: none; cursor: pointer; }
.svc-cancel[open] form { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 6px; }
.svc-cancel input { min-width: 240px; padding: 6px 8px; border: 1px solid var(--line); border-radius: 6px; font: inherit; }
.svc-trash { color: var(--muted); }
.svc-trash:hover { color: var(--danger); background: #fff5f5; }
.svc-totals { display: flex; gap: 18px; justify-content: flex-end; flex-wrap: wrap; margin-top: 12px; }
.svc-terms { margin-top: 14px; }
.svc-terms summary { cursor: pointer; color: var(--muted); }
/* the team of the job: responsible = solid chip, helpers = outline chips (core.people.tech_chip) */
.svc-team { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: 8px 0 2px; min-width: 0; }
.svc-team .tchip { max-width: min(100%, 260px); }
/* the Work Order inside the card (sales/partials/wo_box.html) */
.wo-box { margin: 8px 0 4px; padding: 10px 12px; border: 1px solid #cfe9f3; border-radius: var(--radius); background: #f5fbfd; min-width: 0; }
.wo-box-head { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; }
.wo-box-head > a { font-weight: 600; min-width: 0; overflow-wrap: anywhere; }
.wo-box-meta { display: flex; flex-wrap: wrap; gap: 4px 14px; margin-top: 6px; font-size: 13px; }
.wo-unseen { color: var(--muted); font-style: italic; }
.wo-unseen::before { content: ""; display: inline-block; width: 8px; height: 8px; margin-right: 5px; border-radius: 50%; background: var(--warn); vertical-align: middle; }
.wo-box-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.wo-box-actions form { margin: 0; }
.tbd { color: #a5590c; }  /* ⏳ dates to be confirmed (set in the project) */
/* pop-ups: confirm the service (sales/service_confirm.html) and change technician (sales/wo_team.html) */
.dialog-page { max-width: 760px; }
.dialog-page .dialog-foot { position: static; margin: 16px 0 0; padding: 12px 0 0; }
.svc-confirm-what { margin-bottom: 12px; display: flex; flex-direction: column; gap: 4px; }
.svc-confirm-what .wo-team-now { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.confirm-blockers { margin-bottom: 12px; }
.tpick, .tpick-helpers, .svc-parts, .wo-team-parts { border: 0; padding: 0; margin: 0 0 14px; min-width: 0; }
.tpick legend, .tpick-helpers legend, .svc-parts legend, .wo-team-parts legend { font-weight: 600; padding: 0; margin-bottom: 6px; }
.tpick-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 8px; }
.tpick-card { position: relative; display: flex; flex-direction: column; align-items: flex-start; gap: 4px; min-width: 0; min-height: 44px; padding: 10px 12px 10px 40px; border: 1px solid var(--line); border-radius: var(--radius); background: #fff; cursor: pointer; }
.tpick-card input { position: absolute; left: 12px; top: 12px; margin: 0; width: 18px; height: 18px; accent-color: var(--cyan); }
.tpick-card:has(input:checked) { border-color: var(--cyan); background: #f0f9fc; box-shadow: 0 0 0 1px var(--cyan); }
.tpick-card:focus-within { outline: 2px solid var(--cyan); outline-offset: 1px; }
.tpick-card .tchip { max-width: 100%; }
.tpick-load { font-size: 12px; }
.tpick-warn { font-size: 12px; color: #a5590c; background: #fff9db; border-radius: 6px; padding: 2px 6px; max-width: 100%; overflow-wrap: anywhere; }
.tpick-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.tpick-helper { display: inline-flex; align-items: center; gap: 6px; min-height: 36px; max-width: 100%; padding: 2px 8px 2px 6px; border: 1px solid var(--line); border-radius: 18px; cursor: pointer; }
.tpick-helper input { margin: 0; accent-color: var(--cyan); }
.tpick-helper:has(input:checked) { border-color: var(--cyan); background: #f0f9fc; }
.tpick-helper[hidden] { display: none; }
.svc-part, .wo-team-part { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; padding: 8px 0; border-top: 1px solid var(--line); cursor: pointer; }
.svc-part input, .wo-team-part input { margin: 0; width: 18px; height: 18px; accent-color: var(--cyan); }
.svc-part-name { font-weight: 500; min-width: 0; overflow-wrap: anywhere; }
/* parts locked while the chosen responsible has no van, notices that only apply to a change (sales/team.js) */
.svc-part:has(input:disabled), .wo-team-part:has(input:disabled) { opacity: .55; cursor: not-allowed; }
[data-van-parts] [data-no-van-note] { margin: 0 0 6px; }
[data-van-parts] [data-no-van-note][hidden], .wo-team-parts[hidden], p[data-old][hidden] { display: none; }
.svc-notes, .wo-team-reason { display: flex; flex-direction: column; gap: 4px; margin-bottom: 4px; }
.svc-notes textarea, .wo-team-reason input { width: 100%; border: 1px solid var(--line); border-radius: 6px; padding: 6px 8px; font: inherit; }
/* Work Order page: the technician's brief (M08, sales/work_order_form.html) */
.wo-brief { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin-bottom: 16px; }
.brief-card { min-width: 0; padding: 10px 14px; border: 1px solid #cfe9f3; border-radius: var(--radius); background: #f5fbfd; }
.brief-card.wide { grid-column: 1 / -1; }
#brief-parts { scroll-margin-top: 110px; }  /* back from "I have it" / "Missing" (?next=…#brief-parts): below the bars */
.brief-card h3 { margin: 0 0 6px; font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.brief-card .svc-team { margin: 0; }
.brief-dl { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 3px 12px; margin: 0; }
.brief-dl dt { color: var(--muted); font-size: 12px; padding-top: 2px; }
.brief-dl dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
.brief-contacts { display: flex; flex-wrap: wrap; gap: 4px 14px; margin-top: 4px; }
/* the agent's fields are free text (two numbers, notes, an address): each one wraps instead of widening a phone */
.brief-contacts a, .brief-contacts span { display: inline-flex; align-items: center; gap: 4px; min-height: 32px;
  min-width: 0; max-width: 100%; overflow-wrap: anywhere; }
.brief-contacts a { font-weight: 500; }
.brief-text { margin: 4px 0 8px; }
.brief-label { display: block; color: var(--muted); font-size: 12px; margin-top: 6px; }
.brief-parts { list-style: none; margin: 0; padding: 0; }
.brief-parts li { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; padding: 8px 0; border-top: 1px solid #dbeef5; }
.brief-parts li:first-child { border-top: 0; padding-top: 2px; }
.brief-part-name { font-weight: 500; flex: 1 1 180px; min-width: 0; overflow-wrap: anywhere; }
.brief-part-where { font-size: 13px; }
.brief-part-ok { color: #2b8a3e; font-size: 13px; }
.brief-part-actions, .brief-actions { display: flex; flex-wrap: wrap; gap: 6px; }
.brief-actions { margin-top: 8px; }
.brief-quoted { list-style: none; margin: 0; padding: 0; }
.brief-quoted li { padding: 3px 0; border-top: 1px solid #dbeef5; overflow-wrap: anywhere; }
.brief-quoted li:first-child { border-top: 0; }
.brief-quoted .qty { white-space: nowrap; font-weight: 600; }
.brief-notes { margin-bottom: 16px; }
.brief-notes .field { grid-template-columns: 1fr; }
.brief-notes .field > label { padding-top: 0; color: var(--text); font-size: 14px; font-weight: 600; }
.brief-notes-text { margin: 0; padding: 8px 12px; border-left: 3px solid var(--cyan); background: #fafbfc; overflow-wrap: anywhere; }
.brief-reports { margin-top: 16px; }
.brief-reports h2 { margin-top: 0; }
.brief-attachments { margin-top: 16px; }
.wo-docs { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.wo-docs a { width: 96px; height: 96px; border: 1px solid var(--line); border-radius: 6px; overflow: hidden; display: flex; align-items: center; justify-content: center; background: #f4f6f8; text-decoration: none; }
.wo-docs img { width: 100%; height: 100%; object-fit: cover; }
.wo-docs .doc { font-size: 11px; padding: 4px; text-align: center; color: var(--navy); word-break: break-all; }
/* projects list (M03): the responsible technician's chip after each job */
.wo-ref .tchip { margin-left: 4px; max-width: 100%; }
@media (max-width: 800px) {
  .wo-brief { grid-template-columns: 1fr; }
  .brief-card { padding: 10px 12px; }
  .brief-dl dt { font-size: 13px; }
  .brief-contacts a { min-height: 44px; }
  .tpick-list { grid-template-columns: 1fr; }
  .tpick-helper { min-height: 44px; }
  .svc-part, .wo-team-part { min-height: 44px; }
  .wo-box-actions > .btn, .wo-box-actions > form { flex: 1 1 auto; }
  .wo-box-actions > form .btn { width: 100%; }
  .brief-part-actions .btn { min-height: 44px; }
}
@media (max-width: 640px) {
  .svc-lines tr { display: grid; grid-template-columns: 1fr auto; column-gap: 14px; padding: 4px 0; border-top: 1px solid var(--line); }
  .svc-lines td { border: 0; padding: 1px 0; }
  .svc-lines td:first-child { grid-column: 1 / -1; }
  .svc-lines td:nth-child(2) { display: none; }
  .svc-lines td:nth-child(3) { color: var(--muted); text-align: left; }
  .svc-lines td:nth-child(4) { font-weight: 600; }
  .svc-lines td:nth-child(3)::before { content: attr(data-qty) " × "; }
  .svc-cancel input { min-width: 0; width: 100%; }
  .svc-amount { font-size: 15px; }
}
/* ---- service report editor ---- */
/* service_reports/edit.html (d3 §5.6, d5 §5.5): number, read-only job header, half hours, supplements, camera */
.sr-numberbar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; margin: 4px 0 2px; }
.sr-number { font-size: 15px; } .sr-number strong { font-size: 17px; font-weight: 600; color: var(--navy); letter-spacing: .02em; }
.sr-number.is-draft { color: var(--muted); font-style: italic; font-size: 13px; }
.sr-job { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px 24px; margin: 0 0 10px; padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--radius); background: #fafbfc; }
.sr-job > div { min-width: 0; }
.sr-job dt { font-size: 12px; color: var(--muted); }
.sr-job dd { margin: 1px 0 0; font-weight: 500; overflow-wrap: anywhere; }
.sr-tag { display: inline-block; padding: 0 8px; border-radius: 10px; background: #e3f4fa; color: var(--cyan-dark); font-size: 12px; font-weight: 500; vertical-align: 1px; }
.sr-form input.is-invalid { border-color: var(--danger) !important; background: #fff5f5; }
.sr-form .half-hour-msg { max-width: 160px; white-space: normal; }
.sr-auto-supplements { list-style: none; display: flex; flex-wrap: wrap; gap: 6px; margin: 6px 0 8px; padding: 0; }
.sr-auto-supplements li { padding: 3px 10px; border: 1px solid #cfe9f3; border-radius: 14px; background: #f5fbfd; font-size: 13px; }
.sr-expenses-note { margin: 6px 0 10px; color: var(--muted); font-size: 13px; line-height: 1.5; }
.sr-expenses-note .icon { vertical-align: -3px; margin-right: 2px; color: var(--cyan-dark); }
.sr-expenses-note a { white-space: nowrap; }
.sr-replace { margin: 4px 0 8px; } .sr-replace > summary { cursor: pointer; color: var(--cyan-dark); padding: 6px 0; }
.sr-legacy { margin-top: 10px; } .sr-legacy table { opacity: .85; }
.sr-photos { padding: 6px; }
.sr-photos .sr-empty { margin: 2px 0 6px; font-size: 13px; }
.sr-photos .upload-bar { margin-top: 4px; }
.sr-photo-hint { display: none; margin-top: 4px; }
.sr-form:has(.sr-photos .trash-toggle input:checked) .sr-photo-hint { display: block; }
.sr-engineer { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; margin: 0 0 10px; }
.sr-engineer-label { font-size: 12px; color: var(--muted); }
.sr-engineer-note { font-size: 13px; }
.sr-docs .attach-form { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 8px 0 14px; }
.sr-docs .attach-form select, .sr-docs .attach-form input[name=description] { padding: 6px 8px; border: 1px solid var(--line); border-radius: 6px; font: inherit; min-height: 36px; }
.sr-docs .att-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; }
.sr-docs .att-card { display: flex; gap: 10px; border: 1px solid var(--line); border-radius: 8px; padding: 8px; background: #fff; }
.sr-docs .att-thumb { flex: 0 0 84px; height: 84px; display: flex; align-items: center; justify-content: center; background: #f4f6f8; border-radius: 6px; overflow: hidden; text-decoration: none; }
.sr-docs .att-thumb img { width: 100%; height: 100%; object-fit: cover; }
.sr-docs .att-ext { font-weight: 600; color: var(--navy); font-size: 15px; }
.sr-docs .att-body { min-width: 0; flex: 1; }
.sr-docs .att-name { font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sr-docs .att-edit { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-top: 6px; }
.sr-docs .att-edit select, .sr-docs .att-edit input[name=description] { padding: 4px 6px; border: 1px solid var(--line); border-radius: 6px; font: inherit; font-size: 13px; max-width: 100%; }
.sr-docs .att-expense { margin-top: 4px; }
.sr-docs .att-edit .att-bin { margin-left: auto; }  /* K27: the bin of the line editors, at the end of the card */
/* the documents block is sent in place (report.js): its messages come back inside it, a failure in red */
.sr-docs .sr-docs-messages { margin: 0 0 10px; }
.sr-docs .upload-status.error, .sr-docs .sr-inplace-status.error { color: var(--danger); }
.sr-docs .sr-inplace-status { flex: 1 1 100%; font-size: 13px; }
.sr-docs .upload-retry { margin-left: 4px; font-weight: 500; }
/* a receipt of the project (M19): never printed; the card says so instead of offering "Print" */
.sr-docs .att-card.is-expense { border-left: 3px solid var(--cyan); }
.sr-docs .att-expensed { display: flex; flex-wrap: wrap; align-items: center; gap: 2px 6px; margin-top: 4px; font-size: 13px; color: var(--navy); }
.sr-docs .att-expensed .icon { color: var(--cyan-dark); }
.sr-docs .att-expensed a { white-space: nowrap; }
/* "Save draft" waits for a document still uploading: the line next to the buttons (a link to the documents) */
.sr-wait { font-size: 13px; color: var(--muted); text-decoration: none; }
.sr-wait.error { color: var(--danger); font-weight: 500; text-decoration: underline; }
.sr-wait[hidden] { display: none; }
.sr-auto-supplements li.is-written { border-style: dashed; }
/* the timesheet as a table (above the cards of phones): what the office checks before confirming (M25) reads whole,
   arrival / departure ("17:00" / "17:30"), the engineer and the type; the numbers take no more than they need. A
   narrow tablet scrolls the table, never the page */
@media (min-width: 641px) {
  .sr-timesheet { overflow-x: auto; }
  .sr-timesheet select[name$='-time_arrival'], .sr-timesheet select[name$='-time_departure'] { min-width: 5.6em; }
  .sr-timesheet select[name$='-time_type'] { min-width: 9em; }
  .sr-timesheet select[name$='-employee'] { min-width: 10em; }
  .sr-timesheet input[name$='_hours'], .sr-timesheet input[name$='-nights'], .sr-timesheet input[name$='-mileage_km'] { max-width: 6em; }
}
@media (max-width: 800px) {
  .sr-job { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .sr-photos .upload-bar label.btn { flex: 1 1 auto; justify-content: center; }
}
@media (max-width: 640px) {
  .sr-job { grid-template-columns: 1fr; gap: 6px; }
  .sr-docs .attach-form > *, .sr-docs .attach-form .upload-bar label.btn { width: 100%; min-height: 44px; font-size: 16px; }
  .sr-docs .att-grid { grid-template-columns: 1fr; }
  .sr-docs .att-edit select, .sr-docs .att-edit input[name=description] { font-size: 16px; min-height: 40px; width: 100%; }
  .sr-form .half-hour-msg { max-width: none; }
}
/* ---- expenses ---- */
/* Expenses section of a project / Work Order (apps/expenses/partials/section.html): cards that follow the local
   reading, a bulk bar shown only while receipts are ticked; the review page; the phone "New expense" page */
.exp-section { margin-top: 14px; scroll-margin-top: 96px; }  /* #expenses: its title just under the sticky bars */
.exp-section.is-compact { padding: 12px 14px; }
.exp-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 6px 14px; }
.exp-title { display: inline-flex; align-items: center; gap: 8px; margin: 0; }
.exp-section.is-compact .exp-title { font-size: 15px; }
.exp-totals { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 14px; font-size: 13px; color: var(--muted); }
.exp-totals strong { color: var(--text); font-variant-numeric: tabular-nums; }
.exp-upload { margin-top: 10px; }
.exp-hint { margin: 6px 0 0; font-size: 13px; }
.exp-label { display: block; color: var(--muted); font-size: 12px; margin-bottom: 2px; }
/* the bar comes after the cards: sticky at the bottom of the screen while the list is on it (within thumb reach
   on phones, whichever card was ticked; a bar placed before the list would scroll away above) */
.exp-bulk { display: none; flex-wrap: wrap; align-items: center; gap: 8px; margin: 12px 0 0; padding: 8px 12px; background: #e7f5fb; border: 1px solid #b6e0f0; border-radius: var(--radius); position: sticky; bottom: calc(8px + env(safe-area-inset-bottom)); z-index: 12; box-shadow: 0 4px 16px rgba(22,44,66,.18); }
.exp-bulk.has-selection, .exp-section:has(.exp-select:checked) .exp-bulk { display: flex; }
.exp-bulk-count { margin-right: 4px; }
.exp-share-with > summary { list-style: none; } .exp-share-with > summary::-webkit-details-marker { display: none; }
.exp-share-with[open] { flex: 1 1 100%; }
.exp-share-fields { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 8px 12px; margin-top: 8px; }
.exp-share-project { flex: 1 1 240px; min-width: 0; }
/* the bar is at the bottom of the screen: its project list opens upwards, over the cards, never over the "Share %"
   box and the Share button below it nor past the bottom of the screen; expenses.js opens it downwards
   (.exp-ac-down) when the bar is near the top of the screen */
.exp-bulk .ac-menu { top: auto; bottom: calc(100% + 2px); max-height: min(280px, 45vh); }
.exp-bulk .ac.exp-ac-down .ac-menu { top: calc(100% + 2px); bottom: auto; }
.exp-share-fields .ac, .exp-pick .ac, .exp-share2-project .ac, .exp-share-main .ac { background: #fff; border: 1px solid var(--line); border-radius: 6px; padding: 0 4px 0 8px; min-height: 36px; }
.exp-share-fields .ac-text, .exp-pick .ac-text, .exp-share2-project .ac-text, .exp-share-main .ac-text { border: 0; padding: 7px 0; font: inherit; background: none; min-width: 0; width: 100%; outline: 0; }
.exp-percent, .exp-split-inputs input, .exp-reimbursed input { width: 110px; padding: 6px 8px; border: 1px solid var(--line); border-radius: 6px; font: inherit; background: #fff; }
.exp-reimbursed input { width: auto; min-width: 11em; max-width: 100%; }  /* a whole date and its calendar icon */
.exp-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 10px; margin-top: 12px; }
.exp-card { position: relative; display: grid; grid-template-columns: 76px minmax(0, 1fr); gap: 10px; padding: 10px; border: 1px solid var(--line); border-left: 4px solid var(--warn); border-radius: var(--radius); background: #fff; min-width: 0; }
.exp-card.is-confirmed { border-left-color: var(--ok); }
.exp-card.is-reading { border-left-color: var(--cyan); }
.exp-card.is-cancelled { border-left-color: var(--danger); opacity: .7; }
.exp-card:has(.exp-select:checked) { border-color: var(--cyan); background: #f5fbfd; }
.exp-thumb { display: flex; align-items: center; justify-content: center; width: 76px; height: 96px; border-radius: 6px; background: var(--bg); color: var(--muted); overflow: hidden; }
.exp-thumb img { width: 100%; height: 100%; object-fit: cover; }
.exp-body { min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.exp-line1 { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.exp-card:has(.exp-select-box) .exp-line1 { padding-right: 34px; }
.exp-number { font-weight: 600; color: var(--navy); }
.exp-line2 { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; min-width: 0; color: var(--muted); font-size: 13px; }
.exp-supplier { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text); }
.exp-amount { font-size: 17px; font-weight: 600; font-variant-numeric: tabular-nums; }
.exp-amount small { font-weight: 400; font-size: 13px; color: var(--muted); }
.exp-badges { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; }
.exp-missing, .exp-stale, .exp-error { margin: 2px 0 0; font-size: 12.5px; line-height: 1.35; }
.exp-missing { color: #a5590c; }
.exp-stale { color: var(--danger); }
.exp-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 4px; }
.exp-actions form, .exp-side-actions form { margin: 0; }
.exp-bin { display: inline-flex; align-items: center; justify-content: center; width: 34px; height: 34px; padding: 0; border: 0; border-radius: 8px; background: none; color: var(--muted); cursor: pointer; }
.exp-bin:hover { color: var(--danger); background: #fff5f5; }
.exp-bin:focus-visible { outline: 2px solid var(--cyan); outline-offset: 1px; }
.exp-select-box { position: absolute; top: 4px; right: 4px; display: flex; align-items: center; justify-content: center; width: 34px; height: 34px; cursor: pointer; }
.exp-select-box input { width: 18px; height: 18px; margin: 0; cursor: pointer; }
.exp-more > summary { list-style: none; cursor: pointer; } .exp-more > summary::-webkit-details-marker { display: none; }
.exp-more[open] { flex: 1 1 100%; }
.exp-more-body { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 6px; }
.exp-cancel-form { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.exp-cancel-form input { min-width: 200px; flex: 1 1 200px; padding: 6px 8px; border: 1px solid var(--line); border-radius: 6px; font: inherit; }
.exp-spinner { display: inline-block; width: 10px; height: 10px; margin-right: 5px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; vertical-align: -1px; animation: exp-spin .8s linear infinite; }
@keyframes exp-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .exp-spinner { animation: none; border-right-color: currentColor; opacity: .6; } }
.exp-cancelled { margin-top: 12px; }
.exp-cancelled > summary { cursor: pointer; color: var(--muted); }
.exp-foot { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 6px 16px; margin-top: 10px; font-size: 13px; }
.exp-empty { margin: 0; }
@media (pointer: coarse) { .exp-drop-hint { display: none; } }
/* review page: the receipt beside the data (stacked on phones, the receipt folds) */
.exp-review { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); gap: 16px; align-items: start; }
.exp-receipt { position: sticky; top: 100px; min-width: 0; }
.exp-receipt-box { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 12px; }
.exp-receipt-box > summary { cursor: pointer; font-weight: 600; color: var(--navy); overflow-wrap: anywhere; }
.exp-receipt-box img { display: block; width: 100%; max-height: 75vh; object-fit: contain; margin-top: 8px; border-radius: 6px; background: var(--bg); }
.exp-pdf { display: flex; align-items: center; justify-content: center; height: 180px; margin-top: 8px; border-radius: 6px; background: var(--bg); color: var(--muted); }
.exp-file-links { display: flex; flex-wrap: wrap; gap: 8px; margin: 10px 0 0; }
.exp-text { margin-top: 10px; }
.exp-text > summary { cursor: pointer; color: var(--muted); }
.exp-text pre { margin: 6px 0 0; padding: 8px; max-height: 340px; overflow: auto; white-space: pre-wrap; overflow-wrap: anywhere; font-size: 12px; background: #fafbfc; border-radius: 6px; }
.exp-data { min-width: 0; }
.exp-fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px 24px; }
.exp-fields .field { grid-template-columns: 1fr; gap: 2px; }
.exp-fields .field > label { padding-top: 0; }
.exp-mark { display: inline-block; margin-left: 4px; padding: 0 7px; border-radius: 8px; font-size: 11px; line-height: 17px; background: #e3f4fa; color: #0b7285; white-space: nowrap; }
.exp-mark.low { background: #fff3bf; color: #a5590c; }
.exp-field.is-low .control :is(input, select) { background: #fff9db; }
.exp-form:has(select[name="currency"] option[value="EUR"]:checked) :is(.exp-field[data-field="exchange_rate"], .exp-rate-help) { display: none; }
.exp-form:not(:has(select[name="paid_by"] option[value="company_card"]:checked)) .exp-field[data-field="card_last4"] { display: none; }
.exp-shares { margin: 16px 0 0; padding: 10px 12px 12px; border: 1px solid var(--line); border-radius: var(--radius); min-width: 0; }
.exp-shares legend { padding: 0 6px; font-weight: 600; color: var(--navy); }
.exp-share-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; }
.exp-share-main { flex: 1 1 240px; min-width: 0; }
.exp-share-amount { font-variant-numeric: tabular-nums; }
.exp-shared-toggle { margin-top: 8px; }
.exp-share2 { display: flex; flex-direction: column; gap: 8px; margin-top: 6px; padding-top: 8px; border-top: 1px dashed var(--line); }
.exp-shares:not(:has(input[name="shared"]:checked)) .exp-share2 { display: none; }
.exp-suggest { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.exp-suggest-chip { border: 1px solid #b6e0f0; cursor: pointer; font: inherit; font-size: 13px; }
.exp-suggest-chip:hover { border-color: var(--cyan); }
.exp-split { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 14px; }
.exp-split .exp-label { flex: 1 1 100%; margin: 0; }
.exp-split-pill { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; }
.exp-split-inputs { display: flex; flex-wrap: wrap; gap: 8px 16px; }
.exp-shares:has(input[name="split"][value="amount"]:checked) .exp-by-percent,
.exp-shares:not(:has(input[name="split"][value="amount"]:checked)) .exp-by-amount { display: none; }
.exp-split-out { margin: 0; font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; }
.exp-split-out.is-wrong { color: var(--danger); }
.exp-share-list { margin: 0; padding-left: 18px; }
.exp-share-locked { margin-top: 8px; padding-top: 8px; border-top: 1px dashed var(--line); }  /* the office's share */
.exp-project-ref { display: inline-flex; align-items: center; gap: 4px; padding: 0 6px; color: var(--muted); font-size: 13px; }  /* a job the viewer cannot open: no link */
.exp-buttons { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }
.exp-side-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 12px; padding-top: 10px; border-top: 1px solid var(--line); }
.exp-side-actions:empty { display: none; }
.exp-office { margin-top: 14px; padding: 10px 12px; background: #fafbfc; border: 1px solid var(--line); border-radius: var(--radius); }
.exp-office > summary { cursor: pointer; font-weight: 600; color: var(--navy); }
.exp-office-form { display: flex; flex-direction: column; gap: 8px; margin-top: 8px; }
.exp-office-line { margin: 0; }
.exp-costs td { white-space: nowrap; }  /* "P26-0001" and "75,00 €" in one piece */
.exp-costs tr.is-superseded td { color: var(--muted); text-decoration: line-through; }
.exp-banner { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.exp-to-confirm { line-height: 1.45; }
/* the list and the phone page */
.exp-list-new { display: flex; justify-content: flex-end; margin-bottom: 8px; }
.exp-new h2 { margin-top: 0; }
.exp-choices { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 8px; }
.exp-choice { display: flex; flex-direction: column; gap: 2px; min-height: 56px; padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--radius); background: #fff; color: var(--text); }
.exp-choice:hover { border-color: var(--cyan); }
.exp-choice.is-current { border-color: var(--cyan); box-shadow: inset 4px 0 0 var(--cyan); background: #f5fbfd; }
.exp-pick { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 8px; margin-top: 12px; }
.exp-pick .ac { flex: 1 1 260px; }
.exp-pick .exp-label { flex: 1 1 100%; }
@media (max-width: 800px) {
  .exp-review { grid-template-columns: 1fr; }
  .exp-receipt { position: static; }
  .exp-receipt-box img { max-height: 55vh; }
  .exp-list { grid-template-columns: 1fr; }
  .exp-bin, .exp-select-box { width: 44px; height: 44px; }
  .exp-select-box { top: 0; right: 0; }
  .exp-select-box input { width: 22px; height: 22px; }
  .exp-card:has(.exp-select-box) .exp-line1 { padding-right: 40px; }
  .exp-share-fields .ac, .exp-pick .ac, .exp-share2-project .ac, .exp-share-main .ac { min-height: 44px; }
  .exp-percent, .exp-split-inputs input, .exp-reimbursed input, .exp-cancel-form input { min-height: 44px; font-size: 16px; }
  .exp-split-pill { min-height: 44px; }
  .exp-buttons .btn, .exp-file-links .btn { flex: 1 1 auto; }
  .exp-totals { font-size: 14px; }
}
@media (max-width: 520px) {
  .exp-fields { grid-template-columns: 1fr; }
  .exp-card { grid-template-columns: 64px minmax(0, 1fr); }
  .exp-thumb { width: 64px; height: 84px; }
  .exp-cancel-form input { min-width: 0; }
  .exp-costs th:nth-child(4), .exp-costs td:nth-child(4) { display: none; }  /* superseded rows are struck through */
}
/* ---- supply ---- */
/* the supply inside its card (sales/partials/supply_fulfilment.html, M13): status, parts checklist, buttons,
   delivery notes and customs declarations (DUA); everything wraps, nothing scrolls sideways on a 375 px phone */
.supply-box { margin: 8px 0 4px; padding: 10px 12px; border: 1px solid #d3e8d9; border-radius: var(--radius); background: #f6fbf7; min-width: 0; }
.supply-head { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; }
.supply-ready { font-weight: 600; }
.supply-parts { list-style: none; margin: 8px 0 0; padding: 0; }
.supply-part { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 12px; padding: 7px 0; border-top: 1px solid #dcebe0; min-width: 0; }
.supply-part:first-child { border-top: 0; }
.supply-part-name { flex: 1 1 200px; min-width: 0; overflow-wrap: anywhere; }
.supply-part-name > span { font-weight: 500; }
.supply-qty { white-space: nowrap; }
.supply-chips { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; min-width: 0; font-size: 13px; }
.supply-chip { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 4px 6px; min-width: 0; max-width: 100%; overflow-wrap: anywhere; }
.supply-chip .pill { white-space: nowrap; }
/* a shelf, purchase, delivery note or DUA reference in one piece ("shelf B-12-4" never breaks at its hyphens); only
   one longer than the whole line breaks */
.supply-box .supply-token { display: inline-block; max-width: 100%; overflow-wrap: anywhere; }
.supply-fees { margin: 6px 0 0; }
.supply-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 10px; }
.supply-actions form { margin: 0; }
/* "Close the rest (no backorder)": folded, its reason and button under the hint */
.supply-close-rest { margin-top: 8px; }
.supply-close-rest form > p { flex: 1 0 100%; margin: 0; }
.supply-docs { margin-top: 10px; padding-top: 8px; border-top: 1px solid #dcebe0; }
.supply-docs h4 { margin: 0 0 4px; font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.supply-docs ul { list-style: none; margin: 0 0 6px; padding: 0; }
.supply-docs li { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; padding: 4px 0; min-width: 0; overflow-wrap: anywhere; font-size: 14px; }
.supply-files { display: inline-flex; align-items: center; gap: 4px; color: #2b8a3e; font-size: 13px; white-space: nowrap; }
.supply-pdf { display: inline-flex; align-items: center; gap: 4px; font-size: 13px; white-space: nowrap; }
.supply-hint { margin: 6px 0; }
/* service editor of a supply: the equipment only for the statistics, folded */
.supply-equipment { margin: 4px 0 8px; }
.supply-equipment > summary { cursor: pointer; color: var(--navy); font-weight: 500; }
.supply-equipment .field-grid { margin-top: 8px; }
/* request for quotation of the missing parts (sales/supply_rfq.html) */
.supply-rfq-parts { list-style: none; margin: 0 0 12px; padding: 0; }
.supply-rfq-parts li { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 4px 12px; padding: 6px 0; border-top: 1px solid var(--line); overflow-wrap: anywhere; }
/* the supplier is the only choice of the pop-up: the whole width, its name never cut */
.supply-rfq .field-grid { grid-template-columns: minmax(0, 1fr); }
/* delivery note page (sales/delivery_form.html, tab_delivery_lines.html) */
.dn-brief { margin-bottom: 12px; }
.dn-tools { display: flex; flex-wrap: wrap; align-items: flex-start; gap: 8px; margin: 0 0 12px; }
.dn-trash { color: var(--muted); }
.dn-trash:hover { color: var(--danger); background: #fff5f5; }
.dn-cancel > summary { list-style: none; cursor: pointer; } .dn-cancel > summary::-webkit-details-marker { display: none; }
.dn-cancel-form { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.dn-cancel-form input { flex: 1 1 240px; min-width: 0; padding: 6px 8px; border: 1px solid var(--line); border-radius: 6px; font: inherit; }
.dn-lines .dn-desc { min-width: 160px; overflow-wrap: anywhere; }
/* figures right-aligned as in every list (table.lines has no .num rule of its own) */
.dn-lines .num, .dn-follow .num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
/* table.lines.dn-lines: wins over the generic `table.lines input:not([type=checkbox])` (full width, underline) */
table.lines.dn-lines input.dn-qty, table.lines.dn-lines input.dn-sn { padding: 5px 8px; border: 1px solid var(--line); border-radius: 6px; font: inherit; }
table.lines.dn-lines input.dn-qty { width: 96px; text-align: right; }
table.lines.dn-lines input.dn-sn { width: 100%; min-width: 220px; }
.dn-follow-title { margin: 16px 0 6px; font-size: 14px; color: var(--navy); }
/* "Deliver now" with its unit (12.5 m) */
.dn-now { display: inline-flex; align-items: center; justify-content: flex-end; gap: 4px; max-width: 100%; }
/* the rule of a serial-tracked part, in sight under its box while typing (never cut off as a placeholder) */
.dn-lines .dn-sn-help { margin-top: 2px; white-space: normal; }
/* the goods and "To follow" share their columns: each part number, description and quantity of "To follow" stands
   under the goods' one (wide screens; on phones each line is a card and the columns do not apply) */
@media (min-width: 900px) {
  table.lines.dn-lines, table.lines.dn-follow { table-layout: fixed; }
  .dn-lines col.dn-c-pn, .dn-follow col.dn-c-pn { width: 14%; }
  .dn-lines col.dn-c-num, .dn-follow col.dn-c-num { width: 9%; }
  .dn-lines col.dn-c-now, .dn-follow col.dn-c-now { width: 132px; }
  .dn-lines col.dn-c-sn, .dn-follow col.dn-c-sn { width: 23%; }
  .dn-lines td, .dn-follow td { overflow-wrap: anywhere; }
  table.lines.dn-lines input.dn-sn { min-width: 0; }
}
/* the job card of the delivery note: a reference, a date with its label (ETA 30/10/2026) or IMO with its number in
   one piece on a 375 px phone; lines break only between the "·"-separated items */
.dn-brief .dn-token { display: inline-block; max-width: 100%; overflow-wrap: anywhere; }
/* the narrow status and type columns of the delivery notes, customs declarations and Work Orders lists: their
   filter says "Status: all" / "Estado: todos" in full */
.list-delivery-notes .col-filters select, .list-customs-declarations .col-filters select,
.list-work-orders .col-filters select { min-width: 9.5em; }
/* parts ready beyond what the draft delivers, and "Deliver everything that is ready" next to them */
.dn-more { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; overflow-wrap: anywhere; }
.dn-lines .dn-none { cursor: help; }
/* the read-only "Delivered" figure never runs into the serial numbers after it */
@media (min-width: 641px) { .dn-lines td:last-child, .dn-lines th:last-child { padding-left: 16px; } }
/* "Signed copy" of a delivered note (sales/delivery_form.html): right after the sheet, camera on phones */
.dn-signed { margin-top: 12px; }
.dn-signed h3 { margin: 0 0 6px; font-size: 14px; color: var(--navy); }
.dn-signed-done { margin: 0 0 8px; color: #2b8a3e; overflow-wrap: anywhere; }
.supply-signed { font-weight: 600; }
/* delivery notes ⇄ customs declarations (sales/delivery_list.html, customs_list.html): drawn as a button */
.btn.supply-list-switch { border-color: var(--line); }
/* a customs invoice that cannot be printed yet (a DUA without its delivery note, K24): the header action greyed out
   but still a button, in its usual place; the reason just under the header (sales/customs_form.html, #dua-hint) */
.btn.is-disabled { pointer-events: none; cursor: not-allowed; color: var(--muted); background: #f1f3f5; border-color: var(--line); }
.dua-print { display: flex; justify-content: flex-end; margin: 0 0 12px; }
.dua-print .dua-hint { flex: 0 1 520px; min-width: 0; margin: 0; }
@media (max-width: 800px) {
  .supply-actions > .btn, .supply-actions > form { flex: 1 1 auto; }
  .supply-actions > form .btn { width: 100%; }
  .supply-chip .btn, .supply-docs .btn { min-height: 40px; }
  .supply-pdf { min-height: 40px; }
  .dn-cancel-form input { min-height: 44px; font-size: 16px; }
  table.lines.dn-lines input.dn-qty, table.lines.dn-lines input.dn-sn { width: 100%; min-width: 0; min-height: 44px; font-size: 16px; }
  .dn-lines .dn-desc { min-width: 0; }
  .dn-now { display: flex; width: 100%; }
  .dn-now input.dn-qty { flex: 1 1 auto; }
  table.lines.dn-lines.cards > colgroup, table.lines.dn-follow.cards > colgroup { display: none; }
  .dua-print .dua-hint { flex: 1 1 auto; }
}
/* ---- invoice draft ---- */
/* S13b: an accounting line's label with the receipts printed under it on the invoice (MoveLine.details, K22): the
   Lines tab of an invoice and the journal item page */
.acc-line-label { min-width: 0; overflow-wrap: anywhere; }
/* the mark-up row first, right under the name, as on the invoice PDF; then the receipts */
.acc-markup { margin-top: .15rem; font-size: .9em; color: var(--muted); }
.acc-breakdown { margin: .2rem 0 0; padding-left: 1.1rem; font-size: .9em; color: var(--muted); }
/* the account, quantity, price and amounts of a line sit level with its name, never centred against its receipts */
table.list.acc-lines > tbody > tr > td { vertical-align: top; }
@media (max-width: 640px) {
  /* on a phone the label and its receipts take the whole card width, left aligned, under the account */
  table.list.cards td.acc-label { justify-content: flex-start; text-align: left; }
  table.list.cards td.acc-label::before { display: none; }
  table.list.cards td.acc-label .acc-line-label { flex: 1 1 auto; }
}
/* S13d: the draft invoice page (sales/invoice_draft.html + invoice_draft.js) and the Invoicing section of a project
   (sales/project_invoicing.html). One group per Work Order (its technician chip in the header), the lines added by
   hand, the expenses (Travel expenses / Fuel with their receipts under them). A line switched off is greyed, never
   hidden: it still counts as cost. On a phone (≤ 640 px) every line is a card (table.lines.cards, erp.js): the
   toggle and the description on top, quantity · price · discount · subtotal two by two, the actions last. */
.inv-steps { justify-content: flex-start; align-items: center; gap: 6px 0; margin: 0 0 10px; }
.inv-steps .step.done { color: var(--navy); background: #e3f4fa; }
.inv-steps .inv-chip { margin-left: 10px; }
.inv-who { margin: 0 0 10px; overflow-wrap: anywhere; }
.inv-token { display: inline-block; max-width: 100%; white-space: nowrap; }
.inv-head { margin-bottom: 8px; }
/* back from a line's button (#inv-wo-…, #inv-expenses, #inv-later): its title just under the sticky bars */
.inv-group { margin-top: 18px; min-width: 0; scroll-margin-top: 110px; }
.inv-updates ul, .inv-arrived ul { margin: 4px 0 0; padding-left: 18px; overflow-wrap: anywhere; }
/* `hidden` always wins on this page (a .btn "Recalculate" or a card group would otherwise show: display rules) */
.inv-form [hidden], .inv-group[hidden], .inv-lines tbody[hidden] { display: none !important; }
.inv-group-head { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; padding: 6px 0; border-bottom: 2px solid var(--navy); min-width: 0; }
.inv-group-title { display: inline-flex; align-items: center; gap: 6px; font-weight: 600; color: var(--navy); min-width: 0; overflow-wrap: anywhere; }
.inv-group-head small { overflow-wrap: anywhere; }
table.lines.inv-lines td { vertical-align: middle; padding-top: 5px; padding-bottom: 5px; }
.inv-lines th.inv-on, .inv-lines td.inv-on { width: 70px; text-align: center; }
.inv-lines .w-num { width: 10%; text-align: right; }
.inv-lines .num, .inv-lines td.num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
table.lines.inv-lines input[type=number] { text-align: right; }
.inv-lines th.inv-act, .inv-lines td.inv-act { width: 1%; text-align: right; white-space: nowrap; }
/* a line added by hand: its cell is td.del (the shared K27 bin: struck through until Save) */
table.lines.inv-lines td.inv-act.del { width: 44px; text-align: center; }
.inv-lines td.inv-desc { min-width: 220px; overflow-wrap: anywhere; }
.inv-text { overflow-wrap: anywhere; }
.inv-info { display: block; margin-top: 2px; font-size: 12px; color: var(--muted); }
.inv-warn { display: block; margin-top: 2px; font-size: 12px; color: #a5590c; }
.inv-badge { margin-left: 4px; white-space: nowrap; }
.inv-off-note { display: none; margin-top: 2px; font-size: 12px; color: var(--muted); font-style: italic; }
.inv-lines tr.is-off .inv-off-note { display: block; }
/* off: greyed (the toggle and the actions stay clear to switch it back), never struck through: strike-through means
   only the K27 bin ("removed when you save"); a line switched off stays, not charged, still a cost (M11) */
.inv-lines tr.is-off > td:not(.inv-on):not(.inv-act) { opacity: .5; }
/* Travel expenses / Fuel and the receipts under them */
.inv-lines tr.is-agg > td { background: #f5fbfd; }
.inv-lines tr.is-agg .inv-text, .inv-lines tr.is-agg textarea { font-weight: 500; }
.inv-lines tr.is-detail > td { background: #fcfcfd; font-size: 13px; }
.inv-lines tr.is-detail td.inv-desc { padding-left: 26px; }
.inv-receipt { display: flex; align-items: center; gap: 8px; min-width: 0; flex-wrap: wrap; }
.inv-thumb { display: inline-flex; align-items: center; justify-content: center; width: 36px; height: 36px; flex: none; color: var(--muted); }
.inv-thumb img { width: 36px; height: 36px; object-fit: cover; border-radius: 4px; border: 1px solid var(--line); }
.inv-agg-opts { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 14px; margin-top: 4px; font-size: 13px; }
.inv-agg-opts label { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); }
table.lines.inv-lines .inv-markup input { width: 72px; }
.inv-wo { display: flex; align-items: center; gap: 8px; margin-top: 4px; font-size: 13px; color: var(--muted); }
.inv-wo select { max-width: 260px; }
/* a line added by hand: "Product" names its search box, the text under it is what the invoice prints */
.inv-product { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; margin-bottom: 4px; min-width: 0; }
.inv-product > .inv-field-label { flex: none; font-size: 13px; color: var(--muted); }
.inv-product > .ac { flex: 1 1 180px; min-width: 0; }
/* the "On invoice" toggle: a switch, a 44 px target on phones */
.inv-switch { display: inline-flex; align-items: center; justify-content: center; min-width: 44px; min-height: 34px; cursor: pointer; }
.inv-switch input[type=checkbox] { appearance: none; -webkit-appearance: none; position: relative; width: 38px; height: 22px; margin: 0; border-radius: 11px; background: #ced4da; cursor: pointer; transition: background .15s; flex: none; }
.inv-switch input[type=checkbox]::after { content: ""; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(0,0,0,.25); transition: transform .15s; }
.inv-switch input[type=checkbox]:checked { background: var(--ok); }
.inv-switch input[type=checkbox]:checked::after { transform: translateX(16px); }
.inv-switch input[type=checkbox]:focus-visible { outline: 2px solid var(--cyan); outline-offset: 2px; }
@media (prefers-reduced-motion: reduce) { .inv-switch input[type=checkbox], .inv-switch input[type=checkbox]::after { transition: none; } }
.inv-later { margin-top: 18px; scroll-margin-top: 110px; }
.inv-later > summary { cursor: pointer; font-weight: 600; color: var(--navy); padding: 6px 0; }
.inv-later-next { margin: 0 0 6px; }
.inv-later-lines tr > td { color: var(--muted); }
.inv-not-charged td { color: var(--muted); font-size: 13px; }
.inv-foot-actions { display: flex; flex-wrap: wrap; align-items: flex-start; gap: 8px 12px; margin-top: 12px; }
.inv-foot-actions form { margin: 0; }
.inv-close > summary { list-style: none; } .inv-close > summary::-webkit-details-marker { display: none; }
.inv-close-form { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; max-width: 560px; }
.inv-close-form .help { flex: 1 0 100%; margin: 0; }
.inv-close-form input { flex: 1 1 240px; min-width: 0; padding: 6px 8px; border: 1px solid var(--line); border-radius: 6px; font: inherit; }
.inv-foot-actions [hidden] { display: none !important; }
.inv-later-why { font-style: italic; }
/* the "Confirm invoice" dialog */
.inv-confirm .inv-confirm-totals { margin: 0 0 12px auto; }
.inv-confirm .field { margin-bottom: 8px; }
.inv-rules { margin: 6px 0 12px; padding-left: 18px; font-size: 13px; color: var(--muted); }
.inv-rules li { margin-bottom: 4px; }
/* the Invoicing section of the project page */
.inv-section { margin-top: 18px; }
.inv-section-head { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; }
.inv-section-head h2 { display: inline-flex; align-items: center; gap: 8px; margin: 0; }
.inv-pending { margin: 10px 0; overflow-wrap: anywhere; }
.inv-draft-card { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; margin: 10px 0; padding: 10px 14px; border: 1px solid #cfe9f3; border-radius: var(--radius); background: #f5fbfd; min-width: 0; }
.inv-draft-card.state-invoiced { border-color: #ffe08a; background: #fffbea; }
.inv-draft-card .inv-draft-amount { margin-left: auto; font-variant-numeric: tabular-nums; white-space: nowrap; }
.inv-section form { margin: 0; }
.inv-start { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; margin: 10px 0; }
.inv-section .inv-docs { margin-top: 12px; }
.inv-section .inv-docs h3 { margin: 0 0 6px; font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.inv-closed { margin: 0; padding-left: 18px; overflow-wrap: anywhere; }
@media (max-width: 800px) {
  .inv-switch { min-height: 44px; }  /* the "On invoice" toggle: a 44 px target under the thumb */
  .inv-close-form input { min-height: 44px; font-size: 16px; }
  .inv-draft-card .inv-draft-amount { margin-left: 0; }
  .inv-draft-card .btn, .inv-section form .btn { flex: 1 1 auto; }
}
@media (max-width: 640px) {
  /* each line a card: toggle and actions on one row at the top, the description under them */
  table.lines.inv-lines.cards > tbody > tr { position: relative; }
  table.lines.inv-lines.cards td.inv-on, table.lines.inv-lines.cards td.inv-act { grid-column: auto; text-align: left; width: auto; }
  table.lines.inv-lines.cards td.inv-on { order: -2; display: flex; align-items: center; gap: 8px; }
  table.lines.inv-lines.cards td.inv-on::before { display: inline; }
  table.lines.inv-lines.cards td.inv-act { order: -1; display: flex; justify-content: flex-end; align-items: center; gap: 6px; flex-wrap: wrap; }
  table.lines.inv-lines.cards td.inv-act:empty { display: none; }
  table.lines.inv-lines.cards td.inv-desc { min-width: 0; }
  table.lines.inv-lines.cards tr.is-detail td.inv-desc { padding-left: 0; }
  /* Travel expenses / Fuel and their receipts: the whole card is tinted, never cell by cell with white gaps */
  table.lines.inv-lines.cards tr.is-agg { background: #f5fbfd; }
  table.lines.inv-lines.cards tr.is-detail { background: #fcfcfd; }
  table.lines.inv-lines.cards tr.is-agg > td, table.lines.inv-lines.cards tr.is-detail > td { background: transparent; }
  /* label and value of a figure on the same side (the cell kept the desktop's right alignment) */
  table.lines.inv-lines.cards td.w-num { text-align: left; }
  table.lines.inv-lines.cards td.w-num .num { display: block; text-align: left; }
  table.lines.inv-lines.cards td[data-subtotal] { text-align: left; font-weight: 600; }
  table.lines.inv-lines.cards tr.inv-empty td::before { display: none; }
  .inv-lines .inv-markup input { width: 100%; }
  .inv-wo { flex-wrap: wrap; }
  .inv-wo select { max-width: 100%; }
}

/* ---- product photos (catalog.photos): the first column of the inventory list and the photo on the article's page ---- */
table.list td:has(> .list-photo) { width: 56px; padding-top: 4px; padding-bottom: 4px; }
.list-photo { display: block; width: 40px; height: 40px; object-fit: contain; border: 1px solid var(--line); border-radius: 6px; background: #fff; }
.list-photo.is-empty { display: flex; align-items: center; justify-content: center; color: #b8c2cc; background: #f6f8fa; border-style: dashed; }
.col-filters select[name="c_photo"] { min-width: 6.5em; }
@media (max-width: 640px) {
  /* the card: the photo at its top left, the name beside it (also beside the selection box of the list) */
  table.list.cards > tbody > tr:has(> td > .list-photo) { position: relative; }
  table.list.cards > tbody > tr > td:has(> .list-photo):not(.sel) { position: absolute; top: 10px; left: 14px; display: block; width: 52px; height: 52px; min-height: 0; padding: 0; }
  table.list.cards > tbody > tr > td:has(> .list-photo):not(.sel)::before { display: none; }
  table.list.cards .list-photo { width: 52px; height: 52px; }
  table.list.cards > tbody > tr > td:has(> .list-photo) + td { min-height: 58px; padding-left: 64px; padding-bottom: 6px; align-items: center; justify-content: flex-start; text-align: left; font-weight: 600; font-size: 17px; color: var(--navy); }
  table.list.cards > tbody > tr > td:has(> .list-photo) + td::before { display: none; }
}
.photo-field { display: flex; flex-direction: column; align-items: flex-start; gap: 8px; min-width: 0; max-width: 100%; }
.photo-frame { display: flex; align-items: center; justify-content: center; width: 240px; height: 180px; max-width: 100%; border: 1px solid var(--line); border-radius: 10px; background: #fff; overflow: hidden; }
.photo-frame img { display: block; width: 100%; height: 100%; object-fit: contain; }
a.photo-frame:hover, a.photo-frame:focus-visible { border-color: var(--cyan); box-shadow: 0 2px 10px rgba(22,44,66,.12); }
.photo-frame.is-empty { flex-direction: column; gap: 6px; color: #9aa7b4; background: #f6f8fa; border-style: dashed; font-size: 13px; }
.photo-field.is-dragover .photo-frame { border-color: var(--cyan); background: #eef8fc; }
.photo-clear { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; cursor: pointer; }
.photo-clear input { margin: 0; }
/* on the article's page the photo stands beside its first fields, as on a product card */
@media (min-width: 801px) {
  .field-grid.main > .field:has(.photo-field) { grid-column: 2; grid-row: 1 / span 6; align-self: start; }
}
@media (max-width: 800px) {
  .field-grid.main > .field:has(.photo-field) { order: -1; }
  .photo-frame { width: 100%; height: 220px; }
}
