/* SKL CRM — screens and views */

.mono { font-family: var(--font-mono); font-size: 13px; }
.prewrap { white-space: pre-wrap; }
.tags { display: flex; flex-wrap: wrap; gap: 4px; min-width: 0; }
.tags .tag { max-width: 180px; }
.eyebrow { font-size: 12.5px; font-weight: 600; color: var(--text-3); text-transform: capitalize; letter-spacing: 0; }
.fine { font-size: 12px; color: var(--text-3); text-align: center; line-height: 1.5; }
.screen { display: flex; flex-direction: column; min-height: 0; height: 100%; }
.screen-loading { display: grid; place-items: center; height: 100%; }
.page-pad.narrow { max-width: 760px; }
.page-actions { display: flex; align-items: center; gap: 6px; margin-left: auto; }
.page-head.transparent { border-bottom-color: transparent; }
.crumb { color: var(--text-3); font-weight: 500; transition: color var(--dur-1); }
.crumb:hover { color: var(--text); }
.crumb-sep { color: var(--text-4); font-weight: 400; }
.count-pill { font-size: 12.5px; margin-right: 4px; }
.nav-toggle { display: none; margin-left: -6px; }
.nav-toggle.always { display: inline-grid; }
.app.sidebar-collapsed .sidebar-collapse { display: none; }
.sidebar-collapse { opacity: 0; transition: opacity var(--dur-1); }
.sidebar:hover .sidebar-collapse { opacity: 1; }
.nav-item { position: relative; display: flex; align-items: center; gap: 9px; height: 30px; padding: 0 8px; border-radius: 8px; color: var(--text-2); font-weight: 500; font-size: 13.5px; width: 100%; text-align: left; transition: background var(--dur-1), color var(--dur-1); }
.nav-item .obj-icon { width: 18px; height: 18px; border-radius: 5px; }
.nav-item .obj-icon .icon { width: 11px; height: 11px; }
.user-item { height: 36px; }
.nav-drop-end { height: 8px; border-radius: 2px; }
.nav-drop-end.on { background: var(--accent); height: 2px; margin: 3px 8px; }
.nav-scrim { display: none; }
.ws-logo.sm { width: 18px; height: 18px; border-radius: 5px; font-size: 10px; }
.ws-logo.lg { width: 44px; height: 44px; border-radius: 12px; font-size: 19px; }
.app.standalone { grid-template-columns: minmax(0, 1fr); }
.app.standalone .main { margin: 8px; }

