/* ============================================================
   Trinath Internal Email — Design System
   Theme-aware (light / dark), mobile-first, premium SaaS feel.
   ============================================================ */
:root {
    --bg:            #f4f5fb;
    --surface:       #ffffff;
    --surface-2:     #f8f9fd;
    --border:        #e6e8f0;
    --text:          #1a1c2e;
    --text-soft:     #5b6072;
    --text-faint:    #8b90a3;
    --primary:       #4f46e5;
    --primary-600:   #4338ca;
    --primary-soft:  #eef0ff;
    --accent:        #7c3aed;
    --success:       #16a34a;
    --warning:       #d97706;
    --danger:        #dc2626;
    --shadow-sm:     0 1px 2px rgba(20,22,50,.06), 0 1px 3px rgba(20,22,50,.05);
    --shadow-md:     0 4px 16px rgba(20,22,50,.08);
    --shadow-lg:     0 12px 40px rgba(20,22,50,.14);
    --radius:        14px;
    --radius-sm:     10px;
    --sidebar-w:     264px;
    --topbar-h:      62px;
    --font:          "Segoe UI", system-ui, -apple-system, Roboto, Helvetica, Arial, sans-serif;
}
html[data-theme="dark"] {
    --bg:            #0e0f1a;
    --surface:       #171826;
    --surface-2:     #1e2032;
    --border:        #2a2c42;
    --text:          #e8e9f2;
    --text-soft:     #a3a7bd;
    --text-faint:    #6f7492;
    --primary:       #6366f1;
    --primary-600:   #4f46e5;
    --primary-soft:  #23233f;
    --shadow-sm:     0 1px 2px rgba(0,0,0,.4);
    --shadow-md:     0 6px 20px rgba(0,0,0,.45);
    --shadow-lg:     0 16px 48px rgba(0,0,0,.55);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
    font-family: var(--font);
    background: var(--bg);
    color: var(--text);
    -webkit-font-smoothing: antialiased;
    font-size: 15px;
    line-height: 1.5;
}
a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; }
::selection { background: var(--primary-soft); }

/* ---------- App shell ---------- */
.app-shell { display: flex; min-height: 100vh; }

/* ---------- Sidebar ---------- */
.sidebar {
    width: var(--sidebar-w);
    background: var(--surface);
    border-right: 1px solid var(--border);
    display: flex; flex-direction: column;
    position: fixed; inset: 0 auto 0 0; z-index: 40;
    padding: 18px 14px;
}
.brand { display: flex; align-items: center; gap: 12px; padding: 6px 8px 18px; }
.brand-mark {
    width: 40px; height: 40px; border-radius: 12px;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    color: #fff; display: grid; place-items: center;
    font-weight: 800; font-size: 20px; box-shadow: var(--shadow-md);
}
.brand-text { display: flex; flex-direction: column; }
.brand-title { font-weight: 700; font-size: 15px; }
.brand-sub { font-size: 11px; color: var(--text-faint); }

.compose-btn {
    display: flex; align-items: center; justify-content: center; gap: 8px;
    background: linear-gradient(135deg, var(--primary), var(--primary-600));
    color: #fff; font-weight: 600; padding: 12px; border-radius: var(--radius-sm);
    box-shadow: var(--shadow-md); margin-bottom: 14px; transition: transform .12s, box-shadow .12s;
}
.compose-btn:hover { transform: translateY(-1px); box-shadow: var(--shadow-lg); }
.compose-btn .ic { font-size: 16px; }

.nav { display: flex; flex-direction: column; gap: 2px; overflow-y: auto; flex: 1; }
.nav-item {
    display: flex; align-items: center; gap: 12px;
    padding: 10px 12px; border-radius: var(--radius-sm);
    color: var(--text-soft); font-weight: 500; font-size: 14px;
    transition: background .12s, color .12s;
}
.nav-item:hover { background: var(--surface-2); color: var(--text); }
.nav-item.active { background: var(--primary-soft); color: var(--primary); font-weight: 600; }
.nav-item .ic { width: 20px; text-align: center; font-size: 15px; }
.nav-sep { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--text-faint); padding: 16px 12px 6px; }

