/* Portal shell: left nav · main · right panel
   Panels are resizable (drag the edge), collapsible, and every layout change animates over .5s. */
html, body { height: 100%; }
body { overflow: hidden; }
.ico { width: 20px; height: 20px; flex: none; }

:root { --ease: cubic-bezier(.22, .61, .36, 1); --dur: .5s; --nav-w: 248px; --side-w: 340px; --side-open-w: 340px; --rail-w: 76px; }
.app { display: grid; grid-template-columns: var(--nav-w) 1fr var(--side-w); height: 100vh; height: 100dvh; transition: grid-template-columns var(--dur) var(--ease); }
.app.nav-collapsed { --nav-w: var(--rail-w); }
.app.side-collapsed { --side-w: 0px; }
.app.dragging, .app.dragging * { transition: none !important; }
.app.dragging { cursor: col-resize; user-select: none; }
html.reduce-motion *, html.reduce-motion *::before, html.reduce-motion *::after { transition-duration: .01ms !important; animation-duration: .01ms !important; }

/* drag handles on the inner edges of both panels */
.handle { position: absolute; top: 0; bottom: 0; width: 8px; cursor: col-resize; z-index: 5; touch-action: none; }
.handle::after { content: ''; position: absolute; top: 0; bottom: 0; width: 2px; background: var(--green); opacity: 0; transition: opacity var(--dur) var(--ease); }
.handle:hover::after, .handle.active::after { opacity: 1; }
.nav .handle { right: 0; } .nav .handle::after { right: 0; }
.side .handle { left: 0; } .side .handle::after { left: 0; }

/* ---- left nav ---- */
.nav { position: relative; display: flex; flex-direction: column; background: var(--bg-2); border-right: 1px solid var(--line); overflow-y: auto; overflow-x: hidden; min-width: 0; }
.nav-top { display: flex; align-items: center; justify-content: space-between; padding: 22px 10px 16px 18px; gap: 6px; }
.nav-top .brand { white-space: nowrap; overflow: hidden; font-size: .98rem; min-width: 0; gap: 8px; }
.nav-top .brand > span:last-child { display: inline-block; vertical-align: middle; transition: opacity var(--dur) var(--ease), max-width var(--dur) var(--ease); max-width: 200px; overflow: hidden; }
.nav-collapse { width: 28px; height: 28px; border-radius: 50%; border: 1px solid var(--line-strong); background: var(--surface); color: var(--text-2); display: grid; place-items: center; cursor: pointer; flex: none; transition: transform var(--dur) var(--ease), background var(--dur) var(--ease); }
.nav-collapse:hover { background: var(--surface-2); color: var(--text); }
.nav-user { display: flex; align-items: center; gap: 12px; margin: 0 14px 14px; padding: 12px 14px; border-radius: var(--radius-lg); background: var(--surface); border: 1px solid var(--line); overflow: hidden; white-space: nowrap; }
.avatar { width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; font-size: .8rem; background: var(--blue-soft); color: var(--blue); flex: none; }
.avatar.green { background: var(--green-soft); color: var(--green); }
.avatar.orange { background: var(--orange-soft); color: var(--orange); }
.nav-user b { display: block; font-size: .92rem; line-height: 1.2; }
.nav-user span { font-size: .76rem; color: var(--text-3); }
.nav-section { padding: 14px 16px 6px; font-size: .72rem; font-weight: 600; color: var(--text-3); white-space: nowrap; transition: opacity var(--dur) var(--ease); }
.nav a:not(.brand) { display: flex; align-items: center; gap: 12px; margin: 2px 12px; padding: 10px 12px; border-radius: var(--radius); color: var(--text-2); font-weight: 500; font-size: .92rem; white-space: nowrap; overflow: hidden; transition: background var(--dur) var(--ease), color var(--dur) var(--ease), padding var(--dur) var(--ease); }
.nav a:not(.brand):hover { background: var(--surface); color: var(--text); text-decoration: none; }
.nav a.active { background: var(--green-soft); color: var(--green); }
.nav a .ico { opacity: .9; }
.nav a .label { transition: opacity var(--dur) var(--ease); }
.nav a .count { margin-left: auto; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px; background: var(--orange); color: var(--orange-ink); font-size: .72rem; font-weight: 700; display: grid; place-items: center; }
.nav-admin a.active { background: var(--orange-soft); color: var(--orange); }
.nav-foot { margin-top: auto; padding: 14px; display: flex; gap: 8px; border-top: 1px solid var(--line); }
.nav-foot .btn { flex: 1; white-space: nowrap; overflow: hidden; }
/* collapsed rail: icons only */
.app.nav-collapsed .nav-top { padding-left: 14px; padding-right: 14px; flex-direction: column; }
.app.nav-collapsed .nav-top .brand > span:last-child { opacity: 0; max-width: 0; }
.app.nav-collapsed .nav-collapse { transform: rotate(180deg); }
.app.nav-collapsed .nav-user { margin: 0 14px 10px; padding: 8px; justify-content: center; }
.app.nav-collapsed .nav-user div { display: none; }
.app.nav-collapsed .nav-section { opacity: 0; height: 10px; padding: 0; overflow: hidden; }
.app.nav-collapsed .nav a:not(.brand) { justify-content: center; padding: 11px 0; margin: 2px 14px; }
.app.nav-collapsed .nav a .label { opacity: 0; width: 0; overflow: hidden; }
.app.nav-collapsed .nav a .count { position: absolute; margin: 0; transform: translate(14px, -12px); min-width: 16px; height: 16px; font-size: .62rem; }
.app.nav-collapsed .nav a:not(.brand) { position: relative; }
.app.nav-collapsed .nav-foot { flex-direction: column; }
.app.nav-collapsed .nav-foot .btn span { display: none; }

