/* ===========================================================================
 Tlim · Componentes (biblioteca reutilizável do site e do portal)
 Usa só as variáveis de /ds/tokens.css. Veja todos em /ds/.
 =========================================================================== */
*{box-sizing:border-box}
html{-webkit-text-size-adjust:100%;text-size-adjust:100%}
body{margin:0;background:var(--bg);color:var(--ink);font:16px/1.55 var(--font);-webkit-font-smoothing:antialiased;text-rendering:optimizeLegibility}
h1,h2,h3{font-family:var(--font-d);line-height:1.15;margin:0;letter-spacing:-.02em;font-optical-sizing:auto}
h1{font-size:var(--fs-2xl);font-weight:700}h2{font-size:var(--fs-lg);font-weight:650;letter-spacing:-.01em}h3{font-size:var(--fs-md);font-weight:650;letter-spacing:-.005em}
p{margin:0}a{color:var(--accent)}
button,input,select{font:inherit;color:inherit}
.ic{width:20px;height:20px;flex:none;fill:none;stroke:currentColor;stroke-width:2;stroke-linecap:round;stroke-linejoin:round}
/* logotipo tlim: letras na cor do texto e o ponto de aviso no roxo (troca sozinho no tema escuro).
   Altura por --logo-h. Em fundo roxo, use .tl-logo-on (tudo branco). Arquivos: /ds/logo-wordmark*.svg */
.tl-logo{position:relative;display:inline-block;flex:none;height:var(--logo-h,26px);aspect-ratio:127/55;color:var(--ink)}
.tl-logo::before{content:"";position:absolute;inset:0;background:currentColor;-webkit-mask:url("/ds/logo-wordmark-mask.svg") center/contain no-repeat;mask:url("/ds/logo-wordmark-mask.svg") center/contain no-repeat}
.tl-logo::after{content:"";position:absolute;left:38.19%;top:1.82%;width:10.24%;height:23.64%;border-radius:50%;background:var(--accent)}
.tl-logo-on{color:var(--on-brand)}.tl-logo-on::after{background:currentColor}
@media (forced-colors:active){.tl-logo::before,.tl-logo::after{background:CanvasText}}
.num{font-variant-numeric:tabular-nums}
.muted{color:var(--muted)}.small{font-size:.875rem}.xs{font-size:.8125rem}
.up{color:var(--up)}.down{color:var(--down)}.warn{color:var(--warn)}
.sr{position:absolute!important;width:1px;height:1px;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap}
:focus-visible{outline:2px solid var(--accent);outline-offset:2px;border-radius:8px}
[hidden]{display:none!important}