.sidebar-foot { border-top: 1px solid var(--border); padding-top: 12px; margin-top: 8px; }
.user-chip { display: flex; align-items: center; gap: 10px; padding: 8px; border-radius: var(--radius-sm); }
.user-chip:hover { background: var(--surface-2); }
.avatar {
    width: 38px; height: 38px; border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    color: #fff; display: grid; place-items: center; font-weight: 700; flex: none;
}
.user-meta { display: flex; flex-direction: column; overflow: hidden; }
.u-name { font-weight: 600; font-size: 14px; white-space: nowrap; text-overflow: ellipsis; overflow: hidden; }
.u-sub { font-size: 11px; color: var(--text-faint); white-space: nowrap; text-overflow: ellipsis; overflow: hidden; }

.sidebar-scrim { display: none; }

/* ---------- Main ---------- */
.main { flex: 1; margin-left: var(--sidebar-w); display: flex; flex-direction: column; min-width: 0; }

.topbar {
    height: var(--topbar-h); background: var(--surface);
    border-bottom: 1px solid var(--border);
    display: flex; align-items: center; gap: 14px; padding: 0 20px;
    position: sticky; top: 0; z-index: 30;
}
.menu-btn { display: none; }
.page-title { font-size: 18px; font-weight: 700; margin: 0; white-space: nowrap; }
.topbar-search { flex: 1; max-width: 460px; margin: 0 auto; }
.topbar-search input {
    width: 100%; padding: 9px 14px; border-radius: 999px;
    border: 1px solid var(--border); background: var(--surface-2); color: var(--text);
    font-size: 14px; outline: none; transition: border .12s, box-shadow .12s;
}
.topbar-search input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
.topbar-actions { display: flex; align-items: center; gap: 6px; }

.icon-btn {
    width: 40px; height: 40px; border-radius: 10px; border: none; background: transparent;
    color: var(--text-soft); font-size: 17px; display: grid; place-items: center;
    transition: background .12s, color .12s;
}
.icon-btn:hover { background: var(--surface-2); color: var(--text); }

.bell-wrap { position: relative; }
.badge {
    position: absolute; top: 4px; right: 4px; min-width: 17px; height: 17px;
    background: var(--danger); color: #fff; font-size: 10px; font-weight: 700;
    border-radius: 999px; display: grid; place-items: center; padding: 0 4px;
    animation: pop .3s ease;
}
@keyframes pop { 0%{transform:scale(0)} 70%{transform:scale(1.25)} 100%{transform:scale(1)} }

.notif-panel {
    position: absolute; top: 48px; right: 0; width: 340px; max-width: 90vw;
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius); box-shadow: var(--shadow-lg); overflow: hidden; z-index: 50;
    animation: slidedown .18s ease;
}
@keyframes slidedown { from{opacity:0; transform:translateY(-8px)} to{opacity:1; transform:none} }
.notif-head { display: flex; justify-content: space-between; align-items: center; padding: 14px 16px; border-bottom: 1px solid var(--border); font-weight: 700; }
.link-btn { background: none; border: none; color: var(--primary); font-size: 12px; font-weight: 600; }
.notif-list { max-height: 380px; overflow-y: auto; }
.notif-row { display: flex; gap: 10px; padding: 12px 16px; border-bottom: 1px solid var(--border); align-items: flex-start; transition: background .12s; }
.notif-row:hover { background: var(--surface-2); }
.notif-row.unread { background: var(--primary-soft); }
.notif-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--primary); margin-top: 6px; flex: none; }
.notif-row .n-title { font-weight: 600; font-size: 13px; }
.notif-row .n-body { font-size: 12px; color: var(--text-soft); }
.notif-row .n-when { font-size: 11px; color: var(--text-faint); margin-top: 2px; }
.notif-empty { padding: 30px; text-align: center; color: var(--text-faint); font-size: 13px; }
.notif-all { display: block; text-align: center; padding: 12px; color: var(--primary); font-weight: 600; font-size: 13px; border-top: 1px solid var(--border); }

/* ---------- Content ---------- */
.content { padding: 24px; flex: 1; }

