/* Layout e componentes do Control Room. Cores e fontes vêm de theme.css. */
*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.35;
  -webkit-font-smoothing: antialiased;
}
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background: var(--bg-image) center / cover no-repeat;
  opacity: var(--bg-image-opacity);
  pointer-events: none;
  z-index: 0;
}
h1, h2, h3, p { margin: 0; }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: inherit; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.hidden, [hidden] { display: none !important; }

.icon { display: inline-block; width: 1em; height: 1em; flex: none; }
.icon svg { display: block; width: 100%; height: 100%; }
.mask-icon { display: inline-block; background: currentColor; mask: var(--src) center / contain no-repeat; -webkit-mask: var(--src) center / contain no-repeat; }

/* ---- estrutura ------------------------------------------------------- */
#app { position: relative; z-index: 1; height: 100%; }
html, body { overflow: hidden; }
.shell { display: grid; grid-template-columns: 340px minmax(0, 1fr); gap: 26px; padding: 16px 20px 16px 18px; height: 100vh; align-items: stretch; }
.sidebar {
  position: sticky; top: 16px; height: calc(100vh - 32px); display: flex; flex-direction: column;
  background: var(--sidebar); border: 1px solid var(--card-border); border-radius: 10px; padding: 28px 22px 22px;
  box-shadow: var(--shadow); overflow: hidden;
}
.sidebar .brand { display: block; padding: 0 8px 26px; }
.sidebar .brand img { display: block; height: 54px; width: auto; max-width: 100%; margin: 0 auto; }
[data-theme='light'] .sidebar .brand img.brand-dark { display: none; }
:root:not([data-theme='light']) .sidebar .brand img.brand-light { display: none; }
.nav { display: flex; flex-direction: column; gap: 14px; }
.nav a {
  display: flex; align-items: center; gap: 20px; padding: 6px 12px 6px 7px; border-radius: 54px; text-decoration: none;
  font-weight: 500; font-size: 17px; color: var(--text); transition: background 0.2s;
}
.nav a:hover { background: var(--row-hover); }
.nav a .badge { width: 37px; height: 37px; border-radius: 50%; display: grid; place-items: center; background: var(--nav-icon-bg); color: var(--nav-icon-fg); flex: none; }
.nav a .badge .mask-icon, .nav a .badge .icon { width: 17px; height: 17px; }
.nav a[aria-current='page'] { background: var(--nav-active); color: #fff; }
.nav a[aria-current='page'] .badge { background: var(--gold); color: #fff; }
.nav a span.label { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.calendar { margin-top: auto; background: rgba(152, 111, 50, 0.1); border: 1px solid var(--card-border); border-radius: 8px; padding: 14px 10px 12px; }
.calendar .head { display: flex; align-items: center; justify-content: space-between; gap: 6px; margin-bottom: 10px; }
.calendar .head button.nav-btn { background: none; border: 0; padding: 4px; font-size: 14px; display: grid; place-items: center; }
.calendar select { background: transparent; border: 1px solid var(--line); border-radius: 4px; padding: 1px 2px; font-size: 11px; }
.calendar select option { color: #000; }
.calendar .grid { display: grid; grid-template-columns: repeat(7, 1fr); row-gap: 2px; text-align: center; }
.calendar .dow { font-size: 9px; font-weight: 500; padding: 6px 0; color: var(--text-muted); }
.calendar .day { background: none; border: 0; padding: 0; height: clamp(20px, 3vh, 30px); font-size: 12px; border-radius: 6px; position: relative; }
.calendar .day.out { color: var(--text-faint); }
.calendar .day.today { outline: 1px solid var(--gold); outline-offset: -2px; }
.calendar .day.sel { background: var(--gold); color: #fff; font-weight: 600; }
.calendar .day.inrange { background: rgba(152, 111, 50, 0.35); border-radius: 0; }
.calendar .day:hover:not(.sel) { background: var(--row-hover); }
.calendar .period { display: flex; align-items: center; justify-content: space-between; margin-top: 8px; font-size: 11px; color: var(--text-muted); gap: 6px; }
.calendar .period button { background: none; border: 0; text-decoration: underline; font-size: 11px; padding: 0; color: var(--gold-soft); }
[data-theme='light'] .calendar .period button { color: var(--gold); }

.main { min-width: 0; min-height: 0; display: flex; flex-direction: column; gap: 18px; }
#view { flex: 1; min-height: 0; display: flex; flex-direction: column; gap: 18px; outline: none; }
:where(#view > *, #view > div > *) { flex: none; }
.grow-y { flex: 1 1 0 !important; min-height: 0; }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 20px; min-height: 56px; padding: 6px 0 0 4px; }
.greeting { display: flex; align-items: center; gap: 6px 14px; flex-wrap: wrap; min-width: 0; }
.greeting h1 { font-family: var(--font-display); font-weight: 700; font-size: clamp(20px, 2.1vw, 34px); line-height: 1.1; }
.robot-pill {
  display: inline-flex; align-items: center; gap: 8px; padding: 6px 18px 6px 14px; border-radius: 40px; color: #fff; font-family: var(--font-display); font-weight: 600; font-size: 19px;
  background: var(--pill-ok); border: 1px solid rgba(255, 255, 255, 0.35); box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.35);
}
.robot-pill[data-state='RUNNING'] { background: linear-gradient(180deg, #b8873c, #7a5528); }
.robot-pill[data-state='FAILED'] { background: linear-gradient(180deg, #d94a58, #a8202f); }
.robot-pill .icon { font-size: 20px; }
.robot-pill .spin { animation: spin 1.1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.tools { display: flex; align-items: center; gap: 16px; position: relative; }
.theme-btn { width: 42px; height: 42px; padding: 0; border: 0; background: none; border-radius: 50%; display: grid; place-items: center; }
.theme-btn img { width: 40px; height: 40px; object-fit: contain; filter: drop-shadow(0 2px 3px rgba(0, 0, 0, 0.4)); }
.bell-btn { position: relative; width: 40px; height: 40px; border-radius: 50%; border: 0; display: grid; place-items: center; font-size: 20px; color: var(--text); background: linear-gradient(140deg, rgba(255, 255, 255, 0) 13%, rgba(255, 255, 255, 0.32) 95%); }
[data-theme='light'] .bell-btn { background: none; }
.bell-btn .count { position: absolute; top: -3px; right: -4px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--bad); color: #fff; font-size: 10px; font-weight: 700; display: grid; place-items: center; }
.tools .sep { width: 1.5px; height: 42px; background: var(--gold); }
.user-btn { display: flex; align-items: center; gap: 10px; background: none; border: 0; padding: 0; text-align: left; }
.avatar { width: 40px; height: 40px; border-radius: 50%; background: var(--gold-grad); display: grid; place-items: center; font-family: var(--font-display); font-weight: 600; font-size: 15px; color: #fff; border: 1px solid rgba(255, 255, 255, 0.4); }
.user-btn .who { display: flex; flex-direction: column; }
.user-btn .who strong { font-family: var(--font-display); font-weight: 700; font-size: 16px; line-height: 1.15; }
.user-btn .who small { font-family: var(--font-display); font-size: 10px; color: var(--text-muted); }

.menu {
  position: absolute; top: calc(100% + 10px); right: 0; z-index: 30; min-width: 250px; max-width: 360px; padding: 6px; border-radius: 12px; background: var(--surface-solid);
  border: 1px solid var(--card-border); box-shadow: var(--shadow-lg);
}
.menu button, .menu a.item { display: flex; width: 100%; align-items: center; gap: 10px; text-align: left; background: none; border: 0; padding: 10px 12px; border-radius: 8px; text-decoration: none; font-size: 14px; }
.menu button:hover, .menu a.item:hover { background: var(--row-hover); }
.menu .empty { padding: 14px; color: var(--text-muted); font-size: 14px; }
.menu .notice { display: block; width: 100%; }
.menu .notice strong { display: block; font-size: 13px; }
.menu .notice span { display: block; font-size: 12px; color: var(--text-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 320px; }
.menu h4 { margin: 8px 12px 4px; font-size: 12px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-muted); }

/* ---- cartões, filtros, botões ---------------------------------------- */
.panel { background: var(--surface); border: 1px solid var(--card-border); border-radius: 13px; box-shadow: var(--shadow); }
.page-head { padding: clamp(12px,2.4vh,24px) 26px clamp(12px,2.2vh,22px); display: flex; flex-direction: column; gap: clamp(10px,2.4vh,26px); }
.page-head .title-row { display: flex; align-items: center; justify-content: space-between; gap: 20px; flex-wrap: wrap; }
.page-head h2 { font-family: var(--font-display); font-weight: 700; font-size: clamp(28px, 4.2vh, 40px); line-height: 1.1; }
.filters { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.filters .grow { flex: 1; }
.pill-field {
  display: inline-flex; align-items: center; gap: 8px; height: 36px; padding: 0 14px; border-radius: 20px; background: transparent; border: 1px solid var(--line);
  box-shadow: inset 0 -2px 4px rgba(0, 0, 0, 0.25); font-size: 14px; font-weight: 500;
}
[data-theme='light'] .pill-field { box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12); background: #fff; }
.pill-field input, .pill-field select { background: transparent; border: 0; outline: none; font-size: 14px; font-weight: 500; min-width: 0; }
.pill-field select { appearance: none; -webkit-appearance: none; padding-right: 18px; cursor: pointer; background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%23999' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E") right center no-repeat; }
.pill-field select option { color: #000; }
.pill-field.search { width: 210px; }
.pill-field.supplier { position: relative; width: 170px; }
.pill-field.supplier input { width: 100%; }
.pill-field.supplier input::placeholder { color: var(--text); opacity: 1; }
.suggest { position: absolute; top: calc(100% + 6px); left: 0; z-index: 40; min-width: 100%; margin: 0; padding: 4px; list-style: none; background: var(--surface-solid); border: 1px solid var(--card-border); border-radius: 10px; box-shadow: var(--shadow-lg); }
.suggest li { padding: 8px 12px; border-radius: 6px; font-size: 14px; cursor: pointer; }
.suggest li:hover, .suggest li.on { background: var(--row-hover); }
.pill-field.search input { width: 100%; }
.pill-field.search input::placeholder { color: var(--text); opacity: 1; }
.pill-field.search .icon { font-size: 16px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px; height: 40px; padding: 0 26px; border-radius: 22px; border: 1px solid rgba(255, 255, 255, 0.25);
  background: var(--gold-btn); color: #fff; font-family: var(--font-display); font-weight: 600; font-size: 15px; box-shadow: 0 2px 4px rgba(0, 0, 0, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.25);
}
.btn:hover:not(:disabled) { filter: brightness(1.12); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn .icon { font-size: 16px; }
.btn.ghost { background: transparent; border-color: transparent; box-shadow: none; color: var(--text); padding: 0 18px; }
.btn.danger { background: linear-gradient(90deg, #8f1f2c, #d93642 60%, #8f1f2c); }
.btn.small { height: 34px; padding: 0 18px; font-size: 14px; }
.btn.round { width: 40px; padding: 0; border-radius: 50%; }
.icon-btn { background: none; border: 0; padding: 6px; font-size: 18px; display: inline-grid; place-items: center; border-radius: 6px; }
.icon-btn:hover { background: var(--row-hover); }
.icon-btn.send-anyway { color: var(--ok); }
.icon-btn.resume { color: var(--gold); }
.icon-btn.retry { color: var(--bad); }
.icon-btn.resend { color: var(--warn); }

/* ---- tabelas --------------------------------------------------------- */
.table-wrap { display: flex; flex-direction: column; flex: 1 1 0; min-height: 0; overflow: hidden; border-radius: 13px; background: var(--surface); border: 1px solid var(--card-border); }
.table-scroll { flex: 1 1 0; min-height: 0; overflow: hidden; }
table.data { width: 100%; border-collapse: collapse; }
table.data thead th {
  background: var(--table-head); color: var(--table-head-text); font-family: var(--font-body); font-weight: 700; font-size: 13px; text-transform: uppercase; padding: 22px 12px; text-align: center; white-space: nowrap;
}
table.data tbody td { text-align: center; padding: 0 12px; height: 56px; font-size: 13px; border-top: 4px solid transparent; background-clip: padding-box; background-color: var(--row); }
table.data tbody tr:nth-child(even) td { background-color: var(--row-alt); }
table.data tbody tr.clickable { cursor: pointer; }
table.data tbody tr.clickable:hover td { background-color: var(--row-hover); }
table.data td.strong { font-weight: 700; }
table.data td.pid { font-size: 12px; font-weight: 500; color: var(--text-muted, inherit); white-space: nowrap; }
table.data td.num { font-style: italic; }
table.data td .actions { display: inline-flex; gap: 6px; justify-content: center; align-items: center; }
table.data td.state { font-weight: 600; }
.tone-ok { color: var(--ok); }
.tone-warn { color: var(--warn); }
.tone-bad { color: var(--bad); }
.tone-muted { color: var(--text-muted); }
.table-foot { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 14px 22px; font-size: 15px; flex-wrap: wrap; }
.pager { display: flex; align-items: center; gap: 6px; }
.pager button { background: none; border: 0; min-width: 32px; height: 32px; border-radius: 16px; font-size: 14px; display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 0 8px; }
.pager button[aria-current='page'] { background: var(--gold); color: #fff; font-weight: 600; }
.pager button:disabled { color: var(--text-faint); cursor: default; }
.pager button:hover:not(:disabled):not([aria-current='page']) { background: var(--row-hover); }
.empty-state { padding: 60px 20px; text-align: center; color: var(--text-muted); }
.loading-line { height: 3px; background: var(--gold-grad); background-size: 200% 100%; animation: slide 1s linear infinite; border-radius: 2px; }
@keyframes slide { to { background-position: -200% 0; } }

/* ---- dashboard ------------------------------------------------------- */
.kpi-grid { display: grid; grid-template-columns: minmax(280px, 1.28fr) repeat(3, minmax(0, 1fr)); gap: 18px; align-items: start; height: clamp(190px, 31vh, 317px); }
.kpi-grid.four { height: clamp(140px, 21vh, 190px); }
.kpi-grid.four > .kpi { height: 100%; }
.kpi-grid.four { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.kpi {
  position: relative; min-height: 0; padding: clamp(10px,2vh,22px) 22px 12px; border-radius: 12.7px; background: var(--kpi-bg); border: 1px solid var(--card-border); overflow: hidden; display: flex; flex-direction: column;
}
[data-theme='light'] .kpi { border-color: transparent; }
.kpi h3 { font-family: var(--font-display); font-weight: 700; font-size: clamp(15px,1.15vw,20px); line-height: 1.25; }
.kpi .figure { display: flex; align-items: center; gap: 18px; margin-top: 8px; }
.kpi .value { font-family: var(--font-display); font-weight: 700; font-size: clamp(32px, 5.2vh, 51px); line-height: 1; }
.kpi .change { display: inline-flex; align-items: center; gap: 6px; font-family: var(--font-display); font-size: 17px; }
.kpi .change .icon { font-size: 20px; color: var(--gold); }
.kpi .spark { margin-top: auto; flex: 1 1 0; min-height: 0; width: 100%; max-height: 78px; }

.chart-block { padding: 8px 6px 0; }
.chart-block h3 { font-family: var(--font-display); font-weight: 700; font-size: clamp(18px, 2.4vh, 26px); }
.chart-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.chart-block p.sub { font-family: var(--font-display); font-size: 13px; margin-top: 4px; }
.chart-card { padding: clamp(10px,1.8vh,22px) 26px clamp(8px,1.4vh,18px); background: var(--surface); border: 1px solid var(--card-border); border-radius: 13px; box-shadow: var(--shadow); }
.chart-card { display: flex; flex-direction: column; min-height: 0; }
.chart-card.grow-y { flex: 1 1 0; }
.hbars { margin-top: 10px; display: grid; grid-template-columns: max-content 1fr; flex: 1 1 0; min-height: 0; }
.hbars .lbl { grid-column: 1; text-align: right; padding: 0 8px 0 0; display: flex; align-items: center; justify-content: flex-end; color: var(--chart-label); font-size: clamp(12px, 1.6vh, 15px); white-space: nowrap; max-width: 320px; overflow: hidden; text-overflow: ellipsis; }
.hbars .plot-bg { grid-column: 2; position: relative; border-left: 1.3px solid var(--chart-grid); border-top: 1px dashed var(--chart-grid); }
.hbars .plot-bg::before { content: ''; position: absolute; inset: 0; background: repeating-linear-gradient(90deg, transparent 0, transparent calc(var(--step) - 1px), var(--chart-grid) calc(var(--step) - 1px), var(--chart-grid) var(--step)); opacity: 0.8; mask: repeating-linear-gradient(0deg, #000 0 4px, transparent 4px 8px); -webkit-mask: repeating-linear-gradient(0deg, #000 0 4px, transparent 4px 8px); }
.hbars .row { grid-column: 2; position: relative; border-bottom: 1px dashed var(--chart-grid); display: flex; align-items: center; min-height: 0; }
.hbars .row .bar { height: clamp(8px, 1.6vh, 14px); background: linear-gradient(90deg, #5b3d21, #986f32 60%, #a47835); border-radius: 0 2px 2px 0; min-width: 2px; transition: width 0.5s; }
.hbars .row .val { margin-left: 14px; font-size: 13px; color: var(--chart-label); }
.hbars .axis { grid-column: 2; display: flex; justify-content: space-between; padding-top: 6px; color: var(--chart-label); font-size: clamp(12px, 1.6vh, 15px); }
.chart-note { margin-top: 8px; font-size: 13px; color: var(--text-muted); }

/* ---- configuração ---------------------------------------------------- */
.seg { display: inline-flex; padding: 4px; border-radius: 25px; border: 1px solid var(--line); background: rgba(0, 0, 0, 0.25); }
[data-theme='light'] .seg { background: #fff; }
.seg button { background: none; border: 0; padding: 8px 22px; border-radius: 22px; font-size: 13px; font-weight: 500; }
.seg button[aria-selected='true'] { background: var(--gold-btn); color: #fff; font-weight: 700; box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.25); }
.settings-card { padding: clamp(16px,3vh,32px) 36px clamp(14px,2.5vh,28px); flex: 1 1 0; min-height: 0; display: flex; flex-direction: column; }
.settings-card h3 { font-family: var(--font-display); font-weight: 700; font-size: 30px; }
.settings-card .sub { font-size: 16px; color: var(--text-muted); margin-top: 2px; }
.settings-card .form { margin-top: 34px; display: grid; gap: 18px; }
.settings-card .foot { margin-top: auto; display: flex; justify-content: flex-end; align-items: center; gap: 14px; padding-top: 28px; }
.field { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.field > label, .field > .label { font-size: 16px; }
.input, .select {
  width: 100%; height: 40px; padding: 0 14px; border-radius: 6px; background: var(--field); border: 1px solid transparent; outline: none; font-size: 14px;
}
.input:focus, .select:focus { border-color: var(--gold); }
.input[readonly] { color: var(--text-muted); }
.input.big, .select.big { height: 56px; font-size: 24px; padding: 0 22px; }
.select { appearance: none; -webkit-appearance: none; padding-right: 36px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='7' viewBox='0 0 12 7'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%23aaa' stroke-width='1.8' fill='none' stroke-linecap='round'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 14px center; }
.select option { color: #000; }
.input.invalid { border-color: var(--bad); }
.row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.row-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 18px; }
.row-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }
.contact { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 50px; padding: 0 18px; border-radius: 6px; background: var(--field); box-shadow: inset 0 0 0 1px var(--field-border); }
.contact + .contact { margin-top: 12px; }
.contact .addr { font-size: 16px; overflow: hidden; text-overflow: ellipsis; }
.contact .addr b { color: var(--gold); font-weight: 500; }
.contact .addr small { color: var(--text-muted); margin-left: 8px; }
.contact .side { display: flex; align-items: center; gap: 14px; flex: none; }
.toggle {
  position: relative; width: 114px; height: 26px; border-radius: 13px; border: 0; color: #fff; font-size: 12px; font-weight: 500; padding: 0 14px; text-align: left;
  background: #12744b; box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.4);
}
.toggle::after { content: ''; position: absolute; top: 2px; right: 3px; width: 50px; height: 22px; border-radius: 11px; background: rgba(255, 255, 255, 0.12); border: 1px solid rgba(255, 255, 255, 0.3); }
.toggle[aria-checked='false'] { background: #c8283a; text-align: right; }
.toggle[aria-checked='false']::after { right: auto; left: 3px; }
.circle-btn { width: 28px; height: 28px; border-radius: 50%; border: 1px solid var(--line); background: rgba(255, 255, 255, 0.08); display: grid; place-items: center; font-size: 13px; padding: 0; }
.add-row { display: flex; justify-content: space-between; align-items: flex-start; gap: 20px; }

/* ---- modais ---------------------------------------------------------- */
.overlay { position: fixed; inset: 0; z-index: 100; background: rgba(0, 0, 0, 0.62); display: grid; place-items: center; padding: 20px; animation: fade 0.15s; backdrop-filter: blur(2px); }
@keyframes fade { from { opacity: 0; } }
.modal { width: min(710px, 100%); max-height: calc(100vh - 40px); display: flex; flex-direction: column; background: var(--modal-bg); border-radius: 14px; overflow: hidden; box-shadow: var(--shadow-lg); border: 1px solid var(--card-border); }
.modal.wide { width: min(900px, 100%); }
.modal.narrow { width: min(520px, 100%); }
.modal header { display: flex; align-items: center; gap: 16px; padding: 22px 28px; background: var(--modal-head); color: #fff; flex: none; }
.modal header .ico { width: 44px; height: 44px; border-radius: 50%; border: 1px solid rgba(255, 255, 255, 0.35); display: grid; place-items: center; font-size: 20px; background: rgba(0, 0, 0, 0.25); }
.modal header h3 { font-family: var(--font-display); font-weight: 700; font-size: 26px; line-height: 1.15; }
.modal header p { font-size: 14px; opacity: 0.85; }
.modal header .grow { flex: 1; min-width: 0; }
.modal header .close { background: none; border: 0; color: #fff; font-size: 26px; padding: 4px; }
.modal .body { padding: 26px 30px 8px; overflow: auto; display: flex; flex-direction: column; gap: 20px; }
.modal .body > * { flex: none; }
.modal footer { display: flex; align-items: center; justify-content: flex-end; gap: 14px; padding: 18px 30px 24px; flex: none; flex-wrap: wrap; }
.modal footer .spacer { margin-right: auto; display: flex; gap: 12px; flex-wrap: wrap; }
.section-title { font-family: var(--font-display); font-weight: 600; font-size: 18px; padding-bottom: 6px; border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: 10px; }
.section-title .count { background: var(--table-head); color: #fff; border-radius: 10px; font-size: 12px; padding: 1px 8px; font-family: var(--font-body); }
.modal .field > label { font-size: 15px; }
.modal .input, .modal .select { height: 38px; font-size: 14px; }
[data-theme='light'] .modal .input, [data-theme='light'] .modal .select { background: #f4f4f4; }
.callout { padding: 14px 16px; border-radius: 8px; border-left: 4px solid var(--bad); background: rgba(217, 54, 66, 0.1); font-size: 14px; display: grid; gap: 4px; }
.callout.info { border-color: var(--gold); background: rgba(152, 111, 50, 0.12); }
.callout b { font-weight: 600; }
.mat-box { position: relative; }
.mat-wrap { overflow: auto; border-radius: 8px; max-height: 320px; }
table.mat { border-collapse: collapse; table-layout: fixed; font-size: 13px; }
table.mat th { position: sticky; top: 0; z-index: 1; background: var(--table-head); color: #fff; padding: 12px 14px 12px 8px; font-size: 11px; text-transform: uppercase; overflow: hidden; text-overflow: ellipsis; }
table.mat th.sel { padding: 0; }
table.mat th .grip { position: absolute; top: 0; right: 0; width: 10px; height: 100%; cursor: col-resize; touch-action: none; }
table.mat th .grip::after { content: ''; position: absolute; top: 25%; bottom: 25%; right: 4px; width: 1px; background: rgba(255, 255, 255, 0.4); }
table.mat th .grip:hover::after { background: #fff; }
table.mat td { padding: 4px; border-bottom: 1px solid var(--line); }
table.mat td .input { height: 32px; font-size: 13px; padding: 0 8px; }
table.mat td.no { text-align: center; }
.col-toggle { display: grid; place-items: center; width: 100%; height: 40px; padding: 0; background: none; border: 0; color: #fff; font-size: 18px; }
.col-toggle[aria-expanded='true'] .icon { transform: rotate(180deg); }
.col-panel { position: absolute; top: 46px; right: 0; z-index: 20; width: 262px; max-height: 371px; overflow: auto; padding: 8px 6px 10px; border-radius: 12px; background: var(--pop-bg); border: 1px solid var(--card-border); box-shadow: var(--shadow-lg); }
.col-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.col-act { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 8px 4px; border: 0; border-radius: 10px; background: var(--pop-card); font-size: 13px; font-weight: 500; line-height: 1.2; text-align: center; }
.col-act .icon { font-size: 18px; color: var(--ok); }
.col-act.bad .icon { color: var(--bad); }
.col-act:hover { background: var(--row-hover); }
.col-list { display: grid; gap: 2px; margin-top: 10px; padding: 0 6px; }
.col-item { display: flex; align-items: center; gap: 10px; padding: 7px 2px; font-size: 14px; cursor: pointer; }
.col-item input { width: 16px; height: 16px; accent-color: var(--gold); }
.timeline { display: grid; gap: 0; max-height: 240px; overflow: auto; }
.timeline .ev { display: grid; grid-template-columns: 150px 52px 1fr; gap: 12px; padding: 8px 4px; border-bottom: 1px solid var(--line); font-size: 13px; }
.timeline .ev time { color: var(--text-muted); }
.timeline .ev .by { color: var(--gold-soft); font-size: 12px; }
[data-theme='light'] .timeline .ev .by { color: var(--gold); }
.file-row { display: flex; align-items: center; gap: 14px; padding: 12px 16px; border-radius: 8px; border: 1px solid var(--line); }
.file-row .grow { flex: 1; min-width: 0; }
.file-row strong { display: block; font-size: 14px; overflow: hidden; text-overflow: ellipsis; }
.file-row small { color: var(--text-muted); }
.inline-form { display: grid; grid-template-columns: 1fr 1fr auto; gap: 12px; align-items: end; }
.kv { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px 18px; font-size: 14px; }
.kv dt { font-size: 12px; color: var(--text-muted); }
.kv dd { margin: 0; word-break: break-word; }
.link-btn { background: none; border: 0; padding: 0; text-decoration: underline; color: var(--gold-soft); font-size: 14px; }
[data-theme='light'] .link-btn { color: var(--gold); }

/* ---- toasts e confirmação -------------------------------------------- */
.toasts { position: fixed; right: 24px; bottom: 24px; z-index: 200; display: grid; gap: 10px; }
.toast { padding: 14px 18px; border-radius: 10px; background: var(--surface-solid); border: 1px solid var(--card-border); border-left: 4px solid var(--gold); box-shadow: var(--shadow-lg); max-width: 380px; font-size: 14px; animation: fade 0.2s; }
.toast.error { border-left-color: var(--bad); }
.toast.ok { border-left-color: var(--ok); }

/* ---- login ----------------------------------------------------------- */
.auth { position: relative; z-index: 1; height: 100vh; overflow: hidden; display: grid; place-items: center; padding: 24px; }
.auth .theme-btn { position: absolute; top: 28px; right: 36px; }
.auth-card {
  width: min(494px, 100%); padding: 50px 60px 56px; border-radius: 14px; background: rgba(40, 32, 24, 0.55); backdrop-filter: blur(10px); border: 1px solid var(--card-border); box-shadow: var(--shadow-lg);
  display: grid; gap: 26px; justify-items: center;
}
[data-theme='light'] .auth-card { background: rgba(255, 255, 255, 0.85); }
.auth-card .logo { height: 62px; width: auto; }
.auth-card h1 { font-family: var(--font-display); font-weight: 700; font-size: 26px; text-align: center; }
.auth-card p.hint { text-align: center; color: var(--text-muted); font-size: 14px; margin-top: -14px; }
.auth-card form { width: 100%; display: grid; gap: 18px; }
.input-icon { position: relative; }
.input-icon .lead { position: absolute; left: 18px; top: 50%; transform: translateY(-50%); font-size: 18px; color: var(--gold); }
.input-icon .trail { position: absolute; right: 12px; top: 50%; transform: translateY(-50%); background: none; border: 0; font-size: 18px; padding: 4px; }
.input-icon .input { height: 56px; padding-left: 58px; padding-right: 48px; font-size: 16px; border-radius: 8px; background: rgba(255, 255, 255, 0.08); }
[data-theme='light'] .input-icon .input { background: #f1f1f1; }
.auth-card .btn { height: 56px; width: 100%; border-radius: 8px; font-size: 19px; }
.auth-card .error { color: #ff8b95; font-size: 14px; text-align: center; min-height: 18px; }
[data-theme='light'] .auth-card .error { color: var(--bad); }
.auth-card .forgot { font-size: 13px; text-decoration: none; }
.auth-card .forgot:hover { text-decoration: underline; }

/* ---- responsivo ------------------------------------------------------ */
@media (max-width: 1280px) {
  .shell { grid-template-columns: 76px minmax(0, 1fr); }
  .sidebar { padding: 20px 10px; align-items: center; }
  .sidebar .brand, .nav a span.label, .calendar { display: none; }
  .nav a { padding: 6px; }
  .kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .kpi-grid.four { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .greeting h1 { font-size: 26px; }
}
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }
table.data td.final { max-width: 260px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
