/* Components: panels, filters, tables, dropdowns, modals, feature sections */

/* ==== Modern Custom Scrollbars ==== */
::-webkit-scrollbar {
    width: 7px;
    height: 7px;
}

::-webkit-scrollbar-track {
    background: var(--bg-sunken);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb {
    background: var(--border-strong);
    border-radius: 4px;
    border: 1px solid var(--bg-sunken);
}

::-webkit-scrollbar-thumb:hover {
    background: var(--primary-soft-border);
}

* {
    scrollbar-width: thin;
    scrollbar-color: var(--border-strong) var(--bg-sunken);
}

/* ==== Panels ==== */
.panel {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    padding: 1.25rem;
}

.panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1rem;
}

.panel-header h3 {
    margin: 0;
    font-size: 1rem;
}

/* Feature panel: header / filter bar / table stack.
   Deliberately NOT overflow:hidden so dropdown menus can escape the panel. */
.po-panel {
    display: flex;
    flex-direction: column;
    min-height: 0;
    min-width: 0;
    padding: 0;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    background: var(--bg-surface);
    box-shadow: var(--shadow-sm);
}

/* ==== 3-Card Stack Layout ==== */
.po-panel-group {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    width: 100%;
    height: 100%;
    min-height: 0;
}

.po-merged-card {
    flex: 0 0 auto;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 12px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
    overflow: visible !important;
    padding: 5px;
}

.po-merged-card .po-toolbar {
    border-bottom: 1px solid var(--line);
    border-radius: 12px 12px 0 0;
    background: var(--surface);
    padding: 0.35rem 10px 0.55rem 10px !important;
    margin: 0 !important;
}

.po-merged-card .filter-bar {
    border-bottom: none;
    background: var(--surface);
    padding: 0.4rem 10px 0.35rem 10px !important;
    margin: 0 !important;
}

.po-merged-card form {
    margin: 0 !important;
    padding: 0 !important;
}

.po-table-card {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 12px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
    padding-bottom: 0%;
    padding-top: 1%
}

.po-table-card .rate-table-wrap {
    flex: 1;
    min-height: 0;
}

.po-table-card .rate-table-footer {
    border-top: 1px solid var(--line);
    border-radius: 0 0 12px 12px;
    background: var(--surface);
}

.po-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
    flex: 0 0 auto;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--border);
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    background: var(--bg-surface);
}

.po-heading {
    flex: 1 1 0px;
    min-width: 0;
}

.po-heading h2 {
    margin: 0;
    font-size: 0.88rem;
    line-height: 1.1;
    letter-spacing: -0.01em;
}

.po-heading p {
    margin: 0;
    color: var(--text-muted);
    font-size: 0.68rem;
    line-height: 1.15;
}

.po-search-wrap {
    position: relative;
    flex: 0 1 320px;
    margin: 0 auto;
}

.po-search-wrap .search-icon {
    position: absolute;
    left: 0.65rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--faint);
    font-size: 0.76rem;
    pointer-events: none;
}

.po-search-wrap input {
    width: 100%;
    height: 32px;
    padding: 0.3rem 1.8rem 0.3rem 2rem;
    font-size: 0.8rem;
    border: 1px solid var(--line);
    border-radius: 6px;
    background: var(--surface-2);
    color: var(--ink);
    transition: all 0.16s ease;
}

.po-search-wrap input:focus {
    outline: none;
    background: var(--surface);
    border-color: var(--brand);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 10%, transparent);
}

.po-search-wrap .search-clear-btn {
    position: absolute;
    right: 0.5rem;
    top: 50%;
    transform: translateY(-50%);
    display: grid;
    place-items: center;
    width: 18px;
    height: 18px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: var(--line);
    color: var(--muted);
    font-size: 0.62rem;
    cursor: pointer;
    transition: all 0.14s ease;
}

.po-search-wrap .search-clear-btn:hover {
    background: var(--line-strong);
    color: var(--ink);
}

.po-search-wrap .search-clear-btn[hidden] {
    display: none !important;
}

.rates-search-apply-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: 28px;
    padding: 0 0.65rem;
    border: none;
    border-radius: 6px;
    background: var(--brand);
    color: var(--on-brand);
    font-size: 0.72rem;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.15s ease;
    box-shadow: 0 1px 2px color-mix(in srgb, var(--brand) 18%, transparent);
    flex-shrink: 0;
}

.rates-search-apply-btn:hover {
    background: var(--brand);
    transform: translateY(-0.5px);
}

.rates-search-apply-btn:active {
    transform: translateY(0);
}

.rates-search-apply-btn[hidden] {
    display: none !important;
}

.rate-toolbar-actions {
    flex: 1 1 0px;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 0.5rem;
}

.rate-toolbar-actions .btn {
    min-height: 28px;
    height: 28px;
    padding: 0.22rem 0.85rem;
    font-size: 0.8rem;
    font-weight: 600;
    border-radius: var(--radius-md);
}

.btn-export-csv {
    background: var(--success) !important;
    border-color: var(--success) !important;
    color: var(--on-brand) !important;
    font-weight: 600;
    font-size: 0.76rem !important;
    min-height: 28px !important;
    height: 28px !important;
    padding: 0.25rem 0.75rem !important;
    border-radius: 6px !important;
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    box-shadow: 0 1px 2px color-mix(in srgb, var(--success) 15%, transparent);
}

.btn-export-csv i {
    font-size: 0.75rem !important;
    color: var(--on-brand) !important;
}

.btn-export-csv:hover:not(:disabled) {
    background: var(--success) !important;
    border-color: var(--success) !important;
    color: var(--on-brand) !important;
}

.rates-controls-right .btn {
    min-height: 28px !important;
    height: 28px !important;
    padding: 0.25rem 0.75rem !important;
    font-size: 0.76rem !important;
    font-weight: 600 !important;
    border-radius: 6px !important;
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
}

.rates-controls-right .btn i {
    font-size: 0.75rem !important;
}

.rates-filter-toggle-btn {
    min-height: 28px !important;
    height: 28px !important;
    padding: 0.25rem 0.75rem !important;
    font-size: 0.76rem !important;
    font-weight: 600 !important;
    border-radius: 6px !important;
}

.table-card-top-bar {
    padding-left: 0.5%;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    background: var(--surface);
    border-bottom: 4px solid var(--line);
    border-top-left-radius: var(--radius-lg);
    border-top-right-radius: var(--radius-lg);
}

/* ==== Filter bar ==== */
.rates-controls-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    background: var(--surface);
    border-radius: var(--radius-lg);
}

.rates-search-group {
    display: flex;
    align-items: center;
    gap: 0.40rem;
    flex: 0 1 360px;
    max-width: 440px;
    width: 100%;
}

.rates-search-group .po-search-wrap {
    flex: 1;
    min-width: 0;
    margin: 0;
}

.rates-controls-row .po-search-wrap input {
    height: 28px !important;
    min-height: 28px !important;
    font-size: 0.78rem !important;
    padding-top: 0 !important;
    padding-bottom: 0 !important;
    padding-right: 1.8rem !important;
}

.rates-filter-toggle-btn {
    min-height: 34px;
    height: 34px;
    padding: 0.4rem 0.95rem;
    font-size: 0.82rem;
    font-weight: 600;
    border-radius: var(--radius-md);
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    background: var(--surface-2);
    border: 1px solid var(--line-strong);
    color: var(--ink);
    cursor: pointer;
    transition: all 0.16s ease;
}

.rates-filter-toggle-btn:hover {
    background: var(--surface-2);
    border-color: var(--line-strong);
    color: var(--ink);
}

.rates-filter-toggle-btn.is-open,
.rates-filter-toggle-btn.has-active-filters {
    background: var(--brand-soft) !important;
    border-color: var(--brand-line) !important;
    color: var(--brand-ink) !important;
}

.rates-my-team-btn {
    min-height: 34px;
    height: 34px;
    padding: 0.4rem 0.95rem;
    font-size: 0.82rem;
    font-weight: 600;
    border-radius: var(--radius-md);
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    background: var(--surface-2);
    border: 1px solid var(--line-strong);
    color: var(--ink);
    cursor: pointer;
    transition: all 0.16s ease;
}

.rates-my-team-btn:hover {
    background: var(--surface-2);
    border-color: var(--line-strong);
    color: var(--ink);
}

.rates-my-team-btn.is-active {
    background: var(--brand-soft) !important;
    border-color: var(--brand-line) !important;
    color: var(--brand-ink) !important;
    box-shadow: 0 0 0 1px var(--brand), 0 1px 2px color-mix(in srgb, var(--brand) 12%, transparent) !important;
}

.rates-my-team-btn.is-active i {
    color: var(--brand-ink) !important;
}

.rates-filter-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 18px;
    height: 18px;
    padding: 0 0.35rem;
    border-radius: 999px;
    background: var(--brand);
    color: var(--on-brand);
    font-size: 0.7rem;
    font-weight: 700;
    line-height: 1;
}

.rates-filter-drawer[hidden] {
    display: none !important;
}

.rates-filter-drawer {
    background: var(--surface-2) !important;
    border-bottom: 1px solid var(--line) !important;
    padding: 1rem 0.85rem !important;
    margin: 0 !important;
    animation: fadeIn 0.18s ease;
}

.rates-filter-drawer .filter-fields {
    display: flex !important;
    align-items: center !important;
    flex-wrap: nowrap !important;
    gap: 0.45rem !important;
    width: 100% !important;
}

.rates-filter-drawer .filter-field {
    flex: 1 1 0px !important;
    min-width: 0 !important;
    margin: 0 !important;
}

.rates-filter-drawer .filter-field.w-lg {
    flex: 1.25 1 0px !important;
}

.rates-filter-drawer .filter-actions {
    display: none;
    align-items: center;
    gap: 0.35rem;
    flex: 0 0 auto;
    margin: 0;
}

.rates-filter-drawer .filter-actions .btn {
    min-height: 24px !important;
    height: 24px !important;
    padding: 0.15rem 0.65rem !important;
    font-size: 0.73rem !important;
    border-radius: var(--radius-md) !important;
    white-space: nowrap !important;
}

.rates-filter-drawer .date-range-field .filter-field-icon {
    position: absolute;
    left: 0.52rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--muted);
    font-size: 0.70rem;
    pointer-events: none;
    z-index: 2;
}

.rates-filter-drawer .date-range-field .date-range-trigger-input {
    padding-left: 1.50rem !important;
    padding-right: 1.30rem !important;
    font-size: 0.68rem !important;
    letter-spacing: -0.01em;
}

/* ==== Quotation Filter Single Row Layout ==== */
.quotations-controls-row {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 0.85rem;
    padding: 0.55rem 0.85rem;
    background: var(--surface);
    border-radius: var(--radius-lg);
    min-height: 44px;
    width: 100%;
}

.quotations-status-group {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    flex-shrink: 0;
}

.quotation-status-pill {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: 24px !important;
    min-height: 24px !important;
    padding: 0.15rem 0.55rem !important;
    background: var(--surface);
    border: 1px solid var(--border-strong, var(--brand));
    border-radius: var(--radius-md, 6px);
    color: var(--text-dark, var(--ink));
    font-size: 0.73rem !important;
    font-weight: 500;
    cursor: pointer;
    user-select: none;
    transition: all 0.14s ease;
    white-space: nowrap;
    position: relative;
    box-sizing: border-box;
}

.quotation-status-pill:hover {
    border-color: var(--line-strong);
    background: var(--surface-2);
}

.quotation-status-pill .status-chk-input {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
    pointer-events: none;
}

.quotation-status-pill .status-pill-label {
    display: inline-flex;
    align-items: center;
    font-size: 0.73rem !important;
    font-weight: 500;
    color: inherit;
    line-height: 1;
}

/* Active / Checked State matching reference image */
.quotation-status-pill:has(.status-chk-input:checked),
.quotation-status-pill.is-active {
    background: var(--brand-soft);
    border: 1.5px solid var(--brand);
    color: var(--ink);
}

.quotation-status-pill:has(.status-chk-input:checked) .status-pill-label,
.quotation-status-pill.is-active .status-pill-label {
    font-weight: 700;
    font-size: 0.73rem !important;
    color: var(--ink);
}

.quotation-status-pill:has(.status-chk-input:focus-visible) {
    outline: 2px solid var(--brand);
    outline-offset: 2px;
}

.quotations-filter-hint[hidden] {
    display: none !important;
}

.quotations-filter-form[hidden] {
    display: none !important;
}

.quotations-filter-form {
    display: flex !important;
    align-items: center !important;
    flex: 1 1 auto;
    min-width: 0;
    margin: 0 !important;
    padding: 0 !important;
    animation: fadeIn 0.18s ease;
}

.quotations-filter-form .filter-fields {
    display: flex !important;
    align-items: center !important;
    flex-wrap: nowrap !important;
    gap: 0.45rem !important;
    width: 100% !important;
}

.quotations-filter-form .filter-field {
    flex: 1 1 0px !important;
    min-width: 0 !important;
    margin: 0 !important;
}

.quotations-filter-form .filter-field.w-lg {
    flex: 1.3 1 0px !important;
}

.quotations-filter-form .filter-actions {
    display: none;
    align-items: center;
    gap: 0.35rem;
    flex: 0 0 auto;
    margin: 0;
}

.quotations-filter-form .filter-actions .btn {
    min-height: 24px !important;
    height: 24px !important;
    padding: 0.15rem 0.65rem !important;
    font-size: 0.73rem !important;
    border-radius: var(--radius-md) !important;
    white-space: nowrap !important;
}

.quotations-controls-right {
    display: flex;
    align-items: center;
    flex: 0 0 auto;
    margin-left: auto;
}

/* ==== Multi-Select Dropdown Component ==== */
.ms-field-container {
    position: relative;
}

.ms-trigger {
    width: 100%;
    height: 32px;
    padding: 0.35rem 0.65rem;
    border: 1px solid var(--line-strong);
    border-radius: 8px;
    background: var(--surface);
    color: var(--ink);
    font-size: 0.8rem;
    font-weight: 500;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.4rem;
    user-select: none;
    transition: all 0.14s ease;
    text-align: left;
}

.ms-trigger:hover {
    border-color: var(--line-strong);
    background: var(--surface-2);
}

.ms-trigger.has-selected {
    border-color: var(--brand) !important;
    background: var(--brand-soft) !important;
    color: var(--brand-ink) !important;
    font-weight: 600;
}

.ms-trigger.has-selected .ms-trigger-icon {
    color: var(--brand-ink) !important;
}

.ms-trigger-label {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    flex: 1 1 0px;
}

.ms-required-star {
    color: var(--danger);
    font-weight: 700;
    font-size: 0.76rem;
    line-height: 1;
    display: inline-block;
}

.ms-trigger-icon {
    font-size: 0.65rem;
    color: var(--muted);
    transition: transform 0.14s ease;
}

.ms-trigger.is-open .ms-trigger-icon {
    transform: rotate(180deg);
}

.ms-popover[hidden] {
    display: none !important;
}

.ms-popover {
    position: absolute;
    top: calc(100% + 0.3rem);
    left: 0;
    z-index: 1060;
    width: 250px;
    max-width: 90vw;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 12px;
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.12), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    padding: 0.85rem;
    animation: fadeIn 0.14s ease;
}

.ms-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.55rem;
    padding: 0 0.1rem;
}

.ms-title {
    font-size: 0.72rem;
    font-weight: 750;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.ms-clear-btn {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--brand-ink);
    background: none;
    border: none;
    padding: 0;
    cursor: pointer;
    transition: color 0.12s ease;
}

.ms-clear-btn:hover {
    color: var(--brand-ink);
    text-decoration: underline;
}

.ms-search-wrap {
    margin-bottom: 0.5rem;
}

.ms-search-input {
    width: 100%;
    height: 30px;
    padding: 0.3rem 0.65rem;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface);
    color: var(--ink);
    font-size: 0.78rem;
    outline: none;
    transition: border-color 0.14s ease;
}

.ms-search-input:focus {
    border-color: var(--brand);
    box-shadow: 0 0 0 2px color-mix(in srgb, var(--brand) 12%, transparent);
}

.ms-list {
    max-height: 200px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
    padding-right: 0.1rem;
}

.ms-option {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    padding: 0.35rem 0.45rem;
    border-radius: 6px;
    cursor: pointer;
    user-select: none;
    transition: background 0.12s ease;
}

.ms-option:hover {
    background: var(--surface-2);
}

.ms-option.is-selected {
    background: var(--surface-2);
}

.ms-checkbox {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.ms-checkbox-custom {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
    border: 1.5px solid var(--line-strong);
    border-radius: 4px;
    background: var(--surface);
    display: grid;
    place-items: center;
    transition: all 0.14s ease;
}

.ms-checkbox:checked+.ms-checkbox-custom,
.ms-option.is-selected .ms-checkbox-custom {
    background: var(--brand);
    border-color: var(--brand);
}

.ms-check-icon {
    width: 11px;
    height: 11px;
    color: var(--on-brand);
    opacity: 0;
    transform: scale(0.6);
    transition: all 0.14s ease;
}

.ms-checkbox:checked+.ms-checkbox-custom .ms-check-icon,
.ms-option.is-selected .ms-check-icon {
    opacity: 1;
    transform: scale(1);
}

.ms-label-text {
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--ink);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.ms-empty {
    padding: 0.65rem;
    text-align: center;
    font-size: 0.76rem;
    color: var(--faint);
}

/* ==== Calendar Date Range Picker Popover ==== */
.date-range-field {
    position: relative;
    flex: 1 1 180px;
    min-width: 150px;
    max-width: 230px;
}

.sales-rate-field.date-range-field .filter-field-icon {
    position: absolute;
    left: 0.52rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--muted);
    font-size: 0.70rem;
    pointer-events: none;
    z-index: 2;
    transition: color 0.14s ease;
}

.sales-rate-field.date-range-field.has-value .filter-field-icon {
    color: var(--brand-ink) !important;
}

.sales-rate-field.date-range-field.has-value .suggest-toggle {
    color: var(--brand-ink) !important;
}

.sales-rate-field.date-range-field.has-value .date-range-trigger-input {
    border-color: var(--brand) !important;
    background-color: var(--brand-soft) !important;
    color: var(--brand-ink) !important;
    font-weight: 600 !important;
}

.sales-rate-field.date-range-field .date-range-trigger-input {
    padding-left: 1.50rem !important;
    padding-right: 1.30rem !important;
    font-size: 0.68rem !important;
    letter-spacing: -0.01em;
}

.date-range-trigger-input {
    cursor: pointer !important;
    background-color: var(--surface) !important;
    user-select: none;
    text-overflow: ellipsis;
    font-size: 0.73rem !important;
}

.date-picker-popover[hidden] {
    display: none !important;
}

.date-picker-popover {
    position: absolute;
    top: calc(100% + 0.35rem);
    right: 0;
    left: auto;
    z-index: 1050;
    width: 500px;
    max-width: 92vw;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 12px;
    box-shadow: 0 12px 32px rgba(15, 23, 42, 0.15);
    padding: 0.85rem;
    animation: fadeIn 0.14s ease;
}

.date-popover-inner {
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
}

.date-popover-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 0.15rem;
}

.date-popover-nav {
    width: 26px;
    height: 26px;
    display: grid;
    place-items: center;
    border: 1px solid var(--line);
    border-radius: 6px;
    background: var(--surface);
    color: var(--ink);
    font-size: 0.75rem;
    cursor: pointer;
    transition: all 0.14s ease;
}

.date-popover-nav:hover {
    background: var(--surface-2);
    border-color: var(--line-strong);
    color: var(--ink);
}

.date-popover-title {
    font-size: 0.82rem;
    font-weight: 700;
    color: var(--brand-ink);
    text-align: center;
}

.date-popover-months {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1rem;
}

@media (max-width: 540px) {
    .date-popover-months {
        grid-template-columns: 1fr;
    }

    .date-month-block.right {
        display: none;
    }
}

