    :root { color-scheme: light; font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; font-size: 16px; background:#f3f5f4; color:#203c31; }
    * { box-sizing:border-box; }
    body { margin:0; min-height:100vh; }
    button, input { font:inherit; }
    button { cursor:pointer; }
    .topbar { background:#123d30; color:#fff; border-bottom:4px solid #8fbaa5; }
    .topinner { max-width:1120px; margin:auto; padding:24px 28px; display:flex; align-items:center; gap:14px; }
    .topinner strong { font-size:1.2rem; letter-spacing:-.035em; }
    main { max-width:1120px; margin:auto; padding:46px 28px 80px; }
    h1 { font-size:clamp(2rem,4vw,3rem); letter-spacing:-.055em; line-height:1.05; margin:0 0 11px; }
    .intro { color:#5b7063; margin:0 0 32px; font-size:1.05rem; }
    .grid { display:grid; grid-template-columns:minmax(0,1.2fr) minmax(315px,.8fr); gap:24px; align-items:start; }
    .card { background:white; border:1px solid #dce5de; border-radius:18px; box-shadow:0 8px 30px rgba(18,61,48,.05); }
    .editor { padding:30px; }
    h2 { font-size:1.15rem; letter-spacing:-.025em; margin:0 0 22px; }
    label { display:block; font-weight:650; font-size:.94rem; margin-bottom:9px; }
    .field { position:relative; }
    input { width:100%; border:1px solid #bdcec4; background:#fff; color:#123d30; border-radius:10px; padding:13px 54px 13px 15px; height:50px; outline:none; transition:border-color .15s,box-shadow .15s; }
    input:focus { border-color:#176149; box-shadow:0 0 0 3px #c7dfd0; }
    input[aria-invalid="true"], select[aria-invalid="true"], textarea[aria-invalid="true"] { border-color:#b34e3c !important; background-color:#fff6f4; }
    .field-error { display:block; color:#a53426; font-size:.875rem; font-weight:500; line-height:1.45; margin:6px 0 10px; white-space:normal; scroll-margin:100px; }
    .field-error[hidden] { display:none; }
    [aria-invalid="true"] { scroll-margin:100px; }
    .unit { position:absolute; right:15px; top:50%; transform:translateY(-50%); color:#647b6b; font-size:.9rem; pointer-events:none; }
    .section { border-top:1px solid #e3e9e5; margin-top:27px; padding-top:26px; }
    .oilrow { display:grid; grid-template-columns:1fr 1fr; gap:16px; }
    .factor-panel { background:#f0f6f2; border:1px solid #d8e5dc; border-radius:12px; padding:18px; margin-bottom:29px; }
    .factor-panel h2 { margin-bottom:6px; }
    .factor-panel .hint { margin:0 0 17px; }
    .twocol { display:grid; grid-template-columns:1fr 1fr; gap:16px; }
    .basis-note { color:#627869; font-size:.88rem; line-height:1.45; margin:0 0 17px; }
    .basis-error { min-height:1.2em; color:#a54132; font-size:.88rem; margin:10px 0 0; }
    .weight-row { margin-top:17px; }
    .weight-warning { background:#fff5df; color:#704b13; border:1px solid #efd49a; border-radius:9px; padding:11px 13px; line-height:1.45; margin:14px 0 0; font-size:.88rem; }
    .weight-warning[hidden] { display:none; }
    .hint { color:#627869; font-size:.87rem; margin:10px 0 0; line-height:1.45; }
    .sectionhead { display:flex; align-items:center; justify-content:space-between; gap:15px; margin-bottom:18px; }
    .sectionhead h2 { margin:0; }
    .quote-settings { display:grid; grid-template-columns:1fr 1fr; gap:16px; margin-bottom:17px; }
    .quote-settings + .hint { margin-bottom:18px; }
    .quote-settings select,.customer select { width:100%; height:50px; border:1px solid #bdcec4; border-radius:10px; background:#fff; color:#123d30; padding:0 12px; font:inherit; }
    .quote-settings select:focus,.customer select:focus { outline:3px solid #c7dfd0; border-color:#176149; }
    #exchange-rate[readonly] { background:#edf2ee; color:#405d50; cursor:default; }
    .exchange-meta { display:flex; align-items:baseline; justify-content:space-between; gap:8px; }
    .exchange-meta .hint { margin-top:6px; }
    .retry-rate { border:0; padding:0; background:none; color:#176149; font:inherit; font-size:.87rem; font-weight:700; text-decoration:underline; white-space:nowrap; }
    .customer-head { display:flex; justify-content:space-between; align-items:center; gap:14px; margin-bottom:7px; }
    .customer-head h2 { margin:0; }
    .customer-head select { width:auto; min-width:118px; height:42px; }
    .price-precision { margin-bottom:20px; }
    .price-precision select { height:42px; }
    .freighthead { margin-bottom:18px; }
    .all-in-choice { display:flex; gap:10px; align-items:center; margin-top:16px; padding:13px 15px; border:1px solid #d3e5da; border-radius:10px; background:#f2f8f4; }
    .all-in-choice input { width:19px; height:19px; margin:0; flex:none; accent-color:#176149; }
    .all-in-choice label { margin:0; cursor:pointer; }
    .customer > .all-in-choice { margin-top:0; }
    #markup-type { width:100%; height:50px; padding:0 12px; border:1px solid #bdcec4; border-radius:10px; background:#fff; color:#123d30; font:inherit; }
    .internal-label { margin-left:8px; color:#5b7063; font-size:.875rem; font-weight:400; }
    .invalid-calculator { border-color:#d9aaa2; }
    .invalid-calculator .error { margin:12px 0 0; }
    .calc-open { border:1px solid #bcd5c6; border-radius:9px; background:#eaf3ed; color:#176149; padding:9px 13px; font-weight:700; white-space:nowrap; }
    .calc-open:hover { background:#dcece2; }
    .calc-dialog { border:0; border-radius:18px; padding:0; width:min(620px,calc(100% - 24px)); max-height:calc(100vh - 32px); overflow:auto; color:#203c31; box-shadow:0 24px 80px rgba(10,35,25,.35); }
    .calc-dialog::backdrop { background:rgba(10,35,25,.57); }
    .calc-inner { padding:28px; }
    .dialog-head { display:flex; justify-content:space-between; align-items:start; gap:20px; margin-bottom:22px; }
    .dialog-head h2 { margin:0 0 5px; font-size:1.45rem; }
    .dialog-head p { margin:0; color:#627869; font-size:.9rem; }
    .close-dialog { border:0; background:#edf2ee; color:#435e50; border-radius:8px; font-size:1.5rem; width:38px; height:38px; line-height:1; }
    .calc-dialog select { width:100%; height:50px; border:1px solid #bdcec4; border-radius:10px; background:#fff; color:#123d30; padding:0 12px; font:inherit; }
    .calc-dialog select:focus { outline:3px solid #c7dfd0; border-color:#176149; }
    .calc-section { border-top:1px solid #e3e9e5; margin-top:21px; padding-top:21px; }
    .calc-section h3 { font-size:1rem; margin:0 0 15px; }
    .calc-section .twocol + .twocol { margin-top:15px; }
    .calc-dialog .twocol > div { min-width:0; }
    .calc-dialog .unit { right:12px; }
    .calc-dialog input { padding-right:62px; }
    .calc-preview { margin-top:22px; padding:18px; border-radius:12px; background:#f0f6f2; }
    .calc-preview span { display:block; color:#557060; font-size:.88rem; }
    .calc-preview strong { display:block; margin-top:4px; font-size:1.5rem; font-variant-numeric:tabular-nums; }
    .calc-preview small { display:block; color:#5d7364; margin-top:5px; font-size:.86rem; }
    .calc-feedback { min-height:1.35em; margin:12px 0; color:#a54132; font-size:.9rem; }
    .calc-apply { width:100%; padding:14px; border:0; border-radius:10px; background:#176149; color:#fff; font-weight:750; }
    .calc-apply:disabled { opacity:.5; cursor:not-allowed; }
    .calc-apply:not(:disabled):hover { background:#104c39; }
    [hidden] { display:none !important; }
    .add { color:#176149; background:#eaf3ed; border:1px solid #c7dfd0; border-radius:9px; padding:9px 13px; font-weight:700; }
    .add:hover { background:#dcece2; }
    #surcharges { container-type:inline-size; }
    .surcharge { display:grid; grid-template-columns:minmax(0,1fr) minmax(110px,.6fr) minmax(160px,.85fr) 42px; gap:10px; margin-bottom:12px; align-items:start; }
    .surcharge > div { min-width:0; }
    .surcharge label { font-size:.875rem; line-height:20px; margin-bottom:6px; }
    .surcharge .remove { margin-top:26px; }
    .surcharge input { height:46px; padding:10px 12px; }
    .surcharge select { width:100%; height:46px; border:1px solid #bdcec4; border-radius:9px; background:#fff; color:#123d30; padding:0 8px; font:inherit; }
    .surcharge select:focus { outline:3px solid #c7dfd0; border-color:#176149; }
    .surcharge .amount { padding-right:49px; }
    .surcharge .unit { right:10px; font-size:.8rem; }
    .remove { height:46px; width:42px; border:1px solid #e1e7e3; border-radius:9px; background:#fff; color:#536b5c; font-size:1.5rem; line-height:1; }
    .remove:hover { background:#fff0ed; color:#a94431; }
    .summary { overflow:hidden; position:sticky; top:24px; }
    .summaryhead { background:#123d30; color:white; padding:28px 30px 25px; }
    .summaryhead h2 { margin:0 0 6px; font-size:1.15rem; }
    .summaryhead p { margin:0; color:#c6dfd1; font-size:.9rem; }
    .shipment { padding:20px 30px; background:#f7faf9; border-bottom:1px solid #e0e9e2; line-height:1.55; }
    .shipment strong { display:block; }
    .shipment span { color:#5f7667; font-size:.91rem; }
    .lines { padding:26px 30px 22px; }
    .line { display:flex; justify-content:space-between; gap:15px; margin-bottom:18px; font-size:.96rem; }
    .line span:first-child { min-width:0; overflow-wrap:anywhere; color:#4f6859; }
    .line strong { white-space:nowrap; font-weight:650; font-variant-numeric:tabular-nums; }
    .line small { display:block; font-size:.83rem; color:#778b7d; margin-top:3px; }
    .total { background:#eaf3ed; border-top:1px solid #d4e5da; display:flex; align-items:baseline; justify-content:space-between; gap:12px; padding:25px 30px 29px; }
    .total span { font-weight:700; }
    .total strong { font-size:clamp(1.6rem,2.5vw,2.15rem); letter-spacing:-.05em; white-space:nowrap; font-variant-numeric:tabular-nums; }
    .customer { padding:25px 30px 30px; border-top:1px solid #dce7e0; }
    .customer h2 { margin-bottom:7px; }
    .customer p { color:#627869; font-size:.88rem; margin:0 0 15px; line-height:1.45; }
    .customer textarea { display:block; width:100%; min-height:175px; resize:vertical; border:1px solid #cbdcd1; border-radius:10px; background:#f8faf9; color:#203c31; padding:14px; font:inherit; font-size:.9rem; line-height:1.55; font-variant-numeric:tabular-nums; }
    .customer textarea:focus { outline:3px solid #c7dfd0; border-color:#176149; }
    .copy { width:100%; margin-top:13px; padding:13px 16px; border:0; border-radius:10px; background:#176149; color:white; font-weight:750; }
    .copy:hover { background:#104c39; }
    .copy:disabled { opacity:.55; cursor:not-allowed; }
    .copy-status { min-height:1.3em; margin:8px 0 0 !important; color:#176149 !important; }
    .error { min-height:1.2em; color:#a54132; font-size:.83rem; margin:6px 0 0; }
    @media(max-width:760px) { main { padding:32px 16px 60px; } .topinner { padding:18px 16px; } .grid { grid-template-columns:1fr; } .summary { position:static; } .editor { padding:23px 19px; } .summaryhead,.shipment,.lines,.total,.customer { padding-left:21px; padding-right:21px; } }
    @media(max-width:620px) { .surcharge { grid-template-columns:minmax(0,1fr) minmax(0,1fr) 42px; gap:8px; } .surcharge .name-cell { grid-column:1/-1; } }
    @media(max-width:420px) { .oilrow,.twocol,.quote-settings { grid-template-columns:1fr; } .surcharge { grid-template-columns:minmax(0,1fr) minmax(0,1fr) 38px; gap:7px; } .remove { width:38px; } .total { flex-wrap:wrap; } .calc-inner { padding:22px 18px; } }

    /* FreightSum navigation and calculator overview. */
    [hidden] { display:none !important; }
    .topbar { border-bottom:0; box-shadow:0 1px 0 rgba(255,255,255,.07); }
    .topinner { padding-top:21px; padding-bottom:21px; justify-content:space-between; }
    .brand-link { display:inline-flex; align-items:center; gap:12px; color:#fff; text-decoration:none; border-radius:9px; }
    .brand-symbol { display:block; width:42px; height:42px; flex:none; }
    .brand-link strong { font-size:1.45rem; font-weight:750; letter-spacing:-.045em; }
    .brand-link:focus-visible,.calculator-tile:focus-visible,.add-calculator:focus-visible,.back-home:focus-visible { outline:3px solid #8fbaa5; outline-offset:5px; }
    #home-view { padding-top:56px; }
    .home-heading { display:flex; justify-content:space-between; align-items:center; gap:24px; margin-bottom:35px; }
    .home-heading h1 { font-size:clamp(2rem,4vw,2.7rem); letter-spacing:-.055em; margin:0 0 12px; }
    .home-heading p { margin:0; color:#627869; line-height:1.6; font-size:1rem; }
    .add-calculator { display:inline-flex; align-items:center; justify-content:center; gap:10px; background:#176149; border:1px solid #176149; color:#fff; border-radius:11px; padding:14px 20px; font-size:.95rem; font-weight:650; min-height:50px; white-space:nowrap; box-shadow:0 4px 12px #17614915; transition:background .18s,transform .18s; }
    .add-calculator:hover { background:#104c39; transform:translateY(-1px); }
    .add-calculator svg { width:19px; height:19px; }
    .calculators-grid { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:24px; }
    .calculator-tile { display:flex; flex-direction:column; min-height:326px; padding:29px 30px 0; color:#203c31; text-decoration:none; background:#fff; border:1px solid #dce5de; border-radius:18px; box-shadow:0 7px 28px #123d3006; transition:transform .2s,border-color .2s,box-shadow .2s; overflow:hidden; }
    .calculator-tile:hover { transform:translateY(-4px); border-color:#8fbaa5; box-shadow:0 13px 35px #123d3010; }
    .tile-top { display:flex; align-items:center; justify-content:space-between; margin-bottom:25px; gap:16px; }
    .tile-icon { display:grid; place-items:center; width:54px; height:54px; border-radius:14px; background:#eef5f0; color:#176149; }
    .tile-icon svg { width:29px; height:29px; }
    .tile-type { font-size:.8rem; color:#647d6b; font-weight:600; letter-spacing:.025em; }
    .calculator-tile h2 { font-size:1.4rem; font-weight:720; letter-spacing:-.035em; margin:0 0 11px; }
    .tile-description { color:#607768; font-size:.95rem; line-height:1.6; margin:0 0 20px; max-width:350px; }
    .tile-capabilities { display:flex; flex-wrap:wrap; gap:8px; margin-bottom:25px; }
    .tile-capabilities span { padding:5px 9px; background:#f3f6f4; border-radius:6px; color:#4f6859; font-size:.8rem; }
    .tile-footer { border-top:1px solid #e8ede9; padding:18px 0; margin-top:auto; display:flex; justify-content:space-between; align-items:center; gap:12px; }
    .tile-footer strong { color:#176149; font-size:.94rem; font-weight:700; }
    .tile-footer span { white-space:nowrap; flex-shrink:0; color:#7b8d80; font-size:.8rem; }
    .future-tile { display:flex; flex-direction:column; justify-content:center; align-items:center; text-align:center; min-height:326px; border:1px dashed #bdcec4; border-radius:18px; padding:30px; background:#edf2ee80; }
    .future-symbol { width:49px; height:49px; display:grid; place-items:center; border:1px solid #c7d7cc; color:#7a9283; border-radius:13px; margin-bottom:20px; background:#f8faf9; }
    .future-tile h2 { font-size:1.1rem; color:#4a6657; margin:0 0 11px; letter-spacing:-.025em; }
    .future-tile p { max-width:300px; font-size:.94rem; color:#728778; line-height:1.65; margin:0 0 18px; }
    .back-home { display:inline-flex; align-items:center; justify-content:center; border:1px solid #cbdcd1; background:#fff; color:#476553; border-radius:9px; padding:10px 15px; min-height:44px; font-size:.9rem; font-weight:600; text-decoration:none; margin:0 0 25px; transition:border-color .18s,color .18s; }
    .back-home:hover { color:#176149; border-color:#8fbaa5; }
    #calculator-view h1:focus,#home-title:focus { outline:none; }
    .future-dialog { width:min(460px,calc(100% - 32px)); border:1px solid #dce5de; border-radius:18px; padding:30px; background:#fff; color:#203c31; box-shadow:0 20px 80px #123d3030; }
    .future-dialog::backdrop { background:#123d3080; backdrop-filter:blur(3px); }
    .future-dialog h2 { font-size:1.5rem; margin:0 0 12px; }
    .future-dialog p { color:#607768; font-size:1rem; line-height:1.7; margin:0 0 25px; }
    .future-dialog button { width:100%; }
    @media(max-width:760px) {
      #home-view { padding-top:35px; }
      .home-heading { align-items:flex-start; flex-direction:column; gap:20px; margin-bottom:26px; }
      .home-heading .add-calculator { align-self:flex-start; }
      .calculators-grid { gap:18px; }
      .calculator-tile { padding:23px 22px 0; }
      .future-tile { padding:24px 20px; }
    }
    @media(max-width:620px) {
      .calculators-grid { grid-template-columns:1fr; }
      .calculator-tile { min-height:308px; }
      .future-tile { min-height:250px; }
      .brand-symbol { width:38px; height:38px; }
      .brand-link strong { font-size:1.3rem; }
    }
    @media(prefers-reduced-motion:reduce) {
      .calculator-tile,.add-calculator { transition:none; }
      .calculator-tile:hover,.add-calculator:hover { transform:none; }
    }

    .account-actions { display:flex; align-items:center; flex-wrap:wrap; gap:10px; }
    .account-actions { color:#cbdcd1; font-size:.85rem; }
    .account-actions button { background:transparent; border:1px solid #607b6b; color:white; padding:9px 13px; border-radius:8px; }
    .login-card { max-width:430px; margin:35px auto; padding:32px; background:white; border:1px solid #dce5de; border-radius:18px; box-shadow:0 12px 40px #123d3008; }
    .login-card h1 { margin-bottom:10px; }
    .login-card p { color:#607768; line-height:1.6; }
    .login-card label { margin-top:20px; }
    .login-card input { width:100%; margin-top:8px; }
    .login-card button { width:100%; margin-top:24px; }
    .calculator-tile .open-tile { width:auto; border:0; background:none; color:#176149; text-align:left; padding:18px 0; font-weight:700; }
    .app-status { color:#607768; line-height:1.5; margin-bottom:20px; }
    .app-status[data-error="true"] { color:#a54132; }
    #calculator-name { max-width:330px; }
    @media(max-width:620px) { .account-actions span { display:none; } .login-card { padding:24px; } }

    .calculator-navigation { display:flex; flex-wrap:wrap; gap:12px; margin-bottom:30px; }
    .calculator-navigation .back-home { margin:0; }
    #save-status:empty,#dashboard-status:empty { display:none; }
    .calculator-tile { position:relative; cursor:pointer; }
    .calculator-tile h2 { font-size:1.4rem; }
    .calculator-tile .tile-top { padding-right:48px; }
    .tile-settings { position:absolute; top:31px; right:25px; width:36px; height:36px; display:grid; place-items:center; border:0; border-radius:9px; background:transparent; color:#6b8273; z-index:2; }
    .tile-settings:hover { color:#176149; background:#eef5f0; }
    .tile-settings svg { width:21px; height:21px; }
    .tile-settings:focus-visible { outline:3px solid #8fbaa5; }
    .tile-footer .open-tile { text-decoration:none; color:#176149; font-size:.94rem; font-weight:700; }
    .future-tile { width:100%; font:inherit; cursor:pointer; transition:background .2s,border-color .2s; }
    .future-tile:hover { background:#e5eee7; border-color:#8fbaa5; }
    .future-tile:focus-visible { outline:3px solid #8fbaa5; outline-offset:4px; }
    .future-dialog .dialog-head { align-items:center; }
    .future-dialog .dialog-head h2 { margin:0; }
    .future-dialog .close-dialog { width:36px; flex:none; }
    .future-dialog input { padding-right:15px; }
    .future-dialog select { width:100%; height:50px; padding:0 12px; border:1px solid #bdcec4; border-radius:10px; color:#203c31; background:white; font:inherit; }
    .future-dialog #calculator-name { max-width:none; }
    .settings-fields { margin:20px 0; }
    .future-dialog .settings-note { font-size:.875rem; margin:14px 0; line-height:1.5; }
    .dialog-actions { display:flex; justify-content:space-between; align-items:center; gap:12px; margin-top:22px; }
    .future-dialog .dialog-actions button { width:auto; margin:0; }
    .dialog-actions .add-calculator { margin-left:auto !important; }
    .delete-calculator { color:#a54132; background:none; padding:10px 0; border:0; font-size:.9rem; }
    .add-choices { display:grid; gap:14px; }
    .choice-button { display:flex; flex-direction:column; align-items:flex-start; text-align:left; gap:8px; padding:20px; border:1px solid #d2e1d8; border-radius:12px; background:#f8fbf9; color:#203c31; }
    .choice-button:hover { background:#eef5f0; border-color:#8fbaa5; }
    .choice-button strong { font-size:1rem; }
    .choice-button span { color:#607768; line-height:1.5; font-size:.9rem; }

    .tariff-editor-section { padding:28px; margin-bottom:24px; }
    .tariff-editor-section .hint { margin:0 0 18px; }
    .tariff-three { display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:18px; }
    .tariff-field { display:flex;flex-direction:column;gap:8px;margin:0 0 16px;min-width:0;font-size:.94rem; }
    .tariff-field.tariff-checkbox { flex-direction:row;align-items:center;align-self:center;gap:12px;margin-top:16px;cursor:pointer; }
    .tariff-checkbox input[type="checkbox"] { width:20px;height:20px;padding:0;margin:0;flex:none;accent-color:#176149; }
    .tariff-field input { padding-right:15px; }
    #tariff-editor select,#tariff-via-select,.tariff-price-controls select { width:100%;height:50px;padding:0 12px;border:1px solid #bdcec4;border-radius:10px;background:white;color:#203c31;font:inherit; }
    #tariff-editor input:focus,#tariff-editor select:focus,#tariff-via-select:focus,.tariff-price-controls select:focus { outline:3px solid #c7dfd0; }
    .secondary-button { border:1px solid #bdd4c6;border-radius:9px;padding:11px 15px;background:#eef5f0;color:#176149;font-weight:650; }
    .secondary-button:hover { background:#e4eee7; }
    .tariff-component { border:1px solid #c1d8ca;border-radius:14px;background:#f7faf8;padding:20px;margin-top:20px; }
    .tariff-component > .sectionhead { align-items:flex-end;flex-wrap:wrap; }
    .tariff-component > .sectionhead .tariff-field { flex:1 1 220px; }
    .tariff-component > .sectionhead h3 { margin:14px 0 0;color:#203c31; }
    .component-routing { border:1px solid #cbdcd1;border-radius:12px;padding:18px;margin:6px 0 20px;background:#fff; }
    .routing-heading { font-weight:700;cursor:pointer;margin-bottom:16px; }
    .tariff-price-controls { padding:20px 30px 0; }
    .tariff-price-item { padding:14px 0;border-bottom:1px solid #e1ebe4; }
    .tariff-price-item .line { padding:0 0 8px; }
    .tariff-price-note { margin:4px 0;color:#52705e;font-size:14px;line-height:1.5;overflow-wrap:anywhere; }
    .routing-help { margin:16px 0; }
    .routing-help summary { color:#176149;cursor:pointer; }
    .routing-help ul { padding-left:22px;line-height:1.65;font-size:14px; }
    .routing-help li { margin:8px 0; }
    .routing-help code { font-weight:700; }

    .component-routing > .tariff-field { max-width:220px; }
    .routing-table { border-collapse:collapse;width:100%;font-size:.9rem; }
    .routing-table th { text-align:left;background:#edf4ef;vertical-align:top;padding:10px; }
    .routing-table td { padding:8px;border-bottom:1px solid #e2eae4; }
    .routing-table input,.routing-table select { min-width:155px;padding:10px;height:46px; }
    .routing-table .routing-origin-country { min-width:0; }
    .routing-table th:first-child { min-width:175px; }
    .routing-remove { border:0;background:transparent;color:#8e423c;padding:6px 0;font:inherit;font-size:.875rem; }
    .routing-actions { display:flex;flex-wrap:wrap;gap:12px; }
    .routing-status { color:#176149;line-height:1.5;margin:14px 0 0; }
    .tariff-zone { border:1px solid #d5e1d8;border-radius:12px;margin-top:18px;background:white; }
    .tariff-zone summary { cursor:pointer;padding:18px;font-weight:700;background:#f2f7f3;border-radius:12px; }
    .zone-content { padding:20px; }
    .zone-content h3 { font-size:1rem;margin:12px 0; }
    .zone-content .sectionhead { flex-wrap:wrap; }
    .zone-content .sectionhead .tariff-field { flex:1;max-width:440px; }
    .tariff-table-scroll { overflow:auto;margin:18px 0; }
    .tariff-table { border-collapse:collapse;width:100%;min-width:1180px;font-size:.875rem; }
    .tariff-table th { padding:10px 8px;text-align:left;background:#edf4ef; }
    .tariff-table td { padding:10px 6px;border-bottom:1px solid #e2eae4;vertical-align:top; }
    .tariff-table .band-price-cell { position:relative;padding-bottom:38px; }
    .band-price-cell > .field-error { position:absolute;top:66px;left:6px;right:6px;margin:0; }
    .tariff-table input { padding:10px;min-width:110px; }
    .tariff-table .band-upper { min-width:160px; }
    .tariff-table .band-mode { min-width:160px; }
    .band-lower { white-space:nowrap;font-variant-numeric:tabular-nums;color:#607768; }
    .tariff-table input:disabled { background:#f0f3f1;color:#87978c; }
    .tariff-fee { display:grid;grid-template-columns:minmax(0,2fr) minmax(0,1fr) minmax(0,2fr) 42px;gap:15px;align-items:center;margin-top:15px; }
    .tariff-save-row { display:flex;justify-content:space-between;align-items:center;gap:16px; }
    .tariff-save-row .add-calculator { margin-left:auto; }
    .tariff-shipment h3 { font-size:1rem;color:#176149;margin:0 0 14px; }
    .tariff-shipment label { margin-top:16px; }
    #tariff-via-select { cursor:pointer;transition:border-color .15s,box-shadow .15s; }
    #tariff-via-select:hover:not(:disabled) { border-color:#176149; }
    #tariff-via-select:disabled { background:#f2f6f3;color:#203c31;opacity:1;cursor:default; }
    .tariff-shipment input { padding-right:15px; }
    #tariff-result-lines .line { display:flex;justify-content:space-between;gap:15px;padding:9px 0; }
    #tariff-result-lines .line strong { white-space:nowrap; }
    #tariff-calculator .summaryhead p { margin-bottom:0; }
    #tariff-calculator-description { line-height:1.6; }
    .sr-only { position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap; }
    @media(max-width:760px) { .tariff-three { grid-template-columns:1fr;gap:0; }.tariff-editor-section { padding:20px 16px; }.tariff-component { padding:15px; }.zone-content { padding:15px; }.tariff-editor-section .sectionhead { flex-wrap:wrap; }.tariff-fee { grid-template-columns:repeat(2,minmax(0,1fr)) 42px;gap:8px; }.tariff-fee .tariff-field:first-child { grid-column:1/-1; } }
    @media(max-width:420px) { .tariff-fee { grid-template-columns:1fr 42px; }.tariff-fee .tariff-field { grid-column:1/-1; }.tariff-fee .remove { grid-column:2; } }

    @container (max-width:500px) {
      .surcharge { grid-template-columns:minmax(0,1fr) minmax(0,1fr) 42px; }
      .surcharge .name-cell { grid-column:1/-1; }
    }
    @container (max-width:360px) {
      .surcharge { grid-template-columns:minmax(0,1fr) 42px; }
      .surcharge > div { grid-column:1; }
      .surcharge .name-cell { grid-column:1/-1; }
      .surcharge .remove { grid-column:2; grid-row:3; }
    }

    .reset-calculation { min-height:44px; padding:10px 15px; border:1px solid #b34e3c; border-radius:9px; background:#fff6f4; color:#923728; font:inherit; font-weight:650; }
    .reset-calculation:hover { background:#fbe8e3; }
    .transfer-add { width:100%; margin-top:12px; white-space:normal; line-height:1.4; }

    .price-history { margin:18px 0; padding:16px; border:1px solid #d3e5da; border-radius:12px; background:#f7fbf8; }
    .price-history .sectionhead { align-items:flex-start; flex-wrap:wrap; margin-bottom:8px; }
    .price-history h3 { margin:0; font-size:1rem; }
    .price-history .secondary-button { font-size:.875rem; }
    .history-group { border-top:1px solid #dce8e0; margin-top:16px; padding-top:14px; }
    .history-group h4 { margin:0; font-size:.95rem; overflow-wrap:anywhere; }
    .history-price-row { display:grid; grid-template-columns:minmax(0,1fr) auto 36px; align-items:center; gap:10px; margin-top:10px; font-size:.875rem; }
    .history-price-row span { overflow-wrap:anywhere; }
    .history-price-row strong { font-variant-numeric:tabular-nums; }
    .history-remove { width:36px; height:36px; border:1px solid #d8c9c5; border-radius:8px; background:#fff; color:#923728; font-size:1.4rem; }
    .history-remove:hover { background:#fbe8e3; }
    .history-subtotal { text-align:right; font-size:.875rem; font-weight:650; margin:12px 0 0; }

    .tariff-fee { grid-template-columns:minmax(0,1.4fr) minmax(125px,.8fr) minmax(110px,.7fr) minmax(0,1.2fr) 42px; align-items:start; }
    .tariff-fee > .remove { margin-top:28px; grid-column:-2/-1; grid-row:1; }
    .fee-unit-fields,.surcharge-unit-settings { grid-column:1/-1; display:grid; grid-template-columns:1fr 1fr; gap:15px; background:#f2f8f4; padding:14px; border-radius:10px; }
    .surcharge .surcharge-unit-settings { grid-column:1/-1; }
    .surcharge-unit-settings input { padding-right:12px; }
    @media(max-width:760px) { .tariff-fee { grid-template-columns:minmax(0,1fr) minmax(0,1fr) 42px; } .tariff-fee > .tariff-field:first-child { grid-column:1/-1; } .tariff-fee > .remove { grid-column:3;grid-row:2; } .tariff-fee > .tariff-field:nth-child(4) { grid-column:1/3; } }
    @media(max-width:420px) { .tariff-fee { grid-template-columns:minmax(0,1fr) 42px; } .tariff-fee > .tariff-field { grid-column:1; } .tariff-fee > .tariff-field:first-child { grid-column:1/-1; } .tariff-fee > .tariff-field:nth-child(4) { grid-column:1; } .tariff-fee > .remove { grid-column:2;grid-row:2; } .fee-unit-fields,.surcharge-unit-settings { grid-template-columns:1fr; } }

    .tariff-table .band-markup { min-width:110px; }
    .tariff-table td:last-child { min-width:54px; }
    .history-markup { margin:4px 0 12px; }

    .tariff-table .band-markup-minimum { min-width:140px; }

    .tariff-component > .component-header {
      display:grid;
      grid-template-columns:minmax(180px,1fr) minmax(180px,1fr) auto auto;
      align-items:end;
      gap:15px;
    }
    .component-header > .tariff-field { margin:0; }
    .component-header > button { min-height:50px; margin:0; white-space:nowrap; }
    @media(max-width:1000px) {
      .tariff-component > .component-header { grid-template-columns:repeat(2,minmax(0,1fr)); }
      .component-header > button { justify-self:end; }
    }
    @media(max-width:520px) {
      .tariff-component > .component-header { grid-template-columns:minmax(0,1fr); }
      .component-header > button { justify-self:stretch; }
    }
    #copy-component-dialog select { width:100%; min-height:50px; padding:12px; border:1px solid #bdcec4; border-radius:10px; background:white; color:#123d30; font:inherit; }
    #copy-component-dialog .add-calculator { margin-top:18px; }

/* Theme controls and dark surfaces. Layout and calculator rules stay shared. */
.theme-toggle {
  margin-left:auto;
  flex-shrink:0;
  min-height:44px;
  padding:9px 13px;
  border:1px solid #8fbaa5;
  border-radius:8px;
  background:transparent;
  color:#fff;
  font-size:.875rem;
  font-weight:650;
}
.theme-toggle:hover { background:#ffffff12; }
.theme-toggle:focus-visible { outline:3px solid #E8B966; outline-offset:3px; }
@media(max-width:520px) {
  .topinner { flex-wrap:wrap; gap:12px; }
  .account-actions { margin-left:auto; }
}
html[data-theme="dark"] {
  color-scheme:dark;
  background:#151515;
  color:#f1f1f1;
  --dark-surface:#202020;
  --dark-raised:#292929;
  --dark-border:#505050;
  --dark-muted:#bfbfbf;
  --dark-accent:#8ed5b0;
}
html[data-theme="dark"] :is(.card,.login-card,.calculator-tile,.calc-dialog,.future-dialog,.tariff-zone,.component-routing) {
  background:var(--dark-surface);
  color:#f1f1f1;
  border-color:var(--dark-border);
  box-shadow:none;
}
html[data-theme="dark"] :is(.topbar,.summaryhead) { background:#191919; }
html[data-theme="dark"] .summaryhead p { color:var(--dark-muted); }
html[data-theme="dark"] :is(input,select,textarea,.customer textarea,#markup-type,#copy-component-dialog select,#tariff-editor select,#tariff-via-select,.tariff-price-controls select) {
  background:#181818;
  color:#f1f1f1;
  border-color:var(--dark-border);
}
html[data-theme="dark"] input::placeholder,
html[data-theme="dark"] textarea::placeholder { color:#aaaaaa; opacity:1; }
html[data-theme="dark"] :is(input,select,textarea):focus { border-color:#8ed5b0; outline-color:#8ed5b0; box-shadow:0 0 0 3px #8ed5b030; }
html[data-theme="dark"] :is(input:disabled,select:disabled,input[readonly],#exchange-rate[readonly],#tariff-via-select:disabled) {
  background:#303030;
  color:var(--dark-muted);
}
html[data-theme="dark"] :is(.factor-panel,.all-in-choice,.calc-preview,.shipment,.total,.tariff-component,.price-history,.fee-unit-fields,.surcharge-unit-settings,.tariff-zone summary,.routing-table th,.tariff-table th,.tile-capabilities span,.tile-icon,.future-symbol,.choice-button,.future-tile,.close-dialog) {
  background:var(--dark-raised);
  color:#f1f1f1;
  border-color:var(--dark-border);
}
html[data-theme="dark"] :is(.intro,.hint,.basis-note,.unit,.internal-label,.dialog-head p,.calc-preview span,.calc-preview small,.shipment span,.line span:first-child,.line small,.customer p,.home-heading p,.tile-type,.tile-description,.tile-footer span,.future-tile p,.login-card p,.app-status,.choice-button span,.future-dialog p,.tariff-price-note,.band-lower,.history-markup) {
  color:var(--dark-muted);
}
html[data-theme="dark"] :is(.section,.calc-section,.customer,.total,.shipment,.tile-footer,.history-group,.tariff-price-item,.routing-table td,.tariff-table td) { border-color:var(--dark-border); }
html[data-theme="dark"] :is(.calc-open,.add,.secondary-button,.back-home,.remove,.history-remove) {
  background:var(--dark-raised);
  color:var(--dark-accent);
  border-color:var(--dark-border);
}
html[data-theme="dark"] :is(.calc-open,.add,.secondary-button,.back-home,.choice-button,.future-tile,.tile-settings,.close-dialog):hover {
  background:#363636;
  color:#f1f1f1;
  border-color:#8ed5b0;
}
html[data-theme="dark"] :is(.retry-rate,.copy-status,.routing-help summary,.routing-status,.tariff-shipment h3,.tile-settings,.tile-footer strong,.tile-footer .open-tile,.calculator-tile .open-tile,.future-tile h2,.tariff-component > .sectionhead h3) { color:var(--dark-accent) !important; }
html[data-theme="dark"] :is(.copy,.calc-apply,.add-calculator) { background:#176149; color:#fff; border-color:#40896a; }
html[data-theme="dark"] :is(.copy,.calc-apply,.add-calculator):not(:disabled):hover { background:#237b5e; }
html[data-theme="dark"] :is(.error,.field-error,.basis-error,.calc-feedback,.delete-calculator,.routing-remove,.app-status[data-error="true"]) { color:#ffb0a1; }
html[data-theme="dark"] :is(input,select,textarea)[aria-invalid="true"],
html[data-theme="dark"] .reset-calculation { background:#38221e; border-color:#e58b79 !important; color:#ffb0a1; }
html[data-theme="dark"] :is(.reset-calculation,.remove,.history-remove):hover { background:#4c2923; color:#ffb0a1; }
html[data-theme="dark"] .weight-warning { background:#382f1d; color:#f2d49a; border-color:#8d7345; }
html[data-theme="dark"] .invalid-calculator { border-color:#e58b79; }
html[data-theme="dark"] dialog::backdrop { background:#000000b3; }
@media(max-width:820px) {
  .account-actions span { display:none; }
}

.validity-settings { margin:22px 0; }
.validity-toggle { display:flex; align-items:center; gap:10px; cursor:pointer; }
.validity-toggle input { width:19px; height:19px; padding:0; margin:0; flex:none; accent-color:#176149; }
.validity-dates { margin-top:16px; }
.validity-dates input { padding-right:15px; }
.validity-note { color:#627869; font-size:.875rem; line-height:1.5; margin:0 0 20px; }
html[data-theme="dark"] .validity-note { color:var(--dark-muted); }

.validity-status { padding:10px 12px; border:1px solid #bdcec4; border-radius:8px; background:#eef5f0; color:#176149; font-weight:600; }
.validity-status[data-validity="future"] { background:#fff5df; border-color:#e4c77e; color:#704b13; }
.validity-status[data-validity="expired"] { background:#fff0ed; border-color:#dba397; color:#923728; }
html[data-theme="dark"] .validity-status { background:#22352b; border-color:#40896a; color:#8ed5b0; }
html[data-theme="dark"] .validity-status[data-validity="future"] { background:#382f1d; border-color:#8d7345; color:#f2d49a; }
html[data-theme="dark"] .validity-status[data-validity="expired"] { background:#38221e; border-color:#e58b79; color:#ffb0a1; }

.login-card .remember-login { display:flex; align-items:center; gap:10px; cursor:pointer; font-weight:500; }
.login-card .remember-login input { width:19px; height:19px; padding:0; margin:0; flex:none; accent-color:#176149; }

#admin-view { max-width:1160px; margin:34px auto; padding:0 24px 48px; }
.admin-panel { margin:24px 0; padding:24px; border:1px solid #dce5de; border-radius:14px; background:#fff; }
.admin-panel .sectionhead { display:flex; align-items:center; justify-content:space-between; gap:16px; margin-bottom:20px; }
.admin-org-list { display:grid; gap:10px; }
.admin-org-item { display:flex; align-items:center; justify-content:space-between; gap:16px; padding:14px 0; border-top:1px solid #dce5de; }
.admin-org-item strong,.admin-org-item span { display:block; }
.admin-org-item span { color:#607768; margin-top:4px; font-size:.875rem; }
.admin-actions { display:flex; gap:8px; }
.admin-filters { margin:20px 0; }
.admin-filters input,.admin-filters select { width:100%; margin-top:8px; }
.admin-table-wrap { overflow:auto; }
.admin-table { width:100%; border-collapse:collapse; text-align:left; }
.admin-table th { padding:12px; font-size:.8rem; color:#607768; font-weight:600; border-bottom:2px solid #dce5de; }
.admin-table td { padding:16px 12px; border-bottom:1px solid #dce5de; white-space:pre-line; vertical-align:middle; }
.admin-table td:last-child { min-width:190px; }
.admin-table td button { margin:3px; }
.admin-dialog { width:min(480px,calc(100vw - 32px)); padding:28px; border:1px solid #dce5de; border-radius:14px; color:#172620; background:white; }
.admin-dialog input:not([type="checkbox"]),.admin-dialog select { width:100%; margin:8px 0 18px; }
.admin-dialog .sectionhead { display:flex; align-items:center; justify-content:space-between; gap:16px; }
.admin-dialog .close-dialog { font-size:24px; border:0; background:transparent; color:inherit; }
#admin-user-save { width:100%; }
html[data-theme="dark"] :is(.admin-panel,.admin-dialog) { background:var(--dark-surface); color:#f0f0ec; border-color:var(--dark-border); }
html[data-theme="dark"] :is(.admin-org-item,.admin-table td,.admin-table th) { border-color:var(--dark-border); }
html[data-theme="dark"] :is(.admin-table th,.admin-org-item span) { color:var(--dark-muted); }
@media(max-width:620px) {
  #admin-view { padding:0 16px 28px; }
  .admin-panel { padding:16px; }
  .admin-org-item,.admin-panel .sectionhead { align-items:flex-start; flex-wrap:wrap; }
}
@media(max-width:820px) {
  .topinner:has(#admin-open:not([hidden])) { flex-wrap:wrap; }
  .topinner:has(#admin-open:not([hidden])) .account-actions { flex-wrap:wrap; }
}

.login-card .login-reset-link { width:auto; padding:0; margin:20px 0 0; border:0; background:transparent; color:#176149; text-decoration:underline; text-underline-offset:4px; font-weight:600; }
.login-card .login-reset-link:hover { color:#123d30; }
html[data-theme="dark"] .login-card .login-reset-link { color:var(--dark-accent); }

/* Administration uses the same field proportions as the calculators. */
.admin-filters select,.admin-dialog select {
  width:100%;
  height:50px;
  padding:0 14px;
  border:1px solid #bdcec4;
  border-radius:10px;
  background:#fff;
  color:#123d30;
  font:inherit;
}
.admin-filters select:focus-visible,.admin-dialog select:focus-visible {
  outline:3px solid #c7dfd0;
  border-color:#176149;
}
@media(max-width:620px) {
  .admin-filters { grid-template-columns:1fr; }
}

.admin-sort,.admin-org-open { appearance:none; background:none; border:0; border-radius:4px; color:inherit; font:inherit; text-align:left; cursor:pointer; padding:4px 0; }
.admin-sort { font-weight:600; white-space:nowrap; }
.admin-sort:hover,.admin-org-open:hover { color:#176149; text-decoration:underline; }
.admin-sort:focus-visible,.admin-org-open:focus-visible { outline:2px solid #176149; outline-offset:4px; }
.admin-table td .admin-org-open { margin:0; }
html[data-theme="dark"] :is(.admin-sort,.admin-org-open):hover { color:var(--dark-accent); }
