:root {
  color-scheme: light;
  --bg: #f5f4f0; --surface: #ffffff; --ink: #1d2021; --mute: #666b6e; --line: #dedbd3;
  --accent: #2f5d62; --accent-ink: #ffffff; --blk: #e1edec; --blk-line: #a9c9c8;
  --ok: #2e7d4f; --ok-bg: #dff0e5; --warn: #9a5b00; --warn-bg: #fbefd2; --bad: #b3261e; --bad-bg: #fbe3e0;
  --lock: #eeece6; --hint: #fff7da;
  --font: 'IBM Plex Sans', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --mono: 'IBM Plex Mono', ui-monospace, 'Cascadia Mono', Consolas, monospace;
}
@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --bg: #15181a; --surface: #1d2124; --ink: #e8e6e1; --mute: #9aa0a3; --line: #33393c;
    --accent: #7fb5ba; --accent-ink: #0f1a1b; --blk: #23393b; --blk-line: #3f6467;
    --ok: #74c493; --ok-bg: #1b3325; --warn: #e0a24a; --warn-bg: #3a2d14; --bad: #f08a82; --bad-bg: #3d1f1c;
    --lock: #22262a; --hint: #2e2a15;
  }
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--ink); font-family: var(--font); font-size: 14px; line-height: 1.45;
  padding-block: 16px 56px; padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); }
