/* ========================================
   Page-Specific Styles
   ======================================== */

/* Login Page */
.login-scene {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    min-height: 100dvh;
    background: var(--gradient-login-bg);
    padding: 20px;
}

.login-card {
    background: #fff;
    border-radius: 20px;
    padding: 30px 28px;
    width: 380px;
    max-width: 92vw;
    display: flex;
    flex-direction: column;
    align-items: center;
    box-shadow: 0 24px 70px rgba(0,0,0,0.45);
    border-top: 4px solid var(--gold);
}

.login-logo {
    width: 150px;
    height: auto;
    object-fit: contain;
    margin: 0 auto 6px;
    display: block;
}

.login-logo-fallback {
    width: 96px;
    height: 96px;
    border-radius: 16px;
    background: var(--navy-light);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 3rem;
    margin-bottom: 8px;
}

.login-title {
    color: var(--navy);
    font-size: 1.15rem;
    text-align: center;
    margin: 4px 0 0;
    font-weight: 800;
}

.login-tagline {
    text-align: center;
    color: var(--text-secondary);
    font-size: 0.92rem;
    margin: 2px 0 14px;
    line-height: 1.6;
}

.login-card .field { width: 100%; }

.login-card input {
    font-size: 16px !important;
    padding: 12px 14px !important;
}

.login-btn {
    width: 100%;
    margin-top: 8px;
    padding: 13px;
    font-size: 1.05rem;
    background: var(--gradient-gold) !important;
    color: #fff;
    border: none;
    border-radius: var(--radius-md);
    font-weight: 700;
    cursor: pointer;
    box-shadow: var(--shadow-gold);
    transition: transform var(--transition-fast), box-shadow var(--transition-fast);
}

.login-btn:hover { transform: translateY(-1px); }
.login-btn:active { transform: translateY(0); }
.login-btn:disabled { opacity: 0.6; cursor: not-allowed; }

.login-error {
    width: 100%;
    background: var(--danger-bg);
    color: var(--danger);
    border: 1px solid #f0b8b5;
    border-radius: var(--radius-sm);
    padding: 8px 12px;
    font-size: 0.88rem;
    text-align: center;
    margin-bottom: 6px;
    animation: shake 0.4s ease-out;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-6px); }
    75% { transform: translateX(6px); }
}

.login-dev {
    margin-top: 16px;
    color: var(--muted);
    font-size: 0.72rem;
    text-align: center;
}

.code-wrap { position: relative; }
.code-wrap input { padding-inline-start: 46px !important; }

.code-eye {
    position: absolute;
    inset-inline-start: 6px;
    top: 50%;
    transform: translateY(-50%);
    border: none;
    background: none;
    font-size: 1.1rem;
    line-height: 1;
    padding: 6px;
    cursor: pointer;
    opacity: 0.65;
}
.code-eye:hover { opacity: 1; }

/* Inventory Page */
.inv-filter-bar {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
    margin-bottom: 14px;
}

.inv-filter-bar input {
    flex: 1;
    min-width: 180px;
    max-width: 300px;
}

.inv-subtoolbar {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    margin-bottom: 14px;
}

.inv-subtoolbar[hidden] {
    display: none;
}

.inv-add-material-btn {
    display: inline-flex;
    flex: 0 0 auto;
    align-items: center;
    justify-content: center;
    gap: 6px;
    min-height: 42px;
    white-space: nowrap;
}

.inv-search-wrap {
    display: flex;
    align-items: center;
    gap: 9px;
    flex: 1 1 220px;
    min-width: 0;
    min-height: 42px;
    padding: 0 12px;
    border: 1px solid var(--border-light);
    border-radius: 10px;
    color: var(--text-secondary);
    background: var(--card-bg);
    transition: border-color .16s ease, box-shadow .16s ease;
}

.inv-search-wrap:focus-within {
    border-color: var(--gold);
    box-shadow: 0 0 0 3px rgba(245, 166, 35, .13);
}

.inv-search-wrap > svg {
    flex: 0 0 auto;
}

.inv-search-wrap .search-input {
    flex: 1 1 auto;
    width: 100%;
    min-width: 0;
    max-width: none;
    padding: 8px 0;
    border: 0;
    outline: 0;
    color: var(--text);
    background: transparent;
    box-shadow: none;
}

.inv-search-wrap .search-input:focus {
    border: 0;
    outline: 0;
    box-shadow: none;
}

.inv-search-empty-action {
    display: flex;
    justify-content: center;
    margin-top: -24px;
    padding-bottom: 20px;
}

.inv-stats {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 14px;
}

.inv-stat {
    background: #fff;
    border: 1px solid var(--border-light);
    border-radius: var(--radius-md);
    padding: 10px 16px;
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 140px;
}

.inv-stat-icon { font-size: 1.5rem; }
.inv-stat-value { font-size: 1.1rem; font-weight: 800; color: var(--navy); }
.inv-stat-label { font-size: var(--font-size-xs); color: var(--muted); }