.date-month-block {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.date-month-selects {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.35rem;
}

.date-select-month,
.date-select-year {
    height: 26px;
    padding: 0.15rem 1.4rem 0.15rem 0.45rem;
    border: 1px solid var(--line);
    border-radius: 6px;
    background: var(--surface);
    color: var(--ink);
    font-size: 0.76rem;
    font-weight: 600;
    cursor: pointer;
    outline: none;
    transition: border-color 0.14s ease;
}

.date-select-month:hover,
.date-select-year:hover {
    border-color: var(--line-strong);
}

.date-weekdays {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    text-align: center;
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--muted);
    margin-bottom: 0.15rem;
}

.date-days-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 1px 0;
    text-align: center;
}

.date-cell {
    width: 28px;
    height: 28px;
    margin: 0 auto;
    display: grid;
    place-items: center;
    font-size: 0.76rem;
    font-weight: 500;
    color: var(--ink);
    border-radius: 50%;
    cursor: pointer;
    user-select: none;
    transition: all 0.12s ease;
}

.date-cell:hover:not(.disabled) {
    background: var(--surface-2);
    color: var(--ink);
}

.date-cell.disabled {
    color: var(--faint);
    cursor: default;
    opacity: 0.4;
}

.date-cell.is-start,
.date-cell.is-end {
    background: var(--brand) !important;
    color: var(--on-brand) !important;
    font-weight: 700;
    border-radius: 50%;
    box-shadow: 0 1px 3px color-mix(in srgb, var(--brand) 30%, transparent);
}

.date-cell.in-range {
    background: var(--brand-soft) !important;
    color: var(--brand-ink) !important;
    border-radius: 0;
}

.date-cell.in-range-hover {
    background: var(--surface-2) !important;
    color: var(--brand-ink) !important;
}

.date-popover-footer {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 0.5rem;
    padding-top: 0.55rem;
    border-top: 1px solid var(--line);
}

.btn-date-cancel {
    height: 28px;
    padding: 0.2rem 0.85rem;
    background: var(--surface) !important;
    border: 1px solid var(--line-strong) !important;
    color: var(--ink) !important;
    font-size: 0.76rem;
    font-weight: 600;
    border-radius: 6px;
}

.btn-date-apply {
    height: 28px;
    padding: 0.2rem 0.95rem;
    background: var(--brand) !important;
    border: 1px solid var(--brand) !important;
    color: var(--on-brand) !important;
    font-size: 0.76rem;
    font-weight: 600;
    border-radius: 6px;
    box-shadow: 0 1px 2px color-mix(in srgb, var(--brand) 20%, transparent);
}

.btn-date-apply:hover {
    background: var(--brand) !important;
}

.filter-bar {
    flex: 0 0 auto;
    padding: 0.95rem 1.25rem;
    margin: 0.25rem 0;
    border-bottom: 1px solid var(--border);
    background: var(--bg-subtle);
}

/* The row itself never wraps: only .filter-fields wraps internally, so Apply/Clear
   stay pinned at the end of the first line no matter how many filter fields spill
   onto a second line beneath them. */
.filter-row {
    display: flex;
    align-items: flex-end;
    justify-content: flex-start;
    flex-wrap: nowrap !important;
    gap: 0.5rem;
    min-width: 0;
    width: 100%;
}

.filter-fields {
    display: flex;
    align-items: flex-end;
    justify-content: flex-start;
    flex-wrap: nowrap !important;
    gap: 0.5rem;
    min-width: 0;
    width: 100%;
}

.filter-label {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    margin-right: 0.25rem;
    color: var(--ink);
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    white-space: nowrap;
}

.filter-label i {
    color: var(--primary);
    font-size: 0.75rem;
}

.filter-field {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    min-width: 0;
    flex: 0 1 auto;
}

.filter-field-label {
    display: flex;
    align-items: center;
    gap: 0.3rem;
    margin-bottom: 0.2rem;
    color: var(--ink);
    font-size: 0.72rem;
    font-weight: 750;
    white-space: nowrap;
}

.filter-field-control {
    position: relative;
    display: flex;
    align-items: center;
    min-width: 0;
}

.filter-field.w-sm {
    flex: 1 1 110px;
    min-width: 90px;
}

.filter-field.w-md {
    flex: 1 1 160px;
    min-width: 120px;
}

.filter-field.w-lg {
    flex: 1 1 180px;
    min-width: 140px;
}

/* Leading icon inside a filter input */
.filter-field-control>.filter-field-icon,
.filter-field>.filter-field-icon {
    position: absolute;
    left: 0.45rem;
    display: flex;
    align-items: center;
    color: var(--muted);
    font-size: 0.7rem;
    pointer-events: none;
}

.filter-field input,
.filter-field select {
    width: 100%;
    min-width: 0;
    min-height: 32px;
    border: 1px solid var(--line-strong);
    border-radius: var(--radius-md);
    background-color: var(--bg-surface);
    color: var(--ink);
    font: inherit;
    font-size: 0.82rem;
    font-weight: 500;
    text-overflow: ellipsis;
    outline: none;
    transition: border-color 0.16s ease, box-shadow 0.16s ease;
}

.filter-field input {
    padding: 0.25rem 0.6rem;
}

.filter-field select {
    padding: 0.25rem 1.45rem 0.25rem 0.6rem;
    background-position: right 0.45rem center;
}

.filter-field-control>.filter-field-icon~input,
.filter-field>.filter-field-icon~input,
.filter-field .filter-field-icon~input {
    padding-left: 1.65rem !important;
}

.filter-field input::placeholder {
    color: var(--muted);
    opacity: 1;
    font-weight: 500;
}

.filter-field input:hover:not(:focus),
.filter-field select:hover:not(:focus) {
    border-color: var(--line-strong);
}

.filter-field input:focus,
.filter-field select:focus {
    border-color: var(--brand);
    box-shadow: 0 0 0 2px color-mix(in srgb, var(--brand) 12%, transparent);
}

.filter-field.has-value input,
.filter-field.has-value select,
.filter-field input.has-value,
.filter-field select.has-value {
    border-color: var(--brand);
    background-color: var(--brand-soft);
    color: var(--brand-ink);
    font-weight: 700;
}

.filter-field select option {
    color: var(--ink);
    background-color: var(--surface);
    font-weight: 400;
}

.filter-field.has-value>.filter-field-icon,
.filter-field.has-value .suggest-toggle {
    color: var(--brand-ink);
}

#quotation-customer-filter,
#quotation-customer-filter.has-value {
    border-color: var(--line) !important;
    background-color: var(--surface) !important;
    color: var(--ink) !important;
    font-weight: 400 !important;
}

.filter-field.suggest-field input {
    padding-right: 1.55rem;
}

.filter-field .suggest-toggle {
    width: 1.2rem;
    height: 1.2rem;
    right: 0.2rem;
    font-size: 0.65rem;
}

.filter-toggle {
    flex: 0 0 auto;
    min-height: 32px;
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.25rem 0.65rem;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-md);
    background: var(--bg-surface);
    color: var(--text-body);
    font: inherit;
    font-size: 0.78rem;
    font-weight: 600;
    white-space: nowrap;
    cursor: pointer;
    transition: background-color 0.16s ease, border-color 0.16s ease, color 0.16s ease;
}

.filter-toggle:hover {
    border-color: var(--text-faint);
    background: var(--bg-subtle);
}

.filter-toggle.active {
    border-color: var(--primary-soft-border);
    background: var(--primary-soft);
    color: var(--primary-text);
}

.filter-toggle.active i {
    color: var(--primary);
}

.filter-actions {
    display: none;
    align-items: center;
    flex-wrap: nowrap !important;
    gap: 0.45rem;
    flex: 0 0 auto;
    margin: 0;
}

.filter-actions .btn {
    min-height: 32px;
    height: 32px;
    padding: 0.35rem 0.85rem;
    font-size: 0.8rem;
    font-weight: 600;
    line-height: 1;
    border-radius: var(--radius-md);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.35rem;
    box-sizing: border-box;
}

.btn-clear-cache {
    background: var(--warning-soft) !important;
    border: 1px solid var(--warning) !important;
    color: var(--warning) !important;
    font-weight: 600 !important;
    transition: all 0.16s ease;
}

.btn-clear-cache:hover:not(:disabled) {
    background: color-mix(in srgb, var(--warning) 25%, var(--surface)) !important;
    border-color: var(--warning) !important;
    color: var(--warning) !important;
}

.btn-clear-cache i {
    color: var(--warning);
}

/* Filters never run on their own; Apply commits them. This ring is the only cue that
   there are staged changes waiting. */
.btn-filter-submit.is-dirty:not(:disabled) {
    box-shadow: var(--ring), var(--shadow-xs);
}

/* Applied-filter chips */
.filter-chips {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.4rem;
    margin-top: 0.6rem;
    padding-top: 0.6rem;
    border-top: 1px dashed var(--border-strong);
}

.filter-chips-label {
    color: var(--text-muted);
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.filter-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    max-width: 260px;
    padding: 0.22rem 0.3rem 0.22rem 0.6rem;
    border: 1px solid var(--primary-soft-border);
    border-radius: var(--radius-pill);
    background: var(--primary-soft);
    color: var(--primary-text);
    font: inherit;
    font-size: 0.78rem;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.16s ease, border-color 0.16s ease;
}

.filter-chip:hover {
    border-color: var(--brand-line);
    background: var(--brand-soft);
}

.filter-chip-key {
    color: var(--brand-ink);
    font-weight: 700;
}

.filter-chip-val {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.filter-chip i {
    width: 17px;
    height: 17px;
    flex: 0 0 17px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    background: color-mix(in srgb, var(--brand) 12%, transparent);
    font-size: 0.6rem;
}

.filter-chip:hover i {
    background: var(--primary);
    color: var(--on-brand);
}

.filter-chip.clear-all {
    border-color: var(--border-strong);
    background: var(--bg-surface);
    color: var(--text-muted);
    padding-right: 0.6rem;
}

.filter-chip.clear-all:hover {
    border-color: color-mix(in srgb, var(--danger) 35%, var(--surface));
    background: var(--status-red);
    color: var(--status-red-text);
}

/* ==== Shared dropdown / suggestion menu ==== */
.suggest-toggle {
    position: absolute;
    right: 0.3rem;
    width: 1.5rem;
    height: 1.5rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 0;
    border-radius: var(--radius-sm);
    background: transparent;
    color: var(--text-faint);
    font-size: 0.7rem;
    cursor: pointer;
    transition: background-color 0.16s ease, color 0.16s ease;
}

.suggest-toggle:hover {
    background: var(--primary-soft);
    color: var(--primary);
}

.suggest-menu,
.sales-suggest-menu {
    position: absolute;
    top: calc(100% + 0.3rem);
    left: 0;
    right: 0;
    min-width: 210px;
    z-index: 60;
    max-height: 264px;
    overflow-y: auto;
    overscroll-behavior: contain;
    padding: 0.3rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    background: var(--bg-surface);
    box-shadow: var(--shadow-xl);
}

.suggest-menu[hidden],
.sales-suggest-menu[hidden] {
    display: none;
}

.sales-suggest-heading {
    padding: 0.35rem 0.6rem 0.25rem;
    color: var(--text-faint);
    font-size: 0.66rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.sales-suggest-option {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    width: 100%;
    padding: 0.5rem 0.6rem;
    border: 0;
    border-radius: var(--radius-md);
    background: transparent;
    color: var(--text-dark);
    font: inherit;
    font-size: 0.85rem;
    font-weight: 550;
    text-align: left;
    cursor: pointer;
}

.sales-suggest-option i {
    width: 14px;
    flex: 0 0 14px;
    color: var(--text-faint);
    font-size: 0.78rem;
}

.sales-suggest-option span {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.sales-suggest-option:hover,
.sales-suggest-option.is-active {
    background: var(--primary-soft);
    color: var(--primary-text);
}

.sales-suggest-option:hover i,
.sales-suggest-option.is-active i {
    color: var(--primary);
}

.sales-suggest-option mark {
    background: transparent;
    color: var(--primary);
    font-weight: 700;
}

.sales-suggest-empty {
    padding: 0.6rem;
    color: var(--text-faint);
    font-size: 0.82rem;
    text-align: center;
}

/* Anchored action menus (profile, CSV upload) */
.profile-actions {
    position: relative;
    display: flex;
    align-items: center;
    gap: 0.6rem;
}

.profile-menu,
.rate-csv-menu {
    position: absolute;
    top: calc(100% + 0.5rem);
    right: 0;
    min-width: 196px;
    padding: 0.3rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    background: var(--bg-surface);
    box-shadow: var(--shadow-xl);
    display: none;
    z-index: 500;
}

.profile-menu.open,
.rate-csv-menu.open {
    display: block;
    animation: fadeIn 0.14s ease;
}

.profile-menu button,
.rate-csv-menu button,
.row-actions-menu button {
    width: 100%;
    border: 0;
    background: transparent;
    display: flex;
    align-items: center;
    gap: 0.6rem;
    text-align: left;
    padding: 0.55rem 0.65rem;
    border-radius: var(--radius-md);
    color: var(--text-body);
    font: inherit;
    font-size: 0.85rem;
    font-weight: 550;
    cursor: pointer;
    white-space: nowrap;
}

.profile-menu button i,
.rate-csv-menu button i,
.row-actions-menu button i {
    width: 16px;
    flex: 0 0 16px;
    text-align: center;
    color: var(--text-faint);
    font-size: 0.85rem;
}

.profile-menu button:hover,
.rate-csv-menu button:hover,
.row-actions-menu button:hover {
    background: var(--primary-soft);
    color: var(--primary-text);
}

.profile-menu button:hover i,
.rate-csv-menu button:hover i,
.row-actions-menu button:hover i {
    color: var(--primary);
}

.profile-menu button.danger,
.row-actions-menu button.danger {
    color: var(--status-red-text);
}

.profile-menu button.danger i,
.row-actions-menu button.danger i {
    color: var(--danger);
}

.profile-menu button.danger:hover,
.row-actions-menu button.danger:hover {
    background: var(--status-red);
}

.rate-csv-menu-wrap {
    position: relative;
}

#rates-csv-menu-btn .fa-chevron-down {
    font-size: 0.65rem;
    opacity: 0.85;
}

/* ==== Tables ==== */
.rate-table-wrap {
    position: relative;
    flex: 1 1 auto;
    min-height: 180px;
    margin: 0;
    border-top: 0;
    border-radius: 0 0 var(--radius-lg) var(--radius-lg);
    overflow: auto;
    overscroll-behavior: contain;
    background: var(--bg-surface);
    cursor: grab;
    user-select: auto;
    -webkit-user-select: auto;
}

.rate-table-wrap.is-dragging {
    cursor: grabbing !important;
    user-select: none !important;
    -webkit-user-select: none !important;
}

.rate-table-wrap.is-dragging * {
    cursor: grabbing !important;
    user-select: none !important;
    -webkit-user-select: none !important;
    pointer-events: none !important;
}

.rate-table-toolbar,
.rate-table-footer {
    flex: 0 0 auto;
    width: 100%;
    min-height: 38px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 0.75rem;
    padding: 0.4rem 1rem;
    border-top: 1px solid var(--border);
    border-radius: 0 0 var(--radius-lg) var(--radius-lg);
    background: var(--surface);
}

.rate-table-tools {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.po-result-count {
    color: var(--text-muted);
    font-size: 0.74rem;
    white-space: nowrap;
}

.po-result-count strong {
    color: var(--text-dark);
    font-weight: 650;
}

.po-pagination {
    display: flex;
    align-items: center;
    gap: 0.28rem;
}

#quotation-page-display,
#rates-page-display,
#sales-rates-page-display {
    display: inline-flex;
    align-items: center;
    gap: 0.28rem;
    padding: 0 0.4rem;
    color: var(--ink);
    font-size: 0.72rem;
    font-weight: 600;
    white-space: nowrap;
}

.po-page-button {
    min-width: 22px !important;
    height: 22px !important;
    min-height: 22px !important;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0 0.38rem !important;
    border: 1px solid var(--line-strong);
    border-radius: 5px;
    background: var(--surface);
    color: var(--ink);
    font: inherit;
    font-size: 0.70rem !important;
    font-weight: 600;
    cursor: pointer;
    line-height: 1;
    transition: background-color 0.16s ease, border-color 0.16s ease, color 0.16s ease, box-shadow 0.16s ease;
}

.po-page-button.po-page-nav {
    padding: 0 0.50rem !important;
    font-weight: 500;
}

.po-page-button:hover:not(:disabled):not(.active) {
    border-color: var(--line-strong);
    background: var(--surface-2);
    color: var(--ink);
}

.po-page-button.active {
    background: var(--brand) !important;
    border-color: var(--brand) !important;
    color: var(--on-brand) !important;
    font-weight: 700 !important;
    cursor: default;
    box-shadow: 0 1px 2px color-mix(in srgb, var(--brand) 20%, transparent);
}

.po-page-button:disabled {
    opacity: 1 !important;
    background: var(--surface) !important;
    border-color: var(--line) !important;
    color: var(--faint) !important;
    cursor: not-allowed;
}

.po-page-ellipsis {
    padding: 0 0.15rem;
    color: var(--muted);
    font-size: 0.70rem !important;
    font-weight: 600;
}

.page-size-select {
    min-height: 22px !important;
    height: 22px !important;
    padding: 0 1.3rem 0 0.5rem !important;
    border: 1px solid var(--line-strong);
    border-radius: var(--radius-pill);
    background-color: var(--bg-surface);
    color: var(--ink);
    font: inherit;
    font-size: 0.70rem !important;
    font-weight: 600;
    outline: none;
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23667085' stroke-width='2.25' stroke-linecap='round' stroke-linejoin='round' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.35rem center;
    background-size: 10px 10px;
}

.page-size-select:focus {
    border-color: var(--primary);
    box-shadow: var(--ring);
}

.po-table-card,
.sales-results-card {
    border-radius: 12px !important;
    overflow: hidden !important;
    border: 1px solid var(--line-strong) !important;
}

.data-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    font-variant-numeric: tabular-nums;
    border: 1px solid var(--line-strong);
    border-radius: 10px;
}

.data-table th {
    padding: 0.32rem 0.65rem;
    text-align: left;
    border-bottom: 1px solid var(--line);
    border-right: 1px solid var(--line);
    font-size: 0.65rem;
    vertical-align: middle;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.data-table th .th-text {
    display: inline-block;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    vertical-align: middle;
}

.data-table th.sortable .th-sort .th-text {
    display: inline-block;
    max-width: calc(100% - 15px);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    vertical-align: middle;
}

.data-table td {
    padding: 0.38rem 0.65rem !important;
    text-align: left;
    border-bottom: 1px solid var(--line);
    border-right: 1px solid var(--line);
    font-size: 0.76rem !important;
    vertical-align: middle;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.data-table th:last-child,
.data-table td:last-child {
    border-right: none;
}

.data-table th:first-child {
    border-top-left-radius: 8px;
}

.data-table th:last-child {
    border-top-right-radius: 8px;
}

.data-table th:first-child,
.data-table td:first-child {
    padding-left: 0.85rem;
}

.data-table th:last-child,
.data-table td:last-child {
    padding-right: 0.5rem !important;
    padding-left: 0.5rem !important;
}

.data-table th.text-right,
.data-table td.text-right {
    text-align: right;
}

.data-table th.text-center,
.data-table td.text-center {
    text-align: center !important;
}

.data-table th.text-center .th-sort {
    justify-content: center !important;
}

.mode-text-badge {
    font-size: 0.72rem !important;
    font-weight: 700;
    color: var(--ink);
    text-transform: uppercase;
    letter-spacing: 0.02em;
}

.unit-tag {
    display: inline-block;
    padding: 0;
    font-size: 0.72rem !important;
    font-weight: 600;
    color: var(--ink);
    background: transparent !important;
    border: none !important;
    text-transform: uppercase;
    letter-spacing: 0.02em;
}

.data-table th {
    position: sticky;
    top: 0;
    z-index: 20;
    padding: 0.32rem 0.85rem;
    background: var(--brand);
    /* #0C1B35; 0f1f3b*/
    color: var(--on-brand) !important;
    font-size: 0.65rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    white-space: nowrap;
    box-shadow: inset 0 -1px 0 rgba(255, 255, 255, 0.08);
    border-bottom: 0;
}

.data-table th,
.data-table th button,
.data-table th a,
.data-table th i {
    color: var(--on-brand) !important;
}

.data-table tbody tr {
    transition: background-color 0.14s ease;
}

.data-table tbody tr:nth-child(even) {
    background-color: var(--surface-2) !important;
}

.data-table tbody tr:nth-child(odd) {
    background-color: var(--surface) !important;
}

.data-table tbody tr:hover {
    background-color: var(--surface-2) !important;
}

.data-table tbody tr:last-child td {
    border-bottom: none;
}

.data-table tbody td,
.data-table tbody td span,
.data-table tbody td div,
.data-table tbody td strong,
.data-table tbody td b,
.mode-text-badge,
.unit-tag {
    font-weight: 500 !important;
}

.data-table tbody td i,
.data-table tbody td .fa-solid,
.data-table tbody td .fa-regular,
.data-table tbody td .fa-brands,
.data-table tbody td .route-arrow {
    font-weight: 900 !important;
}

/* Sortable headers */
.data-table th.sortable {
    padding: 0;
}

.th-sort {
    width: 100%;
    max-width: 100%;
    min-height: 0;
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.32rem 0.65rem;
    border: 0;
    background: transparent;
    color: inherit;
    font: inherit;
    font-size: inherit;
    font-weight: inherit;
    letter-spacing: inherit;
    text-transform: inherit;
    cursor: pointer;
    overflow: hidden;
    white-space: nowrap;
    box-sizing: border-box;
}

.data-table th.text-right .th-sort {
    justify-content: flex-end;
}

.data-table th.text-center .th-sort {
    justify-content: center;
}

.th-sort i {
    font-size: 0.68rem;
    opacity: 0.7;
    transition: opacity 0.16s ease;
    margin-left: 0.2rem;
    flex-shrink: 0;
}

.th-sort .th-text {
    flex: 0 1 auto;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.th-sort:hover i,
.data-table th.is-sorted .th-sort i {
    opacity: 1;
}

/* Actions column: sticky pinned to the right edge of both tables */
#freight-rates-table th:last-child,
#quotations-table th:last-child {
    position: sticky !important;
    right: 0 !important;
    top: 0 !important;
    z-index: 30 !important;
    min-width: 72px;
    width: 72px;
    max-width: 72px;
    background: var(--brand-tint) !important;
    text-align: center !important;
    border-left: 1px solid var(--line) !important;
    padding: 0.35rem 0.5rem !important;
    font-size: var(--fs-sm);
    font-weight: 600;
    letter-spacing: normal;
    text-transform: none;
}

#freight-rates-table tbody td:last-child:not([colspan]),
#quotations-table tbody td:last-child:not([colspan]) {
    position: sticky !important;
    right: 0 !important;
    z-index: 10 !important;
    min-width: 72px;
    width: 72px;
    max-width: 72px;
    text-align: center !important;
    background-color: var(--surface);
    border-left: 1px solid var(--line) !important;
    white-space: nowrap;
    padding: 0.38rem 0.5rem !important;
}

#freight-rates-table tbody tr:nth-child(even) td:last-child:not([colspan]),
#quotations-table tbody tr:nth-child(even) td:last-child:not([colspan]) {
    background-color: var(--surface-2) !important;
}

#freight-rates-table tbody tr:nth-child(odd) td:last-child:not([colspan]),
#quotations-table tbody tr:nth-child(odd) td:last-child:not([colspan]) {
    background-color: var(--surface) !important;
}

