/* ===================================================================
   User card (header) + My Preferences + Billing Session windows.
   Blue clinical theme, matching the shell header gradient.
   =================================================================== */
:root {
    --uc-blue: #1565c0;
    --uc-blue-2: #1976d2;
    --uc-blue-soft: #e8f1fc;
    --uc-ink: #1f2937;
    --uc-muted: #6b7a90;
    --uc-line: #e3e9f2;
    --uc-red: #d32f2f;
    --uc-green: #2e7d32;
}

/* ── Trigger in the header ───────────────────────────────────────── */
.uc { position: relative; }
.uc-trigger {
    display: flex; align-items: center; gap: 8px;
    height: 38px; padding: 0 10px 0 4px;
    border: 1px solid rgba(255,255,255,.25); border-radius: 20px;
    background: rgba(255,255,255,.12); color: #fff; cursor: pointer;
    transition: background .15s;
}
.uc-trigger:hover, .uc.open .uc-trigger { background: rgba(255,255,255,.24); }
.uc-avatar {
    width: 30px; height: 30px; border-radius: 50%;
    display: grid; place-items: center; flex-shrink: 0;
    background: #fff; color: var(--uc-blue); font-weight: 700; font-size: .8rem; letter-spacing: .5px;
}
.uc-trigger-text { display: flex; flex-direction: column; align-items: flex-start; line-height: 1.1; max-width: 190px; }
.uc-trigger-text b { font-size: .82rem; font-weight: 600; }
.uc-trigger-text small { font-size: .7rem; opacity: .8; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 190px; }
.uc-chev { width: 14px; height: 14px; filter: brightness(0) invert(1); opacity: .8; transition: transform .15s; }
.uc.open .uc-chev { transform: rotate(180deg); }