/* Object icon sizes */
.obj-icon { width: 22px; height: 22px; border-radius: 6px; display: inline-grid; place-items: center; flex: none; }
.obj-icon .icon { width: 13px; height: 13px; stroke-width: 2; }
.obj-icon.xs { width: 16px; height: 16px; border-radius: 4px; }
.obj-icon.xs .icon { width: 10px; height: 10px; }
.obj-icon.sm { width: 18px; height: 18px; border-radius: 5px; }
.obj-icon.sm .icon { width: 11px; height: 11px; }
.obj-icon.lg { width: 32px; height: 32px; border-radius: 9px; }
.obj-icon.lg .icon { width: 17px; height: 17px; stroke-width: 1.8; }
.obj-icon.xl { width: 44px; height: 44px; border-radius: 12px; }
.obj-icon.xl .icon { width: 22px; height: 22px; stroke-width: 1.7; }
.icon-pick { border-radius: 12px; transition: transform var(--dur-2) var(--ease-spring); }
.icon-pick:hover { transform: scale(1.06); }
.icon-grid { display: grid; grid-template-columns: repeat(8, 1fr); gap: 2px; }
.icon-cell { aspect-ratio: 1; border-radius: 7px; display: grid; place-items: center; color: var(--text-2); transition: background var(--dur-1), color var(--dur-1); }
.icon-cell:hover { background: var(--bg-hover); color: var(--text); }
.icon-cell.on { background: var(--c-gray-bg); color: var(--c-gray-fg); }
.app-icon { --s: 36px; width: var(--s); height: var(--s); border-radius: calc(var(--s) * .27); display: inline-grid; place-items: center; background: linear-gradient(180deg, #2b2d33, #15161a); color: #fff; box-shadow: 0 1px 2px rgba(0,0,0,.2), inset 0 0 0 .5px rgba(255,255,255,.15), inset 0 1px 0 rgba(255,255,255,.12); flex: none; }
:root[data-theme="dark"] .app-icon { background: linear-gradient(180deg, #f4f5f7, #d9dbe0); color: #111214; }
.modal-icon { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; background: var(--bg-muted); color: var(--text-2); flex: none; }

/* ---------- Auth ---------- */
.auth { min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; position: relative; overflow: hidden auto; background: var(--bg-subtle); height: 100dvh; }
.auth-aurora { position: fixed; inset: 0; pointer-events: none; overflow: hidden; }
.auth-aurora span { position: absolute; width: 60vmax; height: 60vmax; border-radius: 50%; filter: blur(90px); opacity: .5; animation: drift 24s var(--ease-in-out) infinite alternate; }
.auth-aurora span:nth-child(1) { background: radial-gradient(circle, #dfe7ff, transparent 65%); top: -30vmax; left: -15vmax; }
.auth-aurora span:nth-child(2) { background: radial-gradient(circle, #f3e6ff, transparent 65%); bottom: -35vmax; right: -20vmax; animation-duration: 30s; }
.auth-aurora span:nth-child(3) { background: radial-gradient(circle, #e3f7f2, transparent 65%); top: 30%; left: 40%; width: 40vmax; height: 40vmax; animation-duration: 36s; opacity: .35; }
:root[data-theme="dark"] .auth-aurora span { opacity: .12; }
@keyframes drift { to { transform: translate(6vmax, 4vmax) scale(1.08); } }
.auth-top, .auth-bottom { position: relative; display: flex; align-items: center; padding: 20px 28px; }
.auth-brand { display: flex; align-items: center; gap: 10px; font-weight: 650; font-size: 15px; letter-spacing: -0.01em; }
.auth-main { position: relative; flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 24px 16px 40px; gap: 18px; }
.auth-card { width: min(400px, 100%); background: var(--surface); border-radius: 20px; padding: 32px 32px 28px; box-shadow: var(--shadow-lg), var(--hairline); }
.auth-head { margin-bottom: 22px; }
.auth-head.center { text-align: center; }
.auth-head h1 { font-family: var(--font-display); font-size: 24px; font-weight: 680; letter-spacing: -0.025em; line-height: 1.2; }
.auth-head p { color: var(--text-2); margin-top: 6px; font-size: 14.5px; }
.auth-foot { font-size: 14px; color: var(--text-2); }
.auth-bottom { justify-content: space-between; font-size: 12.5px; color: var(--text-3); }
.lang-switch { display: flex; gap: 2px; background: var(--bg-muted); border-radius: 8px; padding: 2px; }
.lang-switch button { padding: 3px 9px; border-radius: 6px; color: var(--text-3); font-size: 12.5px; font-weight: 550; }
.lang-switch button.on { background: var(--surface); color: var(--text); box-shadow: var(--shadow-xs); }
.auth-done { text-align: center; display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 8px 0; }
.auth-done h1 { font-size: 22px; font-weight: 680; letter-spacing: -0.02em; }
.auth-done p { color: var(--text-2); max-width: 300px; }
.auth-done .btn { margin-top: 10px; }
.done-icon { width: 64px; height: 64px; border-radius: 20px; display: grid; place-items: center; background: var(--c-green-bg); color: var(--c-green-fg); margin-bottom: 6px; animation: rise-in var(--dur-4) var(--ease-spring) both; }
.done-icon.warn { background: var(--c-orange-bg); color: var(--c-orange-fg); }
.form-error { display: flex; align-items: center; gap: 8px; padding: 10px 12px; border-radius: 10px; background: var(--danger-soft); color: var(--danger); font-size: 13.5px; font-weight: 500; }
.form-note { display: flex; gap: 8px; padding: 10px 12px; border-radius: 10px; background: var(--bg-muted); color: var(--text-2); font-size: 13px; margin-bottom: 14px; }
.form-note .icon { margin-top: 2px; }
.pw-meter { display: grid; grid-template-columns: repeat(4, 1fr) auto; gap: 4px; align-items: center; margin-top: 8px; }
.pw-meter span { height: 3px; border-radius: 2px; background: var(--border); transition: background var(--dur-3) var(--ease); }
.pw-meter em { font-style: normal; font-size: 11.5px; color: var(--text-3); margin-left: 6px; min-width: 52px; text-align: right; }
.pw-meter[data-score="1"] span:nth-child(-n+1) { background: var(--danger); }
.pw-meter[data-score="2"] span:nth-child(-n+2) { background: var(--warning); }
.pw-meter[data-score="3"] span:nth-child(-n+3) { background: #7cc36b; }
.pw-meter[data-score="4"] span:nth-child(-n+4) { background: var(--success); }
.shake { animation: shake 360ms var(--ease); }
@keyframes shake { 20%, 60% { transform: translateX(-5px); } 40%, 80% { transform: translateX(5px); } }
.invite-art { display: flex; align-items: center; justify-content: center; gap: 10px; margin-bottom: 18px; }
.invite-plus { color: var(--text-4); }
.block-seg { display: flex; }
.block-seg button { flex: 1; justify-content: center; }
.block-seg button.on { background: var(--surface); box-shadow: var(--shadow-xs); }

/* ---------- Settings bits ---------- */
.switch-row { gap: 14px; padding: 2px 0; cursor: pointer; }
.switch-row strong { display: block; font-size: 13.5px; font-weight: 550; }
.switch-row .faint { display: block; font-size: 12.5px; }
.field-list { padding: 4px; }
.field-line { position: relative; display: flex; align-items: center; gap: 10px; padding: 6px 8px; border-radius: 9px; transition: background var(--dur-1); }
.field-line:hover { background: var(--bg-hover); }
.field-line .grip { color: var(--text-4); cursor: grab; opacity: 0; transition: opacity var(--dur-1); }
.field-line:hover .grip { opacity: 1; }
.field-line .ti { width: 26px; height: 26px; border-radius: 7px; display: grid; place-items: center; background: var(--bg-muted); color: var(--text-2); flex: none; }
.field-line-main { display: flex; align-items: baseline; gap: 10px; text-align: left; min-width: 0; }
.field-line-main .faint { font-size: 12.5px; }
.field-line.dragging { opacity: .4; }
.field-line.drop-before::before, .menu-item.drop-target::before { content: ""; position: absolute; left: 8px; right: 8px; top: -1px; height: 2px; border-radius: 2px; background: var(--accent); }
.menu-item { position: relative; }
.list-card { padding: 4px; }
.list-row { display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 10px; border-radius: 9px; text-align: left; font-weight: 500; transition: background var(--dur-1); min-height: 36px; }
.list-row:hover { background: var(--bg-hover); }
.danger-title { color: var(--danger) !important; }
.danger-card { display: flex; align-items: center; gap: 16px; padding: 16px 18px; box-shadow: var(--shadow-xs), inset 0 0 0 1px color-mix(in srgb, var(--danger) 25%, var(--border)); }
.danger-card p { font-size: 13px; margin-top: 2px; }
.settings-card { overflow: hidden; }

/* ---------- Toolbar extras ---------- */
.view-tab { position: relative; }
.view-tab-more { margin-right: -4px; border-radius: 4px; display: grid; place-items: center; width: 16px; height: 16px; color: var(--text-3); }
.view-tab-more:hover { background: var(--bg-active); color: var(--text); }
.tb-btn.icon-only { padding: 0; width: 28px; justify-content: center; }
.view-body { flex: 1; min-height: 0; display: flex; flex-direction: column; position: relative; }

/* ---------- Table ---------- */
.table-wrap { flex: 1; min-height: 0; overflow: auto; outline: none; position: relative; }
.tbl { position: relative; padding-bottom: 80px; }
.tr { display: grid; min-height: 36px; border-bottom: 1px solid var(--border-subtle); }
.td, .th { position: relative; display: flex; align-items: center; min-width: 0; padding: 0 10px; border-right: 1px solid var(--border-subtle); background: var(--bg); font-size: 13.5px; }
.td > * { min-width: 0; }
.th-row { position: sticky; top: 0; z-index: 3; min-height: 34px; border-bottom: 1px solid var(--border); }
.th { background: var(--bg); color: var(--text-2); font-size: 12.5px; font-weight: 550; padding: 0; }
.th-btn { display: flex; align-items: center; gap: 6px; height: 100%; width: 100%; padding: 0 10px; text-align: left; color: inherit; transition: background var(--dur-1); }
.th-btn:hover { background: var(--bg-hover); color: var(--text); }
.th-btn .icon { color: var(--text-3); }
.th.num .th-btn { justify-content: flex-end; }
.sort-ind { color: var(--accent-text) !important; }
.col-resize { position: absolute; right: -3px; top: 0; bottom: 0; width: 6px; cursor: col-resize; z-index: 2; }
.col-resize::after { content: ""; position: absolute; left: 2px; top: 6px; bottom: 6px; width: 2px; border-radius: 2px; background: var(--accent); opacity: 0; transition: opacity var(--dur-1); }
.col-resize:hover::after, body.col-resizing .col-resize:hover::after { opacity: 1; }
body.col-resizing { cursor: col-resize; user-select: none; }
.th-add { padding: 0; }
.th-add button { width: 100%; height: 100%; display: grid; place-items: center; color: var(--text-3); }
.th-add button:hover { background: var(--bg-hover); color: var(--text); }
.td-check { justify-content: center; padding: 0; position: sticky; left: 0; z-index: 2; }
.th.td-check { z-index: 4; }
.td-check .check { opacity: 0; transition: opacity var(--dur-1); }
.tr:hover .td-check .check, .td-check .check.on, .th-row .td-check .check { opacity: 1; }
.th-row .td-check .check:not(.on) { opacity: .5; }
.td.sticky, .th.sticky { position: sticky; left: 40px; z-index: 2; box-shadow: 1px 0 0 var(--border); }
.th.sticky { z-index: 4; }
.tr:hover .td { background: var(--bg-subtle); }
.tr.picked .td { background: color-mix(in srgb, var(--accent-soft) 70%, var(--bg)); }
.td.num { justify-content: flex-end; }
.td.selected { box-shadow: inset 0 0 0 1.5px var(--accent) !important; border-radius: 2px; z-index: 1; }
.td.sticky.selected { box-shadow: inset 0 0 0 1.5px var(--accent), 1px 0 0 var(--border) !important; }
.td.ro { color: var(--text-2); }
.td-fill { border-right: 0; }
.td .title-text { font-weight: 550; cursor: pointer; }
.td .title-text:hover { text-decoration: underline; text-decoration-color: var(--text-4); text-underline-offset: 3px; }
.open-btn { margin-left: auto; display: inline-flex; align-items: center; gap: 4px; height: 22px; padding: 0 7px; border-radius: 6px; font-size: 11.5px; font-weight: 600; color: var(--text-2); background: var(--surface); box-shadow: var(--shadow-xs), inset 0 0 0 1px var(--border-strong); opacity: 0; transform: translateX(4px); transition: opacity var(--dur-1), transform var(--dur-2) var(--ease); flex: none; }
.tr:hover .open-btn { opacity: 1; transform: none; }
.open-btn:hover { color: var(--text); }
.group-head { position: sticky; left: 0; display: flex; align-items: center; gap: 8px; height: 40px; padding: 0 12px; font-weight: 600; font-size: 13px; cursor: pointer; user-select: none; background: var(--bg); border-bottom: 1px solid var(--border-subtle); width: max-content; min-width: 100%; }
.tgroup + .tgroup .group-head { margin-top: 10px; border-top: 1px solid var(--border-subtle); }
.chev { color: var(--text-3); transition: transform var(--dur-2) var(--ease-spring); }
.chev.open { transform: rotate(90deg); }
.add-row { color: var(--text-3); cursor: pointer; border-bottom: 0; }
.add-row .td { border-right: 0; background: transparent !important; gap: 8px; font-size: 13px; }
.add-row:hover .td.sticky { color: var(--text); }
.add-row.active .td.sticky { box-shadow: inset 0 0 0 1.5px var(--accent), 1px 0 0 var(--border); background: var(--surface) !important; }
.add-row .input.bare { font-size: 13.5px; width: 100%; }
.hint-cell { grid-column: span 2; font-size: 12px; }
.tfoot { border-bottom: 0; min-height: 34px; }
.tfoot .td { background: var(--bg); border-right: 0; font-size: 12.5px; gap: 4px; }
.load-more { display: flex; justify-content: center; padding: 16px; }
.td .rating .icon { width: 13px; height: 13px; }
.td .tags { flex-wrap: nowrap; overflow: hidden; }

.bulk-bar { position: absolute; left: 50%; bottom: 18px; transform: translateX(-50%); z-index: 20; display: flex; align-items: center; gap: 4px; padding: 5px 5px 5px 14px; border-radius: 14px; background: rgba(28, 29, 32, 0.94); color: #fff; box-shadow: 0 16px 40px -8px rgba(0,0,0,.4), inset 0 0 0 .5px rgba(255,255,255,.1); backdrop-filter: blur(16px); animation: toast-in var(--dur-3) var(--ease-spring) both; }
:root[data-theme="dark"] .bulk-bar { background: rgba(52, 54, 60, 0.96); }
.bulk-n { font-size: 13px; font-weight: 600; padding-right: 6px; white-space: nowrap; }
.bulk-bar .vdivider { background: rgba(255,255,255,.18); }
.bulk-btn { display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 10px; border-radius: 9px; font-size: 13px; font-weight: 550; color: rgba(255,255,255,.9); transition: background var(--dur-1); }
.bulk-btn:hover { background: rgba(255,255,255,.12); }
.bulk-btn.danger { color: #ff9592; }
.bulk-btn.icon { width: 30px; padding: 0; justify-content: center; }

/* ---------- Kanban ---------- */
.kanban { flex: 1; min-height: 0; display: flex; gap: 12px; padding: 14px 20px 20px; overflow-x: auto; align-items: flex-start; background: var(--bg-subtle); }
.kb-col { width: 288px; flex: none; display: flex; flex-direction: column; max-height: 100%; border-radius: 14px; background: var(--bg-muted); transition: background var(--dur-2), box-shadow var(--dur-2); }
:root[data-theme="dark"] .kb-col { background: var(--surface); }
.kb-col.target { background: color-mix(in srgb, var(--accent-soft) 60%, var(--bg-muted)); box-shadow: inset 0 0 0 1.5px var(--accent-ring); }
.kb-col.done .kb-card-title { color: var(--text-2); }
.kb-head { display: flex; align-items: center; gap: 8px; padding: 10px 8px 6px 12px; min-height: 42px; }
.kb-title { font-weight: 600; font-size: 13px; }
.kb-hover { opacity: 0; transition: opacity var(--dur-1); }
.kb-col:hover .kb-hover { opacity: 1; }
.kb-cards { display: flex; flex-direction: column; gap: 6px; padding: 2px 8px 8px; overflow-y: auto; min-height: 60px; }
.kb-card { position: relative; background: var(--surface); border-radius: 11px; padding: 10px 12px; box-shadow: 0 1px 2px rgba(20,28,48,.06), inset 0 0 0 1px var(--border); cursor: grab; user-select: none; text-align: left; transition: box-shadow var(--dur-2) var(--ease), transform var(--dur-2) var(--ease), opacity var(--dur-2); touch-action: none; }
:root[data-theme="dark"] .kb-card { background: var(--surface-raised); }
.kb-card:hover { box-shadow: var(--shadow-md), inset 0 0 0 1px var(--border-strong); }
.kb-card:focus-visible { box-shadow: var(--ring), inset 0 0 0 1px var(--accent); }
.kb-card.ghosted { opacity: .35; box-shadow: none; }
.kb-card-title { font-weight: 550; font-size: 13.5px; line-height: 1.35; }
.kb-ghost { position: fixed; z-index: 500; pointer-events: none; box-shadow: var(--shadow-xl), inset 0 0 0 1px var(--border); cursor: grabbing; transition: transform 40ms linear; will-change: transform; }
.kb-ghost.settling { transition: transform 170ms var(--ease); }
body.dragging-card, body.dragging-card * { cursor: grabbing !important; }
.kb-placeholder { border-radius: 11px; background: color-mix(in srgb, var(--accent) 7%, transparent); box-shadow: inset 0 0 0 1.5px dashed var(--accent-ring); border: 1.5px dashed var(--accent-ring); animation: ph-in var(--dur-2) var(--ease) both; flex: none; }
@keyframes ph-in { from { height: 0 !important; opacity: 0; } }
.kb-add { display: flex; align-items: center; gap: 6px; height: 32px; padding: 0 8px; border-radius: 9px; color: var(--text-3); font-size: 13px; font-weight: 500; transition: background var(--dur-1), color var(--dur-1); }
.kb-add:hover { background: var(--bg-hover); color: var(--text); }
.kb-col.collapsed { width: 44px; padding: 12px 0; align-items: center; gap: 10px; cursor: pointer; writing-mode: vertical-rl; }
.kb-col.collapsed .tag { writing-mode: vertical-rl; height: auto; padding: 8px 0; width: 22px; }
.card-fields { display: flex; flex-direction: column; gap: 5px; margin-top: 8px; font-size: 12.5px; color: var(--text-2); }
.cf { display: flex; align-items: center; gap: 6px; min-width: 0; }
.cf .tag { height: 20px; font-size: 12px; }

/* ---------- Calendar ---------- */
.calendar { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.cal-bar { display: flex; align-items: center; gap: 10px; padding: 12px 20px; }
.cal-title { font-family: var(--font-display); font-size: 18px; font-weight: 650; letter-spacing: -0.02em; text-transform: capitalize; }
.cal-head { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); padding: 0 20px; }
.cal-head div { padding: 6px 8px; font-size: 11.5px; font-weight: 600; color: var(--text-3); text-transform: uppercase; letter-spacing: .04em; }
.cal-grid { flex: 1; min-height: 0; display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); margin: 0 20px 20px; border-radius: 14px; overflow: hidden; box-shadow: inset 0 0 0 1px var(--border); gap: 1px; background: var(--border); }
.calendar.week .cal-grid { grid-template-rows: 1fr; }
.cal-day { background: var(--bg); padding: 6px; display: flex; flex-direction: column; gap: 4px; min-height: 96px; min-width: 0; overflow: hidden; transition: background var(--dur-1); }
.cal-day.weekend { background: color-mix(in srgb, var(--bg-subtle) 60%, var(--bg)); }
.cal-day.outside { background: var(--bg-subtle); }
.cal-day.outside .cal-num { color: var(--text-4); }
.cal-day.over { background: var(--accent-soft); }
.cal-date { display: flex; align-items: center; justify-content: space-between; }
.cal-num { font-size: 12.5px; font-weight: 600; color: var(--text-2); min-width: 24px; height: 24px; display: inline-grid; place-items: center; border-radius: 12px; padding: 0 6px; }
.cal-day.today .cal-num { background: var(--danger); color: #fff; }
.cal-add { width: 22px; height: 22px; border-radius: 6px; display: grid; place-items: center; color: var(--text-3); opacity: 0; transition: opacity var(--dur-1), background var(--dur-1); }
.cal-day:hover .cal-add { opacity: 1; }
.cal-add:hover { background: var(--bg-hover); color: var(--text); }
.cal-events { display: flex; flex-direction: column; gap: 2px; min-height: 0; overflow-y: auto; }
.cal-event { display: flex; align-items: center; gap: 5px; height: 22px; padding: 0 6px; border-radius: 6px; font-size: 12px; font-weight: 550; text-align: left; background: var(--c-gray-bg); color: var(--c-gray-fg); flex: none; cursor: pointer; transition: transform var(--dur-1), box-shadow var(--dur-1), opacity var(--dur-1); }
.cal-event:hover { box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--c-gray-dot) 40%, transparent); }
.cal-event .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--c-gray-dot); flex: none; }
.cal-event.dragging { opacity: .4; }
.cal-time { opacity: .75; flex: none; }
.cal-more { font-size: 11.5px; font-weight: 600; color: var(--text-3); padding: 2px 6px; border-radius: 5px; text-align: left; }
.cal-more:hover { background: var(--bg-hover); color: var(--text); }
.calendar.week .cal-day { min-height: 0; }
.calendar.week .cal-event { height: auto; min-height: 26px; padding: 4px 7px; white-space: normal; }

/* ---------- Gallery ---------- */
.gallery-wrap { flex: 1; min-height: 0; overflow-y: auto; }
.gallery-bar { padding: 10px 20px 0; }
.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 14px; padding: 14px 20px 40px; }
.g-card { display: flex; flex-direction: column; text-align: left; background: var(--surface); border-radius: 14px; overflow: hidden; box-shadow: var(--shadow-xs), var(--hairline); transition: box-shadow var(--dur-2) var(--ease), transform var(--dur-2) var(--ease); }
.g-card:hover { box-shadow: var(--shadow-md), var(--hairline); transform: translateY(-2px); }
.g-cover { aspect-ratio: 16 / 10; background: linear-gradient(135deg, var(--c-gray-bg), color-mix(in srgb, var(--c-gray-dot) 25%, var(--c-gray-bg))); display: grid; place-items: center; overflow: hidden; }
.g-cover img { width: 100%; height: 100%; object-fit: cover; }
.g-initials { font-family: var(--font-display); font-size: 30px; font-weight: 650; color: var(--c-gray-fg); opacity: .7; letter-spacing: -0.02em; }
.g-body { padding: 12px 14px 14px; }
.g-title { font-weight: 600; font-size: 14px; }
.g-new { align-items: center; justify-content: center; gap: 8px; color: var(--text-3); min-height: 200px; background: transparent; box-shadow: inset 0 0 0 1.5px var(--border); border: 0; }
.g-new:hover { color: var(--text); background: var(--bg-subtle); box-shadow: inset 0 0 0 1.5px var(--border-strong); }

/* ---------- Record ---------- */
.record { display: flex; flex-direction: column; min-height: 0; }
.record.sheet-mode { height: 100%; }
.sheet-bar { display: flex; align-items: center; gap: 2px; padding: 10px 12px 6px; flex: none; }
.sheet-body { flex: 1; overflow-y: auto; padding: 4px 24px 32px; }
.record-head { display: flex; align-items: center; gap: 14px; padding: 8px 0 18px; }
.record-title { font-family: var(--font-display); font-size: 22px !important; font-weight: 680; letter-spacing: -0.022em; line-height: 1.25; width: 100%; color: var(--text); }
.record-title.input.bare { height: auto; padding: 2px 0; border-radius: 6px; }
.record-title.input.bare:hover { background: var(--bg-hover); box-shadow: 0 0 0 4px var(--bg-hover); }
.record-title.input.bare:focus { background: transparent; box-shadow: 0 0 0 4px var(--accent-soft); }
.record-meta { display: flex; align-items: center; gap: 6px; margin-top: 3px; font-size: 12.5px; color: var(--text-3); }
.record.page { display: grid; grid-template-columns: minmax(0, 1fr) 380px; min-height: 100%; }
.record-main { padding: 20px 32px 48px; min-width: 0; }
.record-side { border-left: 1px solid var(--border-subtle); padding: 20px 18px 40px; background: var(--bg-subtle); }
.side-title { font-size: 12px; font-weight: 600; color: var(--text-3); margin: 0 0 8px 4px; gap: 6px; }
.sheet-fields { margin: 0 -8px 8px; }
.fields-panel { display: flex; flex-direction: column; }
.fp-row { display: grid; grid-template-columns: 150px minmax(0, 1fr); align-items: start; gap: 8px; min-height: 34px; }
.fp-label { display: flex; align-items: center; gap: 8px; height: 34px; padding: 0 8px; color: var(--text-3); font-size: 13px; min-width: 0; }
.fp-value { display: flex; align-items: center; min-height: 34px; padding: 5px 8px; border-radius: 8px; font-size: 13.5px; min-width: 0; transition: background var(--dur-1), box-shadow var(--dur-1); cursor: pointer; flex-wrap: wrap; }
.fp-value:hover { background: var(--bg-hover); }
.fp-value:focus-visible { box-shadow: var(--ring); }
.fp-value.ro { cursor: default; }
.fp-value.ro:hover { background: transparent; }
.fp-value.editing { background: var(--bg-hover); }
.fp-value.empty .faint { color: var(--text-4); }
.fp-value .prewrap { line-height: 1.5; }
.fp-toggle { display: flex; align-items: center; gap: 8px; height: 30px; padding: 0 8px; margin-top: 4px; border-radius: 8px; color: var(--text-3); font-size: 12.5px; font-weight: 500; }
.fp-toggle:hover { background: var(--bg-hover); color: var(--text); }
.record-side .fp-row { grid-template-columns: 120px minmax(0, 1fr); }
.backlinks { display: flex; flex-direction: column; gap: 16px; margin: 20px 0; }
.bl-list { display: flex; flex-direction: column; gap: 2px; }
.bl-item { display: flex; align-items: center; gap: 8px; height: 32px; padding: 0 10px; border-radius: 8px; text-align: left; font-weight: 500; background: var(--surface); box-shadow: var(--hairline); transition: box-shadow var(--dur-1), transform var(--dur-1); }
.bl-item:hover { box-shadow: var(--shadow-sm), inset 0 0 0 1px var(--border-strong); }
.bl-item .icon { margin-left: auto; }
.record-tabs { margin-top: 12px; }
.tabs-line { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 16px; }
.tab { position: relative; display: inline-flex; align-items: center; gap: 7px; height: 38px; padding: 0 10px; font-size: 13.5px; font-weight: 550; color: var(--text-3); transition: color var(--dur-1); }
.tab:hover { color: var(--text); }
.tab.on { color: var(--text); }
.tab.on::after { content: ""; position: absolute; left: 6px; right: 6px; bottom: -1px; height: 2px; border-radius: 2px; background: var(--text); animation: grow-x var(--dur-3) var(--ease-spring) both; }
@keyframes grow-x { from { transform: scaleX(.4); opacity: 0; } }
.tab-n { min-width: 18px; height: 18px; border-radius: 9px; padding: 0 5px; font-size: 11px; background: var(--bg-muted); color: var(--text-2); display: grid; place-items: center; }
.tab-body { animation: fade-in var(--dur-2) var(--ease) both; }

.composer { display: flex; gap: 10px; padding: 10px 12px; border-radius: 14px; background: var(--surface); box-shadow: var(--shadow-xs), inset 0 0 0 1px var(--border); transition: box-shadow var(--dur-2); margin-bottom: 18px; }
.composer.focused { box-shadow: var(--shadow-md), inset 0 0 0 1px var(--border-strong); }
.composer .textarea.bare { min-height: 0; resize: none; padding: 3px 0; width: 100%; font-size: 14px; }
.composer-foot { display: flex; align-items: center; gap: 8px; padding-top: 8px; }
.tl-list { list-style: none; margin: 0; padding: 0; position: relative; }
.tl-list::before { content: ""; position: absolute; left: 13px; top: 8px; bottom: 8px; width: 1px; background: var(--border); }
.tl-item { position: relative; display: flex; gap: 12px; padding: 7px 0; }
.tl-item.act { align-items: flex-start; }
.tl-icon { position: relative; z-index: 1; width: 28px; height: 22px; display: grid; place-items: center; flex: none; }
.tl-icon .icon { width: 22px; height: 22px; padding: 5px; border-radius: 50%; background: var(--bg); box-shadow: inset 0 0 0 1px var(--border); color: var(--text-3); }
.tl-text { font-size: 13px; color: var(--text-2); line-height: 22px; }
.tl-changes { display: flex; flex-direction: column; gap: 4px; margin-top: 6px; }
.tl-change { display: grid; grid-template-columns: minmax(70px, 120px) auto 14px auto; align-items: center; gap: 8px; font-size: 12.5px; min-width: 0; }
.chg-from { opacity: .6; text-decoration: line-through; text-decoration-color: var(--text-4); min-width: 0; overflow: hidden; }
.chg-to { min-width: 0; overflow: hidden; }
.tl-item.note .avatar { position: relative; z-index: 1; box-shadow: 0 0 0 3px var(--bg); }
.note-card { background: var(--surface); border-radius: 12px; padding: 10px 14px 12px; box-shadow: var(--shadow-xs), inset 0 0 0 1px var(--border); min-width: 0; }
.note-head { display: flex; align-items: center; gap: 8px; font-size: 13px; margin-bottom: 4px; min-height: 24px; }
.note-actions { display: flex; opacity: 0; transition: opacity var(--dur-1); }
.note-card:hover .note-actions { opacity: 1; }
.note-body { white-space: pre-wrap; font-size: 14px; line-height: 1.55; word-wrap: break-word; }

.task-list { display: flex; flex-direction: column; }
.task-list.padded { padding: 4px; }
.task-row { display: flex; align-items: center; gap: 12px; padding: 8px 10px; border-radius: 10px; transition: background var(--dur-1); min-height: 44px; }
.task-row:hover { background: var(--bg-hover); }
.task-row .check.round { transition: transform var(--dur-2) var(--ease-spring), background var(--dur-2); }
.task-row .check.round.on { transform: scale(1.05); }
.task-main { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.task-title { font-size: 14px; font-weight: 500; transition: color var(--dur-2), opacity var(--dur-2); }
.task-row.done .task-title { color: var(--text-3); text-decoration: line-through; text-decoration-color: var(--text-4); }
.task-meta { display: flex; align-items: center; gap: 10px; font-size: 12px; color: var(--text-3); min-width: 0; }
.task-meta:empty { display: none; }
.due { display: inline-flex; align-items: center; gap: 4px; font-weight: 550; }
.due.today { color: var(--warning); }
.due.overdue { color: var(--danger); }
.task-record { display: inline-flex; align-items: center; gap: 5px; min-width: 0; max-width: 240px; color: var(--text-2); font-weight: 500; }
.task-record:hover { color: var(--text); }
.task-actions { opacity: 0; transition: opacity var(--dur-1); }
.task-row:hover .task-actions { opacity: 1; }
.task-composer { display: flex; align-items: center; gap: 10px; padding: 6px 10px; min-height: 44px; flex-wrap: wrap; }
.task-composer .input.bare { font-size: 14px; min-width: 160px; }
.composer-card { margin-bottom: 20px; }
.record-tasks .task-composer { border-radius: 12px; box-shadow: inset 0 0 0 1px var(--border); margin-bottom: 8px; }

.dropzone { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; min-height: 110px; border-radius: 14px; border: 1.5px dashed var(--border-strong); color: var(--text-3); font-size: 13px; font-weight: 500; cursor: pointer; transition: background var(--dur-2), border-color var(--dur-2), color var(--dur-2), transform var(--dur-2) var(--ease-spring); }
.dropzone:hover { background: var(--bg-subtle); color: var(--text-2); }
.dropzone.over { background: var(--accent-soft); border-color: var(--accent); color: var(--accent-text); transform: scale(1.01); }
.file-list { display: flex; flex-direction: column; gap: 2px; margin-top: 12px; }
.file-row { display: flex; align-items: center; gap: 10px; padding: 6px 8px; border-radius: 10px; }
.file-row:hover { background: var(--bg-hover); }
.file-thumb { width: 36px; height: 36px; border-radius: 8px; object-fit: cover; flex: none; display: grid; place-items: center; background: var(--bg-muted); color: var(--text-3); box-shadow: inset 0 0 0 1px var(--border); }

/* ---------- Home ---------- */
.home-hero h1 { font-size: 32px; }
.stat-row { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-bottom: 20px; }
.stat { display: flex; flex-direction: column; gap: 2px; padding: 16px 18px; }
.stat-icon { width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center; background: var(--bg-muted); color: var(--text-2); margin-bottom: 10px; }
.stat.danger .stat-icon { background: var(--danger-soft); color: var(--danger); }
.stat.danger .stat-value { color: var(--danger); }
.stat-value { font-family: var(--font-display); font-size: 26px; font-weight: 680; letter-spacing: -0.03em; line-height: 1.1; }
.stat-label { font-size: 12.5px; color: var(--text-3); font-weight: 500; }
.home-grid { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 16px; }
.home-card { display: flex; flex-direction: column; min-height: 280px; }
.home-card .card-head .icon { color: var(--text-3); }
.card-pad { padding: 0 8px 10px; }
.list-tight .list-row { padding: 7px 8px; }
.soft-empty { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 36px 16px; color: var(--text-3); font-size: 13.5px; text-align: center; }
.soft-empty .icon { width: 22px; height: 22px; }
.object-tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 10px; }
.object-tile { display: flex; align-items: center; gap: 12px; padding: 14px 14px; text-align: left; position: relative; }
.object-tile strong { display: block; font-weight: 600; }
.object-tile .faint { display: block; font-size: 12.5px; }
.object-tile.dashed { background: transparent; box-shadow: inset 0 0 0 1.5px var(--border); }
.object-tile.dashed:hover { background: var(--bg-subtle); }
.object-tile.dashed .obj-icon { background: var(--bg-muted); color: var(--text-3); }
.tile-add { opacity: 0; transition: opacity var(--dur-1); }
.object-tile:hover .tile-add { opacity: 1; }
.activity-feed { padding: 4px; }
.feed-row { display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 10px; border-radius: 9px; text-align: left; font-size: 13.5px; color: var(--text-2); }
.feed-row:hover { background: var(--bg-hover); }
.feed-row strong { color: var(--text); font-weight: 550; }
.feed-title { color: var(--text); font-weight: 550; }

/* ---------- Tasks / Inbox ---------- */
.task-group .section-title { margin-top: 22px; }
.inbox-list { padding: 4px; }
.inbox-row { position: relative; display: flex; align-items: center; gap: 12px; width: 100%; padding: 10px 12px; border-radius: 10px; text-align: left; }
.inbox-row:hover { background: var(--bg-hover); }
.inbox-icon { width: 32px; height: 32px; border-radius: 10px; display: grid; place-items: center; background: var(--bg-muted); color: var(--text-2); flex: none; }
.inbox-icon[data-type="automation"] { background: var(--c-yellow-bg); color: var(--c-yellow-fg); }
.inbox-icon[data-type="task"] { background: var(--c-blue-bg); color: var(--c-blue-fg); }
.inbox-title { display: block; font-weight: 500; }
.inbox-row.unread .inbox-title { font-weight: 650; }
.inbox-body { display: block; font-size: 12.5px; color: var(--text-3); }
.unread-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--c-blue-dot); flex: none; animation: pulse-dot 2s var(--ease-in-out) infinite; }

/* ---------- Theme swap ---------- */
::view-transition-old(root), ::view-transition-new(root) { mix-blend-mode: normal; }
.theme-swap::view-transition-old(root) { animation: 260ms var(--ease) both fade-out; }
.theme-swap::view-transition-new(root) { animation: 260ms var(--ease) both fade-in; }

/* ---------- Responsive ---------- */
@media (max-width: 1100px) {
  .record.page { grid-template-columns: minmax(0, 1fr) 320px; }
  .home-grid { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 860px) {
  .app { grid-template-columns: minmax(0, 1fr); }
  .sidebar { position: fixed; z-index: 120; top: 0; bottom: 0; left: 0; width: 280px; background: var(--bg-subtle); transform: translateX(-100%); transition: transform var(--dur-3) var(--ease); box-shadow: var(--shadow-xl); visibility: visible !important; }
  .app.nav-open .sidebar { transform: none; }
  .nav-scrim { display: block; position: fixed; inset: 0; z-index: 110; background: var(--overlay); opacity: 0; pointer-events: none; transition: opacity var(--dur-3); }
  .app.nav-open .nav-scrim { opacity: 1; pointer-events: auto; }
  .main { margin: 0 !important; border-radius: 0; box-shadow: none; }
  .nav-toggle { display: inline-grid; }
  .sidebar-collapse { display: none; }
  .page-pad { padding: 20px 16px 40px; }
  .stat-row { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .record.page { grid-template-columns: minmax(0, 1fr); }
  .record-side { border-left: 0; border-top: 1px solid var(--border-subtle); }
  .record-main { padding: 16px; }
  .sheet { top: auto; left: 0; right: 0; bottom: 0; width: 100% !important; height: 92dvh; border-radius: 18px 18px 0 0; animation-name: sheet-up; }
  .sheet.leaving { animation-name: sheet-down; }
  .sheet-body { padding: 4px 16px 32px; }
  .fp-row { grid-template-columns: 120px minmax(0, 1fr); }
  .toolbar { padding: 8px 12px; }
  .search-inline input { width: 120px; }
  .search-inline input:focus { width: 160px; }
  .kanban { padding: 12px; }
  .kb-col { width: 260px; }
  .cal-grid { margin: 0 8px 12px; }
  .cal-head { padding: 0 8px; }
  .cal-day { min-height: 70px; padding: 3px; }
  .cal-event .truncate { display: none; }
  .calendar.week .cal-event .truncate { display: inline; }
  .page-title .crumb, .page-title .crumb-sep { display: none; }
  .auth-card { padding: 26px 22px 22px; border-radius: 18px; }
  .count-pill { display: none; }
}
@keyframes sheet-up { from { transform: translateY(40px); opacity: 0; } }
@keyframes sheet-down { to { transform: translateY(40px); opacity: 0; } }
@media (max-width: 520px) {
  .stat-row { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .page-actions .segmented { display: none; }
  .filter-panel { width: calc(100vw - 16px) !important; }
  .filter-rule { grid-template-columns: 1fr 1fr; }
  .filter-rule .conj { grid-column: span 2; }
}
