/* Colours, sizes and radii come from tokens.css, built by design/build.py from design/tokens/. */

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: var(--fs-base)/1.5 var(--font-sans);
}

a { color: var(--accent); text-underline-offset: 2px; }
a:hover { color: var(--accent-hover); }

h1 { font-size: 26px; line-height: 1.2; margin: 0; letter-spacing: -0.01em; }
h2 { font-size: 17px; margin: 28px 0 12px; }
.card h2:first-child { margin-top: 0; }

:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.sr {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip-path: inset(50%); white-space: nowrap;
}
.muted { color: var(--text-muted); }
.mono { font-family: var(--font-mono); font-size: var(--fs-sm); font-variant-numeric: tabular-nums; }
/* Icon from the sprite: <svg class="i" aria-hidden="true"><use href="/static/icones.svg#senha"/></svg> */
.i { width: 1.15em; height: 1.15em; vertical-align: -0.2em; flex: none; }

/* Top bar */
.top { border-bottom: 1px solid var(--border); background: var(--bg); }
.top-in {
  max-width: 1200px; margin: 0 auto; padding: 0 24px; min-height: 60px;
  display: flex; align-items: center; gap: 28px; flex-wrap: wrap;
}
.brand { display: flex; }
.brand img { display: block; }
.top nav { display: flex; gap: 4px; flex: 1; align-self: stretch; }
.top nav a {
  display: flex; align-items: center; padding: 0 14px;
  color: var(--text-muted); text-decoration: none; font-weight: 600;
  border-bottom: 3px solid transparent; margin-bottom: -1px;
}
.top nav a:hover { color: var(--text); }
.top nav a[aria-current="page"] { color: var(--accent); border-bottom-color: var(--accent); }
.who { display: flex; align-items: center; gap: 12px; margin: 0; color: var(--text-muted); }

/* Layout */
.page { max-width: 1200px; margin: 0 auto; padding: 28px 24px 64px; }
.center { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.head { display: flex; align-items: baseline; gap: 16px; flex-wrap: wrap; margin-bottom: 20px; }
.sub { margin: 0; color: var(--text-muted); }
.sub strong { color: var(--text); }
.crumb { margin: 0 0 8px; font-size: 14px; }
.cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 20px; }

.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-md); padding: 20px;
}
.sep { border-top: 1px solid var(--border); padding-top: 20px; }

/* Forms */
label { font-weight: 600; font-size: 14px; }
input, select, textarea {
  font: inherit; color: var(--text); background: var(--bg);
  border: 1px solid var(--border-input); border-radius: var(--radius-sm);
  padding: 8px 10px; min-height: 38px;
}
textarea { resize: vertical; }
.stack { display: grid; gap: 8px; margin: 0; }
.stack p { margin: 0; }
.stack .btn { justify-self: start; margin-top: 6px; }
.check { display: flex; align-items: center; gap: 6px; font-weight: 400; }
.check input { min-height: 0; width: 16px; height: 16px; accent-color: var(--accent); }

.btn {
  display: inline-flex; align-items: center; justify-content: center;
  font: inherit; font-weight: 600; cursor: pointer; text-decoration: none;
  min-height: 38px; padding: 0 16px; border-radius: var(--radius-sm);
  color: var(--text); background: var(--bg); border: 1px solid var(--border-input);
}
.btn:hover { color: var(--text); border-color: var(--text); }
.btn.primary { color: var(--on-accent); background: var(--accent); border-color: var(--accent); }
.btn.primary:hover { color: var(--on-accent); background: var(--accent-hover); border-color: var(--accent-hover); }
.btn.quiet { border-color: var(--border); min-height: 32px; padding: 0 12px; }

.filters { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin: 0 0 16px; }
.filters input[type="search"] { flex: 1 1 240px; max-width: 360px; }

/* Login */
.login { width: min(380px, 100%); display: grid; gap: 8px; padding: 28px; }
.login h1 { font-size: 20px; margin: 12px 0 8px; }
.login .btn { margin-top: 12px; }
.alert {
  margin: 0 0 4px; padding: 10px 12px; border-radius: var(--radius-sm);
  color: var(--danger); border: 1px solid currentColor; background: var(--bg);
}
.notice {
  margin: 0 0 16px; padding: 10px 12px; border-radius: var(--radius-sm);
  border: 1px solid var(--accent); color: var(--text); background: var(--surface);
}