#freight-rates-table tbody tr:hover td:last-child:not([colspan]),
#quotations-table tbody tr:hover td:last-child:not([colspan]) {
    background-color: var(--surface-2) !important;
}

#freight-rates-table tbody tr.skeleton-row td:last-child:not([colspan]),
#quotations-table tbody tr.skeleton-row td:last-child:not([colspan]) {
    background-color: var(--bg-surface) !important;
}

/* Quotations table: Status column sticky pinned beside Actions column */
#quotations-table th:nth-last-child(2),
#quotations-table th:nth-child(6) {
    position: sticky !important;
    right: 72px !important;
    top: 0 !important;
    z-index: 30 !important;
    min-width: 160px;
    width: 160px;
    max-width: 160px;
    background: var(--brand-tint) !important;
    text-align: center !important;
    border-left: 1px solid var(--line) !important;
    padding: 0.35rem 0.5rem !important;
    font-size: var(--fs-sm);
    font-weight: 600;
    letter-spacing: normal;
    text-transform: none;
    box-shadow: -3px 0 6px -2px rgba(0, 0, 0, 0.25);
}

#quotations-table tbody td:nth-last-child(2):not([colspan]),
#quotations-table tbody td:nth-child(6):not([colspan]) {
    position: sticky !important;
    right: 72px !important;
    z-index: 10 !important;
    min-width: 160px;
    width: 160px;
    max-width: 160px;
    text-align: center !important;
    background-color: var(--surface);
    border-left: 1px solid var(--line) !important;
    white-space: nowrap;
    padding: 0.38rem 0.5rem !important;
    box-shadow: -3px 0 6px -2px rgba(0, 0, 0, 0.08);
}

#quotations-table tbody tr:nth-child(even) td:nth-last-child(2):not([colspan]),
#quotations-table tbody tr:nth-child(even) td:nth-child(6):not([colspan]) {
    background-color: var(--surface-2) !important;
}

#quotations-table tbody tr:nth-child(odd) td:nth-last-child(2):not([colspan]),
#quotations-table tbody tr:nth-child(odd) td:nth-child(6):not([colspan]) {
    background-color: var(--surface) !important;
}

#quotations-table tbody tr:hover td:nth-last-child(2):not([colspan]),
#quotations-table tbody tr:hover td:nth-child(6):not([colspan]) {
    background-color: var(--surface-2) !important;
}

#quotations-table tbody tr.skeleton-row td:nth-last-child(2):not([colspan]),
#quotations-table tbody tr.skeleton-row td:nth-child(6):not([colspan]) {
    background-color: var(--bg-surface) !important;
}

.data-table td .cell-main {
    display: block;
    color: var(--text-dark);
    font-weight: 600;
    white-space: nowrap;
}

.data-table td .cell-sub {
    display: block;
    margin-top: 0.15rem;
    color: var(--text-muted);
    font-size: 0.765rem;
    white-space: nowrap;
}

/* Route cell */
.route-cell {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    min-width: 0;
    max-width: 100%;
    color: var(--text-dark);
    font-weight: 600;
}

.route-cell .route-arrow {
    color: var(--text-faint);
    font-size: 0.7rem;
    flex-shrink: 0;
}

.route-cell>span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.rate-id-cell {
    display: inline-block;
    font-weight: 700;
    font-size: 0.76rem;
    color: var(--text-dark, var(--ink));
    font-family: var(--font-mono, monospace);
}

.datetime-cell {
    font-size: 0.8125rem;
    color: var(--text-dark, var(--ink));
    white-space: nowrap;
    display: inline-block;
}

/* Rates 17-Column Layout: Rate ID · Creator · Created At · Mode · Route · Carrier · Commodity · Unit · Buy Rate · Min Sell · Origin Chg · Dest Chg · Validity · ETD · Free Days · Status · Actions */
#freight-rates-table th:nth-child(1),
#freight-rates-table td:nth-child(1) {
    min-width: 65px;
    white-space: nowrap;
    text-align: center;
}

#freight-rates-table th:nth-child(2),
#freight-rates-table td:nth-child(2) {
    min-width: 85px;
    white-space: nowrap;
}

#freight-rates-table th:nth-child(3),
#freight-rates-table td:nth-child(3) {
    min-width: 145px;
    white-space: nowrap;
    text-align: center;
}

#freight-rates-table th:nth-child(4),
#freight-rates-table td:nth-child(4) {
    min-width: 60px;
    white-space: nowrap;
}

#freight-rates-table th:nth-child(5),
#freight-rates-table td:nth-child(5) {
    min-width: 190px;
    white-space: nowrap;
}

#freight-rates-table th:nth-child(6),
#freight-rates-table td:nth-child(6) {
    min-width: 120px;
    white-space: nowrap;
}

#freight-rates-table th:nth-child(7),
#freight-rates-table td:nth-child(7) {
    min-width: 110px;
    white-space: nowrap;
}

#freight-rates-table th:nth-child(8),
#freight-rates-table td:nth-child(8) {
    min-width: 65px;
    white-space: nowrap;
}

#freight-rates-table th:nth-child(9),
#freight-rates-table td:nth-child(9) {
    min-width: 85px;
    white-space: nowrap;
}

#freight-rates-table th:nth-child(10),
#freight-rates-table td:nth-child(10) {
    min-width: 85px;
    white-space: nowrap;
}

#freight-rates-table th:nth-child(11),
#freight-rates-table td:nth-child(11) {
    min-width: 95px;
    white-space: nowrap;
}

#freight-rates-table th:nth-child(12),
#freight-rates-table td:nth-child(12) {
    min-width: 95px;
    white-space: nowrap;
}

#freight-rates-table th:nth-child(13),
#freight-rates-table td:nth-child(13) {
    min-width: 115px;
    white-space: nowrap;
}

#freight-rates-table th:nth-child(14),
#freight-rates-table td:nth-child(14) {
    min-width: 80px;
    white-space: nowrap;
}

#freight-rates-table th:nth-child(15),
#freight-rates-table td:nth-child(15) {
    min-width: 70px;
    white-space: nowrap;
}

#freight-rates-table th:nth-child(16),
#freight-rates-table td:nth-child(16) {
    min-width: 80px;
    white-space: nowrap;
}

#freight-rates-table th:nth-child(17),
#freight-rates-table td:nth-child(17) {
    min-width: 72px;
    width: 72px;
    max-width: 72px;
    white-space: nowrap;
    text-align: center;
}

/* Quotations 7-Column Layout: Creator · Created At · Customer · Customer Details · Total Quote Value · Status · Actions */
#quotations-table th:nth-child(1),
#quotations-table td:nth-child(1) {
    min-width: 80px;
    white-space: nowrap;
}

#quotations-table th:nth-child(2),
#quotations-table td:nth-child(2) {
    min-width: 145px;
    white-space: nowrap;
    text-align: center;
}

#quotations-table th:nth-child(3),
#quotations-table td:nth-child(3) {
    min-width: 90px;
    white-space: nowrap;
}

#quotations-table th:nth-child(4),
#quotations-table td:nth-child(4) {
    min-width: 150px;
    white-space: nowrap;
}

#quotations-table th:nth-child(5),
#quotations-table td:nth-child(5) {
    min-width: 140px;
    white-space: nowrap;
    text-align: center;
}

#quotations-table th:nth-child(6),
#quotations-table td:nth-child(6) {
    min-width: 160px;
    width: 160px;
    max-width: 160px;
    white-space: nowrap;
    text-align: center;
}

#quotations-table th:nth-child(7),
#quotations-table td:nth-child(7) {
    min-width: 72px;
    width: 72px;
    max-width: 72px;
    white-space: nowrap;
    text-align: center;
}

.mode-dot {
    width: 20px;
    height: 20px;
    flex: 0 0 20px;
    display: grid;
    place-items: center;
    border-radius: var(--radius-sm);
    background: var(--primary-soft);
    color: var(--primary);
    font-size: 0.66rem;
}

.mode-dot.air {
    background: var(--status-blue);
    color: var(--status-blue-text);
}

.unit-tag {
    display: inline-block;
    padding: 0.1rem 0.45rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--bg-sunken);
    color: var(--text-body);
    font-size: 0.75rem;
    font-weight: 600;
}

.money {
    display: inline-flex;
    align-items: baseline;
    justify-content: center;
    gap: 0.25rem;
    color: var(--ink);
    font-size: 0.86rem;
    font-weight: 600;
    white-space: nowrap;
}

.money-currency {
    font-size: 0.60rem !important;
    font-weight: 500 !important;
    color: var(--muted) !important;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.validity-cell.is-expiring .cell-sub {
    color: var(--status-yellow-text);
    font-weight: 600;
}

.validity-cell.is-expired .cell-sub {
    color: var(--status-red-text);
    font-weight: 600;
}

.note-flag {
    width: 20px;
    height: 20px;
    display: inline-grid;
    place-items: center;
    padding: 0;
    border: 0;
    border-radius: var(--radius-sm);
    background: transparent;
    color: var(--text-faint);
    font-size: 0.72rem;
    cursor: pointer;
}

.note-flag:hover {
    background: var(--primary-soft);
    color: var(--primary);
}

/* Click-to-expand truncated cell */
.rate-click-cell {
    display: inline-block;
    max-width: none !important;
    overflow: visible;
    white-space: nowrap;
    vertical-align: bottom;
    cursor: pointer;
    border-bottom: none !important;
}

.rate-click-cell:hover {
    color: var(--primary);
    border-bottom: none !important;
}

.rate-value-content {
    white-space: pre-wrap;
    overflow-wrap: anywhere;
    color: var(--text-body);
    line-height: 1.6;
}

/* Row action buttons */
.rate-actions,
.quotation-actions {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 0.35rem;
}

.rate-icon-btn {
    width: 28px;
    height: 28px;
    display: grid;
    place-items: center;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-sm);
    background: var(--bg-surface);
    color: var(--text-muted);
    font-size: 0.78rem;
    cursor: pointer;
    transition: background-color 0.14s ease, border-color 0.14s ease, color 0.14s ease;
}

.rate-icon-btn.edit {
    border-color: var(--brand-line);
    color: var(--brand-ink);
    background: var(--brand-soft);
}

.rate-icon-btn.deactivate {
    border-color: color-mix(in srgb, var(--warning) 35%, var(--surface));
    color: var(--warning);
    background: var(--warning-soft);
}

.rate-icon-btn.activate {
    border-color: color-mix(in srgb, var(--success) 35%, var(--surface));
    color: var(--success);
    background: var(--success-soft);
}

.rate-icon-btn.danger {
    border-color: color-mix(in srgb, var(--danger) 35%, var(--surface));
    color: var(--danger);
    background: var(--danger-soft);
}

.rate-icon-btn:hover:not(:disabled) {
    filter: brightness(0.96);
    box-shadow: var(--shadow-xs);
}

.rate-icon-btn:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

/* "Actions ▾" row trigger, next to the eye/view icon button */
.row-actions-trigger {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    height: 28px;
    padding: 0 0.65rem;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-sm);
    background: var(--bg-surface);
    color: var(--text-body);
    font: inherit;
    font-size: 0.78rem;
    font-weight: 600;
    white-space: nowrap;
    cursor: pointer;
    transition: background-color 0.14s ease, border-color 0.14s ease, color 0.14s ease;
}

.row-actions-trigger i {
    font-size: 0.62rem;
}

.row-actions-trigger:hover,
.row-actions-trigger[aria-expanded="true"] {
    border-color: var(--primary-soft-border);
    background: var(--primary-soft);
    color: var(--primary-text);
}

/* Row actions dropdown: one overlay shared by every table row. Positioned with
   fixed (not absolute) so JS can anchor it under whichever trigger was clicked
   without it being clipped by the table's own overflow:auto scroll container. */
.row-actions-menu {
    position: fixed;
    min-width: 180px;
    padding: 0.3rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    background: var(--bg-surface);
    box-shadow: var(--shadow-xl);
    z-index: 900;
}

.row-actions-menu[hidden] {
    display: none;
}

.row-actions-trigger.action-kebab-btn {
    width: 28px;
    height: 28px;
    min-height: 28px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    background: transparent;
    border: 1px solid transparent;
    color: var(--muted);
    font-size: 0.95rem;
    cursor: pointer;
    transition: all 0.15s ease;
}

.row-actions-trigger.action-kebab-btn:hover,
.row-actions-trigger.action-kebab-btn[aria-expanded="true"] {
    background: var(--surface-2);
    border-color: var(--line-strong);
    color: var(--ink);
}

/* Table state cells: loading, empty, error */
.rate-message-cell,
.quotation-empty-cell,
.table-message-cell,
.table-loader-cell {
    padding: 0 !important;
    border-bottom: 0 !important;
    background: var(--bg-surface);
}

.rate-empty-state,
.quotation-empty-state,
.table-loader,
.empty-state {
    position: sticky;
    left: 0;
    width: 100%;
    min-height: 200px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.6rem;
    padding: 2rem 1.25rem;
    color: var(--text-muted);
    background: var(--bg-surface);
    text-align: center;
}

.rate-empty-state i,
.quotation-empty-state i,
.empty-state i {
    display: grid;
    place-items: center;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--bg-sunken);
    color: var(--text-faint);
    font-size: 1rem;
}

.rate-empty-state span,
.quotation-empty-state span {
    max-width: 420px;
    font-size: 0.875rem;
    line-height: 1.55;
}

.rate-empty-state.is-error i,
.quotation-empty-state.is-error i {
    background: var(--status-red);
    color: var(--status-red-text);
}

.table-loader-icon {
    color: var(--primary);
    font-size: 1.1rem;
}

.table-loader-title {
    color: var(--text-body);
    font-size: 0.875rem;
    font-weight: 600;
}

.table-loader-subtitle {
    margin-top: 0.15rem;
    color: var(--text-faint);
    font-size: 0.8rem;
}

.block-loader {
    display: grid;
    place-items: center;
    padding: 2rem;
}

/* Skeleton rows while a table page loads */
.skeleton-cell {
    height: 12px;
    border-radius: var(--radius-pill);
    background: linear-gradient(90deg, var(--line) 25%, var(--surface-2) 50%, var(--line) 75%);
    background-size: 420px 100%;
    animation: shimmer 1.15s linear infinite;
}

.skeleton-cell.narrow {
    width: 45%;
}

.skeleton-cell.medium {
    width: 70%;
}

tr.skeleton-row td {
    background: var(--bg-surface);
}

/* ==== Rates: CSV upload modal bits ==== */
.rate-file-drop {
    display: grid;
    place-items: center;
    gap: 0.4rem;
    min-height: 152px;
    margin-top: 1rem;
    padding: 1.5rem;
    border: 1.5px dashed var(--primary-soft-border);
    border-radius: var(--radius-lg);
    background: var(--brand-soft);
    color: var(--text-muted);
    text-align: center;
    cursor: pointer;
    transition: border-color 0.16s ease, background-color 0.16s ease;
}

.rate-file-drop:hover,
.rate-file-drop.is-dragover {
    border-color: var(--primary);
    background: var(--primary-soft);
}

.rate-file-drop i {
    color: var(--primary);
    font-size: 1.4rem;
}

.rate-file-drop strong {
    color: var(--text-dark);
    font-size: 0.925rem;
}

.rate-file-drop span {
    font-size: 0.8rem;
}

.rate-file-drop input {
    display: none;
}

.rate-csv-status {
    min-height: 1.2rem;
    margin-top: 0.75rem;
    color: var(--text-muted);
    font-size: 0.82rem;
    overflow-wrap: anywhere;
}

/* ==== Sales Rate Search Controls Row Layout ==== */
.sales-rates-controls-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.65rem;
    padding: 0.55rem 0.85rem;
    background: var(--surface);
    border-radius: var(--radius-lg);
    min-height: 44px;
    width: 100%;
}

.sales-rates-filter-hint {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--muted);
    font-size: 0.78rem;
    font-weight: 500;
    margin-right: auto;
    cursor: default;
    user-select: none;
    padding: 0.25rem 0.65rem;
    border-radius: var(--radius-md);
}

.sales-rates-filter-hint i {
    color: var(--faint);
    font-size: 0.75rem;
}

.sales-rates-filter-hint[hidden] {
    display: none !important;
}