/* Quote Builder Page */
.quote-section {
    margin-bottom: 20px;
}

.quote-section-title {
    font-size: var(--font-size-md);
    font-weight: 800;
    color: var(--navy);
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.quote-result-card {
    background: linear-gradient(135deg, #f8fbff, #eef3f8);
    border: 2px solid var(--navy);
    border-radius: var(--radius-lg);
    padding: 16px;
}

.quote-items-table th { font-size: 0.82rem; }
.quote-items-table td { font-size: 0.85rem; }

/* Saved Quotes Page */
.quotes-filter {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 14px;
}

.quotes-filter select {
    width: auto;
    min-width: 140px;
}

.quote-card {
    background: #fff;
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    padding: 14px;
    margin-bottom: 10px;
    transition: box-shadow var(--transition-base);
}

.quote-card:hover { box-shadow: var(--shadow-md); }

.quote-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 8px;
}

.quote-card-number {
    font-weight: 800;
    color: var(--navy);
    font-size: var(--font-size-lg);
}

.quote-card-total {
    font-weight: 800;
    color: var(--navy);
    font-size: 1.1rem;
    background: var(--gold-light);
    padding: 4px 12px;
    border-radius: var(--radius-full);
}

.quote-card-info {
    display: flex;
    flex-direction: column;
    gap: 8px;
    color: var(--text-secondary);
}

.quote-card-info-primary,
.quote-card-info-secondary {
    display: grid;
    min-width: 0;
    align-items: center;
}

.quote-card-info-primary {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px 14px;
    color: var(--text);
    font-size: 0.92rem;
    font-weight: 600;
}

.quote-card-info-secondary {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 6px 10px;
    padding-top: 7px;
    border-top: 1px solid var(--border-light);
    font-size: 0.74rem;
}

.quote-info-creator {
    grid-column: 1 / -1;
}

.quote-card-info-primary > span,
.quote-card-info-secondary > span {
    min-width: 0;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
}

.quote-card-info-primary svg,
.quote-card-info-secondary svg {
    flex: 0 0 auto;
    width: 13px;
    height: 13px;
}

.quote-card-info-primary .quote-info-phone b {
    font-size: 0.96rem;
    font-weight: 700;
}

.quote-card-actions {
    display: flex;
    gap: 8px;
    margin-top: 10px;
    padding-top: 8px;
    border-top: 1px dashed var(--border);
}

/* Notification System */
.notif-bell {
    position: relative;
}

.notif-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    background: var(--danger);
    color: #fff;
    font-size: 0.6rem;
    font-weight: 800;
    min-width: 18px;
    height: 18px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 4px;
    border: 2px solid var(--navy);
    animation: badge-pulse 2s ease-in-out infinite;
}

@keyframes badge-pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.15); }
}

.notif-overlay {
    position: fixed;
    top: 0; right: 0; bottom: 0; left: 0;
    background: rgba(0,0,0,0.15);
    z-index: 1200;
}

.notif-panel {
    position: fixed;
    top: 60px;
    right: 12px;
    width: min(400px, calc(100vw - 24px));
    max-height: 70vh;
    background: #fff;
    border-radius: var(--radius-xl);
    box-shadow: 0 16px 48px rgba(0,0,0,0.25);
    z-index: 1250;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: notif-slide 0.2s ease-out;
}

@keyframes notif-slide {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}

.notif-panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 16px;
    border-bottom: 1px solid var(--border);
}

.notif-panel-body {
    flex: 1;
    overflow-y: auto;
    max-height: calc(70vh - 60px);
}

.notif-item {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 12px 16px;
    border-bottom: 1px solid #f4f6f8;
    cursor: pointer;
    transition: background var(--transition-fast);
    position: relative;
}

.notif-item:hover { background: #f8fafc; }

.notif-unread {
    background: #f0f6ff;
}

.notif-unread:hover { background: #e8f0fb; }

.notif-item-icon {
    font-size: 1.3rem;
    flex-shrink: 0;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--navy-light);
    border-radius: 10px;
}

.notif-item-content { flex: 1; min-width: 0; }

.notif-item-title {
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--navy-dark);
    margin-bottom: 2px;
}

.notif-item-body {
    font-size: 0.78rem;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.notif-item-time {
    font-size: 0.7rem;
    color: var(--muted);
    margin-top: 3px;
}

.notif-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--info);
    flex-shrink: 0;
    margin-top: 6px;
}

/* Dashboard Page */
.dash-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 14px;
    margin-bottom: 18px;
}

.dash-stat-card {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 18px 16px;
    border-radius: var(--radius-lg);
    color: #fff;
    box-shadow: var(--shadow-md);
    transition: transform var(--transition-fast), box-shadow var(--transition-fast);
}

