/* =====================================================================
   PhysioScribe AI — design system
   Medical palette: white / blue / grey / light-green. Light + dark.
   ===================================================================== */

:root {
    --bg:            #f4f7fb;
    --surface:       #ffffff;
    --surface-2:     #f8fafc;
    --border:        #e6ecf3;
    --text:          #0f2137;
    --text-soft:     #5b6b7f;
    --text-faint:    #93a2b4;
    --brand:         #1a66db;
    --brand-600:     #1651b1;
    --brand-soft:    #eaf2ff;
    --mint:          #22b892;
    --mint-soft:     #e5f7f1;
    --amber:         #e9a23b;
    --amber-soft:    #fdf3e1;
    --danger:        #e5484d;
    --danger-soft:   #fdecec;
    --shadow-sm:     0 1px 2px rgba(16,33,55,.06), 0 1px 3px rgba(16,33,55,.05);
    --shadow-md:     0 6px 20px rgba(16,33,55,.08);
    --shadow-lg:     0 18px 48px rgba(16,33,55,.14);
    --radius:        18px;
    --radius-sm:     12px;
    --sidebar-w:     264px;
    --topbar-h:      70px;
    --ease:          cubic-bezier(.4,0,.2,1);
}

[data-theme="dark"] {
    --bg:            #0b1220;
    --surface:       #121c2e;
    --surface-2:     #0f1826;
    --border:        #223148;
    --text:          #e8eef7;
    --text-soft:     #9fb0c6;
    --text-faint:    #6c7f98;
    --brand:         #4a92ff;
    --brand-600:     #2f83f5;
    --brand-soft:    #16283f;
    --mint:          #38d0a5;
    --mint-soft:     #12312a;
    --amber-soft:    #33290f;
    --danger-soft:   #3a1618;
    --shadow-md:     0 6px 20px rgba(0,0,0,.4);
    --shadow-lg:     0 18px 48px rgba(0,0,0,.55);
    --shadow-sm:     0 1px 2px rgba(0,0,0,.3);
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
    margin: 0;
    font-family: 'Inter', system-ui, sans-serif;
    background: var(--bg);
    color: var(--text);
    -webkit-font-smoothing: antialiased;
    transition: background .3s var(--ease), color .3s var(--ease);
}
.d-none { display: none !important; }
h1,h2,h3,h4,h5,h6 { font-family: 'Plus Jakarta Sans','Inter',sans-serif; color: var(--text); }
a { text-decoration: none; color: inherit; }
/* Keep our theme colours winning over Bootstrap's heading/body variables */
:root { --bs-heading-color: var(--text); --bs-body-color: var(--text); }

/* =====================================================================
   PRELOADER (full-page splash until the app is ready)
   ===================================================================== */