.sales-rates-controls-right {
    display: flex;
    align-items: center;
    flex: 0 0 auto;
    margin-left: auto;
}

.sales-rate-filters[hidden] {
    display: none !important;
}

.sales-rate-filters {
    display: flex !important;
    align-items: center !important;
    flex: 1 1 auto;
    min-width: 0;
    margin: 0 !important;
    padding: 0 !important;
    background: transparent !important;
    animation: fadeIn 0.18s ease;
}

.sales-rate-form-row {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    flex-wrap: nowrap !important;
    width: 100%;
}

.sales-rate-actions {
    flex: 0 0 auto;
    display: none;
    align-items: center;
    gap: 0.35rem;
    margin-left: auto;
}

.sales-rate-field {
    position: relative;
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.sales-rate-field.mode {
    flex: 0 0 76px;
    min-width: 76px;
}

.sales-rate-field.mode label {
    justify-content: flex-start;
    text-align: left;
    padding-left: 0.15rem;
}

.sales-rate-field.charge-unit {
    flex: 0 0 100px;
    min-width: 95px;
}

.sales-rate-field.commodity {
    flex: 1 1 95px;
    min-width: 85px;
}

.sales-rate-field.carrier {
    flex: 1 1 85px;
    min-width: 80px;
}

.sales-rate-field.created-by {
    flex: 1 1 95px;
    min-width: 85px;
}

.sales-rate-field.date-range-field {
    flex: 0 0 100px;
    min-width: 95px;
}

.sales-rate-field label {
    display: flex;
    align-items: center;
    gap: 0.3rem;
    margin-bottom: 0.2rem;
    color: var(--ink);
    font-size: 0.72rem;
    font-weight: 750;
    white-space: nowrap;
}

.sales-required-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 0.8rem;
    height: 0.8rem;
    border-radius: 50%;
    background: var(--status-red);
    color: var(--danger);
    font-size: 0.44rem;
}

/* The control row of a labelled field, so absolute icons align to it not the label */
.sales-field-control {
    position: relative;
    display: flex;
    align-items: center;
    min-width: 0;
}

.sales-rate-field input,
.sales-rate-field select,
.sales-rate-filters .ms-trigger,
#quotation-filter-form .ms-trigger,
.rates-filter-drawer .ms-trigger,
.rates-filter-drawer .date-range-trigger-input {
    width: 100%;
    min-width: 0;
    min-height: 24px !important;
    height: 24px !important;
    padding: 0.15rem 0.55rem !important;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-md);
    background-color: var(--bg-surface);
    color: var(--text-dark);
    font: inherit;
    font-size: 0.73rem !important;
    text-overflow: ellipsis;
    outline: none;
    transition: border-color 0.16s ease, box-shadow 0.16s ease;
}

.sales-rate-filters .ms-trigger {
    padding: 0.15rem 0.42rem !important;
    gap: 0.25rem !important;
    font-weight: 500;
}

.sales-rate-filters .ms-trigger-label {
    font-size: 0.72rem;
    white-space: nowrap;
}

.sales-rate-filters .ms-trigger-icon {
    font-size: 0.52rem;
    flex: 0 0 auto;
}

#quotation-filter-form .ms-trigger,
.rates-filter-drawer .ms-trigger {
    font-weight: 500;
}

#quotation-filter-form .ms-trigger-icon,
.rates-filter-drawer .ms-trigger-icon {
    font-size: 0.58rem;
}

#quotation-filter-form .filter-actions .btn,
.rates-filter-drawer .filter-actions .btn {
    min-height: 24px !important;
    height: 24px !important;
    padding: 0.15rem 0.65rem !important;
    font-size: 0.73rem !important;
    border-radius: var(--radius-md) !important;
}

.sales-rate-filters .ms-trigger:hover {
    border-color: var(--text-faint);
}

.sales-rate-field select {
    padding-right: 1.6rem;
}

.sales-rate-field input:hover:not(:focus),
.sales-rate-field select:hover:not(:focus) {
    border-color: var(--text-faint);
}

.sales-rate-field input:focus,
.sales-rate-field select:focus {
    border-color: var(--primary);
    box-shadow: var(--ring);
}

.sales-rate-field.has-value input,
.sales-rate-field.has-value select,
.sales-rate-field input.has-value,
.sales-rate-field select.has-value {
    border-color: var(--brand);
    background-color: var(--brand-soft);
    color: var(--brand-ink);
    font-weight: 700;
}

.sales-rate-field.has-value .sales-route-icon,
.sales-rate-field.has-value .suggest-toggle {
    color: var(--brand-ink);
}

.sales-rate-field select option {
    color: var(--ink);
    background-color: var(--surface);
    font-weight: 400;
}

.sales-rate-field.sales-suggest-field input {
    padding-right: 1.6rem;
}

.sales-suggest-field .suggest-toggle {
    width: 1.15rem;
    height: 1.15rem;
    right: 0.2rem;
    font-size: 0.6rem;
}

.sales-route-pair {
    position: relative;
    flex: 1.6 1 230px;
    min-width: 195px;
    display: grid;
    grid-template-columns: minmax(0, 1fr) 1.5rem minmax(0, 1fr);
    align-items: center;
    gap: 0.25rem;
}

.sales-route-swap-btn {
    width: 1.4rem;
    height: 1.4rem;
    margin-bottom: 2px;
    justify-self: center;
    display: grid;
    place-items: center;
    border: 1px solid var(--border-strong);
    border-radius: 50%;
    background: var(--bg-surface);
    color: var(--text-muted);
    font-size: 0.65rem;
    cursor: pointer;
    box-shadow: var(--shadow-xs);
    transition: transform 0.24s ease, color 0.16s ease, border-color 0.16s ease;
}

.sales-route-swap-btn:hover {
    color: var(--primary);
    border-color: var(--primary-soft-border);
    background: var(--primary-soft);
    transform: rotate(180deg);
}

.sales-route-icon {
    position: absolute;
    left: 0.5rem;
    display: flex;
    align-items: center;
    color: var(--text-faint);
    font-size: 0.68rem;
    pointer-events: none;
}

.sales-route-input {
    padding-left: 1.65rem !important;
}


.sales-rate-actions .btn {
    min-height: 24px;
    height: 24px;
    padding: 0.18rem 0.65rem;
    font-size: 0.73rem;
}

.sales-rate-filters .auth-message {
    display: none !important;
}

.sales-results-card {
    min-height: 0;
    flex: 1 1 0px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* ==== Sales Rate Results (Exact Reference Match) ==== */
.sales-rate-results {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
    padding: 0.45rem 0.55rem 0.75rem;
    overflow-y: auto;
}

.sales-rate-result-head {
    display: none !important;
}

.sr-card {
    background: var(--surface-2);
    border: 1px solid var(--line);
    border-radius: 7.5px;
    padding: 0.34rem 0.75rem;
    display: flex;
    gap: 0.90rem;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.02);
    transform: translateY(0) translateZ(0);
    transition: transform 0.2s cubic-bezier(0.25, 0.8, 0.25, 1), box-shadow 0.2s ease, border-color 0.2s ease;
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

.sr-card:hover {
    border-color: var(--line-strong);
    transform: translateY(-2px) translateZ(0);
    box-shadow: 0 8px 18px -2px rgba(15, 23, 42, 0.09), 0 3px 6px -1px rgba(15, 23, 42, 0.04);
    z-index: 2;
}

.sr-card.is-selected {

    background: var(--surface-2) !important;
    box-shadow: 0 0 0 1.5px var(--line-strong), 0 4px 12px color-mix(in srgb, var(--brand) 8%, transparent) !important;
}

.sr-card-select-wrap {
    display: flex;
    align-items: center;
    justify-content: center;
    padding-right: 0.25rem;
}

.sr-card-select-label {
    display: flex;
    align-items: center;
    cursor: pointer;
    user-select: none;
    padding: 0.3rem;
    margin: 0;
}

.sr-card-select-label input[type="checkbox"],
.sr-select-all-label input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
    accent-color: var(--brand-ink);
}

.sales-results-action-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.28rem 0.85rem;
    background: var(--surface);
    border-bottom: 1px solid var(--line);
    border-top-left-radius: var(--radius-lg);
    border-top-right-radius: var(--radius-lg);
}

.sales-results-select-info {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.sr-clear-selection-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--muted);
    background: transparent;
    border: 1px solid var(--line);
    padding: 0.15rem 0.48rem;
    border-radius: 5px;
    cursor: pointer;
    transition: all 0.15s ease;
    height: 24px;
}

.sr-clear-selection-btn:hover {
    color: var(--danger);
    border-color: color-mix(in srgb, var(--danger) 35%, var(--surface));
    background: var(--danger-soft);
}

.sr-selected-counter {
    font-size: 0.74rem;
    font-weight: 600;
    color: var(--muted);
    background: var(--surface-2);
    padding: 0.15rem 0.5rem;
    border-radius: 999px;
    line-height: 1.2;
}

.sr-top-create-quote-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    font-weight: 600;
    font-size: 0.74rem;
    min-height: 24px !important;
    height: 24px !important;
    padding: 0.18rem 0.75rem !important;
    border-radius: 5px;
    margin-top: 0 !important;
    transition: all 0.18s ease;
}

.sr-top-create-quote-btn i {
    font-size: 0.72rem;
}

/* Left Section */
.sr-left {
    flex: 1.65;
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.sr-route-header {
    display: flex;
    align-items: center;
    gap: 0.32rem;
    font-size: 0.74rem;
    font-weight: 800;
    color: var(--ink);
    margin-bottom: 0.18rem;
    letter-spacing: -0.01em;
}

.sr-origin,
.sr-destination {
    color: var(--ink);
}

.sr-arrow {
    color: var(--brand-ink);
    font-weight: 700;
    font-size: 0.67rem;
}

.sr-specs-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    row-gap: 0.30rem;
    column-gap: 0;
    margin-top: 0.15rem;
}

.sr-grid-item {
    background: transparent;
    padding: 0.08rem 0.65rem;
    display: flex;
    flex-direction: column;
    justify-content: center;
    min-width: 0;
    border-right: 1px solid var(--line);
}

.sr-grid-item:nth-child(4n) {
    border-right: none;
    padding-right: 0;
}

.sr-grid-item:nth-child(4n + 1) {
    padding-left: 0;
}

.sr-grid-item:nth-child(-n + 4) {
    border-bottom: 1px solid var(--line);
    padding-bottom: 0.28rem;
    margin-bottom: 0.12rem;
}

.sr-item-lbl {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    font-size: 0.65rem;
    font-weight: 600;
    color: var(--brand-ink);
    line-height: 1.1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sr-item-lbl i {
    color: var(--brand-ink);
    font-size: 0.54rem;
    flex-shrink: 0;
    opacity: 1;
}

.sr-item-val {
    display: block;
    font-size: 0.62rem;
    font-weight: 600;
    color: var(--ink);
    margin-top: 0.03rem;
    line-height: 1.15;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sr-card-remarks {
    font-size: 0.56rem;
    color: var(--muted);
    margin-top: 0.18rem;
    line-height: 1.18;
}

/* Right Section */
.sr-right {
    flex: 1;
    min-width: 230px;
    max-width: 280px;
    border-left: 1px solid var(--line);
    padding-left: 0.75rem;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.sr-price-top {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.45rem;
}

.sr-min-rate-block {
    display: flex;
    flex-direction: column;
}

.sr-min-rate-label {
    font-size: 0.50rem;
    font-weight: 700;
    color: var(--success);
    letter-spacing: 0.03em;
    text-transform: uppercase;
}

.sr-min-rate-amount {
    display: flex;
    align-items: baseline;
    gap: 0.22rem;
    margin-top: 0.02rem;
}

.sr-rate-curr-val {
    font-size: 0.82rem;
    font-weight: 800;
    color: var(--success);
    line-height: 1.1;
}

.sr-rate-unit {
    font-size: 0.58rem;
    font-weight: 600;
    color: var(--ink);
}

.sr-create-quote-btn {
    background: var(--brand-hover) !important;
    color: var(--on-brand) !important;
    font-size: 0.62rem !important;
    font-weight: 600 !important;
    min-height: unset !important;
    height: 22px !important;
    line-height: 1 !important;
    padding: 0 0.55rem !important;
    border-radius: 4px !important;
    white-space: nowrap !important;
    border: none !important;
    cursor: pointer !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    transition: background-color 0.15s ease !important;
}

.sr-create-quote-btn:hover {
    background: var(--brand) !important;
}

.sr-right-dashed-divider {
    border-top: 1px dashed var(--line);
    margin: 0.17rem 0;
}

.sr-charges-list {
    display: flex;
    flex-direction: column;
    gap: 0.09rem;
}

.sr-charge-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 0.58rem;
}

.sr-charge-name {
    color: var(--ink);
    font-weight: 500;
}

.sr-charge-val {
    color: var(--ink);
    font-weight: 700;
}

.sr-landed-total-box {
    background: var(--success-soft);
    border-radius: 4px;
    padding: 0.18rem 0.48rem;
    margin-top: 0.18rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.sr-landed-label {
    font-size: 0.52rem;
    font-weight: 700;
    color: var(--success);
    letter-spacing: 0.03em;
    text-transform: uppercase;
}

.sr-landed-val {
    font-size: 0.72rem;
    font-weight: 800;
    color: var(--success);
}

.sales-rate-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.6rem;
    min-height: 200px;
    padding: 2rem;
    border: 1.5px dashed var(--border-strong);
    border-radius: var(--radius-lg);
    background: var(--bg-subtle);
    color: var(--text-muted);
    text-align: center;
    font-size: 0.875rem;
}

.sales-rate-empty::before {
    content: '\f002';
    display: grid;
    place-items: center;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--bg-sunken);
    color: var(--text-faint);
    font-family: 'Font Awesome 6 Free';
    font-weight: 900;
    font-size: 0.95rem;
}

/* ==== Quotations ==== */
.quotation-status {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.35rem;
    padding: 0.22rem 0.65rem;
    border: 1px solid transparent;
    border-radius: var(--radius-pill);
    font-size: 0.75rem;
    font-weight: 600;
    white-space: nowrap;
    line-height: 1.25;
    min-height: 24px;
    box-sizing: border-box;
}

.quotation-status i {
    font-size: 0.68rem;
    flex-shrink: 0;
}

.quotation-status.draft {
    background: var(--status-gray);
    color: var(--status-gray-text);
    border-color: var(--status-gray-border);
}

.quotation-status.submitted {
    background: var(--status-yellow);
    color: var(--status-yellow-text);
    border-color: var(--status-yellow-border);
}

.quotation-status.approved {
    background: var(--status-green);
    color: var(--status-green-text);
    border-color: var(--status-green-border);
}

.quotation-status.rejected {
    background: var(--status-red);
    color: var(--status-red-text);
    border-color: var(--status-red-border);
}

.quotation-margin {
    display: block;
    margin-top: 0.15rem;
    color: var(--status-green-text);
    font-size: 0.745rem;
    font-weight: 600;
}

.quotation-margin.negative {
    color: var(--status-red-text);
}

.quotation-field-hint {
    color: var(--text-faint);
    font-weight: 500;
    font-size: 0.74rem;
}

#quotation-rate-summary {
    background: var(--surface-2);
    border: 1px solid var(--line);
    border-radius: 10px;
    padding: 0.45rem 0.85rem;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    margin-bottom: 0.25rem;
}

.qcreate-summary-header {
    display: flex;
    align-items: center;
    justify-content: flex-start;
}

.qcreate-summary-route {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--ink);
}

.qcreate-summary-details {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.5rem;
    font-size: 0.78rem;
    color: var(--muted);
}

.qcreate-summary-details i {
    color: var(--brand-ink);
    margin-right: 0.2rem;
}

.qcreate-dot {
    color: var(--faint);
}

.qcreate-min-rate {
    color: var(--muted);
}

.qcreate-min-rate strong {
    color: var(--ink);
    font-weight: 700;
}

.quotation-calc-preview {
    margin-top: 0;
    padding: 0.4rem 0.75rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background: var(--surface-2);
    display: grid;
    gap: 0.2rem;
}

.quotation-calc-row {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 0.6rem;
    color: var(--text-body);
    font-size: 0.78rem;
    line-height: 1.35;
}

.quotation-calc-row strong {
    color: var(--text-dark);
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.quotation-calc-row.total {
    margin-top: 0.15rem;
    padding-top: 0.35rem;
    border-top: 1px dashed var(--border-strong);
    font-weight: 700;
}

.quotation-calc-row.total strong {
    color: var(--status-green-text);
    font-size: 0.95rem;
}

.quotation-calc-warning {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    margin-top: 0.15rem;
    padding: 0.35rem 0.55rem;
    border: 1px solid var(--status-red-border);
    border-radius: var(--radius-sm);
    background: var(--status-red-bg);
    color: var(--status-red-text);
    font-size: 0.74rem;
    font-weight: 600;
}

.quotation-decision-amounts {
    display: flex;
    flex-wrap: wrap;
    gap: 1.5rem;
    margin-top: 0.65rem;
    padding-top: 0.65rem;
    border-top: 1px dashed var(--border-strong);
}

.quotation-decision-amounts span {
    display: block;
    color: var(--text-muted);
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.quotation-decision-amounts strong {
    display: block;
    margin-top: 0.15rem;
    color: var(--text-dark);
    font-size: 1rem;
    font-variant-numeric: tabular-nums;
}

.quotation-decision-amounts strong.negative {
    color: var(--status-red-text);
}

/* Quotation document preview (Exact Reference Match) */
#quotation-view-modal .modal-content {
    width: 780px !important;
    max-width: 95vw !important;
    border-radius: 14px !important;
    overflow: hidden !important;
    box-shadow: 0 20px 40px -15px rgba(15, 23, 42, 0.4) !important;
}

#quotation-view-modal .modal-header {
    background: var(--brand-hover) !important;
    padding: 0.85rem 1.25rem !important;
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
}

#quotation-view-modal .modal-heading-icon {
    display: none !important;
}

#quotation-view-modal .modal-header h3 {
    color: var(--on-brand) !important;
    font-size: 1.05rem !important;
    font-weight: 700 !important;
    display: flex !important;
    align-items: center !important;
    gap: 0.6rem !important;
    letter-spacing: 0.01em !important;
}

#quotation-view-modal .modal-body {
    padding: 1rem 1.25rem 0.85rem !important;
    background: var(--surface) !important;
    display: flex;
    flex-direction: column;
    overflow-y: auto !important;
    max-height: calc(92vh - 85px) !important;
}

#quotation-view-modal .modal-footer {
    padding: 0.65rem 1.25rem !important;
    background: var(--surface) !important;
    border-top: 1px solid var(--line) !important;
    display: flex !important;
    justify-content: flex-end !important;
}

.qd-document {
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
}

/* Header: Logo & Meta */
.qd-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: 0.25rem;
}

.qd-logo-box {
    display: flex;
    align-items: center;
    gap: 0.85rem;
}

.qd-logo-img {
    height: 38px;
    object-fit: contain;
}

.qd-logo-divider {
    width: 1px;
    height: 32px;
    background: var(--line);
}

.qd-header-meta {
    text-align: right;
}

.qd-header-title {
    font-size: 1.05rem;
    font-weight: 800;
    color: var(--ink);
    letter-spacing: -0.01em;
}

.qd-header-sub {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 0.45rem;
    margin-top: 0.2rem;
}

.qd-status-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.2rem 0.6rem;
    border-radius: 9999px;
    font-size: 0.72rem;
    font-weight: 700;
}

.qd-status-badge.status-pending {
    background: color-mix(in srgb, var(--warning) 25%, var(--surface));
    color: var(--warning);
    border: 1px solid color-mix(in srgb, var(--warning) 35%, var(--surface));
}

.qd-status-badge.status-approved {
    background: var(--success-soft);
    color: var(--success);
    border: 1px solid color-mix(in srgb, var(--success) 35%, var(--surface));
}

