/* DTC additions on top of app.css (copied unchanged from DIM, itinv/static/app.css).
   Follows the DIM Design System (document for DIM 1.15.2): only tokens (var(--…)), never
   literal colours outside :root; 8px radius for cards and panels, 6px for buttons, inputs
   and menu items, 999px for badges and counts; rem spacing; no shadows on cards. */

/* Tokens DTC adds (the same names in light and dark, like DIM's). */
:root {
  --float-shadow: 0 12px 32px rgba(16, 24, 40, .14), 0 2px 6px rgba(16, 24, 40, .06);   /* floating panels only */
  --screen-bg: #101512;        /* behind a remote screen that does not fill its window */
}

/* Compact button for table rows and tool bars (DIM has none between a button and a pill). */
button.small, a.button.small { padding: .2rem .65rem; font-size: .85rem; }

/* Notice boxes: the same as DIM's dashboard alert boxes (.wheel-alert), under a general name. */
.notice { border-radius: var(--radius); padding: .75rem 1rem; margin-bottom: 1rem; border: 1px solid; }
.notice h2 { font-size: 1rem; margin: 0 0 .35rem; }
.notice p { margin: .2rem 0; }
.notice ul { margin: 0; padding-left: 1.2rem; }
.notice-warn { background: var(--b-amber-bg); border-color: var(--line-amber); }
.notice-warn h2 { color: var(--b-amber); }
.notice-info { background: var(--info-bg); border-color: var(--info-border); }
.notice-danger { background: var(--danger-bg); border-color: var(--danger-border); }
.notice-danger h2 { color: var(--danger); }
.notice .buttons { margin-top: .5rem; }

/* Tables */
table.list td.empty { text-align: center; color: var(--muted); padding: 1.5rem; }
tr.status-stolen td { background: var(--row-error); }
tr.status-revoked td { color: var(--muted); }
tr.unseen td { font-weight: 600; }
table.list td { vertical-align: top; }
.card.flush h2.pad + p.pad { margin-top: -.4rem; }

/* Online dot in the laptop list */
.dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; background: var(--line-gray); }
.dot.on { background: var(--line-green); }

/* Code: settings text and log lines */
pre.code { margin: .5rem 0; padding: .6rem .8rem; background: var(--surface-2); border-radius: 6px; overflow-x: auto;
           font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; font-size: .85em; }
textarea.code { font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; font-size: .9em; }
td.code { font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; font-size: .85em; word-break: break-word; }

/* Card headings inside the two-column layout, and forms within cards */
.card h2 + form, .card h2 + dl { margin-top: 0; }
.card h3:first-child { margin-top: 0; }
.card form.inline-form { display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; margin: 0; }
.card form.inline-form select { width: auto; }
.card .buttons { margin-top: .5rem; }

/* Number cards with a top-border tone (DIM has green, blue, amber, red); muted when zero */
.stat.zero .num { color: var(--muted); }

/* Screen viewer (noVNC) */
/* Screen: the box takes the computer's screen shape (screen.js sets --screen-ratio), so no empty band */
.screen { width: 100%; aspect-ratio: var(--screen-ratio, 16 / 9); max-height: calc(100vh - 150px); min-height: 240px;
  border-radius: var(--radius); overflow: hidden; background: transparent; }
.screen canvas { border-radius: var(--radius); }
.screen[hidden] { display: none; }

/* Login: the sub line under the logo */
.card.login .brand { color: var(--brand); }
.filters.bare { margin: 0; }
.row-form { flex-wrap: nowrap; }
.row-form select { width: auto; flex: 1 1 12rem; min-width: 10rem; }

/* Phones: wide tables scroll inside their card instead of widening the page */
@media (max-width: 900px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  .shell-main, .shell-main .container { min-width: 0; }
  .card.flush { overflow-x: auto; }
}

/* Usage charts (charts.py draws them as SVG on the server) */
.chart { display: block; width: 100%; height: auto; max-height: 240px; }
.chart-bar { fill: var(--line-green); }
.chart g:hover .chart-bar { fill: var(--accent-hover); }
.chart-axis { stroke: var(--border); stroke-width: 1; }
.chart-value { fill: var(--text); font-size: 13px; font-weight: 600; text-anchor: middle; }
.chart-label { fill: var(--muted); font-size: 12px; text-anchor: middle; }
.card .chart { margin-top: .25rem; }

/* Dashboard: a heading with a link on the right inside a card */
.card .pagehead { margin-bottom: .5rem; }
.card .pagehead h2 { margin: 0; }
.card.flush .pagehead.pad { padding-bottom: .4rem; }

