:root {
  --bg1: #0f1c3f;
  --bg2: #1b2b5e;
  --glass: rgba(255, 255, 255, 0.08);
  --glass-strong: rgba(255, 255, 255, 0.12);
  --border: rgba(255, 255, 255, 0.16);
  --text: #eef2ff;
  --muted: #9fb0d8;
  --primary: #6c8cff;
  --primary-2: #8f6cff;
  --green: #34d399;
  --amber: #fbbf24;
  --red: #f87171;
  --cyan: #22d3ee;
  --gold: #fbbf24;
  --radius: 18px;
  --shadow: 0 10px 40px rgba(0, 0, 0, 0.35);
}

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

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  color: var(--text);
  min-height: 100vh;
  background: linear-gradient(135deg, var(--bg1) 0%, var(--bg2) 50%, #2a1b5e 100%);
  background-attachment: fixed;
}

.hidden { display: none !important; }
.muted { color: var(--muted); }

/* Animated background orbs */
.bg-orbs { position: fixed; inset: 0; overflow: hidden; z-index: -1; }
.orb { position: absolute; border-radius: 50%; filter: blur(90px); opacity: 0.45; }
.orb1 { width: 480px; height: 480px; background: #4f6cff; top: -120px; left: -100px; animation: float 14s ease-in-out infinite; }
.orb2 { width: 420px; height: 420px; background: #8f4fff; bottom: -140px; right: -80px; animation: float 18s ease-in-out infinite reverse; }
.orb3 { width: 320px; height: 320px; background: #22d3ee; top: 40%; left: 55%; opacity: 0.25; animation: float 22s ease-in-out infinite; }
@keyframes float { 0%,100% { transform: translate(0,0);} 50% { transform: translate(40px,-30px);} }

.glass {
  background: var(--glass);
  border: 1px solid var(--card-border, var(--border));
  border-radius: var(--radius);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  box-shadow: var(--shadow);
}
body.cards-flat .glass { box-shadow: none; backdrop-filter: none; -webkit-backdrop-filter: none; }

/* ---------- Login ---------- */
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 20px; }
.login-layout { display: flex; gap: 24px; align-items: stretch; width: 100%; max-width: 920px; justify-content: center; }
.login-card { width: 100%; max-width: 400px; padding: 40px 36px; text-align: center; flex-shrink: 0; }

@media (max-width: 880px) {
  .login-layout { flex-direction: column; align-items: center; }
}
.login-logo { font-size: 44px; margin-bottom: 8px; }
.login-card h1 { font-size: 24px; font-weight: 800; line-height: 1.25; margin-bottom: 6px; }
.login-card form { margin-top: 24px; text-align: left; }
.login-card .hint { margin-top: 18px; font-size: 12px; }

/* ---------- Forms ---------- */
label { display: block; font-size: 12px; font-weight: 600; color: var(--muted); margin: 14px 0 6px; letter-spacing: 0.4px; text-transform: uppercase; }
input, select, textarea {
  width: 100%; padding: 11px 14px; border-radius: 12px;
  border: 1px solid var(--border); background: rgba(255,255,255,0.07);
  color: var(--text); font: inherit; font-size: 14px; outline: none;
  transition: border 0.15s, background 0.15s;
}
input:focus, select:focus, textarea:focus { border-color: var(--primary); background: rgba(255,255,255,0.11); }
select option { background: #1b2b5e; color: var(--text); }
textarea { resize: vertical; min-height: 80px; }
input[type="file"] { padding: 8px; font-size: 13px; }
input[type="file"]::file-selector-button {
  background: rgba(255,255,255,0.12); color: var(--text); border: 1px solid var(--border);
  padding: 6px 12px; border-radius: 8px; margin-right: 10px; cursor: pointer; font: inherit; font-size: 12px;
}
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form-error { background: rgba(248,113,113,0.15); border: 1px solid rgba(248,113,113,0.4); color: #fecaca; padding: 10px 12px; border-radius: 10px; font-size: 13px; margin-top: 14px; }
.checkbox-row { display: flex; align-items: center; gap: 10px; margin-top: 14px; font-size: 14px; }
.checkbox-row input { width: 18px; height: 18px; accent-color: var(--primary); }
.checkbox-row label { margin: 0; text-transform: none; font-size: 14px; color: var(--text); }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 10px 18px; border-radius: 12px; border: 1px solid transparent;
  font: inherit; font-size: 14px; font-weight: 600; cursor: pointer;
  color: var(--text); background: rgba(255,255,255,0.1);
  transition: transform 0.12s, box-shadow 0.12s, background 0.15s;
}
.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn-primary { background: linear-gradient(135deg, var(--primary), var(--primary-2)); box-shadow: 0 6px 20px rgba(108,140,255,0.35); }
.btn-success { background: linear-gradient(135deg, #10b981, #059669); }
.btn-danger { background: linear-gradient(135deg, #ef4444, #dc2626); }
.btn-ghost { background: transparent; border-color: var(--border); }
.btn-block { width: 100%; margin-top: 18px; }
.btn-sm { padding: 6px 12px; font-size: 12.5px; border-radius: 9px; }
.btn-round { width: 44px; height: 44px; border-radius: 50%; font-size: 22px; padding: 0; }
.btn-round-sm { width: 28px; height: 28px; border-radius: 50%; font-size: 15px; padding: 0; flex-shrink: 0; box-shadow: none; }
.btn-icon { background: transparent; padding: 6px 9px; font-size: 16px; border-radius: 9px; }
.btn-icon:hover { background: rgba(255,255,255,0.12); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }

/* ---------- App layout ---------- */
.app { display: flex; min-height: 100vh; padding: 18px; gap: 18px; }
.sidebar {
  width: 86px; flex-shrink: 0; padding: 20px 12px; display: flex; flex-direction: column; align-items: center;
  position: sticky; top: 18px; height: calc(100vh - 36px);
}
.brand { padding: 0 0 18px; display: flex; align-items: center; justify-content: center; }
.brand-logo-img {
  max-width: 100%; max-height: 46px; width: auto; height: auto; object-fit: contain;
  background: linear-gradient(135deg, #ffffff 0%, #eef2ff 60%, #dfe7ff 100%);
  padding: 7px 14px; border-radius: 12px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.28), 0 0 20px rgba(108, 140, 255, 0.35);
  transition: box-shadow 0.2s ease;
}
.brand-logo-img:hover { box-shadow: 0 4px 16px rgba(0, 0, 0, 0.28), 0 0 28px rgba(108, 140, 255, 0.55); }
.app.nav-h .brand-logo-img { max-width: 240px; max-height: 30px; }
.app.nav-h .brand { padding: 0; }
.sidebar nav { display: flex; flex-direction: column; gap: 6px; flex: 1; width: 100%; }
.sidebar nav a {
  display: flex; align-items: center; justify-content: center; padding: 12px 0; border-radius: 14px;
  color: var(--muted); text-decoration: none;
  transition: background 0.15s, color 0.15s, transform 0.12s;
}
.sidebar nav a svg { width: 22px; height: 22px; display: block; transition: filter 0.2s ease; }
.sidebar nav a:hover, .sidebar nav a.active { color: #d6e0ff; transform: translateY(-3px); background: none; border: none; }
.sidebar nav a:hover svg, .sidebar nav a.active svg {
  filter: drop-shadow(0 0 5px rgba(108,140,255,0.95)) drop-shadow(0 0 14px rgba(143,108,255,0.55));
}
.me-chip.nav-end { margin-top: auto; padding-top: 14px; border-top: 1px solid var(--border); display: flex; justify-content: center; }
.me-chip.nav-end a.avatar { color: inherit; text-decoration: none; }
.avatar {
  width: 34px; height: 34px; border-radius: 50%; display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, var(--primary), var(--primary-2)); font-weight: 700; font-size: 12px; cursor: pointer;
  transition: transform 0.12s ease, filter 0.2s ease;
}
.avatar:hover { transform: translateY(-3px); filter: drop-shadow(0 0 8px rgba(108,140,255,0.7)); }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 18px; }
.view { display: flex; flex-direction: column; gap: 18px; }

/* ---------- Cards / stats ---------- */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 14px; }
.stat-card { padding: 18px 20px; position: relative; overflow: hidden; }
.stat-card .stat-label { font-size: 12px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: 0.6px; }
.stat-card .stat-value { font-size: 34px; font-weight: 800; margin-top: 6px; }
.stat-card .stat-sub { font-size: 12px; color: var(--muted); margin-top: 2px; }
.stat-accent { position: absolute; top: 0; left: 0; right: 0; height: 3px; }

.panel { padding: 22px; }
.panel h3 { font-size: 16px; font-weight: 700; margin-bottom: 14px; display: flex; align-items: center; gap: 8px; }
.panel-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; flex-wrap: wrap; gap: 10px; }
.panel-head h3 { margin-bottom: 0; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
@media (max-width: 1100px) { .grid-2 { grid-template-columns: 1fr; } }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }
@media (max-width: 1250px) { .grid-3 { grid-template-columns: 1fr; } }
.grid-3 .bar-row { grid-template-columns: minmax(90px, 40%) 1fr 44px; }

.perf-row { display: flex; gap: 20px; align-items: center; flex-wrap: wrap; }
.perf-donut { flex-shrink: 0; }
.perf-donut .chart-row { margin-top: 0 !important; flex-direction: column; gap: 12px; }
.perf-cards { flex: 1; min-width: 130px; grid-template-columns: 1fr; margin: 0; gap: 6px; }
.perf-cards .kv-item { padding: 5px 10px; border-radius: 8px; }
.perf-cards .kv-label { font-size: 9px; letter-spacing: 0.3px; }
.perf-cards .kv-value { font-size: 12px; margin-top: 0; }

/* ---------- Chips / filters ---------- */
.chips { display: flex; gap: 18px; flex-wrap: wrap; align-items: center; }
.chips-right { justify-content: flex-end; }
.sec-ico { width: 15px; height: 15px; vertical-align: -2.5px; margin-right: 5px; display: inline-block; }
.h-ico { width: 18px; height: 18px; color: #8fa2ff; flex-shrink: 0; }
.td-sec .sec-ico { width: 18px; height: 18px; margin: 0; vertical-align: middle; }
.tip { position: relative; display: inline-flex; }
.tip::after {
  content: attr(data-tip);
  position: absolute; left: 50%; top: calc(100% + 7px); transform: translateX(-50%) translateY(-4px);
  background: rgba(23,33,74,0.97); border: 1px solid var(--border); color: var(--text);
  padding: 5px 11px; border-radius: 8px; font-size: 11.5px; font-weight: 600; white-space: nowrap;
  opacity: 0; pointer-events: none; z-index: 200; box-shadow: var(--shadow);
  transition: opacity 0.12s ease, transform 0.12s ease;
}
.tip:hover::after { opacity: 1; transform: translateX(-50%) translateY(0); }
th.th-filter { cursor: pointer; user-select: none; transition: color 0.15s; }
th.th-filter:hover { color: var(--text); }
.col-menu {
  position: fixed; z-index: 300; min-width: 200px; max-height: 320px; overflow-y: auto;
  background: rgba(23,33,74,0.97); border: 1px solid var(--border); border-radius: 12px;
  padding: 6px; display: flex; flex-direction: column; gap: 2px;
  box-shadow: var(--shadow); backdrop-filter: blur(12px);
}
.col-menu button {
  display: flex; align-items: center; gap: 9px; background: none; border: none;
  color: var(--text); font: inherit; font-size: 13px; font-weight: 600;
  padding: 8px 11px; border-radius: 8px; cursor: pointer; text-align: left;
}
.col-menu button .sec-ico, .col-menu button .h-ico { width: 16px; height: 16px; margin: 0; }
.col-menu button:hover { background: rgba(255,255,255,0.08); }
.col-menu button.active { background: rgba(108,140,255,0.25); }
.chat-peek {
  position: fixed; z-index: 300; width: 300px; pointer-events: none;
  background: rgba(23,33,74,0.97); border: 1px solid var(--border); border-radius: 14px;
  padding: 12px 14px; box-shadow: var(--shadow); backdrop-filter: blur(12px);
  display: flex; flex-direction: column; gap: 8px;
}
.peek-title { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.5px; color: var(--muted); }
.peek-msg { font-size: 12.5px; line-height: 1.4; border-left: 2px solid var(--primary); padding-left: 9px; }
.peek-msg b { font-size: 12px; }
.peek-msg .muted { font-size: 10.5px; }
.chip .sec-ico { margin-right: 4px; }
.chip {
  padding: 6px 1px; font-size: 13px; font-weight: 600; cursor: pointer;
  background: transparent; border: none; border-bottom: 2px solid transparent; border-radius: 0;
  color: var(--muted); transition: color 0.15s, border-color 0.15s;
}
.chip:hover { color: var(--text); }
.chip.active { color: var(--text); border-bottom-color: var(--primary); }

.filter-bar { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end; }
.filter-bar > div { min-width: 150px; }
.filter-bar label { margin-top: 0; }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; border-radius: 14px; }
table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
th { text-align: center; padding: 12px 14px; font-size: 11.5px; text-transform: uppercase; letter-spacing: 0.6px; color: var(--muted); border-bottom: 1px solid var(--border); white-space: nowrap; }
td { padding: 12px 14px; border-bottom: 1px solid rgba(255,255,255,0.06); vertical-align: middle; }
tbody tr { transition: background 0.12s; }
tbody tr:hover { background: rgba(255,255,255,0.05); }
td .mono { font-family: 'SF Mono', Menlo, monospace; font-size: 12.5px; color: var(--cyan); }
.instr-cell { max-width: 320px; min-width: 180px; white-space: normal; word-break: break-word; line-height: 1.45; }
.col-wide { width: 23%; min-width: 260px; }
.td-center { text-align: center; }
.person-link { color: inherit; text-decoration: none; border-bottom: 1px dashed rgba(255,255,255,0.25); transition: color 0.15s, border-color 0.15s; }
.person-link:hover { color: #a8bcff; border-bottom-color: #a8bcff; }
.file-thumbs { display: flex; flex-wrap: wrap; gap: 5px; max-width: 100px; justify-content: center; margin: 0 auto; }
.file-thumb { width: 30px; height: 30px; border-radius: 7px; object-fit: cover; display: block; border: 1px solid var(--border); flex-shrink: 0; }
.file-thumb-doc { display: flex; align-items: center; justify-content: center; background: rgba(255,255,255,0.06); color: var(--cyan); }
#quick-add-row input, #quick-add-row select { padding: 8px 11px; font-size: 13px; border-radius: 9px; }
#quick-add-row td { vertical-align: middle; }

/* ---------- Daily activity timeline ---------- */
.timeline-grid { max-height: 460px; overflow-y: auto; scrollbar-width: thin; }
.tl-row { display: grid; grid-template-columns: 105px 1fr; gap: 12px; align-items: start; padding: 5px 4px; border-bottom: 1px solid rgba(255,255,255,0.05); min-height: 26px; }
.tl-time { font-size: 11.5px; color: var(--muted); font-weight: 600; white-space: nowrap; padding-top: 3px; }
.tl-row.has-events { background: rgba(108,140,255,0.06); border-left: 2px solid var(--primary); }
.tl-row.has-events .tl-time { color: var(--text); }
.tl-events { display: flex; flex-wrap: wrap; gap: 6px; }
.tl-chip { font-size: 12px; line-height: 1.4; background: rgba(255,255,255,0.07); border-radius: 9px; padding: 4px 10px; word-break: break-word; }
.tl-chip.tl-in { background: rgba(52,211,153,0.15); color: var(--green); }
.tl-chip.tl-out { background: rgba(248,113,113,0.15); color: var(--red); }
.upd-scroll {
  max-height: 76px; overflow-y: auto; overflow-anchor: none; display: flex; flex-direction: column; gap: 7px; padding-right: 5px;
  scrollbar-width: thin;
}
.upd-scroll::-webkit-scrollbar { width: 4px; }
.upd-scroll::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.2); border-radius: 2px; }
.upd-item { font-size: 12px; line-height: 1.4; border-left: 2px solid rgba(108,140,255,0.55); padding-left: 8px; white-space: normal; word-break: break-word; }
.upd-item .muted { font-size: 10.5px; display: block; }
.upd-cell { display: flex; align-items: flex-start; gap: 8px; }
.upd-body { flex: 1; min-width: 0; }
.upd-cell .btn-icon { flex-shrink: 0; }
.badge-stack { display: flex; flex-direction: column; align-items: flex-start; gap: 3px; }

/* ---------- Badges ---------- */
.badge { display: inline-flex; align-items: center; gap: 6px; padding: 2px 0; font-size: 11.5px; font-weight: 700; white-space: nowrap; }
.badge::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge-tbd { color: #b9c6e8; }
.badge-ongoing { color: var(--amber); }
.badge-done { color: var(--green); }
.badge-confirmed { color: var(--cyan); }
.badge-pending { color: #c4b5fd; }
.badge-returned { color: var(--red); }
.badge-overdue { color: var(--red); }
.badge-admin { color: var(--cyan); }

/* ---------- Modal ---------- */
.modal-host { position: fixed; inset: 0; z-index: 100; display: flex; align-items: center; justify-content: center; padding: 24px; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(5,10,30,0.6); backdrop-filter: blur(4px); }
.modal { position: relative; width: 100%; max-width: 560px; max-height: 88vh; overflow-y: auto; padding: 28px; background: rgba(23,33,74,0.92); }
.modal.modal-lg { max-width: 780px; }
.modal-resize {
  resize: both; overflow: auto; min-width: 400px; min-height: 360px;
  display: flex; flex-direction: column;
}
.modal-resize .chat-thread { flex: 1; max-height: none; }
.modal-resize > .modal-sub, .modal-resize > form, .modal-resize > .chat-confirmbar, .modal-resize > h3 { flex-shrink: 0; }
.modal h3 { font-size: 19px; font-weight: 800; margin-bottom: 4px; }
.modal .modal-sub { font-size: 13px; color: var(--muted); margin-bottom: 10px; }
.modal-close { position: absolute; top: 16px; right: 16px; background: rgba(255,255,255,0.08); border: none; color: var(--muted); width: 32px; height: 32px; border-radius: 50%; font-size: 15px; cursor: pointer; }
.modal-close:hover { color: var(--text); background: rgba(255,255,255,0.15); }
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 22px; }

/* ---------- Toast ---------- */
.toast {
  position: fixed; bottom: 26px; left: 50%; transform: translateX(-50%);
  background: rgba(23,33,74,0.95); border: 1px solid var(--border); backdrop-filter: blur(12px);
  padding: 12px 22px; border-radius: 12px; font-size: 14px; font-weight: 600; z-index: 200;
  box-shadow: var(--shadow); animation: toast-in 0.25s ease;
}
.toast.error { border-color: rgba(248,113,113,0.5); color: #fecaca; }
@keyframes toast-in { from { opacity: 0; transform: translateX(-50%) translateY(10px); } }

/* ---------- Charts ---------- */
.chart-row { display: flex; gap: 24px; align-items: center; flex-wrap: wrap; }
.legend { display: flex; flex-direction: column; gap: 8px; font-size: 13px; }
.legend-item { display: flex; align-items: center; gap: 8px; }
.legend-dot { width: 10px; height: 10px; border-radius: 3px; }
.bars { display: flex; flex-direction: column; gap: 10px; width: 100%; }
.bar-row { display: grid; grid-template-columns: 130px 1fr 52px; align-items: center; gap: 10px; font-size: 13px; }
.bar-row .bar-label { color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar-track { background: rgba(255,255,255,0.07); border-radius: 999px; height: 12px; overflow: hidden; }
.bar-fill { height: 100%; border-radius: 999px; background: linear-gradient(90deg, var(--primary), var(--primary-2)); transition: width 0.4s ease; }
.bar-track.stacked { display: flex; }
.bar-track.stacked .seg { height: 100%; transition: width 0.4s ease; }
.bar-val { font-weight: 700; text-align: right; font-size: 12.5px; }

/* ---------- Timeline / detail ---------- */
.timeline { display: flex; flex-direction: column; gap: 12px; margin-top: 8px; }
.timeline-item { padding: 12px 14px; background: rgba(255,255,255,0.05); border-radius: 12px; border-left: 3px solid var(--primary); font-size: 13.5px; }
.timeline-item .t-meta { font-size: 12px; color: var(--muted); margin-bottom: 4px; }
.attach-list { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.attach-item { display: inline-flex; align-items: center; gap: 6px; background: rgba(255,255,255,0.08); border: 1px solid var(--border); padding: 5px 11px; border-radius: 9px; font-size: 12.5px; color: var(--cyan); text-decoration: none; }
.attach-item:hover { background: rgba(255,255,255,0.14); }
.attach-thumb { width: 72px; height: 72px; object-fit: cover; border-radius: 10px; border: 1px solid var(--border); }

.kv { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; margin: 12px 0; }
.kv .kv-item { background: rgba(255,255,255,0.05); border-radius: 12px; padding: 10px 14px; }
.kv .kv-label { font-size: 11px; text-transform: uppercase; letter-spacing: 0.5px; color: var(--muted); font-weight: 700; }
.kv .kv-value { font-size: 14px; font-weight: 600; margin-top: 3px; }

/* ---------- Org chart ---------- */
.org-tree ul { list-style: none; padding-left: 26px; border-left: 1px dashed rgba(255,255,255,0.2); margin-left: 9px; }
.org-tree > ul { border-left: none; padding-left: 0; margin-left: 0; }
.org-node { display: inline-flex; align-items: center; gap: 10px; background: rgba(255,255,255,0.06); border: 1px solid var(--border); padding: 8px 14px; border-radius: 12px; margin: 6px 0; font-size: 13.5px; }
.org-node .org-pos { color: var(--muted); font-size: 12px; }

.empty { text-align: center; padding: 40px; color: var(--muted); font-size: 14px; }

/* ---------- Task chat popup ---------- */
.chat-thread {
  display: flex; flex-direction: column; gap: 14px;
  max-height: 42vh; min-height: 120px; overflow-y: auto;
  padding: 8px 2px 22px; margin: 12px 0 10px;
}
.chat-row { display: flex; }
.chat-row.mine { justify-content: flex-end; }
.chat-msg { max-width: 78%; display: flex; flex-direction: column; }
.chat-meta { font-size: 10.5px; color: var(--muted); margin: 0 8px 3px; }
.chat-row.mine .chat-meta { text-align: right; }
.chat-bubble {
  padding: 8px 13px; font-size: 13.5px; line-height: 1.45; width: fit-content;
  background: rgba(255,255,255,0.07); border-radius: 16px 16px 16px 5px;
}
.chat-row.mine .chat-bubble {
  background: linear-gradient(135deg, #5b7cfa, #7e5bfa); color: #fff;
  border-radius: 16px 16px 5px 16px; margin-left: auto;
}
.chat-atts { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 5px; }
.chat-row.mine .chat-atts { justify-content: flex-end; }
.chat-photo { width: 120px; height: 120px; object-fit: cover; border-radius: 14px; display: block; }
.chat-controls { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin-bottom: 8px; }
.tick.tick-right { margin-left: auto; }
.tick { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--muted); cursor: pointer; margin: 0; text-transform: none; letter-spacing: 0; font-weight: 600; }
.tick input {
  appearance: none; -webkit-appearance: none;
  width: 13px; height: 13px; min-width: 13px; padding: 0; margin: 0; flex: 0 0 13px;
  border-radius: 50%; border: 1.5px solid var(--muted); background: transparent;
  cursor: pointer; position: relative; transition: border-color 0.15s;
}
.tick input:checked { border-color: var(--primary); }
.tick input:checked::before {
  content: ''; position: absolute; inset: 2px; border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--primary-2));
}
.period-radios { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; padding-top: 12px; margin-top: 12px; border-top: 1px solid var(--border); }
.chat-status { width: auto; padding: 6px 28px 6px 12px; font-size: 12.5px; border: none; background: rgba(255,255,255,0.07); border-radius: 9px; }
.chat-progress { display: inline-flex; align-items: center; gap: 8px; }
.chat-progress input[type="range"] { width: 110px; height: 20px; }
.chat-progress b { font-size: 12px; min-width: 34px; color: var(--text); }
.mini-track { width: 92px; height: 5px; border-radius: 999px; background: rgba(255,255,255,0.1); overflow: hidden; margin-top: 5px; }
.mini-fill { height: 100%; border-radius: 999px; background: linear-gradient(90deg, var(--primary), var(--primary-2)); }

/* ---------- Rewards & celebration ---------- */
.bar-fill.gold { background: linear-gradient(90deg, #f59e0b, #fbbf24); }
.rank {
  display: inline-flex; align-items: center; justify-content: center;
  width: 20px; height: 20px; border-radius: 50%; font-size: 11px; margin-right: 4px;
  background: rgba(255,255,255,0.1); color: var(--text);
}
.rank-1 { background: linear-gradient(135deg, #f59e0b, #fbbf24); color: #1b2b5e; }
.rank-2 { background: linear-gradient(135deg, #94a3b8, #cbd5e1); color: #1b2b5e; }
.rank-3 { background: linear-gradient(135deg, #b45309, #d97706); color: #fff; }
.celebrate-host {
  position: fixed; inset: 0; z-index: 500; overflow: hidden;
  display: flex; align-items: center; justify-content: center;
  background: rgba(5,10,30,0.4); backdrop-filter: blur(2px); cursor: pointer;
}
.confetti { position: absolute; top: -14px; border-radius: 2px; animation: confetti-fall linear forwards; }
@keyframes confetti-fall {
  0% { transform: translateY(0) rotate(0deg); }
  100% { transform: translateY(108vh) rotate(760deg); opacity: 0.85; }
}
.celebrate-card {
  background: rgba(23,33,74,0.97); border: 1px solid rgba(251,191,36,0.45);
  border-radius: 24px; padding: 34px 52px; text-align: center;
  box-shadow: 0 24px 90px rgba(0,0,0,0.55), 0 0 60px rgba(251,191,36,0.12);
  animation: pop-in 0.4s cubic-bezier(0.2, 1.4, 0.4, 1);
}
.celebrate-title {
  font-size: 28px; font-weight: 800;
  background: linear-gradient(90deg, #6c8cff, #c86cff, #fbbf24);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.celebrate-points { margin-top: 10px; font-size: 16px; font-weight: 800; color: var(--gold); }
.celebrate-sub { margin-top: 6px; font-size: 13px; color: var(--muted); }
@keyframes pop-in { from { transform: scale(0.55); opacity: 0; } }
.chat-inputrow { display: flex; align-items: flex-end; gap: 8px; }
.chat-inputrow textarea {
  border: none; background: rgba(255,255,255,0.07); border-radius: 22px; padding: 12px 17px;
}
.chat-inputrow textarea:focus { background: rgba(255,255,255,0.1); }
.chat-attach {
  position: relative; display: flex; align-items: center; justify-content: center;
  width: 42px; height: 42px; border-radius: 50%; cursor: pointer;
  border: none; background: rgba(255,255,255,0.07); color: var(--muted); flex-shrink: 0;
  transition: color 0.15s, background 0.15s;
}
.chat-attach:hover { color: var(--text); background: rgba(255,255,255,0.13); }
.chat-attach-count {
  position: absolute; top: -2px; right: -2px; min-width: 17px; height: 17px; border-radius: 9px;
  background: linear-gradient(135deg, var(--primary), var(--primary-2));
  font-size: 10.5px; font-weight: 700; display: flex; align-items: center; justify-content: center; padding: 0 4px;
}
.chat-send { width: 42px; height: 42px; padding: 0; border-radius: 50%; flex-shrink: 0; box-shadow: none; }
.chat-confirmbar { display: flex; gap: 8px; align-items: center; margin-top: 12px; }
.chat-confirmbar input { border: none; background: rgba(255,255,255,0.06); border-radius: 18px; padding: 10px 16px; }
.chat-confirmbar .btn { width: 42px; height: 42px; padding: 0; border-radius: 50%; flex-shrink: 0; box-shadow: none; }

/* ---------- Nav layout variants (Settings → Appearance) ---------- */
.app.nav-h { flex-direction: column; }
.app.nav-h.nav-bottom { flex-direction: column-reverse; }
.app.nav-v.nav-right { flex-direction: row-reverse; }
.app.nav-h .sidebar {
  width: 100%; height: auto; position: relative;
  flex-direction: row; align-items: center; gap: 16px; padding: 10px 18px;
}
.bar-title { display: none; }
.app.nav-h .bar-title {
  display: block; font-weight: 800; font-size: 16px; letter-spacing: 0.3px; white-space: nowrap;
}
.app.nav-h .sidebar .brand { padding: 0 8px 0 0; }
.app.nav-h .sidebar nav { flex-direction: row; flex-wrap: wrap; align-items: center; justify-content: flex-end; width: auto; flex: 1; }
.app.nav-h .sidebar nav a { padding: 10px 14px; }
.app.nav-h .me-chip.nav-end { margin-top: 0; margin-left: 0; border-top: none; border-left: 1px solid var(--border); padding-top: 0; padding-left: 14px; }
.sidebar nav.align-center { justify-content: center; }
.sidebar nav.align-spread { justify-content: space-evenly; }
.sidebar nav.align-end { justify-content: flex-end; }

input[type="range"] { accent-color: var(--primary); padding: 0; height: 28px; background: transparent; border: none; }
input[type="range"]:focus { border: none; background: transparent; }

@media (max-width: 900px) {
  .app { flex-direction: column; }
  .sidebar { width: 100%; height: auto; position: static; flex-direction: row; align-items: center; flex-wrap: wrap; gap: 10px; }
  .sidebar nav { flex-direction: row; flex-wrap: wrap; justify-content: flex-end; width: auto; flex: 1; }
  .me-chip.nav-end { margin-top: 0; margin-left: 0; border: none; padding: 0; }
  .form-row { grid-template-columns: 1fr; }
}

/* ---------- Profile status column chart ---------- */
.colchart {
  display: flex; align-items: flex-end; gap: 18px;
  overflow-x: auto; padding: 22px 6px 4px; min-height: 214px;
}
.cc-group { display: flex; flex-direction: column; align-items: center; gap: 7px; flex-shrink: 0; }
.cc-bars { display: flex; align-items: flex-end; gap: 4px; height: 164px; }
.cc-bar { width: 13px; border-radius: 4px 4px 0 0; position: relative; opacity: 0.92; }
.cc-bar:hover { opacity: 1; }
.cc-val {
  position: absolute; top: -17px; left: 50%; transform: translateX(-50%);
  font-size: 10.5px; font-weight: 700; color: var(--muted);
}
.cc-x { font-size: 11px; color: var(--muted); white-space: nowrap; }

/* ---------- Point levels ---------- */
.lvl-ico { display: inline-flex; vertical-align: -3px; margin-right: 5px; }
.celebrate-level {
  display: flex; align-items: center; gap: 12px; text-align: left;
  margin-bottom: 16px; padding: 12px 16px; border-radius: 14px;
  background: rgba(255,255,255,0.08);
  border: 1px solid var(--lvl-color);
  box-shadow: 0 0 22px -6px var(--lvl-color);
}
.celebrate-level-icon { display: flex; flex-shrink: 0; }
.celebrate-level-title { font-size: 17px; font-weight: 800; color: var(--lvl-color); }
.celebrate-level-sub { font-size: 12.5px; color: var(--muted); margin-top: 2px; }

/* ---------- Strategic Plan benefits (Admin) ---------- */
.benefit-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 14px; }
.benefit-card {
  display: flex; gap: 13px; align-items: flex-start;
  padding: 15px 16px; border-radius: 14px;
  background: rgba(255,255,255,0.05); border: 1px solid var(--border);
}
.benefit-ico {
  flex-shrink: 0; width: 38px; height: 38px; border-radius: 11px;
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, rgba(108,140,255,0.22), rgba(200,108,255,0.18));
}
.benefit-ico .h-ico { width: 20px; height: 20px; margin: 0; color: #8fa2ff; }
.benefit-title { font-weight: 700; font-size: 14px; margin-bottom: 3px; }
.benefit-desc { font-size: 12.5px; color: var(--muted); line-height: 1.55; }

/* ---------- Strategic Plan (carousel) ---------- */
.sp-carousel { overflow: hidden; }
.sp-progress { height: 3px; background: rgba(255,255,255,0.06); }
.sp-progress-bar { height: 100%; width: 20%; background: linear-gradient(90deg, var(--primary), var(--primary-2)); border-radius: 0 3px 3px 0; transition: width 0.45s ease; }

.sp-viewport { overflow: hidden; transition: height 0.35s ease; }
.sp-track { display: flex; align-items: flex-start; transition: transform 0.45s cubic-bezier(0.22, 0.61, 0.36, 1); }
.sp-slide { flex: 0 0 100%; min-width: 100%; box-sizing: border-box; padding: 44px 48px 40px; }
.sp-slide-inner { max-width: 760px; margin: 0 auto; }

.sp-tag {
  display: inline-flex; align-items: center; gap: 7px; padding: 6px 15px 6px 11px; margin-bottom: 18px;
  border-radius: 999px; background: rgba(108,140,255,0.14); border: 1px solid rgba(108,140,255,0.35);
  color: #a9b9ff; font-size: 11.5px; font-weight: 800; letter-spacing: 0.7px; text-transform: uppercase;
}
.sp-tag .h-ico { width: 14px; height: 14px; margin: 0; color: #a9b9ff; }
.sp-title { font-size: 27px; font-weight: 800; margin-bottom: 10px; line-height: 1.25; }
.sp-sub { color: var(--muted); font-size: 14px; margin-bottom: 22px; }
.sp-body { color: var(--muted); font-size: 14.5px; line-height: 1.75; }

.sp-slide-hero { text-align: center; }
.sp-slide-hero .sp-tag { margin-left: auto; margin-right: auto; }
.sp-slide-hero .sp-title { font-size: 30px; max-width: 620px; margin-left: auto; margin-right: auto; }
.sp-slide-hero .sp-body { max-width: 600px; margin: 0 auto; }

.sp-list { display: flex; flex-direction: column; gap: 12px; }
.sp-row { display: flex; gap: 14px; align-items: flex-start; padding: 14px 16px; border-radius: 14px; background: rgba(255,255,255,0.04); border: 1px solid var(--border); }
.sp-ico { flex-shrink: 0; width: 38px; height: 38px; border-radius: 11px; display: flex; align-items: center; justify-content: center; }
.sp-ico .h-ico { width: 19px; height: 19px; margin: 0; }
.sp-ico-problem { background: rgba(248,113,113,0.14); }
.sp-ico-problem .h-ico { color: var(--red); }
.sp-ico-solution { background: rgba(52,211,153,0.14); }
.sp-ico-solution .h-ico { color: var(--green); }
.sp-row-title { font-weight: 700; font-size: 14px; margin-bottom: 3px; }
.sp-row-text { font-size: 13px; color: var(--muted); line-height: 1.6; }

.sp-slide-vision { text-align: center; padding-top: 50px; padding-bottom: 50px; }
.sp-vision-quote { max-width: 620px; margin: 0 auto; font-size: 18px; font-weight: 600; line-height: 1.75; color: var(--text); }

.sp-nav { display: flex; align-items: center; justify-content: center; gap: 18px; padding: 6px 26px 28px; }
.sp-arrow-btn {
  width: 38px; height: 38px; border-radius: 50%; flex-shrink: 0;
  border: 1px solid var(--border); background: rgba(255,255,255,0.06); color: var(--text);
  display: flex; align-items: center; justify-content: center; cursor: pointer;
  transition: background 0.15s, opacity 0.15s;
}
.sp-arrow-btn:hover:not(:disabled) { background: rgba(255,255,255,0.14); }
.sp-arrow-btn:disabled { opacity: 0.3; cursor: default; }
.sp-dots { display: flex; gap: 8px; }
.sp-dot { width: 8px; height: 8px; border-radius: 50%; background: rgba(255,255,255,0.18); border: none; padding: 0; cursor: pointer; transition: background 0.15s, transform 0.15s; }
.sp-dot.active { background: linear-gradient(135deg, var(--primary), var(--primary-2)); transform: scale(1.35); }
.sp-count { font-size: 11.5px; font-weight: 700; color: var(--muted); letter-spacing: 0.5px; min-width: 58px; text-align: center; }

@media (max-width: 640px) {
  .sp-slide { padding: 32px 22px 28px; }
  .sp-title { font-size: 22px; }
  .sp-slide-hero .sp-title { font-size: 24px; }
}