.btn{display:inline-flex;align-items:center;justify-content:center;gap:8px;min-height:44px;padding:10px 16px;border-radius:12px;border:1px solid var(--line-2);background:var(--surface);color:var(--ink);font-weight:600;font-size:.9375rem;cursor:pointer;text-decoration:none;white-space:nowrap;-webkit-tap-highlight-color:transparent;transition:background var(--dur) var(--ease),border-color var(--dur) var(--ease),color var(--dur) var(--ease)}
.btn:hover{background:var(--surface-2)}
.btn:disabled{opacity:.55;cursor:not-allowed}
.btn-primary{background:var(--accent);border-color:var(--accent);color:var(--accent-ink)}
.btn-primary:hover{background:var(--accent-hover);border-color:var(--accent-hover)}
.btn-danger{color:var(--down);border-color:var(--line-2)}
.btn-danger-solid{background:var(--down);border-color:var(--down);color:#fff}
:root[data-theme=dark] .btn-danger-solid{color:#1a0b09}
.btn-ghost{border-color:transparent;background:transparent}
.btn-ghost:hover{background:var(--surface-2)}
.btn-lg{min-height:52px;font-size:1rem;padding:12px 20px;border-radius:14px}
.btn-block{width:100%}
.btn-wrap{white-space:normal;text-align:center;min-width:0;line-height:1.25}
.btn-icon{width:44px;padding:0;border-color:transparent;background:transparent}
.btn-icon:hover{background:var(--surface-2)}
.btn.busy{position:relative;color:transparent!important;pointer-events:none}
.btn.busy>*{visibility:hidden}
.btn.busy::after{content:"";position:absolute;width:18px;height:18px;border-radius:50%;border:2.5px solid var(--muted);border-top-color:transparent;animation:spin .7s linear infinite}
.btn-primary.busy::after{border-color:var(--accent-ink);border-top-color:transparent}
@keyframes spin{to{transform:rotate(360deg)}}

textarea.input{min-height:150px;font-family:var(--mono);font-size:.9375rem;line-height:1.5;resize:vertical}

.grid{display:grid;gap:14px}
@media (min-width:760px){.grid-2{grid-template-columns:1fr 1fr}.span-2{grid-column:1/-1}}
.card{background:var(--surface);border:1px solid var(--line);border-radius:16px;padding:20px;box-shadow:var(--shadow-sm);min-width:0}
.card-h{display:flex;align-items:center;justify-content:space-between;gap:10px;margin-bottom:12px;min-height:32px}
.card-h .ic{color:var(--muted)}
.card-h h2{display:flex;align-items:center;gap:8px}
.card p+p{margin-top:8px}
.list{list-style:none;margin:0;padding:0}
.list>li{display:flex;align-items:center;gap:12px;padding:10px 0;border-top:1px solid var(--line)}
.list>li:first-child{border-top:0;padding-top:2px}
.grow{flex:1;min-width:0}
.row{display:flex;align-items:center;gap:8px;flex-wrap:wrap}
.stack>*+*{margin-top:14px}
.ellipsis{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}

.badge{display:inline-flex;align-items:center;gap:4px;padding:2px 10px;border-radius:var(--r-pill);font-size:.75rem;font-weight:650;line-height:1.6;white-space:nowrap;background:var(--surface-2);color:var(--ink-2);border:1px solid var(--line)}
.badge.b-ok{background:var(--up-soft);color:var(--up);border-color:transparent}
.badge.b-warn{background:var(--warn-soft);color:var(--warn);border-color:transparent}
.badge.b-bad{background:var(--down-soft);color:var(--down);border-color:transparent}
.badge.b-acc{background:var(--accent-soft);color:var(--accent);border-color:transparent}
.badge .ic{width:12px;height:12px;stroke-width:3}
.chips{display:flex;flex-wrap:wrap;gap:8px}
.chip{display:inline-flex;align-items:center;gap:4px;min-height:44px;padding:0 0 0 12px;border-radius:999px;background:var(--surface-2);border:1px solid var(--line);font-weight:650;font-size:.9375rem}
.chip .chg{font-weight:550;font-size:.8125rem}
.chip button{width:44px;height:44px;border-radius:50%;border:0;background:transparent;display:grid;place-items:center;cursor:pointer;color:var(--muted)}
.chip button:hover{background:var(--line);color:var(--ink)}
.chip button .ic{width:16px;height:16px}
.chip.pending{opacity:.6}
.group-t{font-size:.8125rem;font-weight:650;color:var(--muted);margin:14px 0 8px}
.group-t:first-child{margin-top:0}

label.lbl{display:block;font-weight:600;font-size:.9375rem;margin-bottom:6px}
.hint{font-size:.8125rem;color:var(--muted);margin-top:6px}
.input,select.input{width:100%;min-height:44px;padding:10px 12px;border:1px solid var(--line-2);border-radius:var(--r-sm);background:var(--surface);font-size:1rem}
.input:focus{outline:none;border-color:var(--accent);box-shadow:0 0 0 3px color-mix(in srgb,var(--accent) 25%,transparent)}
.input[aria-invalid=true]{border-color:var(--down)}
.field+.field{margin-top:14px}
.pw{position:relative}.pw .input{padding-right:52px}.pw .btn-icon{position:absolute;right:0;top:0;height:44px}
.search{position:relative}.search>.ic{position:absolute;left:12px;top:12px;color:var(--muted)}.search .input{padding-left:40px}
.err{color:var(--down);font-size:.875rem;margin-top:8px;display:flex;gap:6px;align-items:flex-start}
.err .ic{width:18px;height:18px;margin-top:2px}
.affix{position:relative}.affix .input{padding-right:36px;text-align:right}.affix span{position:absolute;right:12px;top:11px;color:var(--muted);pointer-events:none}
.prefix{position:relative}.prefix .input{padding-left:38px}.prefix span{position:absolute;left:12px;top:11px;color:var(--muted);pointer-events:none}

.sw-row{display:flex;gap:14px;align-items:center;padding:12px 0;border-top:1px solid var(--line);cursor:pointer}
.sw-row:first-child{border-top:0;padding-top:0}
.sw-row b{display:block;font-weight:600}
.sw-row small{display:block;color:var(--muted);font-size:.8125rem;line-height:1.4;margin-top:2px}
.sw{appearance:none;-webkit-appearance:none;width:51px;height:31px;flex:none;border-radius:999px;background:var(--line-2);position:relative;cursor:pointer;margin:0;transition:background .2s}
.sw::after{content:"";position:absolute;top:2px;left:2px;width:27px;height:27px;border-radius:50%;background:#fff;box-shadow:0 1px 3px rgba(0,0,0,.25);transition:transform .2s}
.sw:checked{background:var(--accent)}
.sw:checked::after{transform:translateX(20px)}
.sw:focus-visible{outline:3px solid var(--accent);outline-offset:2px}
.stepper{display:flex;align-items:center;gap:4px}
.stepper .btn{width:44px;padding:0;flex:none}
.stepper .affix{width:96px}
.lim-row{display:flex;align-items:center;gap:12px;padding:10px 0;border-top:1px solid var(--line);flex-wrap:wrap}
.lim-row:first-of-type{border-top:0}
.lim-row label{flex:1 1 160px;font-weight:600}
.saved{font-size:.8125rem;color:var(--muted);display:inline-flex;align-items:center;gap:4px;min-height:24px}
.saved.ok{color:var(--up)}.saved.bad{color:var(--down)}

.meter{height:10px;border-radius:999px;background:var(--surface-2);border:1px solid var(--line);overflow:hidden;margin:8px 0 6px}
.meter>i{display:block;height:100%;border-radius:999px;background:var(--accent)}
.meter.m-warn>i{background:var(--warn)}.meter.m-bad>i{background:var(--down)}
.kv{display:flex;justify-content:space-between;gap:10px;align-items:baseline}
.big{font-family:var(--font-d);font-size:1.75rem;font-weight:700;line-height:1.1}

.kpis{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:12px}
@media (min-width:760px){.kpis{grid-template-columns:repeat(3,minmax(0,1fr))}}
.kpi{background:var(--surface);border:1px solid var(--line);border-radius:var(--r);padding:14px 16px;min-width:0}
.kpi .k{font-size:.8125rem;color:var(--muted);font-weight:600}
.kpi .v{font-family:var(--font-d);font-size:1.75rem;font-weight:700;margin-top:2px;line-height:1.15}
.kpi .s{font-size:.8125rem;color:var(--muted);margin-top:2px}
.split{display:flex;gap:2px;height:14px;border-radius:999px;overflow:hidden;background:var(--surface-2);margin:10px 0}
.split i{display:block;height:100%}
.split .s-up{background:var(--up)}.split .s-down{background:var(--down)}
.hbar{display:grid;grid-template-columns:minmax(90px,auto) 1fr auto;gap:10px;align-items:center;padding:6px 0}
.hbar .t{height:10px;background:var(--surface-2);border-radius:999px;overflow:hidden}
.hbar .t i{display:block;height:100%;background:var(--accent);border-radius:999px}

.avatar{width:42px;height:42px;flex:none;border-radius:50%;display:grid;place-items:center;font-weight:700;font-family:var(--font-d);background:var(--accent-soft);color:var(--accent)}

.empty{text-align:center;padding:20px 12px;color:var(--muted)}
.empty .ic{width:32px;height:32px;color:var(--line-2);margin-bottom:6px}
.empty b{display:block;color:var(--ink);margin-bottom:4px}
.note{display:flex;gap:10px;padding:12px;border-radius:12px;background:var(--accent-soft);color:var(--ink);font-size:.9375rem}
.note .ic{color:var(--accent);margin-top:2px}
.note.n-warn{background:var(--warn-soft)}.note.n-warn .ic{color:var(--warn)}

.results{list-style:none;margin:8px 0 0;padding:0;border:1px solid var(--line);border-radius:12px;overflow:hidden}
.results li{display:flex;align-items:center;gap:10px;padding:8px 8px 8px 12px;border-top:1px solid var(--line)}
.results li:first-child{border-top:0}

.code{display:flex;align-items:center;gap:6px;background:var(--surface-2);border:1px solid var(--line);border-radius:10px;padding:2px 2px 2px 12px;min-width:0}
.code code{font-family:var(--mono);font-size:.875rem;flex:1;overflow-x:auto;white-space:nowrap;padding:8px 0}
.check-item{padding:14px 0;border-top:1px solid var(--line)}
.check-item:first-child{border-top:0;padding-top:0}
.check-item p{color:var(--muted);font-size:.9375rem;margin:4px 0 8px}
ol.steps{margin:0;padding-left:22px}ol.steps li{margin:6px 0}

.sk{background:linear-gradient(90deg,var(--surface-2) 25%,var(--line) 37%,var(--surface-2) 63%);background-size:400% 100%;animation:sh 1.4s ease infinite;border-radius:10px}
@keyframes sh{0%{background-position:100% 50%}100%{background-position:0 50%}}

dialog.sheet{border:0;padding:0;background:var(--surface);color:var(--ink);width:100%;max-width:100%;margin:auto 0 0;border-radius:22px 22px 0 0;max-height:92dvh;overflow:auto;box-shadow:0 -10px 40px rgba(0,0,0,.25)}
dialog.sheet::backdrop{background:var(--overlay)}
dialog.sheet[open]{animation:up .22s ease-out}
@keyframes up{from{transform:translateY(24px)}to{transform:none}}
.sheet-in{padding:20px 16px calc(20px + env(safe-area-inset-bottom))}
.sheet-in h2{font-size:1.25rem;margin-bottom:6px}
.sheet-in>p{color:var(--ink-2)}
.sheet-acts{display:flex;flex-direction:column-reverse;gap:10px;margin-top:20px}
.sheet-menu{display:grid;gap:4px;margin-top:12px}
.sheet-menu .btn{justify-content:flex-start;border-color:transparent;background:var(--surface-2);min-height:52px}
.grab{width:40px;height:5px;border-radius:9px;background:var(--line-2);margin:-8px auto 14px}
@media (min-width:600px){
dialog.sheet{max-width:460px;margin:auto;border-radius:20px}
.sheet-acts{flex-direction:row;justify-content:flex-end}
.grab{display:none}
}

#toasts{position:fixed;left:0;right:0;bottom:calc(var(--tab-h) + 12px + env(safe-area-inset-bottom));z-index:100;display:flex;flex-direction:column;align-items:center;gap:8px;pointer-events:none;padding:0 16px}
@media (min-width:900px){#toasts{bottom:24px;left:auto;right:24px;align-items:flex-end}}
.toast{pointer-events:auto;display:flex;gap:10px;align-items:center;max-width:440px;width:100%;padding:12px 14px;border-radius:14px;background:var(--ink);color:var(--bg);font-size:.9375rem;box-shadow:0 10px 30px rgba(0,0,0,.25);animation:up .2s ease-out}
.toast .ic{margin-top:1px}
.toast>div{flex:1;min-width:0}
.toast-act{flex:none;min-height:40px;padding:0 14px;margin:-6px -4px -6px 0;border-radius:10px;border:1px solid color-mix(in srgb,var(--bg) 45%,transparent);background:transparent;color:var(--bg);font-weight:700;cursor:pointer}
.toast-act:hover{background:color-mix(in srgb,var(--bg) 12%,transparent)}
.toast.t-ok .ic{color:color-mix(in srgb,var(--up) 60%,var(--bg))}
.toast.t-bad .ic{color:color-mix(in srgb,var(--down) 60%,var(--bg))}

.seg{display:flex;gap:4px;overflow-x:auto;padding:4px;margin:0 0 14px;background:var(--surface-2);border:1px solid var(--line);border-radius:14px;scrollbar-width:none;-webkit-overflow-scrolling:touch}
.seg::-webkit-scrollbar{display:none}
.seg a{flex:1 0 auto;display:inline-flex;align-items:center;justify-content:center;gap:6px;min-height:44px;padding:0 14px;border-radius:10px;color:var(--ink-2);text-decoration:none;font-weight:600;font-size:.9375rem;white-space:nowrap;-webkit-tap-highlight-color:transparent}
.seg a .ic{width:18px;height:18px}
.seg a:hover{color:var(--ink)}
.seg a[aria-selected=true]{background:var(--surface);color:var(--accent);box-shadow:0 0 0 1px var(--line),0 1px 3px rgba(23,19,43,.08)}
.seg-s{display:none}
@media (max-width:599px){.seg a .ic{display:none}.seg a{padding:0 12px}.seg-l{display:none}.seg-s{display:inline}}
.grid.top{align-items:start}
.tbar{height:6px;border-radius:999px;background:var(--surface-2);border:1px solid var(--line);overflow:hidden;margin-top:8px;max-width:320px}
.tbar>i{display:block;height:100%;border-radius:999px;background:var(--accent)}
.tbar.near>i{background:var(--warn)}.tbar.hit>i{background:var(--up)}
.fchips{display:flex;gap:8px;overflow-x:auto;padding-bottom:4px;margin-bottom:6px;scrollbar-width:none}
.fchips::-webkit-scrollbar{display:none}
.fchip{flex:none;min-height:44px;padding:0 14px;border-radius:999px;border:1px solid var(--line-2);background:var(--surface);font-weight:600;font-size:.875rem;cursor:pointer;color:var(--ink-2)}
.fchip[aria-pressed=true]{background:var(--accent);border-color:var(--accent);color:var(--accent-ink)}
.time{font-variant-numeric:tabular-nums;font-size:.8125rem;color:var(--muted);min-width:46px;padding-top:2px}
.hist-t{font-size:.9375rem;line-height:1.45;overflow-wrap:anywhere;margin-top:4px}
.two{display:grid;grid-template-columns:1fr 1fr;gap:10px}
.doc-ic{width:36px;height:36px;flex:none;border-radius:10px;display:grid;place-items:center;background:var(--surface-2);font-size:1.125rem}
.sub-h{margin:22px 0 4px}
.bars{display:grid;gap:8px}
.bar-row{display:grid;grid-template-columns:minmax(64px,auto) 1fr minmax(92px,auto);gap:10px;align-items:center;font-size:.875rem;min-height:28px}
.bar-row .tr{height:12px;background:var(--surface-2);border-radius:0 4px 4px 0;overflow:hidden}
.bar-row .tr i{display:block;height:100%;background:var(--accent);border-radius:0 4px 4px 0;min-width:2px}
.bar-row .v{text-align:right;font-variant-numeric:tabular-nums;color:var(--ink-2)}
.div-row{display:grid;grid-template-columns:minmax(64px,auto) 1fr 1fr minmax(120px,auto);gap:0 10px;align-items:center;font-size:.875rem;min-height:28px}
.div-row .dneg,.div-row .dpos{height:20px;display:flex;align-items:center}
.div-row .dneg{justify-content:flex-end;margin-right:-10px;padding-right:1px}
.div-row .dpos{border-left:1px solid var(--line-2);margin-left:-10px;padding-left:1px}
.div-row .dneg i{display:block;height:12px;background:var(--down);border-radius:4px 0 0 4px;min-width:2px}
.div-row .dpos i{display:block;height:12px;background:var(--up);border-radius:0 4px 4px 0;min-width:2px}
.div-row .v{text-align:right;font-variant-numeric:tabular-nums}
@media (max-width:420px){.div-row{grid-template-columns:56px 1fr 1fr 104px}.bar-row{grid-template-columns:56px 1fr 92px}}
.cols{display:flex;align-items:flex-end;gap:10px;height:140px;padding-top:18px;border-bottom:1px solid var(--line-2)}
.col{flex:1;display:flex;flex-direction:column;align-items:center;justify-content:flex-end;height:100%;min-width:0;position:relative}
.col i{display:block;width:100%;max-width:36px;background:var(--accent);border-radius:4px 4px 0 0;min-height:2px;flex:none}
.col b{font-size:.75rem;font-weight:650;color:var(--ink-2);margin-bottom:4px;font-variant-numeric:tabular-nums}
.col-l{display:flex;gap:10px;margin-top:6px}.col-l span{flex:1;text-align:center;font-size:.75rem;color:var(--muted);min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}

@media (prefers-reduced-motion:reduce){*,*::before,*::after{animation-duration:.01ms!important;animation-iteration-count:1!important;transition-duration:.01ms!important}}
.tdg{border-top:1px solid var(--line)}
.tdg:first-of-type{border-top:0}
.tdg summary{display:flex;align-items:center;gap:8px;min-height:48px;cursor:pointer;list-style:none}
.tdg summary::-webkit-details-marker{display:none}
.tdg summary::before{content:"";width:8px;height:8px;border-right:2px solid var(--muted);border-bottom:2px solid var(--muted);transform:rotate(-45deg);transition:transform .15s;margin:0 6px 0 2px;flex:none}
.tdg[open] summary::before{transform:rotate(45deg)}
.tdg .sw-row:first-of-type{border-top:1px solid var(--line);padding-top:12px}
.faces{display:grid;grid-template-columns:repeat(5,1fr);gap:8px;margin-top:14px}
.face{display:flex;flex-direction:column;align-items:center;gap:2px;min-height:72px;border:1px solid var(--line-2);border-radius:14px;background:var(--surface);cursor:pointer;padding:8px 4px;color:var(--ink-2)}
.face span{font-size:1.75rem;line-height:1.1}
.face small{font-size:.75rem;font-weight:600}
.face[aria-checked=true]{border-color:var(--accent);background:var(--accent-soft);color:var(--accent);box-shadow:0 0 0 2px color-mix(in srgb,var(--accent) 35%,transparent)}
