/* ==========================================================================
   MANTAP! — stylesheet
   Breakpoint: < 768 (HP), 768–991 (tablet), ≥ 992 (desktop)
   ========================================================================== */

:root {
  --font: 'Manrope', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --bg: #f4f6fb;
  --surface: #ffffff;
  --surface-2: #f7f8fd;
  --text: #1b1f33;
  --muted: #646b84;
  --border: #e3e7f1;
  --primary: #2447d6;
  --primary-strong: #1c39ae;
  --primary-soft: rgba(36, 71, 214, 0.1);
  --on-primary: #ffffff;
  --success: #0b9a6e;
  --warning: #c98200;
  --danger: #d93a57;
  --danger-soft: rgba(217, 58, 87, 0.1);
  --bubble-me: var(--primary);
  --bubble-me-text: #fff;
  --radius: 14px;
  --radius-sm: 10px;
  --shadow: 0 1px 2px rgba(20, 28, 60, 0.05), 0 8px 24px rgba(20, 28, 60, 0.06);
  --shadow-lg: 0 24px 60px rgba(10, 14, 30, 0.35);
  --topbar-h: 62px;
  --nav-h: 64px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
}

[data-theme='dark'] {
  --bg: #0e1017;
  --surface: #171a24;
  --surface-2: #1d2130;
  --text: #e9edf7;
  --muted: #9aa2ba;
  --border: #272c3c;
  --primary: #6482ff;
  --primary-strong: #86a0ff;
  --primary-soft: rgba(100, 130, 255, 0.16);
  --on-primary: #0b1030;
  --success: #2fd29d;
  --warning: #f0b23e;
  --danger: #ff6b86;
  --danger-soft: rgba(255, 107, 134, 0.14);
  --bubble-me-text: #0b1030;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 8px 24px rgba(0, 0, 0, 0.25);
}

[data-theme='soft-blue'] {
  --bg: #eaf2fb;
  --surface: #ffffff;
  --surface-2: #f2f7fd;
  --text: #1c2b3d;
  --muted: #5f7186;
  --border: #d2dfed;
  --primary: #1b8de6;
  --primary-strong: #0f72c0;
  --primary-soft: rgba(27, 141, 230, 0.12);
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior-y: none;
}
body.no-scroll { overflow: hidden; }
h1, h2, h3, h4, p { margin: 0; }
a { color: inherit; text-decoration: none; }
img { max-width: 100%; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; border-radius: 6px; }
.icon { flex: none; display: block; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.muted { color: var(--muted); }
body:not(.is-admin) .admin-only { display: none !important; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}

/* ---------- tombol & form ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 40px; padding: 0 16px; border-radius: 10px; border: 1px solid transparent;
  font-weight: 700; font-size: 0.9rem; background: var(--surface-2); color: var(--text);
  transition: background 0.15s, transform 0.05s, opacity 0.15s; white-space: nowrap;
}
.btn:active { transform: scale(0.98); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-primary { background: var(--primary); color: var(--on-primary); }
.btn-primary:hover { background: var(--primary-strong); }
.btn-success { background: var(--success); color: #fff; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-outline { background: transparent; border-color: var(--border); }
.btn-outline:hover { background: var(--surface-2); }
.btn-ghost { background: transparent; color: var(--muted); }
.btn-ghost:hover { background: var(--surface-2); color: var(--text); }
.btn-soft { background: var(--primary-soft); color: var(--primary); }
.btn-sm { min-height: 34px; padding: 0 12px; font-size: 0.82rem; border-radius: 9px; }
.btn-block { width: 100%; }

.icon-btn {
  position: relative; display: inline-grid; place-items: center; width: 40px; height: 40px; flex: none;
  border-radius: 12px; border: 1px solid transparent; background: transparent; color: var(--muted);
  transition: background 0.15s, color 0.15s;
}
.icon-btn:hover { background: var(--surface-2); color: var(--text); }
.icon-btn.sm { width: 34px; height: 34px; border-radius: 9px; }
.icon-btn.danger:hover { background: var(--danger-soft); color: var(--danger); }
.icon-btn.on { color: var(--primary); background: var(--primary-soft); }

.field { display: grid; gap: 6px; margin-bottom: 14px; }
.field label { font-size: 0.82rem; font-weight: 700; }
.hint { color: var(--muted); font-size: 0.76rem; }
.input, .select, .textarea {
  width: 100%; min-height: 42px; padding: 9px 12px; border-radius: 10px;
  border: 1px solid var(--border); background: var(--surface); color: var(--text);
  transition: border-color 0.15s, box-shadow 0.15s;
}
.textarea { resize: vertical; min-height: 84px; line-height: 1.45; }
.input::placeholder, .textarea::placeholder { color: var(--muted); opacity: 0.8; }
.input:focus, .select:focus, .textarea:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
.select { padding-right: 32px; appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23888' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 10px center; }
.form-error { color: var(--danger); background: var(--danger-soft); padding: 9px 12px; border-radius: 10px; font-size: 0.85rem; font-weight: 600; }
.dialog-text { color: var(--muted); margin-bottom: 4px; white-space: pre-line; }
@media (max-width: 767.98px) { .input, .select, .textarea { font-size: 16px; } } /* cegah zoom otomatis iOS */

.badge {
  display: inline-grid; place-items: center; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 99px;
  background: var(--danger); color: #fff; font-size: 0.7rem; font-weight: 800; line-height: 1;
}
.badge.soft { background: var(--primary-soft); color: var(--primary); }
.badge.ok { background: rgba(11, 154, 110, 0.14); color: var(--success); }
.badge.warn { background: rgba(201, 130, 0, 0.16); color: var(--warning); }
.badge.neutral { background: var(--surface-2); color: var(--muted); border: 1px solid var(--border); }
.dot-badge { position: absolute; top: 3px; right: 3px; min-width: 18px; height: 18px; font-size: 0.65rem; border: 2px solid var(--surface); }

.panel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px; }
.panel-title { font-size: 0.72rem; font-weight: 800; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); margin-bottom: 10px; }