.qd-status-badge.status-rejected {
    background: var(--danger-soft);
    color: var(--danger);
    border: 1px solid color-mix(in srgb, var(--danger) 35%, var(--surface));
}

.qd-status-badge.status-draft {
    background: var(--surface-2);
    color: var(--muted);
    border: 1px solid var(--line);
}

.qd-meta-dot {
    color: var(--faint);
    font-size: 0.8rem;
}

.qd-meta-date {
    font-size: 0.78rem;
    color: var(--muted);
    font-weight: 500;
}

/* 3x4 Info Card Grid */
.qd-info-card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 12px;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    overflow: hidden;
}

.qd-grid-item {
    padding: 0.65rem 0.85rem;
    display: flex;
    align-items: center;
    gap: 0.65rem;
    border-right: 1px solid var(--line);
    border-bottom: 1px solid var(--line);
    min-width: 0;
}

.qd-grid-item:nth-child(3n) {
    border-right: none;
}

.qd-grid-item:nth-last-child(-n+3) {
    border-bottom: none;
}

.qd-icon-box {
    width: 24px;
    height: 24px;
    background: transparent;
    border-radius: 0;
    color: var(--brand-ink);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    flex-shrink: 0;
}

.qd-content {
    display: flex;
    flex-direction: column;
    min-width: 0;
    overflow: hidden;
}

.qd-label {
    font-size: 0.68rem;
    font-weight: 700;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.qd-value {
    font-size: 0.82rem;
    font-weight: 500;
    color: var(--ink);
    margin-top: 0.12rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Final Highlight Box (Green card in bottom right) */
.qd-grid-item.qd-highlight-box {
    background: var(--success-soft);
    border: 1.5px solid var(--success);
    border-radius: 10px;
    margin: 4px;
    padding: 0.45rem 0.75rem;
}

.qd-icon-box.green {
    background: transparent;
    color: var(--success);
    font-size: 1.2rem;
}

.qd-label.green {
    color: var(--success);
}

.qd-value.green {
    color: var(--success);
    font-size: 1.05rem;
    font-weight: 800;
}

.qd-remarks-box {
    background: var(--surface-2);
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 0.5rem 0.85rem;
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
}

/* Cost Breakdown Card */
.qd-cost-breakdown-card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 0.75rem 1.15rem;
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.qd-cb-header {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    font-size: 0.74rem;
    font-weight: 700;
    color: var(--brand-ink);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.15rem;
}

.qd-cb-header i {
    color: var(--brand-ink);
    font-size: 0.82rem;
}

.qd-cb-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.qd-cb-label {
    font-size: 0.78rem;
    color: var(--muted);
    font-weight: 500;
}

.qd-cb-label.bold {
    font-weight: 700;
    color: var(--ink);
    font-size: 0.82rem;
}

.qd-cb-value {
    font-size: 0.82rem;
    font-weight: 500;
    color: var(--ink);
}

.qd-cb-divider {
    border-top: 1px dashed var(--line);
    margin: 0.25rem 0;
}

.qd-cb-value.profit {
    color: var(--success);
    font-size: 1.05rem;
    font-weight: 800;
}

.qd-cb-value.profit.loss {
    color: var(--danger);
}

.quote-breakdown-row.total.loss strong {
    color: var(--status-red-text);
}

/* ==== Modals ==== */
.modal {
    position: fixed;
    inset: 0;
    padding: 1.5rem;
    background: rgba(15, 23, 42, 0.72);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    animation: fadeIn 0.16s ease;
    transition: opacity 0.2s ease, visibility 0.2s ease, transform 0.2s ease;
}

/* Stacked Modal Management: When a popup opens over another popup, cleanly hide the underlying popup to remove visual clutter */
.modal.is-stacked-behind {
    opacity: 0 !important;
    visibility: hidden !important;
    pointer-events: none !important;
    transform: scale(0.97) !important;
    transition: opacity 0.2s ease, visibility 0.2s ease, transform 0.2s ease;
}

.modal-content {
    background: var(--bg-surface);
    width: 620px;
    max-width: 100%;
    max-height: calc(100vh - 3rem);
    display: flex;
    flex-direction: column;
    border-radius: var(--radius-xl);
    overflow: hidden;
    box-shadow: 0 25px 60px -10px rgba(15, 23, 42, 0.45), 0 0 0 1px rgba(255, 255, 255, 0.1);
}

.modal-content>form {
    display: contents;
}

.modal-header {
    flex: 0 0 auto;
    padding: 0.35rem 1rem;
    min-height: 36px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.12);
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.75rem;
    background: var(--brand);
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}

.modal-heading {
    min-width: 0;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.modal-heading-icon {
    display: none !important;
}

.modal-header h3 {
    margin: 0;
    color: var(--on-brand) !important;
    font-size: 0.88rem;
    font-weight: 600;
    line-height: 1.2;
}

.modal-subtitle {
    display: none !important;
}

.close-modal {
    width: 26px;
    height: 26px;
    flex: 0 0 26px;
    display: grid;
    place-items: center;
    padding: 0;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.12);
    color: var(--on-brand) !important;
    font-size: 0.8rem;
    cursor: pointer;
    transition: background 0.16s ease, color 0.16s ease;
}

.close-modal:hover {
    background: rgba(255, 255, 255, 0.28);
    color: var(--on-brand) !important;
}


.modal-body {
    flex: 1 1 auto;
    min-height: 0;
    padding: 1.25rem;
    overflow-y: auto;
}

.modal-footer {
    flex: 0 0 auto;
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 0.45rem;
    padding: 0.35rem 0.85rem;
    border-top: 1px solid var(--border);
    background: var(--bg-subtle);
}

.modal-footer .btn {
    min-height: 26px !important;
    height: 28px !important;
    padding: 0.2rem 0.75rem !important;
    font-size: 0.78rem !important;
}

#app-message-modal {
    z-index: 2500 !important;
}

#logout-modal,
#app-message-modal {
    align-items: center !important;
    padding: 1.5rem !important;
}

#logout-modal .modal-content,
#app-message-modal .modal-content {
    width: 420px;
}

#app-message-modal .modal-content {
    border: 1px solid var(--line);
    box-shadow: 0 15px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 8px -5px rgba(0, 0, 0, 0.04);
    border-radius: 12px;
    overflow: hidden;
}

#app-message-modal .modal-header {
    background: var(--surface) !important;
    border-bottom: 1px solid var(--line) !important;
    padding: 0.75rem 1.25rem !important;
}

#app-message-modal .modal-header h3 {
    color: var(--ink) !important;
    font-size: 0.95rem !important;
    font-weight: 650 !important;
}

#app-message-modal .modal-body {
    padding: 1.1rem 1.25rem !important;
    color: var(--ink) !important;
    font-size: 0.85rem !important;
}

#app-message-modal .modal-footer {
    padding: 0.75rem 1.25rem !important;
    border-top: 1px solid var(--line) !important;
    background: var(--surface-2) !important;
}

/* ==== Rate Details Modal (Exact Reference Match) ==== */
#rate-detail-modal {
    z-index: 1200 !important;
}

#rate-detail-modal .modal-content {
    width: 780px !important;
    max-width: 95vw !important;
    border-radius: 14px !important;
    overflow: hidden !important;
    box-shadow: 0 20px 40px -15px rgba(15, 23, 42, 0.4) !important;
}

#rate-detail-modal .modal-header {
    background: var(--brand-hover) !important;
    padding: 0.85rem 1.25rem !important;
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
}

#rate-detail-modal .modal-heading-icon {
    display: none !important;
}

#rate-detail-modal .modal-header h3 {
    color: var(--on-brand) !important;
    font-size: 1.05rem !important;
    font-weight: 700 !important;
    display: flex !important;
    align-items: center !important;
    gap: 0.6rem !important;
    letter-spacing: 0.01em !important;
}

.rd-modal-header-icon {
    width: 26px;
    height: 26px;
    background: rgba(255, 255, 255, 0.15);
    border-radius: 6px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.85rem;
    color: var(--on-brand);
}

.rd-modal-header-bullet {
    color: rgba(255, 255, 255, 0.4);
    font-size: 0.8rem;
    margin: 0 0.2rem;
}

#rate-detail-modal .modal-body {
    padding: 0.95rem 1.2rem 0.8rem !important;
    background: var(--surface) !important;
    display: flex;
    flex-direction: column;
    gap: 0.75rem !important;
    max-height: calc(85vh - 110px) !important;
    overflow-y: auto !important;
}

/* Common Card Box */
.rd-card-box {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 10px;
    overflow: hidden;
    margin-bottom: 2%;
}

.rd-card-header {
    background: var(--surface-2);
    border-bottom: 1px solid var(--line);
    padding: 0.42rem 0.85rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;

}

.rd-header-icon-badge {
    width: 22px;
    height: 22px;
    background: var(--brand);
    color: var(--on-brand);
    border-radius: 6px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.72rem;
    flex-shrink: 0;
}

.rd-header-text {
    font-size: 0.76rem;
    font-weight: 700;
    color: var(--brand-ink);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* Card 1: Route Content */
.rd-hero-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.65rem 1rem;
}

.rd-hero-route {
    font-size: 0.80rem;
    font-weight: 700;
    color: var(--ink);
    display: flex;
    align-items: center;
    gap: 0.55rem;
}

.rd-hero-arrow {
    color: var(--muted);
    font-size: 0.75rem;
}

.rd-hero-badges {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.rd-badge-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.22rem 0.65rem;
    border-radius: 9999px;
    font-size: 0.74rem;
    font-weight: 700;
    background: var(--success-soft);
    color: var(--success);
    border: 1px solid color-mix(in srgb, var(--success) 35%, var(--surface));
}

.rd-badge-pill.inactive {
    background: var(--danger-soft);
    color: var(--danger);
    border: 1px solid color-mix(in srgb, var(--danger) 35%, var(--surface));
}

/* Card 2: Rates & Charges Content */
.rd-rates-content {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    padding: 0.65rem 1rem;
}

.rd-rate-col {
    display: flex;
    flex-direction: column;
}

.rd-rate-col+.rd-rate-col {
    border-left: 1px solid var(--line);
    padding-left: 1rem;
}

.rd-rate-label {
    font-size: 0.68rem;
    font-weight: 700;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    white-space: nowrap;
}

.rd-rate-val {
    font-size: 0.82rem;
    font-weight: 700;
    margin-top: 0.15rem;
    white-space: nowrap;
}

.rd-rate-val.buy {
    color: var(--success);
}

.rd-rate-val.sell {
    color: var(--brand-ink);
}

.rd-rate-val.default {
    color: var(--ink);
}

.rd-rate-val small {
    font-size: 0.68rem;
    font-weight: 600;
    color: var(--muted);
    margin-left: 0.15rem;
}

/* Card 3 & 4: Two-col grid */
.rd-two-col-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
}

.rd-table-rows {
    display: flex;
    flex-direction: column;
}

.rd-table-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.38rem 0.85rem;
    border-bottom: 1px solid var(--line);
}

.rd-table-row:last-child {
    border-bottom: none;
}

.rd-k {
    font-size: 0.72rem;
    color: var(--muted);
    font-weight: 500;
}

.rd-v {
    font-size: 0.74rem;
    color: var(--ink);
    font-weight: 500;
    text-align: right;
}

.rd-valid-days {
    font-size: 0.68rem;
    color: var(--muted);
    font-weight: 600;
}

/* Card 5: Footer Content */
.rd-footer-content {
    display: flex;
    align-items: center;
    padding: 0.55rem 1rem;
}

.rd-footer-col {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.rd-footer-col.flex-2 {
    flex: 1.5;
}

.rd-footer-col+.rd-footer-col {
    border-left: 1px solid var(--line);
    padding-left: 1rem;
}

/* ==== LOGOUT MODAL - EXACT PIXEL-PERFECT DESIGN (15% REDUCED) ==== */
#logout-modal {
    align-items: center !important;
    justify-content: center !important;
    padding: 1rem !important;
}

#logout-modal .modal-content {
    width: 374px !important;
    max-width: 92vw !important;
    border-radius: 14px !important;
    border: 1px solid rgba(0, 0, 0, 0.08) !important;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.12), 0 10px 10px -5px rgba(0, 0, 0, 0.04) !important;
    overflow: hidden !important;
    background: var(--surface) !important;
}

#logout-modal .modal-header {
    background: var(--brand-soft) !important;
    border-bottom: 1px solid var(--brand-line) !important;
    padding: 0.85rem 1.15rem !important;
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
}

#logout-modal .modal-heading {
    display: flex !important;
    align-items: center !important;
    gap: 0.75rem !important;
}

#logout-modal .modal-heading-icon {
    width: 36px !important;
    height: 36px !important;
    min-width: 36px !important;
    background: var(--surface) !important;
    border: 1.5px solid var(--brand-line) !important;
    border-radius: 10px !important;
    color: var(--brand-ink) !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    font-size: 0.95rem !important;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04) !important;
}

#logout-modal .modal-header h3 {
    color: var(--ink) !important;
    font-size: 1rem !important;
    font-weight: 700 !important;
    margin: 0 !important;
    line-height: 1.25 !important;
}

#logout-modal .modal-subtitle {
    color: var(--muted) !important;
    font-size: 0.76rem !important;
    font-weight: 400 !important;
    margin: 0.15rem 0 0 0 !important;
    line-height: 1.2 !important;
}

#logout-modal .close-modal {
    background: transparent !important;
    border: none !important;
    color: var(--muted) !important;
    font-size: 0.95rem !important;
    cursor: pointer !important;
    padding: 0.25rem !important;
    border-radius: 6px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    transition: all 0.15s ease !important;
}

#logout-modal .close-modal:hover {
    background: var(--brand-soft) !important;
    color: var(--ink) !important;
}

#logout-modal .modal-body {
    background: var(--surface) !important;
    padding: 1.15rem 1.15rem 0.95rem 1.15rem !important;
}

#logout-modal .logout-confirmation p {
    color: var(--ink) !important;
    font-size: 0.92rem !important;
    font-weight: 500 !important;
    margin: 0 !important;
    line-height: 1.4 !important;
}

#logout-modal .modal-footer {
    background: var(--surface) !important;
    border-top: 1px solid var(--line) !important;
    padding: 0.65rem 1.15rem 0.85rem 1.15rem !important;
    display: flex !important;
    justify-content: flex-end !important;
    align-items: center !important;
    gap: 0.6rem !important;
}

#logout-modal .modal-footer .btn {
    min-height: 32px !important;
    height: 32px !important;
    font-size: 0.84rem !important;
    border-radius: 6px !important;
}

#logout-modal #logout-cancel-btn {
    background: var(--surface) !important;
    border: 1px solid var(--line-strong) !important;
    color: var(--ink) !important;
    font-weight: 500 !important;
    padding: 0 1rem !important;
    cursor: pointer !important;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04) !important;
    transition: all 0.14s ease !important;
}

#logout-modal #logout-cancel-btn:hover {
    background: var(--surface-2) !important;
    border-color: var(--line-strong) !important;
    color: var(--ink) !important;
}

#logout-modal #logout-submit-btn {
    background: var(--danger) !important;
    border: 1px solid var(--danger) !important;
    color: var(--on-brand) !important;
    font-weight: 600 !important;
    padding: 0 1.1rem !important;
    cursor: pointer !important;
    box-shadow: 0 1px 3px color-mix(in srgb, var(--danger) 25%, transparent) !important;
    transition: all 0.14s ease !important;
}

#logout-modal #logout-submit-btn:hover {
    background: var(--danger) !important;
    border-color: var(--danger) !important;
}

#login-submit-btn:hover {
    background-color: var(--brand) !important;
    border-color: var(--brand) !important;
}

/* Rate Create Choice Modal */
#rate-create-choice-modal .modal-content {
    width: 480px;
}

#rate-create-choice-modal .modal-body {
    padding: 1.25rem 1.25rem 0.85rem !important;
}

#rate-create-choice-modal .modal-footer {
    padding: 0.35rem 1rem !important;
}

/* Choice Cards Grid */
.create-choice-grid {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.choice-card {
    display: flex;
    align-items: center;
    gap: 1.15rem;
    padding: 1.15rem 1.35rem;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: var(--surface) !important;
    cursor: pointer;
    text-align: left;
    transition: all 0.22s cubic-bezier(0.4, 0, 0.2, 1);
    width: 100%;
}

.choice-card:hover {
    background: var(--surface-2) !important;
    border-color: var(--brand) !important;
    transform: translateY(-2px) !important;
    box-shadow: 0 8px 24px -4px color-mix(in srgb, var(--brand) 15%, transparent) !important;
}

.choice-icon {
    width: 36px !important;
    height: 36px !important;
    flex: 0 0 36px !important;
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
    color: var(--faint) !important;
    display: grid !important;
    place-items: center !important;
    font-size: 1.5rem !important;
    transition: transform 0.2s ease, color 0.2s ease !important;
}

.choice-card:hover .choice-icon {
    color: var(--ink) !important;
    transform: scale(1.08) !important;
}

.choice-info strong {
    display: block;
    color: var(--ink) !important;
    font-size: 0.98rem;
    font-weight: 700;
}

.choice-info span {
    display: block;
    margin-top: 0.2rem;
    color: var(--muted) !important;
    font-size: 0.81rem;
}

.choice-arrow {
    margin-left: auto;
    color: var(--brand-ink) !important;
    font-size: 0.9rem;
    transition: transform 0.2s ease;
}

.choice-card:hover .choice-arrow {
    transform: translateX(4px);
}

#rate-csv-modal .modal-content {
    width: 620px;
}

/* CSV Template Download Button - Matching App Navy Theme */
#rate-csv-template-btn {
    display: inline-flex !important;
    align-items: center !important;
    gap: 0.5rem !important;
    padding: 0.4rem 0.85rem !important;
    background: var(--surface) !important;
    border: 1px solid var(--line-strong) !important;
    color: var(--brand-ink) !important;
    font-size: 0.82rem !important;
    font-weight: 600 !important;
    border-radius: 8px !important;
    cursor: pointer !important;
    transition: all 0.16s ease !important;
    margin-bottom: 0.85rem !important;
}

#rate-csv-template-btn i {
    color: var(--brand-ink) !important;
    font-size: 0.9rem !important;
    transition: color 0.16s ease !important;
}

#rate-csv-template-btn:hover {
    background: var(--surface-2) !important;
    border-color: var(--brand) !important;
    color: var(--brand-ink) !important;
    box-shadow: 0 2px 8px color-mix(in srgb, var(--brand) 10%, transparent) !important;
}

#rate-csv-template-btn:hover i {
    color: var(--brand-ink) !important;
}

/* Rate Create Choice Modal */
.create-choice-grid {
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
    padding: 0.25rem 0;
}

.choice-card {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1.1rem 1.25rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    background: var(--bg-surface);
    cursor: pointer;
    text-align: left;
    transition: background-color 0.16s ease, border-color 0.16s ease, transform 0.16s ease, box-shadow 0.16s ease;
    width: 100%;
}

.choice-card:hover {
    background: var(--primary-soft);
    border-color: var(--primary-soft-border);
    transform: translateY(-1px);
    box-shadow: var(--shadow-sm);
}

.choice-icon {
    width: 36px;
    height: 36px;
    flex: 0 0 36px;
    background: transparent !important;
    border: none !important;
    color: var(--ink) !important;
    display: grid;
    place-items: center;
    font-size: 1.35rem;
    transition: color 0.16s ease, transform 0.16s ease;
}

.choice-card:hover .choice-icon {
    background: transparent !important;
    border: none !important;
    color: var(--brand-ink) !important;
    transform: scale(1.08);
}

.choice-info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
}

.choice-info strong {
    color: var(--text-dark);
    font-size: 0.95rem;
    font-weight: 650;
}

.choice-info span {
    color: var(--text-muted);
    font-size: 0.825rem;
    line-height: 1.35;
}

.choice-arrow {
    color: var(--text-faint);
    font-size: 0.85rem;
    transition: color 0.16s ease, transform 0.16s ease;
}

