/* A device's policy and its overrides. Uses the variables and components of style.css. */

/* ---- The Policy section of a device's page ---- */
.ovr { display: grid; gap: 16px; min-width: 0; container-type: inline-size; }
.ovr-groups { display: grid; gap: 16px; min-width: 0; }
.ovr-said { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.ovr-head .empty b { color: var(--text); font-size: 15px; }
.ovr-head .empty > span { max-width: 62ch; }
.ovr-head .empty .buttonlink .icon, .ovr-head .empty button .icon { width: 15px; height: 15px; }
.ovr-head .card-body { display: grid; gap: 14px; }
.ovr-intro { display: flex; gap: 14px; align-items: flex-start; }
.ovr-intro b { display: block; font-size: 15px; font-weight: 650; overflow-wrap: anywhere; }
.ovr-intro p { color: var(--muted); max-width: 84ch; margin-top: 2px; }
.ovr-summary { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; min-height: 48px; padding: 7px 8px 7px 14px; border-radius: 10px; background: var(--accent-soft); }
.ovr-summary > .icon { color: var(--accent); }
.ovr-summary > span { flex: 1; min-width: 180px; font-weight: 600; }
.ovr-summary.none { background: var(--panel-2); color: var(--muted); }
.ovr-summary.none > .icon { color: var(--ok); }
.ovr-summary.none > span { font-weight: 400; }
.ovr-summary button { padding: 6px 12px; background: var(--panel); }
.ovr-summary button:hover { background: var(--raised); }
.ovr-locked { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); }

/* One setting to a row: its name, what the policy says, what applies here, and the buttons. The line under them
   is there in both states, so a row keeps its height when it changes between following and overridden. */