/* ---------- boot & login ---------- */
.boot { position: fixed; inset: 0; display: grid; place-items: center; background: var(--bg); z-index: 500; }
.spinner { width: 34px; height: 34px; border-radius: 50%; border: 3px solid var(--primary-soft); border-top-color: var(--primary); animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.login { min-height: 100dvh; display: grid; place-items: center; padding: 20px; }
.login-card { width: min(420px, 100%); background: var(--surface); border: 1px solid var(--border); border-radius: 20px; box-shadow: var(--shadow); padding: 32px 28px; text-align: center; }
.login-card img { width: 84px; height: 84px; border-radius: 22px; margin-bottom: 14px; }
.login-card h1 { font-size: 1.7rem; font-weight: 800; color: var(--primary); letter-spacing: -0.02em; }
.login-card .tag { color: var(--muted); font-weight: 700; font-size: 0.85rem; margin: 2px 0 24px; }
.login-card form { text-align: left; }

/* ---------- topbar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 60; height: calc(var(--topbar-h) + var(--safe-t)); padding-top: var(--safe-t);
  background: color-mix(in srgb, var(--surface) 90%, transparent); backdrop-filter: saturate(1.4) blur(12px);
  border-bottom: 1px solid var(--border);
}
.topbar-inner { max-width: 1280px; height: var(--topbar-h); margin: 0 auto; padding: 0 16px; display: flex; align-items: center; gap: 8px; }
.brand { display: flex; align-items: center; gap: 10px; min-width: 0; }
.brand img { width: 38px; height: 38px; border-radius: 11px; }
.brand b { display: block; font-size: 1.1rem; font-weight: 800; color: var(--primary); line-height: 1.1; letter-spacing: -0.01em; }
.brand small { display: block; color: var(--muted); font-weight: 700; font-size: 0.7rem; }
.topbar .spacer { flex: 1; }
.user-btn { display: flex; align-items: center; gap: 8px; height: 40px; padding: 0 6px 0 4px; border-radius: 99px; border: 1px solid var(--border); background: var(--surface); }
.user-btn:hover { background: var(--surface-2); }
.avatar { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; background: var(--primary); color: var(--on-primary); font-size: 0.72rem; font-weight: 800; flex: none; }
.user-btn .uname { font-weight: 700; font-size: 0.85rem; max-width: 120px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.menu-wrap { position: relative; }
.menu {
  position: absolute; right: 0; top: calc(100% + 8px); width: 250px; padding: 6px; z-index: 70;
  background: var(--surface); border: 1px solid var(--border); border-radius: 14px; box-shadow: var(--shadow-lg);
}
.menu-head { padding: 10px 12px; border-bottom: 1px solid var(--border); margin-bottom: 6px; }
.menu-head b { display: block; color: var(--primary); }
.menu-head small { color: var(--muted); font-weight: 600; }
.menu-item { display: flex; align-items: center; gap: 10px; width: 100%; padding: 10px 12px; border: 0; border-radius: 10px; background: transparent; text-align: left; font-weight: 600; font-size: 0.9rem; }
.menu-item:hover { background: var(--surface-2); }
.menu-item.danger { color: var(--danger); }
.menu-item .badge { margin-left: auto; }

/* ---------- shell ---------- */
.shell { max-width: 1280px; margin: 0 auto; padding: 18px 16px 40px; display: grid; grid-template-columns: 296px minmax(0, 1fr); gap: 20px; align-items: start; }
.sidebar { position: sticky; top: calc(var(--topbar-h) + var(--safe-t) + 18px); max-height: calc(100dvh - var(--topbar-h) - 36px); overflow-y: auto; display: grid; gap: 14px; scrollbar-width: thin; }
.drawer-head { display: none; }
.drawer-backdrop { display: none; }

.tab-list { display: grid; gap: 2px; }
.tab-item { display: flex; align-items: center; gap: 10px; width: 100%; padding: 9px 10px; border: 0; border-radius: 10px; background: transparent; font-weight: 600; font-size: 0.9rem; text-align: left; color: var(--text); }
.tab-item .icon { color: var(--muted); }
.tab-item:hover { background: var(--surface-2); }
.tab-item .count { margin-left: auto; font-size: 0.78rem; color: var(--muted); font-weight: 700; }
.tab-item.active { background: var(--primary-soft); color: var(--primary); }
.tab-item.active .icon, .tab-item.active .count { color: var(--primary); }

.chips { display: none; gap: 8px; overflow-x: auto; padding: 2px 2px 10px; margin: 0 -2px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip { flex: none; display: inline-flex; align-items: center; gap: 6px; height: 36px; padding: 0 14px; border-radius: 99px; border: 1px solid var(--border); background: var(--surface); font-weight: 700; font-size: 0.84rem; color: var(--muted); }
.chip .count { font-size: 0.74rem; opacity: 0.8; }
.chip.active { background: var(--primary); border-color: var(--primary); color: var(--on-primary); }

.filter-btn { display: none; border: 1px solid var(--border); background: var(--surface); }
.login-submit { margin-top: 14px; }
.field.tight { margin-bottom: 10px; }
.h-check { grid-area: check; } .h-no { grid-area: no; } .h-main { grid-area: main; } .h-url { grid-area: url; } .h-actions { grid-area: actions; }
.input-row { display: flex; gap: 8px; }
.input-row .select { flex: 1; min-width: 0; }

/* ---------- toolbar ---------- */
.content { min-width: 0; }
.toolbar { display: grid; grid-template-columns: minmax(0, 1fr) auto auto auto; gap: 10px; align-items: center; margin-bottom: 14px; }
.search { position: relative; }
.search .icon { position: absolute; left: 13px; top: 50%; translate: 0 -50%; color: var(--muted); pointer-events: none; }
.search .input { padding-left: 40px; min-height: 44px; border-radius: 12px; }
.toolbar .select { width: auto; min-height: 44px; border-radius: 12px; }

.list-meta { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin: 0 2px 10px; color: var(--muted); font-size: 0.84rem; font-weight: 600; }
.list-meta h2 { font-size: 1rem; font-weight: 800; color: var(--text); }

/* ---------- daftar link ---------- */
.list { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.list-head, .link-row {
  display: grid; align-items: center; column-gap: 12px;
  grid-template-columns: 40px 52px minmax(0, 1.3fr) minmax(0, 1fr) 140px;
  grid-template-areas: 'check no main url actions';
  padding: 0 14px;
}
.list-head { min-height: 44px; background: var(--surface-2); border-bottom: 1px solid var(--border); color: var(--muted); font-size: 0.74rem; font-weight: 800; letter-spacing: 0.05em; text-transform: uppercase; }
.sort-btn { display: inline-flex; align-items: center; gap: 4px; border: 0; background: transparent; padding: 6px 0; font: inherit; color: inherit; letter-spacing: inherit; text-transform: inherit; }
.sort-btn:hover, .sort-btn.on { color: var(--primary); }
.link-row { min-height: 60px; padding-top: 8px; padding-bottom: 8px; border-bottom: 1px solid var(--border); transition: background 0.12s; }
.link-row:last-child { border-bottom: 0; }
.link-row:hover { background: var(--surface-2); }
.link-row.is-selected { background: var(--primary-soft); }
.cell-check { grid-area: check; display: grid; place-items: center; }
.cell-no { grid-area: no; color: var(--muted); font-weight: 700; font-size: 0.85rem; }
.cell-main { grid-area: main; display: flex; align-items: center; gap: 8px; min-width: 0; }
.cell-url { grid-area: url; color: var(--muted); font-size: 0.82rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cell-url:hover { color: var(--primary); text-decoration: underline; }
.cell-actions { grid-area: actions; display: flex; align-items: center; gap: 2px; }
.link-title { font-weight: 700; overflow-wrap: anywhere; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.link-title:hover { color: var(--primary); }
.link-title.raw { color: var(--warning); font-style: italic; }
.chk { width: 20px; height: 20px; accent-color: var(--primary); cursor: pointer; }
.star-btn { border: 0; background: transparent; padding: 4px; border-radius: 8px; color: var(--muted); display: grid; place-items: center; flex: none; transition: transform 0.15s, color 0.15s; }
.star-btn:hover { transform: scale(1.18); color: var(--warning); }
.star-btn.on { color: var(--warning); }
.star-btn.on .icon { fill: currentColor; }
.discuss-btn { display: inline-flex; align-items: center; justify-content: center; width: auto; min-width: 40px; padding: 0 10px; gap: 5px; font-weight: 700; font-size: 0.8rem; }
.discuss-btn.has { color: var(--primary); background: var(--primary-soft); }

.empty { padding: 56px 20px; text-align: center; color: var(--muted); }
.empty .icon { margin: 0 auto 12px; opacity: 0.5; }
.empty b { display: block; color: var(--text); font-size: 1rem; margin-bottom: 4px; }
.skeleton { height: 58px; margin: 0; border-bottom: 1px solid var(--border); background: linear-gradient(90deg, transparent, var(--surface-2), transparent); background-size: 200% 100%; animation: shimmer 1.3s infinite; }
@keyframes shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }

.pager { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 14px; flex-wrap: wrap; }
.pager-info { color: var(--muted); font-size: 0.84rem; font-weight: 600; }
.pages { display: flex; gap: 6px; flex-wrap: wrap; justify-content: center; }
.page-btn { min-width: 38px; height: 38px; padding: 0 10px; border-radius: 10px; border: 1px solid var(--border); background: var(--surface); font-weight: 700; font-size: 0.85rem; display: grid; place-items: center; }
.page-btn:hover:not(:disabled) { background: var(--surface-2); }
.page-btn.active { background: var(--primary); border-color: var(--primary); color: var(--on-primary); }
.page-btn:disabled { opacity: 0.4; cursor: default; }
.page-gap { display: grid; place-items: center; width: 24px; color: var(--muted); }

.bulk-bar {
  position: sticky; bottom: 16px; z-index: 40; margin-top: 14px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  padding: 10px 12px; border-radius: 14px; background: var(--text); color: var(--bg); box-shadow: var(--shadow-lg);
}
.bulk-bar .bulk-count { font-weight: 800; margin-right: auto; padding-left: 4px; }
.bulk-bar .btn { min-height: 38px; }
.bulk-bar .btn-ghost { color: color-mix(in srgb, var(--bg) 75%, transparent); }
.bulk-bar .btn-ghost:hover { background: rgba(255, 255, 255, 0.12); color: var(--bg); }

/* ---------- bottom nav & fab ---------- */
.bottom-nav { display: none; }
.chat-fab {
  position: fixed; right: 24px; bottom: 24px; z-index: 60; width: 58px; height: 58px; border-radius: 50%; border: 0;
  background: var(--primary); color: var(--on-primary); display: grid; place-items: center; box-shadow: 0 10px 28px color-mix(in srgb, var(--primary) 45%, transparent);
  transition: transform 0.15s;
}
.chat-fab:hover { transform: scale(1.07); }
.chat-fab .badge { position: absolute; top: -4px; right: -4px; border: 2px solid var(--bg); }

/* ---------- chat ---------- */
.chat-panel {
  position: fixed; right: 24px; bottom: 24px; z-index: 80; width: 390px; height: min(580px, calc(100dvh - 110px));
  display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--border);
  border-radius: 18px; box-shadow: var(--shadow-lg); overflow: hidden; animation: pop 0.18s ease-out;
}
@keyframes pop { from { opacity: 0; transform: translateY(12px) scale(0.98); } }
.chat-head { display: flex; align-items: center; gap: 10px; padding: 12px 14px; background: var(--primary); color: var(--on-primary); }
.chat-head .t { flex: 1; min-width: 0; }
.chat-head b { display: block; font-size: 0.95rem; line-height: 1.2; }
.chat-head small { opacity: 0.85; font-size: 0.72rem; font-weight: 600; }
.chat-head .icon-btn { color: inherit; }
.chat-head .icon-btn:hover { background: rgba(255, 255, 255, 0.16); color: inherit; }

.messages { flex: 1; min-height: 0; overflow-y: auto; padding: 14px 12px; display: flex; flex-direction: column; gap: 8px; background: var(--bg); overscroll-behavior: contain; }
.day-sep { align-self: center; font-size: 0.7rem; font-weight: 700; color: var(--muted); background: var(--surface); border: 1px solid var(--border); padding: 2px 10px; border-radius: 99px; margin: 6px 0; }
.msg { display: flex; flex-direction: column; max-width: 84%; }
.msg.me { align-self: flex-end; align-items: flex-end; }
.msg .who { font-size: 0.72rem; font-weight: 800; color: var(--success); margin: 0 6px 2px; }
.bubble { padding: 8px 13px; border-radius: 16px; background: var(--surface); border: 1px solid var(--border); overflow-wrap: anywhere; font-size: 0.92rem; box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04); }
.msg:not(.me) .bubble { border-bottom-left-radius: 4px; }
.msg.me .bubble { background: var(--bubble-me); color: var(--bubble-me-text); border-color: transparent; border-bottom-right-radius: 4px; }
.bubble.deleted { background: var(--danger-soft); border: 1px dashed var(--danger); color: var(--danger); font-style: italic; font-size: 0.84rem; }
.msg .meta { display: flex; align-items: center; gap: 6px; margin: 2px 6px 0; font-size: 0.68rem; color: var(--muted); }
.mention { font-weight: 800; color: var(--primary); background: var(--primary-soft); border-radius: 5px; padding: 0 3px; }
.msg.me .mention { color: inherit; background: rgba(255, 255, 255, 0.22); }
.mini-btn { border: 0; background: transparent; color: inherit; font-size: 0.68rem; font-weight: 700; padding: 0; opacity: 0.8; text-decoration: underline; }

.composer { position: relative; display: flex; gap: 8px; padding: 10px; border-top: 1px solid var(--border); background: var(--surface); }
.composer .input { min-height: 44px; border-radius: 22px; padding: 8px 16px; }
.composer .send { width: 44px; height: 44px; border-radius: 50%; flex: none; border: 0; background: var(--primary); color: var(--on-primary); display: grid; place-items: center; }
.composer .send:disabled { opacity: 0.45; }
.mention-menu { position: absolute; left: 10px; right: 10px; bottom: calc(100% - 2px); max-height: 190px; overflow-y: auto; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; box-shadow: var(--shadow-lg); padding: 4px; z-index: 5; }
.mention-opt { display: flex; align-items: center; gap: 8px; width: 100%; border: 0; background: transparent; padding: 8px 10px; border-radius: 8px; text-align: left; font-size: 0.9rem; }
.mention-opt.active, .mention-opt:hover { background: var(--primary-soft); }
.mention-opt small { color: var(--muted); margin-left: auto; font-weight: 600; }

/* ---------- sheet / modal ---------- */
#overlayRoot { position: relative; z-index: 300; }
.sheet-backdrop { position: fixed; inset: 0; z-index: 300; display: flex; align-items: center; justify-content: center; padding: 16px; background: rgba(8, 11, 26, 0.55); animation: fade 0.15s ease-out; }
.sheet-backdrop.closing { opacity: 0; transition: opacity 0.15s; }
@keyframes fade { from { opacity: 0; } }
.sheet { width: min(500px, 100%); max-height: min(86dvh, 760px); display: flex; flex-direction: column; background: var(--surface); color: var(--text); border-radius: 20px; box-shadow: var(--shadow-lg); animation: pop 0.18s ease-out; overflow: hidden; }
.sheet-sm { width: min(420px, 100%); }
.sheet-lg { width: min(660px, 100%); }
.sheet-grip { display: none; width: 40px; height: 4px; border-radius: 4px; background: var(--border); margin: 8px auto 0; flex: none; touch-action: none; }
.sheet-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 14px 14px 10px 20px; flex: none; touch-action: none; }
.sheet-title { font-size: 1.05rem; font-weight: 800; }
.sheet-body { padding: 4px 20px 20px; overflow-y: auto; overscroll-behavior: contain; flex: 1; min-height: 0; }
.sheet-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 12px 20px calc(14px + var(--safe-b)); border-top: 1px solid var(--border); flex: none; }
.sheet-chat .sheet-body { padding: 0; display: flex; flex-direction: column; }
.sheet-chat .messages { height: min(52dvh, 440px); flex: none; }
.sheet-chat .composer { border-top: 1px solid var(--border); padding-bottom: calc(10px + var(--safe-b)); }
.sheet-sub { color: var(--muted); font-size: 0.82rem; font-weight: 600; padding: 0 20px 10px; overflow-wrap: anywhere; }

