/* CollHub - application shell and shared components. */
html, body { height: 100%; }
body { overflow: hidden; }
button { cursor: pointer; }
a, [role="button"], label.check, summary { cursor: pointer; }

/* ---- boot ---- */
.boot { position: fixed; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 18px; background: var(--paper); z-index: 50; }
.boot-mark { font-size: 34px; color: var(--ink); }
.boot-spinner { width: 28px; height: 28px; border: 3px solid var(--line); border-top-color: var(--primary); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.logo-mark { display: inline-flex; width: 34px; height: 34px; border-radius: 10px; align-items: center; justify-content: center;
    background: linear-gradient(135deg, var(--primary), #2a9d8f); color: #fff; font-size: 17px; box-shadow: 0 4px 10px rgba(31, 111, 139, .3);
    --fa-secondary-opacity: .55; }

/* ---- login ---- */
.login { position: fixed; inset: 0; overflow: auto; display: flex; align-items: center; justify-content: center; padding: 30px 16px;
    background: radial-gradient(1200px 600px at 10% -10%, #dcebef 0%, transparent 60%), radial-gradient(900px 500px at 110% 110%, #f7dfd2 0%, transparent 55%), var(--paper); }
.login-card { width: 100%; max-width: 460px; background: var(--surface); border-radius: var(--radius-lg); box-shadow: var(--shadow-lg); padding: 32px 32px 26px; display: flex; flex-direction: column; }
.login-brand { display: inline-flex; align-items: center; gap: 10px; font-size: 22px; color: var(--ink); margin-bottom: 18px; }
.login-brand:hover { text-decoration: none; }
.login-title { font-size: 22px; margin: 0; }
.login-studio { color: var(--muted); margin: 4px 0 20px; }
.login-btn { width: 100%; margin-top: 4px; }
.login-error { background: var(--danger-50); color: var(--danger); border-radius: var(--radius-sm); padding: 9px 12px; margin-bottom: 12px; font-weight: 600; }
.login-demo { margin-top: 22px; border-top: 1px solid var(--line); padding-top: 18px; }
.login.demo-first .login-demo { order: -1; margin: 0 0 22px; padding: 0 0 18px; border-top: 0; border-bottom: 1px solid var(--line); }
.login.demo-first .login-card { max-width: 520px; }
.login.demo-first .login-brand { order: -3; }
.login.demo-first .login-title, .login.demo-first .login-studio { order: -2; }
.login-demo-head { font-weight: 700; color: var(--ink-2); margin-bottom: 10px; display: flex; gap: 8px; align-items: center; }
.login-demo-head i { color: var(--accent); }
.login-demo-list { display: flex; flex-direction: column; gap: 6px; max-height: 330px; overflow: auto; }
.demo-user { display: flex; align-items: center; gap: 12px; text-align: left; border: 1px solid var(--line); background: var(--surface-2); padding: 8px 12px; border-radius: var(--radius); transition: border-color .12s, background .12s, transform .08s; }
.demo-user:hover { border-color: var(--primary); background: var(--primary-50); }
.demo-user span:nth-child(2) { flex: 1; display: flex; flex-direction: column; }
.demo-user small { color: var(--muted); }
.demo-user > i { color: var(--muted); }
.login-demo-hint { margin-top: 10px; font-size: 12.5px; color: var(--muted); }

/* ---- shell ---- */
.shell { display: flex; height: 100vh; }
.sidebar { width: 236px; flex: 0 0 236px; background: #16202b; color: #cfd7df; display: flex; flex-direction: column; padding: 16px 12px; gap: 6px; }
.sb-brand { display: flex; align-items: center; gap: 10px; color: #fff; font-size: 21px; padding: 2px 6px 0; }
.sb-brand:hover { text-decoration: none; }
.sb-studio { font-size: 12px; color: #8795a3; padding: 2px 6px 12px; border-bottom: 1px solid rgba(255,255,255,.07); margin-bottom: 8px; }
.sb-nav { display: flex; flex-direction: column; gap: 2px; }
.sb-item { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 8px; color: #cfd7df; font-weight: 600; position: relative; --fa-secondary-opacity: .45; }
.sb-item i { width: 20px; text-align: center; font-size: 17px; color: #8fb3c4; }
.sb-item:hover { background: rgba(255,255,255,.06); text-decoration: none; color: #fff; }
.sb-item.is-active { background: rgba(31, 111, 139, .35); color: #fff; }
.sb-item.is-active i { color: #9fd7e8; }
.sb-badge { margin-left: auto; background: var(--accent); color: #fff; font-size: 11px; min-width: 20px; height: 20px; border-radius: 10px; display: inline-flex; align-items: center; justify-content: center; padding: 0 6px; }
.sb-bottom { margin-top: auto; display: flex; flex-direction: column; gap: 4px; }
.sb-tour { display: flex; align-items: center; gap: 10px; background: transparent; border: 1px dashed rgba(255,255,255,.18); color: #cfd7df; border-radius: 8px; padding: 8px 12px; font-weight: 600; }
.sb-tour:hover { background: rgba(255,255,255,.06); color: #fff; }
.sb-tour i { color: #f0a47f; }
.sb-me { display: flex; align-items: center; gap: 10px; padding: 10px 8px; border-radius: 10px; margin-top: 6px; border-top: 1px solid rgba(255,255,255,.07); }
.sb-me:hover { background: rgba(255,255,255,.06); }
.sb-me-text { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.sb-me-text b { color: #fff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sb-me-text small { color: #8795a3; }
.user-menu { position: fixed; left: 14px; bottom: 76px; width: 208px; background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow-lg); padding: 6px; z-index: 900; }
.um-item { display: flex; width: 100%; gap: 10px; align-items: center; background: none; border: 0; padding: 9px 10px; border-radius: 6px; text-align: left; font-weight: 600; color: var(--ink-2); }
.um-item:hover { background: var(--surface-2); }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar { height: 58px; flex: 0 0 58px; display: flex; align-items: center; gap: 12px; padding: 0 20px; background: var(--surface); border-bottom: 1px solid var(--line); }
.topbar-menu { display: none; }
.topbar-title { font-size: 18px; margin: 0; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 14px; }
.conn-state { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--success); font-weight: 600; }
.conn-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--success); box-shadow: 0 0 0 3px var(--success-50); animation: pulse 2.4s infinite; }
.conn-state.is-down { color: var(--warning); }
.conn-state.is-down .conn-dot { background: var(--warning); box-shadow: 0 0 0 3px var(--warning-50); }
@keyframes pulse { 50% { box-shadow: 0 0 0 6px rgba(46,139,87,.08); } }
.online-stack { display: flex; align-items: center; }
.online-stack .avatar { margin-left: -6px; border: 2px solid var(--surface); }
.online-stack .avatar:first-child { margin-left: 0; }
.online-count { font-size: 12px; color: var(--muted); margin-left: 8px; white-space: nowrap; }
.bell { position: relative; font-size: 17px; }
.bell-badge { position: absolute; top: 0; right: 0; background: var(--danger); color: #fff; font-size: 10.5px; min-width: 17px; height: 17px; border-radius: 9px; display: inline-flex; align-items: center; justify-content: center; padding: 0 4px; }
.view { flex: 1; min-height: 0; overflow: auto; }

/* ---- avatars ---- */
.avatar { --c: #6d7580; position: relative; display: inline-flex; align-items: center; justify-content: center; flex: 0 0 auto; border-radius: 50%;
    background: var(--c); color: #fff; font-weight: 700; letter-spacing: .3px; user-select: none; }
.avatar-xs { width: 22px; height: 22px; font-size: 9.5px; }
.avatar-sm { width: 30px; height: 30px; font-size: 11.5px; }
.avatar-md { width: 38px; height: 38px; font-size: 13.5px; }
.avatar-lg { width: 54px; height: 54px; font-size: 18px; }
.avatar.more { background: var(--line-strong); color: var(--ink-2); }
.presence { position: absolute; right: -1px; bottom: -1px; width: 30%; height: 30%; min-width: 8px; min-height: 8px; border-radius: 50%; background: #b8bec6; border: 2px solid var(--surface); }
.presence.is-on { background: #31b36b; }

/* ---- chips and picker ---- */
.chip { --c: var(--primary); display: inline-flex; align-items: center; gap: 6px; background: var(--surface-2); border: 1px solid var(--line); border-radius: 20px; padding: 3px 6px 3px 4px; font-size: 12.5px; font-weight: 600; }
.chip button { background: none; border: 0; color: var(--muted); padding: 0 3px; }
.chip button:hover { color: var(--danger); }
.chip-team { padding-left: 9px; border-color: var(--c); color: var(--c); background: #fff; }
.picker { border: 1px solid var(--line-strong); border-radius: var(--radius-sm); padding: 6px; background: var(--surface); }
.picker:focus-within { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(31, 111, 139, .15); }
.picker-chips { display: flex; flex-wrap: wrap; gap: 5px; margin-bottom: 6px; }
.picker-empty { color: var(--muted); font-size: 12.5px; padding: 2px 4px; }
.picker-add { position: relative; }
.picker-search { border: 0; padding: 4px; box-shadow: none !important; }
.picker-menu { position: absolute; left: 0; right: 0; top: calc(100% + 4px); background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-lg); max-height: 260px; overflow: auto; z-index: 20; padding: 4px; }
.picker-opt { display: flex; align-items: center; gap: 10px; width: 100%; background: none; border: 0; text-align: left; padding: 7px 8px; border-radius: 6px; }
.picker-opt:hover { background: var(--primary-50); }
.picker-opt span:last-child { display: flex; flex-direction: column; }
.picker-opt small { color: var(--muted); }
.picker-none { padding: 10px; color: var(--muted); }
.team-dot { --c: var(--primary); width: 30px; height: 30px; border-radius: 50%; background: var(--c); color: #fff; display: inline-flex; align-items: center; justify-content: center; font-size: 12px; }

/* ---- modal ---- */
.modal-backdrop { position: fixed; inset: 0; background: rgba(22, 32, 43, .45); display: flex; align-items: flex-start; justify-content: center; padding: 6vh 16px 16px; z-index: 1000; overflow: auto; animation: fade .12s; }
@keyframes fade { from { opacity: 0; } }
.modal { background: var(--surface); border-radius: var(--radius-lg); box-shadow: var(--shadow-lg); width: 100%; display: flex; flex-direction: column; max-height: 88vh; animation: pop .14s ease-out; }
@keyframes pop { from { transform: translateY(10px) scale(.99); opacity: 0; } }
.modal-sm { max-width: 420px; }
.modal-md { max-width: 560px; }
.modal-lg { max-width: 760px; }
.modal-xl { max-width: 1040px; }
.modal-head { display: flex; align-items: center; gap: 10px; padding: 16px 18px 12px; border-bottom: 1px solid var(--line); }
.modal-head h2 { font-size: 17px; margin: 0; flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.modal-head h2 i { color: var(--primary); margin-right: 4px; }
.modal-body { padding: 16px 18px; overflow: auto; }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 12px 18px; border-top: 1px solid var(--line); background: var(--surface-2); border-radius: 0 0 var(--radius-lg) var(--radius-lg); }
.modal-foot-left { margin-right: auto; }
.confirm-msg { margin: 0; color: var(--ink-2); font-size: 14.5px; }

/* ---- files ---- */
.file-chip { display: inline-flex; align-items: center; gap: 8px; border: 1px solid var(--line); background: var(--surface); border-radius: var(--radius); padding: 6px 8px 6px 10px; max-width: 100%; }
.file-chip-icon { font-size: 20px; color: var(--primary); --fa-secondary-opacity: .35; }
.file-chip-icon.fa-file-pdf { color: #c0392b; }
.file-chip-icon.fa-file-image { color: #7b5ea7; }
.file-chip-icon.fa-file-excel { color: #2e8b57; }
.file-chip-name { background: none; border: 0; padding: 0; font-weight: 600; color: var(--ink); text-align: left; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 260px; }
.file-chip-name:hover { color: var(--primary); text-decoration: underline; }
.file-chip-size { color: var(--muted); font-size: 12px; white-space: nowrap; }
.file-chip-dl, .file-chip-rm { color: var(--muted); padding: 2px 5px; border-radius: 5px; background: none; border: 0; }
.file-chip-dl:hover { color: var(--accent); background: var(--accent-50); }
.file-chip-rm:hover { color: var(--danger); background: var(--danger-50); }
.preview-img { text-align: center; background: #f0eee9; border-radius: var(--radius); padding: 10px; }
.preview-img img { max-width: 100%; max-height: 64vh; border-radius: 6px; }
.preview-frame { width: 100%; height: 64vh; border: 1px solid var(--line); border-radius: var(--radius); background: #fff; }
.preview-none { text-align: center; padding: 40px; color: var(--muted); }
.preview-none i { font-size: 54px; color: var(--primary); }
.preview-meta { display: flex; gap: 18px; flex-wrap: wrap; margin-top: 12px; color: var(--muted); font-size: 12.5px; }
.preview-meta i { color: var(--primary); }

/* ---- drop zone (shared by chat, appointments, archive) ---- */
.dropzone { border: 2px dashed var(--line-strong); border-radius: var(--radius); padding: 16px; text-align: center; color: var(--muted); transition: border-color .12s, background .12s; }
.dropzone.is-over { border-color: var(--primary); background: var(--primary-50); color: var(--primary); }

/* ---- notifications panel ---- */
.notif-panel { position: fixed; right: 16px; top: 62px; width: 390px; max-width: calc(100vw - 32px); max-height: calc(100vh - 90px); background: var(--surface); border-radius: var(--radius-lg); box-shadow: var(--shadow-lg); z-index: 950; display: flex; flex-direction: column; }
.notif-head { display: flex; align-items: center; gap: 8px; padding: 12px 14px; border-bottom: 1px solid var(--line); }
.notif-head-actions { margin-left: auto; display: flex; gap: 4px; }
.notif-list { overflow: auto; padding: 6px; }
.notif { display: flex; gap: 12px; width: 100%; text-align: left; background: none; border: 0; border-radius: var(--radius); padding: 10px; }
.notif:hover { background: var(--surface-2); }
.notif.is-unread { background: var(--primary-50); }
.notif-icon { font-size: 18px; color: var(--primary); margin-top: 2px; width: 22px; text-align: center; }
.notif-text { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.notif-text span { color: var(--ink-2); font-size: 13px; }
.notif-text small { color: var(--muted); font-size: 11.5px; }
.notif-empty { text-align: center; padding: 30px; color: var(--muted); }
.notif-empty i { font-size: 34px; }

/* ---- page scaffolding used by the views ---- */
.page { padding: 20px 24px 40px; max-width: 1400px; margin: 0 auto; }
.page-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.page-head h2 { margin: 0; font-size: 20px; }
.page-head .spacer { flex: 1; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); box-shadow: var(--shadow-sm); }
.card-head { display: flex; align-items: center; gap: 10px; padding: 14px 16px; border-bottom: 1px solid var(--line); }
.card-head h3 { margin: 0; font-size: 15px; }
.card-head h3 i { color: var(--primary); margin-right: 6px; }
.card-body { padding: 14px 16px; }
.empty { text-align: center; color: var(--muted); padding: 28px 12px; }
.empty i { font-size: 30px; display: block; margin-bottom: 8px; color: var(--line-strong); }
.badge { display: inline-flex; align-items: center; gap: 4px; font-size: 11.5px; font-weight: 700; padding: 2px 8px; border-radius: 20px; background: var(--surface-2); color: var(--ink-2); border: 1px solid var(--line); }
.badge-success { background: var(--success-50); color: var(--success); border-color: transparent; }
.badge-warning { background: var(--warning-50); color: #9a6503; border-color: transparent; }
.badge-danger { background: var(--danger-50); color: var(--danger); border-color: transparent; }
.badge-primary { background: var(--primary-50); color: var(--primary); border-color: transparent; }
.seg { display: inline-flex; background: var(--surface-2); border: 1px solid var(--line); border-radius: 8px; padding: 3px; gap: 2px; }
.seg button { background: none; border: 0; padding: 6px 12px; border-radius: 6px; font-weight: 600; color: var(--ink-2); font-size: 13px; display: inline-flex; gap: 6px; align-items: center; }
.seg button:hover { background: rgba(28,39,51,.05); }
.seg button.is-active { background: var(--surface); color: var(--primary); box-shadow: var(--shadow-sm); }

/* ---- responsive ---- */
@media (max-width: 860px) {
    .sidebar { position: fixed; left: 0; top: 0; bottom: 0; z-index: 800; transform: translateX(-100%); transition: transform .18s; }
    .sidebar.is-open { transform: none; box-shadow: var(--shadow-lg); }
    .topbar-menu { display: inline-flex; }
    .topbar { padding: 0 12px; }
    .conn-label, .online-count { display: none; }
    .page { padding: 14px 12px 30px; }
    .user-menu { left: 14px; }
    .field-row { grid-template-columns: 1fr; }
}
.logo-img { width: 34px; height: 34px; flex: 0 0 34px; }

/* ---- notification settings ---- */
.set-channels { display: flex; flex-direction: column; gap: 8px; margin-bottom: 14px; }
.set-ch { display: flex; align-items: center; gap: 12px; border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 12px; background: var(--surface-2); cursor: pointer; }
.set-ch > i { font-size: 20px; color: var(--primary); width: 24px; text-align: center; }
.set-ch span { flex: 1; display: flex; flex-direction: column; }
.set-ch small { color: var(--muted); }
.set-tg { cursor: default; }
.set-groups { display: flex; flex-direction: column; gap: 6px; }
.set-last h4 { margin: 4px 0 8px; font-size: 13px; color: var(--ink-2); }
.set-last-row { display: flex; align-items: center; gap: 10px; padding: 6px 0; border-top: 1px solid var(--line); font-size: 13px; }
.set-last-row i { color: var(--primary); }
.set-last-row span:nth-child(2) { flex: 1; display: flex; flex-direction: column; }
.set-last-row small { color: var(--muted); }