/* Tables */
.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius-md); }
/* Narrow screens scroll the table sideways instead of squeezing its columns. */
table { width: 100%; min-width: 760px; border-collapse: collapse; }
th, td { text-align: left; padding: 11px 14px; vertical-align: top; }
th {
  font-size: 12.5px; text-transform: uppercase; letter-spacing: 0.04em;
  color: var(--text-muted); background: var(--surface); white-space: nowrap;
}
td { border-top: 1px solid var(--border); }
td .muted { display: block; font-size: 13px; }
td a { font-weight: 600; }

.dot {
  display: inline-block; width: 9px; height: 9px; border-radius: 50%;
  margin-right: 8px; vertical-align: 1px;
}
.dot.on { background: var(--accent); }
.dot.off { background: transparent; box-shadow: inset 0 0 0 2px var(--border-input); }

.tag {
  display: inline-block; font-size: 12.5px; font-weight: 600; padding: 1px 8px;
  border-radius: 999px; border: 1px solid var(--border-input); color: var(--text-muted);
  white-space: nowrap;
}
.tag.live { color: var(--accent); border-color: var(--accent); }
.tag.warn { color: var(--warning); border-color: var(--warning); }

dl { display: grid; grid-template-columns: max-content 1fr; gap: 8px 20px; margin: 0; }
dt { color: var(--text-muted); }
dd { margin: 0; overflow-wrap: anywhere; }

.empty {
  padding: 36px 24px; text-align: center; color: var(--text-muted);
  border: 1px dashed var(--border-input); border-radius: var(--radius-md);
}
.empty h2 { margin: 0 0 6px; color: var(--text); }
.empty p { margin: 0 auto; max-width: 520px; }

.pager { display: flex; align-items: center; gap: 12px; margin-top: 16px; }

/* Overview */
.seg { display: inline-flex; border: 1px solid var(--border-input); border-radius: var(--radius-sm); overflow: hidden; margin-left: auto; }
.seg a { padding: 6px 14px; color: var(--text-muted); text-decoration: none; font-weight: 600; font-size: 14px; }
.seg a + a { border-left: 1px solid var(--border-input); }
.seg a:hover { color: var(--text); }
.seg a[aria-current] { background: var(--accent); color: var(--on-accent); }

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 14px; margin-bottom: 20px; }
.stat { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-md); padding: 16px 18px; }
.stat p { margin: 0; }
.stat-label { font-size: 13px; font-weight: 600; color: var(--text-muted); }
.stat-value { font-size: 26px; font-weight: 700; line-height: 1.25; margin: 4px 0 2px !important; font-variant-numeric: tabular-nums; white-space: nowrap; }
.stat-note { font-size: 13px; color: var(--text-muted); }
.stat.warn { border-color: var(--warning); }
.stat.warn .stat-label { color: var(--warning); }

.card-head { display: flex; align-items: baseline; gap: 6px 16px; flex-wrap: wrap; margin-bottom: 18px; }
.card-head h2, .card-head p { margin: 0; }
.card-head p { font-size: 14px; }

.chart { position: relative; padding: 14px 0 0 30px; }
.chart-max { position: absolute; top: 4px; left: 0; font-size: 12px; color: var(--text-muted); font-variant-numeric: tabular-nums; }
.chart-plot { display: block; width: 100%; height: 180px; overflow: visible; }
.chart-plot .bar { fill: var(--accent); }
.chart-plot .grid { stroke: var(--border); stroke-width: 1; vector-effect: non-scaling-stroke; }
.chart-plot .axis { stroke: var(--border-input); stroke-width: 1; vector-effect: non-scaling-stroke; }
.chart-days {
  position: absolute; top: 14px; left: 30px; right: 0; height: 206px;
  display: grid; margin: 0; padding: 0; list-style: none;
}
.chart-days.days-7 { grid-template-columns: repeat(7, 1fr); }
.chart-days.days-30 { grid-template-columns: repeat(30, 1fr); }
.chart-days li { position: relative; display: flex; align-items: flex-end; justify-content: center; border-radius: var(--radius-sm); outline-offset: -2px; }
.chart-days li:hover, .chart-days li:focus-visible { background: color-mix(in srgb, var(--accent) 9%, transparent); }
.chart-days .x { font-size: 12px; color: var(--text-muted); white-space: nowrap; height: 22px; line-height: 22px; }
.chart-days .x.quiet { visibility: hidden; }
.chart-days li:last-child .x { align-self: flex-end; margin-left: auto; }
.chart-days li:last-child { justify-content: flex-end; }
.chart-days .tip {
  display: none; position: absolute; bottom: 100%; left: 50%; transform: translate(-50%, -6px); z-index: 2;
  background: var(--text); color: var(--bg); border-radius: var(--radius-sm);
  padding: 6px 10px; font-size: 13px; white-space: nowrap; pointer-events: none;
}
.chart-days .tip strong { display: block; }
.chart-days li:hover .tip, .chart-days li:focus-visible .tip { display: block; }
.chart-days li:first-child .tip { left: 0; transform: translate(0, -6px); }
.chart-days li:last-child .tip { left: auto; right: 0; transform: translate(0, -6px); }
.chart + .as-table { margin-top: 44px; }
.as-table summary { cursor: pointer; color: var(--accent); font-weight: 600; font-size: 14px; }
.as-table .table-wrap { margin-top: 10px; }