#app-preloader {
    position: fixed; inset: 0; z-index: 4000; display: grid; place-items: center;
    background:
        radial-gradient(900px 500px at 15% -10%, #dbeafe 0%, transparent 55%),
        radial-gradient(800px 500px at 110% 20%, #d8f5ec 0%, transparent 55%),
        var(--bg);
    transition: opacity .5s var(--ease), visibility .5s var(--ease);
}
[data-theme="dark"] #app-preloader {
    background:
        radial-gradient(900px 500px at 15% -10%, #12294a 0%, transparent 55%),
        radial-gradient(800px 500px at 110% 20%, #0f3630 0%, transparent 55%),
        var(--bg);
}
#app-preloader.hide { opacity: 0; visibility: hidden; }
.pl-inner { text-align: center; animation: rise .5s var(--ease) both; }
.pl-badge {
    position: relative; width: 88px; height: 88px; margin: 0 auto 22px; border-radius: 26px;
    display: grid; place-items: center; color: #fff; font-size: 36px;
    background: linear-gradient(135deg, var(--brand), var(--mint));
    box-shadow: 0 16px 40px rgba(26,102,219,.4);
    animation: plbob 1.8s var(--ease) infinite;
}
.pl-badge img { width: 56px; height: 56px; object-fit: contain; border-radius: 12px; }
.pl-ring {
    position: absolute; inset: -10px; border-radius: 32px;
    border: 3px solid transparent; border-top-color: var(--brand); border-right-color: var(--mint);
    animation: plspin 1s linear infinite;
}
@keyframes plbob { 0%,100%{ transform: translateY(0); } 50%{ transform: translateY(-10px); } }
@keyframes plspin { to { transform: rotate(360deg); } }
.pl-name { font-family: 'Plus Jakarta Sans','Inter',sans-serif; font-weight: 800; font-size: 24px; letter-spacing: -.02em; color: var(--text); }
.pl-name span { color: var(--brand); }
.pl-bar { width: 180px; height: 5px; border-radius: 4px; background: var(--surface-2); overflow: hidden; margin: 18px auto 12px; }
.pl-bar > span { display: block; height: 100%; width: 40%; border-radius: 4px;
    background: linear-gradient(90deg, var(--brand), var(--mint)); animation: plload 1.3s var(--ease) infinite; }
@keyframes plload { 0%{ transform: translateX(-120%); } 100%{ transform: translateX(320%); } }
.pl-tag { font-size: 13px; color: var(--text-soft); font-weight: 500; }

/* ---------- Brand ---------- */
.brand-badge img, .brand-badge.sm img { width: 74%; height: 74%; object-fit: contain; border-radius: 8px; }
.brand-badge {
    width: 54px; height: 54px; border-radius: 16px;
    display: grid; place-items: center; color: #fff; font-size: 22px;
    background: linear-gradient(135deg, var(--brand), var(--mint));
    box-shadow: 0 8px 22px rgba(26,102,219,.35);
}
.brand-badge.sm { width: 38px; height: 38px; border-radius: 11px; font-size: 16px; box-shadow: none; }

/* =====================================================================
   AUTH / LOGIN
   ===================================================================== */
.auth-wrap {
    min-height: 100vh; display: grid; place-items: center; padding: 24px;
    position: relative; overflow: hidden;
    background: radial-gradient(1200px 600px at 10% -10%, #dbeafe 0%, transparent 55%),
                radial-gradient(900px 500px at 110% 20%, #d8f5ec 0%, transparent 55%),
                var(--bg);
}
[data-theme="dark"] .auth-wrap {
    background: radial-gradient(1000px 600px at 10% -10%, #12294a 0%, transparent 55%),
                radial-gradient(900px 500px at 110% 20%, #0f3630 0%, transparent 55%),
                var(--bg);
}
.auth-bg span {
    position: absolute; border-radius: 50%; filter: blur(50px); opacity: .5;
    animation: float 14s var(--ease) infinite;
}
.auth-bg span:nth-child(1){ width:340px;height:340px; background:#7db6ff; top:-60px; left:-40px; }
.auth-bg span:nth-child(2){ width:300px;height:300px; background:#5fe0bd; bottom:-80px; right:-30px; animation-delay:-4s; }
.auth-bg span:nth-child(3){ width:220px;height:220px; background:#a9c8ff; top:40%; right:20%; animation-delay:-8s; }
@keyframes float { 0%,100%{transform:translateY(0) scale(1);} 50%{transform:translateY(-26px) scale(1.06);} }

.glass {
    background: rgba(255,255,255,.72);
    backdrop-filter: blur(22px) saturate(150%);
    -webkit-backdrop-filter: blur(22px) saturate(150%);
    border: 1px solid rgba(255,255,255,.6);
}
[data-theme="dark"] .glass {
    background: rgba(18,28,46,.72);
    border: 1px solid rgba(255,255,255,.08);
}
.auth-card {
    position: relative; z-index: 2; width: 100%; max-width: 420px;
    padding: 40px 36px; border-radius: 26px; box-shadow: var(--shadow-lg);
    animation: rise .6s var(--ease) both;
}
@keyframes rise { from{opacity:0; transform:translateY(18px);} to{opacity:1; transform:none;} }
.auth-title { font-size: 26px; font-weight: 800; margin: 0; letter-spacing:-.02em; }
.auth-title span { color: var(--brand); }
.auth-sub { color: var(--text-soft); margin: 6px 0 0; font-size: 14px; }
.demo-hint { text-align:center; margin: 18px 0 0; font-size: 12px; color: var(--text-faint); }

.field { margin-bottom: 16px; }
.field > label { display:block; font-size: 13px; font-weight: 600; margin-bottom: 7px; color: var(--text-soft); }
.input-icon { position: relative; }
.input-icon > i { position:absolute; left:14px; top:50%; transform:translateY(-50%); color: var(--text-faint); font-size: 14px; }
.input-icon input {
    width: 100%; padding: 13px 42px 13px 40px; border-radius: 12px;
    border: 1.5px solid var(--border); background: var(--surface); color: var(--text);
    font-size: 15px; transition: border-color .2s, box-shadow .2s;
}
.input-icon input:focus { outline:none; border-color: var(--brand); box-shadow: 0 0 0 4px var(--brand-soft); }
.pw-toggle { position:absolute; right:8px; top:50%; transform:translateY(-50%); border:0; background:none; color:var(--text-faint); padding:8px; cursor:pointer; }
.remember { display:flex; align-items:center; gap:8px; font-size:13px; color:var(--text-soft); cursor:pointer; margin:0; }
.remember input { accent-color: var(--brand); width:15px; height:15px; }
.link { color: var(--brand); font-size: 13px; font-weight: 600; }
.link:hover { text-decoration: underline; }

.theme-fab {
    position: fixed; top: 20px; right: 20px; z-index: 5;
    width: 44px; height: 44px; border-radius: 12px; border: 1px solid var(--border);
    background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); cursor: pointer;
}

/* ---------- Buttons ---------- */
.btn-primary {
    display:inline-flex; align-items:center; justify-content:center; gap:8px;
    padding: 13px 20px; border:0; border-radius: 12px; cursor:pointer;
    background: linear-gradient(135deg, var(--brand), var(--brand-600));
    color:#fff; font-weight:700; font-size:15px; box-shadow: 0 8px 20px rgba(26,102,219,.3);
    transition: transform .15s var(--ease), box-shadow .2s, filter .2s;
}
.btn-primary:hover { transform: translateY(-1px); filter: brightness(1.05); }
.btn-primary:active { transform: translateY(0); }
.btn-primary:disabled { opacity:.7; cursor:not-allowed; transform:none; }
.btn-ghost { background: var(--surface); border:1px solid var(--border); color: var(--text); border-radius:12px; padding:11px 16px; font-weight:600; cursor:pointer; display:inline-flex; align-items:center; gap:8px; transition:.2s; }
.btn-ghost:hover { border-color: var(--brand); color: var(--brand); }
.btn-soft { background: var(--brand-soft); color: var(--brand); border:0; border-radius:12px; padding:11px 16px; font-weight:600; cursor:pointer; display:inline-flex; align-items:center; gap:8px; transition:.2s; }
.btn-soft:hover { filter: brightness(.97); }
.btn-danger { background: var(--danger-soft); color: var(--danger); border:0; border-radius:12px; padding:11px 16px; font-weight:600; cursor:pointer; }
.btn-sm { padding: 8px 12px; font-size: 13px; border-radius: 10px; }

/* =====================================================================
   APP LAYOUT
   ===================================================================== */
.app-layout { display: flex; min-height: 100vh; }

.sidebar {
    width: var(--sidebar-w); flex-shrink: 0; background: var(--surface);
    border-right: 1px solid var(--border); display: flex; flex-direction: column;
    position: sticky; top: 0; height: 100vh; z-index: 40;
}
.sidebar-head { display:flex; align-items:center; gap:10px; padding: 18px 20px; border-bottom:1px solid var(--border); }
.brand-word { font-family:'Plus Jakarta Sans'; font-weight:800; font-size:17px; letter-spacing:-.02em; }
.sidebar-close { margin-left:auto; border:0; background:none; color:var(--text-soft); font-size:18px; }
.side-nav { padding: 14px 12px; display:flex; flex-direction:column; gap:4px; flex:1; overflow-y:auto; }
.nav-item {
    display:flex; align-items:center; gap:12px; padding: 11px 14px; border-radius: 12px;
    color: var(--text-soft); font-weight:600; font-size:14.5px; transition: .18s var(--ease);
}
.nav-item i { width: 20px; text-align:center; font-size:16px; }
.nav-item:hover { background: var(--surface-2); color: var(--text); }
.nav-item.active { background: var(--brand-soft); color: var(--brand); }
.nav-item.active i { color: var(--brand); }
.sidebar-foot { padding: 14px 18px; border-top:1px solid var(--border); }
.ai-status { display:flex; align-items:center; gap:8px; font-size:12.5px; color: var(--text-soft); font-weight:600; }
.ai-status .dot { width:8px; height:8px; border-radius:50%; background: var(--mint); box-shadow:0 0 0 3px var(--mint-soft); animation: pulse 2s infinite; }
@keyframes pulse { 0%,100%{opacity:1;} 50%{opacity:.4;} }

.sidebar-scrim { display:none; }

.main-col { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.topbar {
    height: var(--topbar-h); display:flex; align-items:center; gap:14px; padding: 0 22px;
    background: var(--surface); border-bottom:1px solid var(--border);
    position: sticky; top: 0; z-index: 30;
}
.topbar-search { flex:1; max-width:520px; position:relative; }
.topbar-search i { position:absolute; left:14px; top:50%; transform:translateY(-50%); color:var(--text-faint); font-size:14px; }
.topbar-search input {
    width:100%; padding:11px 14px 11px 40px; border-radius:12px; border:1.5px solid transparent;
    background: var(--surface-2); color: var(--text); font-size:14px; transition:.2s;
}
.topbar-search input:focus { outline:none; border-color: var(--brand); background: var(--surface); box-shadow:0 0 0 4px var(--brand-soft); }
.topbar-actions { margin-left:auto; display:flex; align-items:center; gap:8px; }
.icon-btn {
    width:42px; height:42px; border-radius:12px; border:1px solid var(--border); background:var(--surface);
    color: var(--text-soft); cursor:pointer; transition:.18s; display:grid; place-items:center;
}
.icon-btn:hover { color: var(--brand); border-color: var(--brand); }

.profile-menu { position: relative; }
.profile-btn { display:flex; align-items:center; gap:10px; background:none; border:0; cursor:pointer; padding:5px 8px; border-radius:12px; }
.profile-btn:hover { background: var(--surface-2); }
.avatar { width:38px; height:38px; border-radius:11px; background:linear-gradient(135deg,var(--brand),var(--mint)); color:#fff; display:grid; place-items:center; font-weight:700; font-size:14px; }
.profile-meta { flex-direction:column; align-items:flex-start; line-height:1.15; }
.profile-meta strong { font-size:13.5px; }
.profile-meta small { font-size:11.5px; color: var(--text-faint); }
.profile-dropdown {
    position:absolute; right:0; top: calc(100% + 8px); width: 240px; background:var(--surface);
    border:1px solid var(--border); border-radius:16px; box-shadow: var(--shadow-lg); padding:8px;
    opacity:0; visibility:hidden; transform: translateY(-8px); transition:.2s var(--ease); z-index:50;
}
.profile-dropdown.open { opacity:1; visibility:visible; transform:none; }
.pd-head { padding:10px 12px; border-bottom:1px solid var(--border); margin-bottom:6px; display:flex; flex-direction:column; }
.pd-head small { color:var(--text-faint); font-size:12px; }
.profile-dropdown a, .profile-dropdown button {
    display:flex; align-items:center; gap:11px; width:100%; padding:10px 12px; border:0; background:none;
    color:var(--text); font-size:13.5px; font-weight:500; border-radius:10px; cursor:pointer; text-align:left;
}
.profile-dropdown a:hover, .profile-dropdown button:hover { background: var(--surface-2); }
.profile-dropdown .danger { color: var(--danger); }

.content { padding: 26px; max-width: 1400px; width: 100%; margin: 0 auto; }

/* =====================================================================
   SHARED COMPONENTS
   ===================================================================== */
.page-head { display:flex; align-items:flex-end; justify-content:space-between; gap:16px; margin-bottom:22px; flex-wrap:wrap; }
.page-head h1 { font-size: 26px; font-weight:800; margin:0; letter-spacing:-.02em; }
.page-head p { margin:4px 0 0; color: var(--text-soft); font-size:14px; }

.card {
    background: var(--surface); border:1px solid var(--border); border-radius: var(--radius);
    box-shadow: var(--shadow-sm); transition: box-shadow .25s var(--ease), transform .25s var(--ease);
}
.card:hover { box-shadow: var(--shadow-md); }
.card-pad { padding: 20px; }

.stat-grid { display:grid; grid-template-columns: repeat(4,1fr); gap:18px; margin-bottom:24px; }
.stat-card { padding:20px; display:flex; flex-direction:column; gap:14px; animation: rise .5s var(--ease) both; }
.stat-card .ic { width:46px; height:46px; border-radius:13px; display:grid; place-items:center; font-size:19px; }
.ic.blue { background:var(--brand-soft); color:var(--brand); }
.ic.mint { background:var(--mint-soft); color:var(--mint); }
.ic.amber { background:var(--amber-soft); color:var(--amber); }
.ic.red { background:var(--danger-soft); color:var(--danger); }
.stat-card .num { font-size:30px; font-weight:800; line-height:1; font-family:'Plus Jakarta Sans'; }
.stat-card .lbl { color: var(--text-soft); font-size:13.5px; font-weight:500; }

.pill { display:inline-flex; align-items:center; gap:6px; padding:4px 11px; border-radius:999px; font-size:12px; font-weight:600; }
.pill.final { background:var(--mint-soft); color:var(--mint); }
.pill.draft { background:var(--amber-soft); color:var(--amber); }
.pill.blue { background:var(--brand-soft); color:var(--brand); }
.pill.red { background:var(--danger-soft); color:var(--danger); }

.data-table { width:100%; border-collapse: collapse; }
.data-table th { text-align:left; font-size:12px; text-transform:uppercase; letter-spacing:.04em; color:var(--text-faint); padding:12px 16px; border-bottom:1px solid var(--border); font-weight:700; }
.data-table td { padding:14px 16px; border-bottom:1px solid var(--border); font-size:14px; }
.data-table tr:last-child td { border-bottom:0; }
.data-table tbody tr { transition:.15s; cursor:pointer; }
.data-table tbody tr:hover { background: var(--surface-2); }

.empty { text-align:center; padding:60px 20px; color: var(--text-faint); }
.empty i { font-size:42px; opacity:.5; margin-bottom:14px; display:block; }

/* ---------- Skeletons ---------- */
.skeleton { position:relative; overflow:hidden; background: var(--surface-2); border-radius:10px; }
.skeleton::after { content:''; position:absolute; inset:0; transform:translateX(-100%);
    background: linear-gradient(90deg, transparent, rgba(255,255,255,.5), transparent); animation: shimmer 1.4s infinite; }
[data-theme="dark"] .skeleton::after { background: linear-gradient(90deg, transparent, rgba(255,255,255,.06), transparent); }
@keyframes shimmer { 100% { transform: translateX(100%); } }
.sk-line { height:14px; margin:8px 0; }

/* =====================================================================
   CONSULTATION (split screen)
   ===================================================================== */
.consult-toolbar { display:flex; gap:16px; flex-wrap:wrap; margin-bottom:16px; }
.consult-toolbar .ct-field { display:flex; flex-direction:column; gap:6px; min-width:240px; }
.consult-toolbar .ct-field > label { font-size:12px; font-weight:700; text-transform:uppercase; letter-spacing:.04em; color:var(--text-faint); }
.consult-toolbar .ct-row { display:flex; gap:8px; align-items:center; }
.consult-toolbar .ct-row select { flex:1; }
.consult-toolbar .ct-row .btn-sm { white-space:nowrap; }
@media (max-width:560px){ .consult-toolbar .ct-field { min-width:100%; } }

.consult-split { display:flex; gap:0; align-items:stretch; min-height: calc(100vh - var(--topbar-h) - 52px); }
.consult-panel { background:var(--surface); border:1px solid var(--border); border-radius:var(--radius); display:flex; flex-direction:column; min-width:0; box-shadow:var(--shadow-sm); }
.panel-left { flex: 1 1 50%; }
.panel-right { flex: 1 1 50%; }
.resizer { flex: 0 0 14px; cursor: col-resize; display:grid; place-items:center; }
.resizer::before { content:''; width:4px; height:46px; border-radius:4px; background:var(--border); transition:.2s; }
.resizer:hover::before { background: var(--brand); }
.panel-head { padding:16px 18px; border-bottom:1px solid var(--border); display:flex; align-items:center; gap:10px; flex-wrap:wrap; }
.panel-head h3 { margin:0; font-size:16px; font-weight:700; display:flex; align-items:center; gap:9px; }
.panel-body { padding:16px 18px; flex:1; display:flex; flex-direction:column; min-height:0; }

.rec-controls { display:flex; flex-wrap:wrap; gap:8px; margin-bottom:14px; }
.rec-btn { display:inline-flex; align-items:center; gap:7px; padding:9px 13px; border-radius:11px; border:1px solid var(--border); background:var(--surface); color:var(--text); font-weight:600; font-size:13px; cursor:pointer; transition:.18s; }
.rec-btn:hover { border-color:var(--brand); color:var(--brand); }
.rec-btn.rec-live { background:var(--danger); color:#fff; border-color:var(--danger); }
.rec-btn:disabled { opacity:.45; cursor:not-allowed; }
.rec-btn.primary { background:var(--brand); color:#fff; border-color:var(--brand); }

.rec-meter { display:flex; align-items:center; gap:12px; padding:10px 14px; background:var(--surface-2); border-radius:12px; margin-bottom:14px; }
.rec-dot { width:11px; height:11px; border-radius:50%; background:var(--text-faint); }
.rec-dot.live { background:var(--danger); animation: pulse 1s infinite; }
.rec-time { font-variant-numeric: tabular-nums; font-weight:700; font-size:15px; }
.wave { display:flex; align-items:center; gap:3px; height:22px; }
.wave span { width:3px; background:var(--brand); border-radius:2px; height:6px; }
.rec-live-mode .wave span { animation: wv .9s ease-in-out infinite; }
.wave span:nth-child(2){animation-delay:.1s}.wave span:nth-child(3){animation-delay:.2s}.wave span:nth-child(4){animation-delay:.3s}.wave span:nth-child(5){animation-delay:.4s}
@keyframes wv { 0%,100%{height:6px;} 50%{height:20px;} }

.transcript-editor {
    flex:1; width:100%; border:1px solid var(--border); border-radius:12px; padding:14px; resize:none;
    background:var(--surface-2); color:var(--text); font-size:14px; line-height:1.7; min-height:280px;
    font-family:'Inter',sans-serif;
}
.transcript-editor:focus { outline:none; border-color:var(--brand); box-shadow:0 0 0 4px var(--brand-soft); background:var(--surface); }
.transcript-meta { display:flex; gap:16px; margin-top:10px; font-size:12.5px; color:var(--text-faint); flex-wrap:wrap; }
.transcript-meta b { color:var(--text-soft); }

/* ---------- Pipeline progress ---------- */
.pipeline { padding: 8px 0 4px; }
.pipe-step { display:flex; align-items:center; gap:12px; padding:9px 0; }
.pipe-ic { width:30px; height:30px; border-radius:9px; display:grid; place-items:center; background:var(--surface-2); color:var(--text-faint); font-size:13px; flex-shrink:0; transition:.3s; }
.pipe-step.active .pipe-ic { background:var(--brand-soft); color:var(--brand); }
.pipe-step.done .pipe-ic { background:var(--mint); color:#fff; }
.pipe-label { font-size:13.5px; font-weight:600; color:var(--text-soft); }
.pipe-step.active .pipe-label, .pipe-step.done .pipe-label { color:var(--text); }
.pipe-bar { flex:1; height:5px; border-radius:4px; background:var(--surface-2); overflow:hidden; }
.pipe-bar > span { display:block; height:100%; width:0; background:linear-gradient(90deg,var(--brand),var(--mint)); transition:width .5s var(--ease); }

/* ---------- SOAP cards ---------- */
.soap-card { border:1px solid var(--border); border-radius:14px; margin-bottom:14px; overflow:hidden; background:var(--surface); animation: rise .4s var(--ease) both; }
.soap-card-head { display:flex; align-items:center; gap:10px; padding:12px 16px; border-bottom:1px solid var(--border); background:var(--surface-2); }
.soap-tag { width:30px; height:30px; border-radius:9px; display:grid; place-items:center; color:#fff; font-weight:800; font-size:14px; }
.soap-s{background:#2f83f5}.soap-o{background:#22b892}.soap-a{background:#e9a23b}.soap-p{background:#7c5cff}
.soap-card-head h4 { margin:0; font-size:14.5px; font-weight:700; flex:1; }
.soap-card-body { padding:14px 16px; }
.soap-text { width:100%; border:0; background:none; color:var(--text); font-size:14px; line-height:1.75; resize:vertical; min-height:80px; font-family:'Inter',sans-serif; }
.soap-text:focus { outline:none; }
.soap-actions { display:flex; gap:6px; }
.mini-btn { border:1px solid var(--border); background:var(--surface); color:var(--text-soft); width:32px; height:32px; border-radius:9px; cursor:pointer; transition:.15s; }
.mini-btn:hover { color:var(--brand); border-color:var(--brand); }

/* ---------- Review flags ---------- */
.flag-box { border-radius:12px; padding:12px 14px; margin-bottom:12px; font-size:13px; display:flex; gap:10px; }
.flag-box.warn { background:var(--amber-soft); color:#8a5b12; }
.flag-box.info { background:var(--brand-soft); color:var(--brand-600); }
.flag-box.red { background:var(--danger-soft); color:var(--danger); }
[data-theme="dark"] .flag-box.warn { color:#f0c078; }
.chip { display:inline-block; padding:3px 9px; border-radius:8px; background:var(--surface); font-size:11.5px; margin:3px 4px 0 0; border:1px solid var(--border); }

/* ---------- Confidence ---------- */
.conf-item { display:flex; align-items:center; gap:10px; padding:7px 0; font-size:13px; }
.conf-name { flex:0 0 42%; color:var(--text-soft); font-weight:500; text-transform:capitalize; }
.conf-track { flex:1; height:7px; border-radius:5px; background:var(--surface-2); overflow:hidden; }
.conf-fill { height:100%; border-radius:5px; transition:width .6s var(--ease); }
.conf-val { flex:0 0 46px; text-align:right; font-weight:700; font-size:12.5px; }

/* =====================================================================
   TOASTS / LOADER / MODAL
   ===================================================================== */
.toast-stack { position:fixed; top:18px; right:18px; z-index:2000; display:flex; flex-direction:column; gap:10px; max-width:360px; }
.toast {
    background:var(--surface); border:1px solid var(--border); border-left:4px solid var(--brand);
    border-radius:13px; box-shadow:var(--shadow-lg); padding:13px 15px; display:flex; gap:12px; align-items:flex-start;
    animation: toastIn .35s var(--ease);
}
.toast.success { border-left-color:var(--mint); }
.toast.error { border-left-color:var(--danger); }
.toast.warn { border-left-color:var(--amber); }
.toast .t-ic { font-size:17px; margin-top:1px; }
.toast.success .t-ic{color:var(--mint)} .toast.error .t-ic{color:var(--danger)} .toast.warn .t-ic{color:var(--amber)} .toast.info .t-ic{color:var(--brand)}
.toast .t-body { flex:1; }
.toast .t-title { font-weight:700; font-size:13.5px; }
.toast .t-msg { font-size:12.5px; color:var(--text-soft); margin-top:2px; }
.toast .t-close { border:0; background:none; color:var(--text-faint); cursor:pointer; }
@keyframes toastIn { from{opacity:0; transform:translateX(30px);} to{opacity:1;transform:none;} }
.toast.out { opacity:0; transform:translateX(30px); transition:.3s; }

.global-loader { position:fixed; inset:0; z-index:1900; display:grid; place-items:center; background:rgba(8,15,28,.5); backdrop-filter: blur(4px); }
.loader-card { background:var(--surface); border-radius:20px; padding:34px 44px; text-align:center; box-shadow:var(--shadow-lg); }
.loader-card p { margin:16px 0 0; font-weight:600; color:var(--text-soft); }
.pipeline-spinner { width:64px; height:64px; border-radius:20px; display:grid; place-items:center; margin:0 auto; font-size:26px; color:#fff;
    background:linear-gradient(135deg,var(--brand),var(--mint)); animation: bob 1.4s ease-in-out infinite; }
@keyframes bob { 0%,100%{transform:translateY(0) rotate(0);} 50%{transform:translateY(-8px) rotate(4deg);} }

.modal-scrim { position:fixed; inset:0; z-index:1500; background:rgba(8,15,28,.55); backdrop-filter:blur(4px); display:grid; place-items:center; padding:20px; }
.modal-box { background:var(--surface); border-radius:20px; box-shadow:var(--shadow-lg); width:100%; max-width:520px; animation: rise .3s var(--ease); max-height:90vh; overflow:auto; }
.modal-head { padding:18px 22px; border-bottom:1px solid var(--border); display:flex; align-items:center; justify-content:space-between; }
.modal-head h3 { margin:0; font-size:17px; font-weight:700; }
.modal-body { padding:22px; }
.modal-foot { padding:16px 22px; border-top:1px solid var(--border); display:flex; gap:10px; justify-content:flex-end; }
.form-group { margin-bottom:15px; }
.form-group label { display:block; font-size:13px; font-weight:600; margin-bottom:6px; color:var(--text-soft); }
.form-control-x { width:100%; padding:11px 13px; border:1.5px solid var(--border); border-radius:11px; background:var(--surface); color:var(--text); font-size:14px; font-family:inherit; }
.form-control-x:focus { outline:none; border-color:var(--brand); box-shadow:0 0 0 4px var(--brand-soft); }
textarea.form-control-x { resize:vertical; min-height:90px; }
.pw-wrap { position:relative; }
.pw-wrap .form-control-x { padding-right:44px; }
.pw-wrap .pw-toggle { position:absolute; right:6px; top:50%; transform:translateY(-50%); border:0; background:none; color:var(--text-faint); padding:8px; cursor:pointer; border-radius:8px; }
.pw-wrap .pw-toggle:hover { color:var(--brand); }

/* ---------- Logo upload ---------- */
.logo-upload { display:flex; gap:16px; align-items:center; }
.logo-preview {
    width:76px; height:76px; flex-shrink:0; border-radius:16px; border:1.5px dashed var(--border);
    background:var(--surface-2); display:grid; place-items:center; color:var(--text-faint); font-size:24px; overflow:hidden;
}
.logo-preview img { width:100%; height:100%; object-fit:contain; padding:8px; }
.logo-actions { display:flex; flex-direction:column; gap:8px; align-items:flex-start; }
.logo-actions .btn-soft, .logo-actions .btn-ghost { cursor:pointer; }

/* ---------- Detail view ---------- */
.detail-grid { display:grid; grid-template-columns: 1fr 1fr; gap:12px; }
.detail-field { padding:12px 14px; background:var(--surface-2); border-radius:11px; }
.detail-field .k { font-size:11.5px; text-transform:uppercase; letter-spacing:.04em; color:var(--text-faint); font-weight:700; }
.detail-field .v { font-size:14px; margin-top:3px; }

/* =====================================================================
   RESPONSIVE
   ===================================================================== */
@media (max-width: 991px) {
    .sidebar { position:fixed; left:0; top:0; transform: translateX(-100%); transition: transform .3s var(--ease); box-shadow: var(--shadow-lg); }
    .sidebar.open { transform:none; }
    .sidebar-scrim.show { display:block; position:fixed; inset:0; background:rgba(8,15,28,.5); z-index:39; }
    .stat-grid { grid-template-columns: repeat(2,1fr); }
    .consult-split { flex-direction:column; min-height:0; }
    .resizer { display:none; }
    .panel-left, .panel-right { flex:1 1 auto; }
    .detail-grid { grid-template-columns:1fr; }
}
@media (max-width: 560px) {
    .content { padding:16px; }
    .stat-grid { grid-template-columns:1fr; }
    .topbar-search { display:none; }
    .auth-card { padding:32px 24px; }
}
