/* ═══════════════════════════════════════════════════════
   KPAS — styles.css  |  v4.0  (Slack-style workspace design)
   KS Primary Academic & DE Departments · 2026
   ═══════════════════════════════════════════════════════ */

/* ── TOKENS ── */
:root {
  --sidebar:        #2eb67d;   /* bright green sidebar */
  --sidebar-2:      #279e6c;   /* darker shade for gradients/borders */
  --accent2:        #7ed957;   /* secondary accent (light green) */
  --accent:         #2eb67d;   /* primary action green (app-wide) */
  --accent-hover:   #279e6c;
  --accent-soft:    #E7F5EF;
  --accent-soft-bd: #B7E0CE;
  --brand-a:        #2eb67d;
  --brand-b:        #7ed957;

  --ink:     #1D1C1D;
  --muted:   #7A7A7A;
  --muted-2: #9B9A9B;
  --border:  #E6E6E6;
  --border-2:#ECECEC;
  --bg:      #ffffff;
  --field-bg:#F4F4F4;
  --danger:  #C0303B;
  --danger-bg:#FCEDED;
  --danger-bd:#F1CFCF;

  --r:  11px;
  --rs: 9px;
  --shadow-card: 0 5px 16px rgba(0,0,0,.08);
  --shadow-modal:0 24px 70px rgba(0,0,0,.35);
}

*,*::before,*::after { margin:0; padding:0; box-sizing:border-box; }

html,body { height:100%; }
body {
  font-family: 'Lato', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg); color: var(--ink);
  -webkit-font-smoothing: antialiased;
}

::-webkit-scrollbar { width:11px; height:11px; }
::-webkit-scrollbar-thumb { background:rgba(0,0,0,.16); border-radius:7px; border:3px solid transparent; background-clip:padding-box; }
::-webkit-scrollbar-track { background:transparent; }

@keyframes kpasIn  { from{opacity:0;transform:translateY(6px);} to{opacity:1;transform:translateY(0);} }
@keyframes kpasPop { from{opacity:0;transform:scale(.97) translateY(6px);} to{opacity:1;transform:scale(1) translateY(0);} }

/* ── Inline SVG icon sizing (self-hosted, no CDN) ── */
.ic { width:16px; height:16px; flex-shrink:0; display:inline-block; vertical-align:middle; }
.btn-sec-action .ic  { width:13px; height:13px; }
.btn-new-sec .ic     { width:15px; height:15px; }
.tool-btn .ic        { width:15px; height:15px; }
.mtitle .ic          { width:18px; height:18px; }
.btn-upload .ic      { width:15px; height:15px; }
.footer-edit-btn .ic { width:13px; height:13px; }
.toast .ic           { width:16px; height:16px; }
.ctrl .ic            { width:14px; height:14px; }
.card-arrow .ic      { width:16px; height:16px; }
.add-icon .ic        { width:16px; height:16px; }

/* ════════════════════════════════════════
   LOGIN GATE (first page)
   ════════════════════════════════════════ */
#loginPage {
  position:fixed; inset:0; z-index:800;
  display:flex; align-items:center; justify-content:center; padding:24px;
  background:#ffffff;
}
body.authed #loginPage { display:none; }

