html, body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    margin: 0; padding: 0; height: 100%;
    background: #f5f5f5;
    color: #1a1a1a;
}

/* ── Shell ── */
.sd-shell { display: flex; height: 100vh; overflow: hidden; }
.sd-main  { flex: 1; display: flex; flex-direction: column; overflow: hidden; min-width: 0; }

/* ── Sidebar ── */
.sd-sidebar { width: 210px; background: #0F6E56; display: flex; flex-direction: column; flex-shrink: 0; }
.sd-logo { padding: 18px 16px 14px; border-bottom: 0.5px solid rgba(255,255,255,0.1); }
.sd-logo-name { font-size: 16px; font-weight: 500; color: #fff; }
.sd-logo-sub  { font-size: 11px; color: rgba(255,255,255,0.5); margin-top: 2px; }
.sd-nav { padding: 10px 8px; flex: 1; display: flex; flex-direction: column; gap: 1px; }
.sd-ni { display: flex; align-items: center; gap: 9px; padding: 8px 10px; border-radius: 8px;
         font-size: 13px; color: rgba(255,255,255,0.6); text-decoration: none; }
.sd-ni:hover, .sd-ni.active { background: rgba(255,255,255,0.12); color: #fff; }
.sd-ni svg { width: 15px; height: 15px; flex-shrink: 0; }
.sd-footer { padding: 10px 12px 12px; border-top: 0.5px solid rgba(255,255,255,0.1);
             display: flex; align-items: center; justify-content: space-between; gap: 6px; }
.sd-footer-name { font-size: 12px; font-weight: 500; color: rgba(255,255,255,0.75); }
.sd-footer-role { font-size: 10px; color: rgba(255,255,255,0.35); margin-top: 1px; }
.sd-logout-btn { background: none; border: none; cursor: pointer; padding: 5px;
                 border-radius: 6px; display: flex; align-items: center;
                 opacity: 0.6; transition: opacity 0.15s; flex-shrink: 0; }
.sd-logout-btn:hover { opacity: 1; background: rgba(255,255,255,0.1); }

/* ── Topbar ── */
.sd-topbar { padding: 12px 18px; border-bottom: 1px solid #e5e5e5; display: flex;
             align-items: center; justify-content: space-between; flex-shrink: 0; background: #fff; }
.sd-topbar-title { font-size: 15px; font-weight: 500; }
.sd-topbar-right { display: flex; align-items: center; gap: 8px; }
.sd-dot { width: 7px; height: 7px; border-radius: 50%; }
.dot-green { background: #1D9E75; } .dot-grey { background: #aaa; }
.sd-conn { font-size: 12px; color: #666; }

/* ── Stats bar ── */
.sd-stats { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 8px;
            padding: 12px 18px; border-bottom: 1px solid #e5e5e5; flex-shrink: 0; background: #fff; }
.sd-stat { background: #f9f9f9; border-radius: 8px; padding: 9px 11px; }
.sd-stat-l { font-size: 10px; color: #888; margin-bottom: 3px; }
.sd-stat-v { font-size: 19px; font-weight: 500; }
.sd-stat-v.green  { color: #0F6E56; }
.sd-stat-v.amber  { color: #BA7517; }
.sd-stat-v.purple { color: #534AB7; }

/* ── Body ── */
.sd-body { display: flex; flex: 1; overflow: hidden; }

/* ── Queue ── */
.sd-queue { width: 230px; border-right: 1px solid #e5e5e5; overflow-y: auto; flex-shrink: 0; background: #fff; }
.sd-qh { padding: 10px 13px 6px; font-size: 10px; font-weight: 500; color: #888;
         text-transform: uppercase; letter-spacing: .6px; }
.sd-oc { padding: 11px 13px; border-bottom: 1px solid #f0f0f0; cursor: pointer; }
.sd-oc:hover { background: #f9f9f9; }
.sd-oc.sel  { background: #E1F5EE; border-left: 2.5px solid #0F6E56; }
.sd-on { font-size: 13px; font-weight: 500; margin-bottom: 2px; }
.sd-om { font-size: 10px; color: #888; margin-bottom: 5px; }
.sd-ot { font-size: 10px; color: #888; float: right; margin-top: -16px; }

/* ── Pills ── */
.pill { display: inline-block; font-size: 11px; font-weight: 600; padding: 4px 10px; border-radius: 6px;
        letter-spacing: 0.3px; }
.pill-new { background: linear-gradient(135deg, #D4E8FF, #E6F1FB); color: #0C447C; }
.pill-rev { background: linear-gradient(135deg, #FFE8C8, #FAEEDA); color: #633806; }
.pill-rdy { background: linear-gradient(135deg, #D8F0C8, #EAF3DE); color: #27500A; }
.pill-del { background: linear-gradient(135deg, #E8E4FF, #EEEDFE); color: #3C3489; }
.pill-col { background: linear-gradient(135deg, #F5F5F5, #f0f0f0); color: #666; }

/* ── Detail panel ── */
/* ── Empty states ── */
.sd-empty { padding: 10px 13px; font-size: 11px; color: #bbb; font-style: italic; }
.sd-detail-empty { display: flex; flex-direction: column; align-items: center; gap: 10px;
                   color: #ccc; font-size: 12px; margin-top: 60px; }

.sd-detail { flex: 1; display: flex; flex-direction: column; overflow: hidden; background: #fff; }
.sd-chat-header { padding: 14px 18px; border-bottom: 1px solid #e5e5e5; flex-shrink: 0; background: #fff; }
.sd-chat-status { padding: 10px 18px; border-bottom: 1px solid #e5e5e5; flex-shrink: 0; background: #fff; }
.sd-chat-messages { flex: 1; overflow-y: auto; padding: 14px 18px; background: #ece5dd; display: flex; flex-direction: column; gap: 4px; }
.sd-chat-compose { border-top: 1px solid #e5e5e5; padding: 8px 18px; flex-shrink: 0; background: #f0f0f0; display: flex; gap: 8px; align-items: center; }
.sd-dh { display: flex; align-items: flex-start; justify-content: space-between; }
.sd-dn { font-size: 16px; font-weight: 500; }
.sd-dm { font-size: 11px; color: #888; margin-top: 3px; }

.sd-script-box { border: 1px solid #e5e5e5; border-radius: 10px; background: #f9f9f9;
                 padding: 13px; margin-bottom: 14px; display: flex; align-items: center; gap: 12px; }
.sd-thumb { width: 46px; height: 60px; background: #fff; border: 1px solid #e5e5e5;
            border-radius: 6px; display: flex; flex-direction: column; align-items: center;
            justify-content: center; gap: 4px; flex-shrink: 0; }
.tl { height: 3px; background: #e5e5e5; border-radius: 2px; }
.sd-si { flex: 1; }
.sd-st { font-size: 12px; font-weight: 500; margin-bottom: 3px; }
.sd-sd { font-size: 11px; color: #888; line-height: 1.5; }
.sd-vb { font-size: 11px; color: #0F6E56; border: 1px solid #1D9E75; border-radius: 6px;
         padding: 4px 10px; text-decoration: none; white-space: nowrap; }

.sd-sl { font-size: 10px; font-weight: 500; color: #888; text-transform: uppercase;
         letter-spacing: .6px; margin-bottom: 7px; }

.sd-status-rail { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 14px; }
.sd-sb { flex: 1; min-width: 60px; padding: 8px 6px; border-radius: 8px; font-size: 11px;
         font-weight: 500; cursor: pointer; border: 1px solid #e5e5e5;
         background: #f9f9f9; color: #666; text-align: center; }
.sd-sb:hover { background: #fff; color: #1a1a1a; }
.sd-sb.act  { background: #0F6E56; color: #fff; border-color: #0F6E56; }

/* ── Chat bubbles ── */
.chat-row { display: flex; flex-direction: column; max-width: 72%; }
.chat-row-in  { align-items: flex-start; align-self: flex-start; }
.chat-row-out { align-items: flex-end;   align-self: flex-end; }
.chat-bubble { padding: 8px 12px; border-radius: 12px; font-size: 13px; line-height: 1.45;
               word-break: break-word; box-shadow: 0 1px 2px rgba(0,0,0,0.1); }
.chat-bubble-in  { background: #fff; color: #1a1a1a; border-top-left-radius: 3px; }
.chat-bubble-out { background: #DCF8C6; color: #1a1a1a; border-top-right-radius: 3px; }
.chat-meta { display: flex; align-items: center; gap: 3px; margin-top: 2px; padding: 0 3px; }
.chat-time  { font-size: 10px; color: #999; }
.chat-ticks { display: flex; align-items: center; opacity: 0.7; }
.chat-img { max-width: 220px; max-height: 280px; border-radius: 8px; display: block; cursor: zoom-in; }

/* ── Lightbox ── */
.lightbox-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.85); z-index: 9999;
                    display: flex; align-items: center; justify-content: center; }
.lightbox-box { position: relative; max-width: 90vw; max-height: 90vh; }
.lightbox-img { max-width: 90vw; max-height: 88vh; border-radius: 8px; display: block;
                box-shadow: 0 8px 40px rgba(0,0,0,0.5); }
.lightbox-close { position: absolute; top: -14px; right: -14px; width: 30px; height: 30px;
                  border-radius: 50%; background: #fff; border: none; cursor: pointer;
                  font-size: 13px; font-weight: 600; display: flex; align-items: center;
                  justify-content: center; box-shadow: 0 2px 8px rgba(0,0,0,0.3); }

/* ── Message compose ── */
.sd-compose-input { flex: 1; border: 1px solid #e5e5e5; border-radius: 20px; padding: 8px 14px;
                    font-size: 13px; outline: none; font-family: inherit; background: #fff; }
.sd-compose-input:focus { border-color: #0F6E56; }
.sd-compose-input:disabled { background: #f9f9f9; }
.sd-compose-btn { width: 36px; height: 36px; border-radius: 50%; background: #0F6E56; color: #fff;
                  border: none; cursor: pointer; display: flex; align-items: center;
                  justify-content: center; flex-shrink: 0; }
.sd-compose-btn:hover:not(:disabled) { background: #0d5f49; }
.sd-compose-btn:disabled { opacity: 0.45; cursor: default; }
.sd-compose-err { font-size: 11px; color: #991B1B; padding: 4px 18px 6px; }

/* ── Login ── */
.login-shell { min-height: 100vh; display: flex; }

.login-left { width: 52%; background: linear-gradient(145deg, #0a5240 0%, #0F6E56 50%, #1a9470 100%);
              display: flex; align-items: center; justify-content: center; padding: 60px 56px;
              position: relative; overflow: hidden; }
.login-left::before { content: ''; position: absolute; top: -120px; right: -120px;
                       width: 400px; height: 400px; border-radius: 50%;
                       background: rgba(255,255,255,0.04); }
.login-left::after  { content: ''; position: absolute; bottom: -80px; left: -80px;
                       width: 300px; height: 300px; border-radius: 50%;
                       background: rgba(255,255,255,0.04); }
.login-left-inner { position: relative; z-index: 1; max-width: 380px; }

.login-brand { display: flex; align-items: center; gap: 10px; margin-bottom: 56px; }
.login-brand-icon { width: 44px; height: 44px; border-radius: 10px;
                    background: rgba(255,255,255,0.12); display: flex;
                    align-items: center; justify-content: center; }
.login-brand-name { font-size: 20px; font-weight: 600; color: #fff; letter-spacing: -0.3px; }

.login-tagline h1 { font-size: 42px; font-weight: 700; color: #fff; line-height: 1.15;
                    letter-spacing: -1px; margin: 0 0 16px; }
.login-tagline p  { font-size: 15px; color: rgba(255,255,255,0.65); line-height: 1.6;
                    margin: 0 0 40px; }

.login-features { display: flex; flex-direction: column; gap: 12px; }
.login-feat { display: flex; align-items: center; gap: 10px;
              font-size: 13px; color: rgba(255,255,255,0.75); }
.login-feat-dot { width: 6px; height: 6px; border-radius: 50%;
                  background: rgba(255,255,255,0.5); flex-shrink: 0; }

.login-right { flex: 1; display: flex; align-items: center; justify-content: center;
               background: #fafafa; padding: 60px 48px; }
.login-form-wrap { width: 100%; max-width: 360px; }

.login-form-header { margin-bottom: 32px; }
.login-form-header h2 { font-size: 26px; font-weight: 700; color: #111; margin: 0 0 6px;
                         letter-spacing: -0.5px; }
.login-form-header p  { font-size: 14px; color: #888; margin: 0; }

.login-error { background: #FEF2F2; color: #991B1B; font-size: 13px; border: 1px solid #FECACA;
               padding: 10px 14px; border-radius: 8px; margin-bottom: 20px;
               display: flex; align-items: flex-start; gap: 8px; }
.login-field { margin-bottom: 18px; }
.login-field label { display: block; font-size: 12px; font-weight: 600;
                     color: #444; margin-bottom: 6px; letter-spacing: 0.2px; }
.login-field input { width: 100%; padding: 11px 14px; border: 1.5px solid #e5e5e5;
                     border-radius: 10px; font-size: 14px; outline: none;
                     box-sizing: border-box; background: #fff; color: #111;
                     transition: border-color 0.15s; }
.login-field input:focus { border-color: #0F6E56; box-shadow: 0 0 0 3px rgba(15,110,86,0.08); }
.login-field input::placeholder { color: #bbb; }
.login-password-wrap { position: relative; }
.login-password-wrap input { padding-right: 42px; }
.login-password-toggle { position: absolute; right: 10px; top: 50%; transform: translateY(-50%);
                          background: none; border: none; cursor: pointer; padding: 4px;
                          color: #999; display: flex; align-items: center; }
.login-password-toggle:hover { color: #0F6E56; }
.login-btn { width: 100%; padding: 12px 20px; background: #0F6E56; color: #fff;
             border: none; border-radius: 10px; font-size: 14px; font-weight: 600;
             cursor: pointer; margin-top: 6px; display: flex; align-items: center;
             justify-content: center; gap: 8px; transition: background 0.15s, transform 0.1s; }
.login-btn:hover            { background: #0a5240; }
.login-btn:active           { transform: scale(0.99); }
.login-btn:disabled         { background: #0a5240; opacity: 0.75; cursor: not-allowed; }
.login-spinner { width: 16px; height: 16px; border: 2px solid rgba(255,255,255,0.35);
                 border-top-color: #fff; border-radius: 50%; animation: spin 0.7s linear infinite; flex-shrink: 0; }

@media (max-width: 768px) {
    .login-left  { display: none; }
    .login-right { padding: 40px 24px; }
}

/* ── Filter tab bar ── */
.sd-tab-bar { display: flex; gap: 2px; padding: 0 18px; border-bottom: 1px solid #e5e5e5;
              background: #fff; flex-shrink: 0; }
.sd-tab { padding: 9px 12px; font-size: 12px; color: #888; background: none; border: none;
          cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px;
          display: flex; align-items: center; gap: 5px; white-space: nowrap; }
.sd-tab:hover { color: #444; }
.sd-tab.active { color: #0F6E56; border-bottom-color: #0F6E56; font-weight: 500; }
.sd-tab-badge { font-size: 10px; background: #f0f0f0; color: #888; border-radius: 10px;
                padding: 1px 6px; font-weight: 400; }
.sd-tab.active .sd-tab-badge { background: #E1F5EE; color: #0F6E56; }

/* ── Misc detail states ── */
.sd-no-asset { font-size: 12px; color: #bbb; font-style: italic; margin-bottom: 14px; }
.sd-spinner { width: 20px; height: 20px; border: 2px solid #e5e5e5; border-top-color: #0F6E56;
              border-radius: 50%; animation: spin 0.7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Search bar ── */
.sd-search-bar { display: flex; flex-direction: column; gap: 12px; padding: 16px 18px;
                 border-bottom: 1px solid #e8e8e8; background: #fff; }
.sd-search-input-wrap { position: relative; display: flex; align-items: center; }
.sd-search-icon { position: absolute; left: 12px; color: #999; flex-shrink: 0;
                  pointer-events: none; }
.sd-search-input { flex: 1; padding: 11px 16px 11px 38px; border: 1.5px solid #e0e0e0;
                   border-radius: 10px; font-size: 14px; outline: none;
                   background: #f8f9fa; color: #1a1a1a; font-family: inherit;
                   transition: all 0.2s ease; }
.sd-search-input:focus { border-color: #0F6E56; background: #fff;
                        box-shadow: 0 0 0 3px rgba(15,110,86,0.08); }
.sd-search-input::placeholder { color: #aaa; }
.sd-search-clear { position: absolute; right: 12px; background: none; border: none;
                   cursor: pointer; padding: 4px; display: flex; align-items: center;
                   color: #999; transition: color 0.2s ease; flex-shrink: 0; }
.sd-search-clear:hover { color: #666; }
.sd-search-results { font-size: 12px; color: #888; font-weight: 500; margin-left: 2px; }

/* ── Customers page ── */
.sd-cust-shell { flex: 1; overflow-y: auto; background: #fff; }
.sd-cust-list { padding: 0; }
.sd-cust-row { display: flex; align-items: center; gap: 14px; padding: 14px 18px;
               cursor: pointer; border-bottom: 1px solid #f0f0f0; transition: all 0.15s ease;
               position: relative; }
.sd-cust-row::before { content: ''; position: absolute; left: 0; top: 0; bottom: 0;
                       width: 3px; background: transparent; transition: background 0.15s ease; }
.sd-cust-row:hover { background: #f8f9fa; }
.sd-cust-row:hover::before { background: #0F6E56; }
.sd-cust-row.expanded { background: #f8f9fa; }
.sd-cust-row.expanded::before { background: #0F6E56; }
.sd-cust-avatar { width: 42px; height: 42px; border-radius: 50%; background: linear-gradient(135deg, #0F6E56, #1D9E75);
                  color: #fff; font-size: 13px; font-weight: 600;
                  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
                  box-shadow: 0 2px 8px rgba(15,110,86,0.15); }
.sd-cust-info { flex: 1; min-width: 0; }
.sd-cust-name { font-size: 14px; font-weight: 600; color: #1a1a1a; }
.sd-cust-phone { font-size: 12px; color: #999; margin-top: 2px; }
.sd-cust-meta { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }
.sd-cust-count { font-size: 12px; color: #999; font-weight: 500; }
.sd-cust-time { font-size: 11px; color: #bbb; min-width: 60px; text-align: right; }
.sd-cust-chevron { transition: transform 0.2s ease; flex-shrink: 0; color: #999;
                   display: flex; align-items: center; }
.sd-cust-chevron.open { transform: rotate(180deg); }
.sd-cust-orders { border-bottom: 1px solid #f0f0f0; background: #f8f9fa; padding: 8px 18px 8px 72px; }
.sd-co-row { display: flex; align-items: center; gap: 12px; padding: 8px 0;
             border-bottom: 1px solid #f0f0f0; }
.sd-co-row:last-child { border-bottom: none; }
.sd-co-date { font-size: 12px; color: #999; flex: 1; }

/* ── Deliveries page ── */
.sd-del-shell { flex: 1; overflow-y: auto; padding: 16px 18px; background: #f8f8f8; }
.sd-del-badge { background: #EEEDFE; color: #3C3489; font-size: 11px; font-weight: 500;
                padding: 3px 10px; border-radius: 10px; }
.sd-del-section-label { font-size: 10px; font-weight: 500; color: #888;
                         text-transform: uppercase; letter-spacing: .6px; margin-bottom: 10px; }
.sd-del-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 10px;
               margin-bottom: 4px; }
.sd-del-card { background: #fff; border: 1px solid #e8e8e8; border-radius: 10px; padding: 14px;
               display: flex; flex-direction: column; gap: 10px; }
.sd-del-card-done { opacity: 0.65; }
.sd-del-card-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; }
.sd-del-name { font-size: 14px; font-weight: 500; }
.sd-del-phone { font-size: 11px; color: #888; margin-top: 2px; }
.sd-del-script { }
.sd-del-footer { display: flex; align-items: center; justify-content: space-between;
                 border-top: 1px solid #f5f5f5; padding-top: 10px; }
.sd-del-time { font-size: 11px; color: #bbb; }
.sd-del-collect-btn { display: flex; align-items: center; gap: 0; padding: 6px 12px;
                      background: #0F6E56; color: #fff; border: none; border-radius: 7px;
                      font-size: 11px; font-weight: 500; cursor: pointer; }
.sd-del-collect-btn:hover { background: #0d5f49; }
.sd-del-collect-btn:disabled { opacity: 0.6; cursor: default; }

.blazor-error-boundary {
    background: #b32121;
    padding: 1rem 1rem 1rem 1.5rem;
    color: white;
    font-size: 13px;
}
.blazor-error-boundary::after { content: "An error has occurred." }