/* ---- main ---- */
.main { display: flex; flex-direction: column; min-width: 0; overflow: hidden; }
.main-head { display: flex; align-items: center; gap: 14px; padding: 18px 28px; border-bottom: 1px solid var(--line); background: var(--bg); }
.main-head h2 { margin: 0; font-size: 1.4rem; }
.main-head .sub { color: var(--text-3); font-size: .86rem; margin-top: 2px; }
.main-head .grow { flex: 1; }
.main-head .mobile-only { display: none; }
.view { flex: 1; overflow-y: auto; padding: 28px 32px 64px; animation: view-in var(--dur) var(--ease); }
.view.full { padding: 0; overflow: hidden; }
@keyframes view-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* ---- notification trail (chips along the top of the main area) ---- */
.trail { display: flex; align-items: center; gap: 10px; padding: 10px 28px; border-bottom: 1px solid var(--line); background: var(--bg-2); overflow-x: auto; min-height: 56px; scrollbar-width: none; }
.trail::-webkit-scrollbar { display: none; }
.trail:empty { display: none; }
.trail-label { font-size: .74rem; font-weight: 600; color: var(--text-3); white-space: nowrap; flex: none; }
.chip { display: inline-flex; align-items: center; gap: 8px; padding: 7px 8px 7px 12px; border-radius: 999px; background: var(--surface); border: 1px solid var(--line-strong); font-size: .82rem; white-space: nowrap; cursor: pointer; flex: none; max-width: 360px; animation: chip-in var(--dur) var(--ease); transition: background var(--dur) var(--ease), border-color var(--dur) var(--ease), opacity var(--dur) var(--ease), transform var(--dur) var(--ease); }
.chip:hover { background: var(--surface-2); border-color: var(--text-3); }
.chip i { width: 8px; height: 8px; border-radius: 50%; flex: none; }
.chip.green i { background: var(--green); } .chip.blue i { background: var(--blue); } .chip.orange i { background: var(--orange); } .chip.red i { background: var(--red); }
.chip b { font-weight: 600; overflow: hidden; text-overflow: ellipsis; }
.chip time { font-size: .7rem; color: var(--text-3); }
.chip .x { width: 20px; height: 20px; border-radius: 50%; border: 0; background: transparent; color: var(--text-3); display: grid; place-items: center; cursor: pointer; font-size: .7rem; }
.chip .x:hover { background: var(--surface-3); color: var(--text); }
.chip.out { opacity: 0; transform: translateX(-14px); }
.chip.ghost { border-style: dashed; background: transparent; color: var(--text-3); }
@keyframes chip-in { from { opacity: 0; transform: translateX(18px); } to { opacity: 1; transform: none; } }

/* ---- right side panel ---- */
.side { position: relative; display: flex; flex-direction: column; background: var(--bg-2); border-left: 1px solid var(--line); min-width: 0; overflow: hidden; }
.side-inner { width: var(--side-open-w); display: flex; flex-direction: column; height: 100%; }
.side-tabs { display: flex; align-items: stretch; border-bottom: 1px solid var(--line); }
.side-tabs button { flex: 1; padding: 15px 6px; background: none; border: 0; border-bottom: 2px solid transparent; color: var(--text-3); font-weight: 600; font-size: .82rem; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 6px; position: relative; transition: color var(--dur) var(--ease), border-color var(--dur) var(--ease); }
.side-tabs button.active { color: var(--text); border-bottom-color: var(--green); }
.side-tabs button.side-hide { flex: 0 0 44px; padding: 0; color: var(--text-3); }
.side-tabs .badge { position: absolute; top: 9px; right: 10px; min-width: 16px; height: 16px; border-radius: 8px; background: var(--orange); color: var(--orange-ink); font-size: .66rem; display: grid; place-items: center; padding: 0 4px; }
.side-body { flex: 1; overflow-y: auto; display: flex; flex-direction: column; }
.side-body > * { animation: view-in var(--dur) var(--ease); }
.side-body .tour-card { animation: none; }
/* demo banner */
.demo-bar { display: flex; align-items: center; gap: 12px; padding: 10px 24px; background: linear-gradient(90deg, var(--orange-soft), var(--green-soft)); border-bottom: 1px solid var(--line); font-size: .88rem; flex-wrap: wrap; }
.demo-bar .grow { flex: 1; }

