/* ============================ Painel administrativo ============================ */
body[data-layout="admin"] { background: var(--paper); }
.adm { display: grid; grid-template-columns: 248px minmax(0, 1fr); min-height: 100vh; }
.adm-side { position: sticky; top: 0; height: 100vh; overflow-y: auto; background: var(--night); color: var(--fog); padding: 18px 12px; display: flex; flex-direction: column; gap: 14px; }
.adm-brand { display: flex; align-items: center; gap: 10px; text-decoration: none; padding: 4px 8px 12px; border-bottom: 1px solid rgba(241, 238, 232, .15); }
.adm-brand svg { width: 34px; height: 34px; }
.adm-mark { height: 46px; width: auto; }
.adm-brand span { font: 800 1.3rem/1 var(--f-display); text-transform: uppercase; }
.adm-brand small { display: block; font: 500 .62rem/1 var(--f-mono); letter-spacing: .16em; color: var(--lichen); margin-top: 4px; }
.adm-side nav { display: grid; gap: 1px; }
.adm-side nav a { display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: 8px; text-decoration: none; font-size: .9rem; color: #C9C4BB; transition: background .2s, color .2s; }
.adm-side nav a:hover { background: rgba(255, 255, 255, .06); color: var(--fog); }
.adm-side nav a[aria-current="page"] { background: rgba(255, 122, 26, .14); color: #FFC59A; }
.adm-side nav a[aria-current="page"] .ic { color: var(--blaze); }
.adm-side nav a b { margin-left: auto; min-width: 20px; height: 20px; border-radius: 10px; background: var(--blaze); color: #1A0A02; font: 600 .68rem/20px var(--f-mono); text-align: center; padding: 0 5px; }
.adm-side-foot { margin-top: auto; }
.adm-side .btn { --b: rgba(241, 238, 232, .3); color: var(--fog); }
.adm-main { min-width: 0; }
.adm-top { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; gap: 14px; padding: 14px clamp(16px, 3vw, 32px); background: rgba(14, 14, 13, .88); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); }
.adm-top h1 { font: 800 1.9rem/1 var(--f-display); text-transform: uppercase; }
.adm-env { margin-left: auto; display: inline-flex; gap: 8px; align-items: center; font: 500 .74rem/1.3 var(--f-mono); color: var(--muted); }
.adm-menu { display: none; }
.adm-body { padding: clamp(16px, 3vw, 32px); display: grid; gap: 18px; align-content: start; }
.adm-gate { min-height: 100vh; display: grid; place-items: center; padding: 20px; }
.adm-gate .adm-mark { height: 64px; }
@media (max-width: 960px) {
  .adm { grid-template-columns: 1fr; }
  .adm-side { position: fixed; inset: 0 auto 0 0; width: 270px; z-index: 30; transform: translateX(-100%); transition: transform .35s var(--ease); }
  .adm-side.open { transform: none; box-shadow: var(--shadow-l); }
  .adm-menu { display: inline-grid; }
  .adm-env { display: none; }
}

.kpis { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 12px; }
.kpi { background: var(--surface-2); border: 1px solid var(--line); border-radius: 14px; padding: 16px 18px; display: grid; gap: 4px; position: relative; overflow: hidden; }
.kpi::before { content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: var(--line-strong); }
.kpi.ok::before { background: var(--ok); } .kpi.warn::before { background: #D99A1E; } .kpi.bad::before { background: var(--bad); }
.kpi span { font: 500 .72rem/1.2 var(--f-mono); letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.kpi b { font: 800 2.2rem/1 var(--f-display); }
.kpi small { color: var(--muted); font-size: .8rem; }
.adm-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 14px; }
.card { background: var(--surface-2); border: 1px solid var(--line); border-radius: 14px; padding: 18px; min-width: 0; }
.card.wide { grid-column: 1 / -1; }
.card h3 { font: 700 1rem/1.2 var(--f-text); margin-bottom: 12px; }
.bars { display: grid; gap: 8px; }
.bar { display: grid; grid-template-columns: minmax(80px, 140px) 1fr 40px; gap: 10px; align-items: center; font-size: .84rem; }
.bar span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar i { height: 10px; border-radius: 5px; background: var(--paper-2); position: relative; overflow: hidden; }
.bar i::after { content: ''; position: absolute; inset: 0; width: var(--w); background: var(--c, var(--pine)); border-radius: 5px; }
.bar b { font: 600 .8rem var(--f-mono); text-align: right; }
.rank { margin: 0; padding-left: 1.2em; display: grid; gap: 6px; font-size: .88rem; }
.rank li { display: flex; justify-content: space-between; gap: 10px; }
.rank b { font-family: var(--f-mono); font-weight: 500; }
.todo { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; font-size: .9rem; }
.todo li { display: flex; gap: 8px; align-items: center; }
.todo a { color: var(--ink); }
.adm-toolbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.adm-toolbar .field-search { flex: 1 1 260px; }
.tbl { overflow-x: auto; background: var(--surface-2); border: 1px solid var(--line); border-radius: 14px; }
.tbl table { width: 100%; border-collapse: collapse; font-size: .88rem; }
.tbl th { text-align: left; font: 600 .66rem/1 var(--f-mono); letter-spacing: .1em; text-transform: uppercase; color: var(--muted); padding: 12px; border-bottom: 1px solid var(--line); background: var(--surface); white-space: nowrap; }
.tbl td { padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl td.actions, .actions { white-space: nowrap; display: flex; gap: 6px; align-items: center; justify-content: flex-end; }
.tbl tr.row-bad td { background: rgba(255, 107, 90, .08); }
.cellp { display: grid; grid-template-columns: 52px 1fr; gap: 10px; align-items: center; min-width: 240px; }
.cellp .thumb { width: 52px; height: 40px; border-radius: 8px; background: var(--paper); color: var(--ink-2); display: block; }
.cellp .thumb .plate { width: 100%; height: 100%; }
.cellp small { display: block; color: var(--muted); font-size: .76rem; }
.pill { display: inline-block; padding: 4px 8px; border-radius: 999px; background: var(--paper-2); font: 500 .7rem/1.1 var(--f-mono); color: var(--ink-2); white-space: nowrap; }
.pill.ok { background: rgba(76, 194, 127, .15); color: #7FD9A6; } .pill.warn { background: rgba(227, 169, 59, .16); color: #F2C46B; } .pill.bad { background: rgba(255, 107, 90, .15); color: #FF9C8F; }
.warn-t { color: var(--warn); }
.danger { color: var(--bad) !important; --b: #E6B4AE; }
.select.sm { height: 36px; font-size: .8rem; }
input.inline { height: 36px; border: 1.5px solid var(--line); border-radius: 8px; padding: 0 10px; background: var(--surface); width: 100%; min-width: 160px; }
.switch { position: relative; display: inline-block; width: 42px; height: 24px; flex: none; }
.switch input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; z-index: 1; }
.switch span { position: absolute; inset: 0; border-radius: 12px; background: var(--line-strong); transition: background .2s; }
.switch span::after { content: ''; position: absolute; left: 3px; top: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; transition: transform .25s var(--ease); }
.switch input:checked + span { background: var(--ok); }
.switch input:checked + span::after { transform: translateX(18px); }
.switch input:focus-visible + span { outline: 2.5px solid var(--blaze); outline-offset: 2px; }

/* gaveta */
.adm-drawer { position: fixed; inset: 0; z-index: 80; background: rgba(5, 5, 4, .45); opacity: 0; visibility: hidden; transition: opacity .3s var(--ease), visibility .3s; }
.adm-drawer.open { opacity: 1; visibility: visible; }
.adm-drawer-in { position: absolute; right: 0; top: 0; bottom: 0; width: min(860px, 100%); background: var(--paper); box-shadow: var(--shadow-l); display: flex; flex-direction: column; transform: translateX(30px); transition: transform .35s var(--ease); }
.adm-drawer.open .adm-drawer-in { transform: none; }
.adm-drawer-in > header { display: flex; justify-content: space-between; align-items: center; padding: 16px 22px; border-bottom: 1px solid var(--line); }
.adm-drawer-in > header h2 { font: 800 1.6rem/1 var(--f-display); text-transform: uppercase; }
.adm-form { flex: 1; overflow-y: auto; padding: 20px 22px 0; display: flex; flex-direction: column; gap: 16px; }
.adm-form footer { position: sticky; bottom: 0; margin: auto -22px 0; padding: 14px 22px; background: var(--paper); border-top: 1px solid var(--line); display: flex; gap: 8px; justify-content: flex-end; }
.adm-form footer .danger { margin-right: auto; }
.adm-form-msg:not(:empty) { display: flex; gap: 8px; align-items: center; color: var(--bad); background: rgba(255, 107, 90, .08); border: 1px solid rgba(255, 107, 90, .4); padding: 10px 12px; border-radius: 10px; font-size: .9rem; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 14px; }
.form-grid .wide, .form-grid fieldset, .form-grid .consent { grid-column: 1 / -1; }
.adm-form .field input, .adm-form .field select, .adm-form .field textarea { min-height: 42px; padding: 9px 12px; font-size: .92rem; }
.adm-form .field input[type=color] { padding: 4px; height: 42px; }
fieldset.field { border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px 14px; margin: 0; }
fieldset.field legend { font-weight: 600; font-size: .88rem; padding: 0 6px; }
.multi { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 4px 12px; max-height: 180px; overflow-y: auto; font-size: .86rem; }
.multi label { display: flex; gap: 8px; align-items: flex-start; }
.tbl-offers table { min-width: 760px; }
.tbl-offers input, .tbl-offers select { width: 100%; height: 36px; border: 1.5px solid var(--line); border-radius: 8px; padding: 0 8px; background: var(--surface-2); font-size: .84rem; }
.tbl-offers td { padding: 6px; }
.tbl-offers tr.oiss td { color: var(--warn); font-size: .78rem; padding-top: 0; }
.secedit { border-top: 1px dashed var(--line); padding-top: 12px; margin-top: 12px; display: grid; gap: 8px; }
.secedit .row2 { display: grid; grid-template-columns: 2fr 1fr; gap: 10px; }
@media (max-width: 700px) { .form-grid { grid-template-columns: 1fr; } }

/* fila e kanban */
.review { display: grid; grid-template-columns: minmax(240px, 1fr) 1.4fr auto; gap: 16px; align-items: center; }
@media (max-width: 1000px) { .review { grid-template-columns: 1fr; } }
.checks { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; font-size: .84rem; }
.checks li { display: flex; gap: 6px; align-items: center; }
.checks .bad { color: var(--bad); } .checks .warn { color: var(--warn); } .checks .info { color: #7DB3D6; } .checks .ok { color: var(--ok); }
.kanban { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(220px, 1fr); gap: 12px; overflow-x: auto; padding-bottom: 10px; align-items: start; }
.kcol { background: rgba(255, 255, 255, .6); border: 1px solid var(--line); border-radius: 14px; padding: 12px; display: grid; gap: 8px; align-content: start; min-height: 200px; }
.kcol h3 { font: 600 .72rem/1 var(--f-mono); letter-spacing: .1em; text-transform: uppercase; display: flex; justify-content: space-between; color: var(--muted); padding: 4px 2px 6px; }
.kcard { background: var(--surface-2); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; display: grid; gap: 4px; cursor: pointer; transition: border-color .2s, box-shadow .2s; }
.kcard:hover, .kcard:focus-visible { border-color: var(--ink); box-shadow: var(--shadow); }
.kcard b { font-size: .9rem; line-height: 1.25; }
.kcard small { font-size: .74rem; color: var(--muted); }
.kmove { display: flex; gap: 4px; justify-content: flex-end; }
.kmove .icon-btn { width: 30px; height: 30px; }
.req { display: flex; justify-content: space-between; gap: 12px; align-items: center; padding: 12px 0; border-top: 1px solid var(--line); flex-wrap: wrap; }
.req:first-of-type { border-top: 0; }
.order { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.order li { display: flex; gap: 8px; align-items: center; padding: 8px 10px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); }
.order li span { flex: 1; font-size: .9rem; font-weight: 600; }
.order .icon-btn { width: 32px; height: 32px; }
.order .icon-btn[disabled] { opacity: .3; }
pre.code { background: var(--night); color: var(--fog); padding: 14px; border-radius: 10px; overflow: auto; font: 400 .76rem/1.5 var(--f-mono); max-height: 260px; }
.adm-grid:has(.card [data-uid]) { grid-template-columns: minmax(0, 2fr) minmax(280px, 1fr); }
@media (max-width: 1000px) { .adm-grid:has(.card [data-uid]) { grid-template-columns: 1fr; } }
.adm-gate .adm-form-msg:empty { display: none; }