.choice-card:hover .choice-arrow {
    color: var(--primary);
    transform: translateX(3px);
}

#rate-edit-modal .modal-content {
    width: 900px;
}

#quotation-create-modal .modal-content {
    width: min(1080px, 95vw) !important;
    max-width: 1080px !important;
    max-height: 90vh !important;
    display: flex !important;
    flex-direction: column !important;
    overflow: hidden !important;
    border-radius: 10px;
}

#quotation-create-modal .modal-header {
    background: var(--brand);
    padding: 0.35rem 1rem;
    min-height: 36px;
    flex: 0 0 auto;
}

#quotation-create-modal .modal-header h3 {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    font-size: 0.92rem;
    font-weight: 700;
    color: var(--on-brand) !important;
}

#quotation-create-modal .modal-body.qc-modal-body {
    flex: 1 1 auto !important;
    min-height: 0 !important;
    overflow-y: hidden !important;
    overflow-x: hidden !important;
    padding: 0.55rem 0.85rem !important;
    background: var(--surface-2) !important;
}

#quotation-view-modal .modal-content {
    width: min(880px, 95vw) !important;
    max-width: 880px !important;
    max-height: 92vh !important;
    display: flex !important;
    flex-direction: column !important;
    overflow: hidden !important;
}

#quotation-view-modal .modal-body {
    flex: 1 1 auto !important;
    min-height: 0 !important;
    max-height: calc(92vh - 85px) !important;
    overflow-y: auto !important;
    padding: 0.6rem 0.85rem !important;
}

#rate-edit-modal .modal-content {
    width: 960px;
}

#rate-edit-modal .modal-body {
    max-height: calc(85vh - 110px) !important;
    overflow-y: auto !important;
    padding: 0.85rem 1.25rem !important;
}

#quotation-decision-modal .modal-content {
    width: 560px;
}

#rate-detail-modal .modal-content {
    width: 760px;
}

#rate-value-modal .modal-content {
    width: 560px;
}

#profile-modal .modal-content {
    width: min(var(--login-details-width, 420px), 100%);
}

#user-profile-modal .modal-content {
    width: min(var(--user-profile-width, 420px), 100%);
}

.logout-confirmation {
    color: var(--text-body);
    line-height: 1.6;
}

.logout-confirmation p {
    margin: 0;
}

/* ==== Account blocked, Settings ==== */
/* account.js and settings.js build <dialog class="atom-account modal"> / <dialog class="atom-settings modal"> (shown with showModal):
   the page's .modal overlay rules stay off them; their head is the shared one (.modal-header > div > h2 + p, .modal-close) in the Pulse shell section */
dialog.atom-account.modal,
dialog.atom-settings.modal {
    display: block;
    background: var(--surface);
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    animation: none;
}

dialog.atom-account.modal:not([open]),
dialog.atom-settings.modal:not([open]) {
    display: none;
}

/* Login form */
.auth-form {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.auth-form .modal-footer {
    margin: 0.35rem -1.25rem -1.25rem;
}

.auth-message {
    font-size: 0.84rem;
    line-height: 1.45;
    color: var(--text-muted);
}

.auth-message:empty {
    display: none;
    min-height: 0;
    margin: 0;
}

.auth-message.is-error {
    color: var(--status-red-text);
}

.auth-message.is-success {
    color: var(--status-green-text);
}

.input-icon-wrap {
    position: relative;
    display: flex;
    align-items: center;
    width: 100%;
}

.input-icon-wrap .input-icon {
    position: absolute;
    left: 0.75rem;
    color: var(--text-faint);
    font-size: 0.85rem;
    pointer-events: none;
    z-index: 2;
}

.input-icon-wrap input {
    width: 100%;
    min-height: 42px;
    padding: 0.6rem 0.75rem 0.6rem 2.25rem;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-md);
    background-color: var(--bg-surface);
    font: inherit;
    font-size: 0.9rem;
    color: var(--text-dark);
    outline: none;
    transition: border-color 0.16s ease, box-shadow 0.16s ease;
}

.input-icon-wrap input:focus {
    border-color: var(--primary);
    box-shadow: var(--ring);
}

.input-icon-wrap input:-webkit-autofill,
.input-icon-wrap input:-webkit-autofill:hover,
.input-icon-wrap input:-webkit-autofill:focus,
.form-field input:-webkit-autofill {
    -webkit-box-shadow: 0 0 0 1000px var(--surface) inset !important;
    -webkit-text-fill-color: var(--text-dark) !important;
    transition: background-color 5000s ease-in-out 0s;
}

.password-input-wrap input {
    padding-right: 2.85rem;
}

.password-toggle {
    position: absolute;
    right: 0.35rem;
    width: 32px;
    height: 32px;
    display: grid;
    place-items: center;
    border: 0;
    border-radius: var(--radius-sm);
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    z-index: 3;
}

.password-toggle:hover {
    background: var(--bg-sunken);
    color: var(--text-dark);
}

/* Profile detail rows */
.profile-grid {
    display: grid;
    gap: 0.15rem;
}

.profile-row {
    display: grid;
    grid-template-columns: 110px minmax(0, 1fr);
    gap: 1rem;
    padding: 0.7rem 0;
    border-bottom: 1px solid var(--border);
}

.profile-row:last-child {
    border-bottom: none;
}

.profile-row span {
    color: var(--text-muted);
    font-size: 0.85rem;
}

.profile-row strong {
    min-width: 0;
    color: var(--text-dark);
    overflow-wrap: anywhere;
}

.profile-status {
    color: var(--text-muted);
    font-size: 0.85rem;
    line-height: 1.5;
}

/* Rate create/edit form grid */
.rate-edit-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 0.55rem 0.85rem;
}

.rate-edit-grid .wide {
    grid-column: 1 / -1;
}

.rate-edit-grid .form-field label {
    margin-bottom: 0.2rem;
    font-size: 0.74rem;
    font-weight: 600 !important;
    color: var(--ink) !important;
    justify-content: flex-start;
    text-align: left;
}

.req-star {
    color: var(--danger) !important;
    font-weight: 700;
    margin-left: 2px;
}

.rate-edit-grid input,
.rate-edit-grid select,
.rate-edit-grid textarea {
    width: 100%;
    min-height: 34px;
    height: 34px;
    padding: 0.3rem 0.65rem;
    border: 1px solid var(--line-strong);
    border-radius: var(--radius-md);
    background-color: var(--bg-surface);
    color: var(--text-dark);
    font: inherit;
    font-size: 0.82rem;
    outline: none;
    transition: border-color 0.16s ease, box-shadow 0.16s ease;
}

.rate-edit-grid select {
    padding-right: 2.1rem;
}

.rate-edit-grid textarea {
    height: auto;
    min-height: 56px;
    resize: vertical;
}

.rate-edit-grid input:hover:not(:focus),
.rate-edit-grid select:hover:not(:focus),
.rate-edit-grid textarea:hover:not(:focus) {
    border-color: var(--text-faint);
}

.rate-edit-grid input:focus,
.rate-edit-grid select:focus,
.rate-edit-grid textarea:focus {
    border-color: var(--primary);
    box-shadow: var(--ring);
}

/* ==== Responsive components ==== */
@media (max-width: 1200px) {

    .filter-field.w-md,
    .filter-field.w-lg {
        flex: 1 1 140px;
    }
}

@media (max-width: 1000px) {
    .sales-rate-actions {
        margin-left: 0;
        flex: 1 1 100%;
        justify-content: flex-end;
    }

    /* Below this width Apply/Clear drop to their own full-width row instead of
       staying pinned beside the wrapped fields — there isn't room for both. */
    .filter-row {
        flex-wrap: wrap;
    }

    .filter-actions {
        flex: 1 1 100%;
        justify-content: flex-end;
    }

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

    .sales-rate-result-card {
        grid-template-columns: minmax(0, 1fr);
        grid-template-areas: 'info' 'price' 'action';
    }

    .sales-rate-price {
        justify-content: space-between;
    }

    .quote-create-btn {
        justify-self: stretch;
    }
}

@media (max-width: 760px) {

    .po-toolbar,
    .filter-bar,
    .sales-rate-filters,
    .sales-rate-results {
        padding-left: 1rem;
        padding-right: 1rem;
    }

    .rate-table-toolbar {
        padding-left: 1rem;
        padding-right: 1rem;
    }

    /* Full-width label so the fields below it line up in an even two-up grid */
    .filter-label {
        flex: 1 1 100%;
    }

    .filter-field,
    .filter-field.w-sm,
    .filter-field.w-md,
    .filter-field.w-lg {
        flex: 1 1 calc(50% - 0.25rem);
    }

    .filter-toggle {
        flex: 1 1 calc(50% - 0.25rem);
        justify-content: center;
    }

    .rate-toolbar-actions,
    .rate-toolbar-actions .btn {
        flex: 1 1 auto;
    }

    .sales-route-pair {
        grid-template-columns: minmax(0, 1fr);
        gap: 0.5rem;
    }

    .sales-route-swap-btn {
        margin: 0 auto;
        justify-self: center;
    }

    .sales-rate-field.mode,
    .sales-rate-field.charge-unit,
    .sales-rate-field.commodity,
    .sales-rate-field.carrier,
    .sales-rate-field.created-by {
        flex: 1 1 100%;
    }

    .rate-edit-grid,
    .quote-doc-grid {
        grid-template-columns: minmax(0, 1fr);
    }

    .rate-edit-grid .wide {
        grid-column: auto;
    }

    .modal {
        padding: 0.75rem;
        align-items: flex-end;
    }

    .modal-content {
        max-height: calc(100dvh - 1.5rem);
    }

    .modal-header,
    .modal-body,
    .modal-footer {
        padding-left: 1rem;
        padding-right: 1rem;
    }

    .auth-form .modal-footer {
        margin: 0.35rem -1rem -1rem;
    }

    .modal-footer {
        flex-wrap: wrap;
    }

    .modal-footer .btn {
        flex: 1 1 auto;
    }

    .profile-row {
        grid-template-columns: 88px minmax(0, 1fr);
    }

    .quote-doc-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }

    .quote-doc-title {
        text-align: left;
    }
}

/* ==== Top Bar Sync Header Button ==== */
.header-sync-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.4rem 0.95rem;
    border-radius: 9999px;
    border: 1px solid var(--line-strong);
    background: var(--surface);
    color: var(--ink);
    font-size: 0.88rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s ease;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
}

body.logged-in .header-sync-btn {
    display: inline-flex !important;
}

body.logged-out .header-sync-btn {
    display: none !important;
}

.header-sync-btn:hover {
    border-color: var(--line-strong);
    background: var(--surface-2);
    color: var(--ink);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.06);
}

.header-sync-btn i {
    color: var(--ink);
    font-size: 0.9rem;
    transition: transform 0.3s ease;
}

.header-sync-btn:hover i {
    transform: rotate(90deg);
}

.data-table th,
.data-table th *,
.data-table th span,
.data-table th i,
.data-table th button,
.data-table th a,
.th-sort,
.th-sort * {
    color: var(--ink) !important;
}

/* ==== Universal Top Navigation Header Styling ==== */
.header-brand {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding-right: 1.25rem;
    border-right: 1px solid var(--line);
    margin-right: 0.5rem;
}

.header-brand-logo {
    height: 24px;
    width: auto;
    object-fit: contain;
}

.header-brand-title {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--brand-ink) !important;
    letter-spacing: -0.02em;
}

.top-nav-menu {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    height: 100%;
}

body.logged-in .header-brand {
    display: flex !important;
}

body.logged-in .top-nav-menu {
    display: flex !important;
}

.top-nav-item[hidden] {
    display: none !important;
}

.top-nav-item {
    display: inline-flex !important;
    align-items: center;
    gap: 0.55rem;
    padding: 0.65rem 1.1rem;
    color: var(--muted);
    font-size: 0.88rem;
    font-weight: 500;
    text-decoration: none;
    position: relative;
    border-radius: 6px;
    border: none !important;
    background: transparent !important;
    box-shadow: none !important;
    transition: all 0.15s ease;
    cursor: pointer;
}

.top-nav-item::before,
.top-nav-item.active::before {
    display: none !important;
    content: none !important;
}

.top-nav-item i {
    font-size: 0.95rem;
    color: var(--muted);
    transition: color 0.15s ease;
}

.top-nav-item:hover {
    color: var(--ink);
    background: var(--surface-2) !important;
}

.top-nav-item:hover i {
    color: var(--ink);
}

.top-nav-item.active {
    color: var(--brand-ink) !important;
    font-weight: 600;
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
}

.top-nav-item.active i {
    color: var(--brand-ink) !important;
}

.top-nav-item.active::after {
    content: '';
    position: absolute;
    bottom: -1px;
    left: 0.5rem;
    right: 0.5rem;
    height: 2.5px;
    background: var(--brand);
    border-radius: 3px 3px 0 0;
}

/* Multi-Rate Quotation Modal & Document Styles */
.quotation-create-modal-content {
    max-width: 1080px !important;
    width: min(1080px, 95vw) !important;
}

/* 2-Column Modal Layout */
.qc-layout-grid {
    display: grid;
    grid-template-columns: 1fr 310px;
    gap: 0.75rem;
    align-items: start;
}

@media (max-width: 960px) {
    .qc-layout-grid {
        grid-template-columns: 1fr;
    }
}

.qc-main-col {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    min-width: 0;
}

.qc-sidebar-col {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

/* Card Containers */
.qc-card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 0.55rem 0.85rem;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.03);
}

.qc-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.35rem;
    padding-bottom: 0.25rem;
    border-bottom: 1px solid var(--line);
}

.qc-section-title {
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--brand-ink);
    display: flex;
    align-items: center;
    gap: 0.45rem;
    margin: 0;
}

.qc-section-title i {
    color: var(--brand-ink);
    font-size: 0.88rem;
}

.qc-section-hint {
    font-size: 0.73rem;
    color: var(--muted);
    font-weight: 500;
}

/* 1. Customer Details Grid */
.qc-customer-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.65rem;
}

@media (max-width: 680px) {
    .qc-customer-grid {
        grid-template-columns: 1fr;
    }
}

.qc-customer-grid .form-field {
    margin-bottom: 0;
    display: flex;
    flex-direction: column;
}

.qc-customer-grid .form-field label {
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--ink);
    margin-bottom: 0.15rem;
}

.qc-customer-grid .form-field input {
    height: 28px;
    padding: 0.2rem 0.5rem;
    border: 1px solid var(--line-strong);
    border-radius: 5px;
    font-size: 0.8rem;
    width: 100%;
    box-sizing: border-box;
    background: var(--surface);
    color: var(--ink);
    transition: border-color 0.15s, box-shadow 0.15s;
}

.qc-customer-grid .form-field input:focus {
    border-color: var(--brand);
    box-shadow: 0 0 0 2px color-mix(in srgb, var(--brand) 12%, transparent);
    outline: none;
}

/* 2. Freight Rates List & Cards */
.qc-rates-list {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    max-height: 185px;
    overflow-y: auto !important;
    padding-right: 0.3rem;
}

/* Freight Rate Card (Ultra-compact ~75px height, 50% reduced with precision alignment) */
.qc-rate-card {
    background: var(--surface);
    border: 1px solid var(--line-strong);
    border-radius: 6px;
    padding: 0.35rem 0.6rem;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.02);
    transition: border-color 0.15s ease;
    display: flex;
    flex-direction: column;
    gap: 0.22rem;
}

.qc-rate-card:hover {
    border-color: var(--line-strong);
}

.qc-rate-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-bottom: 0.18rem;
    border-bottom: 1px solid var(--line);
    gap: 0.5rem;
}

.qc-route-tag {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    flex-wrap: nowrap;
    min-width: 0;
}

.qc-mode-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    font-size: 0.64rem;
    font-weight: 700;
    text-transform: uppercase;
    padding: 0.08rem 0.35rem;
    border-radius: 4px;
    background: var(--brand-soft);
    color: var(--brand-ink);
    border: 1px solid var(--brand-line);
    line-height: 1.2;
    flex-shrink: 0;
}

.qc-mode-badge.sea {
    background: var(--brand-soft);
    color: var(--brand-ink);
    border-color: var(--brand-line);
}

.qc-mode-badge.air {
    background: var(--success-soft);
    color: var(--success);
    border-color: color-mix(in srgb, var(--success) 35%, var(--surface));
}

.qc-route-text {
    font-size: 0.82rem;
    font-weight: 800;
    color: var(--ink);
    letter-spacing: -0.01em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.qc-carrier-text {
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--muted);
    text-transform: uppercase;
    white-space: nowrap;
    flex-shrink: 0;
}

.qc-unit-badge {
    font-size: 0.64rem;
    font-weight: 600;
    background: var(--surface-2);
    color: var(--muted);
    padding: 0.06rem 0.3rem;
    border-radius: 4px;
    border: 1px solid var(--line);
    line-height: 1.2;
    flex-shrink: 0;
}

.qc-card-top-actions {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    flex-shrink: 0;
}

.qc-item-total-box {
    background: var(--brand-soft);
    border: 1px solid var(--brand-line);
    border-radius: 4px;
    padding: 0.12rem 0.5rem;
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    line-height: 1;
}

.qc-item-total-lbl {
    font-size: 0.62rem;
    font-weight: 700;
    color: var(--brand-ink);
    text-transform: uppercase;
    letter-spacing: 0.03em;
    white-space: nowrap;
}

