.app-ui .new-order-modal {
    --order-modal-ink: var(--text-primary, var(--app-ink));
    --order-modal-muted: var(--text-secondary, var(--app-muted));
    --order-modal-soft: var(--bg-surface-secondary, var(--app-primary-soft));
}
body.app-ui.new-order-modal-open { overflow: hidden; }
.app-ui .new-order-modal {
    position: fixed;
    inset: 0;
    z-index: 12000;
    display: grid;
    place-items: center;
    padding: 28px;
}
.app-ui .new-order-modal[hidden] { display: none; }
.app-ui .new-order-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgb(49 72 94 / 48%);
    backdrop-filter: blur(5px);
}
.app-ui .new-order-modal-card {
    position: relative;
    z-index: 1;
    width: min(680px, 100%);
    max-height: calc(100dvh - 56px);
    overflow-y: auto;
    padding: 34px 30px 28px;
    border: 1px solid rgb(255 255 255 / 65%);
    border-radius: 24px;
    background: #fff;
    color: var(--order-modal-ink);
    box-shadow: 0 28px 80px rgb(16 42 67 / 28%);
}
.app-ui .new-order-modal-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 24px;
    padding: 0;
    border: 0;
    background: transparent;
    box-shadow: none;
}
.app-ui .new-order-modal-eyebrow { margin: 0 0 10px; color: var(--order-modal-muted); font-size: 13px; }
.app-ui .new-order-modal-header h2 { margin: 0; color: var(--order-modal-ink); font-size: clamp(25px, 3vw, 31px); line-height: 1.15; letter-spacing: -.75px; }
.app-ui .new-order-modal-close {
    display: inline-grid;
    flex: 0 0 48px;
    width: 48px;
    height: 48px;
    min-height: 48px;
    padding: 0;
    place-items: center;
    border: 0;
    border-radius: 14px;
    background: var(--order-modal-soft);
    color: #334e68;
    cursor: pointer;
}
.app-ui .new-order-modal-close:hover { background: #e5f1f8; color: var(--brand-blue); }
.app-ui .new-order-modal-close svg { width: 21px; height: 21px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; }
.app-ui .new-order-type-tabs {
    display: inline-grid;
    grid-template-columns: repeat(3, auto);
    gap: 3px;
    max-width: 100%;
    margin-top: 28px;
    padding: 4px;
    border-radius: 999px;
    background: var(--order-modal-soft);
}
.app-ui .new-order-type-tab {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 9px;
    min-height: 44px;
    padding: 10px 17px;
    border: 0;
    border-radius: 999px;
    background: transparent;
    color: var(--order-modal-muted);
    font: inherit;
    font-size: 13px;
    font-weight: 650;
    white-space: nowrap;
    cursor: pointer;
}
.app-ui .new-order-type-tab:hover { color: var(--brand-blue); }
.app-ui .new-order-type-tab.is-active { background: var(--brand-blue); color: #fff; box-shadow: 0 7px 17px rgb(0 117 183 / 20%); }
.app-ui .new-order-type-tab svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.app-ui .new-order-type-panel { margin-top: 26px; }
.app-ui .new-order-type-panel[hidden] { display: none; }
.app-ui .new-order-modal-copy { margin: 0 0 18px; color: var(--order-modal-muted); font-size: 14px; line-height: 1.55; }
.app-ui .new-order-company-list { display: grid; gap: 12px; }
.app-ui .new-order-company-card {
    display: grid;
    grid-template-columns: 44px minmax(0, 1fr) 24px;
    align-items: center;
    gap: 14px;
    min-height: 86px;
    padding: 16px 18px;
    border: 1px solid transparent;
    border-radius: 15px;
    background: var(--order-modal-soft);
    color: var(--order-modal-ink);
    text-decoration: none;
    transition: transform .18s ease, border-color .18s ease, box-shadow .18s ease, background-color .18s ease;
}
.app-ui .new-order-company-card:hover {
    transform: translateY(-1px);
    border-color: rgb(0 160 245 / 28%);
    background: #edf7fd;
    box-shadow: 0 10px 24px rgb(16 42 67 / 9%);
}
.app-ui .new-order-company-card:focus-visible { outline-color: var(--brand-blue); }
.app-ui .new-order-company-initial {
    display: grid;
    width: 44px;
    height: 44px;
    place-items: center;
    border-radius: 12px;
    background: #e4f4fd;
    color: #006fb8;
    font-size: 16px;
    font-weight: 750;
}
.app-ui .new-order-company-initial-return { background: #fff1e5; color: var(--brand-orange); }
.app-ui .new-order-company-text { display: grid; min-width: 0; gap: 5px; }
.app-ui .new-order-company-text strong { color: var(--order-modal-ink); font-size: 15px; line-height: 1.35; }
.app-ui .new-order-company-text small { color: var(--order-modal-muted); font-size: 12px; line-height: 1.45; }
.app-ui .new-order-company-arrow { color: #0077c8; font-size: 24px; line-height: 1; transition: transform .18s ease; }
.app-ui .new-order-company-card:hover .new-order-company-arrow { transform: translateX(3px); }
.app-ui .new-order-modal-note { margin: 20px 0 0; color: var(--order-modal-muted); font-size: 12px; line-height: 1.5; }

@media (max-width: 760px) {
    .app-ui .new-order-modal { padding: 14px; }
    .app-ui .new-order-modal-card { width: 100%; max-height: calc(100dvh - 28px); padding: 26px 20px 22px; border-radius: 22px; }
    .app-ui .new-order-modal-header { gap: 16px; }
    .app-ui .new-order-modal-header h2 { font-size: 26px; }
    .app-ui .new-order-type-tabs { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); width: 100%; }
    .app-ui .new-order-type-tab { min-width: 0; padding: 10px 9px; }
    .app-ui .new-order-type-tab svg { display: none; }
}


@media (max-width: 600px) {
    .app-ui .new-order-modal-eyebrow { margin-bottom: 7px; }
    .app-ui .new-order-modal-close { flex-basis: 44px; width: 44px; height: 44px; min-height: 44px; border-radius: 12px; }
    .app-ui .new-order-type-tabs { margin-top: 22px; }
    .app-ui .new-order-type-panel { margin-top: 22px; }
    .app-ui .new-order-company-card { grid-template-columns: 42px minmax(0, 1fr) 20px; min-height: 82px; padding: 14px; gap: 12px; }
    .app-ui .new-order-company-initial { width: 42px; height: 42px; }
    .app-ui .new-order-company-text strong { font-size: 14px; }
    .app-ui .new-order-company-text small { font-size: 11px; }
}

.app-ui .new-order-type-tabs[hidden] { display: none; }
/* Buttons share the existing rail link layout and theme states. */
.app-ui button.app-rail-link[data-new-order-open] {
    width: 100%; border: 0; margin: 0; font-family: inherit;
    background: transparent; color: var(--app-muted); box-shadow: none; cursor: pointer;
}
.app-ui button.app-rail-link[data-new-order-open]:hover {
    background: var(--interactive-primary-soft, var(--app-primary-soft)); color: var(--brand-blue);
}
.app-ui button.app-rail-link[data-new-order-open].is-current { background: var(--brand-blue); color: #fff; }