.dash-stat-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.dash-stat-blue { background: linear-gradient(135deg, #1a3a5c, #24507f); }
.dash-stat-gold { background: linear-gradient(135deg, #f5a623, #e8940a); }
.dash-stat-green { background: linear-gradient(135deg, #2f8a4b, #25a55a); }
.dash-stat-purple { background: linear-gradient(135deg, #7c3aed, #8b5cf6); }

.dash-stat-icon {
    font-size: 2rem;
    width: 52px;
    height: 52px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.2);
    border-radius: var(--radius-md);
}

.dash-stat-value {
    font-size: 1.2rem;
    font-weight: 800;
    line-height: 1.2;
}

.dash-stat-label {
    font-size: var(--font-size-xs);
    opacity: 0.85;
    font-weight: 600;
}

.dash-charts {
    display: flex;
    gap: 18px;
    margin-bottom: 18px;
}

.dash-chart-card {
    flex: 1;
    min-width: 0;
}

.dash-chart-card canvas {
    width: 100% !important;
    display: block;
}

.dash-quick-actions {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

@media (max-width: 700px) {
    .dash-stats { grid-template-columns: 1fr 1fr; gap: 10px; }
    .dash-stat-card { padding: 14px 12px; }
    .dash-stat-icon { width: 42px; height: 42px; font-size: 1.5rem; }
    .dash-stat-value { font-size: 1rem; }
    .dash-charts { flex-direction: column; gap: 14px; }
}

@media (max-width: 400px) {
    .dash-stats { grid-template-columns: 1fr; }
}

@media (max-width: 560px) {
    .login-scene { padding: 16px 12px; align-items: flex-start; }
    .login-card { max-width: 100%; padding: 24px 18px 18px; margin-top: 24px; }
}

/* ========================================
   Quote Builder Styles (Matching Original App)
   ======================================== */
.brand-pick {
    position: relative;
    z-index: 4;
    margin-top: 14px;
    margin-bottom: 12px;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: #fbfcfe;
}

.brand-pick-head {
    display: flex;
    align-items: baseline;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 8px;
    color: var(--navy);
    font-size: 0.92rem;
}

.brand-pick-head .muted {
    font-size: 0.74rem;
    font-weight: 600;
}

.brand-section {
    display: grid;
    grid-template-columns: minmax(105px, 0.38fr) minmax(0, 1fr);
    align-items: center;
    gap: 12px;
    position: relative;
}

.brand-section + .brand-section {
    margin-top: 9px;
    padding-top: 9px;
    border-top: 1px solid var(--border-light);
}

.brand-section-title {
    font-size: 0.82rem;
    font-weight: 800;
    color: var(--navy);
    line-height: 1.25;
}

.brand-dropdown {
    position: relative;
    min-width: 0;
}

.brand-dropdown-trigger {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    width: 100%;
    min-height: 44px;
    padding: 7px 10px;
    border: 1px solid var(--border);
    border-radius: 9px;
    color: var(--text);
    background: var(--card-bg);
    font: inherit;
    text-align: start;
    cursor: pointer;
    transition: border-color .16s ease, box-shadow .16s ease, background .16s ease;
}

.brand-dropdown-trigger:hover,
.brand-dropdown.is-open .brand-dropdown-trigger,
.brand-dropdown-trigger:focus-visible {
    outline: none;
    border-color: var(--gold);
    box-shadow: 0 0 0 3px rgba(245, 166, 35, .13);
}

.brand-trigger-selection,
.brand-option-identity {
    display: flex;
    align-items: center;
    min-width: 0;
    gap: 9px;
}

.brand-trigger-selection {
    overflow: hidden;
}

.brand-dropdown-chevron {
    width: 18px;
    height: 18px;
    flex: 0 0 auto;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
    transition: transform .16s ease;
}

.brand-dropdown.is-open .brand-dropdown-chevron {
    transform: rotate(180deg);
}

.brand-name {
    overflow: hidden;
    color: var(--text);
    font-size: .82rem;
    font-weight: 700;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.brand-all-mark {
    display: inline-grid;
    place-items: center;
    width: 30px;
    height: 30px;
    flex: 0 0 30px;
    border: 1px solid var(--border-light);
    border-radius: 8px;
    color: var(--navy);
    background: var(--bg-alt);
    font-size: .65rem;
    font-weight: 800;
}

.brand-all-mark svg {
    width: 16px;
    height: 16px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.7;
    stroke-linecap: round;
}

.brand-dropdown-menu {
    position: absolute;
    z-index: 50;
    inset-block-start: calc(100% + 6px);
    inset-inline: 0;
    padding: 8px;
    border: 1px solid var(--border);
    border-radius: 11px;
    background: var(--card-bg);
    box-shadow: 0 14px 34px rgba(18, 31, 44, .18);
}

.brand-dropdown-menu[hidden] {
    display: none;
}

.brand-search-wrap {
    display: flex;
    align-items: center;
    gap: 8px;
    min-height: 38px;
    padding-inline: 10px;
    border: 1px solid var(--border-light);
    border-radius: 8px;
    color: var(--muted);
    background: var(--bg-alt);
}

.brand-search-wrap svg {
    width: 17px;
    height: 17px;
    flex: 0 0 auto;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.6;
    stroke-linecap: round;
}

.brand-search {
    width: 100%;
    min-width: 0;
    padding: 7px 0;
    border: 0 !important;
    outline: 0;
    color: var(--text);
    background: transparent !important;
    font: inherit;
    font-size: .8rem;
}

.brand-search:focus {
    box-shadow: none !important;
}

.brand-row {
    display: grid;
    gap: 3px;
    max-height: 224px;
    margin-top: 6px;
    overflow-y: auto;
    overscroll-behavior: contain;
    scrollbar-width: thin;
}

.brand-row::-webkit-scrollbar {
    width: 6px;
}

.brand-row::-webkit-scrollbar-thumb {
    border-radius: 8px;
    background: var(--border);
}

.brand-option {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    width: 100%;
    min-height: 42px;
    padding: 5px 8px;
    border: 1px solid transparent;
    border-radius: 8px;
    color: var(--text);
    background: transparent;
    font: inherit;
    text-align: start;
    cursor: pointer;
    transition: border-color .14s ease, background .14s ease;
}

.brand-option[hidden] {
    display: none;
}

.brand-option:hover,
.brand-option:focus-visible {
    outline: none;
    border-color: var(--border-light);
    background: var(--bg-alt);
}

.brand-option.is-selected {
    border-color: rgba(213, 137, 44, .35);
    background: rgba(245, 166, 35, .1);
}

.brand-mark-wrap {
    position: relative;
    display: inline-grid;
    place-items: center;
    width: 30px;
    height: 30px;
    flex: 0 0 30px;
    overflow: hidden;
    border: 1px solid var(--border-light);
    border-radius: 8px;
    background: #fff;
}

.brand-mark-img,
.brand-mark-fallback {
    width: 23px;
    height: 23px;
    object-fit: contain;
}

.brand-mark-fallback {
    place-items: center;
    border-radius: 5px;
    color: var(--navy);
    background: var(--bg-alt);
    font-size: .6rem;
    font-weight: 800;
}

.brand-mark-fallback:not([hidden]) {
    display: inline-grid;
}

.brand-option-check {
    flex: 0 0 auto;
    color: var(--gold-dark);
    font-size: .9rem;
    font-weight: 900;
    opacity: 0;
}

.brand-option.is-selected .brand-option-check {
    opacity: 1;
}

.brand-no-results {
    margin: 0;
    padding: 12px 8px 6px;
    color: var(--muted);
    font-size: .78rem;
    text-align: center;
}

.brand-no-results[hidden] {
    display: none;
}

@media (max-width: 600px) {
    .brand-section {
        grid-template-columns: minmax(90px, .35fr) minmax(0, 1fr);
        gap: 8px;
    }

    .brand-dropdown-menu {
        inset-inline-start: auto;
        width: min(100%, 380px);
        min-width: min(260px, calc(100vw - 54px));
    }

    .brand-section-title {
        font-size: .76rem;
    }
}

/* ============================================================
   Custom Created-By (Staff / Account) Dropdown
   ============================================================ */
.created-by-field {
    position: relative;
    width: 290px;
    max-width: 100%;
}

.created-by-perm-hint {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 0.72rem;
    font-weight: 500;
    color: var(--muted);
    background: var(--bg-alt);
    padding: 2px 7px;
    border-radius: 6px;
    border: 1px solid var(--border-light);
}

.created-by-dropdown {
    position: relative;
    width: 100%;
}

.created-by-trigger {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    width: 100%;
    min-height: 48px;
    padding: 6px 12px;
    border: 1px solid var(--border);
    border-radius: 11px;
    background: var(--card-bg);
    color: var(--text);
    font: inherit;
    text-align: start;
    cursor: pointer;
    box-shadow: 0 1.5px 4px rgba(0, 0, 0, .04);
    transition: border-color .16s ease, box-shadow .16s ease, background .16s ease;
}

.created-by-trigger:hover,
.created-by-trigger:focus-visible,
.created-by-dropdown.is-open .created-by-trigger {
    outline: none;
    border-color: var(--gold);
    box-shadow: 0 0 0 3px rgba(245, 166, 35, .15);
}

.created-by-dropdown.is-disabled .created-by-trigger,
.created-by-trigger[disabled] {
    opacity: 0.78;
    cursor: not-allowed;
    background: var(--bg-alt);
    border-color: var(--border-light);
    box-shadow: none;
}

.created-by-selected-info {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
    flex: 1;
}

.created-by-avatar {
    display: grid;
    place-items: center;
    width: 34px;
    height: 34px;
    flex: 0 0 34px;
    border-radius: 50%;
    color: #fff;
    font-size: 0.8rem;
    font-weight: 700;
    background: linear-gradient(135deg, var(--gold) 0%, var(--gold-dark) 100%);
    box-shadow: 0 2px 6px rgba(213, 137, 44, .25);
    user-select: none;
}

.created-by-avatar svg {
    width: 18px;
    height: 18px;
}

.created-by-avatar.is-staff {
    background: linear-gradient(135deg, #2b394a 0%, #1a2430 100%);
    box-shadow: 0 2px 6px rgba(0, 0, 0, .18);
    border: 1px solid rgba(255, 255, 255, .1);
}

.created-by-text-wrap {
    display: flex;
    flex-direction: column;
    min-width: 0;
    line-height: 1.25;
}

.created-by-name {
    font-size: 0.86rem;
    font-weight: 700;
    color: var(--text);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.created-by-badge {
    font-size: 0.68rem;
    color: var(--muted);
    font-weight: 500;
}

.created-by-badge.is-self {
    color: var(--gold-dark);
    font-weight: 600;
}

.created-by-chevron {
    width: 18px;
    height: 18px;
    flex: 0 0 auto;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
    color: var(--muted);
    transition: transform .18s ease, color .18s ease;
}

.created-by-dropdown.is-open .created-by-chevron {
    transform: rotate(180deg);
    color: var(--gold);
}

.created-by-menu {
    position: absolute;
    z-index: 100;
    inset-block-start: calc(100% + 6px);
    inset-inline-end: 0;
    width: 100%;
    min-width: 290px;
    padding: 8px;
    border: 1px solid var(--border);
    border-radius: 13px;
    background: var(--card-bg);
    box-shadow: 0 16px 36px rgba(18, 31, 44, .2), 0 4px 12px rgba(0, 0, 0, .07);
    animation: cbMenuAppear .15s ease-out;
}

@keyframes cbMenuAppear {
    from {
        opacity: 0;
        transform: translateY(-4px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.created-by-menu[hidden] {
    display: none;
}

.created-by-search-wrap {
    display: flex;
    align-items: center;
    gap: 8px;
    min-height: 38px;
    padding-inline: 10px;
    border: 1px solid var(--border-light);
    border-radius: 9px;
    color: var(--muted);
    background: var(--bg-alt);
    margin-bottom: 6px;
    transition: border-color .15s ease, background .15s ease;
}

.created-by-search-wrap:focus-within {
    border-color: var(--gold);
    background: var(--card-bg);
}

.created-by-search-wrap svg {
    width: 16px;
    height: 16px;
    flex: 0 0 auto;
}

.created-by-search {
    width: 100%;
    min-width: 0;
    padding: 7px 0;
    border: 0 !important;
    outline: 0 !important;
    color: var(--text);
    background: transparent !important;
    font: inherit;
    font-size: 0.82rem;
}

.created-by-list-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 4px 6px 6px;
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--muted);
    border-bottom: 1px solid var(--border-light);
    margin-bottom: 4px;
}

.created-by-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    border-radius: 999px;
    background: var(--bg-alt);
    font-size: 0.68rem;
    font-weight: 700;
    color: var(--text);
}

.created-by-list {
    display: grid;
    gap: 3px;
    max-height: 240px;
    overflow-y: auto;
    overscroll-behavior: contain;
    scrollbar-width: thin;
    padding: 2px 1px;
}

.created-by-list::-webkit-scrollbar {
    width: 5px;
}

.created-by-list::-webkit-scrollbar-thumb {
    border-radius: 6px;
    background: var(--border);
}

.created-by-option {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    width: 100%;
    min-height: 42px;
    padding: 6px 8px;
    border: 1px solid transparent;
    border-radius: 8px;
    color: var(--text);
    background: transparent;
    font: inherit;
    text-align: start;
    cursor: pointer;
    transition: border-color .14s ease, background .14s ease, transform .1s ease;
}

.created-by-option[hidden] {
    display: none;
}

.created-by-option:hover,
.created-by-option:focus-visible {
    outline: none;
    border-color: var(--border-light);
    background: var(--bg-alt);
}

.created-by-option.is-selected {
    border-color: rgba(213, 137, 44, .35);
    background: rgba(245, 166, 35, .1);
}

.created-by-opt-identity {
    display: flex;
    align-items: center;
    gap: 9px;
    min-width: 0;
    flex: 1;
}

.created-by-opt-avatar {
    display: grid;
    place-items: center;
    width: 28px;
    height: 28px;
    flex: 0 0 28px;
    border-radius: 50%;
    font-size: 0.74rem;
    font-weight: 700;
    color: #fff;
    background: linear-gradient(135deg, #37474f 0%, #263238 100%);
    box-shadow: 0 1px 3px rgba(0, 0, 0, .15);
}

.created-by-opt-avatar.is-self {
    background: linear-gradient(135deg, var(--gold) 0%, var(--gold-dark) 100%);
    box-shadow: 0 2px 5px rgba(213, 137, 44, .3);
}

.created-by-opt-info {
    display: flex;
    flex-direction: column;
    min-width: 0;
    line-height: 1.25;
}

.created-by-opt-name {
    font-size: 0.83rem;
    font-weight: 600;
    color: var(--text);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.created-by-opt-role {
    font-size: 0.67rem;
    color: var(--muted);
    font-weight: 400;
}

.created-by-opt-role.is-self {
    color: var(--gold-dark);
    font-weight: 600;
}

.created-by-opt-check {
    width: 16px;
    height: 16px;
    flex: 0 0 auto;
    color: var(--gold-dark);
    opacity: 0;
    transition: opacity .14s ease;
}

.created-by-option.is-selected .created-by-opt-check {
    opacity: 1;
}

.created-by-empty {
    padding: 16px 8px;
    color: var(--muted);
    font-size: 0.78rem;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}

.created-by-empty[hidden] {
    display: none;
}

@media (max-width: 600px) {
    .created-by-field {
        width: 100% !important;
    }

    .created-by-menu {
        inset-inline: 0;
        width: 100%;
        min-width: 0;
    }
}

.opt-group {
    margin-top: 14px;
    padding: 14px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: #fbfcfe;
}

.opt-group:first-of-type {
    margin-top: 10px;
}

.opt-group-title {
    font-weight: 800;
    color: var(--navy);
    font-size: 0.92rem;
    padding-bottom: 8px;
    margin-bottom: 12px;
    border-bottom: 1px solid #e4eaf1;
}

.opt-line {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-size: 0.92rem;
}

.target-row {
    display: flex;
    gap: 14px;
    align-items: flex-end;
    flex-wrap: wrap;
    margin-bottom: 8px;
}

.target-row .field {
    flex: 1 1 220px;
    margin: 0;
}

.target-total-label {
    display: inline-flex;
    align-items: center;
    gap: 7px;
}

.classic-target-icon {
    width: 17px;
    height: 17px;
    flex: 0 0 17px;
    color: var(--navy);
    stroke: currentColor;
    stroke-width: 1.7;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.target-switch {
    flex: 0 0 auto;
    margin: 0 0 6px;
    white-space: nowrap;
}

.target-note {
    background: #eef5ff;
    border-inline-start: 3px solid #1a3a5c;
    border-radius: 4px;
    padding: 7px 10px;
    margin-bottom: 12px;
    font-size: 0.82rem;
    line-height: 1.6;
    color: #2c4a6b;
}

.copies-note {
    margin-top: 10px;
    padding: 9px 11px;
    background: #f7fafd;
    border: 1px solid #dbe3ec;
    border-inline-start: 3px solid var(--navy, #1a3a5c);
    border-radius: 8px;
    font-size: 0.8rem;
    line-height: 1.75;
    color: #2c4a6b;
}

.bank-choices {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-top: 10px;
}

.bank-btn {
    flex: 1 1 190px;
    text-align: right;
    cursor: pointer;
    border-radius: 12px;
    padding: 9px 12px;
    border: 1px solid #ccd6e2;
    background: #fff;
    font-family: inherit;
    transition: all 0.15s ease;
}

.bank-btn.active {
    border: 2px solid var(--navy);
    background: #e9f0f9;
}

.sec-badge {
    background: #e6f0fb;
    color: #1a5a9c;
    border-radius: 14px;
    padding: 4px 10px;
    font-size: 0.82rem;
    white-space: nowrap;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-weight: 600;
}

.big-inputs-4 {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr 1fr;
    gap: 12px;
    margin-bottom: 14px;
}

@media (max-width: 768px) {
    .big-inputs-4 {
        grid-template-columns: 1fr 1fr;
    }
}

@media (max-width: 480px) {
    .big-inputs-4 {
        grid-template-columns: 1fr;
    }
}

/* Packages Page Styles */
.pkg-rows { display: flex; flex-direction: column; gap: 12px; margin-top: 10px; }
.pkg-row { padding: 14px; background: #fff; border: 1px solid var(--border); border-radius: 12px; margin-bottom: 0; }
.pkg-row-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; color: var(--navy); }
.pkg-row-head b { font-size: 1.05rem; }
.opt-group { margin-top: 20px; padding: 16px; border: 1px solid var(--border); border-radius: 12px; background: #fbfcfe; }
.opt-group:first-of-type { margin-top: 4px; }
.opt-group-title { font-weight: 800; color: var(--navy); font-size: 0.95rem; padding-bottom: 8px; margin-bottom: 14px; border-bottom: 1px solid #e4eaf1; }
.opt-line { display: flex; align-items: flex-start; gap: 10px; cursor: pointer; color: var(--navy); }
.opt-line input[type="checkbox"] { width: 18px; height: 18px; flex: 0 0 auto; margin-top: 2px; cursor: pointer; }
.opt-line > span { display: flex; flex-direction: column; gap: 2px; }
.opt-line small { font-weight: 600; font-size: 0.78rem; line-height: 1.5; color: var(--muted); }

.packages-page {
    display: grid;
    gap: 18px;
}

.packages-page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    padding: 4px 2px 2px;
}

.packages-page-header .page-title {
    margin: 3px 0 5px;
    color: var(--navy);
    font-size: clamp(1.35rem, 2vw, 1.7rem);
}

.packages-page-header p {
    margin: 0;
    color: var(--text-secondary);
    font-size: 0.88rem;
    line-height: 1.6;
}

.packages-eyebrow {
    color: var(--solar-dark, #c96111);
    font-size: 0.73rem;
    font-weight: 800;
}

.packages-download-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    flex: 0 0 auto;
    min-height: 44px;
    padding: 10px 17px;
    font-weight: 700;
    white-space: nowrap;
}

.packages-error {
    margin: 0;
}

.packages-workspace {
    display: grid;
    grid-template-columns: minmax(0, 1.08fr) minmax(350px, 0.92fr);
    align-items: start;
    gap: 18px;
    min-width: 0;
}

.packages-editor-column {
    display: grid;
    gap: 14px;
    min-width: 0;
}

#packages-page-container .packages-card,
#packages-page-container .packages-preview-card,
#packages-page-container .packages-settings,
#packages-page-container .packages-breakdown-card {
    min-width: 0;
    margin: 0;
    padding: 18px;
    border: 1px solid var(--border);
    border-radius: 15px;
}

.packages-section-heading {
    display: flex;
    align-items: center;
    gap: 11px;
    min-width: 0;
}

.packages-section-heading > div:last-child {
    min-width: 0;
}

.packages-section-heading h3 {
    margin: 0;
    color: var(--navy);
    font-size: 1rem;
}

.packages-section-heading p {
    margin: 4px 0 0;
    color: var(--text-secondary);
    font-size: 0.78rem;
    line-height: 1.55;
}

.packages-step {
    display: inline-grid;
    place-items: center;
    width: 34px;
    height: 34px;
    flex: 0 0 34px;
    color: #fff;
    background: var(--navy);
    border-radius: 11px;
    font-size: 0.82rem;
    font-weight: 800;
}

.packages-card .pkg-rows {
    margin-top: 16px;
}

#packages-page-container .pkg-row {
    padding: 15px;
    background: var(--bg-alt);
    border-color: var(--border);
    border-radius: 12px;
}

#packages-page-container .pkg-row-head {
    gap: 10px;
    padding-bottom: 9px;
    border-bottom: 1px solid var(--border);
}

#packages-page-container .pkg-row .field {
    min-width: 0;
}

#packages-page-container .pkg-row input,
#packages-page-container .pkg-row select,
#packages-page-container .packages-settings input {
    min-width: 0;
    border-radius: 9px;
}

.packages-add-row-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    min-height: 40px;
    margin-top: 12px;
    padding: 8px 13px;
    font-weight: 700;
}

.packages-secondary-note {
    margin: 13px 0 0;
    padding: 10px 12px;
    background: var(--bg-alt);
    border: 1px solid var(--border-light);
    border-radius: 9px;
    font-size: 0.77rem;
    line-height: 1.6;
}

.packages-secondary-note b {
    color: var(--text);
}

#packages-page-container .packages-settings {
    padding: 0;
    overflow: visible;
}

.packages-settings-summary {
    display: flex;
    align-items: center;
    gap: 11px;
    min-height: 70px;
    padding: 14px 17px;
    list-style: none;
    cursor: pointer;
}

.packages-settings-summary::-webkit-details-marker {
    display: none;
}

.packages-settings-copy {
    display: grid;
    gap: 4px;
    min-width: 0;
    margin-inline-end: auto;
}

.packages-settings-copy b {
    color: var(--navy);
    font-size: 0.92rem;
}

.packages-settings-copy small {
    color: var(--text-secondary);
    font-size: 0.75rem;
}

.packages-settings-chevron {
    width: 9px;
    height: 9px;
    flex: 0 0 auto;
    margin-inline-end: 3px;
    border-inline-end: 2px solid var(--text-secondary);
    border-bottom: 2px solid var(--text-secondary);
    transform: rotate(45deg) translateY(-2px);
    transition: transform 0.16s ease;
}

.packages-settings[open] .packages-settings-chevron {
    transform: rotate(225deg) translate(-2px, -1px);
}

.packages-settings-content {
    padding: 0 17px 17px;
    border-top: 1px solid var(--border-light);
}

.packages-settings-content .opt-group {
    margin-top: 14px;
}

.packages-settings-content .opt-group:first-child {
    margin-top: 14px;
}

.packages-bank-buttons {
    gap: 8px;
    margin-top: 10px;
    flex-wrap: wrap;
}

.packages-bank-buttons .btn {
    min-height: 36px;
}

#packages-page-container .packages-breakdown-card {
    padding: 13px 16px;
}

.packages-preview-card {
    position: sticky;
    top: 16px;
    min-width: 0;
    padding: 20px !important;
}

.packages-preview-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 15px;
}

.packages-updating-indicator {
    flex: 0 0 auto;
    color: var(--text-secondary);
    font-size: 0.73rem;
}

.packages-preview-viewport {
    width: 100%;
    min-height: 180px;
    margin-inline: auto;
    overflow: hidden;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 12px;
    box-shadow: 0 3px 12px rgba(25, 45, 65, 0.08);
    transition: opacity 0.15s;
}

.packages-preview-content {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 180px;
}

.packages-preview-footnote {
    margin: 11px 0 0;
    color: var(--text-secondary);
    font-size: 0.73rem;
    text-align: center;
}

@media (max-width: 1000px) {
    .packages-workspace {
        grid-template-columns: minmax(0, 1fr);
    }

    .packages-preview-card {
        position: static;
    }
}

@media (max-width: 600px) {
    .packages-page {
        gap: 13px;
    }

    .packages-page-header {
        align-items: stretch;
        flex-direction: column;
        gap: 11px;
    }

    .packages-download-btn {
        width: 100%;
    }

    #packages-page-container .packages-card,
    #packages-page-container .packages-preview-card {
        padding: 14px !important;
        border-radius: 13px;
    }

    .packages-section-heading {
        align-items: flex-start;
        gap: 9px;
    }

    .packages-section-heading p {
        font-size: 0.74rem;
    }

    #packages-page-container .pkg-row {
        padding: 12px;
    }

    .packages-settings-summary {
        min-height: 64px;
        padding: 12px;
    }

    .packages-settings-content {
        padding: 0 12px 12px;
    }

    .packages-preview-card {
        padding: 16px 20px !important;
    }

    .packages-preview-heading {
        align-items: flex-start;
    }
}

/* Embedded Quote Calculator (EQC) */
.eqc-card {
    border-inline-start: 4px solid var(--gold);
    transition: box-shadow 0.25s ease;
}
.eqc-card:hover {
    box-shadow: 0 2px 12px rgba(26, 58, 92, 0.08);
}
.eqc-header:hover .eqc-hint {
    color: var(--navy);
}
#eqc-body {
    animation: eqcSlide 0.25s ease;
}
@keyframes eqcSlide {
    from { opacity: 0; transform: translateY(-6px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* Company profile settings */
.company-settings {
    padding: 22px;
}

.company-settings-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
    margin-bottom: 22px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border-light);
}

.company-settings-title {
    padding-bottom: 0;
    border-bottom: 0;
    color: var(--navy);
}

.company-settings-header > div:first-child > div:last-child {
    max-width: 720px;
    line-height: 1.8;
}

.company-settings-status {
    flex: 0 0 auto;
}

.company-settings-fields {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 4px 18px;
    margin-bottom: 18px;
}

.company-settings-fields .field {
    min-width: 0;
    margin-bottom: 12px;
}

.company-settings-fields .field label {
    color: var(--text-secondary);
    font-weight: 700;
}

.company-settings-fields input {
    min-height: 42px;
    border-radius: var(--radius-sm);
}

.company-settings-panel {
    margin-bottom: 16px;
    padding: 18px;
    border: 1px solid var(--border-light);
    border-radius: var(--radius-md);
    background: var(--bg-alt);
}

.company-settings-panel h4 {
    color: var(--navy);
}

.company-logo-content {
    display: flex;
    align-items: center;
    gap: 20px;
    flex-wrap: wrap;
}

#comp-logo-preview-box {
    flex: 0 0 auto;
    border-color: var(--border) !important;
    background: var(--card-bg) !important;
}

.company-notes-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.company-note-row {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
    padding: 4px;
    border: 1px solid var(--border-light);
    border-radius: var(--radius-sm);
    background: var(--card-bg);
}

.company-note-row .comp-note-idx {
    flex: 0 0 24px;
}

.company-note-row .comp-note-input {
    flex: 1;
    min-width: 0;
    padding: 9px 11px !important;
    border-radius: var(--radius-sm) !important;
}

.company-settings-actions {
    display: flex;
    justify-content: flex-start;
    gap: 10px;
    padding-top: 16px;
    border-top: 1px solid var(--border-light);
}

.company-settings-actions #save-company-bottom-btn {
    min-width: 220px;
    padding: 11px 22px;
    font-size: 0.95rem;
    font-weight: 700;
}

.company-settings-actions #cancel-company-btn {
    padding: 9px 18px;
    font-weight: 600;
}

@media (max-width: 640px) {
    .company-settings {
        padding: 16px;
    }

    .company-settings-fields {
        grid-template-columns: minmax(0, 1fr);
        gap: 0;
    }

    .company-settings-panel {
        padding: 14px;
    }

    .company-settings-actions {
        flex-direction: column;
    }

    .company-settings-actions .btn {
        width: 100%;
    }
}
