/* SkillNest UI – shared design system (Bootstrap 5.3 base) */
:root {
  --sn-primary: #4f46e5;
  --sn-primary-600: #4338ca;
  --sn-accent: #14b8a6;
  --sn-bg: #f4f6fb;
  --sn-surface: #ffffff;
  --sn-ink: #0f172a;
  --sn-muted: #64748b;
  --sn-border: #e5e7f0;
  --sn-side: #0f172a;
  --sn-side-ink: #cbd5e1;
  --sn-radius: 14px;
  --bs-primary: var(--sn-primary);
  --bs-primary-rgb: 79, 70, 229;
  --bs-body-font-family: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --bs-body-color: var(--sn-ink);
  --bs-border-color: var(--sn-border);
  --bs-link-color: var(--sn-primary);
  --bs-link-color-rgb: 79, 70, 229;
}
body { background: var(--sn-bg); font-size: .925rem; }
.btn-primary { --bs-btn-bg: var(--sn-primary); --bs-btn-border-color: var(--sn-primary); --bs-btn-hover-bg: var(--sn-primary-600); --bs-btn-hover-border-color: var(--sn-primary-600); --bs-btn-active-bg: var(--sn-primary-600); }
.btn-outline-primary { --bs-btn-color: var(--sn-primary); --bs-btn-border-color: var(--sn-primary); --bs-btn-hover-bg: var(--sn-primary); --bs-btn-hover-border-color: var(--sn-primary); }
.text-primary { color: var(--sn-primary) !important; }
.bg-primary { background-color: var(--sn-primary) !important; }
.btn { border-radius: 10px; font-weight: 500; }
.form-control, .form-select { border-radius: 10px; border-color: var(--sn-border); }
.form-control:focus, .form-select:focus { border-color: var(--sn-primary); box-shadow: 0 0 0 .2rem rgba(79,70,229,.15); }
.form-label { font-weight: 500; font-size: .85rem; color: #334155; }

/* Layout */
.app { display: flex; min-height: 100vh; }
.sidebar { width: 252px; flex-shrink: 0; background: var(--sn-side); color: var(--sn-side-ink); display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; overflow-y: auto; z-index: 1040; transition: transform .2s; }
.brand { display: flex; align-items: center; gap: .75rem; padding: 1.25rem 1.25rem 1rem; }
.brand-mark { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; background: linear-gradient(135deg, var(--sn-primary), var(--sn-accent)); color: #fff; font-size: 1.25rem; overflow: hidden; }
.brand-mark img { width: 100%; height: 100%; object-fit: cover; }
.brand-name { color: #fff; font-weight: 700; line-height: 1.1; }
.brand-sub { font-size: .75rem; color: #94a3b8; }
.sidebar .nav { padding: .5rem .75rem; gap: 2px; }
.sidebar .nav-section { font-size: .68rem; text-transform: uppercase; letter-spacing: .08em; color: #64748b; padding: 1rem .75rem .35rem; font-weight: 600; }
.sidebar .nav-link { color: var(--sn-side-ink); border-radius: 10px; padding: .55rem .75rem; display: flex; align-items: center; gap: .7rem; font-weight: 500; }
.sidebar .nav-link i { font-size: 1.05rem; opacity: .85; }
.sidebar .nav-link:hover { background: rgba(255,255,255,.06); color: #fff; }
.sidebar .nav-link.active { background: var(--sn-primary); color: #fff; box-shadow: 0 6px 16px rgba(79,70,229,.35); }
.sidebar-foot { margin-top: auto; padding: 1rem 1.25rem; font-size: .75rem; color: #475569; }
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar { position: sticky; top: 0; z-index: 1030; display: flex; align-items: center; gap: 1rem; padding: .85rem 1.5rem; background: rgba(244,246,251,.85); backdrop-filter: blur(8px); border-bottom: 1px solid var(--sn-border); }
.page-title { font-size: 1.15rem; font-weight: 700; margin: 0; }
.content { padding: 1.5rem; }
.avatar { width: 34px; height: 34px; border-radius: 50%; display: inline-grid; place-items: center; background: linear-gradient(135deg, var(--sn-primary), var(--sn-accent)); color: #fff; font-weight: 600; font-size: .85rem; flex-shrink: 0; overflow: hidden; }
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar-lg { width: 64px; height: 64px; font-size: 1.4rem; }
@media (max-width: 991.98px) {
  .sidebar { position: fixed; left: 0; transform: translateX(-100%); }
  .sidebar.open { transform: none; box-shadow: 0 0 40px rgba(0,0,0,.4); }
  .content { padding: 1rem; }
}

/* Cards */
.card { border: 1px solid var(--sn-border); border-radius: var(--sn-radius); box-shadow: 0 1px 2px rgba(15,23,42,.04); }
.card-header { background: transparent; border-bottom: 1px solid var(--sn-border); padding: .9rem 1.25rem; font-weight: 600; display: flex; align-items: center; gap: .5rem; }
.card-header .actions { margin-left: auto; display: flex; gap: .5rem; }
.stat-card .stat-icon { width: 48px; height: 48px; border-radius: 12px; display: grid; place-items: center; font-size: 1.35rem; flex-shrink: 0; }
.stat-value { font-size: 1.5rem; font-weight: 700; line-height: 1.1; }
.stat-label { color: var(--sn-muted); font-size: .8rem; font-weight: 500; }

/* Tables */
.table { --bs-table-bg: transparent; margin-bottom: 0; }
.table > :not(caption) > * > * { padding: .7rem .9rem; vertical-align: middle; }
.table thead th { font-size: .72rem; text-transform: uppercase; letter-spacing: .05em; color: var(--sn-muted); font-weight: 600; background: #f8fafc; border-bottom-width: 1px; white-space: nowrap; }
.table-hover tbody tr:hover { background: #f8f9ff; }
.empty { text-align: center; padding: 3rem 1rem; color: var(--sn-muted); }
.empty i { font-size: 2.5rem; display: block; margin-bottom: .5rem; opacity: .5; }

/* Badges / chips */
.badge { font-weight: 600; letter-spacing: .01em; }
.chip { display: inline-flex; align-items: center; gap: .35rem; padding: .25rem .6rem; border-radius: 999px; background: #eef2ff; color: var(--sn-primary); font-size: .78rem; font-weight: 600; }
.status-dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }

/* Auth */
.auth-wrap { min-height: 100vh; display: grid; grid-template-columns: 1.1fr 1fr; }
.auth-hero { background: radial-gradient(circle at 20% 20%, rgba(20,184,166,.35), transparent 40%), linear-gradient(135deg, #1e1b4b, var(--sn-primary)); color: #fff; padding: 3.5rem; display: flex; flex-direction: column; justify-content: space-between; }
.auth-hero h2 { font-weight: 700; font-size: 2.1rem; line-height: 1.2; }
.auth-hero .feature { display: flex; gap: .75rem; align-items: flex-start; margin-bottom: 1rem; opacity: .95; }
.auth-hero .feature i { font-size: 1.3rem; background: rgba(255,255,255,.12); border-radius: 10px; padding: .4rem .55rem; }
.auth-panel { display: flex; align-items: center; justify-content: center; padding: 2rem; background: #fff; }
.auth-box { width: 100%; max-width: 400px; }
.otp-inputs { display: flex; gap: .5rem; justify-content: space-between; }
.otp-inputs input { width: 52px; height: 58px; text-align: center; font-size: 1.5rem; font-weight: 700; border-radius: 12px; }
.demo-otp { background: #fffbeb; border: 1px dashed #f59e0b; border-radius: 12px; padding: .75rem 1rem; color: #92400e; }
.demo-otp b { font-size: 1.3rem; letter-spacing: .3em; }
@media (max-width: 991.98px) { .auth-wrap { grid-template-columns: 1fr; } .auth-hero { display: none; } }

/* Misc */
.kv { display: grid; grid-template-columns: 160px 1fr; gap: .45rem 1rem; font-size: .9rem; }
.kv dt { color: var(--sn-muted); font-weight: 500; }
.kv dd { margin: 0; word-break: break-all; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .85rem; }
.secret { filter: blur(4px); cursor: pointer; transition: filter .15s; }
.secret.show { filter: none; }
.filter-bar { display: flex; flex-wrap: wrap; gap: .5rem; align-items: end; }
.modal-content { border-radius: var(--sn-radius); border: 0; }
.modal-header { border-bottom-color: var(--sn-border); }
.nav-tabs .nav-link { font-weight: 500; color: var(--sn-muted); }
.nav-tabs .nav-link.active { color: var(--sn-primary); }
.progress { border-radius: 999px; height: .5rem; }

/* ---- v1.3: presence, chat, tickets ---- */
.sidebar .nav-badge { font-size: .68rem; }
.presence { position: absolute; right: -2px; bottom: -2px; width: 11px; height: 11px; border-radius: 50%; border: 2px solid #fff; }
.presence-dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; }
.presence-online { background: #22c55e; } .presence-away { background: #f59e0b; } .presence-offline { background: #94a3b8; }
.chat-wrap { display: grid; grid-template-columns: 330px 1fr; height: calc(100vh - 140px); min-height: 520px; }
.chat-list { border-right: 1px solid var(--sn-border); overflow-y: auto; }
.chat-item { display: flex; gap: .7rem; padding: .8rem 1rem; border-bottom: 1px solid var(--sn-border); color: inherit; text-decoration: none; }
.chat-item:hover { background: #f8f9ff; } .chat-item.active { background: #eef0ff; }
.chat-item .meta { font-size: .75rem; color: var(--sn-muted); }
.chat-pane { display: flex; flex-direction: column; min-width: 0; }
.chat-head { padding: .8rem 1.2rem; border-bottom: 1px solid var(--sn-border); display: flex; align-items: center; gap: .75rem; flex-wrap: wrap; }
.chat-body { flex: 1; overflow-y: auto; padding: 1.2rem; background: #f8fafc; display: flex; flex-direction: column; gap: .5rem; }
.bubble { max-width: 72%; padding: .6rem .85rem; border-radius: 16px; white-space: pre-wrap; word-wrap: break-word; font-size: .92rem; box-shadow: 0 1px 1px rgba(15,23,42,.05); }
.bubble.school { background: #fff; border: 1px solid var(--sn-border); align-self: flex-start; border-bottom-left-radius: 4px; }
.bubble.support { background: var(--sn-primary); color: #fff; align-self: flex-end; border-bottom-right-radius: 4px; }
.bubble.system { align-self: center; background: transparent; box-shadow: none; color: var(--sn-muted); font-size: .78rem; padding: .2rem; }
.bubble .who { font-size: .72rem; font-weight: 600; opacity: .75; margin-bottom: .1rem; }
.bubble .at { font-size: .68rem; opacity: .65; margin-top: .2rem; text-align: right; }
.chat-foot { border-top: 1px solid var(--sn-border); padding: .75rem; display: flex; gap: .5rem; align-items: flex-end; background: #fff; }
.chat-foot textarea { resize: none; }
@media (max-width: 991.98px) { .chat-wrap { grid-template-columns: 1fr; height: auto; } .chat-list { max-height: 240px; border-right: 0; border-bottom: 1px solid var(--sn-border); } .chat-body { min-height: 360px; } }
.timeline { list-style: none; padding: 0; margin: 0; }
.msg { border: 1px solid var(--sn-border); border-radius: 12px; margin-bottom: .9rem; background: #fff; }
.msg.support { border-left: 4px solid var(--sn-primary); } .msg.school { border-left: 4px solid #14b8a6; }
.msg.internal { background: #fffbeb; border-color: #fde68a; border-left: 4px solid #f59e0b; }
.msg .msg-head { padding: .55rem .9rem; border-bottom: 1px solid var(--sn-border); display: flex; gap: .5rem; align-items: center; font-size: .85rem; }
.msg .msg-body { padding: .8rem .9rem; white-space: pre-wrap; word-wrap: break-word; }
.sys-line { color: var(--sn-muted); font-size: .8rem; margin: -.3rem 0 .9rem .5rem; }
.module-card { border: 1px solid var(--sn-border); border-radius: 12px; padding: .75rem .9rem; display: flex; gap: .75rem; align-items: center; background: #fff; height: 100%; }
.module-card .mi { width: 38px; height: 38px; border-radius: 10px; display: grid; place-items: center; background: #eef0ff; color: var(--sn-primary); font-size: 1.1rem; flex: none; }
.module-card.off .mi { background: #f1f5f9; color: #94a3b8; } .module-card.off .mname { color: var(--sn-muted); }
.seg { flex: none; white-space: nowrap; display: inline-flex; border: 1px solid var(--sn-border); border-radius: 999px; overflow: hidden; font-size: .72rem; }
.seg input { display: none; } .seg label { padding: .2rem .55rem; cursor: pointer; color: var(--sn-muted); }
.seg input:checked + label { background: var(--sn-primary); color: #fff; }
.seg input[value="off"]:checked + label { background: #ef4444; } .seg input[value="on"]:checked + label { background: #16a34a; }
.plan-chip { display: inline-flex; align-items: center; gap: .3rem; padding: .15rem .55rem; border-radius: 999px; font-size: .75rem; font-weight: 600; color: #fff; }
.nav-pills .nav-link.active { background: var(--sn-primary); } .nav-pills .nav-link { color: var(--sn-primary); } .nav-pills .nav-link.active { color: #fff; }
