body.auth-loading > .app-header,
body.auth-loading > .shell,
body.unauthenticated > .app-header,
body.unauthenticated > .shell { visibility: hidden; }

body.auth-loading,
body.unauthenticated { overflow: hidden; }

.login-screen {
  position: fixed;
  inset: 0;
  z-index: 300;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(circle at 18% 12%, rgba(60,198,240,.13), transparent 32%),
    radial-gradient(circle at 86% 82%, rgba(0,177,199,.08), transparent 28%),
    linear-gradient(145deg, #F4F9FD 0%, #F6F9FC 52%, #EAF4FA 100%);
}

body.authenticated .login-screen { display: none; }

.login-card {
  width: min(430px, 100%);
  padding: 34px 36px 28px;
  background: rgba(255,255,255,.96);
  border: 1px solid rgba(13,43,69,.12);
  border-radius: 22px;
  box-shadow: 0 28px 80px rgba(13,43,69,.10);
}

.login-brand { display: flex; align-items: center; gap: 12px; margin-bottom: 30px; }
.login-brand b { display: block; font-size: 19px; }
.login-brand span { display: block; color: var(--muted); font-size: 11px; margin-top: 2px; letter-spacing: .7px; }
.login-eyebrow { color: var(--pv); font-weight: 850; font-size: 10px; letter-spacing: 2px; }
.login-card h1 { font-size: 29px; margin: 8px 0 8px; letter-spacing: -.8px; }
.login-card > p { color: var(--muted); font-size: 13px; line-height: 1.6; margin: 0 0 24px; }
.login-card form { display: grid; gap: 14px; }
.login-submit { width: 100%; padding: 12px 15px; margin-top: 3px; }
.login-error { color: var(--danger); font-size: 12px; min-height: 18px; text-align: center; }
.login-foot { margin-top: 20px; padding-top: 18px; border-top: 1px solid var(--line); color: #64748B; font-size: 9px; text-align: center; letter-spacing: .5px; }

.header-actions { align-items: center; overflow-x: auto; padding: 5px 0; }
.user-chip { display: flex; align-items: center; gap: 7px; min-width: max-content; padding-right: 10px; border-right: 1px solid var(--line); }
.user-chip b, .user-chip small { display: block; }
.user-chip b { font-size: 11px; max-width: 110px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-chip small { font-size: 9px; color: var(--muted); margin-top: 1px; }
.user-avatar { width: 29px; height: 29px; border-radius: 9px; display: grid; place-items: center; background: var(--pv3); color: var(--pv); font-size: 10px; font-weight: 900; }
.icon-btn { color: #7b4848; }
.order-shipping-export { background: #1f4e78; border-color: #1f4e78; color: #fff; box-shadow: 0 4px 12px rgba(31,78,120,.18); }
.order-shipping-export:hover { background: #173b5c; border-color: #173b5c; }
.btn:disabled, .mini:disabled { opacity: .48; cursor: not-allowed; }
body:not(.role-admin) .role-admin { display: none; }
body.role-admin .role-admin { display: inline-flex; }
.history-scope { width: 170px; padding: 7px 9px; display: none; }
body.can-view-all .history-scope { display: inline-block; }

.um-overlay { position: fixed; inset: 0; z-index: 84; display: none; background: rgba(13,43,69,.38); }
.um-overlay.open { display: block; }
.um-drawer { position: absolute; top: 0; right: 0; width: min(760px, 96vw); height: 100%; background: #F6F9FC; border-left: 1px solid var(--line); box-shadow: -18px 0 50px rgba(13,43,69,.16); display: flex; flex-direction: column; }
.um-head { padding: 17px 18px; background: #fff; border-bottom: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; }
.um-head h2 { margin: 0; font-size: 17px; }
.um-sub { color: var(--muted); font-size: 11px; margin-top: 3px; }
.um-create { background: #fff; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.um-create h3 { font-size: 12px; margin: 0 0 9px; color: var(--pv); }
.um-create-grid { display: grid; grid-template-columns: 1fr 1.25fr 105px 1.25fr auto; gap: 8px; }
.um-list { padding: 13px 18px 24px; overflow: auto; display: grid; gap: 8px; }
.um-row { background: #fff; border: 1px solid var(--line); border-radius: 11px; padding: 11px; display: grid; grid-template-columns: minmax(160px,1fr) 115px 92px auto; align-items: center; gap: 10px; }
.um-name { font-size: 13px; font-weight: 850; }
.um-email { color: var(--muted); font-size: 10.5px; margin-top: 2px; }
.um-actions { display: flex; gap: 6px; justify-content: flex-end; }
.cart-actions { align-items: center; flex-wrap: wrap; }
.cart-charge { text-align: right; }
.gift-saving { margin-top: 2px; color: #9a6b00; font-size: 10px; font-weight: 750; }
.complimentary-control { display: flex; align-items: center; gap: 7px; padding: 4px 7px; border: 1px solid #E2E8F0; border-radius: 8px; color: var(--muted); font-size: 11px; }
.complimentary-control.active { border-color: #e4c75e; background: #fff9e5; color: #705a00; }
.complimentary-control b { white-space: nowrap; font-size: 10.5px; }
.gift-qty { width: 108px; height: 30px; background: #fff; }
.active-dot { display: inline-block; width: 7px; height: 7px; border-radius: 99px; background: #29a365; margin-right: 5px; }
.active-dot.off { background: #CBD5E1; }
.role-pill { display: inline-block; border-radius: 999px; padding: 4px 8px; background: var(--pv3); color: var(--pv); font-size: 10px; font-weight: 800; }

.notice { max-width: min(420px, calc(100vw - 44px)); }
.notice.error { background: #9b3f3f; }
.saving { opacity: .7; pointer-events: none; }

@media(max-width:1500px) {
  .brand-sub { display: none; }
  .app-header { padding: 0 12px; }
  .header-actions { gap: 5px; }
  .header-actions .btn { padding: 8px 9px; font-size: 11px; }
  .save-state { display: none; }
}

@media(max-width:850px) {
  .app-header { height: auto; min-height: 66px; align-items: flex-start; gap: 8px; padding-top: 10px; padding-bottom: 8px; }
  .brand-title { font-size: 14px; }
  .logo-mark { width: 34px; height: 34px; }
  .header-actions { flex-wrap: wrap; overflow: visible; justify-content: flex-end; }
  .user-chip { display: none; }
  .um-create-grid { grid-template-columns: 1fr 1fr; }
  .um-row { grid-template-columns: 1fr 90px; }
  .um-row .um-status { display: none; }
}

@media(max-width:520px) {
  .login-card { padding: 28px 22px 22px; }
  .login-card h1 { font-size: 25px; }
  .brand { display: none; }
  .header-actions { width: 100%; justify-content: flex-start; }
  .um-create-grid { grid-template-columns: 1fr; }
}

/* Velnacor visual identity. The supplied logo is kept intact. */
:root {
  --navy: #0D2B45;
  --button-navy: #0F3B57;
  --teal: #00B1C7;
  --cyan: #3CC6F0;
  --blue: #008ACB;
  --pv: var(--button-navy);
  --pv2: var(--teal);
  --pv3: #EAF7FB;
  --ink: #0F172A;
  --muted: #64748B;
  --line: #E2E8F0;
  --bg: #F6F9FC;
}
body { -webkit-font-smoothing: antialiased; }
a { color: var(--button-navy); }
button, a, input, select, textarea { -webkit-tap-highlight-color: transparent; }
button:focus-visible, a:focus-visible { outline: 3px solid var(--cyan); outline-offset: 3px; }
.btn, .mini, .chip, .add-btn { transition: background .15s, border-color .15s, box-shadow .15s; }
.btn.primary, .add-btn { background: var(--button-navy); border-color: var(--button-navy); }
.btn.primary:hover, .add-btn:hover { background: var(--navy); border-color: var(--navy); }
.btn.dark { background: var(--navy); border-color: var(--navy); }
.btn.dark:hover { background: #163E5C; border-color: #163E5C; }
.btn:not(.primary):not(.dark):not(.order-shipping-export):hover { background: #F0F8FC; border-color: #BCD5E3; }
.input:focus { border-color: var(--teal); box-shadow: 0 0 0 3px rgba(0,177,199,.12); }
.brand-lockup { display: block; position: relative; overflow: hidden; flex: 0 0 auto; }
.brand-lockup img { position: absolute; display: block; max-width: none; height: auto; }
.header-logo { width: 175px; height: 37px; }
.header-logo img { width: 190px; left: -7px; top: -15px; }
.app-header { min-height: 74px; height: auto; gap: 20px; padding: 10px 22px; box-shadow: 0 2px 12px rgba(13,43,69,.025); }
.brand { gap: 16px; flex: 0 0 auto; }
.brand-caption { padding-left: 16px; border-left: 1px solid var(--line); }
.brand-title { font-size: 14px; font-weight: 750; color: var(--navy); white-space: nowrap; }
.brand-sub { font-size: 9px; letter-spacing: 1.25px; margin-top: 5px; }
.header-actions { min-width: 0; }
.header-actions .btn { white-space: nowrap; }
.quick-row .btn { white-space: nowrap; flex-shrink: 0; }
.user-avatar { border: 1px solid #D5EAF1; }
.shell { grid-template-columns: minmax(370px, 420px) minmax(0, 1fr); gap: 20px; padding: 20px; }
.panel { min-width: 0; border-radius: 14px; box-shadow: 0 5px 20px rgba(13,43,69,.035); }
.left { max-height: calc(100vh - 114px); scrollbar-width: thin; scrollbar-color: #CBD5E1 transparent; }
.section { padding: 18px; }
.section-title { color: var(--navy); letter-spacing: .1px; }
.step { background: #EFF7FC; border: 1px solid #D5EAF1; color: var(--navy); border-radius: 50%; }
.result { background: #fff; border-radius: 9px; }
.result:hover { background: #F4FAFD; }
.sku { color: #006A95; }
.cart-item { box-shadow: 0 2px 6px rgba(13,43,69,.025); }
.calc-box { background: #F2F8FC; }
.calc-line.total { color: var(--navy); }
.preview-panel { top: 94px; padding: 16px; }
.preview-toolbar { gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.preview-toolbar > div:first-child > b { font-size: 14px; color: var(--navy); }
.preview-toolbar .right-actions { flex-wrap: wrap; gap: 7px; }
.preview-toolbar .btn { font-size: 11px; padding: 8px 10px; }
.order-shipping-export { background: #fff; border-color: #B8D7E6; color: var(--button-navy); box-shadow: none; }
.order-shipping-export:hover { background: #EAF7FB; border-color: #92BED3; color: var(--navy); }
.quote-stage { padding: 16px; background: #EAF0F6; border: 1px solid #E2E8F0; }
.quote { color: var(--ink); box-shadow: 0 6px 24px rgba(13,43,69,.09); }
.quote-top { padding: 26px 42px 22px; border-top: 5px solid var(--navy); border-bottom: 3px solid var(--teal); }
.q-head { align-items: center; gap: 22px; }
.q-brand { display: block; }
.quote-logo { width: 276px; height: 60px; }
.quote-logo img { width: 300px; left: -12px; top: -23px; }
.q-tag { color: var(--muted); font-size: 8px; letter-spacing: 1.35px; margin-top: 2px; }
.q-title h1 { color: var(--navy); font-size: 27px; font-weight: 700; letter-spacing: 2px; }
.q-title p { color: var(--muted); font-size: 10px; margin-top: 9px; }
.q-pills { justify-content: space-between; gap: 10px; padding: 12px 42px; background: #F1F8FC; color: var(--button-navy); font-size: 10px; }
.q-body { padding-top: 26px; }
.meta-title { color: var(--navy); font-size: 11px; letter-spacing: .5px; margin-bottom: 6px; }
.meta-row { padding: 1px 0; }
.meta-row span { overflow-wrap: anywhere; }
.quote th { background: var(--navy); padding-top: 12px; padding-bottom: 12px; }
.quote td { padding-top: 12px; padding-bottom: 12px; }
.quote tbody tr:nth-child(even) { background: #F6F9FC; }
.sum-row { padding: 8px 10px; }
.sum-row.total { border-top: 2px solid var(--teal); background: #EAF7FB; color: var(--navy); padding-top: 10px; padding-bottom: 10px; }
.sum-row.balance { background: var(--navy); padding-top: 10px; padding-bottom: 10px; }
.terms { border-top: 1px solid #C9D9E5; margin-top: 28px; padding-top: 14px; }
.terms h3 { color: var(--navy); font-size: 11px; letter-spacing: .9px; }
.term-row { line-height: 1.5; }
.q-footer { display: flex; justify-content: space-between; gap: 14px; margin-top: 20px; text-align: left; color: var(--muted); letter-spacing: .1px; }
.q-footer a { font-weight: 700; text-decoration: none; color: var(--navy); }
.login-screen { background: radial-gradient(ellipse at 12% 18%, rgba(60,198,240,.12), transparent 42%), radial-gradient(ellipse at 92% 85%, rgba(0,177,199,.09), transparent 38%), #F6F9FC; overflow: auto; }
.login-screen::before { content: ''; position: absolute; width: 390px; height: 390px; border: 1px solid #D6E6F0; border-radius: 50%; left: calc(50% - 385px); top: calc(50% - 340px); pointer-events: none; }
.login-screen::after { content: ''; position: absolute; width: 510px; height: 510px; border: 1px solid #E1EDF4; border-radius: 50%; right: calc(50% - 400px); bottom: calc(50% - 370px); pointer-events: none; }
.login-card { position: relative; z-index: 1; width: min(448px, 100%); padding: 38px 40px 28px; border: 1px solid #DFE8F0; border-top: 4px solid var(--navy); border-radius: 18px; background: #fff; box-shadow: 0 24px 70px rgba(13,43,69,.08); }
.login-brand { width: fit-content; margin-bottom: 34px; text-decoration: none; }
.login-brand .brand-lockup { width: 257px; height: 56px; }
.login-brand .brand-lockup img { width: 280px; top: -23px; left: -11px; }
.login-eyebrow { color: #007D9A; font-size: 9px; letter-spacing: 1.8px; }
.login-card h1 { color: var(--navy); margin-top: 12px; margin-bottom: 12px; font-size: 28px; letter-spacing: .1px; }
.login-card > p { font-size: 12px; line-height: 1.8; margin-bottom: 28px; }
.login-card .field { gap: 7px; }
.login-card .field label { color: #475569; font-size: 12px; }
.login-card .input { min-height: 43px; }
.login-submit { border-radius: 9px; margin-top: 6px; min-height: 45px; }
.login-foot { margin-top: 16px; padding-top: 20px; }
.login-foot span { display: block; font-size: 12px; color: var(--navy); letter-spacing: .2px; }
.login-foot small { display: block; margin-top: 9px; font-size: 8px; letter-spacing: .2px; }
@media(max-width:1500px) {
  .brand-caption { display: none; }
  .app-header { gap: 12px; padding-left: 18px; padding-right: 18px; }
  .header-actions .btn { padding: 8px 9px; }
}
@media(max-width:1260px) {
  .shell { grid-template-columns: minmax(340px, 380px) minmax(0, 1fr); padding: 16px; gap: 16px; }
  .section { padding: 16px; }
  .header-logo { width: 150px; height: 34px; }
  .header-logo img { width: 163px; left: -6px; top: -12px; }
  .user-chip { display: none; }
}
@media(max-width:1050px) {
  .shell { grid-template-columns: 1fr; }
  .left { max-height: none; }
  .preview-panel { position: static; }
  .app-header { align-items: flex-start; }
  .header-actions { flex-wrap: wrap; overflow: visible; justify-content: flex-end; }
}
@media(max-width:640px) {
  .app-header { padding: 12px 14px; gap: 10px; flex-wrap: wrap; }
  .brand { display: flex; }
  .header-logo { width: 161px; }
  .header-logo img { width: 176px; top: -14px; }
  .header-actions { width: 100%; justify-content: flex-start; gap: 6px; }
  .header-actions .btn { font-size: 11px; }
  .shell { padding: 10px; gap: 12px; }
  .section { padding: 15px; }
  .preview-panel { padding: 12px; }
  .preview-toolbar { gap: 10px; }
  .preview-toolbar .right-actions { gap: 6px; }
  .cart-grid { grid-template-columns: 104px minmax(0, 1fr) 70px; }
  .login-screen { padding: 18px; }
  .login-card { padding: 30px 26px 24px; }
  .login-brand { margin-bottom: 27px; }
  .login-brand .brand-lockup { width: 230px; height: 51px; }
  .login-brand .brand-lockup img { width: 252px; top: -20px; }
}
@media print {
  .app-header, .left, .preview-toolbar { display: none; }
  .shell { display: block; padding: 0; }
  .preview-panel, .panel, .quote-stage { padding: 0; border: 0; box-shadow: none; background: #fff; }
  .quote { box-shadow: none; }
  .quote-top { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}

/* Quote ownership controls use the same compact drawer layout. */
[hidden] { display: none !important; }
.history-drawer { width: min(680px, 96vw); }
.history-search { grid-template-columns: minmax(0, 1fr) 195px; }
.history-owner-filters { display: grid; grid-template-columns: minmax(140px, .8fr) minmax(0, 1.2fr); gap: 8px; margin-top: 10px; }
.history-owner-filters .input, .history-owner-filters .history-scope { width: 100%; }
.history-owner-filters .input:disabled { background: #F1F5F9; color: var(--muted); }
.history-bulk-tools { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 10px 11px; margin-top: 11px; border: 1px solid #D9EAF3; border-radius: 8px; background: #F2F8FC; }
.history-bulk-tools .mini { margin-left: auto; background: #fff; }
.selection-control { display: inline-flex; align-items: center; gap: 6px; font-size: 11px; color: var(--navy); cursor: pointer; }
.selection-control input, .record-selection input { accent-color: var(--button-navy); width: 15px; height: 15px; margin: 0; cursor: pointer; }
.record-heading { display: flex; gap: 9px; min-width: 0; }
.record-heading > div { min-width: 0; }
.record-selection { padding-top: 3px; flex: 0 0 auto; }
.record-customer, .record-meta, .record-note { overflow-wrap: anywhere; }
.record-top > div:last-child { flex-shrink: 0; }
.record-buttons .mini { white-space: nowrap; }
.status-pill { white-space: nowrap; line-height: 1.6; }
.assignment-overlay { position: fixed; inset: 0; z-index: 90; display: grid; place-items: center; padding: 20px; background: rgba(13,43,69,.42); }
.assignment-dialog { width: min(460px, 100%); max-height: calc(100vh - 40px); overflow: auto; padding: 23px; background: #fff; border: 1px solid var(--line); border-radius: 15px; box-shadow: 0 20px 70px rgba(13,43,69,.2); }
.assignment-head { display: flex; justify-content: space-between; align-items: center; gap: 14px; }
.assignment-head h2 { margin: 0; color: var(--navy); font-size: 17px; }
.assignment-dialog > p { color: var(--muted); font-size: 12px; line-height: 1.7; margin: 15px 0; overflow-wrap: anywhere; }
.assignment-dialog > p.hint { font-size: 11px; }
.assignment-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 22px; }
.um-row { grid-template-columns: minmax(0, 1fr) auto auto; }
.um-actions { grid-column: 1 / -1; justify-content: flex-start; flex-wrap: wrap; }
.um-email { overflow-wrap: anywhere; }
.um-delete-note { padding: 12px 18px; font-size: 11px; color: var(--muted); line-height: 1.7; background: #F2F8FC; border-bottom: 1px solid var(--line); }
@media(max-width:520px) {
  .history-head, .history-tools { padding-left: 14px; padding-right: 14px; }
  .history-search { grid-template-columns: minmax(0, 1fr); }
  .history-owner-filters { grid-template-columns: minmax(0, .85fr) minmax(0, 1.15fr); }
  .history-owner-filters .input { font-size: 11px; padding-left: 7px; padding-right: 7px; }
  .history-list { padding-left: 12px; padding-right: 12px; }
  .history-bulk-tools { gap: 8px; }
  .history-bulk-tools .mini { margin-left: 0; }
  .record-top { gap: 8px; }
  .record-total { font-size: 14px; }
  .record-date { max-width: 104px; line-height: 1.5; }
  .record-heading .status-pill { margin-top: 4px; }
  .um-row { grid-template-columns: minmax(0, 1fr) auto; }
}
@media print { .assignment-overlay { display: none !important; } }