/* ---- right side panel ---- */
.side { display: flex; flex-direction: column; background: var(--bg-2); border-left: 1px solid var(--line); min-width: 0; overflow: hidden; }
.side-tabs { display: flex; border-bottom: 1px solid var(--line); }
.side-tabs button { flex: 1; padding: 13px 6px; background: none; border: 0; border-bottom: 2px solid transparent; color: var(--text-3); font-weight: 600; font-size: .82rem; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 6px; position: relative; }
.side-tabs button.active { color: var(--text); border-bottom-color: var(--green); }
.side-tabs .badge { position: absolute; top: 7px; right: 10px; min-width: 16px; height: 16px; border-radius: 8px; background: var(--orange); color: var(--orange-ink); font-size: .66rem; display: grid; place-items: center; padding: 0 4px; }
.side-body { flex: 1; overflow-y: auto; display: flex; flex-direction: column; }

.help-item { padding: 16px 20px; border-bottom: 1px solid var(--line); }
.help-item b { display: block; font-size: .9rem; margin-bottom: 4px; }
.help-item p { margin: 0; color: var(--text-2); font-size: .85rem; }
.help-contact { padding: 20px; display: flex; flex-direction: column; gap: 10px; font-size: .9rem; }
.help-contact a { display: inline-flex; align-items: center; gap: 8px; color: var(--text); }

.notif { display: flex; gap: 12px; padding: 14px 20px; border-bottom: 1px solid var(--line); cursor: pointer; transition: background var(--dur) var(--ease); }
.notif:hover { background: var(--surface); }
.notif.unread { background: var(--green-soft); }
.notif i { width: 8px; height: 8px; border-radius: 50%; background: var(--green); margin-top: 7px; flex: none; }
.notif.read i { background: transparent; }
.notif b { display: block; font-size: .88rem; }
.notif p { margin: 2px 0 0; font-size: .82rem; color: var(--text-2); }
.notif time { font-size: .72rem; color: var(--text-3); }
.side-actions { padding: 12px 20px; display: flex; gap: 10px; align-items: center; border-bottom: 1px solid var(--line); }

/* chat */
.chat { display: flex; flex-direction: column; height: 100%; }
.chat-contacts { border-bottom: 1px solid var(--line); max-height: 40%; overflow-y: auto; }
.contact { display: flex; align-items: center; gap: 12px; padding: 12px 20px; cursor: pointer; border-left: 3px solid transparent; transition: background var(--dur) var(--ease); }
.contact:hover { background: var(--surface); }
.contact.active { background: var(--surface); border-left-color: var(--green); }
.contact .meta { flex: 1; min-width: 0; }
.contact b { display: block; font-size: .88rem; }
.contact span { display: block; font-size: .78rem; color: var(--text-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.contact .unread { background: var(--orange); color: var(--orange-ink); font-size: .7rem; font-weight: 700; min-width: 18px; height: 18px; border-radius: 9px; display: grid; place-items: center; padding: 0 5px; }
.chat-head { padding: 12px 20px; border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: 10px; font-size: .9rem; }
.chat-log { flex: 1; overflow-y: auto; padding: 18px 18px 8px; display: flex; flex-direction: column; gap: 8px; }
.msg { max-width: 86%; padding: 8px 12px; border-radius: 14px; font-size: .9rem; line-height: 1.4; word-wrap: break-word; white-space: pre-wrap; }
.msg.me { align-self: flex-end; background: var(--blue); color: var(--blue-ink); border-bottom-right-radius: 4px; }
.msg.them { align-self: flex-start; background: var(--surface-2); border-bottom-left-radius: 4px; }
.msg time { display: block; font-size: .66rem; opacity: .7; margin-top: 3px; }
.chat-day { align-self: center; font-size: .72rem; color: var(--text-3); margin: 6px 0; }
.typing { font-size: .78rem; color: var(--text-3); padding: 0 16px 6px; min-height: 18px; }
.chat-form { display: flex; gap: 10px; padding: 14px 16px; border-top: 1px solid var(--line); }
.chat-form textarea { flex: 1; resize: none; min-height: 40px; max-height: 120px; padding: 9px 12px; }

/* ---- content blocks ---- */
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 22px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 24px 26px; transition: border-color var(--dur) var(--ease); }
.card h3 { font-size: 1.05rem; margin-bottom: 14px; display: flex; align-items: center; gap: 10px; }
.card h3 .ico { color: var(--text-3); }
.card .more { margin-top: 10px; font-size: .85rem; }
.card.accent-green { border-top: 3px solid var(--green); }
.card.accent-blue { border-top: 3px solid var(--blue); }
.card.accent-orange { border-top: 3px solid var(--orange); }
.span-2 { grid-column: span 2; }
.section-title { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 34px 0 16px; }
.section-title h3 { margin: 0; }
.section-title:first-child { margin-top: 0; }

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 18px; margin-bottom: 28px; }
.stat { padding: 18px 20px; border-radius: var(--radius-lg); background: var(--surface); border: 1px solid var(--line); }
.stat b { display: block; font-family: var(--font-display); font-size: 1.7rem; line-height: 1.1; }
.stat span { font-size: .8rem; color: var(--text-2); }
.stat.green b { color: var(--green); } .stat.blue b { color: var(--blue); } .stat.orange b { color: var(--orange); }