.qc-item-total-val {
    font-size: 0.86rem;
    font-weight: 800;
    color: var(--ink);
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.qc-view-rate-btn {
    background: transparent;
    border: 1px solid transparent;
    color: var(--muted);
    cursor: pointer;
    font-size: 0.84rem;
    padding: 0.12rem 0.32rem;
    border-radius: 4px;
    transition: all 0.15s ease;
    line-height: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.qc-view-rate-btn:hover {
    color: var(--brand-ink);
    background: var(--brand-soft);
    border-color: var(--brand-line);
}

.qc-remove-rate-btn {
    background: transparent;
    border: 1px solid transparent;
    color: var(--faint);
    cursor: pointer;
    font-size: 0.8rem;
    padding: 0.12rem 0.28rem;
    border-radius: 4px;
    transition: all 0.15s ease;
    line-height: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.qc-remove-rate-btn:hover {
    color: var(--danger);
    background: var(--danger-soft);
    border-color: color-mix(in srgb, var(--danger) 35%, var(--surface));
}

/* Rate Inputs Row (Only Top Necessary Details) */
.qc-rate-row-inputs {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    flex-wrap: nowrap;
    min-height: 26px;
}

.qc-rate-pricing-meta {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.69rem;
    color: var(--muted);
    line-height: 1;
    white-space: nowrap;
    min-width: 0;
    flex-shrink: 0;
}

.qc-meta-item {
    display: inline-flex;
    align-items: center;
    gap: 0.22rem;
    white-space: nowrap;
}

.qc-meta-lbl {
    font-weight: 500;
    color: var(--muted);
}

.qc-meta-val {
    color: var(--ink);
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}

.qc-pipe-sep {
    color: var(--faint);
    font-size: 0.65rem;
    user-select: none;
    margin: 0 0.08rem;
}

.qc-min-item {
    display: inline-flex;
    align-items: center;
    gap: 0.22rem;
    white-space: nowrap;
}

.qc-min-lbl {
    font-weight: 500;
    color: var(--muted);
}

.qc-min-val {
    color: var(--success);
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}

.qc-min-unit {
    color: var(--muted);
    font-weight: 500;
}

.qc-rate-inputs-group {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    margin-left: auto;
    flex-shrink: 0;
}

.qc-rate-inputs-group .qc-input-group {
    display: flex;
    align-items: center;
    gap: 0.28rem;
    flex-shrink: 0;
}

.qc-inline-label {
    display: inline-flex;
    align-items: center;
    gap: 0.18rem;
    font-size: 0.71rem;
    font-weight: 600;
    color: var(--ink);
    white-space: nowrap;
    margin: 0;
}

.qc-inline-label .sales-required-icon {
    display: inline-flex;
    align-items: center;
    font-size: 0.48rem;
    color: var(--danger);
    margin-left: 0.1rem;
}

.qc-rate-units-input {
    height: 24px;
    width: 48px;
    padding: 0 0.3rem;
    font-size: 0.8rem;
    font-weight: 700;
    border: 1px solid var(--line-strong);
    border-radius: 4px;
    background: var(--surface);
    color: var(--ink);
    text-align: center;
    box-sizing: border-box;
    font-variant-numeric: tabular-nums;
    -moz-appearance: textfield;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.qc-rate-units-input::-webkit-outer-spin-button,
.qc-rate-units-input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.qc-rate-units-input:focus {
    border-color: var(--brand);
    box-shadow: 0 0 0 2px color-mix(in srgb, var(--brand) 12%, transparent);
    outline: none;
}

/* Integrated Currency Suffix Input Group: [ 2200 | USD ] */
.qc-rate-input-wrap {
    display: inline-flex;
    align-items: center;
    height: 24px;
    border: 1px solid var(--line-strong);
    border-radius: 4px;
    background: var(--surface);
    overflow: hidden;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
    box-sizing: border-box;
}

.qc-rate-input-wrap:focus-within {
    border-color: var(--brand);
    box-shadow: 0 0 0 2px color-mix(in srgb, var(--brand) 12%, transparent);
}

.qc-rate-quoted-input {
    height: 100%;
    width: 68px;
    padding: 0 0.45rem;
    font-size: 0.8rem;
    font-weight: 700;
    border: none !important;
    background: transparent !important;
    color: var(--ink);
    box-sizing: border-box;
    text-align: right;
    outline: none !important;
    box-shadow: none !important;
    font-variant-numeric: tabular-nums;
    -moz-appearance: textfield;
}

.qc-rate-quoted-input::-webkit-outer-spin-button,
.qc-rate-quoted-input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.qc-curr-suffix {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0 0.42rem;
    height: 100%;
    background: var(--surface-2);
    border-left: 1px solid var(--line);
    font-size: 0.67rem;
    font-weight: 700;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.03em;
    user-select: none;
    white-space: nowrap;
}

@media (max-width: 768px) {
    .qc-rate-row-inputs {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.3rem;
    }
    .qc-rate-inputs-group {
        margin-left: 0;
        width: 100%;
        justify-content: space-between;
    }
}


/* 3. Sales Remarks Card */
.qc-remarks-card {
    padding: 0.5rem 0.85rem;
}

.qc-remarks-card .qc-card-header {
    margin-bottom: 0.2rem;
    border-bottom: none;
    padding-bottom: 0;
}

.qc-remarks-field textarea {
    width: 100%;
    min-height: 36px;
    height: 36px;
    padding: 0.3rem 0.55rem;
    border: 1px solid var(--line-strong);
    border-radius: 5px;
    font-size: 0.8rem;
    resize: none;
    box-sizing: border-box;
    background: var(--surface);
    color: var(--ink);
}

.qc-remarks-field textarea:focus {
    border-color: var(--brand);
    box-shadow: 0 0 0 2px color-mix(in srgb, var(--brand) 12%, transparent);
    outline: none;
}

/* Right Column: Quotation Summary Card */
.qc-summary-card {
    padding: 0.65rem 0.85rem;
}

.qc-summary-header {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    font-size: 0.94rem;
    font-weight: 700;
    color: var(--success);
    margin-bottom: 0.45rem;
}

.qc-summary-header i {
    font-size: 0.95rem;
    color: var(--success);
}

.qc-summary-breakdown {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
}

.qc-summary-row {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 0.45rem;
    font-size: 0.78rem;
    color: var(--muted);
    padding: 0.1rem 0;
}

.qc-summary-value {
    color: var(--ink);
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.qc-summary-divider {
    border-top: 1px solid var(--line);
    margin: 0.3rem 0;
}

.qc-grand-total-card {
    background: var(--success-soft);
    border: 1px solid color-mix(in srgb, var(--success) 35%, var(--surface));
    border-radius: 8px;
    padding: 0.5rem 0.75rem;
    text-align: center;
    margin-top: 0.45rem;
}

.qc-grand-total-label {
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--success);
}

.qc-grand-total-value {
    font-size: 1.35rem;
    font-weight: 800;
    color: var(--success);
    margin-top: 0.1rem;
    font-variant-numeric: tabular-nums;
}

/* Right Column: Note Card */
.qc-note-card {
    background: var(--brand-soft);
    border: 1px solid var(--brand-line);
    border-radius: 8px;
    padding: 0.5rem 0.75rem;
}

.qc-note-header {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    color: var(--brand-ink);
    font-weight: 700;
    font-size: 0.78rem;
    margin-bottom: 0.15rem;
}

.qc-note-text {
    font-size: 0.73rem;
    color: var(--ink);
    margin: 0;
    line-height: 1.35;
}

/* Modal Footer Buttons */
.qc-modal-footer {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 0.5rem;
    padding: 0.35rem 1rem;
    background: var(--surface);
    border-top: 1px solid var(--line);
    flex: 0 0 auto;
    min-height: 40px;
}

.qc-btn-cancel {
    padding: 0.3rem 0.95rem;
    font-size: 0.82rem;
    font-weight: 600;
    border-radius: 5px;
    height: 30px;
}

.qc-btn-draft {
    padding: 0.3rem 1.05rem;
    font-size: 0.82rem;
    background: var(--brand-soft) !important;
    color: var(--brand-ink) !important;
    border: 1px solid var(--brand-line) !important;
    border-radius: 5px;
    font-weight: 600;
    height: 30px;
    transition: all 0.15s ease;
}

.qc-btn-draft:hover {
    background: var(--brand-soft) !important;
    color: var(--brand-ink) !important;
}

.qc-btn-submit {
    padding: 0.3rem 1.15rem;
    font-size: 0.82rem;
    background: var(--brand) !important;
    color: var(--on-brand) !important;
    border: none !important;
    border-radius: 5px;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    height: 30px;
    transition: background 0.15s ease;
}

.qc-btn-submit:hover {
    background: var(--brand) !important;
}

/* Multi-Item Quotation Document Table */
.qd-table-wrap {
    margin: 1rem 0;
    border: 1px solid var(--line);
    border-radius: 8px;
    overflow-x: auto;
    background: var(--surface);
}

.qd-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.8rem;
    text-align: left;
}

.qd-table th {
    background: var(--surface-2);
    color: var(--muted);
    font-weight: 700;
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    padding: 0.6rem 0.75rem;
    border-bottom: 1px solid var(--line);
    white-space: nowrap;
}

.qd-table td {
    padding: 0.65rem 0.75rem;
    border-bottom: 1px solid var(--line);
    color: var(--ink);
    vertical-align: middle;
}

.qd-table tr:last-child td {
    border-bottom: none;
}

.qd-table .text-right {
    text-align: right;
}

.qd-table .text-center {
    text-align: center;
}

.qd-table .item-total-cell {
    font-weight: 700;
    color: var(--ink);
}

.qd-view-rate-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    padding: 0;
    border: 1px solid var(--line-strong);
    background: var(--surface);
    color: var(--muted);
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.82rem;
    transition: all 0.15s ease;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
}

.qd-view-rate-btn:hover {
    color: var(--brand-ink);
    background: var(--brand-soft);
    border-color: var(--brand-line);
    box-shadow: 0 2px 5px color-mix(in srgb, var(--brand) 15%, transparent);
    transform: translateY(-1px);
}

.qd-view-rate-btn:active {
    transform: translateY(0);
}

.qd-table th.qd-col-details,
.qd-table td.qd-col-details {
    text-align: center;
    white-space: nowrap;
    width: 56px;
    min-width: 56px;
}

.multi-route-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    background: var(--brand-soft);
    color: var(--brand-ink);
    border: 1px solid var(--brand-line);
    padding: 0.15rem 0.5rem;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 600;
}

/* Profile menu: solid, darker icons */
.profile-menu {
    min-width: 220px;
}

.profile-menu button {
    font-size: 0.9rem;
    padding: 0.6rem 0.75rem;
}

.profile-menu button i {
    width: 18px;
    flex: 0 0 18px;
    font-size: 0.95rem;
    color: var(--text-body);
}

/* ==== UPDATE PASSWORD MODAL ==== */
#update-password-modal {
    align-items: center !important;
    justify-content: center !important;
    padding: 1rem !important;
    backdrop-filter: blur(4px) !important;
    background: rgba(15, 23, 42, 0.65) !important;
}

#update-password-modal .modal-content {
    width: 440px !important;
    max-width: 92vw !important;
    border-radius: 16px !important;
    border: none !important;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25), 0 0 0 1px rgba(0, 0, 0, 0.05) !important;
    overflow: hidden !important;
    background: var(--surface) !important;
}

#update-password-modal .modal-header {
    background: var(--surface-2) !important;
    border-bottom: 1px solid var(--line) !important;
    padding: 1rem 1.25rem !important;
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
}

#update-password-modal .modal-heading {
    display: flex !important;
    align-items: center !important;
    gap: 0.85rem !important;
}

#update-password-modal .modal-heading-icon {
    width: 42px !important;
    height: 42px !important;
    min-width: 42px !important;
    background: var(--surface) !important;
    border: 1px solid var(--line) !important;
    border-radius: 10px !important;
    color: var(--brand-ink) !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    font-size: 1.05rem !important;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05) !important;
}

#update-password-modal .modal-header h3 {
    color: var(--brand-ink) !important;
    font-size: 1.1rem !important;
    font-weight: 700 !important;
    margin: 0 !important;
    line-height: 1.25 !important;
}

#update-password-modal .modal-subtitle {
    display: block !important;
    color: var(--muted) !important;
    font-size: 0.8rem !important;
    font-weight: 400 !important;
    margin: 0.15rem 0 0 0 !important;
    line-height: 1.2 !important;
}

#update-password-modal .close-modal {
    background: transparent !important;
    border: none !important;
    color: var(--muted) !important;
    font-size: 1rem !important;
    cursor: pointer !important;
    padding: 0.3rem !important;
    border-radius: 6px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
}

#update-password-modal .close-modal:hover {
    background: var(--line) !important;
    color: var(--brand-ink) !important;
}

#update-password-modal .modal-body {
    background: var(--surface) !important;
    padding: 1.15rem 1.25rem 1.1rem !important;
    display: flex;
    flex-direction: column;
    gap: 0.9rem;
}

#update-password-modal .form-field {
    margin: 0 !important;
}

#update-password-modal .form-field label {
    display: block;
    color: var(--ink) !important;
    font-size: 0.85rem !important;
    font-weight: 600 !important;
    margin-bottom: 0.4rem !important;
}

#update-password-modal .password-input-wrap {
    position: relative;
    display: flex;
    align-items: center;
    width: 100%;
}

#update-password-modal input {
    background-color: var(--surface) !important;
    border: 1px solid var(--line-strong) !important;
    border-radius: 8px !important;
    height: 40px !important;
    min-height: 40px !important;
    padding: 0 2.6rem 0 0.85rem !important;
    font-size: 0.88rem !important;
    color: var(--ink) !important;
    width: 100% !important;
    box-sizing: border-box !important;
}

#update-password-modal input::placeholder {
    color: var(--faint) !important;
}

#update-password-modal input:focus {
    border-color: var(--brand) !important;
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 12%, transparent) !important;
    outline: none !important;
}

#update-password-modal .password-toggle {
    position: absolute;
    right: 0.45rem;
    top: 50%;
    transform: translateY(-50%);
    width: 30px;
    height: 30px;
    border: none;
    background: transparent;
    color: var(--muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    font-size: 0.9rem;
}

#update-password-modal .password-toggle:hover {
    color: var(--ink);
    background: var(--surface-2);
}

#update-password-modal .update-password-hint {
    margin: -0.4rem 0 0;
    font-size: 0.78rem;
    color: var(--muted);
}

#update-password-modal .auth-message {
    margin: 0;
    font-size: 0.8rem;
}

#update-password-modal .auth-message:empty {
    display: none;
}

#update-password-modal .modal-footer {
    background: var(--surface-2) !important;
    border-top: 1px solid var(--line) !important;
    margin: 0 !important;
    padding: 0.85rem 1.25rem !important;
    display: flex !important;
    justify-content: flex-end !important;
    align-items: center !important;
    gap: 0.65rem !important;
}

#update-password-modal .modal-footer .btn {
    min-height: 36px !important;
    height: 36px !important;
    font-size: 0.88rem !important;
    border-radius: 8px !important;
    cursor: pointer !important;
}

#update-password-modal #update-password-cancel {
    background: var(--surface) !important;
    border: 1px solid var(--line-strong) !important;
    color: var(--ink) !important;
    font-weight: 500 !important;
    padding: 0 1.2rem !important;
}

#update-password-modal #update-password-cancel:hover {
    background: var(--surface-2) !important;
    border-color: var(--line-strong) !important;
}

#update-password-modal #update-password-submit {
    background-color: var(--brand) !important;
    border: 1px solid var(--brand) !important;
    color: var(--on-brand) !important;
    font-weight: 600 !important;
    padding: 0 1.35rem !important;
}

#update-password-modal #update-password-submit:hover {
    background-color: var(--brand) !important;
    border-color: var(--brand) !important;
}

#update-password-modal #update-password-submit:disabled {
    opacity: 0.7 !important;
    cursor: wait !important;
}

/* ==== EXPORT CSV MODAL ==== */
#rates-export-modal {
    align-items: center !important;
    justify-content: center !important;
    padding: 1rem !important;
    backdrop-filter: blur(4px) !important;
    background: rgba(15, 23, 42, 0.65) !important;
}

/* short enough never to scroll, so nothing clips the Rows menu; the header and the footer round their own corners */
#rates-export-modal .modal-content {
    width: 520px !important;
    max-width: calc(100vw - 32px) !important;
    border-radius: 16px !important;
    border: none !important;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25), 0 0 0 1px rgba(0, 0, 0, 0.05) !important;
    overflow: visible !important;
    background: var(--surface) !important;
}

#rates-export-modal .modal-header {
    border-radius: 16px 16px 0 0 !important;
    background: var(--surface-2) !important;
    border-bottom: 1px solid var(--line) !important;
    padding: 1rem 1.25rem !important;
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
}

#rates-export-modal .modal-heading {
    display: flex !important;
    align-items: center !important;
    gap: 0.85rem !important;
}

#rates-export-modal .modal-heading-icon {
    width: 42px !important;
    height: 42px !important;
    min-width: 42px !important;
    background: var(--surface) !important;
    border: 1px solid var(--line) !important;
    border-radius: 10px !important;
    color: var(--success) !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    font-size: 1.15rem !important;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05) !important;
}

#rates-export-modal .modal-header h3 {
    color: var(--brand-ink) !important;
    font-size: 1.1rem !important;
    font-weight: 700 !important;
    margin: 0 !important;
    line-height: 1.25 !important;
}

#rates-export-modal .modal-subtitle {
    display: block !important;
    color: var(--muted) !important;
    font-size: 0.8rem !important;
    margin: 0.15rem 0 0 0 !important;
    line-height: 1.2 !important;
}

#rates-export-modal .close-modal {
    background: transparent !important;
    border: none !important;
    color: var(--muted) !important;
    font-size: 1rem !important;
    cursor: pointer !important;
    padding: 0.3rem !important;
    border-radius: 6px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
}

#rates-export-modal .close-modal:hover {
    background: var(--line) !important;
    color: var(--brand-ink) !important;
}

#rates-export-modal .modal-body {
    background: var(--surface) !important;
    padding: 1.15rem 1.25rem 1.1rem !important;
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
    overflow: visible !important;
}

/* Use the filters applied on the main page: a card with a checkbox, a hint and the picked filters as chips */
#rates-export-modal .export-scope {
    display: flex;
    align-items: flex-start;
    gap: 0.65rem;
    padding: 0.75rem;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: var(--surface-2);
    cursor: pointer;
}

#rates-export-modal .export-scope.is-disabled {
    opacity: 0.6;
    cursor: default;
}

#rates-export-modal .export-scope input {
    flex: none;
    width: 16px !important;
    height: 16px !important;
    min-height: 0 !important;
    margin: 2px 0 0;
    padding: 0 !important;
    accent-color: var(--success);
}

#rates-export-modal .export-scope span {
    display: grid;
    gap: 2px;
    min-width: 0;
    color: var(--ink);
    font-size: 0.88rem;
}

#rates-export-modal .export-scope small {
    color: var(--muted);
    font-size: 0.78rem;
}

#rates-export-modal .export-filter-list {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin: 6px 0 0;
    padding: 0;
    list-style: none;
}

#rates-export-modal .export-filter-list li {
    display: inline-flex;
    align-items: center;
    min-height: 22px;
    padding: 0 8px;
    border-radius: 999px;
    background: var(--success-soft);
    color: var(--success);
    font-size: 0.74rem;
    font-weight: 600;
    overflow-wrap: anywhere;
}

/* Rows (a number box with a chevron menu) and Order, side by side */
#rates-export-modal .export-options {
    display: grid;
    grid-template-columns: 1fr 1fr;
    align-items: start;
    gap: 0.75rem;
}

#rates-export-modal .form-field {
    margin: 0 !important;
    min-width: 0;
}

#rates-export-modal .form-field label {
    display: block;
    color: var(--ink) !important;
    font-size: 0.85rem !important;
    font-weight: 600 !important;
    margin-bottom: 0.4rem !important;
}

#rates-export-modal .form-field input,
#rates-export-modal .form-field select {
    background-color: var(--surface) !important;
    border: 1px solid var(--line-strong) !important;
    border-radius: 8px !important;
    height: 40px !important;
    min-height: 40px !important;
    padding: 0 0.85rem !important;
    font-size: 0.9rem !important;
    color: var(--ink) !important;
    width: 100% !important;
    box-sizing: border-box !important;
}

#rates-export-modal .form-field input:focus,
#rates-export-modal .form-field select:focus {
    border-color: var(--success) !important;
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--success) 14%, transparent) !important;
    outline: none !important;
}

#rates-export-modal .export-rows {
    position: relative;
}

#rates-export-modal .export-rows input {
    padding-right: 2.4rem !important;
    appearance: textfield;
    -moz-appearance: textfield;
}

#rates-export-modal .export-rows input::-webkit-inner-spin-button,
#rates-export-modal .export-rows input::-webkit-outer-spin-button {
    margin: 0;
    -webkit-appearance: none;
}

#rates-export-modal .export-rows input:invalid {
    border-color: var(--danger) !important;
}

#rates-export-modal .export-rows-toggle {
    position: absolute;
    top: 1px;
    right: 1px;
    bottom: 1px;
    display: grid;
    place-items: center;
    width: 34px;
    margin: 0;
    padding: 0;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: var(--muted);
    font-size: 0.75rem;
    cursor: pointer;
}

#rates-export-modal .export-rows-menu {
    position: absolute;
    top: calc(100% + 4px);
    right: 0;
    left: 0;
    z-index: 5;
    margin: 0;
    padding: 4px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface);
    box-shadow: 0 10px 25px -5px rgba(15, 23, 42, 0.18);
    list-style: none;
    max-height: 248px;
    overflow-y: auto;
}

#rates-export-modal .export-rows-menu button {
    display: block;
    width: 100%;
    height: 30px;
    margin: 0;
    padding: 0 10px;
    border: 0;
    border-radius: 6px;
    background: transparent;
    color: var(--ink);
    font: inherit;
    font-size: 0.88rem;
    text-align: left;
    cursor: pointer;
}

#rates-export-modal .export-rows-menu button:hover,
#rates-export-modal .export-rows-menu button.is-active {
    background: var(--surface-2);
}

/* empty; only a failed download's message */
#rates-export-modal .export-note {
    margin: 0;
    color: var(--danger);
    font-size: 0.8rem;
}

#rates-export-modal .export-note:empty {
    display: none;
}