/* Profile form: filled-in settings stand out from inherited ones */
.profile-form .field.is-set > label { color: var(--accent); }
.profile-form .field.is-set > label::after { content: " ●"; font-size: .7em; vertical-align: middle; }
.profile-form textarea.code { min-height: 2.4rem; }
.sticky-actions { position: sticky; bottom: 0; background: var(--bg); padding: .75rem 0; margin-top: 0; z-index: 5;
                  border-top: 1px solid var(--border); }

/* Coloured command buttons, so the everyday ones stand out from the risky ones. */
button.tone-green { background: var(--b-green-bg); color: var(--b-green); border-color: var(--success-border); }
button.tone-amber { background: var(--b-amber-bg); color: var(--b-amber); border-color: var(--line-amber); }
button.tone-red { background: var(--danger-bg); color: var(--danger); border-color: var(--danger-border); }
button.tone-green:hover, button.tone-amber:hover, button.tone-red:hover { filter: brightness(.94); }
tr.handled td { color: var(--muted); }
form.add-row { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; }
form.add-row input { flex: 1 1 14rem; width: auto; margin: 0; }
form.add-row button { margin: 0; }

/* Password, PIN and secret fields in the profile form */
.secret-tools { display: flex; gap: 1rem; align-items: center; flex-wrap: wrap; margin-top: .25rem; }
.secret-tools .linkbutton { margin: 0; padding: 0; }
pre.made-hash { margin-top: .4rem; white-space: pre-wrap; word-break: break-all; font-size: .8rem; }

/* Dashboard: two wide columns (chart + rollout, then problems + activity) */
.columns.two { grid-template-columns: repeat(auto-fit, minmax(min(520px, 100%), 1fr)); }

/* Computers list: tick several, then "With selected" (top right of the table) */
.bulkbar { display: flex; justify-content: flex-end; margin: 0 0 .35rem; }
.bulkmenu { position: relative; }
.bulkmenu > summary { list-style: none; cursor: pointer; font-size: .85rem; padding: .25rem .65rem;
  border: 1px solid var(--border); border-radius: 6px; background: var(--surface); color: var(--text); }
.bulkmenu > summary::-webkit-details-marker { display: none; }
.bulkmenu > summary::after { content: " ▾"; color: var(--muted); }
.bulkmenu.has-selection > summary { border-color: var(--accent); color: var(--accent); font-weight: 600; }
.bulkmenu-items { position: absolute; right: 0; top: calc(100% + 4px); z-index: 20; min-width: 210px;
  display: flex; flex-direction: column; padding: .35rem; background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--float-shadow); }
.bulkmenu-items button { text-align: left; background: none; border: 0; padding: .5rem .7rem; font-size: .9rem;
  color: var(--text); border-radius: 6px; cursor: pointer; }
.bulkmenu-items button:hover:not(:disabled) { background: var(--surface-2); }
.bulkmenu-items button:disabled { color: var(--muted); cursor: default; }
.bulkmenu-items button.danger:not(:disabled) { color: var(--danger); }
.bulkmenu-items .bulk-hint { margin: .25rem .65rem .35rem; }
.bulkmenu.has-selection .bulk-hint { display: none; }
table.list th.check, table.list td.check { width: 28px; padding-right: 0; }
table.list td.check input, table.list th.check input { width: 16px; height: 16px; cursor: pointer; }
table.list tr.selected td { background: var(--row-current); }

/* Computer page: files */
.file-send input[type=file] { max-width: 100%; }
.file-list { max-height: 420px; overflow: auto; border: 1px solid var(--border); border-radius: var(--radius); margin-top: .5rem; }
.file-list table.list { margin: 0; }

#files h3 { margin: 1.25rem 0 .35rem; font-size: 1rem; }

/* Screen page: the screen with copy and paste beside it (below it on narrow screens) */
.screen-layout { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 1rem; align-items: start; }
.screen-status { margin: 0 0 .35rem; }
.screen-side { position: sticky; top: 70px; margin: 0; }
.screen-away { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .5rem;
  min-height: 240px; border: 1px dashed var(--border); border-radius: var(--radius); color: var(--muted); }
.clipboard h2 { margin: 0 0 .5rem; font-size: 1.05rem; }
.clipboard h3 { margin: 0 0 .25rem; font-size: .9rem; }
.clipboard .clip-part + .clip-part { margin-top: 1rem; padding-top: .75rem; border-top: 1px solid var(--border); }
.clipboard textarea { width: 100%; font-family: inherit; font-size: .85rem; resize: vertical; margin: 0; }
.clipboard .buttons { display: flex; flex-wrap: wrap; gap: .35rem; margin-top: .35rem; }
.clipboard .buttons button { margin: 0; padding: .35rem .65rem; font-size: .85rem; }
.clipboard #clip-status { margin: .5rem 0 0; min-height: 1.2em; }
@media (max-width: 1100px) {
  .screen-layout { grid-template-columns: 1fr; }
  .screen-side { position: static; }
}