.hero-next { display: grid; grid-template-columns: auto 1fr auto; gap: 22px; align-items: center; padding: 22px 26px; border-radius: var(--radius-lg); background: linear-gradient(120deg, var(--green-soft), var(--blue-soft)); border: 1px solid var(--line); margin-bottom: 28px; }
.hero-next .when { text-align: center; padding: 8px 14px; border-radius: var(--radius); background: var(--bg); min-width: 84px; }
.hero-next .when b { display: block; font-family: var(--font-display); font-size: 1.6rem; line-height: 1; color: var(--green); }
.hero-next .when span { font-size: .78rem; color: var(--text-2); }
.hero-next h3 { margin: 0 0 2px; }
.hero-next p { margin: 0; color: var(--text-2); font-size: .9rem; }

.list { list-style: none; margin: 0; padding: 0; }
.list li { display: flex; align-items: center; gap: 14px; padding: 14px 0; border-bottom: 1px solid var(--line); }
.list li:last-child { border-bottom: 0; }
.list .grow { flex: 1; min-width: 0; }
.list b { display: block; font-size: .93rem; font-weight: 600; }
.list .meta { font-size: .82rem; color: var(--text-2); }
.list .bar { width: 4px; align-self: stretch; border-radius: 2px; background: var(--line-strong); flex: none; }
.bar.green { background: var(--green) !important; } .bar.blue { background: var(--blue) !important; } .bar.orange { background: var(--orange) !important; } .bar.red { background: var(--red) !important; }
.list.clickable li { cursor: pointer; margin: 0 -8px; padding-left: 8px; padding-right: 8px; border-radius: var(--radius-sm); }
.list.clickable li { transition: background var(--dur) var(--ease); }
.list.clickable li:hover { background: var(--surface-2); }

.table { width: 100%; border-collapse: collapse; font-size: .9rem; }
.table th { text-align: left; font-weight: 600; color: var(--text-3); font-size: .78rem; padding: 10px 14px; border-bottom: 1px solid var(--line); }
.table td { padding: 14px; border-bottom: 1px solid var(--line); vertical-align: middle; transition: background var(--dur) var(--ease); }
.table tr:hover td { background: var(--surface-2); }
.table tr.clickable { cursor: pointer; }
.table .actions { white-space: nowrap; text-align: right; }

.toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 22px; }
.toolbar .grow { flex: 1; }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 24px; overflow-x: auto; }
.tabs a, .tabs button { padding: 11px 16px; transition: color var(--dur) var(--ease), border-color var(--dur) var(--ease); border: 0; background: none; color: var(--text-2); font-weight: 600; font-size: .88rem; border-bottom: 2px solid transparent; cursor: pointer; white-space: nowrap; }
.tabs a:hover, .tabs button:hover { color: var(--text); text-decoration: none; }
.tabs a.active, .tabs button.active { color: var(--green); border-bottom-color: var(--green); }

.empty { padding: 36px 22px; text-align: center; color: var(--text-3); border: 1px dashed var(--line-strong); border-radius: var(--radius-lg); }
.empty p { margin: 0 0 10px; }
.loading { display: flex; align-items: center; gap: 10px; color: var(--text-3); padding: 24px; }
.loading .lights i { animation: blink 1s infinite; } .loading .lights i:nth-child(2) { animation-delay: .2s; } .loading .lights i:nth-child(3) { animation-delay: .4s; }
@keyframes blink { 0%, 100% { opacity: .3; } 50% { opacity: 1; } }