.wrap { max-width: 1180px; margin: 0 auto; display: flex; flex-direction: column; gap: 16px; }
h1 { font-size: 20px; margin: 0; letter-spacing: -.01em; }
h2 { font-size: 13px; margin: 0 0 8px; text-transform: uppercase; letter-spacing: .06em; color: var(--mute); font-weight: 600; }
h3 { margin: 0 0 6px; font-size: 16px; }
.sub { color: var(--mute); margin: 4px 0 0; max-width: 70ch; }
.top { display: flex; flex-wrap: wrap; gap: 8px 16px; align-items: center; justify-content: space-between; }
.top .id { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.papel { font-size: 11.5px; padding: 1px 8px; border-radius: 99px; border: 1px solid var(--line); color: var(--mute); }
.papel.adm { color: var(--accent); border-color: var(--accent); }
.tabs { display: flex; gap: 4px; flex-wrap: wrap; border-bottom: 1px solid var(--line); }
.tabs button { border: 0; border-bottom: 2px solid transparent; border-radius: 0; background: transparent; padding: 8px 14px; margin-bottom: -1px; color: var(--mute); }
.tabs button.on { color: var(--ink); border-bottom-color: var(--accent); font-weight: 600; }
.bar { display: flex; flex-wrap: wrap; gap: 10px 16px; align-items: center; }
.bar > * { min-width: 0; }
select, button, input { font: inherit; color: inherit; }
select, input[type=text], input[type=number], input[type=date], input[type=password] { background: var(--surface); border: 1px solid var(--line); border-radius: 6px; padding: 6px 8px; }
button { background: var(--surface); border: 1px solid var(--line); border-radius: 6px; padding: 6px 12px; cursor: pointer; }
button:hover:not(:disabled) { border-color: var(--accent); }
button:disabled { opacity: .45; cursor: default; }
button.pri { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
button.danger { color: var(--bad); border-color: var(--bad); }
button.lnk { border: 0; background: transparent; color: var(--accent); padding: 2px 4px; }
label.f { display: inline-flex; gap: 6px; align-items: center; cursor: pointer; }
#msg, #status { font-size: 13px; color: var(--ok); }
#status.warn { color: var(--warn); }
.gwrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); }
.grid { display: grid; grid-template-columns: 168px repeat(7, minmax(104px, 1fr)); min-width: 900px; }
.grid > div { border-bottom: 1px solid var(--line); border-right: 1px solid var(--line); padding: 8px; min-width: 0; }
.grid > div:nth-child(8n) { border-right: 0; }
.grid > .last { border-bottom: 0; }
.dh { display: flex; flex-direction: column; gap: 3px; cursor: pointer; text-align: left; }
.dh b { font-weight: 600; }
.dh .dt { font-family: var(--mono); font-size: 12px; color: var(--mute); }
.dh.sel { background: var(--blk); }
.dh.we b, .dh.fer b { color: var(--accent); }
.dh.hoje .dt::after { content: ' · hoje'; color: var(--accent); }
.fer-t { font-size: 11px; color: var(--accent); }
.badge { display: inline-block; font-size: 11px; font-family: var(--mono); padding: 1px 6px; border-radius: 99px; width: fit-content; }
.badge.ok { background: var(--ok-bg); color: var(--ok); }
.badge.warn { background: var(--warn-bg); color: var(--warn); }
.badge.bad { background: var(--bad-bg); color: var(--bad); }
.badge.mute { background: var(--lock); color: var(--mute); }
.an { display: flex; flex-direction: column; gap: 2px; }
.an b { font-weight: 600; }
.an small { color: var(--mute); font-size: 12px; }
.tag { display: inline-block; font-size: 10.5px; padding: 0 6px; border-radius: 4px; border: 1px solid var(--line); margin-right: 4px; color: var(--mute); }
.tag.ku { color: var(--accent); border-color: var(--accent); }
.tag.tr { color: var(--warn); border-color: var(--warn); }
.cell { display: flex; flex-direction: column; gap: 4px; align-items: stretch; min-height: 62px; transition: background .12s; }
.cell.alvo { background: color-mix(in srgb, var(--accent) 10%, transparent); outline: 2px dashed var(--blk-line); outline-offset: -4px; }
.cell.sobre { background: color-mix(in srgb, var(--accent) 24%, transparent); outline: 2px solid var(--accent); outline-offset: -4px; }
.cell.mud { background: var(--warn-bg); outline: 2px solid var(--warn); outline-offset: -3px; }
.blk { flex: 1; background: var(--blk); border: 1px solid var(--blk-line); border-radius: 7px; padding: 6px 8px; display: flex; flex-direction: column; justify-content: center; gap: 2px; user-select: none; }
.edit .blk { cursor: grab; }
.blk.dragging { opacity: .4; }
.blk.sel { outline: 2px solid var(--accent); }
.blk b { font-family: var(--mono); font-weight: 500; font-size: 13px; }
.blk small { color: var(--mute); font-size: 11.5px; }
.off { flex: 1; border: 1px dashed var(--line); border-radius: 7px; display: flex; align-items: center; justify-content: center; color: var(--mute); font-size: 12px; text-align: center; }
.off.lock { background: var(--lock); border-style: solid; font-size: 11.5px; padding: 4px; }
.off.add { flex-direction: column; gap: 1px; cursor: pointer; }
.off.add small { font-size: 10.5px; opacity: 0; transition: opacity .12s; }
.off.add:hover small, .off.add:focus small { opacity: 1; color: var(--accent); }
.xblk { flex: 1; border: 1.5px dashed var(--accent); border-radius: 7px; padding: 6px 8px; display: flex; flex-direction: column; justify-content: center; gap: 2px; }
.xblk b { font-family: var(--mono); font-weight: 500; font-size: 13px; color: var(--accent); }
.xblk small { color: var(--accent); font-size: 11.5px; }
.xchip { font-size: 11.5px; color: var(--accent); border: 1.5px dashed var(--accent); border-radius: 6px; padding: 2px 6px; text-align: center; font-family: var(--mono); }
.edit .xblk, .edit .xchip { cursor: pointer; }
.panels { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 16px; }
.panels.um { grid-template-columns: minmax(0, 1fr); }
@media (max-width: 860px) { .panels { grid-template-columns: minmax(0, 1fr); } }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 14px; min-width: 0; }
#acao { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; background: var(--hint); border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; margin-bottom: 10px; }
ul.av { list-style: none; padding: 0; margin: 8px 0 0; display: flex; flex-direction: column; gap: 4px; }
ul.av li { padding: 4px 8px; border-radius: 6px; font-size: 13px; background: var(--lock); }
ul.av li.bad { background: var(--bad-bg); color: var(--bad); }
ul.av li.warn { background: var(--warn-bg); color: var(--warn); }
ul.av li.ok { background: var(--ok-bg); color: var(--ok); }
.cmp { display: flex; flex-direction: column; gap: 6px; margin: 8px 0; }
.cmp div { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.cmp .d { font-family: var(--mono); font-size: 12.5px; min-width: 80px; }
.gap-badges { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0; }
.gantt { display: flex; flex-direction: column; gap: 4px; margin-top: 8px; }
.gr { display: grid; grid-template-columns: 82px 1fr; align-items: center; gap: 8px; }
.gr span.n { font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.track { position: relative; height: 18px; background: var(--lock); border-radius: 4px; }
.bar-t { position: absolute; top: 0; bottom: 0; background: var(--blk-line); border-radius: 4px; }
.alm-t { position: absolute; top: 0; bottom: 0; background: var(--surface); opacity: .95; border-radius: 2px; }
.xb { position: absolute; top: 0; bottom: 0; border: 1.5px dashed var(--accent); border-radius: 4px; }
.covw { position: relative; }
.cov { display: flex; height: 18px; border-radius: 4px; overflow: hidden; }
.cov i { flex: 1; border-right: 1px solid color-mix(in srgb, var(--surface) 70%, transparent); }
.cov i.c0 { background: var(--bad); } .cov i.c1 { background: var(--warn); }
.cov i.c2 { background: var(--ok); } .cov i.cx { background: var(--lock); }
.agora-linha { position: absolute; top: -4px; bottom: -4px; width: 2px; background: var(--ink); }
.ticks { display: flex; justify-content: space-between; font-family: var(--mono); font-size: 11px; color: var(--mute); margin-top: 2px; }
.leg { display: flex; gap: 12px; flex-wrap: wrap; font-size: 12px; color: var(--mute); margin-top: 8px; }
.leg i { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 4px; vertical-align: -1px; }
.hoje-top { display: flex; flex-wrap: wrap; gap: 16px; align-items: stretch; }
.grande { font-size: 34px; font-weight: 600; line-height: 1; font-family: var(--mono); }
.lista { display: flex; flex-direction: column; gap: 6px; margin-top: 10px; }
.lista .it { display: flex; justify-content: space-between; gap: 10px; align-items: baseline; border-bottom: 1px solid var(--line); padding-bottom: 6px; }
.lista .it:last-child { border-bottom: 0; }
.lista .it span.t { color: var(--mute); font-size: 12.5px; text-align: right; }
.lista .it.fora b { color: var(--mute); font-weight: 500; }
.mes { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 6px; }
.mes .h { font-size: 12px; color: var(--mute); text-transform: uppercase; letter-spacing: .05em; text-align: center; }
.mes .d { background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 6px 8px; min-height: 78px; display: flex; flex-direction: column; gap: 4px; text-align: left; cursor: pointer; min-width: 0; }
.mes .d.fora { opacity: .45; }
.mes .d.hoje { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent) inset; }
.mes .d b { font-family: var(--mono); font-size: 13px; }
.mes .d small { color: var(--mute); font-size: 11px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@media (max-width: 640px) { .mes .d { min-height: 64px; padding: 4px; } .mes .d .badge { font-size: 10px; padding: 0 4px; } }
.agt { display: grid; grid-template-columns: minmax(160px, 2fr) minmax(90px, 1fr) auto auto minmax(130px, 1fr) auto; gap: 8px 12px; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--line); }
.agt.cab { font-size: 12px; color: var(--mute); text-transform: uppercase; letter-spacing: .05em; padding-bottom: 6px; }
.agt input[type=text], .agt input[type=date] { width: 100%; }
@media (max-width: 860px) { .agt { grid-template-columns: 1fr 1fr; } .agt.cab { display: none; } }
.fer-lista { display: flex; flex-direction: column; gap: 6px; margin: 8px 0; }
.fer-lista div { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
#veil { position: fixed; inset: 0; background: rgba(0,0,0,.45); display: flex; align-items: center; justify-content: center; padding: 16px; z-index: 20; }
#veil[hidden] { display: none; }
#modal { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 18px; max-width: 540px; width: 100%; max-height: 90vh; overflow: auto; }
#modal .bt { display: flex; gap: 8px; justify-content: flex-end; margin-top: 14px; flex-wrap: wrap; }
#modal input[type=text] { width: 100%; margin-top: 4px; }
textarea#txt { width: 100%; min-height: 160px; background: var(--surface); color: var(--ink); border: 1px solid var(--line); border-radius: 8px; padding: 8px; font-family: var(--mono); font-size: 12px; }
.login { max-width: 360px; margin: 12vh auto 0; display: flex; flex-direction: column; gap: 12px; }
.login input { width: 100%; }
.erro { color: var(--bad); font-size: 13px; min-height: 1.3em; }
[hidden] { display: none !important; }
