/* Device Management: section styles only. Loaded after /shared/ui.css (tokens, header, buttons, inputs,
   list page, badges, dialogs, toast). Activity bar and loading rows copied from costdetails.css. */

.pbar { position: fixed; left: 0; right: 0; top: 52px; height: 3px; z-index: 60; overflow: hidden; background: transparent; pointer-events: none; }
.pbar::before { content: ""; position: absolute; top: 0; bottom: 0; width: 35%; background: var(--accent); border-radius: 3px; animation: pbar 1.1s ease-in-out infinite; }
@keyframes pbar { from { left: -35%; } to { left: 100%; } }
.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; }

/* ------------------------------------------------------------------ list page */
.dvf { display: flex; flex-wrap: wrap; align-items: end; gap: 10px; }
.dvf label { min-width: 160px; }
.dvf .grow { flex: 1 1 240px; }
.lres { margin: 8px var(--gutter) 0; }
.rt tr.nolink { cursor: default; }
.rt tr.old td { opacity: .65; }
.rt tr.nolink:hover { background: none; }
.empty { padding: 24px var(--gutter); }
.no-since .since { display: none !important; }

/* ------------------------------------------------------------------ device and employee pages */
.dv .bar h1 { font-size: 1.35rem; }
.dv .back { padding: 6px 10px; }
.dacts { margin-left: auto; display: flex; gap: 8px; flex-wrap: wrap; }
.danger-t { color: var(--danger); }
.dmeta { flex: 1 1 260px; }
.warn-t { color: var(--danger); }

/* header search (every page) */
.dvfind { position: relative; }
.findlist { position: absolute; top: calc(100% + 4px); left: 0; z-index: 70; width: min(420px, 92vw); max-height: 60vh; overflow: auto;
            margin: 0; padding: 4px 0; list-style: none; background: var(--surface); color: var(--ink); border: 1px solid var(--line);
            border-radius: 10px; box-shadow: 0 8px 24px rgba(0,0,0,.25); }
.findlist a { display: grid; gap: 1px; padding: 8px 12px; color: inherit; text-decoration: none; }
.findlist li[aria-selected="true"] a, .findlist a:hover { background: var(--surface-2); }
.findlist small { color: var(--muted); font-size: .8rem; }
.findlist .none { padding: 8px 12px; color: var(--muted); }
.ro { margin: 0; padding: 8px var(--gutter); background: var(--surface-2); font-size: .92rem; border-bottom: 1px solid var(--line); }
.dverr { margin: 8px var(--gutter) 0; }
.dcols { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); gap: 12px; padding: 12px var(--gutter) 96px; align-items: start; }
.dform { display: grid; gap: 10px; }
.dside { display: grid; gap: 12px; }
.dhist { min-width: 0; }
.dside .card, .dhist { display: grid; gap: 8px; }
.dkv { display: grid; grid-template-columns: max-content 1fr; gap: 4px 14px; margin: 0; font-size: .92rem; }
.dkv dt { color: var(--muted); font-weight: 600; }
.dkv dd { margin: 0; }
.policy { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; color: var(--ink); font-weight: 400; }
.rt td { vertical-align: top; }
@media (max-width: 900px) { .dcols { grid-template-columns: 1fr; } }

/* ------------------------------------------------------------------ phones
   Tables stack into cards: first cell is the title, the rest show their data-l label. Filters go full width,
   and the page bar (title + Save) stays on screen while the form scrolls. */
@media (max-width: 720px) {
  .dvf label, .dvf .grow { flex: 1 1 100%; min-width: 0; }
  .dvf .btn { flex: 1 1 100%; }
  .lres { margin: 8px 0 0; border-radius: 0; border-left: 0; border-right: 0; }
  .rt.stack thead { display: none; }
  .rt.stack, .rt.stack tbody { display: block; }
  .rt.stack tr { display: block; padding: 10px var(--gutter) 12px; border-bottom: 1px solid var(--line); }
  /* one line per field: fixed label column so every card lines up; cell content stays together */
  .rt.stack td { display: flex; align-items: baseline; gap: 10px; border: 0; padding: 2px 0; min-width: 0; }
  .rt.stack td[data-l]::before { content: attr(data-l); flex: 0 0 92px; color: var(--muted); font-size: .8rem; font-weight: 600; }
  .rt.stack td[data-l]:empty { display: none; }
  .rt.stack td.id { font: 700 1.02rem var(--f-display); padding-bottom: 6px; }
  .rt.stack td.del { padding-top: 4px; }
  .rt.stack .badge { flex: none; }
  .rt.stack td.num { text-align: left; justify-content: flex-start; }
  .dcols { padding: 8px 0 96px; gap: 8px; }
  .dcols .card { border-radius: 0; border-left: 0; border-right: 0; }
  .dv .bar { position: sticky; top: 0; z-index: 20; }
  .dacts { width: 100%; }
  .dacts .btn { flex: 1 1 0; }
}

