/* Design tokens — from the design handoff README (final, high-fidelity). */
:root {
	--royal: #00338D ;
	--royal-press: #002A75 ;
	--red: #C60C30 ;
	--red-press: #A80A28 ;
	--ink: #0B1B3F ;
	--text-2: #3E4C6B ;
	--muted: #5A6784 ;
	--faint: #9AA8C4 ;
	--border: #CBD3E3 ;
	--divider: #E3E8F1 ;
	--row-faint: #EEF2FA ;
	--bg: #F5F7FB ;
	--tint: #EEF2FA ;
	--red-tint: #FBE7EB ;
	--red-tint-border: #F3C2CC ;
	--surface: #fff ;
	--checked-text: #7B879F ;
	--mono: 'Courier New', Courier, monospace ;
	--sans: 'IBM Plex Sans', system-ui, sans-serif ;
	--shadow-pop: 0 14px 40px rgba(11,27,63,.18) ;
	--shadow-toast: 0 10px 30px rgba(11,27,63,.15) ;
	--strip-bg: var(--royal) ;
	--editor-font-size: 15px ;
}
[data-theme='b'] {
	--bg: #0A1430 ;
	--surface: #0A1430 ;
	--ink: #DCE4F5 ;
	--text-2: #B9C6E8 ;
	--muted: #8A9BC4 ;
	--faint: #5A6C9C ;
	--border: #1B2A52 ;
	--divider: #12204A ;
	--row-faint: #0F1C3E ;
	--tint: #0F1C3E ;
	--red: #FF6B84 ;
	--checked-text: #6F82AE ;
	--strip-bg: #061027 ;
	--red-tint: #2A1020 ;
	--red-tint-border: #5A2038 ;
}

* { box-sizing: border-box ; }
html, body { height: 100% ; overscroll-behavior-x: none ; }
body { margin: 0 ; font-family: var(--sans) ; color: var(--ink) ; background: var(--bg) ; }
.editor-wrap { touch-action: pan-y ; }
.app { height: 100vh ; height: 100dvh ; display: flex ; flex-direction: column ; }
button { font-family: inherit ; cursor: pointer ; }
input { font-family: inherit ; }
@keyframes pulse { 0%,100% { opacity: .4 ; } 50% { opacity: 1 ; } }