.login-card {
  width:100%; max-width:380px;
  background:#fff; border:1px solid var(--border); border-radius:18px;
  box-shadow:0 12px 40px rgba(0,0,0,.10);
  padding:36px 30px 30px; text-align:center;
  animation:kpasPop .25s ease;
}
.login-brand {
  width:60px; height:60px; margin:0 auto 16px;
  border-radius:16px;
  background:linear-gradient(135deg,var(--brand-a),var(--brand-b));
  display:flex; align-items:center; justify-content:center;
  color:#fff; font-weight:900; font-size:28px;
}
.login-h1 { font-size:26px; font-weight:900; color:var(--ink); letter-spacing:-.5px; margin-bottom:3px; }
.login-p  { font-size:13.5px; color:var(--muted); margin-bottom:24px; }
#googleBtnMain { display:flex; align-items:center; justify-content:center; min-height:44px; }
.signin-loading { font-size:13px; color:var(--muted-2); animation:kpasPulse 1.2s ease-in-out infinite; }
@keyframes kpasPulse { 0%,100%{opacity:.45;} 50%{opacity:.9;} }
.login-note { font-size:12px; color:var(--muted-2); line-height:1.7; margin-top:20px; }
.login-note span { color:var(--accent); font-weight:700; }
.login-warn {
  font-size:12px; line-height:1.6; color:#8a5a00;
  background:#FFF6E5; border:1px solid #F6D98A; border-radius:10px;
  padding:10px 12px; margin-top:14px; text-align:left;
}
.login-warn code { background:#F3E7C6; padding:1px 5px; border-radius:5px; font-size:11px; }

/* ════════════════════════════════════════
   APP SHELL
   ════════════════════════════════════════ */
.app {
  display:none;
  height:100vh;
  width:100%;
  overflow:hidden;
}
body.authed .app { display:flex; }

/* ════════════════════════════════════════
   SIDEBAR
   ════════════════════════════════════════ */
.sidebar {
  width:262px;
  flex-shrink:0;
  display:flex;
  flex-direction:column;
  height:100%;
  background:var(--sidebar);
  color:rgba(255,255,255,.92);
}

.ws-head {
  flex-shrink:0;
  display:flex;
  flex-direction:column;
  align-items:stretch;
  gap:11px;
  padding:12px 12px 14px;
  border-bottom:1px solid rgba(255,255,255,.2);
}
.ws-logo {
  width:100%; height:72px;
  border-radius:12px;
  background:linear-gradient(135deg,var(--brand-a),var(--brand-b));
  display:flex; align-items:center; justify-content:center;
  color:#fff; font-weight:900; font-size:30px;
  overflow:hidden;
}
.ws-logo img {
  width:100%; height:100%;
  object-fit:contain; background:#fff;
  border-radius:12px;
}
.ws-meta { min-width:0; padding:0 4px; }
.ws-name {
  font-weight:900; font-size:26px; color:#fff;
  letter-spacing:-.5px; line-height:1.05;
  white-space:normal; overflow:visible; text-overflow:clip;
}
.ws-sub {
  font-size:14px; font-weight:700; color:rgba(255,255,255,.9);
  letter-spacing:.1px; line-height:1.4; margin-top:6px;
}
.ws-version {
  font-size:11px; font-weight:400; color:rgba(255,255,255,.6);
  letter-spacing:.2px; margin-top:3px;
}

/* nav */
.nav { flex:1; overflow-y:auto; padding:10px 9px 16px; }

.nav-item {
  width:100%;
  display:flex; align-items:center; gap:9px;
  padding:6px 10px;
  border:none; border-radius:6px;
  font-family:inherit; font-size:15px;
  cursor:pointer; text-align:left;
  margin-bottom:1px; line-height:1.3;
  background:transparent; color:rgba(255,255,255,.92); font-weight:400;
  transition:background .12s;
}
.nav-item:hover { background:rgba(255,255,255,.16); }
.nav-item.active { background:rgba(255,255,255,.26); color:#fff; font-weight:700; }
.nav-ico { font-size:15px; line-height:1; opacity:.95; }
.nav-lbl { flex:1; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }

/* HOME — bold, white, emphasised */
#navHome { color:#fff; }
#navHome .nav-lbl { font-weight:900; letter-spacing:.3px; }

/* Workspace selector buttons */
.ws-select { font-weight:700; }
.ws-select.active { background:rgba(255,255,255,.26); color:#fff; }
.ws-select.is-disabled { opacity:.5; cursor:default; }
.ws-select.is-disabled:hover { background:transparent; }
.ws-soon {
  margin-left:auto; flex-shrink:0;
  font-size:9.5px; font-weight:900; letter-spacing:.4px; text-transform:uppercase;
  color:rgba(255,255,255,.85); background:rgba(255,255,255,.18);
  padding:1px 6px; border-radius:10px;
}
/* Switch-workspace link (KG Manager / KG Admin) */
.ws-switch { font-size:12.5px; opacity:.85; }
.ws-switch:hover { opacity:1; }
.ws-switch .nav-ico { font-size:14px; }

.nav-item .nav-hash { font-size:15px; line-height:1; color:rgba(255,255,255,.78); }
.nav-item.active .nav-hash { color:#fff; }
.nav-count { font-size:12px; font-weight:700; color:rgba(255,255,255,.72); }
.nav-item.active .nav-count { color:rgba(255,255,255,.9); }

.nav-group-head {
  display:flex; align-items:center; justify-content:space-between;
  padding:13px 10px 0; margin:9px 4px 5px;
  border-top:1px solid rgba(255,255,255,.2);   /* thin separator, like above HOME */
}
.nav-group-head span {
  font-size:12px; font-weight:900; color:#ffffff;
  letter-spacing:.4px; text-transform:uppercase;
}
.nav-add {
  width:20px; height:20px;
  border:none; border-radius:5px;
  background:rgba(255,255,255,.18); color:#fff;
  font-size:15px; line-height:1; cursor:pointer;
  display:flex; align-items:center; justify-content:center;
}
.nav-add:hover { background:rgba(255,255,255,.3); }

/* sidebar footer */
.side-foot {
  flex-shrink:0;
  border-top:1px solid rgba(255,255,255,.2);
  padding:10px 12px;
}

.admin-tools { display:flex; flex-direction:column; gap:2px; margin-bottom:9px; }
.tool-btn {
  display:flex; align-items:center; gap:8px;
  width:100%; padding:6px 9px;
  border:none; border-radius:6px;
  background:transparent; color:rgba(255,255,255,.92);
  font-family:inherit; font-size:12.5px; font-weight:700;
  cursor:pointer; text-align:left; transition:background .12s;
}
.tool-btn:hover { background:rgba(255,255,255,.18); color:#fff; }
.tool-btn i { width:15px; height:15px; }

.account { display:flex; flex-direction:column; align-items:stretch; gap:10px; padding:4px 0; }
.acc-main { display:flex; align-items:center; gap:10px; min-width:0; }
.acc-avatar {
  width:36px; height:36px; border-radius:8px;
  background:var(--accent);
  display:flex; align-items:center; justify-content:center;
  color:#fff; font-weight:900; font-size:14px;
  flex-shrink:0; position:relative; overflow:visible;
}
.acc-avatar img { width:100%; height:100%; object-fit:cover; border-radius:8px; }
.acc-avatar::after {
  content:''; position:absolute; right:-2px; bottom:-2px;
  width:11px; height:11px; border-radius:50%;
  background:#2EB67D; border:2px solid var(--sidebar);
}
.acc-meta { flex:1; min-width:0; }
.acc-role { font-size:13.5px; font-weight:700; color:#fff; line-height:1.25;
  white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.acc-status { font-size:11px; color:rgba(255,255,255,.78);
  white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.acc-signout {
  width:100%; padding:8px; text-align:center;
  border:1px solid rgba(255,255,255,.28); border-radius:7px;
  background:rgba(255,255,255,.12); color:#fff;
  font-family:inherit; font-size:12.5px; font-weight:700; cursor:pointer;
  transition:background .12s;
}
.acc-signout:hover { background:rgba(255,255,255,.22); color:#fff; }

.signin-wrap { display:flex; flex-direction:column; align-items:stretch; gap:7px; }
#googleBtn { display:flex; justify-content:center; min-height:40px; color-scheme:light; }
.signin-hint { font-size:10.5px; color:rgba(255,255,255,.7); text-align:center; letter-spacing:.2px; }

/* ════════════════════════════════════════
   MAIN
   ════════════════════════════════════════ */
.main { flex:1; display:flex; flex-direction:column; min-width:0; background:var(--bg); }

.topbar {
  height:52px; flex-shrink:0;
  border-bottom:1px solid var(--border);
  display:flex; align-items:center; justify-content:space-between; gap:16px;
  padding:0 22px;
}
.topbar-title { display:flex; align-items:baseline; gap:9px; min-width:0; }
.tt-hash { font-size:19px; font-weight:900; color:#8D8D8D; line-height:1; }
.tt-name {
  font-weight:900; font-size:18px; color:var(--ink); letter-spacing:-.3px;
  white-space:nowrap; overflow:hidden; text-overflow:ellipsis;
}
.tt-desc {
  font-size:13px; color:var(--muted);
  white-space:nowrap; overflow:hidden; text-overflow:ellipsis;
}

.topbar-right { display:flex; align-items:center; gap:10px; flex-shrink:0; }
.search-box {
  display:flex; align-items:center; gap:8px;
  background:var(--field-bg); border:1px solid #E3E3E3; border-radius:8px;
  padding:6px 11px; width:250px; color:#8D8D8D;
}
.search-box input {
  border:none; background:transparent; outline:none;
  font-family:inherit; font-size:13px; color:var(--ink); width:100%;
}
.role-pill {
  display:flex; align-items:center; gap:6px;
  background:var(--accent-soft); border:1px solid var(--accent-soft-bd);
  border-radius:20px; padding:4px 11px;
  font-size:12px; font-weight:700; color:var(--accent); white-space:nowrap;
}
.role-pill::before {
  content:''; width:7px; height:7px; border-radius:50%; background:#2EB67D;
}

/* View / Edit segmented toggle */
.mode-toggle {
  display:inline-flex; align-items:center;
  background:var(--field-bg); border:1px solid #E3E3E3;
  border-radius:9px; padding:2px; gap:2px; flex-shrink:0;
}
.mode-toggle button {
  border:none; background:transparent; cursor:pointer;
  font-family:inherit; font-size:12.5px; font-weight:700; color:var(--muted);
  padding:5px 13px; border-radius:7px; line-height:1; transition:all .12s;
}
.mode-toggle button:hover { color:var(--ink); }
.mode-toggle button.on { background:#fff; color:var(--accent); box-shadow:0 1px 2px rgba(0,0,0,.08); }
.mode-toggle button[data-mode="edit"].on { background:var(--accent); color:#fff; }

/* content */
.content { flex:1; overflow-y:auto; padding:26px 26px 40px; }
.content-inner { max-width:960px; margin:0 auto; }

/* ════════════════════════════════════════
   SECTIONS + CARDS
   ════════════════════════════════════════ */
.content-cat-head {
  font-size:12px; font-weight:900; letter-spacing:.8px; text-transform:uppercase;
  color:var(--muted); margin:6px 2px 16px; padding-bottom:8px;
  border-bottom:2px solid var(--border);
}
.content-cat-head:not(:first-child) { margin-top:30px; }
.section { margin-bottom:34px; animation:kpasIn .3s ease both; }

.sec-header {
  display:flex; align-items:center; justify-content:space-between; gap:12px;
  margin-bottom:13px; padding-bottom:9px; border-bottom:1px solid var(--border-2);
}
.sec-title { display:flex; align-items:center; gap:9px; min-width:0; }
.sec-dot { width:9px; height:9px; border-radius:50%; flex-shrink:0; background:var(--accent); }
.sec-name { font-size:15px; font-weight:900; color:var(--ink); letter-spacing:-.2px; }
.sec-name.editable { cursor:pointer; }
.sec-name.editable:hover { text-decoration:underline dotted; }
.sec-desc {
  font-size:12.5px; color:var(--muted-2);
  white-space:nowrap; overflow:hidden; text-overflow:ellipsis;
}

.sec-header-actions { display:flex; gap:6px; flex-shrink:0; }
.btn-sec-action {
  display:flex; align-items:center; gap:5px;
  font-family:inherit; font-size:12.5px; font-weight:700;
  border-radius:7px; padding:5px 11px; cursor:pointer;
  border:1px solid var(--accent-soft-bd); color:var(--accent); background:var(--accent-soft);
  transition:background .12s;
}
.btn-sec-action i { width:13px; height:13px; }
.btn-add-lnk:hover { background:#D6EFE3; }
.btn-del-sec { border-color:var(--danger-bd); color:var(--danger); background:var(--danger-bg); }
.btn-del-sec:hover { background:#F8DCDC; }

.btn-grid {
  display:grid;
  grid-template-columns:repeat(auto-fill,minmax(224px,1fr));
  gap:11px;
}

.link-card {
  position:relative;
  display:flex; align-items:center; gap:12px;
  padding:12px 13px;
  border:1px solid var(--border); border-radius:var(--r);
  background:var(--bg); text-decoration:none; color:var(--ink);
  transition:border-color .12s, box-shadow .12s, transform .12s;
}
.link-card:hover { border-color:#C7C7C7; box-shadow:var(--shadow-card); transform:translateY(-1px); }

.card-icon {
  width:40px; height:40px; border-radius:10px;
  display:flex; align-items:center; justify-content:center;
  color:#fff; flex-shrink:0;
  background:var(--accent);
  font-weight:900; font-size:14px; letter-spacing:-.4px;
}
.card-icon i, .card-icon svg { width:19px; height:19px; }
.card-icon .mono { font-weight:900; font-size:14px; letter-spacing:-.4px; line-height:1; }

.card-body { flex:1; min-width:0; }
.card-label {
  font-size:14px; font-weight:700; line-height:1.3; color:var(--ink);
  overflow:hidden; text-overflow:ellipsis; white-space:nowrap;
}
.card-host { font-size:12px; color:var(--muted-2); margin-top:1px; }

.card-arrow { color:#C6C6C6; font-size:15px; flex-shrink:0; display:flex; }
.card-arrow i, .card-arrow svg { width:16px; height:16px; }

/* admin controls on cards */
.card-ctrls { display:flex; gap:5px; flex-shrink:0; }
.ctrl {
  width:26px; height:26px;
  border:1px solid #E3E3E3; border-radius:7px;
  background:#F6F6F6; color:#5B5B5B;
  cursor:pointer; font-family:inherit;
  display:flex; align-items:center; justify-content:center;
  transition:background .12s;
}
.ctrl i, .ctrl svg { width:13px; height:13px; }
.ctrl-mv:hover, .ctrl-ed:hover { background:#ECECEC; }
.ctrl-dl { border-color:var(--danger-bd); background:var(--danger-bg); color:var(--danger); }
.ctrl-dl:hover { background:#F8DCDC; }

/* add-link dashed card */
.link-card.add-new {
  display:flex; align-items:center; justify-content:center; gap:7px;
  min-height:64px; cursor:pointer;
  border:1.5px dashed #CFE6DA; border-radius:var(--r);
  background:#F6FBF8; color:var(--accent);
  font-size:13px; font-weight:700;
  transition:background .12s, border-color .12s;
}
.link-card.add-new:hover { background:#EAF6F0; border-color:#8FCBB2; transform:none; box-shadow:none; }
.add-icon { font-size:17px; line-height:1; display:flex; }
.add-icon i, .add-icon svg { width:16px; height:16px; }

/* new channel button */
.btn-new-sec {
  display:flex; align-items:center; gap:7px; margin:6px auto 0;
  font-family:inherit; font-size:13px; font-weight:700; color:#616061;
  background:transparent; border:1.5px dashed #D6D6D6; border-radius:8px;
  padding:8px 18px; cursor:pointer; transition:border-color .12s, color .12s;
}
.btn-new-sec:hover { border-color:#B0B0B0; color:var(--ink); }
.btn-new-sec i { width:15px; height:15px; }

/* empty / no-results state */
.empty-state { text-align:center; padding:60px 20px; color:var(--muted-2); }
.empty-state .es-emoji { font-size:30px; margin-bottom:10px; }
.empty-state .es-title { font-size:15px; font-weight:700; color:#5B5B5B; }
.empty-state .es-sub { font-size:13px; margin-top:4px; }

.search-heading {
  font-size:13px; font-weight:700; color:var(--muted); letter-spacing:.2px;
  margin-bottom:16px;
}

/* home tagline pill */
.home-tag {
  display:inline-flex; align-items:center; gap:7px;
  background:var(--accent-soft); border:1px solid var(--accent-soft-bd);
  color:var(--accent); font-size:12.5px; font-weight:700;
  padding:5px 12px; border-radius:20px; margin-bottom:20px;
}
.home-tag .dot { width:7px; height:7px; border-radius:50%; background:#2EB67D; }

/* ════════════════════════════════════════
   FOOTER
   ════════════════════════════════════════ */
.footer {
  margin-top:20px; padding-top:20px;
  border-top:1px solid var(--border-2);
  text-align:center; font-size:12.5px; color:var(--muted);
  line-height:1.7;
}
.footer a { color:var(--accent); text-decoration:none; font-weight:700; }
.footer a:hover { text-decoration:underline; }
.footer-cc { font-size:11.5px; color:var(--muted-2); margin-top:5px; }
.footer-edit-btn {
  border:none; background:transparent; color:var(--muted-2);
  cursor:pointer; padding:2px 4px; vertical-align:middle;
}
.footer-edit-btn i { width:13px; height:13px; }
.footer-edit-btn:hover { color:var(--accent); }

/* ════════════════════════════════════════
   MODALS
   ════════════════════════════════════════ */
.backdrop {
  position:fixed; inset:0;
  background:rgba(11,7,12,.5); backdrop-filter:blur(4px);
  z-index:600; display:none; align-items:center; justify-content:center; padding:20px;
}
.backdrop.open { display:flex; }
.modal {
  width:100%; max-width:420px;
  background:#fff; border-radius:16px;
  box-shadow:var(--shadow-modal); overflow:hidden;
  animation:kpasPop .2s ease;
}
.modal-lg { max-width:480px; }

.mhd {
  padding:18px 24px 15px; border-bottom:1px solid var(--border-2);
  display:flex; align-items:center; justify-content:space-between;
}
.mtitle {
  font-size:16px; font-weight:900; color:var(--ink);
  display:flex; align-items:center; gap:8px;
}
.mtitle i { width:18px; height:18px; }
.mclose {
  width:28px; height:28px; border:none; border-radius:7px;
  background:#F3F3F3; color:#7A7A7A; font-size:15px; cursor:pointer;
}
.mclose:hover { background:#E6E6E6; }

.mbody { padding:20px 24px 8px; }
.mfoot {
  padding:16px 24px 22px;
  display:flex; gap:9px; justify-content:flex-end;
}

.login-logo {
  width:52px; height:52px; border-radius:14px;
  background:linear-gradient(135deg,#611F69,#E01E5A);
  display:flex; align-items:center; justify-content:center;
  color:#fff; font-weight:900; font-size:22px; margin:0 auto 12px;
}
.login-sub { font-size:13px; color:var(--muted); margin-top:3px; }

.field { margin-bottom:14px; }
.field label {
  display:block; font-size:12px; font-weight:700; color:#616061; margin-bottom:5px;
}
.field input, .field select, .field textarea {
  width:100%; border:1px solid #D6D6D6; border-radius:9px;
  padding:10px 12px; font-family:inherit; font-size:14px;
  outline:none; color:var(--ink); background:#fff;
  transition:border-color .12s, box-shadow .12s;
}
.field select { cursor:pointer; }
.field textarea { resize:vertical; }
.field input:focus, .field select:focus, .field textarea:focus {
  border-color:#1264A3; box-shadow:0 0 0 3px rgba(18,100,163,.12);
}
.field-hint { font-size:11.5px; color:var(--muted-2); margin-top:5px; line-height:1.5; }
.field-tag {
  margin-left:6px; font-size:9.5px; font-weight:800; letter-spacing:.4px; text-transform:uppercase;
  color:#fff; background:var(--accent, #2eb67d); padding:2px 6px; border-radius:9px; vertical-align:middle;
}
.field-row { display:flex; gap:12px; }
.field-row .field { flex:1; }

.err { display:none; font-size:12px; color:var(--danger); margin-top:6px; font-weight:700; }

.hash-input {
  display:flex; align-items:center;
  border:1px solid #D6D6D6; border-radius:9px; padding:0 12px;
  transition:border-color .12s, box-shadow .12s;
}
.hash-input:focus-within { border-color:#1264A3; box-shadow:0 0 0 3px rgba(18,100,163,.12); }
.hash-sign { color:#8D8D8D; font-size:15px; font-weight:900; }
.hash-input input { flex:1; border:none; padding:10px 8px; font-size:14px; outline:none; box-shadow:none; }
.hash-input input:focus { border:none; box-shadow:none; }

.msep { border:none; border-top:1px solid var(--border); margin:6px 0 14px; }

/* modal buttons */
.btn-c, .btn-p, .btn-d {
  padding:9px 18px; border-radius:9px;
  font-family:inherit; font-size:14px; font-weight:700; cursor:pointer;
  transition:background .12s;
}
.btn-c { border:1px solid #D6D6D6; background:#fff; color:#616061; }
.btn-c:hover { background:#F3F3F3; }
.btn-p { border:none; background:var(--accent); color:#fff; }
.btn-p:hover { background:var(--accent-hover); }
.btn-p:disabled { opacity:.6; cursor:default; }
.btn-d { border:none; background:var(--danger); color:#fff; }
.btn-d:hover { background:#A72832; }

/* icon picker */
.icon-preview-badge {
  width:38px; height:38px; border-radius:9px;
  background:var(--accent); color:#fff;
  display:flex; align-items:center; justify-content:center; flex-shrink:0;
}
.icon-preview-badge i, .icon-preview-badge svg { width:18px; height:18px; }

.icon-picker-wrap { margin-top:4px; }
.icon-picker-label { font-size:12px; font-weight:700; color:#616061; margin-bottom:8px; }
#iconPickerGrid {
  display:grid; grid-template-columns:repeat(auto-fill,minmax(38px,1fr));
  gap:6px; max-height:172px; overflow-y:auto;
  padding:4px; background:#F7F7F7; border-radius:10px;
}
.icon-opt {
  width:100%; aspect-ratio:1; border:1px solid #E3E3E3; border-radius:8px;
  background:#fff; color:#5B5B5B; cursor:pointer;
  display:flex; align-items:center; justify-content:center; transition:all .12s;
}
.icon-opt i, .icon-opt svg { width:17px; height:17px; }
.icon-opt:hover { border-color:var(--accent); color:var(--accent); }
.icon-opt.selected { background:var(--accent); border-color:var(--accent); color:#fff; }

/* ════════════════════════════════════════
   COLLABORATION CHANNELS (chat)
   ════════════════════════════════════════ */
.nav-bubble {
  margin-left:auto; flex-shrink:0;
  min-width:18px; height:18px; padding:0 5px;
  border-radius:9px; background:#E01E5A; color:#fff;
  font-size:11px; font-weight:900; line-height:18px; text-align:center;
}
.chat-toolbar { display:flex; align-items:center; gap:10px; margin-bottom:8px; }
.chat-search {
  flex:1; display:flex; align-items:center; gap:8px;
  background:var(--field-bg); border:1px solid #E3E3E3; border-radius:9px;
  padding:6px 11px; color:#8D8D8D; max-width:340px;
}
.chat-search .ic { width:15px; height:15px; flex-shrink:0; }
.chat-search input {
  flex:1; border:none; outline:none; background:transparent;
  font-family:inherit; font-size:13px; color:var(--ink);
}
.chat-search-x {
  border:none; background:transparent; color:var(--muted); cursor:pointer;
  display:flex; align-items:center; padding:0; flex-shrink:0;
}
.chat-search-x .ic { width:14px; height:14px; }
.chat-search-x:hover { color:var(--ink); }
.chat-members-btn {
  display:inline-flex; align-items:center; gap:6px;
  border:1px solid var(--border); border-radius:8px; padding:5px 11px;
  background:#fff; color:var(--ink); font-family:inherit; font-size:12.5px; font-weight:700; cursor:pointer;
}
.chat-members-btn:hover { background:var(--field-bg); }
.chat-members-btn .ic { width:14px; height:14px; }
.chat-readonly {
  flex-shrink:0; margin-top:8px; padding:12px 14px;
  border:1px dashed var(--border); border-radius:12px; background:#FAFAFA;
  color:var(--muted); font-size:13px; text-align:center;
}

.chat-view {
  display:flex; flex-direction:column;
  height:calc(100vh - 52px - 66px);   /* topbar + content padding */
  min-height:340px;
}
.chat-messages {
  flex:1; overflow-y:auto; padding:4px 2px 12px;
  display:flex; flex-direction:column; gap:2px;
}
.chat-empty { color:var(--muted-2); font-size:14px; text-align:center; margin:auto; padding:40px 0; }

.chat-msg { display:flex; gap:11px; padding:6px 8px; border-radius:9px; animation:kpasIn .2s ease both; }
.chat-msg:hover { background:#FAFAFA; }
.chat-msg:hover .chat-del, .chat-msg:hover .chat-unsend { opacity:1; }
.chat-avatar {
  width:36px; height:36px; border-radius:9px; flex-shrink:0;
  display:flex; align-items:center; justify-content:center;
  color:#fff; font-weight:900; font-size:14px; margin-top:2px;
}
.chat-avatar-ghost { background:#E3E3E3; color:#9B9A9B; }
.chat-body { flex:1; min-width:0; }
.chat-meta { display:flex; align-items:center; gap:8px; line-height:1.2; }
.chat-nick { font-size:14px; font-weight:700; color:var(--ink); }
.chat-time { font-size:11.5px; color:var(--muted-2); }
.chat-del {
  margin-left:auto; width:22px; height:22px; flex-shrink:0;
  border:1px solid var(--danger-bd); border-radius:6px; background:var(--danger-bg); color:var(--danger);
  cursor:pointer; opacity:0; transition:opacity .12s; display:flex; align-items:center; justify-content:center;
}
.chat-del .ic { width:12px; height:12px; }
.chat-unsend {
  margin-left:auto; flex-shrink:0;
  border:1px solid var(--border); border-radius:6px; background:#fff; color:var(--muted);
  cursor:pointer; opacity:0; transition:opacity .12s, color .12s, border-color .12s;
  font-family:inherit; font-size:11.5px; font-weight:700; padding:2px 8px;
}
.chat-unsend:hover { color:var(--danger); border-color:var(--danger-bd); background:var(--danger-bg); }
.chat-text { font-size:14px; color:var(--ink); line-height:1.5; margin-top:1px; word-wrap:break-word; overflow-wrap:anywhere; }
.chat-text.muted { color:var(--muted-2); }

/* reactions */
.chat-reacts { display:flex; flex-wrap:wrap; gap:5px; margin-top:6px; align-items:center; }
.react-chip {
  display:inline-flex; align-items:center; gap:4px;
  border:1px solid var(--border); border-radius:20px; padding:1px 9px 1px 7px;
  background:#fff; cursor:pointer; font-family:inherit; font-size:13.5px; line-height:1.7;
  transition:background .12s, border-color .12s;
}
.react-chip:hover { background:var(--field-bg); }
.react-chip.mine { background:var(--accent-soft); border-color:var(--accent-soft-bd); }
.react-chip .rc-count { font-size:11.5px; font-weight:800; color:var(--muted); }
.react-chip.mine .rc-count { color:var(--accent); }
.react-add {
  width:26px; height:24px; flex-shrink:0;
  border:1px solid var(--border); border-radius:20px; background:#fff; color:var(--muted);
  cursor:pointer; opacity:0; transition:opacity .12s, color .12s, border-color .12s;
  display:inline-flex; align-items:center; justify-content:center;
}
.chat-msg:hover .react-add { opacity:1; }
.react-add:hover { color:var(--accent); border-color:var(--accent-soft-bd); }
.react-add .ic { width:15px; height:15px; }
.react-pop {
  position:fixed; z-index:200; display:flex; align-items:center; gap:3px;
  background:#fff; border:1px solid var(--border); border-radius:24px;
  padding:5px 7px; box-shadow:var(--shadow-card, 0 6px 24px rgba(0,0,0,.14));
}
.react-opt {
  border:none; background:transparent; cursor:pointer; font-size:19px; line-height:1;
  padding:4px; border-radius:8px; transition:background .1s, transform .1s;
}
.react-opt:hover { background:var(--field-bg); transform:scale(1.18); }
.react-custom {
  width:44px; border:1px solid var(--border); border-radius:14px; padding:4px 8px;
  font-family:inherit; font-size:15px; text-align:center; outline:none; margin-left:2px;
}
.react-custom:focus { border-color:var(--accent); }

/* ══ AVATARS (photo fills the coloured tile) ══ */
.avatar-el { overflow:hidden; }
.avatar-el img { width:100%; height:100%; object-fit:cover; display:block; }
.chat-avatar { cursor:pointer; }
.chat-nick { cursor:pointer; }
.chat-nick:hover { text-decoration:underline; }

/* ══ PROFILE MODAL ══ */
.profile-photo-row { display:flex; gap:18px; align-items:center; margin-bottom:18px; }
.profile-photo {
  width:96px; height:96px; border-radius:16px; flex-shrink:0;
  display:flex; align-items:center; justify-content:center; overflow:hidden;
  background:#4A154B; color:#fff; font-weight:900; font-size:34px; position:relative;
}
.profile-photo img { width:100%; height:100%; object-fit:cover; display:block; }
.profile-photo.is-loading::after {
  content:""; position:absolute; inset:0; background:rgba(255,255,255,.35);
  backdrop-filter:blur(1px);
}
.profile-photo.is-loading::before {
  content:""; position:absolute; z-index:1; width:22px; height:22px; top:calc(50% - 11px); left:calc(50% - 11px);
  border:3px solid rgba(0,0,0,.15); border-top-color:var(--accent); border-radius:50%; animation:kpasSpin .7s linear infinite;
}
@keyframes kpasSpin { to { transform:rotate(360deg); } }
.profile-photo-actions { display:flex; flex-direction:column; gap:8px; align-items:flex-start; }
.req { color:var(--danger, #E01E5A); font-weight:800; }
.opt { color:var(--muted-2); font-weight:400; font-size:12px; }
#profileBackdrop textarea {
  width:100%; border:1px solid #D6D6D6; border-radius:9px; padding:10px 12px;
  font-family:inherit; font-size:14px; outline:none; resize:vertical; line-height:1.5;
}
#profileBackdrop textarea:focus { border-color:#1264A3; box-shadow:0 0 0 3px rgba(18,100,163,.12); }

/* ══ ABOUT-USER POPUP ══ */
.user-card {
  position:fixed; z-index:210; width:262px; max-width:calc(100vw - 24px);
  background:#fff; border:1px solid var(--border); border-radius:14px; padding:14px;
  box-shadow:0 14px 40px rgba(0,0,0,.18); animation:kpasIn .16s ease both;
}
.uc-head { display:flex; gap:11px; align-items:center; margin-bottom:10px; }
.uc-avatar { width:52px; height:52px; border-radius:12px; flex-shrink:0; display:flex; align-items:center; justify-content:center; color:#fff; font-weight:900; font-size:20px; overflow:hidden; }
.uc-id { min-width:0; }
.uc-name { font-size:15px; font-weight:800; color:var(--ink); }
.uc-nick { font-size:12.5px; color:var(--muted); }
.uc-email { font-size:12px; color:var(--muted-2); word-break:break-all; }
.uc-row { display:flex; gap:8px; font-size:13px; padding:3px 0; border-top:1px solid var(--field-bg); }
.uc-k { color:var(--muted-2); min-width:64px; font-weight:700; }
.uc-v { color:var(--ink); }
.uc-msg { margin-top:8px; font-size:13px; font-style:italic; color:var(--muted); line-height:1.5; }
.uc-empty { font-size:12.5px; color:var(--muted-2); }

/* ══ COMMUNITY SHOWCASE ══ */
.community { max-width:640px; margin:0 auto; }
.community-head-row { display:flex; align-items:center; justify-content:space-between; margin-bottom:20px; }
.community-title { font-size:20px; font-weight:900; color:var(--ink); }
.community-sub { font-size:13px; color:var(--muted); margin-top:2px; }
.community-shuffle { cursor:pointer; }
.community-stage { min-height:220px; display:flex; align-items:center; justify-content:center; }
.community-card {
  width:100%; display:flex; align-items:center; gap:26px; text-align:left; padding:26px 30px;
  background:linear-gradient(120deg, var(--accent-soft, #eafaf2) 0%, #ffffff 55%);
  border:1px solid var(--border); border-radius:20px;
  box-shadow:0 12px 40px rgba(0,0,0,.07);
  animation:communityIn .5s cubic-bezier(.16,.84,.44,1) both;
}
@keyframes communityIn {
  0%   { opacity:0; transform:translateY(16px) scale(.98); }
  100% { opacity:1; transform:translateY(0) scale(1); }
}
.community-avatar {
  width:104px; height:104px; border-radius:50%; flex-shrink:0;
  display:flex; align-items:center; justify-content:center; overflow:hidden;
  color:#fff; font-weight:900; font-size:40px; cursor:pointer;
  box-shadow:0 8px 24px rgba(0,0,0,.16); border:4px solid #fff;
  animation:communityPop .55s cubic-bezier(.16,.84,.44,1) both;
}
@keyframes communityPop { 0% { transform:scale(.85); opacity:0; } 100% { transform:scale(1); opacity:1; } }
.community-info { flex:1; min-width:0; }
.community-name { font-size:22px; font-weight:900; color:var(--ink); letter-spacing:-.3px; }
.community-nick { font-size:14px; color:var(--muted); margin-top:1px; }
.community-pos {
  display:inline-block; margin-top:10px; padding:4px 13px; border-radius:20px;
  background:var(--accent, #2eb67d); color:#fff; font-size:12.5px; font-weight:800;
}
.community-subject { margin-top:9px; font-size:13.5px; color:var(--muted); }
.community-subject::before { content:"Subject · "; color:var(--muted-2); font-weight:700; }
.community-msg { margin-top:12px; font-size:14.5px; font-style:italic; color:var(--ink); line-height:1.55; }
.community-foot { display:flex; align-items:center; justify-content:center; gap:8px; margin-top:20px; font-size:12.5px; color:var(--muted-2); }
.community-live { width:8px; height:8px; border-radius:50%; background:var(--accent, #2eb67d); animation:communityPulse 2s ease-in-out infinite; }
@keyframes communityPulse { 0%,100% { opacity:1; transform:scale(1); } 50% { opacity:.4; transform:scale(1.5); } }

/* threads */
.chat-thread-btn {
  display:inline-flex; align-items:center; gap:6px; margin-top:5px;
  border:1px solid transparent; border-radius:7px; padding:3px 8px;
  background:transparent; color:var(--muted); font-family:inherit; font-size:12.5px; font-weight:700;
  cursor:pointer; opacity:0; transition:opacity .12s, background .12s, border-color .12s;
}
.chat-msg:hover .chat-thread-btn { opacity:1; }
.chat-thread-btn.has-replies { opacity:1; color:var(--accent); }
.chat-thread-btn:hover { background:var(--accent-soft); border-color:var(--accent-soft-bd); color:var(--accent); }
.chat-thread-btn .ic { width:13px; height:13px; }

.thread-back {
  align-self:flex-start; margin-bottom:8px;
  border:1px solid var(--border); border-radius:8px; padding:6px 12px;
  background:#fff; color:var(--ink); font-family:inherit; font-size:13px; font-weight:700; cursor:pointer;
}
.thread-back:hover { background:var(--field-bg); }
.thread-divider {
  display:flex; align-items:center; gap:10px;
  font-size:12.5px; font-weight:700; color:var(--muted-2);
  margin:10px 2px 6px; text-transform:none;
}
.thread-divider::after { content:''; flex:1; height:1px; background:var(--border-2); }

.chat-composer {
  flex-shrink:0; display:flex; gap:9px; align-items:flex-end;
  border:1px solid var(--border); border-radius:12px; padding:9px 10px 9px 12px;
  background:#fff; margin-top:8px;
}
.chat-composer textarea {
  flex:1; border:none; outline:none; resize:none; background:transparent;
  font-family:inherit; font-size:14px; line-height:1.5; color:var(--ink);
  max-height:160px; padding:5px 0;
}
.chat-send { padding:8px 18px; align-self:stretch; }
.chat-composer-wrap { flex-shrink:0; margin-top:8px; }

/* attach button + pending upload chips */
.chat-attach {
  flex-shrink:0; width:32px; height:32px; align-self:flex-end;
  border:none; border-radius:8px; background:transparent; color:var(--muted);
  cursor:pointer; display:flex; align-items:center; justify-content:center;
}
.chat-attach:hover { background:var(--field-bg); color:var(--ink); }
.chat-attach .ic { width:18px; height:18px; }
.chat-pending { display:flex; flex-wrap:wrap; gap:6px; margin-bottom:8px; }
.chat-chip {
  display:inline-flex; align-items:center; gap:6px;
  background:var(--field-bg); border:1px solid var(--border); border-radius:8px;
  padding:5px 9px; font-size:12.5px; color:var(--ink); max-width:240px;
}
.chat-chip .ic { width:14px; height:14px; color:var(--muted); flex-shrink:0; }
.chip-name { overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.chip-spin { color:var(--muted-2); font-size:11.5px; }
.chip-x { border:none; background:transparent; color:var(--muted); cursor:pointer; font-size:13px; padding:0 2px; }
.chip-x:hover { color:var(--danger); }

/* attachment chips on messages */
.chat-atts { display:flex; flex-wrap:wrap; gap:7px; margin-top:6px; }
.chat-att {
  display:inline-flex; align-items:stretch; gap:0;
  border:1px solid var(--border); border-radius:10px; background:#fff;
  font-family:inherit; font-size:13px; color:var(--ink);
  max-width:300px; overflow:hidden; transition:border-color .12s, box-shadow .12s;
}
.chat-att:hover { border-color:#C7C7C7; box-shadow:var(--shadow-card); }
.chat-att-main {
  display:inline-flex; align-items:center; gap:8px; padding:8px 11px; cursor:pointer; min-width:0;
}
.chat-att-main .ic { width:15px; height:15px; flex-shrink:0; }
.chat-att-main .ic:first-child { color:var(--accent); }
.chat-att-main .ic:last-child { color:var(--muted-2); width:13px; height:13px; }
.att-name { font-weight:700; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.att-size { color:var(--muted-2); font-size:12px; flex-shrink:0; }
.chat-att-dl {
  border:none; border-left:1px solid var(--border); background:#FAFAFA; color:var(--muted);
  cursor:pointer; padding:0 11px; display:flex; align-items:center; flex-shrink:0;
}
.chat-att-dl:hover { background:var(--accent-soft); color:var(--accent); }
.chat-att-dl .ic { width:15px; height:15px; }

/* Link / File type toggle in the Add/Edit modal */
.kind-toggle {
  display:inline-flex; align-items:center;
  background:var(--field-bg); border:1px solid #E3E3E3;
  border-radius:9px; padding:3px; gap:3px;
}
.kind-toggle button {
  border:none; background:transparent; cursor:pointer;
  font-family:inherit; font-size:13px; font-weight:700; color:var(--muted);
  padding:6px 14px; border-radius:7px; transition:all .12s;
}
.kind-toggle button:hover { color:var(--ink); }
.kind-toggle button.on { background:#fff; color:var(--accent); box-shadow:0 1px 2px rgba(0,0,0,.08); }

/* file picker in the Add/Edit Item modal */
.file-picker { display:flex; align-items:center; gap:10px; flex-wrap:wrap; }
.file-current {
  flex:1; min-width:140px; font-size:13.5px; color:var(--ink);
  overflow:hidden; text-overflow:ellipsis; white-space:nowrap;
  padding:9px 11px; border:1px solid var(--border); border-radius:9px; background:#FAFAFA;
}

/* allowed-types hint under the composer */
.chat-hint {
  margin-top:6px; padding:4px 9px;
  background:#FFF9DB; color:#000; border-radius:6px;
  font-size:10.5px; line-height:1.4;
}

/* manage access — dedicated page */
.nav-ico .ic { width:16px; height:16px; vertical-align:middle; }

.users-page { animation:kpasIn .3s ease both; }
.users-intro {
  font-size:13.5px; color:var(--muted); line-height:1.65;
  margin-bottom:18px; max-width:680px;
}
.users-intro strong { color:var(--ink); }

.add-user { display:flex; gap:8px; margin-bottom:14px; flex-wrap:wrap; }
.add-user input { flex:1; min-width:220px; border:1px solid #D6D6D6; border-radius:9px; padding:10px 12px; font-family:inherit; font-size:14px; outline:none; }
.add-user input:focus { border-color:#1264A3; box-shadow:0 0 0 3px rgba(18,100,163,.12); }
.add-user select { border:1px solid #D6D6D6; border-radius:9px; padding:10px 12px; font-family:inherit; font-size:14px; background:#fff; cursor:pointer; }
.add-user .btn-p { padding:9px 18px; }

.users-status { font-size:12.5px; font-weight:700; color:var(--accent); min-height:18px; margin:2px 2px 12px; transition:opacity .2s; }
.users-status.is-error { color:var(--danger); }
.users-loading { font-size:13.5px; color:var(--muted-2); padding:20px 4px; }

.user-list { display:flex; flex-direction:column; gap:7px; }
.user-row {
  display:flex; align-items:center; gap:11px;
  padding:10px 12px; border:1px solid var(--border); border-radius:11px; background:#fff;
  transition:border-color .12s, box-shadow .12s;
}
.user-row:hover { border-color:#C7C7C7; box-shadow:var(--shadow-card); }
.user-avatar {
  width:34px; height:34px; border-radius:8px; flex-shrink:0;
  background:var(--accent-soft); color:var(--accent);
  display:flex; align-items:center; justify-content:center;
  font-weight:900; font-size:14px;
}
.user-info { flex:1; min-width:0; display:flex; flex-direction:column; gap:2px; }
.user-nick {
  border:1px solid transparent; border-radius:7px; background:transparent;
  font-family:inherit; font-size:14px; font-weight:700; color:var(--ink);
  padding:3px 6px; margin:-3px -6px 0; outline:none; width:100%;
  transition:border-color .12s, background .12s;
}
.user-nick:hover:not(:disabled) { border-color:var(--border); }
.user-nick:focus { border-color:#1264A3; background:#fff; box-shadow:0 0 0 3px rgba(18,100,163,.1); }
.user-nick:disabled { color:var(--muted); }
.user-email { min-width:0; font-size:12.5px; color:var(--muted-2); overflow:hidden; text-overflow:ellipsis; white-space:nowrap; padding-left:6px; }
.user-tag {
  font-size:10.5px; font-weight:700; color:var(--accent);
  background:var(--accent-soft); border:1px solid var(--accent-soft-bd);
  border-radius:20px; padding:1px 7px; margin-left:6px; vertical-align:middle; text-transform:uppercase; letter-spacing:.3px;
}
.user-role, .user-dept { border:1px solid #D6D6D6; border-radius:8px; padding:7px 10px; font-family:inherit; font-size:13px; background:#fff; cursor:pointer; }
.user-dept { max-width:150px; }
.user-role:disabled, .user-dept:disabled { opacity:.55; cursor:default; }
.user-row .ctrl:disabled { cursor:default; }

/* logo settings */
.logo-preview-wrap {
  min-height:52px; display:flex; align-items:center;
  padding:8px 12px; border:1px solid var(--border); border-radius:9px;
  background:#FAFAFA; margin-bottom:9px;
}
.logo-preview-wrap img { max-height:44px; max-width:160px; border-radius:6px; }
.btn-upload {
  display:inline-flex; align-items:center; gap:6px;
  border:1px solid var(--accent-soft-bd); background:var(--accent-soft); color:var(--accent);
  font-family:inherit; font-size:13px; font-weight:700;
  padding:8px 13px; border-radius:9px; cursor:pointer; margin-right:8px;
}
.btn-upload i { width:15px; height:15px; }
.btn-upload:hover { background:#D6EFE3; }
.btn-logo-del {
  border:none; background:transparent; color:var(--danger);
  font-family:inherit; font-size:13px; font-weight:700; cursor:pointer;
}
.btn-logo-del:hover { text-decoration:underline; }

/* ════════════════════════════════════════
   TOAST
   ════════════════════════════════════════ */
.toast {
  position:fixed; bottom:24px; left:50%; transform:translateX(-50%) translateY(20px);
  background:var(--ink); color:#fff;
  padding:10px 18px; border-radius:10px;
  font-size:13.5px; font-weight:700;
  box-shadow:0 10px 30px rgba(0,0,0,.28);
  z-index:700; display:flex; align-items:center; gap:8px;
  opacity:0; pointer-events:none; transition:opacity .2s, transform .2s;
}
.toast.on { opacity:1; transform:translateX(-50%) translateY(0); }
.toast i { width:16px; height:16px; }

/* ════════════════════════════════════════
   RESPONSIVE
   ════════════════════════════════════════ */
@media (max-width: 820px) {
  .app { flex-direction:column; height:auto; min-height:100vh; overflow:visible; }
  .sidebar { width:100%; height:auto; flex-direction:column; }
  .nav { max-height:none; }
  .main { min-height:60vh; }
  .content { padding:20px 16px 40px; }
  .topbar { flex-wrap:wrap; height:auto; padding:12px 16px; gap:10px; }
  .search-box { width:100%; order:3; }
  .btn-grid { grid-template-columns:1fr; }
}
