:root{
  --fm-blue: #286EB4;
  --fm-blue-2: #3175B5;
  --fm-blue-3: #6E9CC6;
  --fm-ice: #F9FBFC;

  --bg: #F4F7FB;
  --card: #FFFFFF;
  --text: #0F172A;
  --muted: #5B6472;
  --line: rgba(15, 23, 42, .10);

  --radius: 18px;
  --shadow: 0 10px 30px rgba(2, 6, 23, .08);
  --shadow-sm: 0 6px 18px rgba(2, 6, 23, .08);
  --ring: 0 0 0 4px rgba(40,110,180,.15);
}

*{ box-sizing:border-box; }

body{
  margin:0;
  font-family:Poppins, system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  color:var(--text);
  background:
    radial-gradient(900px 460px at 0% 0%, rgba(40,110,180,.10), transparent 60%),
    radial-gradient(700px 360px at 100% 100%, rgba(110,156,198,.12), transparent 55%),
    linear-gradient(180deg, #F7FAFE, #EEF4FB);
  min-height:100vh;
}

.topbar{
  background: linear-gradient(90deg, #0D4F93, #0E5A9F 45%, #0A467E);
  color:#fff;
  box-shadow: 0 8px 24px rgba(2,6,23,.14);
}

.topbar-inner{
  max-width: 1380px;
  margin: 0 auto;
  padding: 22px 22px;
  display:flex;
  align-items:center;
}

.brand{
  display:flex;
  align-items:center;
  gap:14px;
  min-width:0;
}

.brand img{
  width:46px;
  height:46px;
  object-fit:contain;
}

.brand-title{
  display:flex;
  align-items:center;
  gap:18px;
  min-width:0;
  color:#fff;
}

.brand-title strong{
  font-size:25px;
  font-weight:600;
  line-height:1;
  white-space:nowrap;
}

.brand-title span{
  font-size:18px;
  font-weight:500;
  opacity:.95;
  white-space:nowrap;
  border-left:1px solid rgba(255,255,255,.25);
  padding-left:18px;
}

.wrap{
  max-width: 1380px;
  margin: 34px auto 50px;
  padding: 0 20px;
}

.page-grid{
  display:grid;
  grid-template-columns: minmax(0, 1.95fr) minmax(320px, 0.78fr);
  gap: 24px;
  align-items:start;
}

.main-col,
.side-col{
  min-width:0;
}

.section-block + .section-block{
  margin-top: 24px;
}

.section-title{
  margin: 0 0 14px;
  font-size: 22px;
  font-weight: 700;
  color: #0F172A;
}

.card{
  background: var(--card);
  border: 1px solid rgba(15,23,42,.10);
  border-radius: 18px;
  box-shadow: 0 8px 24px rgba(15,23,42,.08);
}

.section-card{
  padding: 18px 18px 16px;
}

.section-step{
  margin: 0 0 14px;
  font-size: 18px;
  font-weight: 700;
}

.start-actions{
  display:flex;
  justify-content:flex-start;
  margin-bottom: 14px;
}

.row{
  display:flex;
  gap:12px;
  align-items:flex-end;
  flex-wrap:wrap;
}

.field{
  flex:1;
  min-width:220px;
}

.field-deal{
  min-width:100%;
}

.deal-search-line{
  display:flex;
  align-items:center;
  gap:12px;
  flex-wrap:wrap;
  margin-top:12px;
}

.deal-status{
  min-height: 22px;
  font-size: 15px;
  font-weight: 500;
  color: var(--muted);
}

.deal-status.is-loading{
  color: #8A6A00;
}

.deal-status.is-success{
  color: #1F6B3A;
  font-weight: 600;
}

.deal-status.is-error{
  color: #C62828;
  font-weight: 600;
}

.deal-status .deal-title{
  font-weight: 500;
  color: var(--text);
}

.deal-status .deal-sep{
  display:inline-block;
  margin: 0 8px;
  color: rgba(15,23,42,.35);
}

label{
  display:block;
  margin:0 0 8px;
  font-size:13px;
  color:var(--muted);
  font-weight:500;
}

.deal-input-wrap{
  position:relative;
}

input{
  width:100%;
  height:48px;
  border:1px solid rgba(15,23,42,.14);
  border-radius:14px;
  padding:0 14px;
  background:#fff;
  outline:none;
  font:inherit;
  font-size:15px;
  transition: border-color .15s ease, box-shadow .15s ease;
}

input:focus{
  border-color: rgba(40,110,180,.55);
  box-shadow: var(--ring);
}

.deal-ok{
  position:absolute;
  right:14px;
  top:50%;
  transform:translateY(-50%);
  font-size:18px;
}

button{
  font:inherit;
  border-radius:14px;
  padding:11px 16px;
  border:1px solid transparent;
  cursor:pointer;
  transition: .15s ease;
}

button:active{
  transform: translateY(1px);
}

.btn-primary{
  background: linear-gradient(180deg, #0E5FA8, #0A4F92);
  color:#fff;
  box-shadow: var(--shadow-sm);
}

.btn-primary:hover{
  filter:brightness(.98);
}

.btn-ghost{
  background:#fff;
  border-color: rgba(40,110,180,.22);
  color: var(--fm-blue);
}

.btn-ghost:hover{
  background: rgba(40,110,180,.05);
}

.btn-add{
  background: linear-gradient(180deg, #1763A9, #0F548F);
  color:#fff;
  border-color: rgba(0,0,0,0);
  box-shadow: var(--shadow-sm);
}

.btn-danger-outline{
  background:#EEF2F6;
  color:#374151;
  border-color: transparent;
}

.table-wrap{
  width:100%;
  max-width:100%;
  overflow-x:auto;
  overflow-y:hidden;
  -webkit-overflow-scrolling:touch;
  border:1px solid rgba(15,23,42,.10);
  border-radius:14px;
  background:#fff;
}

#tbl{
  width:100%;
  min-width: 900px;
  border-collapse: separate;
  border-spacing: 0;
  table-layout: auto;
  background:#fff;
}

#tbl th,
#tbl td{
  padding: 10px 12px;
  border-bottom: 1px solid rgba(15,23,42,.08);
  vertical-align: middle;
  text-align:center;
  white-space:nowrap;
}

#tbl thead th{
  background: linear-gradient(180deg, #EEF3F8, #E5EBF2);
  color:#1F2937;
  font-size:13px;
  font-weight:700;
}

#tbl tbody tr:nth-child(even){
  background: #FBFCFE;
}

#tbl tbody tr:last-child td{
  border-bottom:0;
}