.file-link { display: inline-flex; align-items: center; gap: 6px; font-size: .85rem; }
.check { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; }
.check input { width: 18px; height: 18px; accent-color: var(--green); }
.check.done { color: var(--text-3); text-decoration: line-through; }
.progress-bar { height: 8px; border-radius: 4px; background: var(--surface-3); overflow: hidden; }
.progress-bar i { display: block; height: 100%; background: var(--green); border-radius: 4px; }
.progress-bar.blue i { background: var(--blue); } .progress-bar.orange i { background: var(--orange); }
.badge-grid { display: flex; flex-wrap: wrap; gap: 8px; }
.badge { display: inline-flex; align-items: center; gap: 8px; padding: 6px 12px 6px 8px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--line); font-size: .85rem; font-weight: 500; }
.badge .ic { font-size: 1.1rem; }
.quote-box { border-left: 3px solid var(--blue); padding: 8px 14px; background: var(--surface-2); border-radius: 0 var(--radius) var(--radius) 0; font-size: .92rem; margin: 8px 0; white-space: pre-wrap; }
.stars { color: var(--orange); letter-spacing: 1px; }
.kv { display: grid; grid-template-columns: 130px 1fr; gap: 8px 14px; font-size: .9rem; }
.kv dt { color: var(--text-3); } .kv dd { margin: 0; }

/* calendar */
.cal-head { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.cal-head h3 { margin: 0; min-width: 190px; }
.cal { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.cal .dow { font-size: .72rem; font-weight: 600; color: var(--text-3); padding: 4px 6px; }
.cal .day { min-height: 100px; padding: 8px; border-radius: var(--radius-sm); background: var(--surface); border: 1px solid var(--line); font-size: .78rem; cursor: pointer; display: flex; flex-direction: column; gap: 3px; }
.cal .day { transition: border-color var(--dur) var(--ease); }
.cal .day:hover { border-color: var(--line-strong); }
.cal .day.out { opacity: .4; }
.cal .day.today { border-color: var(--green); }
.cal .day.avail { background: var(--surface-2); }
.cal .day .n { font-weight: 600; color: var(--text-2); }
.cal .day.today .n { color: var(--green); }
.cal .ev { padding: 2px 6px; border-radius: 4px; background: var(--blue-soft); color: var(--blue); font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: .72rem; }
.cal .ev.done { background: var(--green-soft); color: var(--green); }
.cal .ev.cancelled { background: var(--red-soft); color: var(--red); text-decoration: line-through; }
.cal .ev.pending { background: var(--orange-soft); color: var(--orange); }
.cal-legend { display: flex; gap: 14px; font-size: .78rem; color: var(--text-3); margin-top: 10px; flex-wrap: wrap; }
.cal-legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 5px; vertical-align: -1px; }

/* baseline test */
.question { padding: 20px 22px; border: 1px solid var(--line); border-radius: var(--radius-lg); background: var(--surface); margin-bottom: 12px; }
.question .q { font-weight: 500; margin-bottom: 10px; }
.question .num { color: var(--text-3); font-size: .8rem; margin-right: 8px; }
.question .opts { display: flex; gap: 8px; flex-wrap: wrap; }
.question .opts label { padding: 9px 16px; border-radius: 999px; border: 1px solid var(--line-strong); cursor: pointer; transition: background var(--dur) var(--ease), border-color var(--dur) var(--ease); }
.question .opts input { display: none; }
.question .opts input:checked + span { color: var(--green); font-weight: 600; }
.question .opts label:has(input:checked) { border-color: var(--green); background: var(--green-soft); }
.question.correct { border-color: var(--green); } .question.wrong { border-color: var(--red); }
.result-ring { width: 120px; height: 120px; border-radius: 50%; display: grid; place-items: center; background: conic-gradient(var(--green) calc(var(--p) * 1%), var(--surface-3) 0); position: relative; }
.result-ring::after { content: ''; position: absolute; inset: 10px; border-radius: 50%; background: var(--surface); }
.result-ring b { position: relative; font-family: var(--font-display); font-size: 1.6rem; }
.topic-bars { display: grid; gap: 8px; }
.topic-bars div { display: grid; grid-template-columns: 110px 1fr 50px; gap: 10px; align-items: center; font-size: .85rem; }

/* files */
.breadcrumb { display: flex; gap: 6px; align-items: center; font-size: .9rem; color: var(--text-3); flex-wrap: wrap; }
.breadcrumb a { color: var(--text-2); }
.breadcrumb a:hover { color: var(--text); }
.files-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 14px; }
.file-tile { padding: 16px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--line); cursor: pointer; position: relative; transition: border-color var(--dur) var(--ease); }
.file-tile:hover { border-color: var(--line-strong); }
.file-tile .ico { width: 28px; height: 28px; color: var(--blue); margin-bottom: 8px; }
.file-tile.folder .ico { color: var(--orange); }
.file-tile b { display: block; font-size: .86rem; font-weight: 500; word-break: break-word; }
.file-tile span { font-size: .74rem; color: var(--text-3); }
.file-tile .menu { position: absolute; top: 8px; right: 8px; display: none; gap: 2px; }
.file-tile:hover .menu, .file-tile:focus-within .menu { display: flex; }
.dropzone { border: 2px dashed var(--line-strong); border-radius: var(--radius-lg); padding: 22px; text-align: center; color: var(--text-3); margin-bottom: 16px; transition: border-color .15s ease, background .15s ease; }
.dropzone.over { border-color: var(--green); background: var(--green-soft); }