.row-card { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 12px; border: 1px solid var(--border); border-radius: 12px; margin-bottom: 8px; }
.row-card .grow { min-width: 0; flex: 1; }
.row-card .grow b { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; overflow-wrap: anywhere; }
.row-card .sub { color: var(--muted); font-size: 0.8rem; overflow-wrap: anywhere; }
.row-card .acts { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.row-card.unread { border-color: var(--primary); background: var(--primary-soft); cursor: pointer; }
.row-card.clickable { cursor: pointer; }
.row-card.done { opacity: 0.65; }
.section-title { font-size: 0.74rem; font-weight: 800; letter-spacing: 0.05em; text-transform: uppercase; color: var(--muted); margin: 18px 0 8px; }
.section-title:first-child { margin-top: 4px; }
.seg { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
.seg button { min-height: 44px; border-radius: 12px; border: 1.5px solid var(--border); background: var(--surface); font-weight: 700; display: flex; align-items: center; justify-content: center; gap: 8px; }
.seg button.on { border-color: var(--primary); background: var(--primary-soft); color: var(--primary); }
.swatch { width: 14px; height: 14px; border-radius: 50%; border: 1px solid rgba(128, 128, 128, 0.4); }
.switch-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 8px 0; font-weight: 600; font-size: 0.9rem; }
.switch { position: relative; width: 46px; height: 26px; flex: none; }
.switch input { position: absolute; inset: 0; opacity: 0; margin: 0; cursor: pointer; z-index: 1; }
.switch span { position: absolute; inset: 0; border-radius: 99px; background: var(--border); transition: background 0.2s; }
.switch span::after { content: ''; position: absolute; left: 3px; top: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; transition: transform 0.2s; box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3); }
.switch input:checked + span { background: var(--primary); }
.switch input:checked + span::after { transform: translateX(20px); }
.switch input:focus-visible + span { outline: 2px solid var(--primary); outline-offset: 2px; }
.stack { display: grid; gap: 8px; }

