:root {
  color-scheme: dark;
  --bg: #070b14;
  --panel: rgba(14, 22, 38, .92);
  --panel-soft: rgba(23, 34, 55, .78);
  --panel-hover: rgba(38, 53, 80, .86);
  --text: #f7f9fc;
  --muted: #9aa8bd;
  --border: rgba(255, 255, 255, .09);
  --accent: #70a5ff;
  --accent-strong: #4e8df5;
  --danger: #ff717e;
  --shadow: 0 18px 45px rgba(0, 0, 0, .32);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body { background: var(--bg); color: var(--text); overflow: hidden; }
button, input, textarea { font: inherit; }
button { color: inherit; }
button:focus-visible, input:focus-visible, textarea:focus-visible, [tabindex]:focus-visible {
  outline: 2px solid var(--accent); outline-offset: 2px;
}
.hidden { display: none !important; }
.mobile-only { display: none !important; }

.app-shell { height: 100vh; height: 100dvh; max-height: 100dvh; display: flex; flex-direction: column; overflow: hidden; }
.topbar {
  height: 64px; flex: 0 0 64px; display: flex; align-items: center; justify-content: space-between; gap: 18px;
  padding: 0 18px; background: rgba(7, 11, 20, .88); border-bottom: 1px solid var(--border);
  backdrop-filter: blur(18px); z-index: 20; overflow: hidden;
}
.topbar-left { display: flex; align-items: center; gap: 10px; min-width: 0; flex: 0 0 auto; flex-wrap: nowrap; white-space: nowrap; }
.sidebar-toggle { flex: 0 0 auto; }
.brand { display: flex; align-items: center; gap: 10px; min-width: 0; flex: 0 0 auto; color: inherit; text-decoration: none; font-weight: 800; letter-spacing: -.02em; white-space: nowrap; }
.brand-mark { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; background: linear-gradient(145deg, #78adff, #6759ff); box-shadow: 0 8px 25px rgba(90, 112, 255, .28); }
.topbar-actions { min-width: 0; flex: 1 1 auto; display: flex; align-items: center; justify-content: flex-end; gap: 10px; white-space: nowrap; }
.search-wrap { width: min(34vw, 330px); display: flex; align-items: center; gap: 8px; padding: 0 12px; height: 40px; border-radius: 10px; background: var(--panel-soft); border: 1px solid var(--border); color: var(--muted); }
.search-wrap input { width: 100%; border: 0; outline: 0; background: transparent; color: var(--text); }
.search-wrap input::placeholder { color: #7f8da2; }

.primary-button, .secondary-button, .ghost-button, .danger-button, .icon-button {
  border: 0; cursor: pointer; transition: transform .14s ease, background .14s ease, opacity .14s ease;
}
.primary-button { background: linear-gradient(145deg, #6ca5ff, #625cff); color: white; padding: 10px 15px; border-radius: 10px; font-weight: 750; box-shadow: 0 8px 20px rgba(83, 100, 255, .22); }
.secondary-button { background: var(--panel-hover); padding: 9px 13px; border-radius: 9px; font-weight: 650; }
.ghost-button { background: rgba(255,255,255,.06); padding: 9px 13px; border-radius: 9px; }
.danger-button { background: rgba(255, 85, 104, .14); color: #ff9ba4; padding: 9px 13px; border-radius: 9px; font-weight: 700; }
.icon-button { width: 38px; height: 38px; border-radius: 10px; background: transparent; display: grid; place-items: center; font-size: 20px; }
button:hover { transform: translateY(-1px); }
.icon-button:hover, .ghost-button:hover { background: rgba(255,255,255,.10); }

.workspace { height: calc(100dvh - 64px); min-height: 0; flex: 1; display: flex; overflow: hidden; }
.sidebar { width: 260px; flex: 0 0 260px; padding: 18px 12px; border-right: 1px solid var(--border); background: rgba(9, 14, 25, .94); display: flex; flex-direction: column; z-index: 15; overflow: hidden; transition: width .2s ease, flex-basis .2s ease, padding .2s ease, border-color .2s ease, opacity .15s ease; }
.sidebar > * { min-width: 236px; }
.sidebar-heading { display: flex; align-items: center; justify-content: space-between; padding: 0 8px 10px; }
.sidebar-heading h2 { margin: 0; font-size: 13px; text-transform: uppercase; letter-spacing: .14em; color: var(--muted); }
.board-nav { display: flex; flex-direction: column; gap: 4px; overflow-y: auto; }
.board-nav-item { width: 100%; display: flex; align-items: center; gap: 10px; border: 0; background: transparent; color: var(--muted); padding: 10px; border-radius: 10px; cursor: pointer; text-align: left; }
.board-nav-item:hover { background: rgba(255,255,255,.055); color: var(--text); }
.board-nav-item.active { background: rgba(101, 116, 255, .15); color: white; }
.board-nav-dot { width: 13px; height: 13px; border-radius: 4px; flex: 0 0 auto; }
.board-nav-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sidebar-foot { margin-top: auto; padding: 14px 9px 4px; display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 12px; border-top: 1px solid var(--border); }
.status-dot { width: 8px; height: 8px; border-radius: 50%; background: #55d899; box-shadow: 0 0 10px rgba(85,216,153,.5); }

.sidebar.collapsed { width: 0; flex-basis: 0; padding-left: 0; padding-right: 0; border-right-color: transparent; opacity: 0; pointer-events: none; }


.main-content { min-width: 0; min-height: 0; height: 100%; flex: 1; overflow: hidden; position: relative; }
.board-view { height: 100%; min-height: 0; display: grid; grid-template-rows: auto minmax(0,1fr); overflow: hidden; background: radial-gradient(circle at 80% 0%, rgba(112, 165, 255, .12), transparent 35%), linear-gradient(145deg, #0d1829, #101421 62%, #0b101b); }
.board-view.color-violet { background: radial-gradient(circle at 80% 0%, rgba(157, 111, 255, .18), transparent 35%), linear-gradient(145deg, #1b1330, #101421 62%, #0b101b); }
.board-view.color-forest { background: radial-gradient(circle at 80% 0%, rgba(56, 205, 135, .16), transparent 35%), linear-gradient(145deg, #10261f, #101821 62%, #0b101b); }
.board-view.color-sunset { background: radial-gradient(circle at 80% 0%, rgba(255, 137, 98, .16), transparent 35%), linear-gradient(145deg, #2a171c, #161521 62%, #0b101b); }
.board-view.color-slate { background: radial-gradient(circle at 80% 0%, rgba(157, 173, 199, .14), transparent 35%), linear-gradient(145deg, #17202e, #101421 62%, #0b101b); }
.board-header { min-height: 0; padding: 24px 26px 14px; display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.board-header h1 { margin: 3px 0 0; font-size: clamp(24px, 3vw, 38px); letter-spacing: -.04em; }
.eyebrow { color: var(--muted); font-weight: 800; letter-spacing: .14em; font-size: 10px; }
.board-header-actions { display: flex; align-items: center; gap: 12px; }
.save-status { color: var(--muted); font-size: 12px; }

.lists { flex: 1; min-height: 0; overflow-x: auto; overflow-y: hidden; display: flex; align-items: flex-start; gap: 14px; padding: 4px 26px 28px; }
.list-column { width: 300px; max-height: 100%; flex: 0 0 300px; display: flex; flex-direction: column; background: rgba(12, 18, 31, .88); border: 1px solid var(--border); border-radius: 14px; box-shadow: var(--shadow); backdrop-filter: blur(12px); }
.list-column.list-dragging { opacity: .45; }
.list-column.list-drop-before { box-shadow: -4px 0 0 var(--accent), var(--shadow); }
.list-header { display: flex; align-items: center; gap: 8px; padding: 13px 12px 9px; cursor: grab; }
.list-title { flex: 1; margin: 0; border: 0; background: transparent; color: var(--text); font-weight: 780; min-width: 0; padding: 5px; border-radius: 6px; }
.list-title:hover, .list-title:focus { background: rgba(255,255,255,.06); outline: none; }
.card-count { font-size: 11px; color: var(--muted); background: rgba(255,255,255,.06); padding: 3px 7px; border-radius: 20px; }
.list-menu { position: relative; }
.list-menu summary { list-style: none; cursor: pointer; width: 30px; height: 30px; display: grid; place-items: center; border-radius: 8px; }
.list-menu summary::-webkit-details-marker { display: none; }
.list-menu[open] summary { background: rgba(255,255,255,.08); }
.menu-popover { position: absolute; right: 0; top: 34px; z-index: 10; width: 160px; padding: 6px; border: 1px solid var(--border); background: #172033; border-radius: 10px; box-shadow: var(--shadow); }
.menu-popover button { width: 100%; text-align: left; padding: 9px; border: 0; background: transparent; color: #ff9ba4; border-radius: 7px; cursor: pointer; }
.menu-popover button:hover { background: rgba(255,255,255,.07); }
.cards { min-height: 16px; overflow-y: auto; padding: 3px 9px; display: flex; flex-direction: column; gap: 8px; }
.cards.drag-target { background: rgba(112,165,255,.06); border-radius: 10px; }
.card { background: linear-gradient(145deg, rgba(39, 52, 76, .96), rgba(28, 38, 58, .96)); border: 1px solid rgba(255,255,255,.08); border-radius: 11px; padding: 11px; cursor: grab; box-shadow: 0 5px 14px rgba(0,0,0,.17); }
.card:hover { border-color: rgba(131,173,255,.34); transform: translateY(-1px); }
.card.dragging { opacity: .35; }
.card.drop-before { box-shadow: 0 -3px 0 var(--accent), 0 5px 14px rgba(0,0,0,.17); }
.card-labels { display: flex; flex-wrap: wrap; gap: 5px; margin-bottom: 8px; }
.card-label { font-size: 10px; font-weight: 750; letter-spacing: .03em; background: rgba(111, 160, 255, .18); color: #b9d2ff; border-radius: 99px; padding: 3px 7px; }
.card-title { font-weight: 650; line-height: 1.35; overflow-wrap: anywhere; }
.card-meta { display: flex; gap: 10px; align-items: center; margin-top: 10px; color: var(--muted); font-size: 11px; }
.card-due.overdue { color: #ff929c; }
.card-due.soon { color: #ffd477; }
.card-check-progress { margin-left: auto; }
.add-card { margin: 9px; padding: 9px; border: 0; border-radius: 9px; background: transparent; color: var(--muted); cursor: pointer; text-align: left; }
.add-card:hover { background: rgba(255,255,255,.055); color: var(--text); }
.add-card-form { display: grid; gap: 8px; margin: 9px; }
.add-card-form textarea { resize: vertical; min-height: 68px; max-height: 160px; }
.add-card-actions { display: flex; gap: 7px; }
.add-list-column { width: 290px; flex: 0 0 290px; }
.add-list-button { width: 100%; padding: 13px; border: 1px dashed rgba(255,255,255,.18); border-radius: 12px; background: rgba(10, 18, 32, .48); color: var(--muted); cursor: pointer; text-align: left; }
.add-list-button:hover { background: rgba(20,31,50,.74); color: white; }
.add-list-form { padding: 10px; border-radius: 12px; background: rgba(12,18,31,.92); border: 1px solid var(--border); }

input, textarea { width: 100%; color: var(--text); background: #111a2b; border: 1px solid rgba(255,255,255,.10); border-radius: 9px; padding: 10px 11px; }
textarea { resize: vertical; }
label { display: grid; gap: 7px; color: #cad2df; font-size: 13px; font-weight: 650; }
label small { color: var(--muted); font-weight: 400; }
fieldset { border: 0; padding: 0; margin: 3px 0; }
legend { margin-bottom: 9px; color: #cad2df; font-size: 13px; font-weight: 650; }

.empty-state { height: 100%; display: grid; place-content: center; justify-items: center; text-align: center; padding: 30px; background: radial-gradient(circle at 50% 35%, rgba(98,92,255,.14), transparent 35%); }
.empty-state h1 { margin: 18px 0 7px; font-size: 32px; }
.empty-state p { color: var(--muted); max-width: 460px; margin: 0 0 20px; }
.empty-icon { width: 70px; height: 70px; border-radius: 20px; display: grid; place-items: center; background: var(--panel-soft); border: 1px solid var(--border); font-size: 34px; }

.dialog { width: min(560px, calc(100vw - 28px)); padding: 0; border: 1px solid rgba(255,255,255,.12); border-radius: 16px; background: #111a2b; color: var(--text); box-shadow: 0 32px 90px rgba(0,0,0,.62); }
.dialog::backdrop { background: rgba(2,6,14,.72); backdrop-filter: blur(4px); }
.dialog form { padding: 20px; display: grid; gap: 18px; }
.dialog-head { display: flex; justify-content: space-between; gap: 15px; align-items: flex-start; }
.dialog h2 { margin: 4px 0 0; font-size: 24px; letter-spacing: -.03em; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 9px; }
.color-picker { display: flex; gap: 10px; }
.color-picker label { display: block; }
.color-picker input { position: absolute; opacity: 0; pointer-events: none; }
.swatch { display: block; width: 42px; height: 34px; border-radius: 9px; cursor: pointer; border: 2px solid transparent; }
.color-picker input:checked + .swatch { border-color: white; box-shadow: 0 0 0 2px #6c75ff; }
.swatch-ocean { background: linear-gradient(145deg,#28639d,#293b72); }
.swatch-violet { background: linear-gradient(145deg,#7142a4,#362960); }
.swatch-forest { background: linear-gradient(145deg,#277154,#1d433d); }
.swatch-sunset { background: linear-gradient(145deg,#9c4e51,#563044); }
.swatch-slate { background: linear-gradient(145deg,#64758c,#364254); }
.card-dialog { width: min(860px, calc(100vw - 28px)); }
.card-title-area { flex: 1; }
.card-title-input { margin-top: 5px; font-size: 23px; font-weight: 780; letter-spacing: -.02em; background: transparent; border-color: transparent; padding-left: 0; }
.card-title-input:focus { background: #0d1525; border-color: rgba(255,255,255,.12); padding-left: 10px; }
.card-form-grid { display: grid; grid-template-columns: minmax(0, 1fr) 220px; gap: 22px; }
.card-main-fields, .card-side-fields { display: grid; align-content: start; gap: 17px; }
.checklist-section h3 { margin: 0; font-size: 14px; }
.section-title-row { display: flex; justify-content: space-between; align-items: center; }
.section-title-row span { color: var(--muted); font-size: 11px; }
.progress { height: 6px; border-radius: 10px; margin: 8px 0 11px; background: rgba(255,255,255,.08); overflow: hidden; }
.progress div { height: 100%; width: 0; background: linear-gradient(90deg,#63a6ff,#6b5fff); transition: width .2s; }
.checklist-items { display: grid; gap: 5px; }
.checklist-item { display: flex; align-items: center; gap: 8px; padding: 7px; border-radius: 8px; }
.checklist-item:hover { background: rgba(255,255,255,.04); }
.checklist-item input[type="checkbox"] { width: 17px; height: 17px; accent-color: #6672ff; }
.checklist-item .check-text { flex: 1; }
.checklist-item.done .check-text { color: var(--muted); text-decoration: line-through; }
.checklist-remove { border: 0; background: transparent; color: var(--muted); cursor: pointer; }
.inline-form { display: flex; gap: 8px; margin-top: 8px; }
.danger-zone { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 13px; border: 1px solid rgba(255,91,107,.19); background: rgba(255,91,107,.06); border-radius: 10px; }
.danger-zone p { margin: 3px 0 0; color: var(--muted); font-size: 12px; }

.toast-region { position: fixed; right: 18px; bottom: 18px; z-index: 50; display: grid; gap: 8px; }
.toast { background: #1c2940; border: 1px solid var(--border); box-shadow: var(--shadow); padding: 11px 14px; border-radius: 10px; font-size: 13px; animation: toast-in .18s ease; }
.toast.error { border-color: rgba(255,105,118,.38); color: #ffb0b7; }
@keyframes toast-in { from { transform: translateY(8px); opacity: 0; } }

@media (max-width: 640px) {
  .mobile-only { display: grid; }
  .topbar { padding: 0 10px; gap: 8px; }
  .topbar-actions { flex: 1; }
  .search-wrap { flex: 1; width: auto; }
  #newBoardButton { padding: 10px; }
  .sidebar { position: fixed; top: 64px; left: 0; bottom: 0; transform: translateX(-105%); transition: transform .18s ease; box-shadow: var(--shadow); }
  .sidebar.open { transform: translateX(0); }
  .board-header { padding: 17px 16px 12px; align-items: flex-start; }
  .board-header-actions { align-items: flex-end; flex-direction: column-reverse; }
  .lists { padding-left: 16px; padding-right: 16px; }
  .list-column { width: 280px; flex-basis: 280px; }
  .card-form-grid { grid-template-columns: 1fr; }
  .dialog form { padding: 16px; }
}

/* Authentication */
.login-view { min-height: 100%; display: grid; place-items: center; padding: 24px; background: radial-gradient(circle at 50% 20%, rgba(91, 104, 255, .22), transparent 32%), linear-gradient(145deg, #07101e, #090c16); }
.login-panel { width: min(430px, 100%); display: grid; gap: 28px; padding: 34px; border: 1px solid var(--border); border-radius: 20px; background: rgba(14, 22, 38, .94); box-shadow: 0 30px 90px rgba(0,0,0,.48); }
.login-brand { display: flex; align-items: center; gap: 11px; font-size: 20px; font-weight: 850; }
.login-panel h1 { margin: 6px 0 8px; font-size: 34px; letter-spacing: -.04em; }
.login-panel p { margin: 0; color: var(--muted); line-height: 1.55; }
.login-form { display: grid; gap: 17px; }
.login-button { width: 100%; padding: 12px 16px; }

.remember-option { display: grid; grid-template-columns: 18px minmax(0, 1fr); align-items: start; gap: 11px; cursor: pointer; }
.remember-option input { width: 18px; height: 18px; margin: 2px 0 0; accent-color: var(--accent); }
.remember-option span { display: grid; gap: 3px; min-width: 0; }
.remember-option strong { font-size: 13px; }
.remember-option small { color: var(--muted); font-size: 11px; line-height: 1.4; }
.form-error { padding: 10px 12px; border: 1px solid rgba(255, 105, 118, .3); border-radius: 9px; color: #ffadb5; background: rgba(255, 85, 104, .08); font-size: 13px; }
.account-chip { display: flex; align-items: center; gap: 9px; padding-left: 5px; color: #d9e1ec; font-size: 12px; }
.account-chip > span { max-width: 130px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.account-chip button { border: 0; background: transparent; color: var(--muted); cursor: pointer; padding: 6px; }
.account-chip button:hover { color: white; transform: none; }

/* Picture cards and comments */
.card.picture-card { padding: 0; overflow: hidden; }
.card.picture-card .card-body { padding: 11px; }
.card-cover { width: 100%; max-height: 220px; display: block; object-fit: cover; background: #0a1020; }
.card-comments-preview { display: grid; gap: 6px; margin-top: 10px; padding-top: 9px; border-top: 1px solid rgba(255,255,255,.07); }
.card-comment-preview { display: grid; gap: 2px; padding: 6px 7px; border-radius: 7px; background: rgba(7, 13, 25, .42); font-size: 11px; line-height: 1.35; }
.card-comment-preview strong { color: #cbd8ea; font-size: 10px; }
.card-comment-preview span { color: #aebacd; white-space: pre-wrap; overflow-wrap: anywhere; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.more-comments { color: var(--muted); font-size: 10px; padding-left: 5px; }
.card-quick-comment { margin-top: 8px; }
.quick-comment-toggle { border: 0; padding: 4px 0; background: transparent; color: #93a7c4; cursor: pointer; font-size: 11px; }
.quick-comment-toggle:hover { color: white; transform: none; }
.quick-comment-form { display: grid; grid-template-columns: minmax(0,1fr) auto auto; gap: 5px; align-items: center; }
.quick-comment-form input { padding: 7px 8px; font-size: 11px; }
.quick-comment-form .secondary-button { padding: 7px 9px; font-size: 11px; }
.quick-comment-cancel { border: 0; background: transparent; color: var(--muted); cursor: pointer; padding: 6px; }
.list-add-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 5px; margin: 8px 9px 9px; }
.list-add-actions .add-card, .add-picture { margin: 0; padding: 8px; border: 0; border-radius: 8px; background: transparent; color: var(--muted); cursor: pointer; text-align: center; font-size: 12px; }
.list-add-actions .add-card:hover, .add-picture:hover { background: rgba(255,255,255,.055); color: var(--text); }
.image-editor-section, .comments-section { display: grid; gap: 10px; }
.image-editor-section h3, .comments-section h3 { margin: 0; font-size: 14px; }
.image-preview-wrap { overflow: hidden; border: 1px solid var(--border); border-radius: 11px; background: #090f1c; }
.image-preview-wrap img { display: block; width: 100%; max-height: 390px; object-fit: contain; }
.compact-label { font-size: 12px; color: var(--muted); font-weight: 500; }
.text-button { border: 0; padding: 4px; background: transparent; color: #ff939e; cursor: pointer; font-size: 12px; }
.comment-list { display: grid; gap: 9px; max-height: 340px; overflow-y: auto; padding-right: 3px; }
.comment { padding: 10px 11px; border: 1px solid rgba(255,255,255,.07); border-radius: 10px; background: rgba(8,14,26,.55); }
.comment-head { display: flex; align-items: center; gap: 7px; margin-bottom: 6px; }
.comment-head strong { font-size: 12px; }
.comment-head time { color: var(--muted); font-size: 10px; }
.comment-delete { margin-left: auto; border: 0; background: transparent; color: var(--muted); cursor: pointer; }
.comment-delete:hover { color: #ff9ba4; transform: none; }
.comment-text { white-space: pre-wrap; overflow-wrap: anywhere; color: #d9e2ef; font-size: 13px; line-height: 1.45; }
.comment-empty { padding: 12px; border: 1px dashed var(--border); border-radius: 9px; color: var(--muted); text-align: center; font-size: 12px; }
.comment-composer { display: grid; gap: 8px; }
.comment-composer button { justify-self: start; }
.card-dialog { max-height: calc(100vh - 28px); overflow-y: auto; }

/* User administration */
.admin-dialog { width: min(940px, calc(100vw - 28px)); max-height: calc(100vh - 28px); overflow-y: auto; }
.admin-dialog-body { padding: 22px; display: grid; gap: 20px; }
.admin-dialog h3 { margin: 0; font-size: 15px; }
.new-user-form { display: grid; gap: 16px; padding: 16px; border: 1px solid var(--border); border-radius: 12px; background: rgba(8,14,26,.38); }
.admin-grid { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 12px; }
.new-user-form .admin-grid { grid-template-columns: repeat(4, minmax(0,1fr)); }
.account-role-select { width: 100%; min-height: 40px; padding: 9px 10px; border: 1px solid var(--border); border-radius: 8px; background: #101a2b; color: var(--text); }
.account-role-select:disabled { cursor: not-allowed; opacity: .65; }
.account-role-help { color: var(--muted); font-size: 10px; line-height: 1.4; }
.admin-divider { height: 1px; background: var(--border); }
.board-access-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 7px; }
.access-check { display: flex; grid-template-columns: none; align-items: center; gap: 8px; padding: 8px 9px; border: 1px solid rgba(255,255,255,.07); border-radius: 8px; background: rgba(255,255,255,.025); cursor: pointer; font-weight: 500; }
.access-check:hover { background: rgba(255,255,255,.05); }
.access-check input { width: 16px; height: 16px; accent-color: #6874ff; }
.board-permission-row { display: grid; grid-template-columns: minmax(0,1fr) 140px; align-items: center; gap: 10px; padding: 9px; border: 1px solid rgba(255,255,255,.07); border-radius: 9px; background: rgba(255,255,255,.025); }
.board-permission-name { min-width: 0; display: flex; align-items: center; gap: 8px; font-weight: 600; }
.board-permission-name > span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.board-permission-row select { width: 100%; padding: 8px 9px; border: 1px solid var(--border); border-radius: 8px; background: #101a2b; color: var(--text); }
label.permission-option { display: grid !important; grid-template-columns: 18px minmax(0, 1fr); align-items: start; gap: 11px; padding: 12px; border: 1px solid rgba(255,255,255,.07); border-radius: 9px; background: rgba(255,255,255,.025); cursor: pointer; }
label.permission-option > input { width: 17px; height: 17px; margin: 2px 0 0; accent-color: #6874ff; }
.permission-copy { min-width: 0; display: grid; gap: 4px; }
.permission-copy strong { color: #e8edf6; line-height: 1.3; }
.permission-copy small, .permission-help, .account-board-help { color: var(--muted); font-size: 11px; line-height: 1.45; }
.permission-help { display: block; margin-top: 8px; }
.account-board-help { display: block; margin-top: 9px; }

.admin-user-list { display: grid; gap: 12px; }
.user-account-card { display: grid; gap: 15px; padding: 16px; border: 1px solid var(--border); border-radius: 12px; background: rgba(8,14,26,.43); }
.user-account-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.user-account-head > div { display: grid; gap: 3px; }
.user-account-head span { color: var(--muted); font-size: 11px; }
.user-account-actions { display: flex; justify-content: flex-end; }
.admin-badge { padding: 5px 9px; border-radius: 99px; background: rgba(97, 211, 151, .12); color: #8ce1b4 !important; font-weight: 700; }
.muted-note { color: var(--muted); font-size: 12px; }

@media (max-width: 900px) {
  .admin-grid { grid-template-columns: 1fr; }
}

@media (max-width: 640px) {
  .topbar { height: 64px; min-height: 64px; flex-basis: 64px; flex-wrap: nowrap; padding-top: 0; padding-bottom: 0; }
  .topbar-actions { flex-wrap: nowrap; justify-content: flex-end; }
  .account-chip > span { display: none; }
  .sidebar { top: 64px; }
  .quick-comment-form { grid-template-columns: 1fr auto; }
  .quick-comment-cancel { grid-column: 2; }
  .login-panel { padding: 26px 22px; }
}

/* Board-specific access management */
.board-settings-dialog { width: min(720px, calc(100vw - 28px)); max-height: calc(100vh - 28px); overflow-y: auto; }
.board-access-editor { display: grid; gap: 10px; padding-top: 4px; }
.board-access-editor .section-title-row { align-items: flex-start; }
.board-access-editor h3 { margin: 0; font-size: 14px; }
.board-access-editor p { margin: 4px 0 0; color: var(--muted); font-size: 12px; line-height: 1.45; }
.board-member-list { display: grid; gap: 7px; }
.board-member-row { display: grid; grid-template-columns: minmax(0, 1fr) 155px; align-items: center; gap: 12px; padding: 10px 11px; border: 1px solid rgba(255,255,255,.07); border-radius: 9px; background: rgba(255,255,255,.025); }
.board-member-identity { min-width: 0; display: grid; gap: 2px; }
.board-member-identity strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.board-member-identity span { color: var(--muted); font-size: 11px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.board-member-row select { width: 100%; padding: 8px 9px; border: 1px solid var(--border); border-radius: 8px; background: #101a2b; color: var(--text); }
.board-member-empty { padding: 12px; border: 1px dashed var(--border); border-radius: 9px; color: var(--muted); font-size: 12px; text-align: center; }

@media (max-width: 900px) {
  .search-wrap { width: min(26vw, 220px); }
  .account-chip > span { display: none; }
}

@media (max-width: 740px) {
  .search-wrap { display: none; }
  .topbar { gap: 8px; padding-left: 10px; padding-right: 10px; }
  .topbar-actions { gap: 6px; }
  .topbar-actions .primary-button, .topbar-actions .ghost-button { padding-left: 10px; padding-right: 10px; }
}

@media (max-width: 520px) {
  .board-member-row { grid-template-columns: 1fr; gap: 8px; }
}

/* Live boards and custom board backgrounds */
.board-view.has-background-image {
  background-image: linear-gradient(rgba(5, 9, 17, .38), rgba(5, 9, 17, .58)), var(--board-background-image);
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
}
.board-view.has-background-image .board-header {
  background: linear-gradient(to bottom, rgba(5, 9, 17, .5), transparent);
  text-shadow: 0 2px 12px rgba(0,0,0,.72);
}
.board-view.has-background-image .list-column {
  background: rgba(12, 18, 31, .9);
}
.board-background-editor { display: grid; gap: 10px; }
.board-background-editor h3 { margin: 0; font-size: 14px; }
.board-background-preview img { width: 100%; height: 180px; max-height: 180px; object-fit: cover; }
.login-help { margin-top: -8px; color: var(--muted); font-size: 11px; line-height: 1.45; }

@media (max-width: 520px) {
  .topbar { padding-left: 8px; padding-right: 8px; }
  .topbar-left { gap: 6px; }
  .brand { gap: 7px; }
  .brand-mark { width: 32px; height: 32px; }
}

/* BoardStack 5 final layout safeguards */
.account-permission-section { display: grid; gap: 0; }
.account-details-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); max-width: none; }
.topbar .brand-mark, .topbar .brand > span:last-child { flex: 0 0 auto; }

@media (max-width: 640px) {
  .account-details-grid { grid-template-columns: 1fr; max-width: none; }
  .sidebar.collapsed { transform: translateX(-105%); }
}

/* BoardStack 6: board types, rich card descriptions, and live notes */
button, input, textarea, select { font: inherit; }
select { color-scheme: dark; }
.board-nav-type { width: 18px; flex: 0 0 18px; text-align: center; color: #b9c8e0; font-size: 12px; opacity: .85; }
.card-board-content { flex: 1; min-height: 0; display: flex; }
.card-board-content .lists { width: 100%; }

.board-type-picker { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 10px; }
.board-type-option { position: relative; display: grid !important; grid-template-columns: 22px 38px minmax(0,1fr); align-items: center; gap: 10px; padding: 13px; border: 1px solid var(--border); border-radius: 11px; background: rgba(255,255,255,.025); cursor: pointer; }
.board-type-option:hover { background: rgba(255,255,255,.05); }
.board-type-option:has(input:checked) { border-color: rgba(112,165,255,.72); background: rgba(91,116,255,.12); box-shadow: inset 0 0 0 1px rgba(112,165,255,.17); }
.board-type-option input { width: 17px; height: 17px; margin: 0; accent-color: #6f76ff; }
.board-type-icon { width: 36px; height: 36px; display: grid; place-items: center; border-radius: 10px; background: rgba(112,165,255,.13); color: #b9d4ff; font-size: 18px; }
.board-type-option > span:last-child { min-width: 0; display: grid; gap: 3px; }
.board-type-option strong { font-size: 13px; }
.board-type-option small { color: var(--muted); line-height: 1.35; font-size: 10px; }
.board-settings-type { display: grid; grid-template-columns: auto 1fr; gap: 3px 12px; align-items: baseline; padding: 11px 12px; border: 1px solid var(--border); border-radius: 10px; background: rgba(255,255,255,.025); }
.board-settings-type > span { color: var(--muted); font-size: 11px; font-weight: 700; }
.board-settings-type > strong { font-size: 13px; }
.board-settings-type > small { grid-column: 1 / -1; color: var(--muted); font-size: 10px; }

/* Rich text card editor and always-visible descriptions */
.rich-description-section { display: grid; gap: 9px; }
.rich-description-section h3 { margin: 0; font-size: 14px; }
.rich-description-section .section-title-row small { color: var(--muted); font-size: 10px; }
.rich-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 5px; padding: 7px; border: 1px solid var(--border); border-bottom: 0; border-radius: 10px 10px 0 0; background: #0c1423; }
.rich-toolbar button, .rich-toolbar select { height: 31px; border: 1px solid transparent; border-radius: 7px; background: rgba(255,255,255,.045); color: #dbe5f4; cursor: pointer; }
.rich-toolbar button { min-width: 31px; padding: 0 9px; }
.rich-toolbar select { padding: 0 8px; max-width: 140px; }
.rich-toolbar button:hover, .rich-toolbar select:hover { background: rgba(255,255,255,.09); transform: none; }
.rich-color-control { height: 31px; display: flex !important; grid-template-columns: none !important; align-items: center; gap: 5px; padding: 0 7px; border-radius: 7px; background: rgba(255,255,255,.045); color: #dbe5f4; cursor: pointer; }
.rich-color-control input { width: 22px; height: 22px; padding: 0; border: 0; background: transparent; }
.rich-editor-surface {
  width: 100%; min-width: 0; height: clamp(270px, 36vh, 390px); min-height: 240px; max-height: 72vh;
  overflow-y: auto; overflow-x: hidden; resize: vertical; scrollbar-gutter: stable;
  padding: 13px 14px; border: 1px solid var(--border); border-radius: 0 0 10px 10px;
  background: #0a1120; color: #edf3fc; line-height: 1.5; outline: none;
  white-space: pre-wrap; overflow-wrap: anywhere; word-break: break-word;
}
.rich-editor-surface.expanded { height: min(65vh, 680px); max-height: none; }
.rich-editor-surface div, .rich-editor-surface p, .rich-editor-surface span, .rich-editor-surface font,
.rich-editor-surface a, .rich-editor-surface li { max-width: 100%; overflow-wrap: anywhere; word-break: break-word; }
.rich-editor-surface pre { max-width: 100%; white-space: pre-wrap; overflow-wrap: anywhere; word-break: break-word; }
.rich-editor-surface:focus { border-color: rgba(112,165,255,.62); box-shadow: 0 0 0 2px rgba(112,165,255,.12); }
.rich-editor-surface:empty::before { content: attr(data-placeholder); color: #73829a; pointer-events: none; }
.rich-editor-surface p, .card-description-rich p { margin: 0 0 .65em; }
.rich-editor-surface p:last-child, .card-description-rich p:last-child { margin-bottom: 0; }
.rich-editor-surface ul, .rich-editor-surface ol, .card-description-rich ul, .card-description-rich ol { margin: .45em 0 .45em 1.35em; padding: 0; }
.rich-editor-surface blockquote, .card-description-rich blockquote { margin: .5em 0; padding-left: .8em; border-left: 3px solid rgba(112,165,255,.55); color: #becce0; }
.card-description-rich { margin-top: 9px; padding: 9px 10px; border: 1px solid rgba(255,255,255,.055); border-radius: 8px; background: rgba(4,9,18,.27); color: #d8e1ee; font-size: 12px; line-height: 1.48; overflow-wrap: anywhere; cursor: inherit; }
.card-description-rich * { max-width: 100%; }
.card-description-rich pre { white-space: pre-wrap; }
.card-description-rich font, .card-description-rich span { overflow-wrap: anywhere; }

/* Notes board shell */
.notes-board-content { min-height: 0; align-self: stretch; display: grid; grid-template-columns: 285px minmax(0,1fr); margin: 0 22px 22px; overflow: hidden; border: 1px solid rgba(255,255,255,.09); border-radius: 15px; background: rgba(7,12,22,.72); box-shadow: var(--shadow); backdrop-filter: blur(18px); }
.note-browser { min-width: 0; display: flex; flex-direction: column; border-right: 1px solid var(--border); background: rgba(8,14,25,.78); }
.note-browser-actions { display: grid; grid-template-columns: 1fr auto; gap: 7px; padding: 13px; border-bottom: 1px solid var(--border); }
.note-browser-actions button { white-space: nowrap; }
.note-browser-caption { min-height: 34px; display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 8px 14px; color: var(--muted); font-size: 10px; text-transform: uppercase; letter-spacing: .08em; font-weight: 750; }
.note-list { min-height: 0; flex: 1; overflow-y: auto; padding: 0 8px 10px; display: grid; align-content: start; gap: 5px; }
.note-list-item { width: 100%; min-width: 0; display: grid; gap: 4px; padding: 11px; border: 1px solid transparent; border-radius: 10px; background: transparent; color: inherit; cursor: pointer; text-align: left; }
.note-list-item:hover { background: rgba(255,255,255,.05); transform: none; }
.note-list-item.active { background: linear-gradient(135deg, rgba(102,119,255,.17), rgba(75,129,223,.11)); border-color: rgba(119,155,255,.28); }
.note-list-title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 750; font-size: 13px; }
.note-list-excerpt { color: var(--muted); font-size: 10px; line-height: 1.4; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.note-list-meta { min-width: 0; display: flex; align-items: center; gap: 5px; margin-top: 2px; }
.note-list-meta i { max-width: 145px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: inline-flex; align-items: center; gap: 5px; padding: 2px 6px; border-radius: 99px; background: rgba(112,165,255,.10); color: #c5d8f6; font-size: 8px; font-style: normal; }
.note-list-meta i::before { width: 7px; height: 7px; flex: 0 0 7px; border: 1px solid rgba(255,255,255,.35); border-radius: 50%; background: var(--bubble-color, #7792ff); content: ''; }
.note-list-meta em { margin-left: auto; color: #77869c; font-size: 8px; font-style: normal; white-space: nowrap; }
.note-list-empty { padding: 18px 11px; color: var(--muted); font-size: 11px; text-align: center; }
.note-workspace { min-width: 0; min-height: 0; height: 100%; max-height: 100%; position: relative; overflow: hidden; background: radial-gradient(circle at 90% 0, rgba(112,165,255,.06), transparent 34%); }
.note-empty { height: 100%; display: grid; place-content: center; justify-items: center; gap: 8px; padding: 30px; text-align: center; }
.note-empty h2 { margin: 0; }
.note-empty p { max-width: 500px; margin: 0; color: var(--muted); line-height: 1.55; }
.note-empty code { color: #bed5fa; }
.note-empty-icon { margin-bottom: 3px; }
.note-editor-view { height: 100%; min-height: 0; display: flex; flex-direction: column; padding: 16px 18px 13px; overflow: hidden; }
.note-editor-header { display: flex; align-items: center; gap: 12px; }
.note-title-input { min-width: 0; flex: 1; padding: 2px 0 7px; border: 0; border-bottom: 1px solid transparent; border-radius: 0; background: transparent; color: var(--text); font-size: clamp(22px, 2.8vw, 34px); font-weight: 800; letter-spacing: -.035em; }
.note-title-input:focus { outline: none; border-bottom-color: rgba(112,165,255,.42); }
.note-header-actions { flex: 0 0 auto; display: flex; align-items: center; gap: 9px; }
.note-save-status { color: var(--muted); font-size: 10px; white-space: nowrap; }
.note-save-status[data-tone="warning"] { color: #f0c674; }
.note-save-status[data-tone="error"] { color: #ff929c; }
.compact-button { padding: 7px 10px; font-size: 11px; }
.note-bubble-category { min-width: 0; display: flex; align-items: center; gap: 7px; width: max-content; max-width: 100%; margin: 5px 0 10px; padding: 5px 8px; border: 1px solid rgba(255,255,255,.07); border-radius: 99px; background: rgba(112,165,255,.08); color: #c5d8f6; font-size: 10px; font-weight: 700; }
.note-bubble-category .legend-node { width: 10px; height: 10px; flex-basis: 10px; }
.note-bubble-category span:last-child { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.markdown-toolbar { display: flex; align-items: center; flex-wrap: wrap; gap: 4px; padding: 7px; border: 1px solid var(--border); border-radius: 10px 10px 0 0; background: rgba(7,13,24,.85); }
.markdown-toolbar > button, .note-view-switcher button { min-width: 31px; height: 29px; padding: 0 8px; border: 0; border-radius: 6px; background: transparent; color: #bdc9da; cursor: pointer; font-size: 10px; }
.markdown-toolbar > button:hover, .note-view-switcher button:hover { background: rgba(255,255,255,.08); color: white; transform: none; }
.toolbar-spacer { flex: 1; }
.note-view-switcher { display: flex; padding: 2px; border-radius: 7px; background: rgba(255,255,255,.04); }
.note-view-switcher button.active { background: rgba(105,121,255,.24); color: white; }
.note-editor-panes { min-height: 0; flex: 1; display: grid; grid-template-columns: minmax(0,1fr) minmax(0,1fr); border: 1px solid var(--border); border-top: 0; background: rgba(6,11,20,.72); overflow: hidden; }
.note-content-input { min-width: 0; width: 100%; height: 100%; resize: none; padding: 18px; border: 0; border-right: 1px solid var(--border); border-radius: 0; background: rgba(5,10,19,.72); color: #dbe7f7; font-family: "Cascadia Code", "SFMono-Regular", Consolas, "Liberation Mono", monospace; font-size: 13px; line-height: 1.65; tab-size: 2; outline: none; }
.markdown-preview { min-width: 0; height: 100%; overflow-y: auto; padding: 20px 24px 70px; color: #dce6f3; line-height: 1.65; }
.note-editor-panes.mode-edit { grid-template-columns: 1fr; }
.note-editor-panes.mode-edit .markdown-preview { display: none; }
.note-editor-panes.mode-edit .note-content-input { border-right: 0; }
.note-editor-panes.mode-preview { grid-template-columns: 1fr; }
.note-editor-panes.mode-preview .note-content-input { display: none; }
.markdown-preview h1, .markdown-preview h2, .markdown-preview h3, .markdown-preview h4 { margin: 1.1em 0 .45em; color: white; line-height: 1.25; letter-spacing: -.02em; }
.markdown-preview h1:first-child, .markdown-preview h2:first-child, .markdown-preview h3:first-child { margin-top: 0; }
.markdown-preview p { margin: 0 0 1em; }
.markdown-preview ul, .markdown-preview ol { margin: .5em 0 1em; padding-left: 1.5em; }
.markdown-preview li { margin: .2em 0; }
.markdown-preview blockquote { margin: 1em 0; padding: .3em 0 .3em 1em; border-left: 3px solid #718dff; color: #b5c2d6; background: linear-gradient(90deg, rgba(90,111,255,.08), transparent); }
.markdown-preview code { padding: .12em .35em; border-radius: 5px; background: rgba(112,165,255,.10); color: #c5dcff; font-family: "Cascadia Code", Consolas, monospace; font-size: .9em; }
.markdown-preview pre { position: relative; overflow-x: auto; padding: 14px; border: 1px solid var(--border); border-radius: 10px; background: #070d18; }
.markdown-preview pre code { padding: 0; background: transparent; color: #d6e0ef; }
.markdown-preview a { color: #8fbcff; text-decoration: underline; text-decoration-color: rgba(143,188,255,.45); }
.markdown-preview hr { border: 0; border-top: 1px solid var(--border); margin: 1.6em 0; }
.markdown-placeholder { color: var(--muted); }
.wiki-link { display: inline; padding: 0; border: 0; background: transparent; color: #a99cff; font: inherit; font-weight: 650; cursor: pointer; text-decoration: underline; text-decoration-style: dotted; text-underline-offset: 3px; }
.wiki-link:hover { color: #c8c0ff; transform: none; }
.wiki-link.unresolved { color: #df8fa0; }
.inline-tag { color: #7fc7b1; }
.md-task { list-style: none; margin-left: -1.25em !important; }
.md-task.done { color: #7f8b9d; text-decoration: line-through; }
.task-box { width: 16px; height: 16px; margin-right: 7px; display: inline-grid; place-items: center; border: 1px solid #6d809b; border-radius: 4px; color: #9edabf; font-size: 10px; text-decoration: none; }
.note-relations { flex: 0 0 auto; display: grid; grid-template-columns: 1fr 1fr; gap: 12px; padding-top: 10px; max-height: 118px; }
.note-relations section { min-width: 0; padding: 9px 10px; border: 1px solid var(--border); border-radius: 9px; background: rgba(255,255,255,.022); overflow: hidden; }
.note-relations h3 { display: flex; gap: 6px; margin: 0 0 6px; color: #c7d2e2; font-size: 10px; text-transform: uppercase; letter-spacing: .08em; }
.note-relations h3 span { color: var(--muted); }
.relation-list { display: flex; gap: 5px; overflow-x: auto; padding-bottom: 2px; }
.relation-list button { flex: 0 0 auto; display: flex; align-items: center; gap: 5px; max-width: 180px; padding: 5px 8px; border: 1px solid rgba(255,255,255,.065); border-radius: 7px; background: rgba(255,255,255,.035); color: #b8c9df; cursor: pointer; font-size: 10px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.relation-list button:hover { background: rgba(255,255,255,.075); transform: none; }
.relation-list button.unresolved { color: #df9aa6; border-style: dashed; }
.relation-empty { color: #758399; font-size: 10px; }

/* Graph */
.graph-view { height: 100%; max-height: 100%; min-height: 0; position: relative; display: flex; flex-direction: column; overflow: hidden; padding: 17px; }
.graph-toolbar { flex: 0 0 auto; display: flex; justify-content: space-between; align-items: center; gap: 14px; padding-bottom: 12px; }
.graph-toolbar h2 { margin: 0; font-size: 20px; }
.graph-toolbar p { margin: 3px 0 0; color: var(--muted); font-size: 10px; }
.graph-actions { max-width: 650px; display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 7px; }
.graph-actions .graph-layout-status { flex: 1 0 100%; text-align: right; }
.graph-actions button { white-space: nowrap; }
.graph-canvas { height: 0; min-height: 180px; flex: 1 1 0; position: relative; overflow: hidden; border: 1px solid var(--border); border-radius: 13px; background: radial-gradient(circle at 50% 50%, rgba(62,84,129,.18), transparent 55%), #060b14; cursor: grab; }
.graph-canvas:active { cursor: grabbing; }
.knowledge-graph { width: 100%; height: 100%; display: block; touch-action: none; }
.graph-edge { fill: none; stroke: rgba(128,151,194,.38); stroke-linecap: round; stroke-linejoin: round; }
.graph-edge-hit { fill: none; stroke: transparent; stroke-width: 18px; pointer-events: stroke; }
.graph-node { cursor: pointer; }
.graph-node circle { fill: #7792ff; stroke: rgba(220,230,255,.78); stroke-width: 1.2; filter: drop-shadow(0 0 8px rgba(94,118,255,.48)); }
.graph-node.isolated circle { stroke: rgba(196,205,221,.62); filter: none; }
.graph-node:hover circle { stroke-width: 2; filter: brightness(1.2) drop-shadow(0 0 10px rgba(210,220,255,.48)); }
.graph-node text { fill: #dbe5f5; stroke: #060a12; stroke-width: 3px; paint-order: stroke; text-anchor: middle; font-size: 10px; font-weight: 650; pointer-events: none; }
.graph-legend {
  min-height: 38px; max-height: min(22vh, 160px); position: absolute; z-index: 4;
  left: 17px; right: 17px; bottom: 17px; display: flex; flex-wrap: wrap; align-items: center; gap: 10px 18px;
  overflow-x: hidden; overflow-y: auto; padding: 10px 11px 8px; border-top: 1px solid var(--border); border-radius: 0 0 12px 12px;
  background: rgba(6,11,20,.94); color: var(--muted); font-size: 9px; backdrop-filter: blur(10px);
}
.graph-legend-group { display: flex; flex-wrap: wrap; align-items: center; gap: 9px; }
.graph-legend-group strong { color: #c9d4e5; font-size: 9px; text-transform: uppercase; letter-spacing: .08em; }
.graph-legend span { display: inline-flex; align-items: center; gap: 5px; }
.legend-node { width: 9px; height: 9px; flex: 0 0 auto; border: 1px solid rgba(255,255,255,.38); border-radius: 50%; background: #7792ff; }
.legend-line { width: 32px; height: 10px; overflow: visible; }
.legend-line path { fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.graph-weight-note { margin-left: auto; font-style: italic; }
.graph-layout-status { align-self: center; color: var(--muted); font-size: 10px; white-space: nowrap; }
.graph-actions button:disabled { cursor: default; opacity: .42; transform: none; }
.graph-empty { position: absolute; inset: 0; display: grid; place-content: center; justify-items: center; gap: 5px; color: var(--muted); }
.graph-empty strong { color: white; }

.graph-context-menu { position: fixed; z-index: 70; width: min(280px, calc(100vw - 16px)); display: grid; gap: 11px; padding: 12px; border: 1px solid rgba(151,174,213,.26); border-radius: 8px; background: #111b2c; box-shadow: 0 18px 42px rgba(0,0,0,.48); }
.graph-context-head { min-width: 0; display: grid; grid-template-columns: 38px minmax(0,1fr); align-items: center; gap: 10px; }
.graph-context-head > span:last-child { min-width: 0; display: grid; gap: 3px; }
.graph-context-head strong, .graph-context-head small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.graph-context-head strong { font-size: 12px; }
.graph-context-head small { color: var(--muted); font-size: 9px; }
.graph-context-preview { width: 38px; min-height: 30px; display: grid; place-items: center; }
.graph-context-preview .legend-node { width: 18px; height: 18px; }
.graph-context-type { gap: 5px; color: var(--muted); font-size: 9px; }
.graph-context-type select { width: 100%; min-height: 39px; padding: 8px 9px; }
.graph-context-menu > button { width: 100%; min-height: 38px; }


/* Graph appearance editor */
.graph-settings-dialog { width: min(980px, calc(100vw - 28px)); }
.graph-settings-dialog > form { max-height: min(88vh, 900px); overflow-y: auto; padding-bottom: 0; }
.graph-settings-dialog .dialog-head p, .graph-style-section .section-title-row p { margin: 4px 0 0; color: var(--muted); font-size: 10px; }
.graph-style-section { margin-top: 18px; padding: 14px; border: 1px solid var(--border); border-radius: 12px; background: rgba(255,255,255,.018); }
.graph-style-section h3 { margin: 0; font-size: 13px; }
.graph-style-list, .graph-assignment-list { display: grid; gap: 8px; margin-top: 11px; }
.graph-style-row { display: grid; grid-template-columns: 34px minmax(150px, 1fr) 100px 120px 32px; gap: 9px; align-items: end; padding: 9px; border: 1px solid rgba(255,255,255,.055); border-radius: 10px; background: rgba(5,10,19,.42); }
.graph-style-row:not(.connection) { grid-template-columns: 34px minmax(170px,1fr) 100px minmax(32px,auto); }
.graph-style-row label { gap: 4px; color: var(--muted); font-size: 9px; }
.graph-style-row input, .graph-style-row select { min-height: 35px; padding: 7px 9px; }
.graph-style-row input[type="color"] { width: 100%; padding: 3px; cursor: pointer; }
.graph-style-preview.bubble { width: 24px; height: 24px; align-self: center; justify-self: center; border: 1px solid rgba(255,255,255,.5); border-radius: 50%; box-shadow: 0 0 9px rgba(150,170,255,.26); }
.graph-line-preview { width: 34px; align-self: center; justify-self: center; }
.graph-fixed-type { align-self: center; color: #77859a; font-size: 9px; white-space: nowrap; }
.graph-remove-type { align-self: center; }
.graph-assignment-list { grid-template-columns: repeat(2, minmax(0,1fr)); max-height: 230px; overflow-y: auto; padding-right: 3px; }
.graph-assignment-row { min-width: 0; display: grid; grid-template-columns: minmax(0,1fr) minmax(145px, .8fr); gap: 10px; align-items: center; padding: 8px 9px; border: 1px solid rgba(255,255,255,.052); border-radius: 9px; background: rgba(5,10,19,.34); }
.graph-assignment-row > span { min-width: 0; overflow: hidden; color: #c5d1e2; font-size: 10px; text-overflow: ellipsis; white-space: nowrap; }
.graph-assignment-row > span i { color: #75869e; font-style: normal; }
.graph-assignment-row select { min-width: 0; min-height: 35px; padding: 7px 9px; }
.sticky-dialog-actions { position: sticky; bottom: 0; z-index: 2; margin: 18px -24px 0; padding: 14px 24px; border-top: 1px solid var(--border); background: rgba(13,23,40,.97); backdrop-filter: blur(12px); }
.notes-mobile-nav { display: none; }
.admin-overview { min-width: 0; overflow: hidden; border: 1px solid rgba(112,165,255,.2); border-radius: 10px; background: rgba(8,14,26,.38); }
.admin-overview-head { min-width: 0; display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 14px 15px; }
.admin-overview-head > div { min-width: 0; display: grid; gap: 4px; }
.admin-overview-head h3 { margin: 0; font-size: 14px; }
.admin-overview-head span { color: var(--muted); font-size: 11px; }
.admin-overview-head a { flex: 0 0 auto; color: var(--text); text-decoration: none; }
.admin-overview-summary { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); background: rgba(82,117,190,.06); }
.admin-metric { min-width: 0; display: grid; gap: 4px; padding: 12px 15px; border-right: 1px solid var(--border); }
.admin-metric:last-child { border-right: 0; }
.admin-metric span { overflow: hidden; color: var(--muted); font-size: 10px; text-overflow: ellipsis; white-space: nowrap; }
.admin-metric strong { font-size: 20px; line-height: 1; }
.admin-activity-table-wrap { min-width: 0; max-height: 330px; overflow-y: auto; }
.admin-activity-table { width: 100%; border-collapse: collapse; table-layout: fixed; }
.admin-activity-table th { padding: 9px 11px; border-bottom: 1px solid var(--border); color: var(--muted); font-size: 9px; text-align: left; text-transform: uppercase; }
.admin-activity-table td { min-width: 0; padding: 11px; border-bottom: 1px solid rgba(255,255,255,.055); vertical-align: middle; }
.admin-activity-table tr:last-child td { border-bottom: 0; }
.admin-user-identity { min-width: 0; display: flex; align-items: center; gap: 9px; }
.admin-user-avatar { width: 30px; height: 30px; flex: 0 0 30px; display: grid; place-items: center; border-radius: 7px; background: rgba(112,165,255,.14); color: #caddff; font-size: 10px; font-weight: 800; }
.admin-user-identity > span:last-child, .admin-presence, .admin-last-login, .admin-contribution { min-width: 0; display: grid; gap: 3px; }
.admin-user-identity strong, .admin-last-login strong { overflow: hidden; font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.admin-user-identity small, .admin-presence small, .admin-contribution small { overflow: hidden; color: var(--muted); font-size: 9px; text-overflow: ellipsis; white-space: nowrap; }
.admin-presence > strong { display: flex; align-items: center; gap: 6px; font-size: 10px; }
.admin-presence > strong i { width: 7px; height: 7px; flex: 0 0 7px; border-radius: 50%; background: #687489; }
.admin-presence > strong.online { color: #8ce1b4; }
.admin-presence > strong.online i { background: #52d391; box-shadow: 0 0 0 3px rgba(82,211,145,.11); }
.admin-presence > strong.offline { color: #98a5b8; }
.admin-contribution > span { display: flex; align-items: baseline; justify-content: space-between; gap: 6px; }
.admin-contribution > span strong { font-size: 11px; }
.admin-contribution > i { height: 5px; overflow: hidden; border-radius: 3px; background: rgba(255,255,255,.08); }
.admin-contribution > i b { height: 100%; display: block; border-radius: inherit; background: #6d82ef; }
.admin-activity-empty { padding: 22px !important; color: var(--muted); font-size: 11px; text-align: center; }
.admin-contribution-note { margin: 0; padding: 9px 12px; border-top: 1px solid var(--border); color: var(--muted); font-size: 9px; line-height: 1.4; }

@media (max-width: 1020px) {
  .notes-board-content { grid-template-columns: 235px minmax(0,1fr); margin-left: 14px; margin-right: 14px; }
  .note-editor-view { padding-left: 13px; padding-right: 13px; }
  .markdown-preview { padding-left: 16px; padding-right: 16px; }
}

@media (max-width: 760px) {
  .board-type-picker { grid-template-columns: 1fr; }
  .notes-board-content { grid-template-columns: 190px minmax(0,1fr); margin: 0 8px 8px; }
  .note-browser-actions { grid-template-columns: 1fr; }
  .note-browser-actions button { width: 100%; }
  .note-editor-panes.mode-split { grid-template-columns: 1fr; }
  .note-editor-panes.mode-split .markdown-preview { display: none; }
  .note-relations { grid-template-columns: 1fr; max-height: 150px; overflow-y: auto; }
  .graph-toolbar { align-items: flex-start; }
  .graph-actions { flex-direction: column; }
}

@media (max-width: 760px) {
  .graph-settings-dialog { width: calc(100vw - 16px); }
  .graph-style-row, .graph-style-row:not(.connection) { grid-template-columns: 28px minmax(0,1fr) 78px 30px; }
  .graph-style-row.connection { grid-template-columns: 28px minmax(0,1fr) 76px 100px 30px; }
  .graph-fixed-type { display: none; }
  .graph-assignment-list { grid-template-columns: 1fr; }
}

@media (max-width: 560px) {
  .notes-board-content { display: block; overflow-y: auto; }
  .note-browser { height: 205px; border-right: 0; border-bottom: 1px solid var(--border); }
  .note-browser-actions { grid-template-columns: 1fr auto; }
  .note-workspace { height: calc(100% - 205px); min-height: 430px; }
  .note-editor-header { align-items: flex-start; }
  .note-header-actions { flex-direction: column-reverse; align-items: flex-end; }
  .markdown-toolbar { max-height: 78px; overflow-y: auto; }
  .note-relations { display: none; }
  .rich-toolbar select { max-width: 105px; }
}


/* BoardStack 6.1: resizable description editor and reliable long-word wrapping */
@media (max-width: 640px) {
  .rich-editor-surface { height: 260px; min-height: 210px; max-height: 65vh; }
  .rich-editor-surface.expanded { height: 58vh; }
}

/* BoardStack 6.4: focused mobile notes, touch graph controls, and overflow safeguards */
@media (max-width: 640px) {
  html, body, .app-shell, .workspace, .main-content, .board-view { width: 100%; max-width: 100%; }
  .topbar .brand > span:last-child { display: none; }
  .topbar-actions { min-width: 0; }
  .topbar-actions .primary-button, .topbar-actions .ghost-button, .account-chip button { min-height: 40px; padding: 8px 10px; font-size: 11px; }
  .board-header { min-width: 0; padding: 11px 10px 9px; }
  .board-header h1 { max-width: 62vw; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 22px; }
  .board-header-actions { gap: 6px; }
  .board-header-actions button { min-height: 40px; }

  .notes-board-content {
    min-width: 0; margin: 0 5px 5px; display: flex; flex-direction: column; overflow: hidden;
    border-radius: 11px;
  }
  .notes-mobile-nav {
    flex: 0 0 47px; display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 3px;
    padding: 5px; border-bottom: 1px solid var(--border); background: rgba(7,13,24,.97);
  }
  .notes-mobile-nav button {
    min-width: 0; min-height: 37px; padding: 6px 3px; border: 0; border-radius: 7px;
    background: transparent; color: var(--muted); cursor: pointer; font-size: 11px; font-weight: 700;
  }
  .notes-mobile-nav button.active { background: rgba(105,121,255,.22); color: white; }
  .notes-board-content .note-browser, .notes-board-content .note-workspace {
    width: 100%; height: auto; min-height: 0; flex: 1 1 auto;
  }
  .notes-board-content[data-mobile-pane="list"] .note-workspace { display: none; }
  .notes-board-content:not([data-mobile-pane="list"]) .note-browser { display: none; }
  .note-browser { border-right: 0; border-bottom: 0; }
  .note-browser-actions { grid-template-columns: 1fr 1fr; gap: 8px; padding: 9px; }
  .note-browser-actions button, .note-list-item { min-height: 44px; }
  .note-list { padding: 2px 7px 9px; }
  .note-list-item { padding: 12px; }
  .note-list-title {
    min-width: 0; display: block; color: #edf3fc; -webkit-text-fill-color: #edf3fc;
  }
  .note-workspace { overflow: hidden; }
  .note-editor-view { padding: 9px 8px 7px; }
  .note-editor-header { align-items: center; gap: 7px; }
  .note-title-input { min-width: 0; font-size: 21px; }
  .note-header-actions { flex-direction: row; align-items: center; gap: 5px; }
  .note-save-status { max-width: 82px; overflow: hidden; text-overflow: ellipsis; }
  .note-bubble-category { margin: 3px 0 7px; }
  .markdown-toolbar { flex: 0 0 auto; flex-wrap: nowrap; max-height: none; overflow-x: auto; overflow-y: hidden; scrollbar-width: none; }
  .markdown-toolbar::-webkit-scrollbar { display: none; }
  .markdown-toolbar > button, .note-view-switcher button { flex: 0 0 auto; min-width: 38px; height: 38px; }
  .toolbar-spacer { display: none; }
  .note-view-switcher { flex: 0 0 auto; margin-left: auto; }
  .note-view-switcher #noteSplitMode { display: none; }
  .note-editor-panes, .note-editor-panes.mode-split { min-height: 0; grid-template-columns: 1fr; }
  .note-editor-panes.mode-split .markdown-preview { display: none; }
  .note-content-input, .markdown-preview { min-width: 0; padding: 14px; overflow-wrap: anywhere; }
  .markdown-preview pre { max-width: 100%; white-space: pre-wrap; overflow-wrap: anywhere; }
  .note-relations { display: none; }

  .graph-view { min-width: 0; padding: 8px; overflow: hidden; }
  .graph-toolbar { display: grid; gap: 8px; padding-bottom: 8px; }
  .graph-toolbar > div:first-child { min-width: 0; }
  .graph-toolbar p { display: none; }
  .graph-actions { min-width: 0; display: flex; flex-flow: row wrap; gap: 5px; }
  .graph-layout-status { width: 100%; padding: 0 2px 2px; }
  .graph-actions button { flex: 1 1 auto; min-height: 42px; padding: 8px; font-size: 10px; }
  .graph-canvas { min-width: 0; min-height: 280px; border-radius: 9px; }
  .graph-legend { left: 8px; right: 8px; bottom: 8px; max-height: 104px; display: block; overflow-y: auto; padding: 8px 8px 6px; border-radius: 0 0 8px 8px; }
  .graph-legend-group { margin-bottom: 7px; gap: 8px; }
  .graph-weight-note { display: block !important; margin: 4px 0 0; }

  .dialog {
    width: calc(100vw - 8px); max-width: calc(100vw - 8px); max-height: calc(100dvh - 8px);
    margin: auto; overflow-x: hidden; overflow-y: auto; border-radius: 12px;
  }
  .dialog form, .admin-dialog-body { min-width: 0; padding: 13px; gap: 14px; }
  .dialog-head { min-width: 0; }
  .dialog-head > div { min-width: 0; }
  .dialog h2 { overflow-wrap: anywhere; font-size: 21px; }
  .dialog-actions { flex-wrap: wrap; }
  .dialog-actions button { min-height: 42px; }
  .card-form-grid, .admin-grid, .account-details-grid { min-width: 0; grid-template-columns: minmax(0,1fr); }
  .rich-toolbar { max-width: 100%; overflow-x: auto; flex-wrap: nowrap; }
  .rich-toolbar > * { flex: 0 0 auto; }
  .board-member-row { min-width: 0; grid-template-columns: minmax(0,1fr); }
  .admin-overview-head { align-items: stretch; flex-direction: column; }
  .admin-overview-head a { min-height: 42px; display: grid; place-items: center; }
  .admin-metric { padding: 11px 9px; }
  .admin-metric strong { font-size: 18px; }
  .admin-activity-table-wrap { max-height: none; overflow: visible; }
  .admin-activity-table, .admin-activity-table tbody, .admin-activity-table tr, .admin-activity-table td { width: 100%; display: block; }
  .admin-activity-table thead { display: none; }
  .admin-activity-table tr { display: grid; grid-template-columns: minmax(0,1fr) minmax(0,1fr); padding: 10px 11px; border-bottom: 1px solid rgba(255,255,255,.065); }
  .admin-activity-table td { padding: 8px 5px; border: 0; }
  .admin-activity-table td::before { display: block; margin-bottom: 5px; color: var(--muted); content: attr(data-label); font-size: 8px; font-weight: 700; text-transform: uppercase; }
  .admin-activity-table td:first-child, .admin-activity-table td:last-child { grid-column: 1 / -1; }
  .admin-activity-table td:first-child { padding-top: 2px; }
  .admin-activity-table td:last-child { padding-bottom: 2px; }
  .admin-activity-empty { display: block !important; grid-column: 1 / -1; }
  .toast-region { left: 8px; right: 8px; bottom: 8px; }
}

@media (max-width: 560px) {
  .graph-settings-dialog { width: calc(100vw - 8px); }
  .graph-style-section { min-width: 0; margin-top: 10px; padding: 9px; }
  .graph-style-section .section-title-row { align-items: flex-start; gap: 8px; }
  .graph-style-row, .graph-style-row:not(.connection), .graph-style-row.connection {
    min-width: 0; grid-template-columns: 30px minmax(0,1fr); gap: 7px; align-items: center;
  }
  .graph-style-row label { min-width: 0; grid-column: 2; }
  .graph-style-row input, .graph-style-row select { width: 100%; min-width: 0; min-height: 42px; }
  .graph-style-row .graph-remove-type { grid-column: 1; grid-row: 2; }
  .graph-assignment-row { min-width: 0; grid-template-columns: minmax(0,1fr); }
  .graph-assignment-row > span { white-space: normal; overflow-wrap: anywhere; }
  .graph-assignment-row select { width: 100%; min-height: 42px; }
  .sticky-dialog-actions { margin: 12px -13px 0; padding: 10px 13px; }
  .color-picker { max-width: 100%; flex-wrap: wrap; }
}