/* modals / toasts */
.modal { position: fixed; inset: 0; z-index: 100; background: rgba(5, 14, 16, .62); backdrop-filter: blur(6px); display: grid; place-items: center; padding: 16px; animation: fade-in var(--dur) var(--ease); }
@keyframes fade-in { from { opacity: 0; } }
@keyframes pop-in { from { opacity: 0; transform: translateY(14px) scale(.98); } }
.modal-card { width: min(560px, 100%); background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-xl); box-shadow: var(--shadow); max-height: 92vh; display: flex; flex-direction: column; animation: pop-in var(--dur) var(--ease); }
.modal-card.wide { width: min(860px, 100%); }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 22px 26px 12px; }
.modal-head h3 { margin: 0; }
.modal-body { padding: 8px 26px 20px; overflow-y: auto; }
.modal-foot { padding: 14px 26px 22px; display: flex; gap: 10px; justify-content: flex-end; border-top: 1px solid var(--line); }
.modal-body .field.half { display: inline-flex; width: calc(50% - 6px); }
.modal-body .field.half + .field.half { margin-left: 12px; }
.toasts { position: fixed; top: 18px; left: 50%; transform: translateX(-50%); z-index: 200; display: flex; flex-direction: column; gap: 8px; align-items: center; }
.toast { padding: 10px 18px; border-radius: 999px; background: var(--surface-3); border: 1px solid var(--line-strong); box-shadow: var(--shadow); font-size: .9rem; animation: chip-in var(--dur) var(--ease); }
.toast-ok { border-color: var(--green); } .toast-err { border-color: var(--red); color: var(--red); }
.toast.out { opacity: 0; transition: opacity var(--dur) var(--ease); }
@keyframes up { from { transform: translateY(8px); opacity: 0; } }

/* login screen */
.gate { height: 100vh; display: grid; place-items: center; padding: 20px; background: radial-gradient(900px 500px at 80% -10%, var(--blue-soft), transparent 60%), radial-gradient(700px 500px at 0% 100%, var(--green-soft), transparent 60%), var(--bg); }
.gate-card { width: min(420px, 100%); background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-xl); padding: 30px; box-shadow: var(--shadow); }
.gate-card .brand { margin-bottom: 18px; }

