:root {
    --navy: #10243e;
    --blue: #1769e0;
    --blue-soft: #e9f2ff;
    --green: #16845b;
    --red: #c53d4d;
    --amber: #ba7410;
    --ink: #172033;
    --muted: #687386;
    --line: #dfe5ec;
    --surface: #ffffff;
    --background: #f3f6f9;
    --shadow: 0 8px 24px rgba(25, 42, 70, .08);
}

* { box-sizing: border-box; }
body { margin: 0; color: var(--ink); background: var(--background); font: 15px/1.45 Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif; }
button, input, select, textarea { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }

.topbar { min-height: 72px; padding: 12px clamp(18px, 4vw, 56px); display: flex; align-items: center; justify-content: space-between; gap: 24px; color: #fff; background: var(--navy); }
.brand { display: flex; align-items: center; gap: 12px; color: inherit; text-decoration: none; }
.brand-mark { width: 42px; height: 42px; display: grid; place-items: center; border-radius: 13px; color: var(--navy); background: #fff; font-size: 23px; font-weight: 900; }
.brand strong, .brand small { display: block; }
.brand small { margin-top: 1px; color: #bfcde0; font-size: 11px; letter-spacing: .08em; text-transform: uppercase; }
.top-actions { display: flex; align-items: center; gap: 18px; }
.top-actions a { color: #dce7f5; text-decoration: none; font-size: 13px; font-weight: 700; }
.top-actions a:hover { color: #fff; }
.top-actions form { margin: 0; }
.user-name { color: #dce7f5; }
.link-button { padding: 8px 0; border: 0; color: #fff; background: none; cursor: pointer; font-weight: 700; }

main { padding-bottom: 48px; }
.page-header { padding: 32px clamp(18px, 4vw, 56px) 22px; display: flex; align-items: end; justify-content: space-between; gap: 24px; }
.page-header.compact { max-width: 1180px; margin: auto; }
h1, h2, h3, p { margin-top: 0; }
h1 { margin-bottom: 5px; font-size: clamp(27px, 4vw, 40px); letter-spacing: -.035em; }
.eyebrow { margin-bottom: 6px; color: var(--blue); font-size: 12px; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; }
.muted { margin-bottom: 0; color: var(--muted); }

.company-picker { display: grid; gap: 5px; min-width: 220px; }
.company-picker label { color: var(--muted); font-size: 12px; font-weight: 700; }
select, input, textarea { width: 100%; border: 1px solid #cbd4df; border-radius: 9px; color: var(--ink); background: #fff; }
select, input { min-height: 42px; padding: 8px 11px; }
textarea { padding: 10px 11px; resize: vertical; }
select:focus, input:focus, textarea:focus { outline: 3px solid rgba(23, 105, 224, .15); border-color: var(--blue); }

.messages { padding: 14px clamp(18px, 4vw, 56px) 0; }
.message { max-width: 840px; margin: 0 auto 8px; padding: 12px 16px; border: 1px solid #b7d5c8; border-radius: 10px; color: #105c3f; background: #eaf8f1; }
.message.error { border-color: #efbdc3; color: #872b36; background: #fff0f2; }
.message.warning { border-color: #ebd1a9; color: #75470a; background: #fff8e9; }

.board { padding: 0 clamp(18px, 4vw, 56px); display: grid; grid-template-columns: repeat(4, minmax(270px, 1fr)); gap: 16px; align-items: start; overflow-x: auto; }
.board-column { min-height: 360px; border: 1px solid var(--line); border-radius: 15px; background: #e9eef4; }
.column-header { padding: 15px 16px; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--line); }
.column-header h2 { margin: 0; font-size: 14px; letter-spacing: .04em; text-transform: uppercase; }
.counter { min-width: 28px; height: 28px; padding: 0 8px; display: grid; place-items: center; border-radius: 20px; color: var(--muted); background: #fff; font-size: 12px; font-weight: 800; }
.column-body { padding: 10px; display: grid; gap: 10px; }

.order-card, .delivery-card { border: 1px solid var(--line); border-radius: 12px; background: var(--surface); box-shadow: 0 2px 8px rgba(25, 42, 70, .04); }
.order-card { padding: 14px; }
.order-head { display: flex; align-items: start; justify-content: space-between; gap: 10px; }
.order-head strong, .order-head time { display: block; }
.order-head time { margin-top: 2px; color: var(--muted); font-size: 12px; }
.order-card h3 { margin: 14px 0 8px; font-size: 17px; }
.status { padding: 5px 8px; border-radius: 20px; color: #3b526d; background: #edf2f7; font-size: 10px; font-weight: 800; letter-spacing: .04em; text-transform: uppercase; white-space: nowrap; }
.status-confirmado, .status-novo { color: #1253a5; background: #e6f0ff; }
.status-em_separacao { color: #885205; background: #fff0cf; }
.status-pronto { color: #14704e; background: #e4f6ee; }
.status-saiu_para_entrega { color: #5b3b9b; background: #eee8ff; }
.item-list { margin: 0 0 12px; padding: 10px 0; list-style: none; border-block: 1px solid #edf0f4; }
.item-list li + li { margin-top: 4px; }
.item-list.large { font-size: 17px; }
.order-details p { margin: 0 0 8px; }
.order-details span { display: block; color: var(--muted); font-size: 11px; font-weight: 700; text-transform: uppercase; }
.warning-text { color: var(--red); }
.issue-flag { margin: 10px 0; padding: 8px 10px; border-radius: 8px; color: #804d08; background: #fff1d2; font-size: 12px; font-weight: 700; }
.card-actions { margin-top: 12px; display: grid; gap: 8px; }
.card-actions form { margin: 0; }
.assign-form { display: grid; grid-template-columns: 1fr auto; gap: 7px; }

.button { min-height: 40px; padding: 9px 13px; display: inline-grid; place-items: center; border: 0; border-radius: 9px; text-decoration: none; cursor: pointer; font-weight: 750; }
.button.primary { color: #fff; background: var(--blue); }
.button.secondary { color: #28415f; background: #e8edf3; }
.button.success { color: #fff; background: var(--green); }
.button.danger { color: #fff; background: var(--red); }
.button.full { width: 100%; }
.button:hover { filter: brightness(.96); }
.empty-state { padding: 26px 14px; display: grid; gap: 6px; place-items: center; color: var(--muted); text-align: center; }

.delivery-grid { max-width: 1180px; margin: auto; padding: 0 clamp(18px, 4vw, 32px); display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 18px; }
.delivery-card { padding: 20px; box-shadow: var(--shadow); }
.delivery-card h2 { margin: 20px 0 8px; font-size: 22px; }
.delivery-card address { margin: 16px 0; padding-left: 15px; border-left: 3px solid var(--blue); font-style: normal; }
.delivery-card address small { margin-top: 8px; display: block; color: var(--muted); }
.payment-box { padding: 13px 15px; display: flex; justify-content: space-between; gap: 12px; border-radius: 10px; background: var(--blue-soft); }
.payment-box span { color: var(--muted); }
.note { margin: 14px 0 0; padding: 10px 12px; border-radius: 8px; background: #f6f7f9; }
.delivery-actions { margin-top: 18px; display: grid; gap: 10px; }
.delivery-actions form { margin: 0; }
.problem-box { padding: 10px 12px; border: 1px solid #efc4ca; border-radius: 9px; color: var(--red); }
.problem-box summary { cursor: pointer; font-weight: 750; }
.problem-box form { margin-top: 10px; display: grid; gap: 8px; }
.empty-state.wide { min-height: 260px; border: 1px dashed #bdc8d5; border-radius: 14px; background: #fff; }

.login-shell { min-height: calc(100vh - 72px); padding: 32px 18px; display: grid; place-items: center; background: radial-gradient(circle at top right, #dcecff 0, transparent 38%), var(--background); }
.login-card { width: min(100%, 420px); padding: clamp(24px, 5vw, 38px); border: 1px solid var(--line); border-radius: 18px; background: #fff; box-shadow: var(--shadow); }
.login-card h1 { font-size: 30px; }
.stack-form { margin-top: 24px; display: grid; gap: 8px; }
.stack-form label { margin-top: 7px; font-size: 13px; font-weight: 700; }
.stack-form .button { margin-top: 12px; }

@media (max-width: 900px) {
    .board { grid-template-columns: repeat(4, minmax(285px, 82vw)); padding-bottom: 16px; scroll-snap-type: x proximity; }
    .board-column { scroll-snap-align: start; }
    .page-header { align-items: start; flex-direction: column; }
}

@media (max-width: 560px) {
    .topbar { min-height: 64px; }
    .brand small, .user-name { display: none; }
    .brand-mark { width: 38px; height: 38px; }
    .page-header { padding-top: 24px; }
    .delivery-grid { grid-template-columns: 1fr; }
    .delivery-card { padding: 16px; }
}