.ovr-cols, .ovr-main { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr) minmax(0, 1fr) 178px; column-gap: 16px; align-items: center; }
.ovr.readonly .ovr-cols, .ovr.readonly .ovr-main { grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr) minmax(0, 1fr); }
.ovr-cols { padding: 8px 18px 8px 21px; border-bottom: 1px solid var(--line); font-size: 11.5px; font-weight: 650; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.ovr-row { border-bottom: 1px solid var(--line); border-left: 3px solid transparent; transition: background .15s, border-color .15s; }
.ovr-row:last-child { border-bottom: 0; border-radius: 0 0 calc(var(--radius) - 1px) calc(var(--radius) - 1px); }
.ovr-row.on { border-left-color: var(--accent); background: color-mix(in srgb, var(--accent) 7%, transparent); }
.ovr-main { grid-template-areas: "label policy device acts" "meta meta meta acts"; row-gap: 2px; padding: 9px 18px; }
.ovr.readonly .ovr-main { grid-template-areas: "label policy device" "meta meta meta"; }
.ovr-label { grid-area: label; font-weight: 600; overflow-wrap: anywhere; }
.ovr-val { overflow-wrap: anywhere; }
.ovr-val:not(.device) { grid-area: policy; }
.ovr-val.device { grid-area: device; color: var(--muted); }
.ovr-row.on .ovr-val:not(.device) { color: var(--muted); }
.ovr-row.on .ovr-val.device { color: var(--text); font-weight: 650; }
.ovr-cap { display: none; font-size: 11.5px; font-weight: 650; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.ovr-meta { grid-area: meta; display: flex; align-items: center; gap: 8px; min-height: 22px; font-size: 12.5px; color: var(--muted); min-width: 0; }
.ovr-meta b { font-weight: 600; color: var(--text); }
.ovr-meta.bad { color: var(--bad); }
.ovr-meta .pill { flex: none; }
.ovr-acts { grid-area: acts; display: flex; justify-content: flex-end; gap: 6px; }
.ovr-acts button { padding: 5px 11px; }
.ovr-acts button[data-act="remove"] { background: none; border-color: transparent; color: var(--muted); }
.ovr-acts button[data-act="remove"]:hover { background: var(--raised); color: var(--text); }
.ovr-acts button[aria-expanded="true"] { border-color: var(--accent); background: var(--accent-soft); }
.ovr [aria-disabled="true"] { opacity: .55; cursor: default; }

/* The editor opens under its row. */
.ovr-editor { display: grid; gap: 14px; margin: 2px 18px 14px; padding: 14px 16px; border: 1px solid var(--line-strong); border-radius: 12px; background: var(--panel); }
.ovr-field { display: grid; grid-template-columns: 120px minmax(0, 1fr); gap: 6px 16px; align-items: start; }
.ovr-field.stacked { grid-template-columns: 1fr; }
.ovr-flabel { font-size: 13px; font-weight: 600; padding-top: 6px; }
.ovr-field.stacked .ovr-flabel { padding-top: 0; }
.ovr-field label.switch { min-height: 34px; width: max-content; }
.ovr-options { display: grid; gap: 6px; max-width: 440px; }
.ovr-option { display: flex; align-items: center; gap: 10px; padding: 8px 12px; border: 1px solid var(--line-strong); border-radius: 9px; background: var(--panel-2); font-size: 14px; font-weight: 400; cursor: pointer; }
.ovr-option:hover { border-color: var(--accent); }
.ovr-option:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.ovr-option input { width: 16px; height: 16px; margin: 0; padding: 0; flex: none; accent-color: var(--accent); }
.ovr-option .grow { flex: 1; min-width: 0; }
.ovr-tag { font-size: 12px; color: var(--muted); white-space: nowrap; }
.ovr-number { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.ovr-number input { width: 110px; }
.ovr-hinttext { margin-top: 8px; font-size: 12.5px; color: var(--muted); max-width: 70ch; }
.ovr-times { display: flex; flex-wrap: wrap; gap: 6px; }
.ovr-time { position: relative; display: inline-flex; align-items: center; padding: 6px 13px; border: 1px solid var(--line-strong); border-radius: 999px; background: var(--panel-2); font-size: 13px; font-weight: 400; cursor: pointer; white-space: nowrap; }
.ovr-time:hover { border-color: var(--accent); }
.ovr-time input { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; padding: 0; opacity: 0; cursor: pointer; }
.ovr-time:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); font-weight: 600; }
.ovr-time:has(input:focus-visible) { box-shadow: 0 0 0 3px var(--accent-soft); border-color: var(--accent); }
.ovr-say { margin-top: 8px; min-height: 20px; font-size: 13px; color: var(--muted); }
.ovr-say.bad { color: var(--bad); }
.ovr-editor .actions { margin-top: 0; }

/* A narrow section (a small window, or a laptop with the section list beside it): each row stacks. */
@container (max-width: 720px) {
  .ovr-cols { display: none; }
  .ovr-main, .ovr.readonly .ovr-main { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); grid-template-areas: "label label" "policy device" "meta meta" "acts acts"; row-gap: 7px; }
  .ovr.readonly .ovr-main { grid-template-areas: "label label" "policy device" "meta meta"; }
  .ovr-cap { display: block; }
  .ovr-meta { align-items: flex-start; flex-wrap: wrap; }
  .ovr-acts { justify-content: flex-start; }
  .ovr-editor { margin: 2px 12px 12px; padding: 12px; }
  .ovr-field { grid-template-columns: 1fr; }
  .ovr-flabel { padding-top: 0; }
  .ovr-intro .avatar { display: none; }
}

/* ---- The dialogs: "Remove all overrides" and "Connect without asking" ---- */
#ovr-dialog .ovr-list { margin: 10px 0 0; padding-left: 20px; display: grid; gap: 4px; }
#ovr-dialog .ovr-list b { font-weight: 600; }
#ovr-dialog .ovr-list + p { margin-top: 12px; }
#ovr-dialog form > p { margin-top: 0; }
#ovr-dialog .actions { margin-top: 4px; }

/* ---- Remote control: the strip that says whether the person at the computer is asked first ---- */
.ovr-remote { display: flex; align-items: center; gap: 9px; flex-wrap: wrap; padding: 8px 16px; border-bottom: 1px solid var(--line); font-size: 13px; color: var(--muted); }
.ovr-remote .grow { flex: 1; min-width: 200px; }
.ovr-remote.without { background: var(--warn-soft); color: var(--text); }
.ovr-remote.without > .icon { color: var(--warn); }
.ovr-remote [aria-disabled="true"] { opacity: .55; cursor: default; }
.ovr-launch > div { display: grid; gap: 8px; justify-items: start; }