/* ---------- Tab strip (Direction A) ---------- */
.strip { background: var(--strip-bg) ; padding: 10px 12px 0 ; display: flex ; align-items: flex-end ; gap: 2px ; min-height: 52px ; }
[data-theme='b'] .strip { padding: 0 ; align-items: stretch ; min-height: 40px ; border-bottom: 1px solid var(--border) ; }
.tab { display: flex ; align-items: center ; gap: 8px ; height: 38px ; padding: 0 12px 0 14px ; border: 0 ; border-radius: 9px 9px 0 0 ;
	font-size: 13px ; font-weight: 500 ; max-width: 220px ; background: rgba(255,255,255,.12) ; color: #fff ; white-space: nowrap ; }
.tab.active { background: var(--surface) ; color: var(--ink) ; }
.tab.split { background: rgba(255,255,255,.3) ; }
[data-theme='b'] .tab { border-radius: 0 ; height: auto ; padding: 0 14px ; background: transparent ; color: #8A9BC4 ; font-family: var(--mono) ;
	border-right: 1px solid var(--border) ; border-top: 2px solid transparent ; }
[data-theme='b'] .tab.active { background: var(--bg) ; color: #fff ; border-top-color: var(--red) ; }
[data-theme='b'] .tab.split { color: #fff ; border-top-color: var(--muted) ; }
.tab .title { overflow: hidden ; text-overflow: ellipsis ; }
.tab .close { opacity: .6 ; background: none ; border: 0 ; color: inherit ; font-size: 14px ; padding: 2px 4px ; border-radius: 4px ; line-height: 1 ; }
.tab .close:hover { opacity: 1 ; background: rgba(0,0,0,.08) ; }
.dot { width: 8px ; height: 8px ; border-radius: 50% ; flex: none ; }
.dot.private { background: #fff ; border: 1.5px solid var(--faint) ; }
.dot.foreign { outline: 2px dashed currentColor ; outline-offset: 2px ; }
.strip-btn { background: rgba(255,255,255,.12) ; color: #fff ; border: 0 ; border-radius: 7px ; font-size: 13px ; padding: 6px 10px ; margin-bottom: 4px ; }
.strip-btn:hover { background: rgba(255,255,255,.22) ; }
.strip-right { margin-left: auto ; display: flex ; align-items: center ; gap: 12px ; padding-bottom: 6px ; }
.save-state { font-size: 12px ; color: rgba(255,255,255,.85) ; display: flex ; align-items: center ; gap: 6px ; }
.save-state .sdot { width: 7px ; height: 7px ; border-radius: 50% ; }
.save-state .sdot.saving { background: #B9C3D6 ; animation: pulse 1.2s infinite ; }
.save-state .sdot.saved { background: #7FA8FF ; }
.save-state .sdot.error { background: var(--red) ; }
.avatar { width: 28px ; height: 28px ; border-radius: 50% ; color: #fff ; font-size: 12px ; font-weight: 600 ;
	display: flex ; align-items: center ; justify-content: center ; border: 0 ; }
[data-theme='b'] .avatar { border-radius: 4px ; width: 24px ; height: 24px ; }

/* ---------- Editor header ---------- */
/* Chrome around the editor is not selectable, so a drag that overshoots the
   first or last line doesn't pull the title or tab strip into the selection. */
.strip, .ed-header, .statusbar, .pillstrip { user-select: none ; -webkit-user-select: none ; }
.ed-header { display: flex ; align-items: center ; gap: 12px ; padding: 10px 24px ; border-bottom: 1px solid var(--divider) ; background: var(--surface) ; flex-wrap: wrap ; }
.ed-title { font-size: 15px ; font-weight: 600 ; }
.badge { font-size: 11px ; font-weight: 600 ; padding: 3px 9px ; border-radius: 999px ; color: #fff ; border: 0 ; }
.badge.private { background: var(--surface) ; color: var(--muted) ; border: 1px solid var(--border) ; }
.ed-meta { font-size: 12px ; color: var(--muted) ; }
.presence { font-size: 12px ; color: var(--red) ; background: var(--red-tint) ; border: 1px solid var(--red-tint-border) ;
	padding: 3px 10px ; border-radius: 999px ; display: inline-flex ; align-items: center ; gap: 6px ; }
.ed-actions { margin-left: auto ; display: flex ; gap: 8px ; }
.btn-outline { font-size: 12px ; padding: 6px 10px ; background: var(--surface) ; color: var(--ink) ; border: 1px solid var(--border) ; border-radius: 7px ; }
.btn-outline:hover { border-color: var(--royal) ; color: var(--royal) ; }
[data-theme='b'] .btn-outline:hover { border-color: var(--muted) ; color: #fff ; }
.btn-primary { background: var(--royal) ; color: #fff ; border: 0 ; border-radius: 8px ; font-size: 13px ; font-weight: 500 ; padding: 8px 14px ; }
.btn-primary:hover { background: var(--royal-press) ; }
[data-theme='b'] .btn-primary { background: #00338D ; }
.btn-red { background: var(--red) ; color: #fff ; border: 0 ; border-radius: 8px ; font-size: 13px ; font-weight: 500 ; padding: 8px 14px ; }

/* ---------- Editor ---------- */
/* .panes holds one pane (the active tab) or, on desktop, two side by side. */
.panes { flex: 1 ; display: flex ; min-height: 0 ; }
.pane { flex: 1 1 0 ; min-width: 0 ; min-height: 0 ; display: flex ; flex-direction: column ; }
.pane.pane-side { border-left: 1px solid var(--border) ; }
.editor-wrap { flex: 1 ; min-height: 0 ; overflow-y: auto ; background: var(--surface) ; }
.editor { padding: 28px 64px ; max-width: 76ch ; font-family: var(--mono) ; font-size: var(--editor-font-size) ; line-height: 1.65 ; }
[data-theme='b'] .editor { max-width: 84ch ; padding: 24px 48px 24px 24px ; }
.panes.two .editor { padding-left: 32px ; padding-right: 32px ; }
/* Room to scroll past the last line, so it can sit mid-window instead of
   pinned to the bottom of the viewport. Clicks here still land on .editor. */
.editor::after { content: '' ; display: block ; height: 50vh ; }
.line { display: flex ; align-items: flex-start ; gap: 10px ; border-radius: 4px ; padding: 0 4px ; min-height: calc(var(--editor-font-size) * 1.65) ; }
.line:hover { background: var(--row-faint) ; }
[data-theme='b'] .line { gap: 14px ; }
[data-theme='b'] .line::before { content: attr(data-n) ; color: #3A4C7C ; min-width: 2ch ; text-align: right ; user-select: none ; }
.line .cb { width: 16px ; height: 16px ; margin-top: calc((var(--editor-font-size) * 1.65 - 16px) / 2) ; border-radius: 4px ;
	border: 1.5px solid var(--faint) ; background: transparent ; flex: none ; padding: 0 ; color: #fff ; font-size: 11px ; line-height: 1 ;
	user-select: none ; -webkit-user-select: none ; }
.line .txt { cursor: text ; }
.line .cb.on { background: var(--royal) ; border-color: var(--royal) ; }
[data-theme='b'] .line .cb.on { background: var(--red) ; border-color: var(--red) ; }
.line .txt { flex: 1 ; white-space: pre-wrap ; word-break: break-word ; outline: none ; min-width: 1ch ;
	min-height: calc(var(--editor-font-size) * 1.65) ; }
.line.checked .txt { color: var(--checked-text) ; text-decoration: line-through ; }
.editor[data-readonly='1'] .txt { pointer-events: none ; }

/* ---------- Status bar (Direction B) ---------- */
.statusbar { display: none ; }
[data-theme='b'] .statusbar { display: flex ; align-items: center ; gap: 14px ; background: #00338D ; color: #fff ;
	font-family: var(--mono) ; font-size: 11px ; padding: 0 10px 0 0 ; height: 26px ; }
[data-theme='b'] .statusbar .who { background: var(--red) ; color: #fff ; font-weight: 700 ; padding: 0 10px ; height: 100% ; display: flex ; align-items: center ; }
[data-theme='b'] .statusbar .right { margin-left: auto ; display: flex ; gap: 14px ; }

/* ---------- Context menu / popovers ---------- */
.popover { position: fixed ; z-index: 50 ; background: var(--surface) ; border: 1px solid var(--border) ; border-radius: 10px ;
	box-shadow: var(--shadow-pop) ; padding: 6px ; min-width: 200px ; }
[data-theme='b'] .popover { background: #061027 ; border-color: #2A3D6E ; }
.popover .item { display: block ; width: 100% ; text-align: left ; background: none ; border: 0 ; font-size: 13px ; color: var(--ink) ;
	padding: 8px 10px ; border-radius: 6px ; }
.popover .item:hover { background: var(--tint) ; color: var(--royal) ; }
[data-theme='b'] .popover .item:hover { background: #00338D ; color: #fff ; }
.popover .item.danger { color: var(--red) ; }
.popover .item.row { display: flex ; align-items: center ; gap: 8px ; }
.popover .item.on { color: var(--royal) ; font-weight: 600 ; }
[data-theme='b'] .popover .item.on { color: #fff ; }
.popover .sep { height: 1px ; background: var(--divider) ; margin: 4px 6px ; }
.popover .menu-hint { font-size: 12px ; color: var(--muted) ; padding: 8px 10px ; max-width: 240px ; line-height: 1.4 ; }
.scrim { position: fixed ; inset: 0 ; z-index: 40 ; background: transparent ; }
.scrim.dark { background: rgba(11,27,63,.35) ; }

.vis-pop { padding: 14px ; min-width: 340px ; }
.vis-pop h4 { margin: 0 0 10px ; font-size: 13px ; font-weight: 600 ; }
.vis-row { display: flex ; align-items: center ; gap: 10px ; padding: 9px 10px ; border: 1.5px solid var(--border) ; border-radius: 8px ; margin-bottom: 6px ;
	background: none ; width: 100% ; font-size: 13px ; color: var(--ink) ; }
.vis-row.sel { border-color: var(--royal) ; background: var(--tint) ; }

/* ---------- Library overlay ---------- */
.overlay { position: fixed ; inset: 0 ; z-index: 45 ; background: rgba(11,27,63,.35) ; display: flex ; justify-content: flex-end ; }
.drawer { width: 400px ; max-width: 92vw ; background: var(--surface) ; height: 100% ; overflow-y: auto ; padding: 20px ; box-shadow: var(--shadow-pop) ; }
.drawer h3 { margin: 0 0 12px ; font-size: 17px ; }
.filters { display: flex ; gap: 6px ; margin-bottom: 12px ; flex-wrap: wrap ; }
.pill-filter { font-size: 12px ; padding: 5px 12px ; border-radius: 999px ; border: 1px solid var(--border) ; background: var(--surface) ; color: var(--ink) ; }
.pill-filter.active { background: var(--royal) ; border-color: var(--royal) ; color: #fff ; }
.lib-row { display: flex ; align-items: center ; gap: 10px ; width: 100% ; text-align: left ; background: none ; border: 0 ;
	border-bottom: 1px solid var(--divider) ; padding: 10px 6px ; font-size: 13px ; color: var(--ink) ; }
.lib-row:hover { background: var(--row-faint) ; }
.lib-row .meta { margin-left: auto ; font-size: 11px ; color: var(--muted) ; display: flex ; gap: 8px ; align-items: center ; }
.star { color: var(--red) ; }

/* ---------- Toasts ---------- */
.toasts { position: fixed ; right: 20px ; bottom: 20px ; z-index: 60 ; display: flex ; flex-direction: column ; gap: 10px ; }
.toast { background: var(--surface) ; border-left: 4px solid var(--royal) ; border-radius: 10px ; box-shadow: var(--shadow-toast) ;
	padding: 12px 16px ; font-size: 13px ; display: flex ; align-items: center ; gap: 10px ; color: var(--ink) ; }
.toast.error { border-left-color: var(--red) ; }
.toast button { background: none ; border: 0 ; color: var(--muted) ; font-size: 14px ; }
.toast .act { color: var(--royal) ; font-weight: 600 ; }

/* ---------- Modal ---------- */
.modal-scrim { position: fixed ; inset: 0 ; z-index: 55 ; background: rgba(11,27,63,.4) ; display: flex ; align-items: center ; justify-content: center ; padding: 16px ; }
.modal { background: var(--surface) ; border-radius: 12px ; padding: 24px ; width: 420px ; max-width: 100% ; box-shadow: var(--shadow-pop) ; }
.modal h3 { margin: 0 0 14px ; font-size: 17px ; }
.field { margin-bottom: 12px ; }
.field label { display: block ; font-size: 11px ; font-weight: 600 ; letter-spacing: .06em ; text-transform: uppercase ; color: var(--muted) ; margin-bottom: 5px ; }
.field input { width: 100% ; font-size: 14px ; padding: 9px 10px ; border: 1px solid var(--border) ; border-radius: 8px ; background: var(--surface) ; color: var(--ink) ; }
.modal .actions { display: flex ; gap: 8px ; justify-content: flex-end ; margin-top: 16px ; }

/* ---------- Empty state ---------- */
.empty { text-align: center ; padding: 80px 20px ; }
.empty .word { font-family: var(--mono) ; font-size: 15px ; }
.empty .sub { font-size: 13px ; color: var(--muted) ; margin: 6px 0 18px ; }

/* ---------- Auth (PIN) ---------- */
.auth { min-height: 100vh ; min-height: 100dvh ; background: #00338D ; position: relative ; overflow: hidden ;
	display: flex ; align-items: center ; justify-content: center ; padding: 20px ; }
.auth::after { content: '' ; position: absolute ; width: 420px ; height: 420px ; border-radius: 50% ; background: #C60C30 ; right: -120px ; bottom: -120px ; }
.auth-card { position: relative ; z-index: 1 ; background: #fff ; color: #0B1B3F ; border-radius: 16px ; padding: 36px 40px ; width: 440px ; max-width: 100% ;
	display: flex ; flex-direction: column ; gap: 22px ; }
.wordmark { font-family: var(--mono) ; font-size: 13px ; font-weight: 700 ; color: #C60C30 ; }
.auth-card h2 { margin: 0 ; font-size: 22px ; font-weight: 600 ; }
.auth-copy { font-size: 14px ; color: #3E4C6B ; margin: 0 ; }
.auth-copy .num { font-family: var(--mono) ; }
.phone-input { font-family: var(--mono) ; font-size: 18px ; padding: 12px ; border: 1px solid #CBD3E3 ; border-radius: 9px ; width: 100% ; }
.pin-row { display: flex ; gap: 8px ; justify-content: space-between ; }
.pin-box { width: 54px ; height: 54px ; text-align: center ; font-family: var(--mono) ; font-size: 24px ; font-weight: 700 ;
	border: 1px solid #CBD3E3 ; border-radius: 9px ; }
.pin-box:focus { outline: none ; border: 2px solid #00338D ; }
.pin-row.err .pin-box { border-color: #C60C30 ; background: #FBE7EB ; }
.auth-error { font-size: 13px ; color: #C60C30 ; margin: 0 ; }
.auth-btn { height: 48px ; background: #00338D ; color: #fff ; border: 0 ; border-radius: 9px ; font-size: 15px ; font-weight: 600 ; }
.auth-btn:hover { background: #002A75 ; }
.auth-foot { display: flex ; justify-content: space-between ; font-size: 13px ; color: #5A6784 ; }
.auth-foot .cool { font-family: var(--mono) ; }
.auth-foot a, .auth-foot button.link { color: #00338D ; background: none ; border: 0 ; font-size: 13px ; padding: 0 ; text-decoration: underline ; }
.restore { display: flex ; flex-direction: column ; align-items: center ; gap: 18px ; background: #fff ; border-radius: 16px ; padding: 48px 56px ; position: relative ; z-index: 1 ; }
.restore .bars { display: flex ; gap: 8px ; }
.restore .bar { width: 46px ; height: 16px ; border-radius: 6px 6px 0 0 ; background: #00338D ; animation: pulse 1.2s infinite ; }
.restore .bar:nth-child(2) { animation-delay: .15s ; }
.restore .bar:nth-child(3) { background: #C60C30 ; animation-delay: .3s ; }
.restore .bar:nth-child(4) { animation-delay: .45s ; }
.restore .msg { font-family: var(--mono) ; font-size: 14px ; color: #0B1B3F ; }

/* ---------- Admin portal ---------- */
.portal { display: flex ; height: 100vh ; height: 100dvh ; background: var(--bg) ; }
.side { width: 220px ; flex: none ; background: var(--surface) ; border-right: 1px solid var(--divider) ; padding: 20px 12px ; display: flex ; flex-direction: column ; }
.side .wordmark { font-size: 13px ; }
.side .subword { font-size: 11px ; color: var(--muted) ; margin-bottom: 20px ; }
.nav-item { display: block ; width: 100% ; text-align: left ; font-size: 14px ; font-weight: 500 ; padding: 9px 12px ; border-radius: 8px ;
	background: none ; border: 0 ; color: var(--ink) ; margin-bottom: 2px ; }
.nav-item.active { background: var(--royal) ; color: #fff ; }
.side .foot { margin-top: auto ; display: flex ; align-items: center ; gap: 8px ; font-size: 12px ; color: var(--muted) ; }
.portal-main { flex: 1 ; overflow-y: auto ; padding: 28px 32px ; }
.portal-head { display: flex ; align-items: center ; justify-content: space-between ; margin-bottom: 18px ; }
.portal-head h2 { margin: 0 ; font-size: 22px ; font-weight: 600 ; letter-spacing: -.01em ; }
.card { background: var(--surface) ; border: 1px solid var(--divider) ; border-radius: 12px ; overflow: hidden ; }
.thead { display: grid ; font-size: 11px ; font-weight: 600 ; letter-spacing: .06em ; text-transform: uppercase ; color: var(--muted) ;
	padding: 10px 16px ; border-bottom: 1px solid var(--divider) ; gap: 10px ; }
.trow { display: grid ; align-items: center ; padding: 12px 16px ; border-bottom: 1px solid var(--row-faint) ; font-size: 13px ; gap: 10px ;
	background: none ; border-left: 0 ; border-right: 0 ; border-top: 0 ; width: 100% ; text-align: left ; color: var(--ink) ; }
button.trow:hover { background: var(--bg) ; }
.trow.sel { background: var(--tint) ; }
.users-grid { grid-template-columns: 1.4fr 1fr .7fr 1.4fr .7fr ; }
.export-grid { grid-template-columns: 36px 1.6fr 1fr 1.2fr 1fr .6fr ; }
.owns-grid { grid-template-columns: 1.6fr 1fr 1.4fr 1fr ; }
.mono { font-family: var(--mono) ; }
.chip { font-size: 10px ; font-weight: 600 ; color: #fff ; padding: 2px 8px ; border-radius: 999px ; display: inline-block ; margin-right: 4px ; }
.chip.outline { background: var(--surface) ; color: var(--muted) ; border: 1px solid var(--border) ; }
.role-admin { color: var(--red) ; font-weight: 600 ; }
.status-active { color: var(--royal) ; font-weight: 500 ; }
.status-off { color: var(--muted) ; }

.edit-drawer { width: 360px ; max-width: 92vw ; background: var(--surface) ; border-left: 1px solid var(--divider) ; padding: 28px ; overflow-y: auto ; }
.swatches { display: flex ; gap: 8px ; flex-wrap: wrap ; }
.swatch { width: 26px ; height: 26px ; border-radius: 50% ; border: 2px solid transparent ; padding: 0 ; }
.swatch.sel { outline: 2px solid var(--royal) ; outline-offset: 2px ; }
.seg { display: flex ; border: 1px solid var(--border) ; border-radius: 8px ; overflow: hidden ; }
.seg button { flex: 1 ; padding: 8px ; font-size: 13px ; background: var(--surface) ; color: var(--ink) ; border: 0 ; }
.seg button.active { background: var(--royal) ; color: #fff ; }
.check-row { display: flex ; align-items: center ; gap: 10px ; padding: 8px 4px ; font-size: 13px ; background: none ; border: 0 ; width: 100% ; text-align: left ; color: var(--ink) ; }
.check-row .box { width: 16px ; height: 16px ; border: 1.5px solid var(--faint) ; border-radius: 4px ; flex: none ; color: #fff ; font-size: 11px ; line-height: 14px ; text-align: center ; }
.check-row .box.on { background: var(--royal) ; border-color: var(--royal) ; }
.dev-row { display: flex ; align-items: center ; gap: 10px ; padding: 10px 0 ; border-bottom: 1px solid var(--row-faint) ; font-size: 13px ; }
.dev-kind { font-family: var(--mono) ; font-size: 11px ; font-weight: 700 ; color: var(--royal) ; }
.dev-meta { font-size: 11px ; color: var(--muted) ; }
.dev-out { margin-left: auto ; color: var(--red) ; background: none ; border: 0 ; font-size: 12px ; }
.empty-dashed { border: 1.5px dashed var(--border) ; border-radius: 10px ; padding: 18px ; font-size: 12px ; color: var(--muted) ; text-align: center ; }

.group-cards { display: grid ; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)) ; gap: 16px ; margin-bottom: 24px ; }
.gcard { background: var(--surface) ; border: 1px solid var(--divider) ; border-radius: 12px ; overflow: hidden ; }
.gcard .band { height: 6px ; }
.gcard .inner { padding: 16px ; }
.gcard h3 { margin: 0 ; font-size: 17px ; font-weight: 600 ; }
.gcard .count { font-size: 12px ; color: var(--muted) ; margin-bottom: 10px ; }
.member-chip { display: inline-flex ; align-items: center ; gap: 6px ; border: 1px solid var(--border) ; border-radius: 999px ;
	padding: 3px 10px 3px 4px ; font-size: 12px ; margin: 0 4px 6px 0 ; background: var(--surface) ; color: var(--ink) ; }
.member-chip .mini { width: 18px ; height: 18px ; border-radius: 50% ; color: #fff ; font-size: 9px ; display: inline-flex ; align-items: center ; justify-content: center ; }
.gcard .acts { margin-top: 8px ; display: flex ; gap: 12px ; }
.gcard .acts button { background: none ; border: 0 ; font-size: 12px ; color: var(--royal) ; padding: 0 ; }
.gcard .acts button.danger { color: var(--red) ; }

.action-bar { background: #0B1B3F ; color: #fff ; border-radius: 12px ; padding: 14px 18px ; display: flex ; align-items: center ; gap: 16px ; margin-top: 16px ; flex-wrap: wrap ; }
.action-bar .n { font-size: 14px ; font-weight: 600 ; }
.action-bar .file { font-family: var(--mono) ; font-size: 12px ; color: #9AA8C4 ; }
.action-bar .seg { border-color: #3E4C6B ; }
.action-bar .seg button { background: #0B1B3F ; color: #fff ; }
.action-bar .seg button.active { background: #00338D ; }
.action-bar .btn-red { margin-left: auto ; }

/* ---------- Phone ---------- */
.pillstrip { display: none ; }
.m2 { display: none ; }
.dots { display: none ; background: none ; border: 0 ; color: var(--royal) ; font-size: 18px ; font-weight: 700 ; letter-spacing: 2px ; padding: 2px 8px ; }
[data-theme='b'] .dots { color: var(--muted) ; }
@media (max-width: 700px) {
	.strip, .statusbar { display: none ; }
	.pane.pane-side { display: none ; }
	.panes.two .editor { padding-left: 20px ; padding-right: 20px ; }
	.ed-header { padding: 8px 16px 10px ; }
	.ed-actions { display: none ; }
	.dots { display: block ; margin-left: auto ; }
	.editor { padding: 18px 20px ; line-height: 1.6 ; }
	[data-theme='b'] .line::before { display: none ; }
	.line .cb { width: 22px ; height: 22px ; border-radius: 6px ; }
	.pillstrip { display: flex ; align-items: center ; gap: 8px ; background: var(--bg) ; border-top: 1px solid var(--divider) ;
		padding: 8px 12px calc(10px + env(safe-area-inset-bottom)) ; overflow-x: auto ; scrollbar-width: none ; }
	.pillstrip::-webkit-scrollbar { display: none ; }
	.count-sq { width: 38px ; height: 38px ; flex: none ; border-radius: 12px ; background: var(--royal) ; color: #fff ; font-weight: 600 ; border: 0 ; }
	.pill { display: inline-flex ; align-items: center ; gap: 7px ; height: 38px ; padding: 0 14px ; border-radius: 999px ; font-size: 13px ;
		font-weight: 500 ; background: var(--surface) ; border: 1px solid var(--border) ; color: var(--ink) ; white-space: nowrap ; flex: none ; }
	.pill.active { background: var(--royal) ; border-color: var(--royal) ; color: #fff ; }
	.pill.add { border-style: dashed ; width: 38px ; padding: 0 ; justify-content: center ; }
	.hint { font-size: 11px ; color: var(--muted) ; text-align: center ; padding: 4px 0 ; }
	.m2 { display: block ; position: fixed ; inset: 0 ; z-index: 48 ; background: var(--tint) ; overflow-y: auto ; padding: 18px 16px calc(16px + env(safe-area-inset-bottom)) ; }
	.m2 h2 { font-size: 22px ; font-weight: 600 ; margin: 0 0 12px ; display: flex ; justify-content: space-between ; align-items: center ; }
	.m2 .sect { font-size: 11px ; font-weight: 600 ; letter-spacing: .06em ; text-transform: uppercase ; color: var(--muted) ; margin: 16px 0 8px ; }
	.m2-grid { display: grid ; grid-template-columns: 1fr 1fr ; gap: 10px ; }
	.m2-card { background: var(--surface) ; border-radius: 12px ; border: 1.5px solid #DCE2EE ; padding: 10px ; text-align: left ; }
	.m2-card.active { border-color: var(--royal) ; }
	.m2-card .head { display: flex ; align-items: center ; gap: 6px ; font-size: 12px ; font-weight: 600 ; margin-bottom: 6px ; color: var(--ink) ; }
	.m2-card pre { margin: 0 ; font-family: var(--mono) ; font-size: 9px ; height: 84px ; overflow: hidden ; color: var(--text-2) ; }
	.m2 .bottom { display: flex ; gap: 10px ; margin-top: 20px ; }
	.m2 .bottom button { flex: 1 ; height: 44px ; border-radius: 12px ; font-size: 14px ; font-weight: 500 ; }
	.auth-card { padding: 28px 22px ; }
	.pin-box { width: 50px ; height: 50px ; }
	.portal { flex-direction: column ; }
	.side { width: 100% ; flex-direction: row ; align-items: center ; gap: 4px ; padding: 10px 12px ; border-right: 0 ; border-bottom: 1px solid var(--divider) ; }
	.side .subword { margin: 0 ; }
	.side .foot { margin-left: auto ; margin-top: 0 ; }
	.portal-main { padding: 16px ; }
	.users-grid { grid-template-columns: 1.4fr 1fr .7fr ; }
	.users-grid .hide-sm { display: none ; }
	.export-grid { grid-template-columns: 36px 1.6fr 1fr ; }
	.export-grid .hide-sm { display: none ; }
	.owns-grid { grid-template-columns: 1.6fr 1fr ; }
	.owns-grid .hide-sm { display: none ; }
	.edit-drawer { width: 100vw ; }
	.popover.sheet { left: 12px !important ; right: 12px ; min-width: 0 ; }
	.popover.sheet .item { padding: 12px 10px ; font-size: 15px ; }
}