/* ---------- toast & loading ---------- */
#toastRoot { position: fixed; z-index: 700; top: calc(12px + var(--safe-t)); right: 16px; display: grid; gap: 8px; width: min(380px, calc(100vw - 32px)); pointer-events: none; }
.toast { pointer-events: auto; display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: 12px; background: var(--text); color: var(--bg); font-weight: 600; font-size: 0.88rem; box-shadow: var(--shadow-lg); opacity: 0; transform: translateY(-8px); transition: opacity 0.2s, transform 0.2s; border-left: 4px solid var(--primary); }
.toast.in { opacity: 1; transform: none; }
.toast-success { border-left-color: var(--success); }
.toast-error { border-left-color: var(--danger); }
.toast-msg { flex: 1; overflow-wrap: anywhere; }
.toast-action { border: 0; background: rgba(255, 255, 255, 0.16); color: inherit; border-radius: 8px; padding: 6px 10px; font-weight: 800; font-size: 0.8rem; }
#loadingOverlay { position: fixed; inset: 0; z-index: 800; display: flex; flex-direction: column; gap: 12px; align-items: center; justify-content: center; background: rgba(8, 11, 26, 0.55); color: #fff; font-weight: 700; }
#loadingOverlay .spinner { border-color: rgba(255, 255, 255, 0.25); border-top-color: #fff; }