table.compact { min-width: 0; }
table.compact th, table.compact td { padding: 8px 10px; }
table.rank th { background: transparent; }
table.rank th:first-child, table.rank td:first-child { padding-left: 0; }
table.rank th:last-child, table.rank td:last-child { padding-right: 0; }
table.rank td:not(:first-child), table.rank th:not(:first-child) { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.page > h2 { margin-top: 28px; }
.page > .card + h2, .page > .cols { margin-top: 24px; }

/* Service records */
[hidden] { display: none !important; }
.push { margin-left: auto; }
.sub-head { margin: 28px 0 12px; align-items: center; }
.sub-head h2 { margin: 0; }
.badge {
  display: inline-block; min-width: 20px; padding: 0 6px; margin-left: 6px; border-radius: 999px;
  background: var(--danger); color: var(--bg); font-size: 12px; line-height: 20px; text-align: center;
}
.tag.st-open { color: var(--accent); border-color: var(--accent); }
.tag.st-waiting { color: var(--warning); border-color: var(--warning); }
.tag.st-resolved { color: var(--text-muted); }
a.tag { text-decoration: none; }
.tag.late { color: var(--danger); border-color: var(--danger); }
.tag.remind { color: var(--warning); border-color: var(--warning); }
td.clip { max-width: 420px; overflow-wrap: anywhere; }
.alert p { margin: 0; }
.alert { margin-bottom: 16px; }
.ticket-cols { grid-template-columns: minmax(0, 2fr) minmax(260px, 1fr); align-items: start; }
.ticket-form textarea { width: 100%; }
.ticket-form label:not(.check) { margin-top: 8px; }
.choice { border: 0; padding: 0; margin: 8px 0 0; display: flex; flex-wrap: wrap; gap: 6px 18px; }
.choice legend { font-weight: 600; font-size: 14px; margin-bottom: 6px; padding: 0; }
.when { border-top: 1px solid var(--border); margin-top: 10px; padding-top: 12px; }
.when > p { margin: 0 0 4px; font-size: 14px; }
.when-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px 20px; }
.when-row p { display: grid; gap: 6px; margin: 0; align-content: start; }
.hint { font-size: 13px; color: var(--text-muted); }
.muted-inline { color: var(--text-muted); }
.attention { border-color: var(--warning); margin-bottom: 20px; }
.attn { list-style: none; margin: 0; padding: 0; }
.attn li { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px 16px; padding: 10px 0; border-top: 1px solid var(--border); }
.attn li:first-child { border-top: 0; padding-top: 0; }
.attn li > div:first-child { display: grid; min-width: 0; }
.attn a { font-weight: 600; }
.attn .muted { font-size: 13px; }
.attn-why { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.attn-why form { margin: 0; }

/* Customers and technicians */
.record { max-width: 820px; }
.record h2 { margin-top: 0; }
.fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 20px; }
.fields p { display: grid; gap: 6px; align-content: start; }
.fields .wide { grid-column: 1 / -1; }
.fields input, .fields textarea { width: 100%; }
form.inline { margin: 0; }
td:has(> form.inline), td:has(> a.plain) { text-align: right; white-space: nowrap; }
a.plain { font-weight: 400; }
.add { margin-top: 16px; }
.add summary { cursor: pointer; color: var(--accent); font-weight: 600; }
.add[open] summary { margin-bottom: 12px; }
.picks {
  list-style: none; margin: 4px 0; padding: 0; max-height: 320px; overflow-y: auto;
  display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 2px 20px;
}
.picks .check { padding: 5px 0; align-items: flex-start; }
.picks .check input { margin-top: 3px; flex: none; }
:target { scroll-margin-top: 16px; }