@media (max-width: 520px) {
    #rates-export-modal .export-options {
        grid-template-columns: 1fr;
    }
}

#rates-export-modal .modal-footer {
    border-radius: 0 0 16px 16px !important;
    background: var(--surface) !important;
    border-top: 1px solid var(--line) !important;
    margin: 0 !important;
    padding: 0.85rem 1.25rem 1rem !important;
    display: flex !important;
    justify-content: flex-end !important;
    align-items: center !important;
    gap: 0.65rem !important;
}

#rates-export-modal .modal-footer .btn {
    min-height: 38px !important;
    height: 38px !important;
    font-size: 0.88rem !important;
    border-radius: 8px !important;
    cursor: pointer !important;
}

#rates-export-modal #rates-export-cancel {
    background: var(--surface) !important;
    border: 1px solid var(--line-strong) !important;
    color: var(--ink) !important;
    font-weight: 500 !important;
    padding: 0 1.2rem !important;
}

#rates-export-modal #rates-export-cancel:hover {
    background: var(--surface-2) !important;
    border-color: var(--line-strong) !important;
}

#rates-export-modal #rates-export-submit {
    background-color: var(--success) !important;
    border: 1px solid var(--success) !important;
    color: var(--on-brand) !important;
    font-weight: 600 !important;
    padding: 0 1.35rem !important;
}

#rates-export-modal #rates-export-submit:hover:not(:disabled) {
    background-color: var(--success) !important;
    border-color: var(--success) !important;
}

#rates-export-modal #rates-export-submit:disabled {
    opacity: 0.6 !important;
    cursor: not-allowed !important;
}

/* ==== QUOTATION EMAIL PREVIEW ==== */
.quotation-email-content { width: min(880px, calc(100vw - 32px)); max-width: none; }
.quotation-email-meta { display: grid; grid-template-columns: max-content 1fr; gap: 0.35rem 0.9rem; margin: 0 0 0.85rem; font-size: 0.85rem; }
.quotation-email-meta dt { color: var(--muted); font-weight: 700; }
.quotation-email-meta dd { margin: 0; color: var(--ink); font-weight: 600; overflow-wrap: anywhere; }
.quotation-email-frame-wrap { position: relative; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; background: var(--surface-2); }
.quotation-email-frame { display: block; width: 100%; height: min(60vh, 620px); border: 0; background: var(--surface-2); }
.quotation-email-status { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; margin: 0; padding: 1rem; text-align: center; color: var(--muted); font-size: 0.9rem; background: var(--surface-2); }
.quotation-email-status[hidden] { display: none; }
.quotation-email-message { margin: 0.6rem 0 0; min-height: 1.2em; font-size: 0.85rem; color: var(--danger); }
@media (max-width: 640px) { .quotation-email-frame { height: 55vh; } }
.quotation-email-edit { margin-right: auto; }

/* ==== QUOTATION EMAIL TEMPLATE EDITOR ==== */
.quotation-template-content { width: min(1200px, calc(100vw - 32px)); max-width: none; }
.quotation-template-grid { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 3fr); gap: 1.25rem; align-items: stretch; }
.quotation-template-edit, .quotation-template-preview { display: flex; flex-direction: column; min-width: 0; }
.quotation-template-note { margin: 0 0 0.6rem; color: var(--muted); font-size: 0.88rem; line-height: 1.5; }
.quotation-template-label { margin: 0 0 0.3rem; color: var(--ink); font-size: 0.85rem; font-weight: 700; }
.quotation-template-field { margin-bottom: 0.85rem; padding: 0.55rem 0.7rem; border: 1px solid var(--line-strong); border-radius: 8px; font: inherit; font-size: 0.92rem; line-height: 1.5; resize: vertical; }
.quotation-template-field:focus { outline: 2px solid var(--brand-line); outline-offset: 0; border-color: var(--brand); }
.quotation-template-placeholders { display: flex; flex-wrap: wrap; gap: 0.35rem; margin-bottom: 0.9rem; }
.quotation-template-chip { padding: 0.28rem 0.6rem; border: 1px solid var(--brand-line); border-radius: 999px; background: var(--brand-soft); color: var(--brand-ink); font-size: 0.78rem; font-weight: 600; cursor: pointer; }
.quotation-template-chip:hover, .quotation-template-chip:focus-visible { background: var(--brand-soft); border-color: var(--brand-line); }
.quotation-template-chip i { margin-right: 0.25rem; font-size: 0.68rem; }
.quotation-template-switches { display: flex; flex-wrap: wrap; align-items: center; gap: 0.4rem 1rem; font-size: 0.88rem; color: var(--ink); }
.quotation-template-switches-title { font-weight: 700; color: var(--ink); }
.quotation-template-switch { display: inline-flex; align-items: center; gap: 0.4rem; cursor: pointer; }
.quotation-template-switch input { width: 1rem; height: 1rem; accent-color: var(--brand-ink); }
.quotation-template-preview-subject { margin-bottom: 0.5rem; padding: 0.5rem 0.7rem; border-radius: 8px; background: var(--surface-2); font-size: 0.88rem; font-weight: 600; overflow-wrap: anywhere; }
.quotation-template-frame { flex: 1; min-height: 440px; height: auto; border: 1px solid var(--line); border-radius: 10px; }
@media (max-width: 900px) {
    .quotation-template-grid { grid-template-columns: 1fr; }
    .quotation-template-frame { min-height: 420px; }
}

/* ==== MICROSOFT ACCOUNT ==== */
.ms-account { position: relative; }
.ms-account[hidden], .ms-menu[hidden] { display: none; }
.ms-chip { display: inline-flex; align-items: center; gap: 0.35rem; max-width: 200px; padding: 0.42rem 0.7rem; border: 1px solid var(--line-strong); border-radius: 999px; background: var(--surface); color: var(--ink); font: inherit; font-size: 0.78rem; font-weight: 600; line-height: 1.2; cursor: pointer; }
.ms-chip:hover, .ms-chip:focus-visible { border-color: var(--line-strong); background: var(--surface-2); }
.ms-chip.is-connected { border-color: color-mix(in srgb, var(--success) 35%, var(--surface)); background: var(--success-soft); }
.ms-chip.is-expired { border-color: var(--warning); background: var(--warning-soft); }
.ms-chip-text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ms-logo { position: relative; display: inline-flex; }
.ms-chip-dot { display: none; position: absolute; top: -3px; right: -4px; width: 8px; height: 8px; border: 2px solid color-mix(in srgb, var(--success) 30%, var(--surface)); border-radius: 50%; background: var(--success); }
.ms-chip.is-connected .ms-chip-dot { display: block; }
.ms-menu { position: absolute; top: calc(100% + 8px); right: 0; z-index: 60; width: 320px; max-width: calc(100vw - 32px); padding: 1rem; border: 1px solid var(--line-strong); border-radius: 14px; background: var(--surface); box-shadow: 0 16px 40px rgba(15, 23, 42, 0.16); }
.ms-menu-head { display: flex; align-items: center; gap: 0.6rem; margin-bottom: 0.85rem; }
.ms-logo-box { display: inline-flex; padding: 0.45rem; border: 1px solid color-mix(in srgb, var(--success) 35%, var(--surface)); border-radius: 10px; background: var(--success-soft); }
.ms-menu-title { flex: 1; font-size: 0.82rem; font-weight: 800; letter-spacing: 0.06em; color: var(--ink); }
.ms-badge { padding: 0.3rem 0.5rem; border-radius: 6px; background: color-mix(in srgb, var(--success) 25%, var(--surface)); color: var(--success); font-size: 0.68rem; font-weight: 800; letter-spacing: 0.04em; }
.ms-badge.is-expired { background: color-mix(in srgb, var(--warning) 25%, var(--surface)); color: var(--warning); }
.ms-menu-account { display: flex; flex-direction: column; gap: 0.3rem; margin-bottom: 0.85rem; padding: 0.8rem 0.9rem; border: 1px solid var(--line-strong); border-radius: 10px; background: var(--surface-2); overflow-wrap: anywhere; }
.ms-menu-account strong { font-size: 0.92rem; color: var(--ink); }
.ms-menu-account span { font-size: 0.82rem; color: var(--muted); }
.ms-menu-reconnect, .ms-menu-disconnect { display: flex; align-items: center; justify-content: center; gap: 0.45rem; width: 100%; padding: 0.6rem; border: 0; border-radius: 10px; font: inherit; font-size: 0.88rem; font-weight: 700; cursor: pointer; }
.ms-menu-reconnect { margin-bottom: 0.5rem; background: var(--brand); color: var(--on-brand); }
.ms-menu-disconnect { background: var(--danger-soft); color: var(--danger); }
.ms-menu-reconnect:hover { background: var(--brand); }
.ms-menu-disconnect:hover { background: color-mix(in srgb, var(--danger) 25%, var(--surface)); }
.ms-connect-content { position: relative; display: flex; flex-direction: column; align-items: center; width: min(520px, calc(100vw - 32px)); max-width: none; padding: 2.25rem 2rem 1.5rem; text-align: center; }
.ms-connect-close { position: absolute; top: 0.9rem; right: 0.9rem; border: 0; background: none; color: var(--faint); font-size: 1.1rem; cursor: pointer; }
.ms-connect-close:hover { color: var(--muted); }
.ms-connect-logo { display: inline-flex; padding: 1rem; border: 1px solid var(--line); border-radius: 16px; background: var(--surface-2); box-shadow: 0 4px 12px rgba(15, 23, 42, 0.08); }
.ms-connect-pill { display: inline-flex; align-items: center; gap: 0.35rem; margin-top: 0.9rem; padding: 0.35rem 0.8rem; border: 1px solid var(--brand-line); border-radius: 999px; background: var(--brand-soft); color: var(--brand-ink); font-size: 0.8rem; font-weight: 700; }
.ms-connect-content h3 { margin: 0.9rem 0 0.5rem; font-size: 1.45rem; color: var(--ink); }
.ms-connect-text { margin: 0 0 1.1rem; color: var(--muted); font-size: 0.92rem; line-height: 1.55; }
.ms-connect-box { width: 100%; margin-bottom: 1.25rem; padding: 0.9rem 1rem; border: 1px solid var(--line-strong); border-radius: 12px; background: var(--surface-2); text-align: left; }
.ms-connect-box strong { display: flex; align-items: center; gap: 0.4rem; font-size: 0.88rem; color: var(--ink); }
.ms-connect-box strong i { color: var(--brand-ink); }
.ms-connect-box ul { margin: 0.6rem 0 0; padding-left: 1.2rem; color: var(--ink); font-size: 0.86rem; line-height: 1.9; }
.ms-connect-start { display: flex; align-items: center; justify-content: center; gap: 0.6rem; width: 100%; padding: 0.85rem; border: 0; border-radius: 10px; background: var(--toast-bg); color: var(--on-brand); font: inherit; font-size: 0.98rem; font-weight: 700; cursor: pointer; }
.ms-connect-start:hover { background: var(--toast-bg); }
.ms-connect-later { margin-top: 0.75rem; border: 0; background: none; color: var(--muted); font: inherit; font-size: 0.9rem; font-weight: 600; cursor: pointer; }
.ms-connect-later:hover { color: var(--ink); text-decoration: underline; }
@media (max-width: 640px) { .ms-chip-text { display: none; } .ms-chip { padding: 0.45rem 0.6rem; } }

/* ==== Pulse shell ==== */
/* The shared look of the apps (Pulse's page standard, docs page.md): logo mark, view tabs, header buttons, avatar and account menu,
   the login card with its --brand head, and the dialog frame. Last in the file, so it wins over the older rules above. */
.header-brand {
    gap: 10px;
}
.header-brand .mark {
    display: grid;
    place-items: center;
    flex: none;
    width: var(--mark);
    height: var(--mark);
    border-radius: var(--radius);
    background: var(--brand);
    color: var(--on-brand);
    font-size: 16px;
    font-weight: 700;
}
.header-brand-title {
    color: var(--ink) !important;
    font-size: var(--fs-lg);
    letter-spacing: normal;
}
/* view tabs: a segmented group, the active tab filled --brand */
.top-nav-menu {
    height: auto;
    gap: 2px;
    padding: 3px;
    border-radius: 10px;
    background: var(--surface-2);
}
.top-nav-item {
    height: 30px;
    padding: 0 14px;
    gap: 6px;
    border-radius: var(--radius);
    color: var(--muted);
    font-size: var(--fs);
    font-weight: 600;
}
.top-nav-item i {
    font-size: 13px;
}
.top-nav-item:hover {
    background: var(--surface) !important;
}
.top-nav-item.active {
    color: var(--on-brand) !important;
    background: var(--brand) !important;
}
.top-nav-item.active i {
    color: var(--on-brand) !important;
}
.top-nav-item.active::after {
    display: none;
}
/* header buttons: outlined, never filled */
.ms-chip {
    height: var(--btn-h);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--surface);
    font-size: var(--fs);
    font-weight: 600;
}
.avatar {
    width: var(--avatar);
    height: var(--avatar);
    font-size: 14px;
    font-weight: 700;
    letter-spacing: normal;
}
.user-profile {
    padding: 0;
    border: 0;
}
.user-profile:hover {
    border: 0;
    background: transparent;
}
/* account menu: My profile, Login details, Update password, Sync, Settings, then Logout in red; no divider */
.profile-menu.account-menu {
    min-width: 180px;
    width: max-content;
    padding: 6px;
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
}
.profile-menu .account-menu-item {
    gap: 9px;
    height: 36px;
    padding: 0 18px 0 11px;
    border-radius: var(--radius);
    color: var(--ink);
    font-size: var(--fs);
    font-weight: 400;
}
.profile-menu .account-menu-item:hover {
    background: var(--surface-2);
    color: var(--ink);
}
.profile-menu .account-menu-item svg {
    flex: none;
    width: 17px;
    height: 17px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}
.profile-menu .account-menu-logout,
.profile-menu .account-menu-logout:hover {
    color: var(--danger);
}
.profile-menu .account-menu-logout:hover {
    background: var(--danger-soft);
}
/* login card: 370px, --radius-lg, 27px inside, a --brand head like a dialog's, labels over 45px fields, the full-width Login button 22px below */
.login-card {
    max-width: 370px;
    padding: 27px;
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
}
.login-card .login-head {
    display: grid;
    align-content: center;
    gap: 2px;
    min-height: 75px;
    margin: -27px -27px 27px;
    padding: var(--dialog-head-pad);
    border-bottom: 1px solid var(--brand-hover);
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    background: var(--brand);
}
.login-card .login-head h2 {
    margin: 0;
    color: var(--on-brand);
    font-size: var(--fs-lg);
    font-weight: 600;
    letter-spacing: normal;
}
.login-card-form {
    gap: 16px !important;
}
.login-card-form label {
    margin-bottom: 8px;
    color: var(--ink);
    font-size: 13px;
    font-weight: 600;
}
.login-input-wrap {
    height: 45px;
    border-radius: var(--radius);
    background: var(--surface);
}
.login-input-wrap:focus-within {
    box-shadow: var(--ring);
}
.login-input-wrap input,
.login-input-wrap select {
    font-size: 14px;
}
/* dialogs: --radius-lg frame, a --brand head (17px title, 12px subtitle, a 32px square ×), the actions on --bg at the right */
.modal-content {
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
}
.modal-header {
    min-height: 0;
    padding: var(--dialog-head-pad);
    border-bottom: 1px solid var(--brand-hover);
    border-radius: 0;
}
.modal-heading > div {
    display: grid;
    gap: 2px;
    min-width: 0;
}
.modal-header h3 {
    font-size: var(--fs-lg);
    font-weight: 600;
    letter-spacing: normal;
}
.modal-header .modal-subtitle {
    display: block !important;
    margin: 0;
    color: var(--on-brand-soft);
    font-size: 12px;
}
.close-modal {
    width: 32px;
    height: 32px;
    flex: 0 0 32px;
    border: 1px solid var(--on-brand-line);
    border-radius: var(--radius);
    background: transparent;
    font-size: 15px;
}
.close-modal:hover {
    background: var(--on-brand-hover);
}
.modal-body {
    padding: var(--dialog-pad);
}
.modal-footer {
    gap: 8px;
    padding: var(--dialog-actions-pad);
    border-top: 1px solid var(--line);
    background: var(--bg);
}
.modal-footer .btn {
    min-height: var(--btn-h) !important;
    height: var(--btn-h) !important;
    padding: var(--btn-pad) !important;
    font-size: var(--fs) !important;
}
/* logged out, the header shows the app's wordmark, as on Pulse's login page; logged in, the logo mark and name */
body.logged-out .header-brand .mark {
    display: none;
}
body.logged-out .header-brand-title {
    display: inline-flex;
    align-items: center;
    color: var(--brand-ink) !important;
    font-family: Arial, sans-serif;
    font-size: 32px;
    font-weight: 800;
    letter-spacing: -2px;
}
body.logged-out .header-brand-title::before {
    content: "";
    width: 18px;
    height: 25px;
    margin-right: 3px;
    background: repeating-linear-gradient(to bottom, transparent 0 5px, var(--brand-line) 5px 7px);
}
body.logged-out .header-brand {
    border-right: 0;
}
/* the shared dialog head of account.js, settings.js and sync.js: h2 + p in a div, then a 32px square .modal-close */
.modal-header > div:first-child:not(.modal-heading) {
    display: grid;
    gap: 2px;
    min-width: 0;
}
.modal-header h2 {
    margin: 0;
    color: var(--on-brand);
    font-size: var(--fs-lg);
    font-weight: 600;
    line-height: 1.3;
}
.modal-header > div:first-child > p {
    margin: 0;
    color: var(--on-brand-soft);
    font-size: 12px;
}
.modal-close {
    display: grid;
    flex: none;
    place-items: center;
    width: 32px;
    height: 32px;
    margin-left: auto;
    padding: 0;
    border: 1px solid var(--on-brand-line);
    border-radius: var(--radius);
    background: transparent;
    color: var(--on-brand);
    cursor: pointer;
}
.modal-close svg {
    width: 18px;
    height: 18px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
}
.modal-close:hover {
    background: var(--on-brand-hover);
}
/* ==== pager ==== */
/* every Previous / Next, the same block as Finance, MDM and Pulse: <div class="pager" role="group" aria-label="Pages"> > button.btn.btn-secondary.pager-btn (left chevron)
   + span.pager-label ("Page N") + button.btn.btn-secondary.pager-btn (right chevron); the page only places the group */
.pager {
    display: flex;
    align-items: center;
    gap: 8px;
}
.pager .pager-btn {
    flex: 0 0 auto;
    width: var(--btn-h);
    height: var(--btn-h);
    min-height: 0;
    padding: 0;
}
.pager .pager-btn svg {
    width: 16px;
    height: 16px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}
.pager .pager-btn:disabled {
    background: var(--bg);
    color: var(--faint);
    border-color: var(--line);
    opacity: 1;
    cursor: not-allowed;
}
.pager .pager-label {
    min-width: 54px;
    text-align: center;
    white-space: nowrap;
    font-size: var(--fs-sm);
    font-weight: 600;
    color: var(--ink);
}
/* table heads: --brand-tint, --ink, 12px/600, normal case (Pulse's tables) */
.data-table th {
    background: var(--brand-tint);
    font-size: var(--fs-sm);
    font-weight: 600;
    letter-spacing: normal;
    text-transform: none;
    box-shadow: inset 0 -1px 0 var(--line);
}
.data-table th,
.data-table th button,
.data-table th a,
.data-table th i {
    color: var(--ink) !important;
}
.data-table th.sortable .th-sort .th-text {
    text-transform: none;
    letter-spacing: normal;
}
/* the dim behind a dialog: the theme's --backdrop, no blur */
.modal {
    background: var(--backdrop);
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
}
/* phones: the feature cards hide, so the login form sits under the heading (Pulse's login page) */
@media (max-width: 850px) {
    .hero-feature-grid {
        display: none;
    }
}
