/* ===========================================================================
   THEME TOKENS
   Semua warna diambil dari variabel ini, sehingga mode gelap & terang
   berlaku konsisten di seluruh halaman (login, papan, kalender, pengaturan,
   modal, notifikasi).
   =========================================================================== */
:root,
:root[data-theme="dark"] {
  --bg: #0B0C10;
  --text: #F5F6FA;
  --text-muted: rgba(245, 246, 250, 0.65);
  --text-dim: rgba(245, 246, 250, 0.4);
  --text-faint: rgba(245, 246, 250, 0.28);

  --glass-bg: rgba(255, 255, 255, 0.07);
  --glass-border: rgba(255, 255, 255, 0.14);
  --glass-shadow: 0 8px 32px rgba(0, 0, 0, 0.35);

  --surface: rgba(255, 255, 255, 0.06);
  --surface-2: rgba(255, 255, 255, 0.05);
  --surface-strong: rgba(255, 255, 255, 0.1);
  --hairline: rgba(255, 255, 255, 0.1);
  --hairline-soft: rgba(255, 255, 255, 0.06);

  --accent-a: #6C7CFF;
  --accent-b: #B98CF2;
  --on-accent: #0B0C10;
  --accent-text: #B0B8FF;

  --danger: #FF9E9E;
  --danger-bg: rgba(255, 90, 90, 0.12);
  --warn: #F5A85A;

  --blob-1: #5B5FEF;
  --blob-2: #E85D9E;
  --blob-3: #34D8C6;
  --blob-opacity-1: 0.35;
  --blob-opacity-2: 0.3;
  --blob-opacity-3: 0.25;

  --overlay: rgba(0, 0, 0, 0.55);
  --popover: #171A27;
  --popover-border: rgba(255, 255, 255, 0.16);
  --popover-shadow: 0 18px 44px rgba(0, 0, 0, 0.5);
  --avatar-ring: #0B0C10;
  color-scheme: dark;
}

:root[data-theme="light"] {
  --bg: #EDEFF6;
  --text: #16181F;
  --text-muted: rgba(22, 24, 31, 0.68);
  --text-dim: rgba(22, 24, 31, 0.45);
  --text-faint: rgba(22, 24, 31, 0.3);

  --glass-bg: rgba(255, 255, 255, 0.6);
  --glass-border: rgba(255, 255, 255, 0.85);
  --glass-shadow: 0 8px 32px rgba(60, 65, 100, 0.14);

  --surface: rgba(255, 255, 255, 0.72);
  --surface-2: rgba(255, 255, 255, 0.66);
  --surface-strong: rgba(22, 24, 31, 0.08);
  --hairline: rgba(22, 24, 31, 0.12);
  --hairline-soft: rgba(22, 24, 31, 0.08);

  --accent-a: #5B6BF5;
  --accent-b: #A876EC;
  --on-accent: #FFFFFF;
  --accent-text: #4E5BD8;

  --danger: #C2384A;
  --danger-bg: rgba(194, 56, 74, 0.1);
  --warn: #B46A17;

  --blob-1: #8B93FF;
  --blob-2: #FF9CC8;
  --blob-3: #7BE8DA;
  --blob-opacity-1: 0.5;
  --blob-opacity-2: 0.42;
  --blob-opacity-3: 0.38;

  --overlay: rgba(30, 32, 45, 0.35);
  --popover: #FFFFFF;
  --popover-border: rgba(255, 255, 255, 0.9);
  --popover-shadow: 0 18px 44px rgba(60, 65, 100, 0.22);
  --avatar-ring: #FFFFFF;
  color-scheme: light;
}

/* =========================================================================== */
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); overflow-x: hidden; }
body {
  font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--text);
  transition: background-color .25s ease, color .25s ease;
}
.font-display { font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; }

::-webkit-scrollbar { height: 6px; width: 6px; }
::-webkit-scrollbar-thumb { background: var(--surface-strong); border-radius: 4px; }

input:focus, textarea:focus, select:focus, button:focus-visible, a:focus-visible {
  outline: 2px solid var(--accent-a);
  outline-offset: 2px;
}
input, textarea, select, button { font-family: inherit; }

/* Background blobs */
.blob-layer { position: fixed; inset: 0; z-index: 0; overflow: hidden; pointer-events: none; }
.blob { position: absolute; border-radius: 50%; filter: blur(100px); transition: background-color .3s ease, opacity .3s ease; }
.blob1 { top: -10%; left: -10%; width: 480px; height: 480px; background: var(--blob-1); opacity: var(--blob-opacity-1); animation: blobMove1 26s ease-in-out infinite; }
.blob2 { top: 20%; right: -15%; width: 420px; height: 420px; background: var(--blob-2); opacity: var(--blob-opacity-2); animation: blobMove2 32s ease-in-out infinite; }
.blob3 { bottom: -15%; left: 20%; width: 500px; height: 500px; background: var(--blob-3); opacity: var(--blob-opacity-3); animation: blobMove3 22s ease-in-out infinite; }
@keyframes blobMove1 { 0% { transform: translate(-10%,-10%) scale(1);} 50% { transform: translate(6%,8%) scale(1.15);} 100% { transform: translate(-10%,-10%) scale(1);} }
@keyframes blobMove2 { 0% { transform: translate(8%,6%) scale(1);} 50% { transform: translate(-8%,-10%) scale(1.1);} 100% { transform: translate(8%,6%) scale(1);} }
@keyframes blobMove3 { 0% { transform: translate(0,0) scale(1);} 50% { transform: translate(-6%,10%) scale(1.2);} 100% { transform: translate(0,0) scale(1);} }
@media (prefers-reduced-motion: reduce) { .blob1,.blob2,.blob3 { animation: none !important; } }

#app { position: relative; z-index: 10; min-height: 100vh; }

/* ===========================================================================
   LAYOUT ADAPTIF
   HP  : satu kolom, kartu digeser horizontal, jarak rapat.
   Tab : lebih lebar, tiga kolom papan, sel kalender lebih tinggi.
   PC  : lebar penuh terkendali, tipografi & jarak lebih lega.
   =========================================================================== */
.app-container {
  width: 100%;
  min-height: 100dvh;
  margin: 0 auto;
  padding: 16px 14px 96px;
  display: flex;
  flex-direction: column;
  --cell-h: 116px;
  --board-min-h: 0px;
  --gap: 14px;
}
@media (min-width: 640px) {
  .app-container { max-width: 1920px; padding: 22px clamp(20px, 3vw, 48px) 100px; --cell-h: 132px; --gap: 16px; }
}
@media (min-width: 900px) {
  .app-container { padding: 26px clamp(24px, 3.5vw, 64px) 100px; --cell-h: 148px; --gap: 18px; --board-min-h: 58vh; }
}
@media (min-width: 1100px) {
  .app-container { --cell-h: 156px; --gap: 18px; --board-min-h: 60vh; }
}
@media (min-width: 1300px) {
  .app-container { padding: 30px clamp(32px, 4vw, 72px) 110px; --cell-h: 164px; --gap: 20px; --board-min-h: 62vh; }
}
@media (min-width: 1700px) {
  .app-container { padding: 34px clamp(48px, 5vw, 96px) 110px; --cell-h: 180px; --gap: 22px; --board-min-h: 66vh; }
}

/* Papan Kanban */
.board { display: flex; gap: var(--gap); overflow-x: auto; padding-bottom: 8px; scroll-snap-type: x proximity; align-items: stretch; }
.board-col { flex: 0 0 84%; min-width: 250px; scroll-snap-align: start; }
.board-col-inner { border-radius: 18px; padding: 12px; display: flex; flex-direction: column; gap: 12px; height: 100%; min-height: var(--board-min-h); }
@media (min-width: 560px) {
  .board-col { flex: 0 0 47%; }
}
@media (min-width: 860px) {
  /* Kolom membagi ruang rata; kalau papannya banyak, otomatis bisa digeser. */
  .board { scroll-snap-type: none; }
  .board-col { flex: 1 1 0; min-width: 245px; }
}
.board-cards { display: flex; flex-direction: column; gap: 10px; }