/* The screen in its own window: slim bar, the screen fills the rest */
body.screen-window { margin: 0; height: 100vh; display: flex; flex-direction: column; background: var(--bg); }
.sw-bar { display: flex; align-items: center; gap: .65rem; padding: .35rem .65rem; border-bottom: 1px solid var(--border);
  background: var(--surface); font-size: .9rem; flex-wrap: wrap; }
.sw-bar form { margin: 0; }
.sw-bar button { margin: 0; padding: .25rem .65rem; font-size: .85rem; }
.sw-bar .inline-check { margin: 0 0 0 auto; }
.sw-status { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sw-body { flex: 1 1 auto; display: flex; min-height: 0; }
.screen.screen-fill { flex: 1 1 auto; aspect-ratio: auto; height: auto; max-height: none; min-height: 0; border-radius: 0;
  background: var(--screen-bg); }
.screen-side[hidden] { display: none; }
.screen.screen-fill canvas { border-radius: 0; }
.screen.actual-size { overflow: auto; }
.sw-side { width: 300px; flex: 0 0 300px; overflow: auto; padding: .75rem; border-left: 1px solid var(--border);
  background: var(--surface); }
.sw-side[hidden] { display: none; }
.sw-empty { padding: 1.5rem; }

/* Files card: choose a file and send it on one line, the file list button beside it */
.file-actions { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; justify-content: space-between; }
.file-actions form { display: flex; gap: .5rem; align-items: center; margin: 0; flex-wrap: wrap; }
.file-actions form button { margin: 0; }
.file-actions input[type=file] { width: auto; margin: 0; padding: .25rem; }

/* Profile page: "Set in this profile" on top, then every setting in sections with a side menu */
.applied-table { width: 100%; border-collapse: collapse; }
.applied-table td, .applied-table th { padding: .25rem .5rem; border-bottom: 1px solid var(--border); text-align: left;
  vertical-align: top; }
.applied-table tr.applied-group th { padding-top: .75rem; font-size: .8rem; text-transform: uppercase; letter-spacing: .04em;
  color: var(--muted); border-bottom: 1px solid var(--border); }
.applied-table td.applied-label { width: 34%; }
.applied-table td.applied-value code { word-break: break-all; }
.all-settings-head { margin: 1.5rem 0 .25rem; }
.profile-layout { display: grid; grid-template-columns: 200px minmax(0, 1fr); gap: 1rem; align-items: start; }
.profile-nav { position: sticky; top: 70px; display: flex; flex-direction: column; gap: 1px; font-size: .9rem;
  max-height: calc(100vh - 90px); overflow: auto; }
.profile-nav a { padding: .35rem .5rem; border-radius: 6px; color: var(--text); text-decoration: none;
  display: flex; justify-content: space-between; gap: .5rem; }
.profile-nav a:hover { background: var(--surface-2); }
.profile-nav-tools { display: flex; gap: .75rem; padding: 0 .5rem .35rem; font-size: .8rem; }
.profile-nav-tools .linkbutton { margin: 0; padding: 0; }
.count { display: inline-block; min-width: 1.4em; padding: .1rem .5rem; border-radius: 999px; font-size: .75rem;
  text-align: center; background: var(--b-green-bg); color: var(--b-green); font-weight: 600; }
details.psec { padding-top: .5rem; padding-bottom: .5rem; scroll-margin-top: 70px; }
details.psec > summary { display: flex; align-items: center; gap: .75rem; cursor: pointer; list-style: none; }
details.psec > summary::-webkit-details-marker { display: none; }
details.psec > summary::before { content: "▸"; color: var(--muted); width: 1em; }
details.psec[open] > summary::before { content: "▾"; }
details.psec > summary h2 { margin: 0; font-size: 1.05rem; }
details.psec > summary .muted { font-size: .85rem; }
details.psec[open] > summary { margin-bottom: .5rem; }
.profile-form .form-grid { grid-template-columns: repeat(auto-fill, minmax(min(320px, 100%), 1fr)); }
.profile-form .field { scroll-margin-top: 70px; }
.printer-list { display: flex; flex-direction: column; gap: .6rem; margin-bottom: .6rem; }
.printer-block { border: 1px solid var(--border); border-radius: var(--radius); padding: .5rem .8rem .6rem; margin: 0;
  scroll-margin-top: 70px; }
.printer-block.is-new { border-color: var(--accent); }
.printer-block legend { font-weight: 600; padding: 0 .3rem; }
.printer-grid { display: grid; grid-template-columns: 1fr 1fr; gap: .4rem .8rem; }
.printer-grid label { display: block; font-size: .85rem; gap: 2px; margin: 0; }
.printer-grid label input { margin: 2px 0 0; width: 100%; }
.printer-grid .wide { grid-column: 1 / -1; }
.printer-foot { display: flex; justify-content: space-between; align-items: center; margin-top: .4rem; }
.printer-foot .linkbutton { margin: 0; padding: 0; }
.danger-link { color: var(--danger) !important; }
@media (max-width: 800px) {
  .profile-layout { grid-template-columns: 1fr; }
  .profile-nav { position: static; flex-direction: row; flex-wrap: wrap; max-height: none; }
  .printer-grid { grid-template-columns: 1fr; }
}
.printer-grid label > .muted { display: inline; }

/* Files in their own window */
body.files-window { margin: 0; padding: .75rem; background: var(--bg); }
body.files-window .card { margin: 0; }
body.files-window .flash, body.files-window .notice { margin: 0 0 .65rem; }
#files .pagehead { display: flex; justify-content: space-between; align-items: center; gap: .5rem; }
#files .pagehead a.button { font-size: .85rem; padding: .25rem .65rem; }
.sw-bar a.button { margin: 0; padding: .25rem .65rem; font-size: .85rem; }

/* Updates page: channels table */
.table-scroll { overflow-x: auto; }
.channels-table td { vertical-align: top; }
.channels-table td.channel-name strong { white-space: nowrap; }
.channels-table td.channel-count .channel-total { font-size: 1.15rem; font-weight: 600; margin-right: .4rem; }
.channels-table .channel-badges { display: flex; flex-wrap: wrap; gap: .3rem; margin-top: .3rem; }
.channels-table .channel-badges:empty { display: none; }
.channels-table td.channel-actions { min-width: 22rem; }
.channels-table .channel-buttons { display: flex; flex-wrap: wrap; gap: .35rem; margin-top: .4rem; }

.channels-table .channel-buttons button:disabled { opacity: .35; cursor: default; }

/* --- Side menu: the three levels of the DIM Design System (1.15.2) ------------------------
   app.css here is an older copy of DIM's; these rules bring the side menu up to the
   document. They can go when app.css is copied again from DIM 1.15.2 or newer. */
.sidenav.grouped .side-group { border-radius: var(--radius); }
.sidenav.grouped .side-group[open] { background: rgba(255, 255, 255, .05); padding-bottom: .3rem; }
.sidenav.grouped .side-group[open] + .side-group, .sidenav.grouped .side-group + .side-group[open] { margin-top: .4rem; }
.sidenav.grouped .side-heading { margin-top: 0; padding: .55rem .75rem; font-size: .74rem; font-weight: 700;
                                 text-transform: uppercase; letter-spacing: .08em; color: #fff; }
.sidenav.grouped .side-group:not([open]) > .side-heading { color: var(--side-text); opacity: .7; }
.sidenav.grouped .side-group:not([open]) > .side-heading:hover { opacity: 1; }
.sidenav.grouped .side-group[data-current] > .side-heading { box-shadow: inset 3px 0 0 #3cc57f; }
.sidenav.grouped .side-group > a, .sidenav.grouped .side-group > .side-sub { margin-left: .85rem;
                                 border-left: 1px solid rgba(255, 255, 255, .18); }
.sidenav.grouped .side-group > a { padding-left: .8rem; border-radius: 0 6px 6px 0; }
.sidenav.grouped .side-sub > summary { padding: .4rem .75rem .4rem .8rem; font-size: .9em; font-weight: 600;
                                 color: var(--side-text); border-radius: 0 6px 6px 0; }
.sidenav.grouped .side-sub[open] > summary { color: #fff; }
.sidenav.grouped .side-sub:not([open]) > summary { opacity: .75; }
.sidenav.grouped .side-sub > a { margin-left: .8rem; padding-left: .8rem; font-size: .95em;
                                 border-left: 1px solid rgba(255, 255, 255, .18); border-radius: 0 6px 6px 0; }
.sidenav.grouped .menu-dot { align-self: center; margin-top: 0; }
@media (max-width: 900px) {
  .sidenav.grouped .side-group > a, .sidenav.grouped .side-group > .side-sub { margin-left: 0; border-left: 0; }
}

/* User menu: light, dark or follow the computer (saved per admin) */
.menu-theme .menu-heading { display: block; }
.theme-choice { display: flex; gap: .25rem; padding: .35rem .7rem .5rem; }
.theme-choice button { flex: 1 1 0; padding: .25rem .5rem; font-size: .85rem; }
.theme-choice button.active { background: var(--b-green-bg); color: var(--b-green); border-color: var(--success-border);
                              font-weight: 600; }
