*{box-sizing:border-box}
:root{
  --navy:#082b5c;
  --blue:#0b67e8;
  --blue2:#1685ff;
  --text:#0b2652;
  --muted:#637792;
  --line:#cdd9e9;
  --white:#fff;
}
html,body{margin:0;min-height:100%;font-family:Inter,system-ui,-apple-system,BlinkMacSystemFont,"Segoe UI",sans-serif;background:#061a35;color:var(--text)}
button,input{font:inherit}
.hidden{display:none!important}

.login-screen{
  min-height:100svh;
  position:relative;
  background-image:url("assets/background.png");
  background-size:cover;
  background-position:center center;
  overflow:hidden;
}
.background-overlay{
  position:absolute;inset:0;
  background:linear-gradient(90deg,rgba(3,20,45,.08) 0%,rgba(3,20,45,.03) 45%,rgba(3,20,45,.24) 100%),
             linear-gradient(0deg,rgba(2,15,35,.30) 0%,rgba(2,15,35,0) 45%);
  pointer-events:none;
}
.login-card{
  position:absolute;
  left:9.5%;
  top:50%;
  transform:translateY(-24%);
  width:min(390px,86vw);
  background:rgba(255,255,255,.96);
  border:1px solid rgba(255,255,255,.75);
  border-radius:24px;
  padding:26px 28px 22px;
  box-shadow:0 22px 65px rgba(0,20,55,.28);
  backdrop-filter:blur(8px);
}
.logo{
  display:block;
  width:126px;
  height:126px;
  object-fit:contain;
  margin:0 auto -2px;
}
.homolog-badge{
  display:table;
  margin:0 auto 13px;
  padding:7px 12px;
  border-radius:999px;
  background:#e2efff;
  color:#0870e8;
  font-weight:800;
  font-size:.78rem;
}
.login-card h1{
  margin:0;
  text-align:center;
  font-size:1.8rem;
  color:#092b5a;
  letter-spacing:-.02em;
}
.subtitle{
  margin:7px auto 19px;
  max-width:290px;
  text-align:center;
  color:var(--muted);
  line-height:1.5;
}
.form-panel label{
  display:block;
  margin:10px 0 6px;
  font-size:.92rem;
  color:#172f55;
  font-weight:700;
}
.field{
  height:50px;
  border:1px solid #c9d7e9;
  background:#fff;
  border-radius:12px;
  display:flex;
  align-items:center;
  gap:10px;
  padding:0 12px;
  box-shadow:inset 0 1px 2px rgba(20,45,80,.03);
}
.field:focus-within{
  border-color:#4f9bff;
  box-shadow:0 0 0 3px rgba(18,117,239,.10);
}
.field-icon{width:23px;color:#315d96;font-size:1rem;text-align:center}
.field input{
  border:0;outline:0;min-width:0;flex:1;
  color:#102c55;background:transparent;
}
.field input::placeholder{color:#9aa9bd}
.icon-button{
  border:0;background:transparent;color:#375f96;
  width:34px;height:34px;cursor:pointer;font-size:.95rem
}
.primary-btn{
  width:100%;
  border:0;
  margin-top:16px;
  height:52px;
  border-radius:12px;
  color:#fff;
  background:linear-gradient(90deg,#0e72ed,#0874f6 55%,#0f87ff);
  font-weight:800;
  font-size:1.02rem;
  cursor:pointer;
  box-shadow:0 10px 26px rgba(8,111,235,.25);
}
.primary-btn:hover{filter:brightness(1.03)}
.primary-btn:disabled{opacity:.58;cursor:not-allowed}
.text-btn{
  display:block;
  margin:14px auto 0;
  border:0;background:transparent;
  color:#0870e8;
  text-decoration:underline;
  font-weight:700;
  cursor:pointer;
}
.form-panel h2{margin:4px 0 4px;text-align:center;font-size:1.35rem}
.help{margin:0 0 14px;text-align:center;color:var(--muted);font-size:.9rem;line-height:1.5}
.message{
  margin-top:14px;padding:11px 12px;border-radius:10px;
  background:#eff6ff;border:1px solid #cfe2ff;color:#164d8b;font-size:.88rem;line-height:1.45
}
.message.error{background:#fff0f0;border-color:#f2c8c8;color:#9b2626}
.footer-mark{
  position:absolute;
  bottom:14px;
  left:50%;
  transform:translateX(-50%);
  color:rgba(255,255,255,.92);
  text-transform:uppercase;
  letter-spacing:.18em;
  font-size:.68rem;
  font-weight:800;
  text-shadow:0 2px 10px rgba(0,0,0,.45);
  white-space:nowrap;
}

/* Dashboard */
.dashboard-screen{min-height:100vh;background:#f2f6fb}
.dashboard-header{
  min-height:78px;background:#fff;border-bottom:1px solid #dce5f0;
  display:flex;justify-content:space-between;align-items:center;
  padding:12px 5%;position:sticky;top:0;z-index:5
}
.dashboard-brand{display:flex;align-items:center;gap:10px}
.dashboard-brand img{width:52px;height:52px;object-fit:contain}
.dashboard-brand span{display:block;color:#0b4ea2;font-weight:800;font-size:.8rem;text-transform:uppercase;letter-spacing:.06em}
.dashboard-brand strong{display:block;color:#40546e;font-size:.86rem;margin-top:3px;font-weight:600}
.logout-btn{border:1px solid #cdd9e9;background:#fff;border-radius:10px;padding:9px 13px;font-weight:700;color:#2b4567;cursor:pointer}
.dashboard-content{max-width:1050px;margin:0 auto;padding:28px 18px 110px}
.welcome-card,.trips-card,.stats-grid article{background:#fff;border:1px solid #dde6f1;border-radius:18px;box-shadow:0 10px 28px rgba(24,52,85,.06)}
.welcome-card{padding:23px;margin-bottom:16px}
.eyebrow{display:block;color:#0b64d8;font-size:.74rem;font-weight:800;text-transform:uppercase;letter-spacing:.08em}
.welcome-card h1,.trips-card h2{margin:4px 0 7px;color:#112c53}
.welcome-card p{margin:0;color:#657992}
.stats-grid{display:grid;grid-template-columns:repeat(3,1fr);gap:14px;margin-bottom:16px}
.stats-grid article{padding:19px}
.stats-grid span{display:block;color:#687b93;font-size:.85rem}
.stats-grid strong{display:block;margin-top:10px;color:#0a5fc9;font-size:1.5rem}
.trips-card{padding:22px}
.empty-state{text-align:center;padding:48px 18px 38px;color:#62758e}
.truck{font-size:2.5rem}
.empty-state h3{margin:10px 0 6px;color:#17365f}
.empty-state p{margin:0 auto;max-width:580px;line-height:1.6}

/* Mobile approved layout */
@media (max-width:700px){
  .login-screen{
    min-height:100svh;
    background-size:auto 100%;
    background-position:58% center;
    overflow:auto;
    padding:0 0 28px;
  }
  .background-overlay{
    background:
      linear-gradient(0deg,rgba(2,15,35,.66) 0%,rgba(2,15,35,.12) 42%,rgba(2,15,35,.02) 74%),
      linear-gradient(90deg,rgba(2,15,35,.02),rgba(2,15,35,.10));
  }
  .login-card{
    position:relative;
    left:auto;top:auto;transform:none;
    width:calc(100% - 34px);
    margin:52svh auto 0;
    padding:20px 20px 18px;
    border-radius:23px;
  }
  .logo{width:108px;height:108px;margin-top:-2px}
  .login-card h1{font-size:1.72rem}
  .subtitle{font-size:.93rem;margin-bottom:15px}
  .field{height:51px}
  .primary-btn{height:54px}
  .footer-mark{
    position:relative;
    bottom:auto;left:auto;transform:none;
    text-align:center;margin:16px 0 2px;
    white-space:normal;
  }
  .stats-grid{grid-template-columns:1fr}
}

/* Portal conectado v5 */
.bridge-frame{position:fixed;width:1px;height:1px;opacity:0;pointer-events:none;border:0;left:-9999px;top:-9999px}
.header-actions{display:flex;align-items:center;gap:8px}
.refresh-btn{border:1px solid #cdd9e9;background:#fff;border-radius:10px;width:40px;height:40px;font-size:1.25rem;color:#0b64d8;cursor:pointer}
.dashboard-notice{margin:0 0 16px;padding:13px 15px;border:1px solid #bcd9ff;background:#edf6ff;color:#164f93;border-radius:13px;font-size:.9rem;line-height:1.5}
.section-title-row{display:flex;align-items:center;justify-content:space-between;gap:14px}
.loading-state{text-align:center;padding:46px 18px;color:#637792}
.spinner{width:30px;height:30px;border:3px solid #dce8f7;border-top-color:#0b67e8;border-radius:50%;margin:0 auto 12px;animation:spin .8s linear infinite}
@keyframes spin{to{transform:rotate(360deg)}}
.secondary-btn{border:1px solid #bfcfe2;background:#fff;color:#0b5fc8;border-radius:10px;padding:10px 15px;font-weight:800;margin-top:15px;cursor:pointer}
.trip-item{border:1px solid #dce6f1;border-radius:16px;padding:18px;margin-top:14px;background:#fbfdff}
.trip-top{display:flex;justify-content:space-between;gap:18px;align-items:flex-start;padding-bottom:14px;border-bottom:1px solid #e3ebf4}
.trip-kicker{display:block;color:#0b64d8;font-size:.68rem;font-weight:800;letter-spacing:.045em;text-transform:uppercase;word-break:break-all}
.trip-top h3{margin:5px 0;color:#102f59;font-size:1.15rem}
.trip-top p{margin:0;color:#71839a;font-size:.83rem;line-height:1.5}
.trip-total{text-align:right;min-width:125px}
.trip-total span{display:block;color:#7a899d;font-size:.75rem}
.trip-total strong{display:block;margin-top:4px;color:#0a5fc9;font-size:1.24rem}
.operation-list{padding-top:4px}
.operation-row{display:flex;justify-content:space-between;gap:14px;align-items:center;padding:12px 0;border-bottom:1px dashed #e0e8f1}
.operation-row:last-child{border-bottom:0}
.operation-row>div:first-child strong{display:block;color:#1e395f;font-size:.9rem}
.operation-row>div:first-child span{display:block;color:#6d7f95;font-size:.8rem;margin-top:4px}
.operation-right{text-align:right}
.operation-right>strong{display:block;color:#143b6c;font-size:.92rem}
.status-pill{display:inline-block;margin-top:5px;padding:4px 8px;border-radius:999px;font-size:.67rem;font-weight:800}
.status-pill.active{background:#e6f1ff;color:#075fbf}
.status-pill.warning{background:#fff4d9;color:#875d00}
.status-pill.ok{background:#e7f8ed;color:#19763a}
.trip-actions{display:flex;justify-content:flex-end;padding-top:13px}
.delivery-btn{border:0;border-radius:11px;background:#0b67e8;color:#fff;font-weight:800;padding:11px 15px;cursor:pointer;box-shadow:0 7px 18px rgba(11,103,232,.18)}
.proof-note{font-size:.8rem;color:#6d7f95;font-weight:700}
.modal-backdrop{position:fixed;z-index:30;inset:0;background:rgba(4,22,48,.62);display:flex;align-items:center;justify-content:center;padding:18px}
.modal-card{position:relative;width:min(480px,100%);max-height:calc(100svh - 28px);overflow:auto;background:#fff;border-radius:20px;padding:25px;box-shadow:0 28px 80px rgba(0,20,55,.35)}
.modal-close{position:absolute;right:14px;top:12px;width:38px;height:38px;border:0;border-radius:50%;background:#f0f4f9;color:#385675;font-size:1.5rem;cursor:pointer}
.modal-card h2{margin:5px 0 3px;color:#102f59}
.modal-subtitle{margin:0 0 17px;color:#71839a;font-size:.83rem;word-break:break-all}
.modal-card label{display:block;margin:10px 0 6px;color:#1a355a;font-size:.86rem;font-weight:800}
.modal-input{width:100%;border:1px solid #c8d6e7;border-radius:11px;padding:12px 13px;outline:0;color:#153255;background:#fff}
.modal-input:focus{border-color:#4b99ff;box-shadow:0 0 0 3px rgba(11,103,232,.10)}
.modal-textarea{resize:vertical;min-height:78px}
.or-row{display:flex;align-items:center;gap:10px;color:#92a0b1;font-size:.72rem;text-transform:uppercase;margin:4px 0}
.or-row:before,.or-row:after{content:"";height:1px;background:#e2e8ef;flex:1}
.location-note{margin-top:15px;background:#f0f7ff;border:1px solid #d2e5fb;border-radius:11px;padding:12px;color:#315f91}
.location-note strong{display:block;font-size:.83rem;margin-bottom:4px}
.location-note span{display:block;font-size:.76rem;line-height:1.45}

@media (max-width:700px){
  .dashboard-header{padding:9px 12px;min-height:68px}
  .dashboard-brand img{width:44px;height:44px}
  .dashboard-brand strong{max-width:190px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
  .dashboard-content{padding:18px 12px 90px}
  .welcome-card{padding:18px}
  .trips-card{padding:15px}
  .trip-item{padding:14px}
  .trip-top{display:block}
  .trip-total{text-align:left;margin-top:12px}
  .operation-row{align-items:flex-start}
  .operation-right{min-width:105px}
  .trip-actions{justify-content:stretch}
  .delivery-btn{width:100%;min-height:48px}
  .modal-backdrop{align-items:flex-end;padding:0}
  .modal-card{width:100%;max-height:92svh;border-radius:22px 22px 0 0;padding:24px 18px 20px}
}


.operation-main{min-width:0}
.proof-upload-btn{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  margin-top:9px;
  border:1px solid #b8d3f4;
  border-radius:10px;
  background:#eef6ff;
  color:#075fbf;
  font-weight:800;
  padding:8px 11px;
  cursor:pointer
}
.proof-upload-btn:hover{filter:brightness(.98)}
.file-input{
  position:absolute;
  width:1px;
  height:1px;
  opacity:0;
  pointer-events:none
}
.file-picker{
  display:flex !important;
  align-items:center;
  justify-content:center;
  min-height:52px;
  border:1px dashed #82aee3;
  border-radius:12px;
  background:#f2f8ff;
  color:#075fbf !important;
  cursor:pointer;
  margin-top:6px !important;
  padding:12px
}
.file-name{
  margin-top:8px;
  color:#71839a;
  font-size:.78rem;
  word-break:break-word
}
@media (max-width:700px){
  .proof-upload-btn{width:100%;min-height:44px}
}


.cargo-photo-section{
  margin-top:16px;
  padding-top:14px;
  border-top:1px solid #e4edf7
}
.optional-text{
  font-size:.78rem;
  color:#6f8197;
  font-weight:600
}
.merchandise-picker{
  background:#f6fbf7;
  border-color:#a9d8b2;
  color:#176d32 !important
}


/* Ciclos financeiros v5.7 */
.stats-grid-two{grid-template-columns:repeat(2,1fr)}
.finance-cycle-section{
  background:#fff;
  border:1px solid #dde6f1;
  border-radius:18px;
  box-shadow:0 10px 28px rgba(24,52,85,.06);
  padding:22px;
  margin-bottom:16px;
}
.finance-title-row h2{margin:4px 0 3px;color:#112c53}
.finance-cycle-grid{display:grid;grid-template-columns:repeat(2,1fr);gap:14px;margin-top:15px}
.finance-cycle-card{
  border:1px solid #dbe6f3;
  border-radius:16px;
  padding:18px;
  background:#fbfdff;
}
.finance-cycle-card.next-cycle-card{background:#f7fbff}
.finance-cycle-head{display:flex;justify-content:space-between;gap:14px;align-items:flex-start}
.finance-kicker{
  display:block;
  color:#0b64d8;
  font-size:.75rem;
  font-weight:800;
  text-transform:uppercase;
  letter-spacing:.055em;
}
.finance-cycle-head strong,.empty-finance>strong{
  display:block;
  margin-top:6px;
  color:#0a5fc9;
  font-size:1.6rem;
}
.finance-status{
  display:inline-block;
  padding:6px 9px;
  border-radius:999px;
  font-size:.7rem;
  font-weight:800;
  text-align:center;
}
.finance-status.provision{background:#fff4d9;color:#875d00}
.finance-status.ready{background:#e7f2ff;color:#075fbf}
.finance-status.paid{background:#e7f8ed;color:#19763a}
.finance-status.late{background:#ffe9e9;color:#a12626}
.finance-cycle-meta{display:grid;gap:6px;margin-top:15px;color:#667b96;font-size:.8rem;line-height:1.45}
.finance-cycle-meta b{color:#294c78}
.empty-finance p{margin:10px 0 0;color:#74869c;font-size:.82rem;line-height:1.45}

@media (max-width:700px){
  .stats-grid-two{grid-template-columns:1fr 1fr}
  .finance-cycle-grid{grid-template-columns:1fr}
  .finance-cycle-head strong{font-size:1.5rem}
}


/* v5.8 — simulação segura de pagamento */
.simulation-banner{
  display:grid;
  gap:4px;
  border:1px solid #e4bd69;
  background:#fff8e8;
  border-radius:15px;
  padding:14px 16px;
  margin-bottom:16px;
  color:#785500;
}
.simulation-banner strong{font-size:.78rem;letter-spacing:.06em}
.simulation-banner span{font-size:.8rem;line-height:1.4}
.sim-paid-card{border-color:#b7d9c1;background:#f8fffa}
.sim-payment-actions{margin-top:15px}
.sim-receipt-btn{
  width:100%;
  min-height:44px;
  border:1px solid #afd0ba;
  border-radius:12px;
  background:#edf8f0;
  color:#176437;
  font-weight:800;
  font-size:.88rem;
}
.sim-receipt-mark{
  display:inline-block;
  margin:12px 0 16px;
  padding:6px 10px;
  border:1px solid #e4bd69;
  border-radius:999px;
  background:#fff8e8;
  color:#785500;
  font-size:.7rem;
  font-weight:900;
  letter-spacing:.055em;
}
.sim-receipt-details{display:grid;gap:0;margin:0}
.sim-receipt-details div{
  display:flex;
  justify-content:space-between;
  gap:18px;
  padding:10px 0;
  border-bottom:1px solid #e5edf6;
}
.sim-receipt-details dt{color:#6e8097}
.sim-receipt-details dd{
  margin:0;
  color:#17365e;
  font-weight:800;
  text-align:right;
}
.sim-receipt-note{margin-top:16px}
@media (max-width:700px){
  .sim-receipt-details div{align-items:flex-start}
}