/* ── Drop-down card ──────────────────────────────────────────────── */
.uc-backdrop { position: fixed; inset: 0; z-index: 900; }
.uc-card {
    position: absolute; right: 0; top: calc(100% + 10px); z-index: 901;
    width: 340px; max-width: calc(100vw - 24px);
    background: #fff; color: var(--uc-ink);
    border-radius: 12px; overflow: hidden;
    box-shadow: 0 12px 32px rgba(15, 40, 80, .22), 0 2px 6px rgba(15, 40, 80, .12);
    animation: uc-pop .14s ease-out;
}
.uc-card::before {
    content: ""; position: absolute; top: -6px; right: 26px; width: 12px; height: 12px;
    background: var(--uc-blue-2); transform: rotate(45deg);
}
@keyframes uc-pop { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }
.uc-card-head {
    position: relative; display: flex; gap: 12px; align-items: center;
    padding: 16px; color: #fff;
    background: linear-gradient(135deg, #1565c0 0%, #1976d2 60%, #2196f3 100%);
}
.uc-card-head .uc-avatar { width: 48px; height: 48px; font-size: 1.05rem; box-shadow: 0 0 0 3px rgba(255,255,255,.35); }
.uc-card-head b { display: block; font-size: 1rem; }
.uc-card-head small { display: block; font-size: .75rem; opacity: .85; word-break: break-all; }
.uc-rows { padding: 8px 16px; }
.uc-row { display: grid; grid-template-columns: 22px 72px 1fr; align-items: center; gap: 6px; padding: 7px 0; border-bottom: 1px solid var(--uc-line); font-size: .82rem; }
.uc-row:last-child { border-bottom: none; }
.uc-row img { width: 16px; height: 16px; opacity: .55; }
.uc-row span { color: var(--uc-muted); }
.uc-row strong { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.uc-row strong.none { color: var(--uc-muted); font-weight: 400; font-style: italic; }
.uc-actions { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; padding: 12px 16px 16px; background: #f7f9fc; border-top: 1px solid var(--uc-line); }
.uc-actions form { display: contents; }
.uc-action {
    display: flex; flex-direction: column; align-items: center; gap: 5px;
    padding: 10px 4px; border: 1px solid var(--uc-line); border-radius: 10px;
    background: #fff; color: var(--uc-ink); font-size: .74rem; font-weight: 600; cursor: pointer;
    transition: border-color .15s, box-shadow .15s, transform .1s;
}
.uc-action:hover { border-color: var(--uc-blue-2); box-shadow: 0 2px 8px rgba(21,101,192,.15); }
.uc-action:active { transform: translateY(1px); }
.uc-action i { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; background: var(--uc-blue-soft); }
.uc-action i img { width: 18px; height: 18px; }
.uc-action.billing i { background: #e8f5e9; }
.uc-action.logout { color: var(--uc-red); }
.uc-action.logout i { background: #fdecea; }
.uc-action.logout:hover { border-color: var(--uc-red); box-shadow: 0 2px 8px rgba(211,47,47,.15); }

/* ── Toasts (switch result, broadcast messages) ──────────────────── */
.uc-toasts { position: fixed; top: 62px; right: 16px; z-index: 1200; display: flex; flex-direction: column; gap: 8px; max-width: min(420px, calc(100vw - 32px)); }
.uc-toast {
    display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px;
    background: #fff; border-left: 4px solid var(--uc-green); border-radius: 8px;
    box-shadow: 0 8px 24px rgba(15,40,80,.18); font-size: .84rem; color: var(--uc-ink);
    animation: uc-pop .18s ease-out;
}
.uc-toast.broadcast { border-left-color: #f59e0b; }
.uc-toast img { width: 18px; height: 18px; margin-top: 1px; }
.uc-toast div { flex: 1; }
.uc-toast small { display: block; color: var(--uc-muted); font-size: .72rem; margin-bottom: 2px; }
.uc-toast button { background: none; border: none; cursor: pointer; opacity: .5; padding: 0; }
.uc-toast button img { width: 14px; height: 14px; }

/* ── Modal windows (My Preferences, Billing Session) ─────────────── */
.mp-overlay {
    position: fixed; inset: 0; z-index: 1000;
    background: rgba(15, 30, 55, .45); backdrop-filter: blur(2px);
    display: grid; place-items: center; padding: 16px;
    animation: mp-fade .15s ease-out;
}
@keyframes mp-fade { from { opacity: 0; } to { opacity: 1; } }
.mp-window {
    position: relative; display: flex; flex-direction: column;
    width: min(1000px, 100%); height: min(640px, calc(100vh - 32px));
    background: #fff; border-radius: 14px; overflow: hidden;
    box-shadow: 0 24px 64px rgba(10, 30, 60, .35);
    color: var(--uc-ink);
}
.mp-window.compact { width: min(560px, 100%); height: auto; max-height: calc(100vh - 32px); }
.mp-window.wide { width: min(1080px, 100%); height: auto; max-height: calc(100vh - 32px); }
.mp-head {
    display: flex; align-items: center; gap: 10px; padding: 0 12px 0 18px; height: 54px; flex-shrink: 0;
    background: linear-gradient(135deg, #1565c0 0%, #1976d2 60%, #2196f3 100%); color: #fff;
}
.mp-head > img { width: 20px; height: 20px; filter: brightness(0) invert(1); }
.mp-head h2 { margin: 0; font-size: 1.1rem; font-weight: 600; color: #fff; }
.mp-user { margin-left: auto; font-size: .78rem; opacity: .85; }
.mp-close { width: 34px; height: 34px; border: none; border-radius: 8px; background: transparent; cursor: pointer; display: grid; place-items: center; }
.mp-close:hover { background: rgba(255,255,255,.18); }
.mp-close img { width: 18px; height: 18px; filter: brightness(0) invert(1); }
.mp-body { display: flex; flex: 1; min-height: 0; }
.mp-tabs { width: 220px; flex-shrink: 0; padding: 12px 8px; background: #f5f8fc; border-right: 1px solid var(--uc-line); overflow-y: auto; }
.mp-tab {
    display: flex; align-items: center; gap: 10px; width: 100%;
    padding: 10px 12px; margin-bottom: 2px; border: none; border-radius: 8px;
    background: transparent; color: var(--uc-ink); font-size: .86rem; text-align: left; cursor: pointer;
}
.mp-tab img { width: 18px; height: 18px; opacity: .55; }
.mp-tab:hover { background: #e9f0f9; }
.mp-tab.on { background: var(--uc-blue-2); color: #fff; font-weight: 600; box-shadow: 0 2px 6px rgba(21,101,192,.3); }
.mp-tab.on img { filter: brightness(0) invert(1); opacity: 1; }
.mp-pane { flex: 1; min-width: 0; display: flex; flex-direction: column; padding: 16px 18px 0; overflow: hidden; }
.mp-loading { flex: 1; display: grid; place-items: center; }
.mp-msg { display: flex; gap: 8px; align-items: center; padding: 8px 12px; margin-bottom: 10px; border-radius: 8px; font-size: .84rem; }
.mp-msg img { width: 16px; height: 16px; }
.mp-msg.ok { background: #e8f5e9; color: #1b5e20; }
.mp-msg.err { background: #fdecea; color: #b71c1c; }
.mp-grid { flex: 1; min-height: 0; overflow: auto; border: 1px solid var(--uc-line); border-radius: 10px; }
.mp-grid table { width: 100%; border-collapse: collapse; font-size: .85rem; }
.mp-grid th { position: sticky; top: 0; z-index: 1; background: #f5f8fc; text-align: left; font-weight: 600; color: #37474f; padding: 10px 12px; border-bottom: 1px solid var(--uc-line); }
.mp-grid td { padding: 9px 12px; border-bottom: 1px solid #f0f3f8; }
.mp-grid tbody tr { cursor: pointer; }
.mp-grid tbody tr:hover { background: #f7faff; }
.mp-grid tbody tr.on { background: var(--uc-blue-soft); }
.mp-sel { width: 36px; }
.mp-c { text-align: center; width: 90px; }
.mp-radio { display: inline-block; width: 16px; height: 16px; border-radius: 50%; border: 2px solid #b0bec5; vertical-align: middle; }
.mp-radio.on { border-color: var(--uc-blue-2); box-shadow: inset 0 0 0 3px #fff; background: var(--uc-blue-2); }
.mp-tick { width: 16px; height: 16px; }
.mp-current { margin-left: 8px; padding: 1px 8px; border-radius: 10px; background: #e3f2fd; color: var(--uc-blue); font-size: .7rem; font-weight: 600; }
.mp-empty { padding: 28px; text-align: center; color: var(--uc-muted); }
.mp-foot { display: flex; align-items: center; gap: 10px; padding: 12px 0 14px; flex-shrink: 0; }
.mp-spacer { flex: 1; }
.mp-check { display: flex; align-items: center; gap: 6px; font-size: .85rem; cursor: pointer; }
.mp-check.off { color: #9aa7b8; cursor: default; }
.mp-btn {
    display: inline-flex; align-items: center; gap: 6px; height: 34px; padding: 0 16px;
    border: 1px solid #cfd8e3; border-radius: 8px; background: #fff; color: var(--uc-ink);
    font-size: .85rem; font-weight: 600; cursor: pointer;
}
.mp-btn:hover:not(:disabled) { background: #f5f8fc; }
.mp-btn img { width: 16px; height: 16px; }
.mp-btn.primary { background: var(--uc-blue-2); border-color: var(--uc-blue-2); color: #fff; }
.mp-btn.primary img { filter: brightness(0) invert(1); }
.mp-btn.primary:hover:not(:disabled) { background: var(--uc-blue); }
.mp-btn.danger { background: var(--uc-red); border-color: var(--uc-red); color: #fff; }
.mp-btn.danger img { filter: brightness(0) invert(1); }
.mp-btn:disabled { opacity: .5; cursor: default; }
.mp-search { display: flex; align-items: center; gap: 8px; padding: 0 10px; height: 36px; margin-bottom: 10px; border: 1px solid #cfd8e3; border-radius: 8px; }
.mp-search img { width: 16px; height: 16px; opacity: .5; }
.mp-search input { flex: 1; border: none; outline: none; font-size: .86rem; }
.mp-group { border-bottom: 1px solid var(--uc-line); }
.mp-group-head { display: flex; align-items: center; gap: 8px; padding: 9px 12px; background: #f5f8fc; font-weight: 600; font-size: .85rem; cursor: pointer; position: sticky; top: 0; }
.mp-group-head em { margin-left: auto; font-style: normal; font-weight: 400; color: var(--uc-muted); font-size: .76rem; }
.mp-loc { display: flex; align-items: center; gap: 8px; padding: 7px 12px 7px 34px; font-size: .85rem; cursor: pointer; }
.mp-loc:hover { background: #f7faff; }
.mp-form { display: flex; flex-direction: column; gap: 14px; max-width: 420px; flex: 1; overflow-y: auto; }
.mp-form label { display: flex; flex-direction: column; gap: 5px; font-size: .82rem; color: #37474f; font-weight: 600; }
.mp-form label b { color: var(--uc-red); }
.mp-form input, .mp-form textarea {
    height: 36px; padding: 0 10px; border: 1px solid #cfd8e3; border-radius: 8px;
    font: inherit; font-weight: 400; font-size: .88rem; color: var(--uc-ink); background: #fff;
}
.mp-form input:focus, .mp-form textarea:focus { outline: none; border-color: var(--uc-blue-2); box-shadow: 0 0 0 3px rgba(25,118,210,.15); }
.mp-form input:disabled, .mp-form textarea:disabled { background: #f5f7fa; color: #455a64; }
.mp-form textarea { height: auto; padding: 8px 10px; resize: vertical; }
.mp-broadcast { max-width: none; }
.mp-hint { margin: 0; font-size: .76rem; color: var(--uc-muted); font-weight: 400; }
.mp-confirm-layer { position: absolute; inset: 0; z-index: 5; display: grid; place-items: center; background: rgba(15,30,55,.35); }
.mp-confirm { width: min(460px, calc(100% - 32px)); padding: 20px 22px; background: #fff; border-radius: 12px; box-shadow: 0 16px 40px rgba(10,30,60,.3); }
.mp-confirm h3 { margin: 0 0 8px; font-size: 1rem; }
.mp-confirm p { margin: 0 0 16px; font-size: .86rem; color: #455a64; line-height: 1.45; }
.mp-confirm-actions { display: flex; justify-content: flex-end; gap: 8px; }

/* Billing session */
.bs-pane { padding: 16px 18px; overflow-y: auto; }
.bs-status { display: flex; align-items: center; gap: 10px; padding: 10px 12px; margin-bottom: 14px; border-radius: 10px; background: #f5f8fc; font-size: .84rem; }
.bs-status i { width: 10px; height: 10px; border-radius: 50%; background: #9aa7b8; }
.bs-status.live i { background: var(--uc-green); box-shadow: 0 0 0 4px rgba(46,125,50,.15); }
.bs-fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 16px; max-width: none; }
.bs-fields .full { grid-column: 1 / -1; }
.bs-cards { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; margin: 14px 0; }
.bs-card { padding: 10px 12px; border: 1px solid var(--uc-line); border-radius: 10px; }
.bs-card small { display: block; color: var(--uc-muted); font-size: .72rem; }
.bs-card b { font-size: 1rem; }
.bs-card span { display: block; font-size: .74rem; color: var(--uc-muted); }
.bs-table { width: 100%; border-collapse: collapse; font-size: .8rem; }
.bs-table th { background: #f5f8fc; padding: 8px; text-align: right; font-weight: 600; color: #37474f; border-bottom: 1px solid var(--uc-line); white-space: nowrap; }
.bs-table th:first-child, .bs-table td:first-child { text-align: left; }
.bs-table td { padding: 7px 8px; text-align: right; border-bottom: 1px solid #f0f3f8; }
.bs-table tr.grp td { background: #fafcff; font-weight: 700; text-align: left; color: var(--uc-blue); }
.bs-table input { width: 110px; height: 30px; padding: 0 6px; text-align: right; border: 1px solid #cfd8e3; border-radius: 6px; font: inherit; }
.bs-table .neg { color: var(--uc-red); font-weight: 600; }
.bs-table-wrap { border: 1px solid var(--uc-line); border-radius: 10px; overflow-x: auto; }
.bs-foot { display: flex; align-items: center; gap: 10px; padding: 12px 18px; border-top: 1px solid var(--uc-line); background: #fafbfd; }

@media (max-width: 720px) {
    .uc-trigger-text { display: none; }
    .mp-body { flex-direction: column; }
    .mp-tabs { width: auto; display: flex; overflow-x: auto; border-right: none; border-bottom: 1px solid var(--uc-line); padding: 6px; }
    .mp-tab { width: auto; white-space: nowrap; }
    .mp-window { height: calc(100vh - 32px); }
    .bs-fields, .bs-cards { grid-template-columns: 1fr 1fr; }
}