/* ==========================================================================
   TABLET & HP
   ========================================================================== */
@media (max-width: 991.98px) {
  .shell { grid-template-columns: 1fr; padding: 12px 12px calc(var(--nav-h) + var(--safe-b) + 28px); gap: 0; }
  .chat-fab { display: none; }
  .filter-btn { display: inline-flex; }
  .chips { display: flex; }
  .tab-list-wrap { display: none; }

  .sidebar {
    position: fixed; z-index: 220; left: 0; right: 0; bottom: 0; top: auto; max-height: 88dvh; overflow-y: auto;
    padding: 6px 16px calc(20px + var(--safe-b)); background: var(--surface); border-radius: 22px 22px 0 0; box-shadow: var(--shadow-lg);
    transform: translateY(105%); visibility: hidden; transition: transform 0.25s ease, visibility 0.25s; align-content: start;
  }
  .sidebar.open { transform: none; visibility: visible; }
  .sidebar .panel { box-shadow: none; padding: 14px; }
  .drawer-head { display: flex; align-items: center; justify-content: space-between; padding: 8px 2px 0; position: sticky; top: 0; background: var(--surface); z-index: 2; }
  .drawer-head b { font-size: 1.05rem; font-weight: 800; }
  .drawer-backdrop { display: block; position: fixed; inset: 0; z-index: 210; background: rgba(8, 11, 26, 0.5); opacity: 0; pointer-events: none; transition: opacity 0.2s; }
  .drawer-backdrop.open { opacity: 1; pointer-events: auto; }

  .bottom-nav {
    position: fixed; z-index: 90; left: 0; right: 0; bottom: 0; height: calc(var(--nav-h) + var(--safe-b)); padding-bottom: var(--safe-b);
    display: grid; grid-template-columns: repeat(3, 1fr); background: color-mix(in srgb, var(--surface) 94%, transparent); backdrop-filter: blur(12px);
    border-top: 1px solid var(--border);
  }
  .nav-item { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; border: 0; background: transparent; color: var(--muted); font-size: 0.7rem; font-weight: 700; }
  .nav-item.active { color: var(--primary); }
  .nav-item .badge { position: absolute; top: 6px; left: calc(50% + 6px); border: 2px solid var(--surface); }

  .chat-panel { z-index: 120; inset: var(--vvt, 0px) 0 auto 0; width: auto; height: var(--vvh, 100dvh); border-radius: 0; border: 0; animation: slide-up 0.2s ease-out; }
  .chat-head { padding-top: calc(12px + var(--safe-t)); }
  .composer { padding-bottom: calc(10px + var(--safe-b)); }
  @keyframes slide-up { from { transform: translateY(24px); opacity: 0; } }

  .bulk-bar { position: fixed; z-index: 85; left: 12px; right: 12px; bottom: calc(var(--nav-h) + var(--safe-b) + 10px); margin: 0; }
  #toastRoot { left: 50%; right: auto; translate: -50% 0; }
}