/* header search: wider on desktop; on phones (where ui.css hides .jump) it stays, filling the header */
.hdr .dvfind input { width: 340px; max-width: 32vw; padding: 7px 12px; font-size: .95rem; }
@media (max-width: 720px) {
  /* phones: search gets its own full-width row under the logo and buttons */
  .dv .hdr-in { flex-wrap: wrap; row-gap: 8px; padding-top: 6px; padding-bottom: 10px; }
  .hdr .dvfind { display: block; order: 99; flex: 1 1 100%; min-width: 0; margin: 0; }
  .hdr .dvfind input { box-sizing: border-box; width: 100%; max-width: none; height: 40px; padding: 0 12px; font-size: 16px; border-radius: 10px; }   /* 16px: no iOS zoom on focus */
  .findlist { left: 0; right: 0; width: auto; }
  /* the four tabs fit without sideways scrolling */
  #tabs { gap: 6px; }
  #tabs .pill-btn { padding: 6px 11px; font-size: .85rem; }
}

/* employee lookup: field-looking button + full-height search dialog (phone friendly, no datalist) */
.lookup { display: block; width: 100%; text-align: left; font: inherit; font-size: 1rem; color: var(--ink); background: var(--surface);
          border: 1px solid var(--line); border-radius: var(--r-sm); padding: 9px 36px 9px 12px; min-height: 42px; cursor: pointer; position: relative; }
.lookup::after { content: "\203A"; position: absolute; right: 12px; top: 50%; transform: translateY(-50%) rotate(90deg); color: var(--muted); font-size: 1.2rem; }
.lookup.empty { color: var(--muted); }
.lookup:disabled { opacity: .7; cursor: default; }
dialog.pick { max-width: 520px; height: min(640px, 90vh); }
dialog.pick form { height: 100%; grid-template-rows: auto auto 1fr; }
.pick-h { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.pick-h h2 { margin: 0; font-size: 1.1rem; }
#pickQ { font-size: 16px; }
.pick-list { list-style: none; margin: 0; padding: 0; overflow: auto; border-top: 1px solid var(--line); }
.pick-list li { border-bottom: 1px solid var(--line); }
.pick-list button { display: grid; grid-template-columns: 1fr auto; gap: 2px 8px; width: 100%; text-align: left; padding: 10px 4px; background: none; border: 0; color: inherit; font: inherit; cursor: pointer; }
.pick-list button:hover, .pick-list button:focus-visible { background: var(--surface-2); }
.pick-list small { grid-column: 1; color: var(--muted); font-size: .82rem; }
.pick-list .badge { grid-column: 2; grid-row: 1 / 3; align-self: center; }
.pick-list .none { padding: 14px 4px; color: var(--muted); }
@media (max-width: 720px) { dialog.pick { width: 100%; max-width: none; height: 100%; max-height: none; margin: 0; border-radius: 0; } }

/* "Other..." vendor box under the Purchased from drop-down */
input.other { margin-top: 6px; }

/* bulk status bar (Devices tab) */
.dvbulk { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 8px var(--gutter) 0; padding: 8px 12px; background: var(--accent-soft); border-radius: var(--r-sm); }
.dvbulk input { flex: 1 1 200px; min-width: 0; }
.rt .selc { width: 34px; }
.nosel .selc { display: none !important; }
.rt .selc input { width: 18px; height: 18px; }

/* Dashboard tab */
.dvdash { padding: 4px var(--gutter) 96px; display: grid; gap: 10px; }
.dvdash h2 { margin: 14px 0 0; font: 700 1.05rem var(--f-display); }
.dtiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.dtile { display: flex; flex-direction: column; gap: 2px; padding: 12px 14px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); color: var(--ink); text-decoration: none; }
a.dtile:hover { background: var(--surface-2); }
.dtile b { font: 700 1.6rem/1.1 var(--f-display); }
.dtile span { color: var(--muted); font-size: .88rem; }
.dtile small { display: block; font-size: .78rem; }
.dtile.warn { border-color: #C98A1B; } .dtile.warn b { color: #C98A1B; }
.dtile.bad b { color: var(--danger); }
.dchart { padding: 12px; }
.dchart .bars { display: grid; grid-template-columns: repeat(12, 1fr); gap: 6px; align-items: end; height: 170px; }
.dchart .col { display: grid; grid-template-rows: 1fr auto auto; height: 100%; text-align: center; font-size: .75rem; color: var(--muted); }
.dchart .stack { display: flex; align-items: flex-end; justify-content: center; gap: 2px; height: 100%; min-height: 0; }
.dchart .stack i { display: block; width: 40%; max-width: 16px; min-height: 2px; border-radius: 3px 3px 0 0; }
.dchart small { font-size: .7rem; }
.dchart .new, .dchart .key.new { background: var(--brand-2, #2E9E6B); }
.dchart .gone, .dchart .key.gone { background: var(--danger); }
.dchart .key { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin: 0 4px 0 10px; vertical-align: -1px; }
.dgrid { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 12px; }
.dgrid .tw { max-height: 360px; }
