:root {
    color-scheme: light;
    --ink: #14202c;
    --muted: #536272;
    --edge: #dce2e9;
    --surface: #fff;
    --background: #f2f5f8;
    --orange: #ff782b;
    --dark: #131d27;
    font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
    color: var(--ink);
    background: var(--background);
}
* { box-sizing: border-box; }
body { margin: 0; display: grid; grid-template-columns: 245px minmax(0,1fr); min-height: 100vh; }
main { width: 100%; max-width: 1480px; padding: 36px clamp(16px,4vw,55px); margin: 0 auto; }
aside { background: var(--dark); padding: 32px 18px; color: white; display: flex; flex-direction: column; gap: 35px; }
.brand { color: white; text-decoration: none; display: grid; gap: 12px; padding: 0 8px; }
.brand img { background: white; border-radius: 8px; padding: 9px; width: 148px; }
.brand span { font-size: .88rem; color: #d1dae5; }
nav { display: grid; gap: 5px; }
nav a { color: #e2e9ef; padding: 11px 12px; border-radius: 7px; text-decoration: none; white-space: nowrap; }
nav a:hover, nav .selected { color: white; background: #2a3948; }
nav .selected { box-shadow: inset 3px 0 var(--orange); }
.logout { margin-top: auto; padding-left: 8px; }
h1, h2, h3, p { margin: 0 0 12px; }
h1 { font-size: clamp(1.6rem,3vw,2.2rem); line-height: 1.15; letter-spacing: -.035em; }
h2 { font-size: 1.16rem; margin-bottom: 16px; }
h3 { font-size: .98rem; margin-top: 18px; }
p, small { color: var(--muted); }
small { display: block; }
a { color: #115291; }
a:focus-visible, button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 3px solid #177cce; outline-offset: 2px; }
.page { display: flex; justify-content: space-between; align-items: flex-start; flex-wrap: wrap; gap: 14px; margin-bottom: 18px; }
.page p { margin-bottom: 0; }
.panel { background: var(--surface); border: 1px solid var(--edge); border-radius: 12px; padding: clamp(14px,2.5vw,23px); margin-bottom: 16px; min-width: 0; box-shadow: 0 2px 6px #15233308; }
.stats { display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); gap: 12px; }
.stat { border-top: 3px solid var(--orange); }
.stat strong { font-size: clamp(1.1rem,2vw,1.6rem); display: block; margin-top: 7px; overflow-wrap: anywhere; }
.stack { display: grid; gap: 13px; }
.stack > .panel { margin-bottom: 0; }
.bar { display: flex; flex-wrap: wrap; gap: 10px 14px; align-items: center; }
.filters { align-items: end; margin: 12px 0 18px; }
.actions { margin-bottom: 16px; }
.split { display: grid; grid-template-columns: minmax(240px,1fr) minmax(0,2fr); gap: 16px; align-items: start; }
.formgrid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 14px; }
label { display: grid; gap: 5px; min-width: 0; font-weight: 600; font-size: .88rem; }
input, select, textarea, button, .button { font: inherit; border-radius: 7px; }
input, select, textarea { padding: 9px 10px; border: 1px solid #b9c5d0; color: var(--ink); background: white; width: 100%; min-height: 42px; }
textarea { resize: vertical; }
button, .button { background: var(--orange); color: #151a20; padding: 9px 14px; min-height: 42px; border: 1px solid transparent; cursor: pointer; text-decoration: none; display: inline-flex; align-items: center; justify-content: center; font-weight: 700; }
button:hover, .button:hover { filter: brightness(.94); }
button:disabled { opacity: .5; cursor: default; }
.secondary { background: #eef2f6; border-color: #d1dbe4; color: #25364a; }
.check { display: flex; align-items: center; }
.check input { width: 18px; min-height: 18px; }
.scroll { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: .91rem; }
th, td { padding: 11px 10px; border-bottom: 1px solid #e6ebef; text-align: left; }
th { background: #f4f6f8; color: #405163; font-weight: 650; }
td small { margin-top: 4px; }
.badge { background: #ecf0f5; padding: 4px 8px; border-radius: 20px; font-size: .79rem; white-space: nowrap; }
.aprovado,.concluido { background: #dff4e6; color: #165535; }
.execucao,.enviado { background: #e1efff; color: #174d83; }
.cancelado { background: #ffe7e6; color: #8b2826; }
.line-item { display: grid; grid-template-columns: minmax(155px,3fr) minmax(80px,1fr) minmax(105px,1fr) minmax(60px,1fr) auto; align-items: end; gap: 10px; margin-bottom: 12px; padding-bottom: 10px; border-bottom: 1px solid var(--edge); }
.line-total { padding-bottom: 3px; }
output { font-weight: 700; display: block; }
.totals { justify-content: flex-end; margin-top: 15px; }
.multiline { white-space: pre-wrap; overflow-wrap: anywhere; }
.notice { background: #e0f3e8; color: #155335; border-radius: 8px; padding: 12px 16px; }
.error { background: #fce7e5; color: #881f1a; }
.guest { display: block; background: var(--dark); }
.guest main { max-width: 485px; padding-top: max(42px,10vh); }
.login img { width: min(200px,70%); display: block; margin-bottom: 18px; }
@media (max-width: 1000px) {
    body { grid-template-columns: 185px minmax(0,1fr); }
    .stats { grid-template-columns: repeat(2,minmax(0,1fr)); }
    .split { grid-template-columns: minmax(0,1fr); gap: 0; }
}
@media (max-width: 740px) {
    body { display: block; }
    aside { padding: 12px 16px; gap: 10px; display: grid; grid-template-columns: 1fr auto; align-items: center; }
    .brand img { width: 115px; }
    .brand span { display: none; }
    nav { grid-column: 1/-1; grid-row: 2; display: flex; overflow: auto; }
    .logout { margin: 0; }
    nav a { font-size: .89rem; }
    .line-item { grid-template-columns: repeat(2,minmax(0,1fr)) auto; }
    .line-item > label:first-of-type { grid-column: 1/-1; }
    .line-total { grid-column: 1/3; }
}
@media (max-width: 420px) { .formgrid { grid-template-columns: 1fr; } }