@media (max-width: 767.98px) {
  body { font-size: 14.5px; }
  .topbar-inner { padding: 0 12px; }
  .brand small, .user-btn .uname { display: none; }
  .user-btn { padding: 0; border: 0; width: 40px; justify-content: center; }
  .user-btn .icon-chevD { display: none; }
  .avatar { width: 36px; height: 36px; font-size: 0.8rem; }

  .toolbar { grid-template-columns: minmax(0, 1fr) auto; position: sticky; top: calc(var(--topbar-h) + var(--safe-t)); z-index: 30; margin: 0 -12px 10px; padding: 8px 12px; background: var(--bg); }
  .toolbar .select, .toolbar .btn-reset { display: none; }

  .list { background: transparent; border: 0; box-shadow: none; overflow: visible; }
  .list-head { display: none; }
  .link-row {
    grid-template-columns: 24px minmax(0, 1fr) auto; grid-template-areas: 'check main actions' '. url url';
    row-gap: 4px; column-gap: 10px; padding: 12px; margin-bottom: 10px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow);
  }
  .link-row:last-child { border-bottom: 1px solid var(--border); }
  .link-row:hover { background: var(--surface); }
  .link-row.is-selected { background: var(--primary-soft); border-color: var(--primary); }
  .cell-no { display: none; }
  .cell-url { font-size: 0.78rem; }
  .cell-actions { align-self: start; }
  .icon-btn { width: 42px; height: 42px; }
  .list-meta { margin-top: 2px; }
  .pager { flex-direction: column; }
  .skeleton { height: 86px; border: 1px solid var(--border); border-radius: var(--radius); margin-bottom: 10px; }

  /* Menu pengguna jadi bottom sheet di HP */
  .menu { position: fixed; left: 12px; right: 12px; top: auto; bottom: calc(12px + var(--safe-b)); width: auto; padding: 8px; z-index: 250; }

  /* Modal jadi bottom sheet */
  .sheet-backdrop { align-items: flex-end; padding: 0; }
  .sheet, .sheet-sm, .sheet-lg { width: 100%; max-height: 92dvh; border-radius: 22px 22px 0 0; animation: sheet-up 0.22s ease-out; transition: transform 0.2s; }
  .sheet-grip { display: block; }
  .sheet-foot { padding-bottom: calc(14px + var(--safe-b)); }
  .sheet-foot .btn { flex: 1; }
  @keyframes sheet-up { from { transform: translateY(40px); opacity: 0; } }
  .sheet-chat .messages { height: min(56dvh, 460px); }
}

@media (min-width: 768px) and (max-width: 991.98px) {
  .toolbar { grid-template-columns: minmax(0, 1fr) auto auto auto auto; }
}

.menu-backdrop { position: fixed; inset: 0; z-index: 65; }
@media (min-width: 992px) { .menu-backdrop { display: none; } }
@media (max-width: 767.98px) { .menu-backdrop { background: rgba(8, 11, 26, 0.45); z-index: 240; } }

/* Pengaturan urutan/baris ada di toolbar (≥768px) atau di drawer filter (HP) */
.drawer-only-tools { display: none; }
@media (max-width: 767.98px) { .drawer-only-tools { display: block; } }

.prefix-actions { margin-top: 8px; }
.prefix-actions .btn { flex: 1; }
.danger-text { color: var(--danger); }