/* ---------- Toasts ---------- */
.toast {
    padding: 12px 18px; border-radius: var(--radius-sm); margin-bottom: 16px;
    font-weight: 500; box-shadow: var(--shadow-sm); animation: slidedown .25s ease;
}
.toast.success { background: #e7f7ee; color: #0f7a3d; border: 1px solid #b7e4c9; }
.toast.error   { background: #fdecec; color: #b42318; border: 1px solid #f5c2bd; }
html[data-theme="dark"] .toast.success { background: #10291c; color: #74e3a4; border-color: #1c4a33; }
html[data-theme="dark"] .toast.error   { background: #2a1414; color: #f5a29a; border-color: #4a1f1f; }

/* ---------- Dashboard ---------- */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 16px; }
.stat-card {
    background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
    padding: 18px; box-shadow: var(--shadow-sm); transition: transform .14s, box-shadow .14s;
    display: flex; flex-direction: column; gap: 6px; position: relative; overflow: hidden;
}
.stat-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); }
.stat-card .s-ic { font-size: 22px; }
.stat-card .s-num { font-size: 30px; font-weight: 800; letter-spacing: -.02em; }
.stat-card .s-label { font-size: 13px; color: var(--text-soft); font-weight: 500; }
.stat-card::after { content:""; position:absolute; right:-20px; top:-20px; width:70px; height:70px; border-radius:50%; background: var(--primary-soft); opacity:.6; }

.section-title { font-size: 15px; font-weight: 700; margin: 28px 0 14px; color: var(--text-soft); text-transform: uppercase; letter-spacing: .04em; }

.quick-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 14px; }
.quick-card {
    background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
    padding: 18px; display: flex; flex-direction: column; gap: 8px; box-shadow: var(--shadow-sm);
    transition: transform .14s, box-shadow .14s;
}
.quick-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); border-color: var(--primary); }
.quick-card .q-ic { font-size: 26px; }
.quick-card .q-label { font-weight: 600; }
.quick-card .q-count { font-size: 13px; color: var(--text-faint); }

/* ---------- Mail list ---------- */
.list-toolbar { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; gap: 12px; flex-wrap: wrap; }
.list-count { color: var(--text-faint); font-size: 13px; }