/* ---- whiteboard ---- */
.wb { display: flex; flex-direction: column; height: 100%; }
.wb-bar { display: flex; align-items: center; gap: 6px; padding: 8px 12px; border-bottom: 1px solid var(--line); background: var(--bg-2); flex-wrap: wrap; }
.wb-bar .sep { width: 1px; height: 24px; background: var(--line); margin: 0 4px; }
.wb-bar .tool { width: 36px; height: 36px; border-radius: var(--radius-sm); border: 1px solid transparent; background: transparent; color: var(--text-2); display: grid; place-items: center; cursor: pointer; }
.wb-bar .tool:hover { background: var(--surface); color: var(--text); }
.wb-bar .tool.active { background: var(--green-soft); color: var(--green); border-color: var(--green); }
.wb-bar .swatch { width: 22px; height: 22px; border-radius: 50%; border: 2px solid var(--line-strong); cursor: pointer; }
.wb-bar .swatch.active { border-color: var(--text); box-shadow: 0 0 0 2px var(--bg-2); }
.wb-bar input[type=range] { width: 80px; accent-color: var(--green); }
.wb-bar .title { font-weight: 600; background: transparent; border: 1px solid transparent; padding: 4px 8px; border-radius: var(--radius-sm); min-width: 160px; }
.wb-bar .title:hover, .wb-bar .title:focus { border-color: var(--line-strong); background: var(--bg); }
.wb-bar .peers { display: flex; gap: 4px; margin-left: auto; align-items: center; }
.wb-bar .peers .avatar { width: 28px; height: 28px; font-size: .68rem; }
.wb-bar .status { font-size: .78rem; color: var(--text-3); }
.wb-stage { flex: 1; overflow: auto; position: relative; background: var(--bg); cursor: crosshair; }
.wb-stage.tool-select { cursor: default; }
.wb-stage.tool-text, .wb-stage.tool-note { cursor: text; }
.wb-world { position: relative; width: 2400px; height: 1600px; transform-origin: 0 0; background: var(--surface); background-image: radial-gradient(var(--line-strong) 1px, transparent 1px); background-size: 24px 24px; }
.wb-canvas { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.wb-item { position: absolute; border-radius: 8px; user-select: none; touch-action: none; }
.wb-stage.tool-select .wb-item { cursor: move; }
.wb-item.note { background: #ffd166; color: #1f1400; padding: 12px; box-shadow: 0 6px 16px -8px rgba(0, 0, 0, .5); font-size: 15px; }
.wb-item.text { color: var(--text); padding: 6px; }
.wb-item.image { padding: 0; overflow: hidden; background: transparent; }
.wb-item.image img { width: 100%; height: 100%; object-fit: contain; pointer-events: none; }
.wb-item .content { width: 100%; height: 100%; outline: none; overflow: hidden; white-space: pre-wrap; word-wrap: break-word; }
.wb-item .content:focus { outline: 1px dashed rgba(0, 0, 0, .3); }
.wb-item.selected { outline: 2px solid var(--blue); outline-offset: 2px; }
.wb-item .grip { position: absolute; right: -6px; bottom: -6px; width: 14px; height: 14px; border-radius: 3px; background: var(--blue); cursor: nwse-resize; display: none; }
.wb-item.selected .grip { display: block; }
.wb-item .del { position: absolute; top: -10px; right: -10px; width: 22px; height: 22px; border-radius: 50%; background: var(--red); color: #fff; border: 0; display: none; place-items: center; cursor: pointer; font-size: .75rem; }
.wb-item.selected .del { display: grid; }
.wb-item.shape { background: transparent; }
.wb-item.shape svg { width: 100%; height: 100%; overflow: visible; }
.wb-cursor { position: absolute; pointer-events: none; z-index: 20; transition: transform .08s linear; }
.wb-cursor i { display: block; width: 10px; height: 10px; border-radius: 50%; background: var(--orange); border: 2px solid #fff; }
.wb-cursor span { position: absolute; left: 12px; top: -4px; background: var(--orange); color: var(--orange-ink); font-size: .7rem; padding: 1px 6px; border-radius: 4px; white-space: nowrap; }
.rt-bar { display: flex; gap: 2px; padding: 4px; background: var(--surface-3); border: 1px solid var(--line-strong); border-radius: var(--radius-sm); position: absolute; z-index: 30; box-shadow: var(--shadow-sm); }
.rt-bar button { width: 30px; height: 28px; border: 0; background: transparent; color: var(--text); border-radius: 4px; cursor: pointer; font-size: .85rem; }
.rt-bar button:hover { background: var(--surface); }
.rt-bar select, .rt-bar input[type=color] { height: 28px; border: 0; background: var(--surface); color: var(--text); border-radius: 4px; font-size: .8rem; }

/* ---- responsive ---- */
.scrim { display: none; }
@media (max-width: 1180px) {
  .app { grid-template-columns: 248px 1fr 0; }
  .side { position: fixed; top: 0; right: 0; bottom: 0; width: min(380px, 92vw); z-index: 60; transform: translateX(100%); transition: transform var(--dur) var(--ease); display: flex; }
  .side-inner { width: 100%; }
  .app.side-open .side { transform: none; }
  .handle { display: none; }
}
@media (max-width: 860px) {
  .app { grid-template-columns: 1fr; }
  .nav { position: fixed; top: 0; left: 0; bottom: 0; width: 280px; z-index: 60; transform: translateX(-100%); transition: transform var(--dur) var(--ease); }
  .app.nav-collapsed .nav { width: 280px; }
  .app.nav-collapsed .nav a .label, .app.nav-collapsed .nav-user div, .app.nav-collapsed .nav-foot .btn span { display: inline; opacity: 1; width: auto; }
  .app.nav-collapsed .nav a:not(.brand) { justify-content: flex-start; padding: 10px 12px; }
  .app.nav-collapsed .nav-section { opacity: 1; height: auto; padding: 14px 16px 6px; }
  .nav-collapse { display: none; }
  .trail { padding: 8px 14px; }
  .app.nav-open .nav { transform: none; }
  .main-head .mobile-only { display: inline-flex; }
  .main-head { padding: 10px 14px; }
  .main-head h2 { font-size: 1.1rem; }
  .view { padding: 18px 16px 48px; }
  .span-2 { grid-column: span 1; }
  .hero-next { grid-template-columns: auto 1fr; }
  .hero-next .btn { grid-column: 1 / -1; }
  .scrim { display: block; position: fixed; inset: 0; z-index: 55; background: rgba(0, 0, 0, .45); opacity: 0; pointer-events: none; transition: opacity var(--dur) var(--ease); }
  .app.nav-open ~ .scrim, .app.side-open ~ .scrim { opacity: 1; pointer-events: auto; }
  .cal .day { min-height: 56px; }
  .cal .ev { display: none; }
  .cal .day .cnt { display: inline-block; font-size: .7rem; color: var(--blue); }
  .kv { grid-template-columns: 100px 1fr; }
  .modal-body .field.half { width: 100%; display: flex; }
  .modal-body .field.half + .field.half { margin-left: 0; }
}
@media (min-width: 861px) { .cal .day .cnt { display: none; } }

/* ---- guided tour ---- */
.tour-spot { position: fixed; z-index: 90; border-radius: 14px; box-shadow: 0 0 0 9999px rgba(4, 12, 14, .62), 0 0 0 3px var(--green); pointer-events: none; transition: all var(--dur) var(--ease); opacity: 0; }
.tour-spot.on { opacity: 1; }
.tour-card { padding: 24px 22px; display: flex; flex-direction: column; gap: 12px; height: 100%; }
.tour-card .step { font-size: .74rem; font-weight: 600; color: var(--green); }
.tour-card h3 { margin: 0; font-size: 1.25rem; }
.tour-card p { color: var(--text-2); margin: 0; }
.tour-card .dots { display: flex; gap: 6px; margin-top: auto; padding-top: 10px; }
.tour-card .dots i { width: 8px; height: 8px; border-radius: 50%; background: var(--surface-3); transition: background var(--dur) var(--ease), transform var(--dur) var(--ease); }
.tour-card .dots i.done { background: var(--green); } .tour-card .dots i.cur { background: var(--green); transform: scale(1.4); }
.tour-card .actions { display: flex; gap: 10px; margin-top: 8px; }
.tour-card .actions .grow { flex: 1; }
.tour-card .illus { font-size: 2.2rem; line-height: 1; }

/* ---- personalisation ---- */
.pref-row { display: grid; grid-template-columns: 1fr auto; gap: 18px; align-items: center; padding: 16px 0; border-bottom: 1px solid var(--line); }
.pref-row:last-child { border-bottom: 0; }
.pref-row b { display: block; font-size: .95rem; }
.pref-row .hint { display: block; margin-top: 2px; }
.pref-row input[type=range] { width: 220px; accent-color: var(--green); }
.pref-row .val { font-variant-numeric: tabular-nums; min-width: 56px; text-align: right; color: var(--text-2); font-size: .9rem; }
.switch { position: relative; width: 48px; height: 28px; border-radius: 14px; background: var(--surface-3); border: 1px solid var(--line-strong); cursor: pointer; transition: background var(--dur) var(--ease); flex: none; }
.switch::after { content: ''; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: var(--text-2); transition: transform var(--dur) var(--ease), background var(--dur) var(--ease); }
.switch.on { background: var(--green); border-color: var(--green); }
.switch.on::after { transform: translateX(20px); background: var(--green-ink); }
.theme-pick { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.theme-pick button { padding: 16px; border-radius: var(--radius-lg); border: 2px solid var(--line); background: var(--surface-2); color: var(--text); cursor: pointer; text-align: left; transition: border-color var(--dur) var(--ease), transform var(--dur) var(--ease); }
.theme-pick button.on { border-color: var(--green); }
.theme-pick .swatch-row { display: flex; gap: 6px; margin-bottom: 10px; }
.theme-pick .swatch-row i { width: 18px; height: 18px; border-radius: 50%; display: block; }

/* ---- vertical site-content editor ---- */
.stack { display: flex; flex-direction: column; gap: 28px; max-width: 860px; }
.item-block { border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 20px 22px 14px; margin-bottom: 16px; background: var(--bg-2); }
.item-block .item-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.item-block .item-head b { font-size: .82rem; color: var(--text-3); }
.sticky-save { padding: 18px 0 0; margin-top: 6px; border-top: 1px solid var(--line); display: flex; gap: 10px; justify-content: flex-end; align-items: center; }
.sticky-save .grow { flex: 1; }