/* Kalender & catatan mengikuti lebar container */
.cal-week { display: grid; grid-template-columns: repeat(7, 1fr); min-height: var(--cell-h); }
.notes-grid { display: grid; grid-template-columns: 1fr; gap: var(--gap); }
@media (min-width: 640px) { .notes-grid { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1100px) { .notes-grid { grid-template-columns: repeat(3, 1fr); } }
@media (min-width: 1700px) { .notes-grid { grid-template-columns: repeat(4, 1fr); } }

/* Ukuran teks ikut membesar di layar besar */
@media (min-width: 1300px) {
  .task-card { padding: 14px; }
  .cal-daynum { width: 24px; height: 24px; font-size: 12.5px; }
  .cal-bar { height: 20px; font-size: 11.5px; }
}

.glass {
  background: var(--glass-bg);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border: 1px solid var(--glass-border);
  box-shadow: var(--glass-shadow);
}

/* Auth */
.field { display:flex; align-items:center; gap:8px; border-radius:12px; padding:0 12px; background: var(--surface); border:1px solid var(--hairline); color: var(--text-dim); }
.field input { width:100%; background:transparent; border:none; outline:none; color:var(--text); font-size:13.5px; padding:10px 0; }
.link-btn { background:none; border:none; color:var(--accent-text); font-weight:600; cursor:pointer; font-size:13px; }

.btn-primary { width:100%; display:flex; align-items:center; justify-content:center; gap:6px; border-radius:12px; padding:10px 0; font-weight:700; background:linear-gradient(135deg,var(--accent-a),var(--accent-b)); color:var(--on-accent); border:none; cursor:pointer; font-size:13.5px; }
.btn-secondary { border-radius:12px; padding:10px 16px; background:var(--surface-strong); color:var(--text-muted); border:none; cursor:pointer; font-size:13px; }
.btn-danger { display:flex; align-items:center; gap:6px; border-radius:12px; padding:10px 14px; background:var(--danger-bg); color:var(--danger); border:none; cursor:pointer; font-size:13px; }

/* Header / nav */
.app-header { position:relative; z-index:100; overflow:visible; }
.seg-btn { display:flex; align-items:center; gap:6px; border-radius:999px; padding:6px 12px; font-size:13px; background:transparent; color:var(--text-muted); font-weight:500; border:none; cursor:pointer; }
.seg-active { background:linear-gradient(135deg,var(--accent-a),var(--accent-b)); color:var(--on-accent); font-weight:700; }
.icon-btn { display:flex; align-items:center; justify-content:center; width:34px; height:34px; border-radius:999px; background:var(--surface); color:var(--text-muted); border:none; cursor:pointer; text-decoration:none; flex-shrink:0; }
.icon-btn-primary { display:flex; align-items:center; justify-content:center; width:38px; height:38px; border-radius:12px; background:linear-gradient(135deg,var(--accent-a),var(--accent-b)); color:var(--on-accent); border:none; cursor:pointer; flex-shrink:0; }

.app-brand { min-width:0; }
.app-brand span { white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.app-nav, .app-actions { flex-shrink:0; }
.header-user { max-width:210px; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; color:var(--text-muted); font-size:11.5px; font-weight:600; }
.app-content { flex:1 0 auto; }
.app-container.settings-page { padding-bottom:max(14px, env(safe-area-inset-bottom)); }
.auth-shell { min-height:100dvh; display:flex; flex-direction:column; padding:20px 20px max(12px, env(safe-area-inset-bottom)); }
.auth-main { flex:1 0 auto; display:flex; align-items:center; justify-content:center; padding:20px 0 32px; }
.app-footer { display:flex; align-items:center; justify-content:space-between; gap:14px; margin-top:32px; padding:0 4px; color:var(--text-dim); font-size:11px; flex-shrink:0; }
.auth-shell .app-footer { margin-top:0; }

@media (max-width: 639px) {
  .app-container { padding:12px 10px 92px; }
  .app-header {
    display:grid !important;
    grid-template-columns:minmax(0,1fr) auto;
    gap:10px 12px !important;
    padding:12px !important;
  }
  .app-brand { grid-column:1; grid-row:1; }
  .app-brand span { display:none; }
  .app-actions { grid-column:2; grid-row:1; }
  .app-nav {
    grid-column:1 / -1;
    grid-row:2;
    display:grid !important;
    grid-template-columns:repeat(6,minmax(0,1fr));
    width:100%;
    border-radius:14px !important;
  }
  .app-nav .seg-btn {
    min-width:0;
    width:100%;
    justify-content:center;
    flex-direction:column;
    gap:2px;
    padding:6px 2px;
    border-radius:11px;
    font-size:10px;
    line-height:1.15;
  }
  .app-nav .seg-btn span { display:block !important; max-width:100%; overflow:hidden; text-overflow:ellipsis; }
  .settings-section { padding:14px; }
  .app-footer { margin-top:28px; padding:0 2px; font-size:10.5px; }
  .auth-shell { padding:12px 12px max(10px, env(safe-area-inset-bottom)); }
  .auth-main { padding:12px 0 24px; }
  .auth-shell .app-footer { margin-top:0; }
  .setting-row > :first-child { min-width:0; }
  .responsive-form-row { flex-direction:column; }
  .responsive-form-row > * { min-width:0; width:100%; }
  .modal-overlay { align-items:flex-end; padding:0; }
  .modal-panel { max-width:none; max-height:calc(100dvh - 12px); border-radius:22px 22px 0 0; padding:18px 16px calc(18px + env(safe-area-inset-bottom)); }
  .modal-panel form > .flex.items-center.gap-2.mt-2 { flex-wrap:wrap; }
}

.avatar { display:flex; align-items:center; justify-content:center; width:30px; height:30px; border-radius:999px; color:#12131A; font-size:11px; font-weight:700; border:2px solid var(--avatar-ring); }
.avatar-sm { width:22px; height:22px; font-size:9px; }
.avatar-xs { display:inline-flex; align-items:center; justify-content:center; width:15px; height:15px; border-radius:999px; color:#12131A; font-size:7.5px; font-weight:700; border:1.5px solid var(--avatar-ring); flex-shrink:0; }

.fab { position:fixed; right:20px; bottom:24px; width:56px; height:56px; border-radius:999px; display:flex; align-items:center; justify-content:center; background:linear-gradient(135deg,var(--accent-a),var(--accent-b)); box-shadow:0 10px 30px rgba(108,124,255,0.45); color:var(--on-accent); border:none; cursor:pointer; z-index:30; }

/* Notification bell */
.bell-wrap { position:relative; z-index:110; }
.bell-wrap .icon-btn { position:relative; }
.bell-badge { position:absolute; top:-2px; right:-2px; min-width:17px; height:17px; padding:0 4px; border-radius:999px; background:#F0554F; color:#fff; font-size:10px; font-weight:700; display:flex; align-items:center; justify-content:center; border:2px solid var(--bg); }
/* Panel menempel ke tepi kanan lonceng dan lebarnya mengecil sendiri di layar
   sempit, jadi tidak pernah menjulur keluar layar. */
.notif-panel {
  position:absolute; top:44px; right:0; left:auto;
  width:min(320px, calc(100vw - 32px));
  border-radius:18px; padding:12px; z-index:1000;
  max-height:min(62vh, 460px); overflow-y:auto; overscroll-behavior:contain;
  background:var(--popover);
  border:1px solid var(--popover-border);
  box-shadow:var(--popover-shadow);
}
@media (max-width: 639px) {
  /* Di layar sempit panel diukur terhadap header, bukan terhadap lonceng,
     sehingga bisa melebar penuh tepat di bawah header tanpa menutupi menu. */
  .bell-wrap { position:static; }
  .notif-panel { top:calc(100% + 8px); left:0; right:0; width:auto; }
}
.notif-row { display:flex; gap:10px; align-items:flex-start; padding:9px 10px; border-radius:12px; background:var(--surface-strong); cursor:pointer; }
.notif-row:hover { background:var(--glass-border); }
.notif-dot { width:8px; height:8px; border-radius:999px; margin-top:5px; flex-shrink:0; }
.sev-overdue { color:#F0554F; }
.sev-today { color:var(--warn); }
.sev-soon { color:var(--text-muted); }

/* Kanban */
.task-card { position:relative; border-radius:14px; padding:12px; background:var(--surface-2); border:1px solid var(--hairline-soft); cursor:pointer; }
.task-card-bar { position:absolute; left:0; top:8px; bottom:8px; width:3px; border-radius:4px; }
.clamp-2 { display:-webkit-box; -webkit-line-clamp:2; -webkit-box-orient:vertical; overflow:hidden; }
.clamp-1 { display:-webkit-box; -webkit-line-clamp:1; -webkit-box-orient:vertical; overflow:hidden; }
.pill { display:flex; align-items:center; gap:4px; border-radius:999px; padding:4px 8px; background:var(--surface); color:var(--text-muted); font-size:11px; }
.embed-link { color:var(--accent-text); text-decoration:none; max-width:100%; }
.embed-link:hover { text-decoration:underline; }
.embed-field { border:1px solid var(--hairline-soft); border-radius:12px; padding:11px; background:var(--surface-2); }
.embed-field .setting-help { margin-top:6px; }
.pill-overdue { background:rgba(240,85,79,0.16); color:#F0554F; font-weight:600; }
.pill-soon { background:rgba(245,168,90,0.18); color:var(--warn); font-weight:600; }
.chev-btn { background:none; border:none; color:var(--text-muted); cursor:pointer; padding:2px; }
.chev-btn:disabled { color:var(--text-faint); cursor:default; }

/* Calendar */
.cal-cell { cursor:pointer; padding:4px 4px 0; border-top:1px solid var(--hairline-soft); }
.cal-daynum { display:inline-flex; align-items:center; justify-content:center; width:20px; height:20px; border-radius:999px; font-size:11.5px; color:var(--text-muted); font-weight:500; }
.cal-today { background:linear-gradient(135deg,var(--accent-a),var(--accent-b)); color:var(--on-accent) !important; font-weight:700; }
.cal-bar { position:absolute; pointer-events:auto; cursor:pointer; height:18px; border-radius:999px; color:#12131A; font-size:10.5px; font-weight:600; display:flex; align-items:center; gap:4px; padding:0 7px; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.cal-bar-title { flex:1; overflow:hidden; text-overflow:ellipsis; }
.today-btn { border-radius:999px; padding:4px 12px; font-size:12px; background:var(--surface-strong); color:var(--text-muted); border:none; cursor:pointer; }
.nav-btn { display:flex; align-items:center; justify-content:center; background:var(--surface-strong); border:none; border-radius:999px; width:28px; height:28px; color:var(--text); cursor:pointer; }
.today-row { display:flex; align-items:center; gap:10px; border-radius:12px; padding:8px 12px; background:var(--surface-2); cursor:pointer; }

/* Calendar: Gantt mode */
.gantt-wrap { margin-top:10px; }
.gantt-scroll { overflow-x:auto; border-radius:12px; border:1px solid var(--hairline-soft); }
.gantt-header { display:flex; position:sticky; top:0; z-index:2; background:var(--surface); border-bottom:1px solid var(--hairline-soft); }
.gantt-label-head { width:128px; min-width:128px; flex-shrink:0; position:sticky; left:0; z-index:3; background:var(--surface); padding:8px 10px; font-size:11px; font-weight:600; color:var(--text-dim); border-right:1px solid var(--hairline-soft); display:flex; align-items:center; }
.gantt-daybar { display:flex; }
.gantt-daycell { flex-shrink:0; text-align:center; font-size:10px; color:var(--text-dim); padding:8px 0; border-right:1px solid var(--hairline-soft); }
.gantt-daycell-today { color:var(--on-accent); font-weight:700; background:linear-gradient(135deg,var(--accent-a),var(--accent-b)); border-radius:6px; margin:2px; padding:6px 0; }
.gantt-row { display:flex; border-bottom:1px solid var(--hairline-soft); }
.gantt-row:last-child { border-bottom:none; }
.gantt-label { width:128px; min-width:128px; flex-shrink:0; position:sticky; left:0; z-index:1; background:var(--surface-2); display:flex; align-items:center; gap:6px; padding:8px 10px; font-size:12px; color:var(--text); cursor:pointer; border-right:1px solid var(--hairline-soft); }
.gantt-track { position:relative; height:38px; flex-shrink:0; }
.gantt-bar { position:absolute; top:8px; height:22px; border-radius:8px; color:#12131A; font-size:10.5px; font-weight:600; display:flex; align-items:center; padding:0 8px; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; cursor:pointer; }

/* Modal */
.modal-overlay { position:fixed; inset:0; background:var(--overlay); z-index:50; display:flex; align-items:center; justify-content:center; padding:16px; }
.modal-panel { width:100%; max-width:480px; border-radius:24px; padding:20px; max-height:88vh; overflow-y:auto; }
.modal-tabs { display:flex; gap:4px; border-bottom:1px solid var(--hairline); margin-top:10px; }
.modal-tab { background:none; border:none; color:var(--text-dim); font-size:13px; padding:8px 10px; cursor:pointer; border-bottom:2px solid transparent; margin-bottom:-1px; }
.modal-tab-active { color:var(--text); font-weight:600; border-bottom-color:var(--accent-a); }

.f-label { display:block; color:var(--text-dim); font-size:12px; margin-bottom:4px; font-weight:500; }
.f-input { width:100%; background:var(--surface); border:1px solid var(--hairline); border-radius:10px; padding:9px 11px; color:var(--text); font-size:13.5px; outline:none; }
  .color-dot { width:30px; height:30px; border-radius:999px; cursor:pointer; display:block; flex:0 0 auto; transition:border-color .14s ease,box-shadow .14s ease,transform .14s ease; }
  .color-dot:hover { transform:scale(1.06); }
  .color-dot.color-dot-selected { transform:scale(1.08); }
  .color-dot:focus-within { outline:2px solid var(--accent-a); outline-offset:4px; }

.assignee-list { display:flex; flex-direction:column; gap:6px; max-height:160px; overflow-y:auto; border:1px solid var(--hairline); border-radius:12px; padding:8px; }
.assignee-item { display:flex; align-items:center; gap:8px; cursor:pointer; padding:4px; }

.upload-btn { display:inline-flex; align-items:center; gap:6px; align-self:flex-start; border-radius:12px; padding:9px 14px; background:var(--surface-strong); color:var(--text); font-size:13px; cursor:pointer; }
.attachment-row { display:flex; align-items:center; gap:10px; border-radius:12px; padding:8px 10px; background:var(--surface-2); }

.activity-row { display:flex; gap:10px; padding:8px 2px; }
.comment-bubble { margin-top:4px; padding:8px 10px; border-radius:12px; background:var(--surface); font-size:13px; color:var(--text-muted); line-height:1.4; }

/* Header & kontrol papan */
.col-head { display:flex; align-items:center; gap:6px; padding:2px 2px 0; }
.col-name { font-size:13.5px; font-weight:700; color:var(--text); flex:1; min-width:0; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.col-count { border-radius:999px; padding:1px 8px; font-size:11.5px; background:var(--surface-strong); color:var(--text-muted); flex-shrink:0; }
.col-menu-btn { background:none; border:none; color:var(--text-dim); cursor:pointer; padding:2px; display:flex; flex-shrink:0; border-radius:6px; }
.col-menu-btn:hover { color:var(--text); background:var(--surface); }
.col-done .col-name { color:var(--text-muted); }
.col-empty { border:1px dashed var(--hairline); border-radius:12px; padding:20px 8px; text-align:center; font-size:11.5px; color:var(--text-faint); }
.col-add-card { margin-top:auto; display:flex; align-items:center; justify-content:center; gap:5px; border:none; border-radius:11px; padding:8px; background:var(--surface); color:var(--text-muted); font-size:12px; cursor:pointer; }
.col-add-card:hover { color:var(--text); }

.board-col-add { display:flex; flex: 0 0 62%; min-width:170px; }
.add-col-btn { width:100%; min-height:88px; border-radius:18px; display:flex; flex-direction:column; align-items:center; justify-content:center; gap:6px; color:var(--text-muted); font-size:12.5px; cursor:pointer; border:1px dashed var(--glass-border); }
.add-col-btn:hover { color:var(--text); }
@media (min-width: 560px) { .board-col-add { flex: 0 0 34%; } }
@media (min-width: 860px) { .board-col-add { flex: 0 0 152px; min-width:152px; } }

/* Handle geser */
.col-handle, .card-handle {
  display:flex; align-items:center; justify-content:center;
  color:var(--text-faint); cursor:grab; flex-shrink:0;
  touch-action:none; padding:3px; margin:-3px; border-radius:6px;
}
.col-handle:hover, .card-handle:hover { color:var(--text-muted); background:var(--surface); }
.col-handle:active, .card-handle:active { cursor:grabbing; }

/* Status saat menggeser */
.drag-ghost {
  position:fixed; z-index:80; pointer-events:none; margin:0;
  opacity:.94; transform-origin:center;
  box-shadow:0 18px 40px rgba(0,0,0,.4); border-radius:14px;
  rotate:1.5deg;
}
.drag-ghost .board-col-inner { min-height:0; }
.drag-source { opacity:.32; }
.drag-source .task-card-bar { opacity:.4; }
body.dragging-active { user-select:none; -webkit-user-select:none; }
body.dragging-active .task-card, body.dragging-active .board-col { cursor:grabbing; }

/* To-do (gaya Microsoft To Do) */
.todo-wrap { max-width: 1120px; margin: 0 auto; }
.todo-quick { display:flex; align-items:center; gap:10px; border-radius:16px; padding:12px 14px; }
.todo-quick input { flex:1; background:transparent; border:none; outline:none; color:var(--text); font-size:14px; min-width:0; }
.todo-item { display:flex; align-items:flex-start; gap:11px; border-radius:14px; padding:11px 12px; cursor:pointer; }
.todo-check { width:21px; height:21px; border-radius:999px; border:2px solid var(--text-dim); background:transparent; cursor:pointer; flex-shrink:0; display:flex; align-items:center; justify-content:center; color:var(--on-accent); margin-top:1px; padding:0; }
.todo-check:hover { border-color: var(--accent-a); }
.todo-check-on { background:linear-gradient(135deg,var(--accent-a),var(--accent-b)); border-color:transparent; }
.todo-body { flex:1; min-width:0; }
.todo-title { color:var(--text); font-size:14px; font-weight:500; line-height:1.35; overflow-wrap:anywhere; }
.todo-done .todo-title { color:var(--text-dim); text-decoration:line-through; }
.todo-meta-row { display:flex; align-items:center; gap:6px; flex-wrap:wrap; margin-top:4px; }
.todo-meta { display:inline-flex; align-items:center; gap:4px; font-size:11px; color:var(--text-dim); border-radius:999px; padding:2px 8px; background:var(--surface); }
.todo-meta.sev-overdue { color:#F0554F; background:rgba(240,85,79,0.14); }
.todo-meta.sev-today { color:var(--warn); background:rgba(245,168,90,0.16); }
.tagged-badge { color:var(--accent-text); background:rgba(108,124,255,0.14); }
.todo-star { background:none; border:none; color:var(--text-faint); cursor:pointer; padding:4px; margin-top:-1px; flex-shrink:0; }
.todo-star:hover { color:var(--warn); }
.todo-star-on { color:var(--warn); }
.todo-star-on svg { fill: currentColor; }
.todo-step-add { width:30px; height:30px; border-radius:10px; border:1px solid var(--hairline); background:var(--surface); color:var(--accent-text); display:flex; align-items:center; justify-content:center; cursor:pointer; flex-shrink:0; padding:0; }
.todo-step-add:hover { background:var(--surface-strong); }
.todo-steps-panel { display:flex; flex-direction:column; gap:9px; padding:12px; border:1px solid var(--hairline); border-radius:14px; background:var(--surface); }
.todo-step-compose { display:flex; align-items:center; gap:7px; border-radius:11px; padding:5px 6px 5px 11px; background:var(--surface-strong); border:1px solid var(--hairline-soft); }
.todo-step-compose input { flex:1; min-width:0; border:none; outline:none; background:transparent; color:var(--text); font-size:13px; padding:5px 0; }
.todo-step-compose button { width:30px; height:30px; border:0; border-radius:9px; background:linear-gradient(135deg,var(--accent-a),var(--accent-b)); color:var(--on-accent); display:flex; align-items:center; justify-content:center; cursor:pointer; }
.todo-step-list { display:flex; flex-direction:column; gap:5px; max-height:190px; overflow-y:auto; }
.todo-step-row { display:flex; align-items:center; gap:9px; padding:5px 3px; }
.todo-step-row .todo-check { width:19px; height:19px; margin:0; }
.todo-step-text { flex:1; min-width:0; color:var(--text); font-size:13px; overflow-wrap:anywhere; }
.todo-step-text-done { color:var(--text-dim); text-decoration:line-through; }
.todo-step-delete { border:0; background:transparent; color:var(--text-faint); padding:4px; cursor:pointer; }
.todo-step-delete:hover { color:var(--danger); }
.todo-done-toggle { display:flex; align-items:center; gap:6px; background:none; border:none; color:var(--text-muted); font-size:13px; font-weight:600; cursor:pointer; padding:10px 4px 2px; margin-top:8px; }
.day-picker { display:flex; gap:6px; margin-top:10px; flex-wrap:wrap; }
.day-dot { width:40px; height:32px; border-radius:10px; border:1px solid var(--hairline); background:var(--surface); color:var(--text-muted); font-size:11.5px; cursor:pointer; }
.day-dot-on { background:linear-gradient(135deg,var(--accent-a),var(--accent-b)); color:var(--on-accent); border-color:transparent; font-weight:700; }
.tagged-banner { display:flex; align-items:center; gap:7px; border-radius:11px; padding:8px 11px; margin-bottom:12px; background:rgba(108,124,255,0.12); color:var(--accent-text); font-size:12.5px; }

/* Kartu catatan */
.note-card { position:relative; border-radius:18px; padding:14px 14px 12px; cursor:pointer; display:flex; flex-direction:column; gap:8px; min-height:120px; }
.note-accent { position:absolute; left:0; top:14px; bottom:14px; width:3px; border-radius:4px; }
.note-body { color:var(--text-muted); font-size:12.5px; line-height:1.45; white-space:pre-wrap; display:-webkit-box; -webkit-line-clamp:4; -webkit-box-orient:vertical; overflow:hidden; }
.note-empty { border-radius:20px; padding:40px 20px; text-align:center; color:var(--text-dim); font-size:13px; }
.notes-toolbar { display:flex; align-items:center; justify-content:space-between; gap:10px; flex-wrap:wrap; margin-bottom:14px; }
.filter-group { display:flex; gap:4px; border-radius:999px; padding:4px; background:var(--surface); }
.filter-btn { border:none; background:transparent; color:var(--text-muted); font-size:12.5px; padding:5px 12px; border-radius:999px; cursor:pointer; display:inline-flex; align-items:center; gap:4px; }
.filter-btn-active { background:linear-gradient(135deg,var(--accent-a),var(--accent-b)); color:var(--on-accent); font-weight:600; }

/* ---------------------------------------------------------------------------
   Bilah cari + saring papan.
   Chip-nya sengaja punya bentuk saat diam, bukan hanya saat aktif: tombol yang
   tidak terlihat seperti tombol membuat orang mengira filternya rusak. Setiap
   chip juga mengecil sesaat saat ditekan, supaya sentuhan terasa menjawab.
   --------------------------------------------------------------------------- */
.board-filters { border-radius:20px; padding:11px 13px; margin-bottom:14px; display:flex; flex-direction:column; gap:10px; }
.board-search { display:flex; align-items:center; gap:9px; padding:9px 13px; border-radius:14px; background:var(--surface-2); border:1px solid var(--hairline-soft); color:var(--text-dim); }
.board-search:focus-within { border-color:var(--accent-a); background:var(--surface); }
.board-search input { flex:1; min-width:0; background:transparent; border:0; outline:none; color:var(--text); font-size:13.5px; }
.board-search-clear { background:transparent; border:0; color:var(--text-dim); cursor:pointer; display:inline-flex; padding:2px; border-radius:7px; }
.board-search-clear:hover { color:var(--text); background:var(--surface-strong); }

.board-filter-row { display:flex; align-items:center; gap:8px; flex-wrap:wrap; }
.filter-group { display:flex; align-items:center; gap:5px; flex-wrap:wrap; }
.filter-divider { width:1px; height:20px; background:var(--hairline); flex-shrink:0; }

.chip { display:inline-flex; align-items:center; justify-content:center; gap:5px; min-height:32px; padding:0 12px; border-radius:999px;
        border:1px solid var(--hairline); background:var(--surface-2); color:var(--text-muted);
        font-size:12.5px; font-weight:500; cursor:pointer; line-height:1;
        transition:background-color .15s ease, border-color .15s ease, color .15s ease, transform .08s ease; }
.chip:hover { background:var(--surface-strong); color:var(--text); border-color:var(--hairline); }
.chip:active { transform:scale(.94); }
.chip:focus-visible { outline:2px solid var(--accent-a); outline-offset:2px; }
.chip-active { background:linear-gradient(135deg,var(--accent-a),var(--accent-b)); border-color:transparent; color:var(--on-accent); font-weight:600; }
.chip-active:hover { color:var(--on-accent); }

/* Titik warna: lingkaran besar supaya nyaman disentuh, bukan titik 9 px. */
.chip-dot { width:32px; min-height:32px; padding:0; }
.chip-dot span { width:15px; height:15px; border-radius:999px; display:block; box-shadow:inset 0 1px 0 rgba(255,255,255,.3); }
.chip-dot.chip-active { background:var(--surface-strong); border-color:var(--accent-a); }
.chip-dot.chip-active span { box-shadow:0 0 0 2px var(--bg), 0 0 0 4px var(--accent-a); }

.chip-person { width:32px; min-height:32px; padding:0; overflow:hidden; }
.chip-person .avatar-xs { width:22px; height:22px; font-size:9px; border-radius:999px; display:inline-flex; align-items:center; justify-content:center; }
.chip-person.chip-active { background:var(--surface-strong); border-color:var(--accent-a); }

.chip-clear { margin-left:auto; color:var(--danger); border-color:var(--danger); background:var(--danger-bg); }
.chip-clear:hover { color:var(--danger); background:var(--danger-bg); }

.board-filter-note { font-size:11.5px; color:var(--text-dim); }
.board-filter-note strong { color:var(--text); }

@media (max-width: 640px) {
  .board-filters { padding:10px; border-radius:17px; }
  .board-filter-row { gap:6px; }
  .filter-divider { display:none; }
  .chip-clear { margin-left:0; }
}
.check-btn { display:flex; align-items:center; gap:5px; border:none; border-radius:999px; padding:4px 9px; font-size:11px; cursor:pointer; background:var(--surface-strong); color:var(--text-muted); }
.check-btn-done { background:rgba(63,224,197,0.18); color:#1F9E8A; }

/* Settings page */
.settings-section { border-radius:20px; padding:16px; }
.settings-title { font-size:14px; font-weight:700; color:var(--text); margin-bottom:2px; }
.settings-sub { font-size:12px; color:var(--text-dim); margin-bottom:14px; }
.setting-row { display:flex; align-items:center; justify-content:space-between; gap:14px; padding:11px 0; border-top:1px solid var(--hairline-soft); }
.setting-row-first { border-top:none; }
.setting-label { font-size:13.5px; color:var(--text); font-weight:500; }
.setting-help { font-size:11.5px; color:var(--text-dim); margin-top:2px; }

.theme-options { display:flex; gap:8px; margin-top:10px; }
.theme-card { flex:1; border-radius:14px; padding:12px 8px; background:var(--surface-2); border:2px solid transparent; cursor:pointer; text-align:center; color:var(--text-muted); font-size:12.5px; display:flex; flex-direction:column; align-items:center; gap:6px; }
.theme-card-active { border-color:var(--accent-a); color:var(--text); font-weight:600; }

/* Preset warna aksen. Pratinjau tiap kartu memakai warna preset itu sendiri,
   bukan token yang sedang aktif, supaya semuanya bisa dibandingkan sekaligus
   tanpa harus dicoba satu per satu. */
/* ---------------------------------------------------------------------------
   Chat bergaya WhatsApp: foto profil, pemisah hari, reaksi, suara, pencarian
   --------------------------------------------------------------------------- */
.avatar-photo { overflow:hidden; padding:0; background:var(--surface-strong); }
.avatar-photo img { width:100%; height:100%; object-fit:cover; display:block; }
.avatar-xl { width:72px; height:72px; font-size:24px; border-radius:22px; }
.avatar-setting { display:flex; align-items:center; gap:14px; margin-top:10px; }
.avatar-setting-actions { display:flex; flex-wrap:wrap; gap:8px; }
.avatar-upload { display:inline-flex; align-items:center; gap:7px; padding:8px 13px; border-radius:11px; background:var(--surface-strong); color:var(--text); font-size:12.5px; font-weight:600; cursor:pointer; }
.avatar-upload input { display:none; }
.avatar-remove { display:inline-flex; align-items:center; gap:6px; padding:8px 13px; border-radius:11px; background:var(--danger-bg); color:var(--danger); border:0; font-size:12.5px; font-weight:600; cursor:pointer; }

/* Kepala percakapan */
.chat-head-copy { display:flex; flex-direction:column; min-width:0; flex:1; }
.chat-head-copy strong { font-size:13.5px; line-height:1.2; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.chat-head-copy small { font-size:10.5px; color:var(--text-dim); line-height:1.3; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.chat-head-copy small.chat-online { color:#34D8C6; }
.chat-head-copy small.chat-typing { color:var(--accent-text); }
.chat-head-tool { background:transparent; border:0; color:var(--text-muted); cursor:pointer; padding:5px; border-radius:9px; display:inline-flex; }
.chat-head-tool:hover { background:var(--surface-strong); color:var(--text); }

/* Pemisah hari dan batas belum dibaca */
.chat-day { display:flex; justify-content:center; margin:10px 0 6px; }
.chat-day span { font-size:10.5px; font-weight:600; color:var(--text-dim); background:var(--surface-strong); border-radius:999px; padding:3px 11px; }
.chat-unread-divider span { color:var(--on-accent); background:linear-gradient(135deg,var(--accent-a),var(--accent-b)); }

/* Reaksi */
.chat-reactions { display:flex; flex-wrap:wrap; gap:4px; margin-top:-5px; padding:0 4px; }
.chat-message-row.mine .chat-reactions { justify-content:flex-end; }
.chat-reaction { display:inline-flex; align-items:center; gap:3px; padding:2px 7px; border-radius:999px; border:1px solid var(--hairline); background:var(--surface); color:var(--text); font-size:12px; cursor:pointer; line-height:1.4; }
.chat-reaction.mine { border-color:var(--accent-a); background:var(--surface-strong); }
.chat-reaction small { font-size:10px; color:var(--text-muted); font-weight:700; }
.chat-reaction-bar { position:absolute; bottom:calc(100% + 4px); right:0; display:flex; gap:2px; padding:4px; border-radius:999px; z-index:30; }
.chat-reaction-bar button { background:transparent; border:0; cursor:pointer; font-size:17px; line-height:1; padding:4px 5px; border-radius:999px; }
.chat-reaction-bar button:hover { background:var(--surface-strong); }

/* Pesan suara */
.chat-voice { display:flex; align-items:center; gap:7px; min-width:210px; }
.chat-voice audio { flex:1; height:32px; min-width:0; }
.chat-voice small { font-size:10.5px; color:var(--text-muted); font-variant-numeric:tabular-nums; }
.chat-recording { display:flex; align-items:center; gap:9px; padding:8px 11px; border-radius:13px; background:var(--surface-strong); margin-bottom:7px; font-size:12.5px; }
.chat-recording strong { font-size:12.5px; }
.chat-recording span { font-variant-numeric:tabular-nums; color:var(--text-muted); }
.chat-recording button { margin-left:auto; background:transparent; border:0; color:var(--text-muted); font-size:12.5px; font-weight:600; cursor:pointer; }
.chat-recording .chat-record-send { margin-left:0; color:var(--accent-text); }
.chat-record-dot { width:9px; height:9px; border-radius:50%; background:var(--danger); animation:chatRecordPulse 1.1s ease-in-out infinite; }
@keyframes chatRecordPulse { 0%,100% { opacity:1; } 50% { opacity:.25; } }
@media (prefers-reduced-motion: reduce) { .chat-record-dot { animation:none; } }

/* Status kirim */
.chat-checks.pending { opacity:.75; display:inline-flex; vertical-align:-2px; }
.chat-checks.failed { color:var(--danger); font-weight:800; }
.chat-bubble-pending { opacity:.72; }
.chat-row-failed .chat-bubble { border:1px solid var(--danger); }
.chat-send-failed { display:flex; align-items:center; gap:8px; flex-wrap:wrap; margin-top:5px; font-size:11px; color:var(--danger); }
.chat-send-failed button { background:var(--surface-strong); border:0; border-radius:8px; padding:3px 9px; color:var(--text); font-size:11px; font-weight:600; cursor:pointer; }

/* Lompat ke pesan terbaru */
.chat-jump-bottom { position:absolute; right:14px; bottom:86px; width:34px; height:34px; border-radius:50%; border:1px solid var(--hairline); background:var(--popover); color:var(--text); display:none; align-items:center; justify-content:center; cursor:pointer; box-shadow:var(--popover-shadow); z-index:25; }
.chat-jump-bottom.visible { display:flex; }

/* Pencarian di dalam percakapan */
.chat-search { padding:8px 10px 0; }
.chat-search-field { display:flex; align-items:center; gap:7px; padding:7px 10px; border-radius:11px; background:var(--surface-strong); color:var(--text-muted); }
.chat-search-field input { flex:1; min-width:0; background:transparent; border:0; outline:none; color:var(--text); font-size:12.5px; }
.chat-search-field button { background:transparent; border:0; color:var(--text-muted); cursor:pointer; display:inline-flex; }
.chat-search-results { max-height:190px; overflow:auto; margin-top:6px; display:flex; flex-direction:column; gap:3px; }
.chat-search-results button { text-align:left; background:var(--surface-2); border:0; border-radius:10px; padding:7px 10px; cursor:pointer; color:var(--text); display:flex; flex-direction:column; gap:1px; }
.chat-search-results button:hover { background:var(--surface-strong); }
.chat-search-results strong { font-size:11.5px; color:var(--accent-text); }
.chat-search-results span { font-size:12px; color:var(--text); overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.chat-search-results small { font-size:10px; color:var(--text-dim); }
.chat-message-found .chat-bubble { outline:2px solid var(--accent-a); outline-offset:2px; }

/* Grup */
.chat-group-form { display:flex; flex-direction:column; gap:6px; }
.chat-group-name { background:var(--surface); border:1px solid var(--hairline); border-radius:11px; padding:9px 11px; color:var(--text); font-size:13px; outline:none; }
.chat-group-pick { display:flex; align-items:center; gap:9px; padding:7px 9px; border-radius:11px; background:var(--surface-2); border:1px solid transparent; color:var(--text); font-size:12.5px; cursor:pointer; text-align:left; }
.chat-group-pick span { flex:1; min-width:0; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.chat-group-pick.picked { border-color:var(--accent-a); background:var(--surface-strong); }
.chat-group-remove { background:transparent; border:0; color:var(--danger); cursor:pointer; display:inline-flex; }
.chat-group-create { margin-top:4px; padding:10px; border-radius:12px; border:0; cursor:pointer; font-size:13px; font-weight:700; color:var(--on-accent); background:linear-gradient(135deg,var(--accent-a),var(--accent-b)); }
.chat-group-danger { background:var(--danger-bg); color:var(--danger); }

/* Tautan di dalam pesan */
.chat-link { color:var(--accent-text); text-decoration:underline; word-break:break-all; }

.accent-options { display:grid; grid-template-columns:repeat(auto-fill,minmax(126px,1fr)); gap:8px; margin-top:10px; }
.accent-card { border-radius:14px; padding:9px 11px; background:var(--surface-2); border:2px solid transparent; cursor:pointer; text-align:left; display:flex; align-items:center; gap:10px; min-width:0; color:var(--text-muted); }
.accent-card:hover { background:var(--surface-strong); }
.accent-card-active { border-color:var(--accent-a); color:var(--text); }
.accent-swatch { width:26px; height:26px; border-radius:9px; flex-shrink:0; border:1px solid var(--hairline); box-shadow:inset 0 1px 0 rgba(255,255,255,0.22); }
.accent-name { display:block; min-width:0; font-size:13px; font-weight:700; color:var(--text); line-height:1.2; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }

/* Toggle switch */
.switch { position:relative; display:inline-block; width:44px; height:25px; flex-shrink:0; }
.switch input { opacity:0; width:0; height:0; }
.slider { position:absolute; cursor:pointer; inset:0; background:var(--surface-strong); border-radius:999px; transition:.25s; }
.slider:before { position:absolute; content:""; height:19px; width:19px; left:3px; bottom:3px; background:#fff; border-radius:50%; transition:.25s; box-shadow:0 1px 3px rgba(0,0,0,0.3); }
.switch input:checked + .slider { background:linear-gradient(135deg,var(--accent-a),var(--accent-b)); }
.switch input:checked + .slider:before { transform:translateX(19px); }
.switch input:focus-visible + .slider { outline:2px solid var(--accent-a); outline-offset:2px; }

.number-input { width:74px; text-align:center; background:var(--surface); border:1px solid var(--hairline); border-radius:10px; padding:7px; color:var(--text); font-size:13.5px; outline:none; }

.toast { position:fixed; left:50%; transform:translateX(-50%); bottom:96px; z-index:60; border-radius:999px; padding:10px 18px; font-size:13px; font-weight:500; color:var(--text); }

/* Status penerima to-do (sisi pengirim) */
.recip-chip { display:inline-flex; align-items:center; justify-content:center; min-width:20px; height:16px; padding:0 4px; border-radius:999px; background:var(--surface-strong); color:var(--text-muted); font-size:9px; font-weight:700; margin-left:2px; }
.recip-done { background:rgba(63,224,197,0.25); color:#1F9E8A; }
.recip-meta-done { color:#1F9E8A; background:rgba(63,224,197,0.14); }
.recip-panel { border:1px solid var(--hairline); border-radius:14px; padding:11px 12px; margin-bottom:14px; background:var(--surface-2); }
.recip-row { display:flex; align-items:center; gap:9px; padding:5px 0; }
.recip-status { display:inline-flex; align-items:center; gap:5px; font-size:12px; color:var(--text-dim); }
.recip-status-done { color:#1F9E8A; font-weight:600; }

/* ===========================================================================
   MESSENGER
   Ditaruh sesudah aturan dasar. Kalau blok ini berada di atas .glass,
   latar, garis tepi, dan bayangan panel popover-nya ikut ditimpa .glass
   sehingga pemilih emoji dan kartu kamera berubah jadi tembus pandang.
   =========================================================================== */
/* Messenger: dock ala Facebook di desktop, panel fokus di layar vertikal. */
.chat-launcher {
  position: fixed; right: 86px; bottom: 28px; z-index: 90;
  width: 50px; height: 50px; border: 1px solid var(--glass-border);
  border-radius: 50%; display: grid; place-items: center; color: var(--on-accent);
  background: linear-gradient(135deg,var(--accent-a),var(--accent-b));
  box-shadow: 0 12px 35px rgba(70,78,160,.38); cursor: pointer;
}
.chat-launcher-badge { position:absolute; top:-3px; right:-3px; min-width:19px; height:19px; padding:0 5px; border-radius:999px; display:grid; place-items:center; background:#F0554F; color:#fff; font-size:10px; font-weight:800; border:2px solid var(--bg); }
.chat-dock { position:fixed; right:24px; bottom:88px; z-index:120; width:clamp(760px,50vw,1040px); max-width:calc(100vw - 28px); height:min(680px,calc(100vh - 120px)); border-radius:22px; overflow:hidden; display:flex; flex-direction:column; box-shadow:0 24px 70px rgba(0,0,0,.36); backdrop-filter:blur(28px) saturate(150%); -webkit-backdrop-filter:blur(28px) saturate(150%); }
.chat-head { min-height:58px; display:flex; align-items:center; gap:10px; padding:9px 12px; border-bottom:1px solid var(--glass-border); background:var(--surface-strong); color:var(--text); }
.chat-head strong { flex:1; font-size:14px; }
.chat-head button { width:34px; height:34px; border:0; border-radius:11px; display:grid; place-items:center; color:var(--text-muted); background:transparent; cursor:pointer; }
.chat-head button:hover { background:var(--surface); color:var(--text); }
.chat-list-title { flex:1; min-width:0; display:flex; align-items:center; gap:8px; }
.chat-list-title strong { flex:0 1 auto; }
.chat-contacts { overflow-y:auto; padding:8px; }
.chat-contact { position:relative; width:100%; border:0; background:transparent; color:var(--text); display:flex; align-items:center; gap:11px; padding:10px; border-radius:14px; text-align:left; cursor:pointer; transition:background .16s ease,opacity .16s ease; }
.chat-contact:hover { background:var(--surface); }
.chat-contact.is-loading { background:var(--surface); opacity:.78; pointer-events:none; }
.chat-contact.is-loading::after { content:""; flex:0 0 auto; width:15px; height:15px; border-radius:50%; border:2px solid color-mix(in srgb,var(--accent-a) 28%,transparent); border-top-color:var(--accent-a); animation:chat-contact-spin .7s linear infinite; }
@keyframes chat-contact-spin { to { transform:rotate(360deg); } }
.chat-room-contact { margin-bottom:5px; background:color-mix(in srgb,var(--accent-a) 9%,transparent); border:1px solid color-mix(in srgb,var(--accent-a) 20%,transparent); }
.chat-room-avatar { color:var(--on-accent); background:linear-gradient(135deg,var(--accent-a),var(--accent-b)); }
.chat-contact-copy { flex:1; min-width:0; display:flex; flex-direction:column; gap:2px; }
.chat-contact-copy strong { font-size:13px; }
.chat-contact-copy small { color:var(--text-muted); font-size:11px; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.chat-count { flex:0 0 auto; min-width:20px; height:20px; padding:0 6px; display:grid; place-items:center; border-radius:999px; background:linear-gradient(135deg,var(--chat-count-a,var(--accent-a)),var(--chat-count-b,var(--accent-b))); color:#fff; font-size:10px; line-height:1; font-weight:800; box-shadow:0 4px 12px color-mix(in srgb,var(--chat-count-a,var(--accent-a)) 28%,transparent); }
.chat-total-count { min-width:23px; height:23px; padding-inline:7px; }
.chat-messages { flex:1; overflow-y:auto; padding:14px 12px; display:flex; flex-direction:column; gap:7px; background:color-mix(in srgb,var(--surface) 55%,transparent); }
.chat-message-row { display:flex; }
.chat-message-row.mine { justify-content:flex-end; }
.chat-message-row.theirs { justify-content:flex-start; }
.chat-bubble { position:relative; max-width:82%; border-radius:17px; padding:9px 29px 7px 11px; color:var(--text); background:var(--surface-strong); border:1px solid var(--glass-border); font-size:13px; line-height:1.42; overflow-wrap:anywhere; }
.chat-message-row.mine .chat-bubble { color:var(--on-accent); border-color:transparent; background:linear-gradient(135deg,var(--accent-a),var(--accent-b)); }
.chat-sender-name { display:block; margin-bottom:3px; color:var(--accent-text); font-size:11px; }
.chat-forwarded { display:flex; align-items:center; gap:4px; margin-bottom:4px; font-size:10px; font-style:italic; opacity:.72; }
.chat-deleted-message { display:flex; align-items:center; gap:6px; font-style:italic; opacity:.72; }
.chat-reply-quote { width:100%; display:flex; flex-direction:column; gap:1px; margin:0 0 6px; padding:7px 9px; border:0; border-left:3px solid var(--accent-a); border-radius:8px; text-align:left; color:inherit; background:rgba(0,0,0,.12); cursor:default; }
.chat-reply-quote strong { font-size:10px; }
.chat-reply-quote span { max-width:220px; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; font-size:10px; opacity:.78; }
.chat-message-menu-button { position:absolute; top:4px; right:5px; width:23px; height:23px; border:0; border-radius:50%; display:grid; place-items:center; color:inherit; background:rgba(0,0,0,.08); opacity:.25; cursor:pointer; }
.chat-bubble:hover .chat-message-menu-button, .chat-message-menu-button:focus-visible { opacity:.9; }
.chat-message-menu { position:absolute; z-index:8; top:26px; right:6px; min-width:132px; padding:5px; border-radius:13px; color:var(--text); background:var(--popover); border:1px solid var(--popover-border); box-shadow:var(--popover-shadow); }
.chat-message-menu button { width:100%; display:flex; align-items:center; gap:8px; padding:8px 9px; border:0; border-radius:9px; color:var(--text); background:transparent; font-size:12px; cursor:pointer; }
.chat-message-menu button:hover { background:var(--surface-strong); }
.chat-bubble time { display:block; text-align:right; margin-top:4px; font-size:9px; opacity:.7; }
.chat-checks { display:inline-block; margin-left:3px; letter-spacing:-2px; font-size:11px; font-weight:800; color:currentColor; opacity:.85; }
.chat-checks.read { color:#61c7ff; opacity:1; }
.chat-attachment-list { display:flex; flex-direction:column; gap:6px; margin-top:6px; }
.chat-attachment { display:flex; align-items:center; gap:8px; padding:7px 8px; border-radius:11px; color:inherit; background:rgba(0,0,0,.1); text-decoration:none; font-weight:600; }
.chat-attachment > span { min-width:0; display:flex; flex-direction:column; overflow-wrap:anywhere; }
.chat-attachment small { display:block; opacity:.72; font-weight:400; }
.chat-media-grid { display:grid; grid-template-columns:1fr; width:min(640px,70vw); max-width:100%; overflow:hidden; border-radius:15px; }
.chat-media-grid.chat-media-count-1 { width:fit-content; justify-items:start; }
.chat-media-grid.chat-media-group { gap:3px; padding:3px; border:1px solid var(--glass-border); background:var(--surface-strong); }
.chat-media-grid.chat-media-count-2, .chat-media-grid.chat-media-count-3, .chat-media-grid.chat-media-count-4 { grid-template-columns:repeat(2,minmax(0,1fr)); }
.chat-media-grid.chat-media-count-3 > :first-child { grid-row:span 2; }
.chat-photo, .chat-video { position:relative; display:grid; place-items:center; width:100%; min-width:0; max-width:100%; margin:0; padding:0; border:0; border-radius:0; overflow:hidden; vertical-align:top; cursor:pointer; background:transparent; }
.chat-photo img, .chat-video video {
  display:block;
  width:auto;
  height:auto;
  max-width:100%;
  max-height:min(520px, 62vh);
  object-fit:contain;
}
.chat-media-grid.chat-media-count-1 .chat-photo, .chat-media-grid.chat-media-count-1 .chat-video { width:fit-content; max-width:100%; }
.chat-media-grid:not(.chat-media-count-1) .chat-photo img, .chat-media-grid:not(.chat-media-count-1) .chat-video video { width:100%; height:clamp(130px,18vw,260px); object-fit:cover; }
.chat-media-grid.chat-media-count-3 > :first-child img, .chat-media-grid.chat-media-count-3 > :first-child video { height:clamp(263px,36vw,523px); }
.chat-video-play { position:absolute; inset:50% auto auto 50%; width:42px; height:42px; translate:-50% -50%; display:grid; place-items:center; border-radius:50%; color:#fff; background:rgba(0,0,0,.58); }
.chat-media-more { position:absolute; inset:0; display:grid; place-items:center; color:#fff; background:rgba(5,7,15,.62); font-size:clamp(22px,4vw,38px); font-weight:800; text-shadow:0 2px 8px rgba(0,0,0,.55); }
.chat-media-with-caption .chat-photo, .chat-media-with-caption .chat-video { margin-top:0; }
.chat-media-caption { margin-top:7px; }
.chat-bubble.chat-media-only, .chat-bubble.chat-media-with-caption { width:max-content; max-width:94%; }
.chat-bubble.chat-media-only { padding:0; border:0; color:#fff; background:transparent; box-shadow:none; }
.chat-message-row.mine .chat-bubble.chat-media-only { border-color:transparent; background:transparent; }
.chat-media-only .chat-media-grid:not(.chat-media-group) { background:transparent; }
.chat-media-only .chat-photo, .chat-media-only .chat-video { margin-top:0; border:0; background:transparent; box-shadow:none; }
.chat-media-only time { position:absolute; z-index:2; right:7px; bottom:6px; margin:0; padding:3px 6px; border-radius:999px; color:#fff; background:rgba(0,0,0,.58); opacity:1; text-shadow:0 1px 2px rgba(0,0,0,.45); }
.chat-media-only .chat-message-menu-button { z-index:3; color:#fff; background:rgba(0,0,0,.52); opacity:.72; }
.chat-media-only .chat-sender-name { position:absolute; z-index:2; top:7px; left:7px; margin:0; padding:3px 7px; border-radius:999px; color:#fff; background:rgba(0,0,0,.58); text-shadow:0 1px 2px rgba(0,0,0,.45); }
.chat-compose-shell { position:relative; border-top:1px solid var(--glass-border); background:var(--surface-strong); }
.chat-compose { display:flex; align-items:center; gap:7px; padding:10px; border-top:1px solid var(--glass-border); background:var(--surface-strong); }
.chat-compose-shell .chat-compose { border-top:0; background:transparent; }
.chat-compose input[type="text"], .chat-compose > input { flex:1; min-width:0; border:1px solid var(--glass-border); border-radius:14px; background:var(--surface); color:var(--text); padding:10px 12px; outline:none; }
.chat-compose > button { width:39px; height:39px; border:0; border-radius:13px; display:grid; place-items:center; background:linear-gradient(135deg,var(--accent-a),var(--accent-b)); color:var(--on-accent); cursor:pointer; }
.chat-compose > .chat-tool { width:36px; height:36px; flex:0 0 auto; color:var(--text-muted); background:transparent; }
.chat-compose > .chat-tool:hover { color:var(--text); background:var(--surface); }
.chat-file { width:36px; height:36px; flex:0 0 auto; display:grid; place-items:center; color:var(--text-muted); border-radius:12px; cursor:pointer; }
.chat-file:hover { background:var(--surface); color:var(--text); }
.chat-file input { display:none; }
.chat-hidden-input { display:none !important; }
.chat-selected-files { display:flex; gap:7px; margin:8px 10px 0; padding-bottom:2px; overflow-x:auto; }
.chat-selected-file { min-width:190px; max-width:260px; display:flex; align-items:center; gap:9px; padding:8px 9px; border:1px solid var(--glass-border); border-radius:13px; color:var(--text); background:var(--surface); }
.chat-selected-file > img, .chat-selected-file > video { width:43px; height:43px; border-radius:10px; object-fit:cover; background:#050507; }
.chat-selected-file > span { min-width:0; flex:1; display:flex; flex-direction:column; }
.chat-selected-file strong { overflow:hidden; text-overflow:ellipsis; white-space:nowrap; font-size:11px; }
.chat-selected-file small { color:var(--text-muted); font-size:9px; }
.chat-selected-file > button { width:30px; height:30px; border:0; border-radius:10px; display:grid; place-items:center; color:var(--text-muted); background:transparent; cursor:pointer; }
.chat-selected-file > button:hover { color:var(--text); background:var(--surface-strong); }
.chat-emoji-picker { position:absolute; z-index:3; left:10px; bottom:calc(100% + 8px); width:250px; padding:9px; display:grid; grid-template-columns:repeat(6,1fr); gap:3px; border-radius:16px; box-shadow:var(--popover-shadow); background:var(--popover); border:1px solid var(--popover-border); }
.chat-emoji-picker button { width:35px; height:35px; border:0; border-radius:9px; background:transparent; font-size:20px; cursor:pointer; }
.chat-emoji-picker button:hover { background:var(--surface-strong); transform:scale(1.08); }
.chat-mention-picker { position:absolute; z-index:4; left:10px; right:10px; bottom:calc(100% + 8px); max-height:255px; overflow-y:auto; padding:7px; border-radius:16px; background:var(--popover); border:1px solid var(--popover-border); box-shadow:var(--popover-shadow); }
.chat-mention-picker[hidden], .chat-mention-picker > button[hidden] { display:none !important; }
.chat-mention-picker > button { width:100%; display:flex; align-items:center; gap:9px; padding:7px; border:0; border-radius:11px; text-align:left; color:var(--text); background:transparent; cursor:pointer; }
.chat-mention-picker > button:hover { background:var(--surface-strong); }
.chat-mention-picker > button > span:last-child { display:flex; flex-direction:column; }
.chat-mention-picker small { color:var(--text-muted); font-size:10px; }
.chat-compose-reply { display:flex; align-items:center; gap:8px; margin:8px 10px 0; padding:7px 9px; border-left:3px solid var(--accent-a); border-radius:10px; color:var(--text); background:var(--surface); }
.chat-compose-reply > span { min-width:0; flex:1; display:flex; flex-direction:column; }
.chat-compose-reply strong { font-size:10px; color:var(--accent-text); }
.chat-compose-reply small { overflow:hidden; text-overflow:ellipsis; white-space:nowrap; color:var(--text-muted); font-size:10px; }
.chat-mention { color:color-mix(in srgb,var(--accent-text) 78%,#22d3ee 22%); font-weight:800; }
.chat-message-row.mine .chat-mention { color:#8be9ff; }
.chat-compose-reply button { width:28px; height:28px; border:0; border-radius:9px; display:grid; place-items:center; color:var(--text-muted); background:transparent; cursor:pointer; }
.chat-notification-prompt { margin:8px 8px 0; display:flex; align-items:center; justify-content:center; gap:7px; padding:9px; border:1px solid color-mix(in srgb,var(--accent-a) 32%,transparent); border-radius:12px; color:var(--accent-text); background:color-mix(in srgb,var(--accent-a) 10%,transparent); font-size:11px; font-weight:700; cursor:pointer; }
.chat-forward-layer { position:absolute; z-index:9; inset:0; padding:13px; display:grid; place-items:center; background:var(--overlay); backdrop-filter:blur(12px); -webkit-backdrop-filter:blur(12px); }
.chat-forward-card { width:100%; max-height:90%; overflow:hidden; border-radius:19px; color:var(--text); background:var(--popover); border:1px solid var(--popover-border); box-shadow:var(--popover-shadow); }
.chat-forward-card header { display:flex; align-items:center; padding:12px; border-bottom:1px solid var(--glass-border); }
.chat-forward-card header strong { flex:1; }
.chat-forward-card header button { width:32px; height:32px; border:0; border-radius:10px; display:grid; place-items:center; color:var(--text-muted); background:transparent; cursor:pointer; }
.chat-forward-card > div { max-height:350px; overflow-y:auto; padding:7px; }
.chat-forward-card > div > button { width:100%; display:flex; align-items:center; gap:10px; padding:8px; border:0; border-radius:12px; color:var(--text); background:transparent; text-align:left; cursor:pointer; }
.chat-forward-card > div > button:hover { background:var(--surface-strong); }
.chat-gallery-layer { position:absolute; z-index:20; inset:0; display:flex; flex-direction:column; color:#fff; background:rgba(3,5,12,.94); backdrop-filter:blur(20px); -webkit-backdrop-filter:blur(20px); }
.chat-gallery-layer > header { min-height:56px; display:flex; align-items:center; gap:10px; padding:9px 12px; border-bottom:1px solid rgba(255,255,255,.12); }
.chat-gallery-layer > header strong { flex:0 0 auto; }
.chat-gallery-layer > header span { flex:1; min-width:0; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; color:rgba(255,255,255,.7); font-size:12px; }
.chat-gallery-layer > header button { width:36px; height:36px; border:0; border-radius:11px; display:grid; place-items:center; color:#fff; background:rgba(255,255,255,.1); cursor:pointer; }
.chat-gallery-stage { position:relative; flex:1; min-height:0; display:grid; place-items:center; padding:16px 56px; overflow:hidden; }
.chat-gallery-media { width:100%; height:100%; min-width:0; min-height:0; display:grid; place-items:center; overflow:hidden; }
.chat-gallery-media > img, .chat-gallery-media > video { display:block; width:100%; height:100%; min-width:0; min-height:0; object-fit:contain; object-position:center; border-radius:10px; background:transparent; }
.chat-gallery-nav { position:absolute; top:50%; translate:0 -50%; width:42px; height:54px; border:0; border-radius:13px; display:grid; place-items:center; color:#fff; background:rgba(255,255,255,.12); cursor:pointer; }
.chat-gallery-nav.previous { left:10px; }
.chat-gallery-nav.next { right:10px; }
.chat-gallery-layer > footer { display:flex; justify-content:center; gap:9px; padding:10px 12px 12px; border-top:1px solid rgba(255,255,255,.12); }
.chat-gallery-layer > footer a { display:flex; align-items:center; gap:7px; padding:9px 13px; border-radius:12px; color:#fff; background:rgba(255,255,255,.1); text-decoration:none; font-size:12px; font-weight:700; }
.chat-camera-layer { position:absolute; z-index:5; inset:0; padding:12px; display:grid; place-items:center; background:var(--overlay); backdrop-filter:blur(12px); -webkit-backdrop-filter:blur(12px); }
.chat-camera-card { width:100%; overflow:hidden; border-radius:20px; background:var(--popover); border:1px solid var(--popover-border); box-shadow:var(--popover-shadow); }
.chat-camera-head { display:flex; align-items:center; padding:11px 12px; color:var(--text); border-bottom:1px solid var(--glass-border); }
.chat-camera-head strong { flex:1; }
.chat-camera-head button { width:32px; height:32px; border:0; border-radius:10px; display:grid; place-items:center; color:var(--text-muted); background:transparent; cursor:pointer; }
.chat-camera-card video { display:block; width:100%; max-height:325px; aspect-ratio:3/4; object-fit:cover; background:#050507; }
.chat-camera-actions { min-height:72px; padding:10px 14px; display:flex; align-items:center; justify-content:space-between; }
.chat-camera-actions > button { border:0; color:var(--text); background:transparent; cursor:pointer; }
.chat-camera-actions > button:first-child { display:flex; align-items:center; gap:6px; font-size:11px; }
.chat-camera-actions .chat-shutter { width:52px; height:52px; padding:4px; border:2px solid var(--text); border-radius:50%; }
.chat-shutter span { display:block; width:100%; height:100%; border-radius:50%; background:linear-gradient(135deg,var(--accent-a),var(--accent-b)); }
.chat-camera-error { padding:28px 18px; color:var(--text-muted); text-align:center; font-size:13px; }
.chat-camera-error button { display:block; margin:14px auto 0; border:0; border-radius:11px; padding:9px 13px; color:var(--on-accent); background:linear-gradient(135deg,var(--accent-a),var(--accent-b)); cursor:pointer; }
.chat-empty { margin:auto; padding:24px; color:var(--text-muted); font-size:12px; text-align:center; }
.file-input { padding:9px 11px; }
.file-input::file-selector-button { border:0; border-radius:10px; padding:7px 10px; margin-right:10px; background:var(--surface-strong); color:var(--text); cursor:pointer; }
.attachment-mini-list { display:flex; flex-direction:column; gap:5px; margin-top:7px; }
.attachment-mini-list a { display:flex; align-items:center; gap:6px; color:var(--accent-text); font-size:12px; text-decoration:none; }

@media (max-width: 639px) {
  .chat-launcher { left:18px; right:auto; bottom:22px; width:48px; height:48px; }
  .chat-dock { left:10px; right:10px; bottom:80px; width:auto; height:min(620px,calc(100vh - 105px)); max-height:none; border-radius:24px; }
  .chat-bubble { max-width:88%; }
  .chat-media-grid { width:min(82vw,520px); }
  .chat-media-grid:not(.chat-media-count-1) .chat-photo img, .chat-media-grid:not(.chat-media-count-1) .chat-video video { height:clamp(105px,34vw,210px); }
  .chat-media-grid.chat-media-count-3 > :first-child img, .chat-media-grid.chat-media-count-3 > :first-child video { height:clamp(213px,68vw,423px); }
  .chat-gallery-stage { padding:12px 42px; }
  .chat-compose { gap:3px; padding:8px; }
  .chat-compose > .chat-tool, .chat-file { width:32px; }
  .chat-emoji-picker { left:8px; bottom:calc(100% + 8px); width:min(250px,calc(100vw - 44px)); }
}

@media (prefers-reduced-motion: reduce) {
  .chat-contact { transition:none; }
  .chat-contact.is-loading::after { animation:none; border-color:var(--accent-a); }
}
