:root{
      --bg:#f7f8fa;
      --surface:#ffffff;
      --surface-soft:#f9fafb;
      --text:#111827;
      --muted:#667085;
      --line:#e5e7eb;
      --line-strong:#d0d5dd;
      --primary:#111827;
      --primary-soft:#eef2f6;
      --accent:#2563eb;
      --success:#067647;
      --danger:#b42318;
      --warning:#b54708;
      --radius:16px;
      --radius-sm:11px;
      --shadow:0 8px 28px rgba(16,24,40,.06);
      --sidebar:236px;
    }

    *{box-sizing:border-box}
    html{scroll-behavior:smooth}
    body{
      margin:0;
      min-height:100vh;
      background:var(--bg);
      color:var(--text);
      font-family:"Poppins",ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,"Segoe UI",sans-serif;
      -webkit-font-smoothing:antialiased;
    }
    button,input{font:inherit}
    *{font-family:inherit}
    button{cursor:pointer}
    .app{min-height:100vh}

    .sidebar{
      position:fixed;
      inset:0 auto 0 0;
      width:var(--sidebar);
      background:#0f172a;
      color:#fff;
      padding:22px 16px;
      display:flex;
      flex-direction:column;
      z-index:20;
    }
    .logo{
      display:flex;
      align-items:center;
      gap:10px;
      padding:0 8px 24px;
      font-size:17px;
      font-weight:700;
      letter-spacing:-.02em;
    }
    .logo-mark{
      width:34px;height:34px;border-radius:10px;
      display:grid;place-items:center;
      background:#fff;color:#0f172a;
      font-weight:800;
    }
    .nav{display:grid;gap:6px}
    .nav-btn{
      width:100%;
      display:flex;
      align-items:center;
      gap:11px;
      border:0;
      background:transparent;
      color:#cbd5e1;
      padding:11px 12px;
      border-radius:10px;
      text-align:left;
      font-weight:600;
      font-size:14px;
    }
    .nav-btn:hover{background:#182235;color:#fff}
    .nav-btn.active{background:#fff;color:#0f172a}
    .nav-icon{
      width:19px;height:19px;
      display:grid;place-items:center;
      font-size:14px;
      opacity:.9;
    }
    .side-spacer{flex:1}
    .side-note{
      border-top:1px solid #263244;
      padding:16px 8px 0;
      color:#94a3b8;
      font-size:12px;
      line-height:1.45;
    }

    .shell{
      margin-left:var(--sidebar);
      min-height:100vh;
    }
    .topbar{
      height:68px;
      border-bottom:1px solid var(--line);
      background:rgba(255,255,255,.88);
      backdrop-filter:blur(10px);
      position:sticky;
      top:0;
      z-index:15;
      display:flex;
      align-items:center;
      padding:0 28px;
    }
    .topbar-inner{
      width:100%;
      display:flex;
      align-items:center;
      justify-content:space-between;
      gap:16px;
    }
    .mobile-brand{display:none;font-weight:700}
    .page-title{font-size:14px;font-weight:700;color:#344054}
    .top-actions{display:flex;gap:9px;align-items:center}
    .pill{
      border:1px solid var(--line);
      background:#fff;
      padding:7px 10px;
      border-radius:999px;
      color:#475467;
      font-size:12px;
      white-space:nowrap;
    }

    main{
      max-width:1320px;
      margin:0 auto;
      padding:30px 28px 54px;
    }

    .hero{
      display:flex;
      justify-content:space-between;
      align-items:flex-end;
      gap:20px;
      margin-bottom:22px;
    }
    .hero h1{
      margin:0 0 7px;
      font-size:30px;
      line-height:1.15;
      letter-spacing:-.035em;
    }
    .hero p{
      margin:0;
      color:var(--muted);
      font-size:14px;
      max-width:720px;
    }
    .hero-actions{display:flex;gap:9px;flex-shrink:0}

    .btn{
      border:0;
      border-radius:10px;
      min-height:42px;
      padding:10px 14px;
      font-weight:700;
      font-size:14px;
      transition:.15s ease;
    }
    .btn:active{transform:translateY(1px)}
    .btn-primary{background:var(--primary);color:#fff}
    .btn-primary:hover{background:#1f2937}
    .btn-secondary{
      background:#fff;
      color:#344054;
      border:1px solid var(--line-strong);
    }
    .btn-ghost{
      background:transparent;
      color:#475467;
      border:1px solid transparent;
    }

    .kpis{
      display:grid;
      grid-template-columns:repeat(4,minmax(0,1fr));
      gap:14px;
      margin-bottom:20px;
    }
    .kpi{
      background:var(--surface);
      border:1px solid var(--line);
      border-radius:14px;
      padding:16px 17px;
    }
    .kpi-label{
      color:var(--muted);
      font-size:12px;
      font-weight:600;
      margin-bottom:7px;
    }
    .kpi-value{
      font-size:22px;
      font-weight:800;
      letter-spacing:-.025em;
    }
    .kpi-sub{
      margin-top:5px;
      color:var(--muted);
      font-size:11.5px;
    }

    .dashboard-grid{
      display:grid;
      grid-template-columns:minmax(0,1.45fr) minmax(360px,.82fr);
      gap:20px;
      align-items:start;
    }

    .panel{
      background:var(--surface);
      border:1px solid var(--line);
      border-radius:var(--radius);
      box-shadow:var(--shadow);
      overflow:hidden;
    }
    .panel + .panel{margin-top:16px}
    .panel-header{
      padding:18px 20px 15px;
      border-bottom:1px solid var(--line);
      display:flex;
      justify-content:space-between;
      gap:14px;
      align-items:flex-start;
    }
    .panel-header h2{
      margin:0 0 4px;
      font-size:16px;
      letter-spacing:-.01em;
    }
    .panel-header p{
      margin:0;
      color:var(--muted);
      font-size:12.5px;
    }
    .panel-body{padding:18px 20px 20px}

    .section-title{
      display:flex;
      align-items:center;
      gap:8px;
      margin:0 0 13px;
      font-size:13px;
      font-weight:700;
      color:#344054;
    }
    .step-dot{
      width:24px;height:24px;border-radius:8px;
      background:var(--primary-soft);
      color:#344054;
      display:grid;place-items:center;
      font-size:11px;
      font-weight:800;
    }

    .grid-2{
      display:grid;
      grid-template-columns:repeat(2,minmax(0,1fr));
      gap:14px 16px;
    }
    .field{display:flex;flex-direction:column;gap:6px}
    .field.full{grid-column:1/-1}
    label{
      font-size:12.5px;
      color:#344054;
      font-weight:600;
    }
    .input-wrap{
      min-height:45px;
      display:flex;
      align-items:center;
      border:1px solid var(--line-strong);
      border-radius:10px;
      background:#fff;
      overflow:hidden;
      transition:border-color .15s,box-shadow .15s;
    }
    .input-wrap:focus-within{
      border-color:#98a2b3;
      box-shadow:0 0 0 3px rgba(16,24,40,.05);
    }
    input{
      width:100%;
      min-width:0;
      border:0;
      outline:0;
      padding:10px 11px;
      background:transparent;
      color:var(--text);
      font-size:14px;
    }
    input[type=number]{
      appearance:textfield;
      -moz-appearance:textfield;
    }
    input[type=number]::-webkit-inner-spin-button,
    input[type=number]::-webkit-outer-spin-button{-webkit-appearance:none;margin:0}
    .prefix,.suffix{
      color:#667085;
      font-size:12.5px;
      padding:0 10px;
      white-space:nowrap;
      background:#fafafa;
      align-self:stretch;
      display:flex;align-items:center;
    }
    .prefix{border-right:1px solid #eef0f2}
    .suffix{border-left:1px solid #eef0f2}
    .hint{
      font-size:11.5px;
      color:var(--muted);
      line-height:1.35;
    }

    .divider{
      height:1px;
      background:var(--line);
      margin:20px 0;
    }

    .invoice-unit-strip{
      margin-top:14px;
      padding:11px 13px;
      border-top:1px solid var(--line);
      display:flex;
      align-items:center;
      justify-content:space-between;
      gap:16px;
    }

    .invoice-unit-strip + .invoice-unit-strip{
      margin-top:0;
      border-top:1px solid var(--line);
      border-bottom:1px solid var(--line);
    }
    .invoice-unit-copy{
      min-width:0;
    }
    .invoice-unit-label{
      font-size:12.5px;
      font-weight:700;
      color:#344054;
      margin-bottom:2px;
    }
    .invoice-unit-help{
      font-size:11.5px;
      color:var(--muted);
      line-height:1.35;
    }
    .invoice-unit-value{
      flex-shrink:0;
      font-size:16px;
      font-weight:800;
      color:#111827;
      letter-spacing:-.02em;
    }

    details.disclosure{
      border:1px solid var(--line);
      border-radius:12px;
      background:var(--surface-soft);
      overflow:hidden;
    }
    details.disclosure + details.disclosure{margin-top:10px}
    details.disclosure summary{
      list-style:none;
      cursor:pointer;
      padding:13px 14px;
      font-size:13px;
      font-weight:700;
      display:flex;
      justify-content:space-between;
      gap:12px;
      align-items:center;
    }
    details.disclosure summary::-webkit-details-marker{display:none}
    details.disclosure summary::after{
      content:"+";
      color:#667085;
      font-size:18px;
      font-weight:400;
    }
    details.disclosure[open] summary::after{content:"−"}
    .disclosure-body{
      padding:3px 14px 14px;
      border-top:1px solid var(--line);
    }
    .disclosure-body .grid-2{margin-top:13px}

    .rule-box{
      border:1px solid #dbe4f0;
      background:#f8fafc;
      border-radius:11px;
      padding:12px 13px;
      font-size:12px;
      color:#475467;
      line-height:1.5;
      margin-top:13px;
    }
    .rule-box strong{color:#344054}

    .results-column{
      display:grid;
      gap:16px;
      position:sticky;
      top:88px;
    }

    .summary-card{
      position:static;
    }

    .chart-panel{
      background:var(--surface);
      border:1px solid var(--line);
      border-radius:var(--radius);
      box-shadow:var(--shadow);
      overflow:hidden;
    }

    .chart-body{
      padding:18px 20px 20px;
    }

    .cost-chart-layout{
      display:grid;
      grid-template-columns:150px minmax(0,1fr);
      gap:18px;
      align-items:center;
    }

    .donut-wrap{
      position:relative;
      width:150px;
      height:150px;
      margin:auto;
    }

    .donut{
      width:150px;
      height:150px;
      border-radius:50%;
      background:conic-gradient(#e5e7eb 0 100%);
      position:relative;
      transition:background .2s ease;
    }

    .donut::after{
      content:"";
      position:absolute;
      inset:25px;
      border-radius:50%;
      background:#fff;
      box-shadow:0 0 0 1px rgba(229,231,235,.85);
    }

    .donut-center{
      position:absolute;
      inset:0;
      z-index:2;
      display:grid;
      place-content:center;
      text-align:center;
      pointer-events:none;
      padding:34px;
    }

    .donut-center span{
      color:var(--muted);
      font-size:10px;
      font-weight:600;
      line-height:1.25;
    }

    .donut-center strong{
      margin-top:3px;
      font-size:14px;
      line-height:1.1;
      letter-spacing:-.02em;
    }

    .cost-legend{
      display:grid;
      gap:8px;
    }

    .legend-row{
      display:grid;
      grid-template-columns:auto minmax(0,1fr) auto;
      gap:8px;
      align-items:center;
      font-size:11.5px;
    }

    .legend-dot{
      width:9px;
      height:9px;
      border-radius:3px;
    }

    .legend-label{
      color:#475467;
      min-width:0;
      white-space:nowrap;
      overflow:hidden;
      text-overflow:ellipsis;
    }

    .legend-value{
      font-weight:700;
      text-align:right;
      white-space:nowrap;
    }

    .legend-percent{
      color:var(--muted);
      font-size:10px;
      margin-left:4px;
      font-weight:500;
    }

    .form-summary{
      display:grid;
      grid-template-columns:repeat(3,minmax(0,1fr));
      gap:10px;
      margin-bottom:16px;
    }

    .mini-kpi{
      border:1px solid var(--line);
      background:var(--surface-soft);
      border-radius:12px;
      padding:12px 13px;
    }

    .mini-kpi span{
      display:block;
      font-size:10.5px;
      color:var(--muted);
      margin-bottom:4px;
      font-weight:600;
    }

    .mini-kpi strong{
      font-size:15px;
      letter-spacing:-.02em;
    }
    .summary-head{
      padding:20px;
      background:#0f172a;
      color:#fff;
    }
    .summary-head .eyebrow{
      color:#94a3b8;
      font-size:11px;
      font-weight:700;
      text-transform:uppercase;
      letter-spacing:.08em;
      margin-bottom:7px;
    }
    .summary-head .price{
      font-size:36px;
      font-weight:800;
      line-height:1.02;
      letter-spacing:-.045em;
    }
    .summary-head .summary-note{
      margin-top:8px;
      color:#cbd5e1;
      font-size:12px;
    }
    .summary-body{padding:7px 20px 16px}
    .summary-row{
      display:flex;
      justify-content:space-between;
      gap:18px;
      padding:12px 0;
      border-bottom:1px solid var(--line);
      font-size:13px;
    }
    .summary-row:last-child{border-bottom:0}
    .summary-row span{color:#667085}
    .summary-row strong{text-align:right}
    .summary-row.emphasis strong{color:var(--danger)}
    .summary-actions{
      display:grid;
      grid-template-columns:1fr auto;
      gap:9px;
      padding:0 20px 20px;
    }
    .summary-actions .btn-primary{width:100%}

    .calc-details{
      border-top:1px solid var(--line);
    }
    .calc-details summary{
      cursor:pointer;
      list-style:none;
      padding:14px 20px;
      font-size:12.5px;
      font-weight:700;
      color:#344054;
    }
    .calc-details summary::-webkit-details-marker{display:none}
    .calc-table{
      width:100%;
      border-collapse:collapse;
      font-size:12px;
    }
    .calc-table td{
      padding:9px 20px;
      border-top:1px solid #f0f1f3;
    }
    .calc-table td:first-child{color:#667085}
    .calc-table td:last-child{text-align:right;font-weight:600}

    .history-view[hidden]{display:none}
    .history-toolbar{
      display:flex;
      justify-content:space-between;
      align-items:center;
      gap:14px;
      margin-bottom:16px;
    }
    .history-list{
      display:grid;
      grid-template-columns:repeat(3,minmax(0,1fr));
      gap:14px;
    }
    .history-card{
      background:#fff;
      border:1px solid var(--line);
      border-radius:14px;
      padding:16px;
    }
    .history-card-top{
      display:flex;
      justify-content:space-between;
      gap:12px;
      align-items:flex-start;
      margin-bottom:12px;
    }
    .history-card .cost{
      font-size:20px;
      font-weight:800;
      letter-spacing:-.02em;
    }
    .history-card small{color:var(--muted)}
    .history-meta{
      display:grid;
      gap:7px;
      font-size:12.5px;
      color:#475467;
    }
    .history-card-actions{
      display:flex;
      gap:8px;
      margin-top:14px;
    }
    .mini-btn{
      border:1px solid var(--line-strong);
      background:#fff;
      border-radius:9px;
      padding:7px 9px;
      font-size:12px;
      font-weight:600;
    }
    .empty{
      grid-column:1/-1;
      background:#fff;
      border:1px dashed var(--line-strong);
      border-radius:14px;
      padding:34px 20px;
      text-align:center;
      color:var(--muted);
      font-size:13px;
    }

    .settings-view[hidden]{display:none}
    .settings-grid{
      display:grid;
      grid-template-columns:minmax(0,1fr) minmax(280px,.7fr);
      gap:20px;
      align-items:start;
    }
    .setting-line{
      padding:13px 0;
      border-bottom:1px solid var(--line);
      display:flex;
      justify-content:space-between;
      gap:18px;
      font-size:13px;
    }
    .setting-line:last-child{border-bottom:0}
    .setting-line span{color:var(--muted)}
    .setting-line strong{text-align:right}

    .mobile-bottom-nav{display:none}

    @media(max-width:1080px){
      .kpis{grid-template-columns:repeat(2,minmax(0,1fr))}
      .history-list{grid-template-columns:repeat(2,minmax(0,1fr))}
    }

    @media(max-width:820px){
      :root{--sidebar:0px}
      .sidebar{display:none}
      .shell{margin-left:0}
      .topbar{
        height:60px;
        padding:0 16px;
      }
      .mobile-brand{display:block}
      .page-title{display:none}
      .pill{display:none}
      main{
        padding:20px 14px 94px;
      }
      .hero{
        align-items:flex-start;
        margin-bottom:18px;
      }
      .hero h1{font-size:25px}
      .hero p{font-size:13px}
      .hero-actions .btn-secondary{display:none}
      .dashboard-grid{grid-template-columns:1fr}
      .results-column{
        position:static;
        order:-1;
      }
      .summary-card{
        position:static;
      }
      .cost-chart-layout{
        grid-template-columns:140px minmax(0,1fr);
      }
      .donut-wrap,.donut{
        width:140px;
        height:140px;
      }
      .summary-head .price{font-size:32px}
      .history-list{grid-template-columns:1fr}
      .settings-grid{grid-template-columns:1fr}
      .mobile-bottom-nav{
        display:grid;
        grid-template-columns:repeat(3,1fr);
        position:fixed;
        bottom:0;left:0;right:0;
        background:rgba(255,255,255,.95);
        backdrop-filter:blur(10px);
        border-top:1px solid var(--line);
        z-index:30;
        padding:7px 8px max(7px,env(safe-area-inset-bottom));
      }
      .mobile-nav-btn{
        border:0;
        background:transparent;
        color:#667085;
        min-height:48px;
        border-radius:10px;
        font-size:11px;
        font-weight:700;
        display:grid;
        place-items:center;
        gap:2px;
      }
      .mobile-nav-btn.active{
        background:#f2f4f7;
        color:#111827;
      }
      .mobile-nav-icon{font-size:16px;line-height:1}
    }

    @media(max-width:560px){
      .hero{
        display:block;
      }
      .hero-actions{
        margin-top:14px;
      }
      .hero-actions .btn-primary{width:100%}
      .kpis{
        grid-template-columns:1fr 1fr;
        gap:10px;
      }
      .kpi{
        padding:13px 14px;
      }
      .kpi-value{font-size:18px}
      .kpi-sub{display:none}
      .grid-2{grid-template-columns:1fr}
      .form-summary{grid-template-columns:1fr 1fr}
      .cost-chart-layout{grid-template-columns:1fr}
      .donut-wrap,.donut{width:160px;height:160px}
      .cost-legend{grid-template-columns:1fr}
      .field.full{grid-column:auto}
      .panel-header,.panel-body{
        padding-left:15px;
        padding-right:15px;
      }
      .summary-body,.summary-actions{
        padding-left:15px;
        padding-right:15px;
      }
      .summary-actions{
        grid-template-columns:1fr;
      }
      .summary-actions .btn-secondary{width:100%}
      .top-actions .btn-secondary{display:none}
    }

[hidden]{display:none !important}

.input-wrap.invalid{
  border-color:#d92d20;
  box-shadow:0 0 0 3px rgba(217,45,32,.08);
}

.status-message{
  min-height:20px;
  margin-bottom:12px;
  font-size:12px;
  color:var(--muted);
}

.status-message.error{color:var(--danger)}
.status-message.success{color:var(--success)}

.donut-svg{
  width:150px;
  height:150px;
  display:block;
  transform:rotate(-90deg);
}

.donut-track{
  fill:none;
  stroke:#e5e7eb;
  stroke-width:16;
}

.donut-segment{
  fill:none;
  stroke-width:16;
  stroke-linecap:butt;
}

.segment-0{stroke:#111827}
.segment-1{stroke:#475467}
.segment-2{stroke:#98a2b3}
.segment-3{stroke:#2563eb}
.segment-4{stroke:#7c3aed}
.segment-5{stroke:#d97706}
.segment-6{stroke:#dc2626}

.legend-color-0{background:#111827}
.legend-color-1{background:#475467}
.legend-color-2{background:#98a2b3}
.legend-color-3{background:#2563eb}
.legend-color-4{background:#7c3aed}
.legend-color-5{background:#d97706}
.legend-color-6{background:#dc2626}

@media(max-width:820px){
  .donut-svg{width:140px;height:140px}
}

@media(max-width:560px){
  .donut-svg{width:160px;height:160px}
}


.auth-top{
  display:flex;
  align-items:center;
  gap:8px;
}

.auth-email{
  max-width:220px;
  overflow:hidden;
  text-overflow:ellipsis;
  white-space:nowrap;
  font-size:12px;
  color:#475467;
  font-weight:600;
}

.modal-backdrop{
  position:fixed;
  inset:0;
  background:rgba(15,23,42,.48);
  backdrop-filter:blur(3px);
  z-index:100;
  display:grid;
  place-items:center;
  padding:18px;
}

.auth-modal{
  width:min(430px,100%);
  position:relative;
  background:#fff;
  border:1px solid var(--line);
  border-radius:20px;
  box-shadow:0 24px 80px rgba(15,23,42,.22);
  padding:24px;
}

.modal-close{
  position:absolute;
  top:14px;
  right:14px;
  width:34px;
  height:34px;
  border:0;
  border-radius:10px;
  background:#f2f4f7;
  color:#475467;
  font-size:22px;
  line-height:1;
}

.auth-brand{
  display:flex;
  align-items:center;
  gap:12px;
  padding-right:38px;
  margin-bottom:20px;
}

.auth-brand h2{
  margin:0 0 3px;
  font-size:20px;
}

.auth-brand p{
  margin:0;
  color:var(--muted);
  font-size:12px;
  line-height:1.45;
}

.auth-tabs{
  display:grid;
  grid-template-columns:1fr 1fr;
  gap:4px;
  padding:4px;
  background:#f2f4f7;
  border-radius:11px;
  margin-bottom:18px;
}

.auth-tab{
  border:0;
  border-radius:8px;
  padding:9px 10px;
  background:transparent;
  color:#667085;
  font-size:13px;
  font-weight:600;
}

.auth-tab.active{
  background:#fff;
  color:#111827;
  box-shadow:0 1px 3px rgba(16,24,40,.08);
}

.auth-form{
  display:grid;
  gap:14px;
}

.auth-message{
  min-height:18px;
  font-size:12px;
  color:var(--muted);
  line-height:1.4;
}

.auth-message.error{color:var(--danger)}
.auth-message.success{color:var(--success)}

.auth-submit{
  width:100%;
}

.history-auth-hint{
  color:var(--muted);
  font-size:12px;
}

.btn:disabled{
  cursor:not-allowed;
  opacity:.6;
}

@media(max-width:820px){
  .auth-email{display:none}
  .top-actions{gap:6px}
  .top-actions #topResetBtn{display:none}
}


.identity-panel{
  margin-bottom:16px;
}

.optional-label{
  color:var(--muted);
  font-weight:500;
  font-size:11px;
}

.history-controls{
  display:grid;
  grid-template-columns:minmax(0,1fr) 190px;
  gap:12px;
  align-items:end;
  margin-bottom:12px;
}

.history-search{
  max-width:520px;
}

.history-sort{
  display:flex;
  flex-direction:column;
  gap:6px;
}

.history-sort label{
  font-size:11px;
  color:var(--muted);
}

.history-sort select{
  min-height:45px;
  border:1px solid var(--line-strong);
  border-radius:10px;
  background:#fff;
  color:var(--text);
  padding:0 11px;
  font:inherit;
  font-size:13px;
}

.history-name{
  font-size:15px;
  font-weight:700;
  color:#111827;
  margin-bottom:3px;
}

.history-supplier{
  font-size:11.5px;
  color:var(--muted);
  margin-bottom:10px;
}

.history-card .cost{
  font-size:18px;
}

.sr-only{
  position:absolute;
  width:1px;
  height:1px;
  padding:0;
  margin:-1px;
  overflow:hidden;
  clip:rect(0,0,0,0);
  white-space:nowrap;
  border:0;
}

@media(max-width:620px){
  .history-controls{
    grid-template-columns:1fr;
  }
  .history-search{
    max-width:none;
  }
}


.history-kpis{
  display:grid;
  grid-template-columns:repeat(4,minmax(0,1fr));
  gap:12px;
  margin-bottom:16px;
}

.history-kpis .kpi{
  box-shadow:none;
}

.history-date-kpi{
  font-size:16px;
  line-height:1.25;
}

.history-controls{
  grid-template-columns:minmax(180px,1.4fr) minmax(160px,1fr) 170px 190px auto;
  align-items:end;
}

.history-search,
.history-filter,
.history-sort{
  display:flex;
  flex-direction:column;
  gap:6px;
  max-width:none;
}

.history-search label,
.history-filter label,
.history-sort label{
  font-size:11px;
  color:var(--muted);
  font-weight:600;
}

.history-filter select,
.history-sort select{
  min-height:45px;
  border:1px solid var(--line-strong);
  border-radius:10px;
  background:#fff;
  color:var(--text);
  padding:0 11px;
  font:inherit;
  font-size:13px;
}

.history-clear-btn{
  height:45px;
  white-space:nowrap;
}

.history-pagination{
  display:flex;
  align-items:center;
  justify-content:center;
  gap:14px;
  margin-top:18px;
}

.history-pagination span{
  color:var(--muted);
  font-size:12px;
  min-width:92px;
  text-align:center;
}

@media(max-width:1150px){
  .history-kpis{
    grid-template-columns:repeat(2,minmax(0,1fr));
  }

  .history-controls{
    grid-template-columns:repeat(2,minmax(0,1fr));
  }

  .history-clear-btn{
    width:max-content;
  }
}

@media(max-width:620px){
  .history-kpis{
    grid-template-columns:1fr 1fr;
    gap:10px;
  }

  .history-kpis .kpi-value{
    font-size:17px;
  }

  .history-date-kpi{
    font-size:13px !important;
  }

  .history-controls{
    grid-template-columns:1fr;
  }

  .history-clear-btn{
    width:100%;
  }

  .history-pagination{
    justify-content:space-between;
  }
}


/* v11: fixed tax rates live only in Regras e parâmetros. */
.settings-grid .panel:last-child .setting-line strong{
  white-space:nowrap;
}


/* Login gate v13 */
.login-screen{
  min-height:100vh;
  background:#f6f7f9;
  display:grid;
  place-items:center;
  padding:28px;
}

.login-layout{
  width:min(1040px,100%);
  min-height:620px;
  display:grid;
  grid-template-columns:minmax(0,.92fr) minmax(420px,1.08fr);
  overflow:hidden;
  border:1px solid var(--line);
  border-radius:24px;
  background:#fff;
  box-shadow:0 24px 80px rgba(15,23,42,.10);
}

.login-brand-panel{
  background:#0f172a;
  color:#fff;
  padding:44px;
  display:flex;
  flex-direction:column;
}

.login-brand-mark{
  width:52px;
  height:52px;
  display:grid;
  place-items:center;
  border-radius:15px;
  background:#fff;
  color:#0f172a;
  font-size:14px;
  font-weight:800;
  letter-spacing:.02em;
}

.login-brand-copy{
  margin:auto 0;
  max-width:390px;
}

.login-eyebrow{
  color:#93c5fd;
  font-size:12px;
  font-weight:700;
  letter-spacing:.08em;
  text-transform:uppercase;
  margin-bottom:10px;
}

.login-brand-copy h1{
  margin:0 0 14px;
  font-size:42px;
  line-height:1;
  letter-spacing:-.045em;
}

.login-brand-copy p{
  margin:0;
  color:#cbd5e1;
  font-size:14px;
  line-height:1.7;
}

.login-security-list{
  display:grid;
  gap:10px;
  color:#cbd5e1;
  font-size:12px;
}

.login-security-list > div{
  display:flex;
  align-items:center;
  gap:9px;
}

.security-dot{
  width:8px;
  height:8px;
  border-radius:50%;
  background:#60a5fa;
  flex:none;
}

.login-form-panel{
  display:grid;
  place-items:center;
  padding:42px;
}

.login-card{
  width:min(390px,100%);
}

.login-mobile-brand{
  display:none;
  align-items:center;
  gap:11px;
  margin-bottom:28px;
}

.login-mobile-brand > div:last-child{
  display:grid;
}

.login-mobile-brand strong{
  font-size:14px;
}

.login-mobile-brand span{
  color:var(--muted);
  font-size:11px;
}

.login-heading{
  margin:22px 0 24px;
}

.login-heading h2{
  margin:0 0 7px;
  font-size:26px;
  line-height:1.2;
  letter-spacing:-.03em;
}

.login-heading p{
  margin:0;
  color:var(--muted);
  font-size:12.5px;
  line-height:1.55;
}

.password-input-wrap{
  position:relative;
}

.password-input-wrap input{
  padding-right:78px;
}

.password-toggle{
  position:absolute;
  right:7px;
  top:50%;
  transform:translateY(-50%);
  border:0;
  background:transparent;
  color:#475467;
  padding:6px 8px;
  border-radius:7px;
  font-size:11px;
  font-weight:600;
}

.password-toggle:hover{
  background:#f2f4f7;
}

.login-privacy{
  margin:18px 0 0;
  color:#98a2b3;
  font-size:10.5px;
  line-height:1.55;
  text-align:center;
}

body.authenticated .login-screen{
  display:none;
}

body:not(.authenticated) #appShell{
  display:none !important;
}

@media(max-width:800px){
  .login-screen{
    padding:0;
    background:#fff;
  }

  .login-layout{
    width:100%;
    min-height:100vh;
    display:block;
    border:0;
    border-radius:0;
    box-shadow:none;
  }

  .login-brand-panel{
    display:none;
  }

  .login-form-panel{
    min-height:100vh;
    padding:28px 20px;
  }

  .login-card{
    width:min(420px,100%);
  }

  .login-mobile-brand{
    display:flex;
  }
}

/* v14: acompanhamento do realizado */
.realization-view[hidden]{display:none}

.realization-eyebrow{
  margin-bottom:6px;
  color:var(--accent);
  font-size:11px;
  font-weight:700;
  letter-spacing:.08em;
  text-transform:uppercase;
}

.realization-notice{
  margin-bottom:14px;
  padding:12px 14px;
  border:1px solid #f5d49b;
  border-radius:12px;
  background:#fffbeb;
  color:#7a4b08;
  font-size:12px;
  line-height:1.55;
}

.realization-kpis{
  display:grid;
  grid-template-columns:repeat(4,minmax(0,1fr));
  gap:12px;
  margin-bottom:16px;
}

.realization-grid{
  display:grid;
  grid-template-columns:minmax(0,1.35fr) minmax(330px,.65fr);
  gap:16px;
  align-items:start;
}

.realization-status-badge,
.history-status-badge{
  display:inline-flex;
  align-items:center;
  width:max-content;
  border-radius:999px;
  padding:5px 9px;
  font-size:10px;
  font-weight:700;
  letter-spacing:.02em;
  white-space:nowrap;
}

.status-simulation{
  background:#f2f4f7;
  color:#475467;
}

.status-in-progress{
  background:#fff7e8;
  color:#9a4f05;
}

.status-finalized{
  background:#ecfdf3;
  color:#067647;
}

.realization-help{
  margin:-2px 0 12px;
  color:var(--muted);
  font-size:12px;
  line-height:1.55;
}

.field textarea{
  width:100%;
  resize:vertical;
  min-height:104px;
  border:1px solid var(--line-strong);
  border-radius:10px;
  background:#fff;
  color:var(--text);
  padding:11px 12px;
  outline:none;
  font:inherit;
  font-size:13px;
  line-height:1.5;
}

.field textarea:focus{
  border-color:#98a2b3;
  box-shadow:0 0 0 3px rgba(152,162,179,.12);
}

.realization-comparison-panel{
  position:sticky;
  top:84px;
}

.comparison-table-wrap{
  overflow-x:auto;
}

.comparison-table{
  width:100%;
  border-collapse:collapse;
  font-size:12px;
}

.comparison-table th,
.comparison-table td{
  padding:10px 8px;
  border-bottom:1px solid var(--line);
  text-align:right;
  white-space:nowrap;
}

.comparison-table th:first-child,
.comparison-table td:first-child{
  text-align:left;
}

.comparison-table th{
  color:var(--muted);
  font-size:10px;
  text-transform:uppercase;
  letter-spacing:.04em;
}

.comparison-total td{
  font-weight:700;
  color:#111827;
}

.realization-summary-box{
  margin-top:14px;
  padding:14px;
  border:1px solid var(--line);
  border-radius:12px;
  background:var(--surface-soft);
  display:grid;
  gap:3px;
}

.realization-summary-box span,
.realization-summary-box small{
  color:var(--muted);
  font-size:11px;
}

.realization-summary-box strong{
  font-size:20px;
}

.history-card-header-line{
  display:flex;
  align-items:flex-start;
  justify-content:space-between;
  gap:10px;
  margin-bottom:4px;
}

.history-realized-box{
  margin-top:10px;
  padding:10px;
  border:1px solid var(--line);
  border-radius:10px;
  background:var(--surface-soft);
  display:grid;
  grid-template-columns:repeat(2,minmax(0,1fr));
  gap:6px 10px;
  font-size:11px;
  color:var(--muted);
}

.history-realized-box strong{
  display:block;
  margin-top:2px;
  color:#111827;
  font-size:12px;
}

.history-controls{
  grid-template-columns:minmax(170px,1.3fr) minmax(140px,.9fr) 150px 150px 175px auto;
}

@media(max-width:1150px){
  .realization-kpis{grid-template-columns:repeat(2,minmax(0,1fr))}
  .realization-grid{grid-template-columns:1fr}
  .realization-comparison-panel{position:static}
  .history-controls{grid-template-columns:repeat(2,minmax(0,1fr))}
}

@media(max-width:620px){
  .realization-kpis{grid-template-columns:1fr 1fr;gap:10px}
  .realization-kpis .kpi-value{font-size:17px}
  .realization-hero .hero-actions{width:100%}
  .realization-hero .hero-actions .btn{flex:1}
  .history-realized-box{grid-template-columns:1fr}
  .history-controls{grid-template-columns:1fr}
}

.history-card-actions{flex-wrap:wrap}
.history-card-actions .mini-btn:first-child{flex:1 1 100%}
