/* As cores do painel acompanham o verde da marca e as preferências claro/escuro. */
:root {
  color-scheme: light;
  --bg: #f4f6f1; --paper: #fff; --sub: #f8f9f5; --ink: #172b25; --muted: #586c63;
  --line: #dce4d9; --line-strong: #aab9ac; --brand: #195841; --accent: #cce88b;
  --high: #eef6dc; --danger: #9a352c; --warn: #855b18; --warn-bg: #fbf0d9;
  --rail: #123d34; --rail-sub: #c6d9ce; --rail-active: #2b5447;
  --shadow: 0 12px 36px rgba(31, 56, 38, .07);
  font: 15px/1.5 "Segoe UI", system-ui, sans-serif;
  background: var(--bg); color: var(--ink);
}
:root[data-tema=escuro] {
  color-scheme: dark; --bg: #101b19; --paper: #1b2824; --sub: #202f29; --ink: #edf4e9;
  --muted: #b0c3b8; --line: #35453d; --line-strong: #617368; --brand: #a9d7ad;
  --high: #284334; --danger: #ffaea2; --warn: #f3cd80; --warn-bg: #423924; --rail: #0b2923;
}
* { box-sizing: border-box; }
[hidden] { display:none !important; }
body { margin: 0; min-width: 280px; }
button,input,select { font: inherit; color: inherit; }
button,select { cursor: pointer; }
button,a,input,select { -webkit-tap-highlight-color: transparent; }
a { color: var(--brand); }
:focus-visible { outline: 3px solid #8bb851; outline-offset: 3px; }
h1,h2,h3,p,figure,dl,dd { margin: 0; }
h1,h2,h3 { line-height: 1.18; text-wrap: balance; }
h1 { font-size: clamp(30px, 3.4vw, 46px); font-weight: 660; letter-spacing: -.055em; }
h2 { font-size: 22px; font-weight: 650; letter-spacing: -.035em; }
h3 { font-size: 17px; font-weight: 650; letter-spacing: -.02em; }
button { border: 0; }
button:disabled { cursor: wait; opacity: .58; }
.ico { width: 20px; height: 20px; flex: 0 0 auto; }
.skip { position: absolute; left: 12px; top: -100px; z-index: 20; background: var(--paper); padding: 8px 14px; }
.skip:focus { top: 10px; }
.entry { min-height: 100svh; display:grid; place-items:center; padding:clamp(18px,4.4vw,72px); }
.entry-box { display:grid; grid-template-columns: 1fr .94fr; overflow:hidden; max-width:1060px; width:100%; min-height:600px; background:var(--paper); border:1px solid var(--line); border-radius:20px; box-shadow:var(--shadow); }
.entry-left { display:flex; flex-direction:column; padding:44px clamp(30px,4.5vw,68px); }
.brand,.rail-brand { display:flex; align-items:center; gap:12px; }
.brand b,.rail-brand b { font-size:26px; line-height:1; letter-spacing:-.055em; }
.brand img,.rail-brand img { border-radius:12px; }
.entry-form { margin:auto 0; padding:48px 0 24px; }
.entry-form h1 { font-size:clamp(33px,3.2vw,44px); max-width:14ch; }
.entry-form>p:not(.feedback) { color:var(--muted); margin:14px 0 25px; max-width:38ch; }
.entry-form form, .form-stack { display:grid; gap:17px; }
label { display:grid; gap:6px; font-size:14px; font-weight:620; }
input,select { min-width:0; width:100%; background:var(--paper); border:1px solid var(--line-strong); border-radius:8px; min-height:44px; padding:9px 12px; font-weight:400; }
input::placeholder { color:var(--muted); }
input[readonly] { background:var(--sub); }
.primary,.secondary,.outline-danger { display:inline-flex; align-items:center; justify-content:center; gap:9px; padding:10px 16px; border-radius:9px; font-weight:620; min-height:42px; font-size:14px; text-decoration:none; }
.primary { background:#1e6347; color:white; border:1px solid #1e6347; }
.primary:hover { background:#174f38; }
.secondary,.outline-danger { border:1px solid var(--line-strong); color:var(--ink); background:var(--paper); }
.secondary:hover,.close:hover { background:var(--sub); }
.outline-danger { color:var(--danger); border-color:currentColor; }
.text-action { color:var(--brand); background:none; padding:8px 3px; font-size:14px; font-weight:600; }
.fill { width:100%; margin-top:5px; }
.field-photo { position:relative; background:var(--rail); }
.field-photo img { height:100%; width:100%; position:absolute; object-fit:cover; filter:saturate(.9); }
.field-photo figcaption { position:absolute; right:12px; bottom:12px; font-size:10px; color:white; background:#16342cdb; border-radius:5px; padding:3px 8px; }
.feedback { color:var(--muted); font-size:14px; margin:14px 0; overflow-wrap:anywhere; }
.feedback:empty { display:none; }
.feedback[data-tipo=erro] { color:var(--danger); }
.console { min-height:100svh; display:grid; grid-template-columns:222px minmax(0,1fr); }
.sidebar { position:sticky; top:0; min-height:100svh; max-height:100svh; overflow:auto; display:flex; flex-direction:column; padding:32px 16px 20px; color:white; background:var(--rail); }
.rail-brand { margin:0 12px 42px; }
.rail-brand span { display:block; font-size:12px; color:var(--rail-sub); margin-top:4px; letter-spacing:.02em; }
.sidebar nav { display:grid; gap:5px; }
.sidebar nav a,.rail-end button { display:flex; align-items:center; gap:11px; color:var(--rail-sub); background:transparent; font-size:14px; font-weight:540; text-decoration:none; padding:12px 14px; border-radius:9px; }
.sidebar nav a:hover,.rail-end button:hover { background:var(--rail-active); }
.sidebar nav a[aria-current=page] { color:white; background:var(--rail-active); font-weight:660; }
.sidebar nav a[aria-current=page] svg { color:var(--accent); }
.rail-end { display:grid; margin-top:auto; border-top:1px solid #ffffff26; padding-top:10px; }
.main-zone { min-width:0; }
.top-bar { min-height:68px; padding:12px clamp(18px,4vw,65px); display:flex; align-items:center; justify-content:space-between; gap:12px; background:var(--paper); border-bottom:1px solid var(--line); color:var(--muted); font-size:14px; }
.account { display:flex; align-items:center; gap:9px; min-width:0; }
.account strong { font-weight:600; max-width:24ch; overflow:hidden; text-overflow:ellipsis; }
.account .text-action { margin-left:8px; }
#conteudo { max-width:1450px; margin:0 auto; padding:clamp(22px,4vw,60px); }
.page-head,.section-head,.actions,.dialog-head,.filterbar { display:flex; align-items:center; gap:12px; }
.page-head { justify-content:space-between; flex-wrap:wrap; margin-bottom:26px; }
.section-head { justify-content:space-between; flex-wrap:wrap; padding:20px 22px; }
.section-head h2 { font-size:18px; }
.actions { flex-wrap:wrap; }
.stat-grid { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:14px; margin-bottom:24px; }
.stat,.card { background:var(--paper); border:1px solid var(--line); border-radius:14px; }
.stat { padding:18px 20px; display:grid; grid-template-columns:1fr auto; align-items:center; gap:6px; min-width:0; }
.stat .ico { color:var(--brand); width:20px; height:20px; }
.stat small { color:var(--muted); font-size:13px; }
.stat b { font-weight:640; letter-spacing:-.055em; font-size:32px; }
.card { overflow:hidden; margin-bottom:20px; }
.filterbar { padding:15px 20px; background:var(--sub); border-bottom:1px solid var(--line); flex-wrap:wrap; }
.filterbar label { flex:1 1 155px; max-width:360px; font-size:12px; }
.filterbar input,.filterbar select { min-height:39px; padding:7px 10px; font-size:14px; }
.table-wrap { overflow:auto; }
table { width:100%; border-collapse:collapse; text-align:left; font-size:14px; }
th,td { border-bottom:1px solid var(--line); padding:14px 18px; vertical-align:middle; }
tr:last-child td { border-bottom:0; }
th { font-size:12px; font-weight:600; color:var(--muted); background:var(--sub); white-space:nowrap; }
td { overflow-wrap:anywhere; }
td small,.muted,.help { color:var(--muted); }
td small { display:block; margin-top:2px; font-size:12px; }
td a { font-weight:630; text-underline-offset:3px; }
td .text-action { margin-right:8px; }
.badge { display:inline-flex; align-items:center; gap:6px; border-radius:20px; background:var(--sub); border:1px solid var(--line); color:var(--muted); padding:3px 9px; font-size:12px; line-height:1.4; font-weight:600; white-space:nowrap; }
.badge::before { content:''; width:6px; height:6px; border-radius:100%; background:currentColor; }
.badge[data-tone=ok] { background:var(--high); color:var(--brand); }
.badge[data-tone=attention] { background:var(--warn-bg); color:var(--warn); }
.badge[data-tone=error] { color:var(--danger); }
.empty { min-height:150px; display:grid; align-content:center; justify-items:center; gap:10px; padding:22px; text-align:center; }
.empty .ico { color:var(--brand); width:28px; height:28px; }
.empty p,.help { font-size:14px; color:var(--muted); }
.block { padding:0 22px 22px; }
dl.info { display:grid; grid-template-columns:minmax(124px,.8fr) minmax(0,1.5fr); margin:0; }
dl.info dt,dl.info dd { padding:11px 0; border-bottom:1px solid var(--line); }
dl.info dt { color:var(--muted); font-size:14px; }
dl.info dd { font-weight:560; overflow-wrap:anywhere; }
dl.info dt:last-of-type,dl.info dd:last-child { border-bottom:0; }
.grid-two { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:16px; }
.grid-two .card { margin-bottom:16px; }
.back { display:inline-block; margin-bottom:16px; color:var(--brand); font-size:14px; }
dialog { width:min(450px,calc(100% - 28px)); max-height:calc(100dvh - 36px); color:var(--ink); background:var(--paper); border:1px solid var(--line); border-radius:15px; padding:24px; box-shadow:var(--shadow); }
dialog::backdrop { background:rgba(7,25,19,.57); }
.dialog-head { justify-content:space-between; margin-bottom:18px; }
.close { color:inherit; background:var(--sub); font-size:24px; line-height:1; width:34px; height:34px; border-radius:8px; }
dialog .actions { justify-content:flex-end; margin-top:14px; }
dialog .form-stack .actions { margin:0; }
.output { width:100%; padding:12px; min-height:7rem; border:1px solid var(--line-strong); background:var(--sub); border-radius:8px; color:var(--ink); resize:vertical; font:14px/1.5 ui-monospace,monospace; }
@media(max-width:1000px) {
  .console { grid-template-columns:190px minmax(0,1fr); }
  .sidebar { padding-inline:10px; }
  #conteudo { padding:24px; }
  .grid-two { grid-template-columns:1fr; gap:0; }
  td,th { padding:12px; }
}
@media(max-width:720px) {
  .entry-box { grid-template-columns:1fr; max-width:450px; min-height:auto; }
  .entry-left { padding:28px; }
  .entry-form { padding:36px 0 0; }
  .field-photo { min-height:100px; }
  .console { display:block; }
  .sidebar { position:relative; min-height:auto; max-height:none; overflow:visible; display:grid; grid-template-columns:1fr auto; gap:10px; padding:13px 16px 8px; }
  .rail-brand { margin:0; }
  .rail-brand img { width:34px; height:34px; }
  .rail-brand b { font-size:21px; }
  .rail-brand span { display:inline; margin-left:8px; }
  .sidebar nav { grid-column:1/-1; display:flex; max-width:100%; overflow:auto; gap:3px; }
  .sidebar nav a { white-space:nowrap; font-size:13px; padding:9px 10px; }
  .sidebar nav .ico { display:none; }
  .rail-end { grid-row:1; grid-column:2; margin:0; padding:0; display:flex; border:0; }
  .rail-end button { font-size:12px; padding:5px 8px; }
  #tema span { display:none; }
  .top-bar { min-height:48px; padding:4px 16px; }
  #conteudo { padding:24px 16px; }
  .stat-grid { gap:7px; }
  .stat { padding:10px; display:block; }
  .stat b { display:block; font-size:24px; }
  .stat .ico { display:none; }
  .stat small { font-size:12px; }
  .page-head { margin-bottom:18px; }
  .section-head,.filterbar { padding:14px; }
  .block { padding:0 14px 14px; }
  .table-wrap table { min-width:580px; }
  .table-wrap { scrollbar-width:thin; }
  .account strong { max-width:14ch; }
}
@media(max-width:370px) {
  .rail-brand span,.account .ico { display:none; }
  .stat small { font-size:11px; }
  .sidebar { padding-inline:9px; }
  #conteudo { padding-inline:12px; }
  .entry { padding:12px; }
  .entry-left { padding:23px; }
}
@media(max-width:620px) {
  .sidebar nav { display:grid; grid-template-columns:repeat(4,minmax(0,1fr)); }
  .sidebar nav a { justify-content:center; padding:10px 2px; }
  .nav-extra { display:none; }
  .table-wrap table { min-width:0; }
  .table-wrap thead { position:absolute; width:1px; height:1px; overflow:hidden; clip-path:inset(50%); }
  .table-wrap tbody,.table-wrap tr { display:block; }
  .table-wrap tr { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); padding:14px; gap:12px; border-bottom:1px solid var(--line); }
  .table-wrap tr:last-child { border-bottom:0; }
  .table-wrap td { border:0; padding:0; }
  .table-wrap td:first-child,.table-wrap td[data-coluna="Ações"] { grid-column:1/-1; }
  .table-wrap td::before { content:attr(data-coluna); display:block; color:var(--muted); font-size:11px; margin-bottom:2px; }
}
@media(prefers-reduced-motion:no-preference) {
  button,a { transition:background-color .15s ease; }
}