@media (max-width: 640px) {
  .fields { grid-template-columns: 1fr; }
  .top-in { padding: 8px 16px; gap: 8px 16px; }
  .top nav { order: 3; flex-basis: 100%; }
  .who { margin-left: auto; }
  .top nav { overflow-x: auto; scrollbar-width: none; }
  .top nav a { padding: 10px 12px; white-space: nowrap; }
  .page { padding: 20px 16px 48px; }
  .seg { margin-left: 0; }
  .ticket-cols { grid-template-columns: 1fr; }
  .stats { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .stat { padding: 12px 14px; }
  .stat-value { font-size: 21px; white-space: normal; }
  .card { padding: 16px; }
  .chart-days.days-30 .x { visibility: hidden; }
  .chart-days .wd { display: none; }
  dl { grid-template-columns: 1fr; gap: 2px; }
  dd { margin-bottom: 8px; }
}

/* Technician access */
.record + .record { margin-top: 20px; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; }
.actions form { margin: 0; }
.notice p { margin: 0 0 8px; }
.notice p:last-child { margin: 0; }
.notice input { width: 100%; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.logins { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.logins li { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; }
.logins form { margin: 0; }
.plain { list-style: none; padding: 0; }

/* Design system: icons in buttons, small and danger buttons */
.btn { gap: 8px; }
.btn.sm { min-height: 32px; padding: 0 12px; font-size: 14px; }
.btn.danger { color: var(--danger); border-color: var(--danger); }
.btn.danger:hover { color: var(--bg); background: var(--danger); border-color: var(--danger); }
.btn[aria-disabled="true"] { opacity: .5; cursor: not-allowed; }
.btn[aria-disabled="true"]:hover { color: var(--text); border-color: var(--border-input); }
.nowrap { white-space: nowrap; }

/* Devices: bulk actions and Acessar */
.bulk {
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px; margin: 0 0 12px;
  padding: 10px 12px; border: 1px solid var(--accent); border-radius: var(--radius-md); background: var(--surface);
}
.bulk strong { margin-right: 6px; }
.bulk select { min-height: 32px; padding-top: 0; padding-bottom: 0; }
th.pick, td.pick { width: 1px; padding-right: 0; }
td.pick input, th.pick input { min-height: 0; width: 16px; height: 16px; margin: 3px 0 0; accent-color: var(--accent); }
tr.selected td { background: var(--surface); }
td.row-acts { text-align: right; white-space: nowrap; }
td.row-acts .btn { margin-right: 12px; }

/* Confirmation before an action with no way back */
dialog.confirm {
  width: min(460px, calc(100vw - 32px)); padding: 22px 24px; border: 1px solid var(--border);
  border-radius: var(--radius-md); background: var(--bg); color: var(--text);
  box-shadow: 0 18px 50px rgb(0 0 0 / .25);
}
dialog.confirm::backdrop { background: rgb(0 0 0 / .45); }
dialog.confirm h2 { margin: 0 0 10px; font-size: 18px; }
dialog.confirm p { margin: 0 0 8px; }
dialog.confirm p + p { color: var(--text-muted); font-size: 14px; }
.confirm-acts { display: flex; justify-content: flex-end; flex-wrap: wrap; gap: 8px; margin-top: 18px; }
.confirm-acts .btn.danger { color: var(--bg); background: var(--danger); }

/* Technician invite link, shown once */
.linkbox { display: grid; gap: 10px; margin: 0 0 20px; padding: 16px 18px; border: 1px solid var(--accent); border-radius: var(--radius-md); background: var(--surface); }
.linkbox h2 { display: flex; align-items: center; gap: 8px; margin: 0; font-size: 17px; }
.linkbox h2 .i { color: var(--accent); }
.linkbox p { margin: 0; }
.linkbox .row { display: flex; flex-wrap: wrap; gap: 8px; }
.linkbox .row input { flex: 1 1 320px; min-width: 0; }
.linkbox .warn { display: flex; align-items: flex-start; gap: 8px; font-size: 14px; color: var(--text); }
.linkbox .warn .i { color: var(--warning); margin-top: 3px; }

/* Password created: next steps */
.done-card { width: min(520px, 100%); display: grid; gap: 18px; padding: 28px; }
.done-head { display: grid; justify-items: center; gap: 8px; text-align: center; }
.done-head .big { display: grid; place-items: center; width: 56px; height: 56px; border-radius: 50%; background: var(--bg); border: 1px solid var(--border); color: var(--success); }
.done-head .big .i { width: 28px; height: 28px; }
.done-head h1 { font-size: 22px; margin: 0; }
.done-head p { margin: 0; color: var(--text-muted); }
.steps { list-style: none; counter-reset: step; margin: 0; padding: 0; display: grid; gap: 12px; }
.steps li { counter-increment: step; display: grid; grid-template-columns: 32px 1fr; gap: 12px; padding: 14px; border: 1px solid var(--border); border-radius: var(--radius-md); }
.steps li::before { content: counter(step); display: grid; place-items: center; width: 32px; height: 32px; border-radius: 50%; background: var(--accent); color: var(--on-accent); font-weight: 700; }
.steps p { margin: 4px 0 0; color: var(--text-muted); font-size: 14px; }
.steps .btn { margin-top: 10px; }
.done-card > .btn { justify-self: center; }

/* Customer's answer at the end of a session */
.rating { display: inline-flex; align-items: center; gap: 1px; color: var(--warning); white-space: nowrap; }
.rating .i { width: 15px; height: 15px; }
.rating .i.on { --icon-fill: currentColor; }
.rating .i.off { color: var(--border-input); }
.tag.pending { color: var(--danger); border-color: var(--danger); }
td .answer { display: block; margin-top: 6px; }
.note-quote { display: block; margin-top: 6px; padding-left: 10px; border-left: 3px solid var(--border-input); color: var(--text); font-size: 14px; white-space: pre-line; }

/* Download page */
.dl { max-width: 680px; margin: 0 auto; display: grid; gap: 18px; }
.dl .head { margin-bottom: 0; }
.dl .head picture { flex-basis: 100%; }
.dl h2 { margin: 0; }
.hero-dl { display: grid; gap: 12px; padding: 20px; border-radius: var(--radius-lg); border: 1.5px solid var(--accent); }
.hero-dl h2 { font-size: 20px; margin-bottom: 6px; }
.hero-dl p, .alt-dl p { margin: 0; color: var(--text-muted); }
.dl .file { font-size: 12.5px; color: var(--text-muted); overflow-wrap: anywhere; }
.btn.lg { min-height: 48px; padding: 0 22px; font-size: 16px; }
.alt-dl { display: flex; flex-wrap: wrap; gap: 12px 16px; align-items: center; justify-content: space-between; padding: 16px; border: 1px solid var(--border); border-radius: var(--radius-md); }
.alt-dl > div { display: grid; gap: 6px; flex: 1 1 300px; }
.alt-dl h2 { font-size: 16px; }
details.help, details.older { border: 1px solid var(--border); border-radius: var(--radius-md); padding: 12px 16px; background: var(--surface); }
details.help summary, details.older summary { cursor: pointer; font-weight: 600; display: flex; gap: 8px; align-items: center; }
details.help > p { margin: 10px 0 0; color: var(--text-muted); font-size: 14px; }
.smartscreen { margin-top: 12px; display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr)); gap: 12px; }
.ss { border-radius: var(--radius-sm); overflow: hidden; border: 1px solid var(--border); font-size: 12.5px; }
.ss .ssh { background: #1f5fa8; color: #ffffff; padding: 10px 12px; }
.ss .ssh b { display: block; font-size: 14px; margin-bottom: 4px; }
.ss .ssb { background: var(--bg); padding: 8px 12px; display: flex; gap: 8px; justify-content: flex-end; }
.ss .ssb span { border: 1px solid var(--border-input); padding: 3px 10px; border-radius: 3px; }
.ss .hl { outline: 2.5px solid var(--warning); outline-offset: 2px; border-radius: 3px; }
.ss-steps { margin: 12px 0 0; padding-left: 20px; font-size: 14px; }
details.older ul { margin: 10px 0 0; padding-left: 20px; }
.hint .btn.quiet { min-height: 28px; padding: 0 8px; }
.dl-phone { display: grid; gap: 10px; padding: 18px; border: 1px solid var(--border); border-radius: var(--radius-lg); }
.dl-phone h2 { display: flex; align-items: center; gap: 8px; font-size: 17px; }
.dl-phone p { margin: 0; color: var(--text-muted); }
.dl-phone ol, .dl-steps { margin: 0; padding-left: 20px; display: grid; gap: 4px; }
.dl-phone .row { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 16px; }
.dl-phone .addr { font-size: 14px; }
