:root {
    --orange: #ff8000;
    --orange-dark: #e66f00;
    --orange-pale: #fff3e6;
    --ink: #171717;
    --ink-soft: #3f3f46;
    --muted: #71717a;
    --line: #e8e8eb;
    --surface: #ffffff;
    --canvas: #f5f5f3;
    --success: #16803c;
    --danger: #c52b2b;
    --shadow: 0 14px 38px rgba(17, 17, 17, .06);
    --radius: 18px;
    font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    color: var(--ink);
    background: var(--canvas);
    font-synthesis: none;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; min-height: 100vh; background: var(--canvas); color: var(--ink); }
button, input, select { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
a { color: inherit; text-decoration: none; }
h1, h2, h3, p { margin-top: 0; }
h1 { margin-bottom: 10px; font-size: clamp(32px, 4vw, 46px); letter-spacing: -.045em; line-height: 1.02; }
h2 { margin-bottom: 4px; font-size: 21px; letter-spacing: -.025em; }
h3 { margin-bottom: 4px; font-size: 17px; }
p { color: var(--muted); line-height: 1.6; }

.sidebar {
    position: fixed; inset: 0 auto 0 0; z-index: 40; width: 238px; padding: 30px 20px 22px;
    display: flex; flex-direction: column; background: #121212; color: #fff;
}
.brand { display: inline-flex; align-items: center; gap: 11px; letter-spacing: -.02em; }
.brand-mark {
    display: grid; place-items: center; width: 38px; height: 38px; border-radius: 10px;
    background: var(--orange); color: #111; font-size: 23px; font-weight: 900; font-style: italic;
    transform: skew(-5deg);
}
.brand strong { display: block; font-size: 17px; line-height: 1; letter-spacing: .05em; }
.brand small { display: block; margin-top: 5px; color: var(--orange); font-size: 9px; letter-spacing: .34em; }
.main-nav { margin-top: 54px; display: grid; gap: 7px; }
.main-nav a { display: flex; align-items: center; gap: 12px; min-height: 46px; padding: 0 14px; border-radius: 11px; color: #aaa; font-size: 14px; font-weight: 650; transition: .18s ease; }
.main-nav a span { width: 20px; color: #777; font-size: 19px; text-align: center; }
.main-nav a:hover, .main-nav a.active { background: #292929; color: #fff; }
.main-nav a.active span { color: var(--orange); }
.sidebar-foot { margin-top: auto; padding: 18px 9px 0; border-top: 1px solid #2b2b2b; }
.sidebar-foot > span { display: block; overflow: hidden; color: #8f8f8f; font-size: 11px; text-overflow: ellipsis; }
.text-button { margin: 7px 0 0; padding: 0; border: 0; background: none; color: #ddd; cursor: pointer; font-size: 12px; }
.text-button:hover { color: var(--orange); }
.text-button.danger { color: var(--danger); }
.mobile-bar { display: none; }

.main-content { min-height: 100vh; margin-left: 238px; padding: 48px clamp(26px, 4.2vw, 72px) 70px; }
.page-header { max-width: 1340px; margin: 0 auto 30px; display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; }
.page-header p:not(.eyebrow) { margin-bottom: 0; }
.eyebrow { margin-bottom: 11px; color: var(--orange-dark); font-size: 11px; font-weight: 800; letter-spacing: .2em; text-transform: uppercase; }
.sender-pill { min-width: 260px; display: flex; align-items: center; gap: 10px; padding: 13px 15px; border: 1px solid var(--line); border-radius: 13px; background: var(--surface); box-shadow: 0 5px 16px rgba(20,20,20,.025); }
.sender-pill .status-dot { width: 8px; height: 8px; border-radius: 50%; background: #2db34a; box-shadow: 0 0 0 4px #e4f7e8; }
.sender-pill div { flex: 1; }
.sender-pill small, .sender-pill strong { display: block; }
.sender-pill small { color: var(--muted); font-size: 10px; }
.sender-pill strong { max-width: 150px; overflow: hidden; font-size: 13px; text-overflow: ellipsis; white-space: nowrap; }
.sender-pill a { color: var(--orange-dark); font-size: 11px; font-weight: 700; }

.card { border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow); }
.shipment-layout { max-width: 1340px; margin: 0 auto; display: grid; grid-template-columns: minmax(0, 1fr) 370px; gap: 24px; align-items: start; }
.form-column { display: grid; gap: 18px; }
.form-section, .settings-section { padding: 26px; }
.section-heading { margin-bottom: 23px; display: flex; align-items: center; justify-content: space-between; gap: 18px; }
.section-heading > div:first-child { display: flex; align-items: center; gap: 13px; }
.section-heading h2, .section-heading p { margin: 0; }
.section-heading p { font-size: 12px; }
.section-heading > a { color: var(--orange-dark); font-size: 12px; font-weight: 700; }
.section-number { display: grid; place-items: center; width: 34px; height: 34px; flex: 0 0 auto; border-radius: 9px; background: var(--orange-pale); color: var(--orange-dark); font-size: 13px; font-weight: 900; }
.section-number.dark { background: #2b2b2b; color: var(--orange); }
.required-note { color: #a1a1aa; font-size: 10px; }

.field-grid { display: grid; gap: 16px; }
.field-grid.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.recipient-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.recipient-grid label:nth-child(3), .recipient-grid label:nth-child(4) { grid-column: span 2; }
.span-2 { grid-column: span 2; }
.street-field { grid-column: span 2; }
.city-field { grid-column: span 2; }
.delivery-mode { margin: -4px 0 18px; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.delivery-mode label { min-height: 66px; padding: 12px 14px; display: flex; grid-template: none; align-items: center; gap: 11px; border: 1px solid #dedee2; border-radius: 11px; background: #fafafa; cursor: pointer; transition: .16s; }
.delivery-mode label:hover, .delivery-mode label.active { border-color: var(--orange); background: var(--orange-pale); box-shadow: 0 0 0 2px rgba(255,128,0,.08); }
.delivery-mode input { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.delivery-mode-icon { width: 34px; height: 34px; flex: 0 0 auto; display: grid; place-items: center; border-radius: 9px; background: #fff; color: var(--orange-dark); font-size: 20px; box-shadow: 0 2px 8px rgba(0,0,0,.04); }
.delivery-mode label > span:last-child { display: grid; gap: 3px; }
.delivery-mode strong { color: var(--ink); font-size: 12px; }
.delivery-mode small { color: var(--muted); font-size: 9px; font-weight: 400; }
.point-mode-hint { margin: -7px 0 17px; padding: 10px 12px; border-radius: 9px; background: #fff8ef; color: #7a5735; font-size: 10px; line-height: 1.45; }
.point-mode-hint[hidden] { display: none; }
.common-point-picker { margin: -7px 0 19px; padding: 14px; display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 12px; border: 1px solid #dedee2; border-radius: 12px; background: #fafafa; }
.common-point-picker[hidden] { display: none; }
.common-point-picker.selected { border-color: var(--orange); background: var(--orange-pale); box-shadow: 0 0 0 2px rgba(255,128,0,.07); }
.common-point-copy { min-width: 0; display: flex; align-items: center; gap: 11px; }
.common-point-icon { width: 36px; height: 36px; flex: 0 0 auto; display: grid; place-items: center; border-radius: 9px; background: #fff; color: var(--orange-dark); font-size: 20px; box-shadow: 0 2px 8px rgba(0,0,0,.05); }
.common-point-copy > div { min-width: 0; display: grid; gap: 3px; }
.common-point-copy strong { font-size: 11px; }
.common-point-copy p { margin: 0; overflow: hidden; color: #6f6f74; font-size: 9px; line-height: 1.4; text-overflow: ellipsis; }
.common-point-actions { display: flex; align-items: center; gap: 9px; }
.common-point-note { grid-column: 1 / -1; padding-top: 9px; border-top: 1px solid #e6e6e8; color: #8a6c50; font-size: 9px; line-height: 1.45; }
label { display: grid; gap: 7px; color: #55555c; font-size: 11px; font-weight: 700; }
input, select { width: 100%; height: 43px; padding: 0 12px; border: 1px solid #dcdce0; border-radius: 9px; outline: none; background: #fff; color: var(--ink); font-size: 13px; transition: border-color .16s, box-shadow .16s; }
input::placeholder { color: #b4b4bb; }
input:focus, select:focus { border-color: var(--orange); box-shadow: 0 0 0 3px rgba(255,128,0,.12); }
input:invalid:not(:placeholder-shown) { border-color: #dc6a6a; }
label small { color: #99999f; font-weight: 400; }

.button { min-height: 40px; padding: 0 16px; display: inline-flex; align-items: center; justify-content: center; gap: 10px; border: 1px solid transparent; border-radius: 9px; cursor: pointer; font-size: 12px; font-weight: 800; transition: transform .15s, background .15s, opacity .15s; }
.button:hover:not(:disabled) { transform: translateY(-1px); }
.button:disabled { opacity: .5; cursor: not-allowed; }
.button.primary { background: var(--orange); color: #161616; }
.button.primary:hover:not(:disabled) { background: #ff9225; }
.button.secondary { border-color: #d7d7dc; background: #fff; }
.button.ghost { border-color: #e4e4e7; background: #fafafa; }
.button.small { min-height: 34px; padding: 0 12px; font-size: 11px; }
.button.wide { width: 100%; }
.icon-button { width: 30px; height: 30px; border: 0; border-radius: 8px; background: #f4f4f5; cursor: pointer; color: #777; font-size: 18px; }
.icon-button:hover { background: #fee9e9; color: var(--danger); }

.preset-row { margin: -3px 0 18px; display: grid; grid-template-columns: repeat(auto-fit, minmax(145px, 1fr)); gap: 9px; }
.preset-button { min-height: 56px; padding: 9px 12px; display: grid; gap: 3px; border: 1px solid #e6e6e9; border-radius: 10px; background: #fafafa; text-align: left; cursor: pointer; }
.preset-button strong { font-size: 12px; }
.preset-button span { color: var(--muted); font-size: 9px; white-space: nowrap; }
.preset-button:hover, .preset-button.active { border-color: var(--orange); background: var(--orange-pale); }
.package-list { display: grid; gap: 10px; }
.package-row { display: grid; grid-template-columns: 34px 1fr 1fr 1fr 1fr .8fr .8fr 32px; gap: 9px; align-items: end; padding: 13px; border: 1px solid #ececef; border-radius: 12px; background: #fbfbfb; }
.package-row.active { border-color: #ffc27e; background: #fffaf4; }
.package-index { align-self: center; width: 28px; height: 28px; display: grid; place-items: center; border-radius: 7px; background: #202020; color: var(--orange); font-size: 11px; font-weight: 800; }
.package-row label { font-size: 9px; }
.package-row input, .package-row select { height: 36px; padding: 0 8px; font-size: 11px; }
.package-row .remove-package { align-self: end; height: 36px; width: 32px; border: 0; border-radius: 8px; background: #eeeef0; color: #888; cursor: pointer; }
.package-row .remove-package:hover { background: #ffe6e6; color: var(--danger); }

.advanced-card { overflow: hidden; box-shadow: none; }
.advanced-card summary { padding: 17px 21px; display: flex; justify-content: space-between; align-items: center; list-style: none; cursor: pointer; }
.advanced-card summary::-webkit-details-marker { display: none; }
.advanced-card summary span:first-child { display: grid; gap: 3px; }
.advanced-card summary strong { font-size: 13px; }
.advanced-card summary small { color: var(--muted); font-size: 10px; }
.advanced-card[open] .chevron { transform: rotate(180deg); }
.advanced-fields { padding: 3px 21px 22px; }
.switch-label { min-height: 45px; display: flex; align-items: center; gap: 10px; }
.switch-label input, .toggle input { position: absolute; opacity: 0; pointer-events: none; }
.switch-label > span:nth-child(2), .toggle > span { position: relative; width: 38px; height: 22px; flex: 0 0 auto; border-radius: 20px; background: #d5d5da; transition: .2s; }
.switch-label > span:nth-child(2)::after, .toggle > span::after { content: ''; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px #888; transition: .2s; }
.switch-label input:checked + span, .toggle input:checked + span { background: var(--orange); }
.switch-label input:checked + span::after, .toggle input:checked + span::after { transform: translateX(16px); }
.switch-label > span:last-child { display: grid; }
.switch-label small { font-size: 9px; }

.quote-column { position: sticky; top: 28px; }
.quote-panel { overflow: hidden; }
.quote-panel-head { padding: 23px 22px 17px; border-bottom: 1px solid var(--line); }
.quote-panel-head > div { display: flex; align-items: center; gap: 12px; }
.quote-panel-head h2, .quote-panel-head p { margin: 0; }
.quote-panel-head p { font-size: 11px; }
.broker-strip { padding: 13px 22px; display: flex; gap: 6px; border-bottom: 1px solid #eee; }
.broker-badge { width: 28px; height: 24px; display: grid; place-items: center; border: 1px solid #ddd; border-radius: 6px; color: #aaa; background: #f5f5f5; font-size: 9px; font-weight: 900; text-transform: uppercase; }
.broker-badge.ready { border-color: #ffd2a2; background: var(--orange-pale); color: var(--orange-dark); }
.quote-placeholder, .empty-state { min-height: 225px; padding: 34px 32px 23px; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; }
.quote-placeholder strong { margin-top: 17px; font-size: 13px; }
.quote-placeholder p { max-width: 240px; margin: 8px 0 0; font-size: 11px; }
.radar-icon { position: relative; width: 58px; height: 58px; display: grid; place-items: center; border: 1px solid #dedee1; border-radius: 50%; background: repeating-radial-gradient(circle, #fff 0 9px, #eee 10px 10px); }
.radar-icon::before { content: ''; width: 5px; height: 5px; border-radius: 50%; background: var(--orange); box-shadow: 12px -10px 0 -1px #ffb363; }
.radar-icon span { position: absolute; width: 50%; height: 1px; left: 50%; top: 50%; transform-origin: left; transform: rotate(-45deg); background: linear-gradient(90deg, var(--orange), transparent); }
.quote-results { max-height: 445px; padding: 12px; overflow: auto; display: grid; gap: 8px; }
.quote-results[hidden] { display: none; }
.quote-item { padding: 13px; display: grid; grid-template-columns: 1fr auto; gap: 8px 12px; align-items: center; border: 1px solid #e5e5e8; border-radius: 11px; background: #fff; }
.quote-item.cheapest { border-color: var(--orange); box-shadow: inset 3px 0 0 var(--orange); }
.quote-item h3 { margin: 0; font-size: 12px; }
.quote-item p { margin: 3px 0 0; font-size: 9px; line-height: 1.35; }
.point-badge { margin-top: 6px; padding: 3px 6px; display: inline-flex; border-radius: 5px; background: var(--orange-pale); color: var(--orange-dark); font-size: 8px; font-weight: 800; text-transform: uppercase; letter-spacing: .04em; }
.quote-point-summary { padding: 9px 11px; border-radius: 8px; background: #fff8ef; color: #7a5735; font-size: 9px; font-weight: 700; line-height: 1.4; }
.quote-price { text-align: right; }
.quote-price strong { display: block; font-size: 15px; }
.quote-price small { color: var(--muted); font-size: 8px; }
.quote-item .button { grid-column: 1 / -1; min-height: 34px; }
.quote-error { padding: 10px 12px; border-radius: 9px; background: #fff0f0; color: #9d2f2f; font-size: 10px; line-height: 1.45; }
.quote-loading { padding: 10px 12px; display: flex; align-items: center; gap: 9px; border-radius: 9px; background: #f5f5f5; color: #666; font-size: 10px; }
.spinner { width: 14px; height: 14px; border: 2px solid #ddd; border-top-color: var(--orange); border-radius: 50%; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.compare-button { width: calc(100% - 44px); margin: 0 22px 10px; min-height: 49px; }
.quote-footnote { margin: 0 22px 18px; text-align: center; font-size: 9px; }

.point-dialog { width: min(780px, calc(100vw - 32px)); max-height: min(820px, calc(100vh - 32px)); padding: 0; overflow: hidden; border: 0; border-radius: 20px; background: #fff; box-shadow: 0 30px 100px rgba(0,0,0,.32); }
.point-dialog::backdrop { background: rgba(15,15,15,.66); backdrop-filter: blur(3px); }
.point-dialog-shell { display: grid; grid-template-rows: auto auto auto minmax(0, 1fr); max-height: min(820px, calc(100vh - 32px)); }
.point-dialog header { padding: 22px 24px 18px; display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; border-bottom: 1px solid var(--line); }
.point-dialog header h2, .point-dialog header p { margin-bottom: 0; }
.point-dialog header > div > p:last-child { margin-top: 5px; font-size: 10px; line-height: 1.4; }
.dialog-close { width: 35px; height: 35px; flex: 0 0 auto; border: 0; border-radius: 9px; background: #f1f1f2; color: #666; cursor: pointer; font-size: 22px; }
.dialog-close:hover { background: #ffe9e9; color: var(--danger); }
.point-search { padding: 14px 24px; display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 9px; border-bottom: 1px solid #eee; }
.point-search[hidden], .point-map[hidden], .point-loading[hidden], .point-list[hidden] { display: none; }
.point-loading { margin: 14px 24px 0; padding: 12px; display: flex; align-items: center; justify-content: center; gap: 9px; border-radius: 9px; background: #f6f6f6; color: #666; font-size: 11px; }
.point-list { min-height: 160px; max-height: 58vh; padding: 12px 24px 24px; overflow: auto; display: grid; align-content: start; gap: 8px; }
.point-option { width: 100%; padding: 12px; display: grid; grid-template-columns: 38px minmax(0, 1fr) 24px; align-items: center; gap: 11px; border: 1px solid #e5e5e8; border-radius: 11px; background: #fff; text-align: left; cursor: pointer; transition: .15s; }
.point-option:hover:not(:disabled) { border-color: var(--orange); background: #fffaf4; transform: translateY(-1px); }
.point-option:disabled { opacity: .55; cursor: wait; }
.point-option-icon { width: 38px; height: 38px; display: grid; place-items: center; border-radius: 9px; background: var(--orange-pale); color: var(--orange-dark); font-size: 19px; }
.point-option > span:nth-child(2) { min-width: 0; display: grid; gap: 3px; }
.point-option strong { overflow: hidden; color: var(--ink); font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.point-option small { overflow: hidden; color: #666; font-size: 9px; text-overflow: ellipsis; white-space: nowrap; }
.point-option em { color: #999; font-size: 8px; font-style: normal; }
.point-option-arrow { color: var(--orange-dark); font-weight: 900; }
.point-empty { margin: 22px 0; padding: 22px; border-radius: 11px; background: #f6f6f6; color: #777; text-align: center; font-size: 11px; line-height: 1.5; }
.point-empty.error { background: #fff0f0; color: var(--danger); }
.point-map { min-height: 520px; padding: 0 24px 20px; }
.point-map iframe { width: 100%; height: min(570px, 65vh); border: 1px solid #ddd; border-radius: 12px; background: #fafafa; }
.point-map p { margin: 7px 0 0; text-align: center; font-size: 9px; }

.empty-banner { max-width: 1340px; margin: 0 auto 20px; padding: 16px 18px; display: flex; align-items: center; justify-content: space-between; gap: 20px; border: 1px solid #ffd1a2; border-radius: 13px; background: var(--orange-pale); }
.empty-banner div { display: grid; gap: 3px; }
.empty-banner span { color: var(--muted); font-size: 11px; }
.recent-section { max-width: 1340px; margin: 42px auto 0; }
.table-card, .history-card { overflow: hidden; }
table { width: 100%; border-collapse: collapse; font-size: 11px; }
th { padding: 12px 15px; border-bottom: 1px solid var(--line); background: #fafafa; color: #999; text-align: left; font-size: 9px; letter-spacing: .06em; text-transform: uppercase; }
td { padding: 14px 15px; border-bottom: 1px solid #efeff1; color: #555; }
tr:last-child td { border-bottom: 0; }
td small { margin-top: 3px; display: block; color: #999; }
.icon-link { color: var(--orange-dark); font-weight: 800; white-space: nowrap; }
.operator-tag { padding: 4px 7px; border-radius: 5px; background: #f0f0f1; font-size: 9px; text-transform: uppercase; }

.settings-layout { max-width: 1180px; margin: 0 auto; display: grid; grid-template-columns: 210px minmax(0, 1fr); gap: 24px; align-items: start; }
.settings-nav { position: sticky; top: 28px; padding: 18px; display: grid; gap: 3px; box-shadow: none; }
.settings-nav > strong { margin: 0 8px 10px; font-size: 11px; text-transform: uppercase; letter-spacing: .12em; }
.settings-nav a { padding: 10px 9px; border-radius: 8px; color: #666; font-size: 12px; }
.settings-nav a:hover { background: var(--orange-pale); color: var(--orange-dark); }
.settings-nav small { margin: 25px 8px 0; color: #aaa; font-size: 9px; }
.settings-content { display: grid; gap: 26px; }
.settings-section { scroll-margin-top: 20px; }
.settings-section .form-actions { margin-top: 20px; display: flex; justify-content: flex-end; }
.settings-group { display: grid; gap: 14px; scroll-margin-top: 20px; }
.group-heading { margin: 8px 2px 2px; }
.group-heading h2, .group-heading p { margin-bottom: 3px; }
.group-heading p { font-size: 12px; }
.broker-settings { padding: 22px; scroll-margin-top: 18px; box-shadow: none; }
.broker-title { margin-bottom: 20px; display: flex; align-items: center; gap: 12px; }
.broker-title > div:nth-child(2) { flex: 1; }
.broker-title h3, .broker-title p { margin: 0; }
.broker-title p { font-size: 10px; }
.operator-logo { width: 39px; height: 39px; display: grid; place-items: center; border-radius: 9px; background: #202020; color: #fff; font-size: 11px; font-weight: 900; }
.operator-logo.apaczka { background: #f47721; }
.operator-logo.glob { background: #dc1e32; }
.operator-logo.furgonetka { background: #ee3024; }
.config-status { padding: 5px 8px; border-radius: 20px; background: #f2f2f3; color: #888; font-size: 9px; font-weight: 700; }
.config-status.ready { background: #e8f8ec; color: var(--success); }
.broker-actions { margin-top: 18px; padding-top: 16px; display: flex; align-items: center; justify-content: flex-end; gap: 10px; border-top: 1px solid #eee; }
.toggle { margin-right: auto; display: flex; grid-auto-flow: column; align-items: center; gap: 8px; }
.toggle > span { width: 34px; height: 20px; }
.toggle > span::after { width: 14px; height: 14px; }
.toggle input:checked + span::after { transform: translateX(14px); }
.broker-actions .toggle + .toggle { margin-right: 0; }
.oauth-row { margin-top: 13px; display: flex; justify-content: flex-end; }
.callback-box { min-height: 43px; padding: 8px 11px; border: 1px dashed #d9d9dd; border-radius: 9px; overflow: hidden; }
.callback-box small, .callback-box code { display: block; }
.callback-box small { color: #999; font-size: 8px; }
.callback-box code { margin-top: 4px; overflow: hidden; font-size: 9px; text-overflow: ellipsis; white-space: nowrap; }
.credential-guide { margin: 18px 0 13px; padding: 11px 12px; display: grid; gap: 4px; border-radius: 9px; background: #f5f5f6; color: #64646a; font-size: 10px; line-height: 1.45; }
.credential-guide strong { color: var(--ink); font-size: 10px; }
.credential-guide a { color: var(--orange-dark); font-weight: 800; }
.credential-guide code { padding: 2px 4px; border-radius: 4px; background: #fff; color: #333; }
.credential-guide.map-guide { margin-top: 20px; background: #fff8ef; }
.map-key-fields { margin-bottom: 3px; }
.field-help { margin-top: 5px; color: #96969c; font-size: 8px; font-weight: 400; line-height: 1.4; }
.oauth-help { margin: 15px 0 0; padding: 10px 12px; border-left: 3px solid var(--orange); background: #fff8ef; color: #75583d; font-size: 9px; line-height: 1.5; }
.preset-admin-list { display: grid; gap: 8px; }
.preset-admin-list > div { padding: 10px 12px; display: flex; align-items: center; gap: 11px; border: 1px solid #ececef; border-radius: 10px; }
.preset-admin-list > div > div { flex: 1; display: grid; gap: 2px; }
.preset-admin-list strong { font-size: 12px; }
.preset-admin-list small { color: #888; font-size: 9px; }
.package-glyph { width: 30px; height: 30px; display: grid; place-items: center; border-radius: 7px; background: var(--orange-pale); color: var(--orange-dark); }
.preset-create { margin-top: 16px; padding-top: 16px; display: grid; grid-template-columns: 1.6fr repeat(4, 1fr) auto; gap: 8px; align-items: end; border-top: 1px solid #eee; }

.minimal-page { background: #111; }
.minimal-main { min-height: 100vh; padding: 44px 24px; display: grid; place-items: center; background: radial-gradient(circle at 20% 20%, #30261d 0, #171513 28%, #111 65%); }
.auth-card { width: min(100%, 430px); padding: 35px; display: grid; gap: 27px; border-radius: 22px; background: #fff; box-shadow: 0 30px 90px rgba(0,0,0,.35); }
.auth-brand { color: #111; }
.auth-card h1 { font-size: 35px; }
.auth-card p { margin-bottom: 0; font-size: 13px; }
.stack-form { display: grid; gap: 16px; }
.inline-error { padding: 11px 13px; border-radius: 8px; background: #fff0f0; color: var(--danger); font-size: 11px; }
.setup-shell { width: min(100%, 1080px); display: grid; grid-template-columns: .9fr 1.1fr; overflow: hidden; border-radius: 24px; box-shadow: 0 35px 100px rgba(0,0,0,.38); }
.setup-intro { padding: 48px; background: #171717; color: #fff; }
.setup-intro .brand { margin-bottom: 70px; }
.setup-intro h1 { font-size: 43px; }
.setup-intro > p:not(.eyebrow) { color: #aaa; font-size: 13px; }
.feature-list { margin: 45px 0 0; padding: 0; display: grid; gap: 17px; list-style: none; color: #ddd; font-size: 12px; }
.feature-list li { display: flex; align-items: center; gap: 13px; }
.feature-list span { color: var(--orange); font-size: 9px; font-weight: 900; }
.setup-form { padding: 37px; border-radius: 0; box-shadow: none; }
.setup-form hr { margin: 26px 0; border: 0; border-top: 1px solid var(--line); }
.compact-heading { margin-bottom: 17px; }
.compact-heading > div { align-items: baseline !important; }
.step-chip { padding: 4px 7px; border-radius: 5px; background: var(--orange-pale); color: var(--orange-dark); font-size: 8px; font-weight: 900; }
.setup-form .button { margin-top: 24px; }
.database-choice { margin-bottom: 16px; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.database-option { position: relative; display: block; cursor: pointer; }
.database-option input { position: absolute; opacity: 0; pointer-events: none; }
.database-option span { min-height: 64px; padding: 13px 15px; display: grid; align-content: center; gap: 3px; border: 1px solid #dedee2; border-radius: 10px; background: #fafafa; transition: .16s; }
.database-option strong { color: var(--ink); font-size: 12px; }
.database-option small { color: var(--muted); font-size: 9px; font-weight: 400; }
.database-option input:checked + span { border-color: var(--orange); background: var(--orange-pale); box-shadow: 0 0 0 2px rgba(255,128,0,.1); }
.database-fields[hidden] { display: none; }
.database-note { color: #888; font-size: 9px; line-height: 1.5; }
.setup-warning { margin: 0; padding: 10px 12px; border-radius: 8px; background: #fff0f0; color: var(--danger); font-size: 10px; line-height: 1.45; }

.flash { max-width: 1340px; margin: 0 auto 20px; padding: 13px 15px; display: flex; justify-content: space-between; align-items: center; border: 1px solid; border-radius: 10px; font-size: 12px; }
.flash.success { border-color: #bfe6c8; background: #eefaf1; color: var(--success); }
.flash.error { border-color: #ffcaca; background: #fff1f1; color: var(--danger); }
.flash button { border: 0; background: none; color: inherit; cursor: pointer; font-size: 18px; }
.toast-stack { position: fixed; right: 22px; bottom: 22px; z-index: 100; width: min(340px, calc(100vw - 44px)); display: grid; gap: 9px; }
.toast { padding: 13px 15px; display: flex; align-items: flex-start; gap: 10px; border-radius: 11px; background: #202020; color: #fff; box-shadow: 0 12px 30px rgba(0,0,0,.25); font-size: 11px; line-height: 1.5; animation: toast-in .2s ease-out; }
.toast.success::before { content: '✓'; color: #68db89; font-weight: 900; }
.toast.error::before { content: '!'; color: #ff8f8f; font-weight: 900; }
@keyframes toast-in { from { transform: translateY(8px); opacity: 0; } }
.empty-state h2 { margin: 17px 0 4px; }
.empty-state p { margin-bottom: 18px; font-size: 12px; }
.table-scroll { overflow-x: auto; }

@media (max-width: 1120px) {
    .shipment-layout { grid-template-columns: minmax(0, 1fr) 330px; }
    .recipient-grid { grid-template-columns: repeat(4, 1fr); }
    .city-field { grid-column: span 2; }
    .package-row { grid-template-columns: 30px repeat(4, 1fr); }
    .package-row label:nth-of-type(5), .package-row label:nth-of-type(6) { grid-column: span 2; }
    .preset-create { grid-template-columns: repeat(3, 1fr); }
}

@media (max-width: 860px) {
    .sidebar { transform: translateX(-100%); transition: transform .2s; }
    body.menu-open .sidebar { transform: translateX(0); }
    .mobile-bar { position: sticky; top: 0; z-index: 35; height: 62px; padding: 0 18px; display: flex; align-items: center; justify-content: space-between; background: #141414; color: #fff; }
    .mobile-bar .brand-mark { width: 31px; height: 31px; font-size: 18px; }
    .menu-button { border: 0; background: transparent; color: #fff; font-size: 21px; }
    .main-content { margin-left: 0; padding: 28px 18px 55px; }
    .shipment-layout { grid-template-columns: 1fr; }
    .quote-column { position: static; }
    .page-header { align-items: flex-start; }
    .sender-pill { min-width: 220px; }
    .settings-layout { grid-template-columns: 1fr; }
    .settings-nav { position: static; grid-template-columns: repeat(3, 1fr); }
    .settings-nav > strong, .settings-nav small { display: none; }
    .settings-nav a { text-align: center; }
}

@media (max-width: 620px) {
    .page-header { display: grid; }
    .sender-pill { width: 100%; }
    .form-section, .settings-section, .broker-settings { padding: 19px; }
    .section-heading { align-items: flex-start; }
    .field-grid.two, .recipient-grid { grid-template-columns: 1fr 1fr; }
    .recipient-grid label:nth-child(3), .recipient-grid label:nth-child(4), .span-2, .street-field, .city-field { grid-column: 1 / -1; }
    .package-row { grid-template-columns: 28px 1fr 1fr; }
    .package-row label { grid-column: auto !important; }
    .package-row label:first-of-type { grid-column: span 2 !important; }
    .package-row .remove-package { grid-column: 3; }
    .broker-actions { flex-wrap: wrap; }
    .broker-actions .test-connection { margin-left: auto; }
    .setup-shell { grid-template-columns: 1fr; }
    .setup-intro { padding: 30px; }
    .setup-intro .brand { margin-bottom: 38px; }
    .feature-list { display: none; }
    .setup-form { padding: 26px 22px; }
    .minimal-main { padding: 18px; }
    .preset-create { grid-template-columns: 1fr 1fr; }
    .preset-create label:first-of-type { grid-column: span 2; }
    .settings-nav { overflow-x: auto; grid-template-columns: repeat(3, minmax(130px, 1fr)); }
    .empty-banner { align-items: flex-start; flex-direction: column; }
    .recent-section { display: none; }
    .delivery-mode { grid-template-columns: 1fr; }
    .common-point-picker { grid-template-columns: 1fr; }
    .common-point-actions { justify-content: flex-start; flex-wrap: wrap; }
    .point-dialog { width: calc(100vw - 18px); max-height: calc(100vh - 18px); border-radius: 15px; }
    .point-dialog-shell { max-height: calc(100vh - 18px); }
    .point-dialog header { padding: 18px; }
    .point-search { padding: 12px 16px; grid-template-columns: 1fr; }
    .point-list { padding: 10px 16px 18px; }
    .point-map { min-height: 430px; padding: 0 10px 12px; }
    .point-map iframe { height: 65vh; }
}