#tbl th.col-vol,
#tbl td.col-vol{
  width:70px;
  min-width:70px;
}

#tbl th.col-qtd,
#tbl td.col-qtd{
  width:88px;
  min-width:88px;
}

#tbl th.col-x,
#tbl td.col-x{
  width:58px;
  min-width:58px;
}

#tbl input{
  width:100%;
  min-width:72px;
  height:40px;
  border-radius:10px;
  text-align:center;
  padding:0 8px;
  font-size:15px;
  font-variant-numeric: tabular-nums;
}

.cell-cub{
  display:inline-block;
  min-width:70px;
  font-weight:600;
  color:#334155;
}

.x{
  width:34px;
  height:34px;
  padding:0;
  display:inline-flex;
  align-items:center;
  justify-content:center;
  border-radius:10px;
  background:#fff;
  color:#B45309;
  border:1px solid rgba(180,83,9,.15);
}

.x:hover{
  background:#FFF7ED;
}

.table-actions{
  display:flex;
  gap:12px;
  flex-wrap:wrap;
  margin-top:16px;
}

.hint{
  margin-top:12px;
  font-size:13px;
  color:var(--muted);
}

.side-card{
  padding: 18px;
}

.side-group + .side-group{
  margin-top: 18px;
}

.side-group h3{
  margin:0 0 10px;
  font-size:17px;
  font-weight:700;
}

.summary-panel{
  border-radius: 14px;
  background: linear-gradient(180deg, #F3F7FB, #EDF3F8);
  padding: 14px 14px 10px;
  border: 1px solid rgba(15,23,42,.06);
}

.summary-item + .summary-item{
  margin-top: 14px;
}

.summary-item span{
  display:block;
  font-size:14px;
  color:#334155;
  margin-bottom:4px;
}

.summary-item strong{
  display:block;
  font-size:26px;
  line-height:1;
  font-weight:700;
  color:#0F172A;
}

.btn-main{
  width:100%;
  height:50px;
  font-size:16px;
  font-weight:600;
}

.out{
  margin-top:16px;
  background:#F8FAFC;
  color:#334155;
  border-radius:14px;
  padding:12px 14px;
  border:1px solid rgba(15,23,42,.08);
  font-size:13px;
  white-space:pre-wrap;
  overflow:auto;
  min-height:54px;
}

@media (max-width: 1100px){
  .page-grid{
    grid-template-columns: 1fr;
  }

  .brand-title{
    flex-direction:column;
    align-items:flex-start;
    gap:6px;
  }

  .brand-title span{
    border-left:0;
    padding-left:0;
  }
}

@media (max-width: 640px){
  .wrap{
    padding: 0 14px;
  }

  .topbar-inner{
    padding: 18px 14px;
  }

  .brand-title strong{
    font-size:20px;
  }

  .brand-title span{
    font-size:14px;
    white-space:normal;
  }

  .section-title{
    font-size:20px;
  }

  .section-step{
    font-size:17px;
  }
}