:root {
    --bg: #f5f7fa; --surface: #ffffff; --ink: #172b4d; --muted: #5e6c84; --line: #dfe3ea;
    --accent: #176b87; --accent-ink: #ffffff; --ok: #1f7a4d; --bad: #b3261e; --busy: #8a5a00; --warn-bg: #fff4e0;
}
@media (prefers-color-scheme: dark) {
    :root { --bg: #11161d; --surface: #1a212b; --ink: #e6edf5; --muted: #9aa8b8; --line: #2c3644;
            --accent: #4fb3d1; --accent-ink: #0b1218; --ok: #5fcf95; --bad: #ff8a80; --busy: #f3c164; --warn-bg: #2d2416; }
}
* { box-sizing: border-box; }
body { margin: 0; font: 15px/1.5 "Segoe UI", system-ui, sans-serif; background: var(--bg); color: var(--ink); }
a { color: var(--accent); }
.top { display: flex; align-items: center; gap: 24px; padding: 12px 24px; background: var(--surface); border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.brand { font-weight: 700; text-decoration: none; color: var(--ink); }
.brand span { color: var(--muted); font-weight: 400; }
.brand { display: inline-flex; align-items: center; gap: 10px; }
.brand picture, .brand .logo { display: block; height: 27px; width: auto; }
.top nav { display: flex; gap: 16px; flex: 1; }
.top nav a { text-decoration: none; }
.logout { display: flex; gap: 8px; align-items: center; color: var(--muted); margin: 0; }
main { max-width: 1080px; margin: 0 auto; padding: 24px 16px 48px; }
footer { text-align: center; color: var(--muted); font-size: 12px; padding: 16px; }
h1 { font-size: 24px; margin: 0 0 4px; }
h2 { font-size: 18px; margin: 28px 0 10px; }
.sub { color: var(--muted); margin: 0 0 20px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 20px; margin-bottom: 16px; }
.narrow { max-width: 440px; margin: 40px auto; }
.link-card { display: block; text-decoration: none; color: inherit; }
.link-card:hover { border-color: var(--accent); }
.link-card h2 { margin-top: 0; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 16px; }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: 4px 16px; margin: 0; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; overflow-wrap: anywhere; }
table { width: 100%; border-collapse: collapse; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
th, td { text-align: left; padding: 9px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { color: var(--muted); font-weight: 600; font-size: 13px; }
tr:last-child td { border-bottom: 0; }
.table-wrap { overflow-x: auto; }
.pill { display: inline-block; padding: 1px 10px; border-radius: 999px; font-size: 13px; font-weight: 600; border: 1px solid currentColor; }
.ok { color: var(--ok); } .bad { color: var(--bad); } .busy { color: var(--busy); } .muted { color: var(--muted); }
label { display: block; font-weight: 600; margin: 14px 0 4px; }
.hint { color: var(--muted); font-size: 13px; font-weight: 400; margin: 2px 0 0; }
input[type=text], input[type=email], input[type=password], select {
    width: 100%; padding: 9px 11px; border: 1px solid var(--line); border-radius: 8px; background: var(--bg); color: var(--ink); font: inherit; }
input.code { letter-spacing: 4px; font-size: 20px; max-width: 180px; }
.check { display: flex; gap: 8px; align-items: flex-start; font-weight: 400; }
button, .button { display: inline-block; padding: 9px 18px; border: 0; border-radius: 8px; background: var(--accent); color: var(--accent-ink); font: inherit; font-weight: 600; cursor: pointer; text-decoration: none; }
button.secondary, .button.secondary { background: transparent; color: var(--accent); border: 1px solid var(--accent); }
button.danger { background: var(--bad); color: #fff; }
button.link { background: none; color: var(--accent); padding: 0; font-weight: 400; }
.actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 18px; align-items: center; }
.error { background: var(--warn-bg); border-left: 4px solid var(--bad); padding: 10px 14px; border-radius: 6px; }
.notice { background: var(--warn-bg); border-left: 4px solid var(--accent); padding: 10px 14px; border-radius: 6px; }
.secret { font-family: Consolas, monospace; font-size: 18px; letter-spacing: 2px; overflow-wrap: anywhere; background: var(--bg); padding: 10px; border-radius: 8px; }
progress { width: 100%; height: 10px; }
code { overflow-wrap: anywhere; }
/* Manager panel (/gestor) */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; margin-bottom: 8px; }
.kpis .card { margin-bottom: 0; }
.kpis .sub { margin: 0; }
.big { font-size: 28px; font-weight: 700; margin: 2px 0; }
.attention { border-color: var(--bad); }
.filters { display: flex; flex-direction: column; gap: 10px; }
.inline { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin: 0; }
.inline input[type=text] { flex: 1 1 240px; width: auto; }
.inline-label { margin: 0; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { padding: 4px 14px; border: 1px solid var(--line); border-radius: 999px; text-decoration: none; color: var(--ink); }
.chip.on { background: var(--ink); color: var(--surface); border-color: var(--ink); font-weight: 600; }
.error ul { margin: 6px 0 0; padding-left: 20px; }
.checks { list-style: none; margin: 8px 0 0; padding: 0; }
.checks li { margin: 2px 0; }
fieldset.modes { border: 0; padding: 0; margin: 14px 0 0; }
fieldset.modes legend { font-weight: 600; margin-bottom: 4px; }
input[readonly] { color: var(--muted); }
.title-row { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; flex-wrap: wrap; }
.once { border: 2px solid var(--accent); }
.row-action { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin: 0; }
.row-action .check { margin: 0; }
button.small, select.small { padding: 5px 12px; font-size: 13px; width: auto; }
.form-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 0 16px; }
.filter-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 0 16px; align-items: end; }
.filter-grid label { margin-top: 0; }
.filter-actions { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; padding-top: 8px; }
.filter-actions .check { margin: 0; }

/* ---- Client home (Início) ---- */
:root { --ok-bg: #e3f3ea; --busy-bg: #e8f1f5; --busy-ink: #0f4f65; --warn-ink: #7c2d12; --warn-soft: #fff7ed; --warn-line: #f5d6b3; --warn-strong: #c2410c;
        --track: #e6eaf0; --none-line: #cdd3dc; --help-bg: #14213d; --help-ink: #c9d4ea; }
@media (prefers-color-scheme: dark) {
    :root { --ok-bg: #173327; --busy-bg: #15303b; --busy-ink: #8fd3ea; --warn-ink: #fbcf9f; --warn-soft: #2b1f14; --warn-line: #5a3b1d; --warn-strong: #f08a4b;
            --track: #2c3644; --none-line: #3a4656; --help-bg: #0d1626; --help-ink: #b5c3dc; }
}
.top nav a[aria-current="page"] { font-weight: 600; text-decoration: underline; text-underline-offset: 6px; }
.home-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 20px; }
.home-head h1 { font-size: 28px; }
.eyebrow { margin: 0 0 2px; color: var(--muted); font-size: 14px; }
.no-margin { margin: 0; }
.home-actions { margin: 0; }
button.with-icon, .button.with-icon { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 18px; border-radius: 10px; }
.button.secondary { display: inline-flex; align-items: center; min-height: 44px; padding: 0 16px; border-radius: 10px; }
.banner { display: flex; flex-wrap: wrap; align-items: center; gap: 16px; padding: 16px 20px; border-radius: 14px; margin-bottom: 20px; border: 1px solid var(--line); background: var(--surface); }
.banner .grow { flex: 1 1 360px; min-width: 0; }
.banner-title { margin: 0; font-weight: 600; }
.banner-text { margin: 2px 0 0; font-size: 14px; }
.banner-icon { width: 44px; height: 44px; border-radius: 12px; display: flex; align-items: center; justify-content: center; flex: 0 0 auto; }
.banner.warn { background: var(--warn-soft); border-color: var(--warn-line); color: var(--warn-ink); }
.banner.warn .banner-icon { background: var(--warn-line); color: var(--warn-ink); }
.banner.warn .button.secondary { color: var(--warn-ink); border-color: var(--warn-line); background: var(--surface); }
.banner.good .banner-icon { background: var(--ok-bg); color: var(--ok); }
.banner.good .banner-text, .banner.calm .banner-text { color: var(--muted); }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 16px; margin-bottom: 20px; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 16px 18px; display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.stat-label, .stat-hint { font-size: 13px; color: var(--muted); }
.stat-value { font-size: 26px; font-weight: 700; line-height: 1.2; }
.stat-value small { font-size: 16px; font-weight: 500; color: var(--muted); }
svg.meter { display: block; }
svg.meter .track { fill: var(--track); }
svg.meter .fill { fill: var(--accent); }
svg.meter.high .fill { fill: var(--warn-strong); }
.home-grid { display: flex; flex-wrap: wrap; gap: 20px; align-items: flex-start; }
.home-grid > .card { flex: 999 1 560px; min-width: 0; margin: 0; }
.home-side { flex: 1 1 300px; min-width: 0; display: flex; flex-direction: column; gap: 16px; }
.home-side .card { margin: 0; }
.card.flush { padding: 0; overflow: hidden; }
.card-title { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; padding: 18px 20px 8px; }
.card-title.tight { padding: 0 0 10px; }
.card-title h2 { margin: 0; font-size: 18px; }
table.devices { border: 0; border-radius: 0; }
table.devices th { text-transform: uppercase; letter-spacing: .04em; font-size: 12px; padding: 10px 12px; }
table.devices td { padding: 12px; vertical-align: middle; }
table.devices th:first-child, table.devices td:first-child { padding-left: 20px; }
table.devices th:last-child, table.devices td:last-child { padding-right: 20px; }
th.num, td.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.device-name { font-weight: 600; color: var(--ink); text-decoration: none; }
.device-name:hover { text-decoration: underline; }
.block { display: block; }
.state { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px; font-size: 13px; font-weight: 600; white-space: nowrap; }
.state svg circle { fill: currentColor; }
.state.ok { background: var(--ok-bg); color: var(--ok); }
.state.busy { background: var(--busy-bg); color: var(--busy-ink); }
.state.warn { background: var(--warn-soft); color: var(--warn-ink); border: 1px solid var(--warn-line); }
svg.days { display: block; }
svg .ok, .legend svg .ok { fill: var(--ok); }
svg .bad, .legend svg .bad { fill: var(--warn-strong); }
svg.days .none { fill: var(--track); stroke: var(--none-line); stroke-width: 1; }
.legend { display: flex; flex-wrap: wrap; gap: 16px; padding: 12px 20px 16px; font-size: 12px; color: var(--muted); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.small-link { font-size: 13px; }
ol.activity { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 14px; font-size: 14px; line-height: 1.4; }
ol.activity li { display: grid; grid-template-columns: 32px minmax(0, 1fr); gap: 10px; align-items: start; }
.dot-icon { width: 32px; height: 32px; border-radius: 9px; display: flex; align-items: center; justify-content: center; background: var(--bg); color: var(--muted); }
.dot-icon.ok { background: var(--ok-bg); color: var(--ok); }
.dot-icon.bad { background: var(--warn-soft); color: var(--warn-ink); }
.dot-icon.info { background: var(--busy-bg); color: var(--busy-ink); }
.card.help { background: var(--help-bg); border-color: var(--help-bg); color: #fff; }
.card.help h2 { margin: 0 0 8px; font-size: 17px; }
.card.help p { margin: 0 0 14px; color: var(--help-ink); font-size: 14px; line-height: 1.5; }
.card.help .help-hint { margin: 0; }
.button.light { display: inline-flex; align-items: center; min-height: 44px; padding: 0 16px; border-radius: 10px; background: #fff; color: #14213d; }
@media (max-width: 600px) {
    .home-head form, .home-head button { width: 100%; justify-content: center; }
    .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
    .stat { padding: 14px; }
    .stat-value { font-size: 20px; }
    .stat-value small { font-size: 14px; }
}

/* ---- Client computer page ---- */
:root { --cal-one: #cdebda; --cal-one-ink: #14532d; --cal-many: #1f7a4d; --cal-failed: #fde2cc; --cal-failed-ink: #7c2d12; }
@media (prefers-color-scheme: dark) { :root { --cal-one: #1f4a35; --cal-one-ink: #c9f0d9; --cal-many: #3fae75; --cal-failed: #4a2b17; --cal-failed-ink: #fbcf9f; } }
.crumb { margin: 0 0 12px; font-size: 14px; }
.device-head { display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 18px; }
.device-id { display: flex; gap: 16px; align-items: center; min-width: 0; }
.device-icon { width: 56px; height: 56px; border-radius: 14px; background: var(--busy-bg); color: var(--busy-ink); display: flex; align-items: center; justify-content: center; flex: 0 0 auto; }
.device-id h1 { font-size: 26px; overflow-wrap: anywhere; }
.device-meta { margin: 4px 0 0; display: flex; flex-wrap: wrap; gap: 6px 8px; align-items: center; color: var(--muted); font-size: 14px; }
.device-actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.inline-form { margin: 0; }
details.more { position: relative; }
details.more > summary { list-style: none; cursor: pointer; width: 44px; padding: 0; justify-content: center; }
details.more > summary::-webkit-details-marker { display: none; }
details.more .menu { position: absolute; right: 0; top: 50px; z-index: 5; min-width: 230px; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 6px; display: flex; flex-direction: column; box-shadow: 0 8px 24px rgba(0,0,0,.12); }
details.more .menu a { padding: 10px 12px; border-radius: 8px; text-decoration: none; color: var(--ink); }
details.more .menu a:hover { background: var(--bg); }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 20px; overflow-x: auto; }
.tabs a { padding: 12px 16px; font-size: 14px; color: var(--muted); text-decoration: none; white-space: nowrap; border-bottom: 2px solid transparent; }
.tabs a[aria-current="page"] { color: var(--ink); font-weight: 600; border-bottom-color: var(--accent); }
.main-col { flex: 999 1 560px; min-width: 0; display: flex; flex-direction: column; gap: 20px; }
.main-col .card { margin: 0; }
.card.summary { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 16px; }
.card.summary > div { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.card.summary strong { font-size: 18px; }
.month-nav { display: inline-flex; align-items: center; gap: 6px; font-size: 14px; }
.month-nav a, .month-nav .disabled { display: inline-flex; align-items: center; justify-content: center; width: 36px; height: 36px; border-radius: 8px; border: 1px solid var(--line); text-decoration: none; font-size: 18px; }
.month-nav .disabled { color: var(--line); }
.month-nav strong { min-width: 140px; text-align: center; }
.no-top { margin-top: 0; }
.no-bottom { margin-bottom: 0; }
.calendar { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 6px; margin-bottom: 12px; }
.weekday { font-size: 12px; color: var(--muted); text-align: center; padding-bottom: 2px; }
.day { display: flex; align-items: center; justify-content: center; height: 40px; border-radius: 8px; font-size: 13px; text-decoration: none; color: var(--muted); }
.day.none { background: var(--bg); border: 1px solid var(--line); }
.day.one { background: var(--cal-one); color: var(--cal-one-ink); font-weight: 600; }
.day.many { background: var(--cal-many); color: #fff; font-weight: 600; }
.day.failed { background: var(--cal-failed); color: var(--cal-failed-ink); font-weight: 600; }
.day.out { opacity: .35; }
a.day:hover { outline: 2px solid var(--accent); outline-offset: 1px; }
.cal-key .one { fill: var(--cal-one); } .cal-key .many { fill: var(--cal-many); } .cal-key .failed { fill: var(--cal-failed); }
.cal-key .none { fill: var(--bg); stroke: var(--line); }
.legend.no-pad { padding: 0; }
.pad-text { padding: 0 20px 20px; margin: 0; }
ul.job-list { list-style: none; margin: 0; padding: 0; }
ul.job-list li { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; padding: 12px 20px; border-top: 1px solid var(--line); font-size: 14px; }
ul.job-list .grow { flex: 1 1 220px; min-width: 0; }
.nowrap { white-space: nowrap; }
.state.neutral { background: var(--bg); color: var(--muted); }
.side-title { margin: 0 0 12px; font-size: 17px; }
ul.folders { list-style: none; margin: 0 0 12px; padding: 0; display: flex; flex-direction: column; gap: 10px; font-size: 14px; }
ul.folders li { display: grid; grid-template-columns: 20px minmax(0, 1fr); gap: 10px; align-items: start; overflow-wrap: anywhere; }
ul.folders svg { color: var(--accent); margin-top: 1px; }
@media (max-width: 600px) {
    .device-actions { width: 100%; }
    .device-actions > a, .device-actions > form { flex: 1 1 auto; }
    .device-actions button { width: 100%; justify-content: center; }
    .day { height: 36px; }
}
.card-title { flex-wrap: wrap; }
@media (max-width: 600px) { .device-actions > a { justify-content: center; } }

/* ---- Client restore wizard ---- */
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.steps-bar { list-style: none; margin: 0 0 20px; padding: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; }
.steps-bar li { display: flex; align-items: center; gap: 12px; padding: 12px 16px; border-radius: 12px; background: var(--surface); border: 1px solid var(--line); font-size: 14px; }
.steps-bar li.current { border: 2px solid var(--accent); padding: 11px 15px; }
.step-n { width: 30px; height: 30px; border-radius: 50%; display: flex; align-items: center; justify-content: center; flex: 0 0 auto; font-weight: 700; background: var(--bg); color: var(--muted); }
.steps-bar li.current .step-n { background: var(--accent); color: var(--accent-ink); }
.steps-bar li.done .step-n { background: var(--ok); color: #fff; }
.chips .chip { min-height: 40px; display: inline-flex; align-items: center; }
ul.copy-days { list-style: none; margin: 0; padding: 0; }
ul.copy-days li { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 16px; padding: 12px 20px; border-top: 1px solid var(--line); }
.copy-day { min-width: 190px; font-weight: 600; }
.copy-times { display: flex; flex-wrap: wrap; gap: 6px; }
.files-card { flex: 999 1 560px; }
.files-head { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; padding: 16px 20px; border-bottom: 1px solid var(--line); }
.files-head h2 { margin: 0; font-size: 18px; flex: 1 1 260px; }
.search-form { display: flex; gap: 8px; flex: 1 1 300px; margin: 0; }
.search-form input[type=search] { flex: 1 1 auto; padding: 9px 11px; border: 1px solid var(--line); border-radius: 8px; background: var(--bg); color: var(--ink); font: inherit; min-height: 42px; }
.files-bar { display: flex; flex-wrap: wrap; gap: 10px 16px; align-items: center; justify-content: space-between; padding: 10px 20px; font-size: 14px; color: var(--muted); }
.crumbs { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.crumbs strong { color: var(--ink); }
a.toggle { display: inline-flex; align-items: center; gap: 8px; min-height: 40px; padding: 0 12px; border-radius: 8px; border: 1px solid var(--line); color: var(--ink); text-decoration: none; font-size: 13px; }
a.toggle .box { fill: var(--surface); stroke: var(--muted); stroke-width: 1.5; }
a.toggle.on { border-color: var(--accent); }
a.toggle.on .box { fill: var(--accent); stroke: var(--accent); }
a.toggle .tick { fill: none; stroke: #fff; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
table.files .ck-col { width: 44px; padding-right: 0; }
table.files input[type=checkbox] { width: 18px; height: 18px; }
table.files tr.marked td { background: var(--busy-bg); }
.file-name { display: inline-flex; align-items: center; gap: 8px; flex-wrap: wrap; overflow-wrap: anywhere; }
.ico-dir { color: var(--accent); flex: 0 0 auto; } .ico-file { color: var(--muted); flex: 0 0 auto; }
.badge { padding: 1px 8px; border-radius: 999px; background: var(--warn-soft); color: var(--warn-ink); font-size: 12px; font-weight: 600; }
.files-foot { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; justify-content: space-between; padding: 12px 20px 16px; border-top: 1px solid var(--line); }
.pad-block { padding: 20px; }
ul.picked { list-style: none; margin: 0 0 12px; padding: 0; display: flex; flex-direction: column; gap: 8px; font-size: 14px; }
ul.picked li { display: flex; justify-content: space-between; gap: 8px; align-items: flex-start; overflow-wrap: anywhere; }
ul.picked form { margin: 0; }
ul.picked.compact { margin-top: 12px; }
button.icon-btn { background: transparent; color: var(--muted); min-width: 36px; min-height: 36px; padding: 0; border-radius: 8px; }
button.icon-btn:hover { background: var(--bg); color: var(--ink); }
.picked-total { margin: 0 0 12px; padding-top: 12px; border-top: 1px solid var(--line); }
button.full, .button.full { width: 100%; justify-content: center; }
.restore-form { flex: 999 1 560px; min-width: 0; margin: 0; }
.restore-form label:first-of-type { margin-top: 0; }
.revoked-list { margin-top: 20px; }