.mail-list { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow-sm); }
.mail-row {
    display: flex; align-items: center; gap: 12px; padding: 14px 18px;
    border-bottom: 1px solid var(--border); transition: background .12s; position: relative;
}
.mail-row:last-child { border-bottom: none; }
.mail-row:hover { background: var(--surface-2); }
.mail-row.unread { background: var(--surface); }
.mail-row.unread::before { content:""; position:absolute; left:0; top:0; bottom:0; width:3px; background: var(--primary); }
.mail-row.unread .m-from, .mail-row.unread .m-subject { font-weight: 700; }
.m-avatar { width: 42px; height: 42px; border-radius: 50%; background: linear-gradient(135deg,var(--primary),var(--accent)); color:#fff; display:grid; place-items:center; font-weight:700; flex:none; }
.m-main { flex: 1; min-width: 0; }
.m-toprow { display: flex; justify-content: space-between; gap: 10px; align-items: baseline; }
.m-from { font-size: 14px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.m-from .m-branch { color: var(--text-faint); font-weight: 500; font-size: 12px; }
.m-time { font-size: 12px; color: var(--text-faint); white-space: nowrap; flex: none; }
.m-subject { font-size: 14px; margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.m-snippet { font-size: 13px; color: var(--text-soft); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.m-tags { display: flex; align-items: center; gap: 6px; margin-top: 5px; flex-wrap: wrap; }
.m-flags { display: flex; gap: 4px; align-items: center; flex: none; }
.flag-star { font-size: 15px; opacity: .3; }
.flag-star.on { opacity: 1; }

.chip { font-size: 11px; font-weight: 600; padding: 2px 9px; border-radius: 999px; display: inline-flex; align-items: center; gap: 4px; }
.chip-cat { color: #fff; }
.chip-status { background: var(--surface-2); color: var(--text-soft); border: 1px solid var(--border); }
.chip-urgent { background: #fdecec; color: var(--danger); border: 1px solid #f5c2bd; }
.chip-attach { background: var(--surface-2); color: var(--text-soft); border: 1px solid var(--border); }
.status-Open           { color:#16a34a; }
.status-WaitingReply   { color:#d97706; }
.status-InProgress     { color:#2563eb; }
.status-WaitingApproval{ color:#7c3aed; }
.status-Urgent         { color:#dc2626; }
.status-Closed         { color:#64748b; }

/* ---------- Empty state ---------- */
.empty { text-align: center; padding: 70px 20px; color: var(--text-faint); }
.empty .e-ic { font-size: 54px; margin-bottom: 12px; }
.empty .e-title { font-size: 17px; font-weight: 700; color: var(--text-soft); }
.empty .e-sub { font-size: 14px; margin-top: 4px; }

/* ---------- Cards / panels ---------- */
.panel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-sm); }
.panel-pad { padding: 22px; }

/* ---------- Conversation ---------- */
.conv-header { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px 22px; box-shadow: var(--shadow-sm); margin-bottom: 18px; }
.conv-header .c-code { font-size: 12px; color: var(--text-faint); font-weight: 600; letter-spacing: .04em; }
.conv-header .c-subject { font-size: 22px; font-weight: 800; margin: 4px 0 10px; }
.conv-toolbar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.conv-participants { margin-top: 12px; display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.participant { font-size: 12px; background: var(--surface-2); border: 1px solid var(--border); border-radius: 999px; padding: 3px 10px; }

.thread { display: flex; flex-direction: column; gap: 16px; }
.msg { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-sm); overflow: hidden; animation: fadein .3s ease; }
@keyframes fadein { from{opacity:0; transform:translateY(6px)} to{opacity:1; transform:none} }
.msg-head { display: flex; align-items: center; gap: 12px; padding: 14px 18px; border-bottom: 1px solid var(--border); }
.msg-head .m-avatar { width: 38px; height: 38px; }
.msg-who { flex: 1; }
.msg-who .mw-name { font-weight: 700; font-size: 14px; }
.msg-who .mw-sub { font-size: 12px; color: var(--text-faint); }
.msg-time { font-size: 12px; color: var(--text-faint); }
.msg-body { padding: 18px; font-size: 14.5px; line-height: 1.65; word-wrap: break-word; }
.msg-body img { max-width: 100%; border-radius: 8px; }
.msg-body table { border-collapse: collapse; }
.msg-body td, .msg-body th { border: 1px solid var(--border); padding: 6px 10px; }
.msg-attach { padding: 0 18px 16px; display: flex; flex-wrap: wrap; gap: 10px; }
.attach-pill { display: inline-flex; align-items: center; gap: 8px; background: var(--surface-2); border: 1px solid var(--border); border-radius: 10px; padding: 8px 12px; font-size: 13px; transition: border .12s; }
.attach-pill:hover { border-color: var(--primary); }
.attach-pill .a-ic { font-size: 18px; }
.attach-pill .a-size { color: var(--text-faint); font-size: 11px; }

/* ---------- Reply box ---------- */
.reply-box { margin-top: 18px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-sm); padding: 16px; }
.reply-box .rb-title { font-weight: 700; margin-bottom: 10px; display:flex; align-items:center; gap:8px; }

/* ---------- Editor ---------- */
.editor-wrap { border: 1px solid var(--border); border-radius: var(--radius-sm); overflow: hidden; background: var(--surface); }
.editor-toolbar { display: flex; flex-wrap: wrap; gap: 2px; padding: 6px; border-bottom: 1px solid var(--border); background: var(--surface-2); }
.editor-toolbar button, .tool-btn {
    width: 34px; height: 32px; border: none; background: transparent; border-radius: 8px;
    color: var(--text-soft); font-size: 14px; display: grid; place-items: center; transition: background .12s;
}
.editor-toolbar button:hover, .tool-btn:hover { background: var(--border); color: var(--text); }
.editor-toolbar .mic.rec { color: var(--danger); animation: pulse 1s infinite; }
@keyframes pulse { 0%,100%{opacity:1} 50%{opacity:.4} }
.editor-area { min-height: 180px; padding: 14px; outline: none; font-size: 14.5px; line-height: 1.6; }
.editor-area:empty::before { content: attr(data-placeholder); color: var(--text-faint); }
.editor-area.small { min-height: 90px; }

/* ---------- Forms ---------- */
.form-grid { display: grid; gap: 16px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-size: 13px; font-weight: 600; color: var(--text-soft); }
.field input, .field select, .field textarea {
    padding: 10px 12px; border: 1px solid var(--border); border-radius: var(--radius-sm);
    background: var(--surface); color: var(--text); font-size: 14px; outline: none; font-family: inherit;
    transition: border .12s, box-shadow .12s;
}
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
.field .suffix-input { display: flex; align-items: center; border: 1px solid var(--border); border-radius: var(--radius-sm); overflow: hidden; }
.field .suffix-input input { border: none; border-radius: 0; flex: 1; }
.field .suffix-input .suffix { padding: 0 12px; color: var(--text-faint); background: var(--surface-2); align-self: stretch; display: grid; place-items: center; font-size: 13px; }
.help { font-size: 12px; color: var(--text-faint); }

.btn { padding: 10px 18px; border-radius: var(--radius-sm); border: 1px solid var(--border); background: var(--surface); color: var(--text); font-weight: 600; font-size: 14px; transition: background .12s, transform .1s; }
.btn:hover { background: var(--surface-2); }
.btn:active { transform: scale(.98); }
.btn-primary { background: linear-gradient(135deg,var(--primary),var(--primary-600)); color: #fff; border: none; box-shadow: var(--shadow-sm); }
.btn-primary:hover { box-shadow: var(--shadow-md); }
.btn-danger { background: var(--danger); color: #fff; border: none; }
.btn-ghost { background: transparent; border: 1px solid var(--border); }
.btn-sm { padding: 6px 12px; font-size: 13px; }
.btn-row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }

/* ---------- Recipient picker ---------- */
.picker { border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface); max-height: 260px; overflow-y: auto; }
.picker-group-title { font-size: 11px; text-transform: uppercase; letter-spacing: .05em; color: var(--text-faint); padding: 10px 14px 4px; font-weight: 700; position: sticky; top: 0; background: var(--surface); }
.picker-item { display: flex; align-items: center; gap: 10px; padding: 8px 14px; cursor: pointer; transition: background .1s; }
.picker-item:hover { background: var(--surface-2); }
.picker-item input { width: 16px; height: 16px; accent-color: var(--primary); }
.picker-item .pi-name { font-weight: 600; font-size: 14px; }
.picker-item .pi-sub { font-size: 12px; color: var(--text-faint); }
.selected-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
.tag { display: inline-flex; align-items: center; gap: 6px; background: var(--primary-soft); color: var(--primary); border-radius: 999px; padding: 4px 10px; font-size: 13px; font-weight: 600; }
.tag .x { cursor: pointer; opacity: .7; }
.tag .x:hover { opacity: 1; }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-sm); }
table.data { width: 100%; border-collapse: collapse; min-width: 640px; }
table.data th { text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--text-faint); padding: 14px 16px; border-bottom: 1px solid var(--border); }
table.data td { padding: 13px 16px; border-bottom: 1px solid var(--border); font-size: 14px; }
table.data tr:last-child td { border-bottom: none; }
table.data tr:hover td { background: var(--surface-2); }
.pill { font-size: 12px; font-weight: 600; padding: 3px 10px; border-radius: 999px; }
.pill.on  { background: #e7f7ee; color: #0f7a3d; }
.pill.off { background: #fdecec; color: #b42318; }
html[data-theme="dark"] .pill.on { background:#10291c; color:#74e3a4; }
html[data-theme="dark"] .pill.off { background:#2a1414; color:#f5a29a; }
.role-badge { font-size: 12px; font-weight: 600; padding: 3px 10px; border-radius: 999px; background: var(--primary-soft); color: var(--primary); }
.presence-dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; margin-right: 5px; }
.presence-online { background: #16a34a; } .presence-away { background: #d97706; } .presence-offline { background: #94a3b8; }

/* ---------- Modal ---------- */
.modal-scrim { position: fixed; inset: 0; background: rgba(10,12,30,.5); backdrop-filter: blur(2px); z-index: 100; display: none; align-items: center; justify-content: center; padding: 20px; }
.modal-scrim.open { display: flex; animation: fadein .18s ease; }
.modal { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow-lg); width: 100%; max-width: 480px; max-height: 90vh; overflow-y: auto; animation: slidedown .22s ease; }
.modal-head { padding: 18px 22px; border-bottom: 1px solid var(--border); font-weight: 700; font-size: 17px; display: flex; justify-content: space-between; align-items: center; }
.modal-body { padding: 22px; }
.modal-foot { padding: 16px 22px; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: 10px; }

/* ---------- Bottom nav (mobile) ---------- */
.bottom-nav { display: none; }
.fab { }

/* ---------- Profile ---------- */
.profile-card { max-width: 560px; }
.profile-hero { display: flex; align-items: center; gap: 18px; padding: 24px; border-bottom: 1px solid var(--border); }
.profile-hero .avatar { width: 72px; height: 72px; font-size: 30px; }
.profile-name { font-size: 22px; font-weight: 800; }
.profile-role { color: var(--text-soft); }
.profile-list { padding: 8px 0; }
.profile-list .pl-row { display: flex; justify-content: space-between; padding: 12px 24px; border-bottom: 1px solid var(--border); }
.profile-list .pl-row:last-child { border: none; }
.profile-list .pl-k { color: var(--text-faint); font-size: 13px; }
.profile-list .pl-v { font-weight: 600; font-size: 14px; }

/* ---------- Charts ---------- */
.chart-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 16px; }
.chart-card { }
.chart-title { font-weight: 700; font-size: 14px; margin-bottom: 16px; }
.bars-v { display: flex; align-items: flex-end; gap: 10px; height: 180px; padding-top: 10px; }
.bar-v-wrap { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; gap: 4px; }
.bar-v-val { font-size: 12px; font-weight: 700; color: var(--text-soft); }
.bar-v { width: 100%; max-width: 34px; min-height: 3px; border-radius: 6px 6px 0 0;
    background: linear-gradient(180deg, var(--primary), var(--accent)); transition: height .6s cubic-bezier(.2,.8,.2,1); }
.bar-v-label { font-size: 11px; color: var(--text-faint); white-space: nowrap; }
.bars-h { display: flex; flex-direction: column; gap: 12px; }
.bar-h-row { display: flex; align-items: center; gap: 10px; }
.bar-h-label { width: 96px; font-size: 12.5px; color: var(--text-soft); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; flex: none; }
.bar-h-track { flex: 1; height: 12px; background: var(--surface-2); border-radius: 999px; overflow: hidden; }
.bar-h { height: 100%; border-radius: 999px; background: linear-gradient(90deg, var(--primary), var(--accent)); min-width: 3px; transition: width .7s cubic-bezier(.2,.8,.2,1); }
.bar-h.alt  { background: linear-gradient(90deg, #0891b2, #22d3ee); }
.bar-h.alt2 { background: linear-gradient(90deg, #d97706, #fbbf24); }
.bar-h-val { width: 34px; text-align: right; font-size: 12.5px; font-weight: 700; color: var(--text-soft); flex: none; }

/* ---------- Skeleton ---------- */
.skeleton { background: linear-gradient(90deg, var(--surface-2) 25%, var(--border) 37%, var(--surface-2) 63%); background-size: 400% 100%; animation: shimmer 1.4s infinite; border-radius: 6px; }
@keyframes shimmer { 0%{background-position:100% 0} 100%{background-position:-100% 0} }

/* ============================================================
   Responsive
   ============================================================ */
@media (max-width: 900px) {
    .sidebar { transform: translateX(-100%); transition: transform .25s ease; box-shadow: var(--shadow-lg); }
    .sidebar.open { transform: none; }
    .sidebar-scrim.show { display: block; position: fixed; inset: 0; background: rgba(0,0,0,.4); z-index: 39; }
    .main { margin-left: 0; }
    .menu-btn { display: grid; }
    .topbar-search { display: none; }
    .content { padding: 16px 14px 90px; }
    .bottom-nav {
        display: flex; position: fixed; bottom: 0; left: 0; right: 0; height: 62px;
        background: var(--surface); border-top: 1px solid var(--border); z-index: 35;
        justify-content: space-around; align-items: center; padding-bottom: env(safe-area-inset-bottom);
    }
    .bottom-nav a { display: flex; flex-direction: column; align-items: center; gap: 2px; font-size: 10px; color: var(--text-faint); flex: 1; }
    .bottom-nav a.active { color: var(--primary); }
    .bottom-nav a span { font-size: 19px; }
    .bottom-nav a.fab { flex: none; width: 54px; height: 54px; margin-top: -22px; border-radius: 50%; background: linear-gradient(135deg,var(--primary),var(--primary-600)); color: #fff; box-shadow: var(--shadow-lg); }
    .bottom-nav a.fab span { font-size: 22px; }
    .conv-header .c-subject { font-size: 18px; }
}
@media (min-width: 901px) { .menu-btn { display: none; } }
