:root {
  color-scheme: light;
  --page: #f7f8fc;
  --surface: #fff;
  --surface-subtle: #f8f9fc;
  --surface-hover: #f0f1f8;
  --sidebar: #fcfcfe;
  --canvas: #f5f6fb;
  --grid-dot: #d7daea;
  --text: #191b2f;
  --muted: #626980;
  --quiet: #70778e;
  --border: #e1e4ef;
  --border-strong: #cbd0e0;
  --accent: #5448e9;
  --accent-hover: #4237d1;
  --accent-text: #493bd7;
  --accent-soft: #eeecff;
  --accent-border: #cbc5ff;
  --green: #147953;
  --green-soft: #e5f6ee;
  --orange: #9b4c15;
  --orange-soft: #fff0e3;
  --red: #a63149;
  --red-soft: #ffedf1;
  --red-solid: #a63149;
  --red-solid-hover: #8d253b;
  --blue: #355fbe;
  --blue-soft: #eaf0ff;
  --shadow-card: 0 2px 3px #23274708, 0 6px 20px #23274709;
  --shadow-float: 0 12px 32px #22254021, 0 2px 8px #22254012;
  --scrim: #17192d70;
  --sidebar-width: 244px;
  --toolbar-height: 65px;
  --radius: 6px;
  --font-sans: "Inter", "Segoe UI", system-ui, -apple-system, sans-serif;
}

[data-theme="dark"] {
  color-scheme: dark;
  --page: #151625;
  --surface: #202235;
  --surface-subtle: #1a1c2e;
  --surface-hover: #292c43;
  --sidebar: #191a2c;
  --canvas: #191b2d;
  --grid-dot: #373b56;
  --text: #f0f1fc;
  --muted: #b4b9d3;
  --quiet: #a0a7c4;
  --border: #343852;
  --border-strong: #525976;
  --accent: #6559f2;
  --accent-hover: #766af8;
  --accent-text: #b3aaff;
  --accent-soft: #302952;
  --accent-border: #5d518f;
  --green: #83d9b8;
  --green-soft: #213e3a;
  --orange: #ffc197;
  --orange-soft: #422e31;
  --red: #ff9aad;
  --red-soft: #442939;
  --blue: #9ab6ff;
  --blue-soft: #293554;
  --shadow-card: 0 2px 3px #0002, 0 6px 20px #0002;
  --shadow-float: 0 12px 32px #0006, 0 2px 8px #0003;
  --scrim: #090a16ac;
}

*, *::before, *::after { box-sizing: border-box; }

html { min-height: 100%; }

body {
  min-width: 280px;
  margin: 0;
  background: var(--page);
  color: var(--text);
  font: 14px/1.5 var(--font-sans);
  -webkit-font-smoothing: antialiased;
}

button, input, select, textarea { color: inherit; font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: default; opacity: .5; }
input, textarea, select { min-width: 0; }
img { display: block; max-width: 100%; }
svg { width: 18px; height: 18px; flex-shrink: 0; vertical-align: middle; }
.icon { fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.icon-library { position: absolute; width: 0; height: 0; overflow: hidden; pointer-events: none; }
a { color: var(--accent-text); }
::selection { background: var(--accent-soft); color: var(--accent-text); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
[hidden] { display: none !important; }

.sr-only, .visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.app-shell { display: grid; grid-template-columns: var(--sidebar-width) minmax(0, 1fr); min-height: 100dvh; }
.app-main, .main-content, #workspace-view { min-width: 0; }

.sidebar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  flex-direction: column;
  height: 100vh;
  height: 100dvh;
  min-height: 0;
  background: var(--sidebar);
  border-right: 1px solid var(--border);
}

.sidebar-backdrop, .mobile-menu, .mobile-nav, .brand .mobile-sidebar-close, .file-mobile-section { display: none; }

.brand {
  display: flex;
  min-height: var(--toolbar-height);
  align-items: center;
  gap: 10px;
  padding: 0 20px;
  color: var(--text);
  text-decoration: none;
}

.brand-mark {
  display: grid;
  width: 33px;
  height: 33px;
  place-items: center;
  flex-shrink: 0;
  color: #fff;
  background: var(--accent);
  border-radius: var(--radius);
  box-shadow: 0 3px 8px #5143dd36;
}

.brand-mark svg { width: 20px; height: 20px; }
.brand-name { font-size: 20px; font-weight: 760; line-height: 1; letter-spacing: -.045em; }

.sidebar-workspace { position: relative; margin: 0 15px 12px; }
.sidebar-project { margin-top: 10px; }
.sidebar-board { margin-bottom: 23px; }

.workspace-trigger {
  display: flex;
  width: 100%;
  align-items: center;
  gap: 9px;
  min-height: 46px;
  padding: 6px 8px;
  color: var(--text);
  text-align: left;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.workspace-trigger:hover, .workspace-trigger[aria-expanded="true"] { border-color: var(--accent-border); }
.workspace-trigger > svg { width: 14px; height: 14px; margin-left: auto; color: var(--muted); }

.workspace-avatar, .profile-avatar {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  flex-shrink: 0;
  background: var(--accent-soft);
  color: var(--accent-text);
  border-radius: 5px;
  font-size: 11px;
  font-weight: 750;
}

.workspace-avatar { width: 30px; height: 30px; }
.sidebar-board .workspace-avatar { background: var(--surface-hover); color: var(--muted); }
.workspace-avatar svg { width: 16px; height: 16px; }

.workspace-info, .profile-copy { display: grid; min-width: 0; line-height: 1.33; }
.workspace-info strong, .profile-copy strong { overflow: hidden; font-size: 13px; font-weight: 690; text-overflow: ellipsis; white-space: nowrap; }
.workspace-info small, .profile-copy small { margin-top: 2px; color: var(--muted); font-size: 11px; }

.sidebar-main { flex: 1; min-height: 0; overflow-y: auto; padding: 0 13px 16px; }
.nav-label { margin: 0 0 7px; padding: 0 9px; color: var(--quiet); font-size: 10px; font-weight: 750; letter-spacing: .085em; text-transform: uppercase; }

.nav-item {
  display: flex;
  width: 100%;
  min-height: 38px;
  align-items: center;
  gap: 10px;
  margin: 2px 0;
  padding: 6px 9px;
  color: var(--muted);
  text-align: left;
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--radius);
  font-size: 13px;
  font-weight: 590;
}

.nav-item:hover { background: var(--surface-hover); color: var(--text); }
.nav-item.is-active, .nav-item[aria-current="page"] { color: var(--accent-text); border-color: var(--accent-soft); background: var(--accent-soft); font-weight: 700; }
.nav-item svg { width: 17px; height: 17px; }
.nav-item > span:not(.section-dot) { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav-item .nav-count, .nav-item .section-count { margin-left: auto; color: var(--quiet); font-size: 11px; font-weight: 600; }

.section-dot { width: 8px; height: 8px; margin: 0 5px 0 4px; flex-shrink: 0; background: var(--section-color, var(--accent)); border-radius: 50%; }
.sidebar-footer { margin-top: auto; padding: 13px 15px; border-top: 1px solid var(--border); }
.profile { display: flex; min-width: 0; align-items: center; gap: 9px; }
.profile > svg, .profile > button { margin-left: auto; }
.profile-avatar { background: var(--surface-hover); color: var(--muted); }
.profile-copy i, .eyebrow i { display: inline-block; width: 6px; height: 6px; flex-shrink: 0; background: var(--accent); border-radius: 50%; }
.profile-copy i { vertical-align: 1px; margin-right: 1px; background: var(--green); }

.topbar {
  position: sticky;
  top: 0;
  z-index: 8;
  display: flex;
  min-height: var(--toolbar-height);
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 10px 32px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}

.topbar-left, .topbar-right, .breadcrumbs { display: flex; min-width: 0; align-items: center; }
.topbar-left, .topbar-right { gap: 10px; }
.breadcrumbs { gap: 8px; color: var(--muted); font-size: 13px; white-space: nowrap; }
.breadcrumbs > * { min-width: 0; }
.breadcrumbs > span, .breadcrumbs > strong { overflow: hidden; text-overflow: ellipsis; }
.breadcrumbs > span { max-width: min(23vw, 255px); }
.breadcrumbs > strong { color: var(--text); font-weight: 680; }
.breadcrumbs svg { width: 13px; height: 13px; color: var(--quiet); }

.search-field {
  display: flex;
  width: clamp(170px, 21vw, 284px);
  min-height: 37px;
  align-items: center;
  gap: 8px;
  padding: 0 9px 0 10px;
  color: var(--quiet);
  background: var(--surface-subtle);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.search-field:focus-within { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-soft); }
.search-field input { width: 100%; padding: 6px 0; background: transparent; border: 0; outline: 0; font-size: 12px; }
.search-field input::placeholder { color: var(--quiet); opacity: 1; }
.search-field svg { width: 16px; height: 16px; }

kbd { display: inline-block; padding: 0 4px; background: var(--surface); color: var(--muted); border: 1px solid var(--border); border-radius: 3px; font: 10px/1.65 var(--font-sans); white-space: nowrap; }

.button, .icon-button, .filter-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 38px;
  border: 1px solid transparent;
  border-radius: var(--radius);
  font-size: 13px;
  font-weight: 680;
  line-height: 1.2;
  text-decoration: none;
  transition: background-color .15s, border-color .15s, color .15s;
}

.button { padding: 8px 12px; white-space: nowrap; }
.button svg { width: 16px; height: 16px; }
.button-primary { background: var(--accent); color: #fff; box-shadow: 0 2px 4px #4940b22e; }
.button-primary:not(:disabled):hover { background: var(--accent-hover); }
.button-secondary, .button-outline { background: var(--surface); border-color: var(--border-strong); color: var(--text); }
.button-secondary:not(:disabled):hover, .button-outline:not(:disabled):hover { background: var(--surface-hover); }
.button-ghost { background: transparent; color: var(--muted); }
.button-ghost:not(:disabled):hover { background: var(--surface-hover); color: var(--text); }
.button-danger { background: var(--red-soft); color: var(--red); }
.button-danger:not(:disabled):hover { border-color: var(--red); }
.button-danger[data-action="trash-file"] { background: var(--red-solid); color: #fff; }
.button-danger[data-action="trash-file"]:hover { background: var(--red-solid-hover); }

.icon-button { width: 36px; min-height: 34px; flex-shrink: 0; padding: 0; background: transparent; color: var(--muted); }
.icon-button:not(:disabled):hover { background: var(--surface-hover); color: var(--text); }
.icon-button[aria-expanded="true"], .icon-button[aria-pressed="true"], .icon-button.is-active { background: var(--accent-soft); color: var(--accent-text); }
.theme-button { width: 37px; min-height: 37px; background: var(--surface); border-color: var(--border); }
.topbar .mobile-menu, .board-zoom-floating, .board-tools-floating { display: none; }

.main-content { width: 100%; max-width: 1640px; margin: 0 auto; padding: 27px 32px 32px; }

.hero { display: flex; align-items: end; justify-content: space-between; flex-wrap: wrap; gap: 16px 20px; margin-bottom: 23px; }
.hero-copy { min-width: 0; }
.eyebrow { display: flex; align-items: center; gap: 7px; width: fit-content; margin: 0 0 7px; color: var(--accent-text); font-size: 10px; font-weight: 780; letter-spacing: .095em; line-height: 1.3; text-transform: uppercase; }
.eyebrow > span:empty, .eyebrow-dot { width: 6px; height: 6px; flex-shrink: 0; background: var(--accent); border-radius: 50%; }
.hero h1, .utility-view h1 { margin: 0; font-size: clamp(29px, 3.2vw, 43px); font-weight: 780; line-height: 1.1; letter-spacing: -.055em; overflow-wrap: anywhere; }
.hero p:not(.eyebrow) { margin: 8px 0 0; color: var(--muted); font-size: 14px; }
.board-actions, .board-controls { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.profile-image { display: block; width: 100%; height: 100%; object-fit: cover; border-radius: inherit; }
.project-overview { margin-bottom: 12px; }
.is-file-view > .hero, .is-file-view #board-options, .is-file-view #board-description, .is-file-view .board-controls { display: none; }
.is-file-view > .stats-grid { gap: 12px; margin-bottom: 12px; }
.project-page-title { display: flex; align-items: center; gap: 12px; margin-bottom: 18px; }
.project-page-title > div { min-width: 0; }
.project-page-title h1 { margin: 0; font-size: clamp(25px, 5vw, 38px); line-height: 1.1; letter-spacing: -.04em; overflow-wrap: anywhere; }
.project-page-title p { margin: 5px 0 0; color: var(--muted); overflow-wrap: anywhere; }
.project-avatar-large { width: 50px; height: 50px; font-size: 16px; }
.project-panels, .project-settings-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: start; gap: 12px; }
.project-panels { align-items: stretch; }
.project-panel { min-width: 0; padding: 14px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
.project-panel h2 { margin: 0 0 9px; font-size: 16px; }
.project-panel > p { margin: 0 0 8px; }
.overview-column { display: grid; min-width: 0; grid-template-rows: auto 1fr; gap: 12px; }
.overview-panel { background: var(--surface-subtle); }
.overview-panel .board-header { min-height: 54px; padding-block: 9px; background: var(--surface); }
.overview-panel .board-actions:empty { display: none; }
.overview-scroll { max-height: 250px; overflow: auto; padding: 8px 12px; border-top: 1px solid var(--border); scrollbar-width: thin; }
.overview-scroll:focus-visible { outline-offset: -2px; }
.overview-scroll > p { margin: 5px 3px; }
.overview-scroll .utility-row { padding-inline: 5px; }
.overview-scroll .utility-row > time { max-width: 12ch; white-space: normal; text-align: end; }
.project-shortcut { display: flex; width: 100%; min-height: 46px; align-items: center; gap: 8px; padding: 5px 9px 5px 6px; background: var(--surface); border: 1px solid var(--border-strong); border-radius: 4px; box-shadow: var(--shadow-card); text-align: left; }
.project-shortcut + .project-shortcut { margin-top: 6px; }
.project-shortcut:hover, .project-shortcut[aria-current="true"] { border-color: var(--accent-border); background: var(--accent-soft); color: var(--accent-text); }
.project-shortcut .stat-icon { width: 32px; height: 32px; }
.project-shortcut .icon { width: 16px; height: 16px; flex-shrink: 0; }
.project-shortcut > .icon { margin-inline-start: auto; }
.project-shortcut strong { min-width: 0; overflow-wrap: anywhere; }
.project-members-summary, .project-member-rules { list-style: none; margin: 0; padding: 0; }
.project-members-summary > li { padding: 7px 0; border-bottom: 1px solid var(--border); }
.project-member-rules { padding: 5px 0 0 12px; font-size: 12px; overflow-wrap: anywhere; }
.project-member-rules span { color: var(--accent-text); margin-inline-start: 4px; }
.project-setting-actions, .resource-settings-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.project-setting-actions { flex-direction: column; align-items: stretch; }
.project-panel .danger, .resource-settings-actions .danger { color: var(--red); }
.avatar-clear { display: flex; align-items: center; gap: 7px; margin: 0 0 12px; }

.stats-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 13px; margin: 0 0 22px; }
.stat-card { display: flex; min-width: 0; min-height: 78px; align-items: center; gap: 12px; padding: 12px 14px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); }
.stat-icon { display: grid; width: 40px; height: 40px; flex-shrink: 0; place-items: center; border-radius: 5px; }
.stat-icon svg { width: 19px; height: 19px; }
.stat-files { background: var(--accent-soft); color: var(--accent-text); }
.stat-sections { background: var(--blue-soft); color: var(--blue); }
.stat-edited { background: var(--green-soft); color: var(--green); }
.stat-copy { display: grid; align-content: center; gap: 1px; min-width: 0; }
.stat-number { overflow: hidden; font-size: 21px; font-weight: 750; letter-spacing: -.035em; line-height: 1.15; text-overflow: ellipsis; white-space: nowrap; }
.stat-label { color: var(--muted); font-size: 12px; line-height: 1.3; }
.stat-date { font-size: 17px; }

.board-panel { position: relative; min-width: 0; overflow: clip; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); }
.board-stage { position: relative; }
.board-grid { display: none; }

.board-header, .board-toolbar, .board-footer {
  display: flex;
  min-width: 0;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  padding: 10px 15px;
}

.board-header { min-height: 65px; padding-block: 12px; }
.board-title { min-width: 0; }
.board-title h2 { margin: 0; font-size: 17px; font-weight: 745; line-height: 1.3; letter-spacing: -.024em; }
.board-title p { margin: 3px 0 0; color: var(--muted); font-size: 12px; }
.board-actions { gap: 7px; }
.board-actions .button { min-height: 33px; padding: 6px 9px; font-size: 12px; }
.board-actions .button svg { width: 15px; height: 15px; }

.board-toolbar { min-height: 49px; padding-block: 7px; border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); }
.board-filters { display: flex; flex: 1; min-width: 0; align-items: center; flex-wrap: wrap; gap: 3px; }
.filter-button { min-height: 30px; padding: 4px 9px; background: transparent; color: var(--muted); font-size: 12px; white-space: nowrap; }
.filter-button svg { width: 14px; height: 14px; }
.filter-button:hover { color: var(--text); background: var(--surface-hover); }
.filter-button.is-active, .filter-button[aria-pressed="true"], .filter-button[aria-selected="true"] { background: var(--accent-soft); color: var(--accent-text); }
.board-controls { justify-content: flex-end; gap: 8px; }
.segmented, .zoom-control { display: inline-flex; align-items: center; flex-shrink: 0; gap: 1px; padding: 2px; background: var(--surface-subtle); border: 1px solid var(--border); border-radius: 5px; }
.segmented .icon-button, .zoom-control .icon-button { width: 28px; min-height: 25px; border-radius: 3px; }
.segmented svg, .zoom-control svg { width: 15px; height: 15px; }
.zoom-control > span, .zoom-control > output, .zoom-control > button:not(.icon-button) { min-width: 40px; padding: 0 2px; color: var(--muted); text-align: center; font-size: 11px; font-weight: 680; font-variant-numeric: tabular-nums; }
.zoom-control > button:not(.icon-button) { background: transparent; border: 0; }
.fit-button { width: 31px; min-height: 31px; background: var(--surface-subtle); border-color: var(--border); }
.fit-button svg { width: 15px; height: 15px; }

.board-viewport {
  position: relative;
  isolation: isolate;
  width: 100%;
  height: clamp(390px, 52vh, 660px);
  overflow: auto;
  background-color: var(--canvas);
  scrollbar-color: var(--border-strong) var(--canvas);
  scrollbar-width: thin;
}

.board-spacer { position: relative; min-width: 100%; min-height: 100%; }
.board-viewport.is-touch-canvas { touch-action: none; background: transparent; }
.board-viewport.is-panning { user-select: none; cursor: grabbing; }
.board-viewport.is-touch-canvas .board-spacer { overflow: clip; }
.board-surface { position: absolute; inset: 0 auto auto 0; overflow: hidden; transform-origin: top left; }
.board-surface.is-list, .board-surface.is-empty { position: relative; overflow: visible; }
.board-item { position: absolute; min-width: 0; min-height: 0; }
.board-viewport.is-dragover, .board-viewport.is-drop-target, .board-panel.is-dragover .board-viewport { outline: 2px dashed var(--accent); outline-offset: -5px; }
.board-viewport:has(.board-surface.is-list) { height: auto; min-height: 280px; overflow: visible; background: var(--surface-subtle); }
.board-spacer:has(.board-surface.is-list) { width: 100%; height: auto; }
.board-surface.is-list { display: grid; width: 100% !important; height: auto !important; min-height: 280px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 232px), 1fr)); align-content: flex-start; gap: 13px; padding: 14px; transform: none !important; zoom: 1 !important; }
.board-surface.is-list .board-item { position: relative; inset: auto; width: auto; height: auto; }

.file-card {
  position: relative;
  display: flex;
  width: 100%;
  height: 100%;
  min-width: 0;
  flex-direction: column;
  padding: 10px;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  box-shadow: var(--shadow-card);
  transition: border-color .14s, box-shadow .14s;
}

.file-card:hover, .file-card:focus-within { border-color: var(--accent-border); box-shadow: 0 0 0 1px var(--accent-soft), var(--shadow-card); }
.file-card-header { display: flex; flex-shrink: 0; min-width: 0; align-items: center; gap: 8px; margin-bottom: 8px; }
.file-icon { display: grid; width: 33px; height: 33px; place-items: center; flex-shrink: 0; background: var(--accent-soft); color: var(--accent-text); border-radius: 4px; }
.file-icon svg { width: 17px; height: 17px; }
.type-text { background: var(--accent-soft); color: var(--accent-text); }
.type-docx { background: var(--blue-soft); color: var(--blue); }
.type-image { background: var(--green-soft); color: var(--green); }
.type-pdf { background: var(--red-soft); color: var(--red); }
.file-heading { display: grid; min-width: 0; flex: 1; gap: 2px; padding: 0; background: transparent; border: 0; line-height: 1.2; text-align: left; }
.file-heading:hover strong { color: var(--accent-text); }
.file-heading strong, .file-heading small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-heading strong { font-size: 12px; font-weight: 725; }
.file-heading small { color: var(--muted); font-size: 10px; }
.file-menu-button { width: 27px; min-height: 27px; margin-left: auto; }
.file-menu-button svg { width: 16px; height: 16px; }

.file-preview {
  position: relative;
  display: block;
  width: 100%;
  min-width: 0;
  min-height: 0;
  height: var(--preview-height, 79px);
  flex: 0 0 auto;
  overflow: hidden;
  padding: 8px 9px;
  background: var(--surface-subtle);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 4px;
  text-align: left;
}

button.file-preview:hover { border-color: var(--accent-border); }
.file-preview img { width: 100%; height: 100%; object-fit: cover; }
.preview-image { padding: 0; }
.preview-text { color: var(--muted); font-size: 10px; line-height: 1.55; overflow-wrap: anywhere; white-space: pre-wrap; }
.preview-text > p, .preview-text > pre { display: -webkit-box; margin: 0; overflow: hidden; -webkit-box-orient: vertical; -webkit-line-clamp: 4; font: inherit; white-space: inherit; }
.preview-lines { display: grid; gap: 3px; }
.preview-line { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.preview-line:first-child { color: var(--text); font-weight: 670; }
.preview-pdf { display: grid; align-content: center; justify-items: center; gap: 4px; background: var(--red-soft); color: var(--red); font-size: 10px; font-weight: 700; text-align: center; }
.preview-pdf svg { width: 23px; height: 23px; }
.paper-lines { display: grid; width: min(50%, 84px); gap: 4px; }
.paper-lines > i, .paper-lines > span { width: 100%; height: 3px; background: currentColor; border-radius: 1px; opacity: .34; }
.paper-lines > :nth-child(2) { width: 78%; }
.paper-lines > :nth-child(3) { width: 88%; }
.pdf-label { font-size: 9px; font-weight: 760; letter-spacing: .08em; }

.file-card-footer { display: flex; min-height: 23px; align-items: center; justify-content: space-between; gap: 8px; margin-top: 6px; }
.file-section { display: inline-flex; max-width: 100%; align-items: center; gap: 5px; overflow: hidden; padding: 2px 5px; background: var(--surface-subtle); border: 1px solid var(--border); border-radius: 3px; color: var(--muted); font-size: 9px; font-weight: 640; line-height: 1.35; text-overflow: ellipsis; white-space: nowrap; }
.file-section > span:empty { width: 5px; height: 5px; flex-shrink: 0; background: var(--section-color, var(--accent)); border-radius: 50%; }
.file-section .section-dot { width: 5px; height: 5px; margin: 0; }
.file-card-footer { flex-wrap: wrap; }
.file-locate { display: inline-flex; min-height: 30px; align-items: center; gap: 5px; margin-inline-start: auto; padding: 3px 7px; border: 1px solid transparent; background: var(--accent-soft); color: var(--accent-text); font-size: 11px; font-weight: 700; }
.file-locate:hover { border-color: var(--accent-border); }
.file-locate .icon { width: 15px; height: 15px; }

.board-section {
  --section-ink: var(--section-color, var(--accent));
  --section-line: color-mix(in srgb, var(--section-ink) 43%, var(--border));
  --section-wash: color-mix(in srgb, var(--section-ink) 7%, transparent);
  position: absolute;
  z-index: 0;
  background: var(--section-wash);
  border: 1px solid var(--section-line);
  border-radius: var(--radius);
}

.board-section-header {
  display: flex;
  height: 34px;
  min-width: 0;
  align-items: center;
  gap: 5px;
  padding: 0 5px 0 8px;
  background: color-mix(in srgb, var(--section-ink) 9%, var(--surface));
  border-bottom: 1px solid var(--section-line);
  border-radius: 5px 5px 0 0;
}

.board-section.is-drop-target {
  z-index: 1;
  background: color-mix(in srgb, var(--section-ink) 17%, transparent);
  border-color: var(--section-ink);
  outline: 2px dashed var(--section-ink);
  outline-offset: -5px;
}

.board-section.is-moving { z-index: 1; user-select: none; }

.section-title {
  display: inline-flex;
  min-width: 0;
  min-height: 28px;
  flex: 1;
  align-items: center;
  gap: 6px;
  padding: 3px 4px;
  background: transparent;
  color: var(--text);
  border: 0;
  border-radius: 3px;
  font-size: 12px;
  font-weight: 740;
  line-height: 1.1;
  text-align: left;
}

.section-title[data-gesture] { touch-action: none; cursor: grab; }
.section-title[data-gesture]:active { cursor: grabbing; }
.section-title > span, .section-title > strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.section-title > svg { width: 15px; height: 15px; color: color-mix(in srgb, var(--section-ink) 72%, var(--text)); }
.section-title .section-dot { margin: 0; }
.board-section-header .section-count { flex-shrink: 0; color: var(--muted); font-size: 11px; font-variant-numeric: tabular-nums; }
.board-section-header .icon-button { width: 27px; min-height: 27px; }
.board-section-header .icon-button svg { width: 16px; height: 16px; }

.board-item.canvas-item { z-index: 2; --resize-hit: 22px; }
.board-item.canvas-item.is-selected, .board-item.canvas-item:focus-within { z-index: 3; }
.board-item.canvas-item.is-moving { z-index: 4; user-select: none; }
.canvas-card { padding: 8px; }
.canvas-item.is-selected .canvas-card { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent), var(--shadow-card); }
.canvas-text { padding: 9px 11px 10px; }
.canvas-title {
  width: 100%;
  flex-shrink: 0;
  overflow: hidden;
  padding: 3px 0 7px;
  background: transparent;
  color: var(--text);
  border: 0;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
  font-weight: 735;
  line-height: 1.3;
  text-align: left;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.canvas-title:hover { color: var(--accent-text); }
.canvas-drag-header[data-gesture="move"] { touch-action: none; user-select: none; cursor: grab; }
.canvas-drag-header[data-gesture="move"]:active, .canvas-item.is-moving .canvas-drag-header { cursor: grabbing; }
.canvas-text-content {
  min-height: 0;
  flex: 1;
  overflow: auto;
  overscroll-behavior: contain;
  padding: 7px 3px 1px 0;
  color: var(--text);
  font-size: 12px;
  line-height: 1.55;
  overflow-wrap: anywhere;
  scrollbar-color: var(--border-strong) transparent;
  scrollbar-width: thin;
}

.canvas-text-content:focus-visible { outline-offset: 0; }
.canvas-text-content > :first-child { margin-top: 0; }
.canvas-text-content > :last-child { margin-bottom: 0; }
.canvas-text-content p, .canvas-text-content ul, .canvas-text-content ol, .canvas-text-content blockquote, .canvas-text-content pre { margin: 0 0 .68em; }
.canvas-text-content h1, .canvas-text-content h2, .canvas-text-content h3, .canvas-text-content h4, .canvas-text-content h5, .canvas-text-content h6 { margin: .7em 0 .28em; color: var(--text); font-weight: 740; line-height: 1.25; }
.canvas-text-content h1 { font-size: 1.42em; letter-spacing: -.025em; }
.canvas-text-content h2 { font-size: 1.25em; }
.canvas-text-content h3, .canvas-text-content h4 { font-size: 1.1em; }
.canvas-text-content h5, .canvas-text-content h6 { font-size: 1em; }
.canvas-text-content strong { color: var(--text); }
.canvas-text-content ul, .canvas-text-content ol { padding-inline-start: 1.5em; }
.canvas-text-content blockquote { padding: 0 0 0 .7em; border-left: 2px solid var(--border-strong); }
.canvas-text-content pre, .canvas-text-content :not(pre) > code { background: var(--surface-subtle); border: 1px solid var(--border); border-radius: 3px; }
.canvas-text-content pre { padding: .4em .55em; white-space: pre-wrap; }
.canvas-text-content :not(pre) > code { padding: 0 .2em; }
.canvas-plain-text { white-space: pre-wrap; }

.canvas-card.canvas-image { padding: 4px; }
.canvas-photo {
  display: block;
  width: 100%;
  height: 100%;
  padding: 0;
  overflow: hidden;
  background: var(--surface-subtle);
  border: 0;
  border-radius: 2px;
}

.canvas-photo:focus-visible { outline-offset: -2px; }
.canvas-photo img { width: 100%; height: 100%; object-fit: contain; pointer-events: none; }
.canvas-image-name {
  position: absolute;
  inset: auto 0 calc(100% + 5px);
  z-index: 1;
  display: none;
  max-width: 100%;
  overflow: hidden;
  padding: 4px 7px;
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--accent-border);
  border-radius: 4px;
  box-shadow: var(--shadow-card);
  font-size: 12px;
  font-weight: 700;
  line-height: 1.3;
  text-align: left;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.canvas-item.is-selected .canvas-image-name { display: block; }
.canvas-item.caption-inset .canvas-image-name { inset: 4px 4px auto; }
.canvas-document .file-preview { min-height: 0; flex: 1; margin-top: 6px; }

.canvas-resize, .section-resize {
  position: absolute;
  z-index: 2;
  padding: 0;
  touch-action: none;
  background: transparent;
  color: var(--accent-text);
  border: 0;
  border-radius: 2px;
}

.canvas-resize, .section-resize {
  right: 0;
  bottom: 0;
  display: grid;
  width: var(--resize-hit, 22px);
  height: var(--resize-hit, 22px);
  place-items: center;
  opacity: 0;
  cursor: nwse-resize;
}

.canvas-resize svg, .section-resize svg { width: 14px; height: 14px; }
.canvas-item:hover .canvas-resize, .canvas-item.is-selected .canvas-resize, .canvas-resize:focus-visible, .board-section:hover .section-resize, .board-section:focus-within .section-resize { opacity: 1; }
.canvas-resize:hover, .canvas-resize:focus-visible, .section-resize:hover, .section-resize:focus-visible { background: var(--accent-soft); }
.canvas-item.is-selected[data-kind="image"] .canvas-resize { background: var(--accent-soft); border: 1px solid var(--accent-border); }

.board-footer { min-height: 35px; padding-block: 6px; border-top: 1px solid var(--border); color: var(--muted); font-size: 11px; }
.board-legend { display: inline-flex; align-items: center; gap: 7px; }
.board-legend svg, .board-footer svg { width: 13px; height: 13px; }

.empty-state { display: grid; min-height: 200px; align-content: center; justify-items: center; gap: 8px; padding: 20px; color: var(--muted); text-align: center; }
.board-surface > .empty-state { width: min(100%, 740px); min-height: 280px; margin-inline: auto; }
.board-surface.is-list > .empty-state { grid-column: 1 / -1; }
.board-empty-actions { position: absolute; z-index: 3; inset: 50% auto auto 50%; width: min(calc(100% - 32px), 360px); min-height: 0; transform: translate(-50%, -50%); pointer-events: none; }
.board-empty-actions button, .board-empty-actions a { pointer-events: auto; }
.empty-state > svg { width: 28px; height: 28px; color: var(--accent-text); }
.empty-icon { display: grid; width: 40px; height: 40px; place-items: center; background: var(--accent-soft); color: var(--accent-text); border-radius: var(--radius); }
.empty-icon svg { width: 20px; height: 20px; }
.empty-state h2, .empty-state h3, .empty-state strong { margin: 0; color: var(--text); font-size: 15px; font-weight: 725; }
.empty-state p { max-width: 340px; margin: 0; font-size: 13px; }

.popover {
  z-index: 25;
  min-width: 172px;
  max-width: min(300px, calc(100vw - 20px));
  padding: 4px;
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  box-shadow: var(--shadow-float);
}

.selector-menu { position: absolute; top: calc(100% + 5px); right: 0; left: 0; max-height: min(280px, 48dvh); overflow: auto; }
.context-menu { position: fixed; }
.popover button {
  display: flex;
  width: 100%;
  min-height: 34px;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  background: transparent;
  color: inherit;
  border: 0;
  border-radius: 4px;
  text-align: left;
  font-size: 12px;
}

.popover button:hover, .popover button:focus-visible { background: var(--surface-hover); }
.popover button.is-active, .popover button[aria-current="true"] { background: var(--accent-soft); color: var(--accent-text); font-weight: 700; }
.popover button.danger, .popover button.is-danger, .popover button[data-danger] { color: var(--red); }
.popover button svg { width: 15px; height: 15px; }
.popover hr { margin: 4px 0; border: 0; border-top: 1px solid var(--border); }
.menu-avatar { display: grid; width: 24px; height: 24px; flex-shrink: 0; place-items: center; background: var(--accent-soft); color: var(--accent-text); border-radius: 4px; font-size: 9px; font-weight: 750; }
.selector-menu .menu-item > span:not(.menu-avatar) { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.selector-menu .menu-item > svg:last-child { margin-left: auto; color: var(--accent-text); }
.selector-menu .menu-create { margin-top: 3px; border-top: 1px solid var(--border); border-radius: 0 0 4px 4px; color: var(--accent-text); font-weight: 660; }

.utility-view { min-width: 0; }
.utility-view > h1 { margin-bottom: 8px; }
.utility-view > p { margin: 0 0 20px; color: var(--muted); }
.utility-list { overflow: hidden; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); }
.utility-row { display: flex; min-width: 0; min-height: 61px; align-items: center; gap: 11px; padding: 10px 13px; }
.utility-row + .utility-row { border-top: 1px solid var(--border); }
.utility-row > div, .utility-row > span { min-width: 0; }
.utility-row-copy { flex: 1; }
.utility-row strong, .utility-row small { display: block; overflow-wrap: anywhere; }
.utility-row small { color: var(--muted); font-size: 11px; }
.utility-row > .button:last-child { margin-left: auto; }
.utility-row time { margin-left: auto; color: var(--muted); font-size: 11px; white-space: nowrap; }
.utility-row > .danger { color: var(--red); }
.utility-row > .danger:hover { background: var(--red-soft); color: var(--red); }

.modal {
  width: min(100% - 30px, 520px);
  max-width: none;
  max-height: calc(100dvh - 30px);
  margin: auto;
  padding: 0;
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  box-shadow: var(--shadow-float);
}

.modal::backdrop { background: var(--scrim); backdrop-filter: blur(2px); }
.modal.modal-wide, .modal.is-wide, .modal:has(.detail-tabs) { width: min(100% - 30px, 790px); }
.modal.modal-image-viewer { width: min(100% - 30px, 1100px); }
.modal-inner { display: flex; max-height: calc(100dvh - 32px); flex-direction: column; }
.modal-header { display: flex; flex-shrink: 0; min-width: 0; justify-content: space-between; align-items: start; gap: 12px; padding: 15px 17px; border-bottom: 1px solid var(--border); }
.modal-header > div { min-width: 0; }
.modal-header h2 { margin: 0; color: var(--text); font-size: 19px; font-weight: 750; line-height: 1.35; letter-spacing: -.02em; overflow-wrap: anywhere; }
.modal-header p { margin: 4px 0 0; color: var(--muted); font-size: 12px; }
.modal-header-actions { display: flex; flex-shrink: 0; gap: 4px; margin: -2px -4px 0 auto; }
.modal-header-actions .icon-button { width: 32px; min-height: 32px; }
.modal-body { min-height: 0; overflow: auto; padding: 15px 17px; }
.modal-body > :first-child { margin-top: 0; }
.modal-body > :last-child { margin-bottom: 0; }
.modal-footer { display: flex; flex-shrink: 0; justify-content: flex-end; align-items: center; flex-wrap: wrap; gap: 7px; padding: 12px 17px; border-top: 1px solid var(--border); }
.modal .button { min-height: 36px; }
.modal form { min-height: 0; }
.modal-inner > form { display: flex; min-height: 0; flex-direction: column; }

.field { display: grid; min-width: 0; gap: 5px; margin: 0 0 12px; color: var(--text); font-size: 12px; font-weight: 670; }
.field small { color: var(--muted); font-weight: 500; }
.field input, .field select, .field textarea, .text-editor {
  width: 100%;
  min-height: 38px;
  padding: 8px 9px;
  background: var(--surface-subtle);
  color: var(--text);
  border: 1px solid var(--border-strong);
  border-radius: 4px;
  font-size: 13px;
  font-weight: 500;
}

.field input:focus, .field select:focus, .field textarea:focus, .text-editor:focus { outline: 2px solid var(--accent-soft); outline-offset: 0; border-color: var(--accent); }
.field textarea { min-height: 70px; resize: vertical; }
.field input[type="color"] { width: 65px; padding: 3px; }
.field-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.field-error, .form-error { color: var(--red); font-size: 12px; }

.detail-tabs { display: flex; flex-shrink: 0; align-items: center; gap: 5px; overflow: auto; padding: 7px 17px; border-bottom: 1px solid var(--border); }
.detail-tabs > button { padding-inline: 10px; }
.detail-preview { display: grid; width: 100%; min-height: 170px; overflow: hidden; place-items: center; background: var(--canvas); border: 1px solid var(--border); border-radius: 4px; }
.detail-preview img { max-height: min(56dvh, 570px); object-fit: contain; }
.modal-image-viewer .detail-image img { max-height: max(100px, calc(var(--visible-height, 100dvh) - 195px)); }
.detail-preview iframe, .detail-preview object, .detail-preview embed { display: block; width: 100%; height: min(56dvh, 570px); min-height: 260px; border: 0; }
.detail-preview pre { width: 100%; margin: 0; padding: 14px; white-space: pre-wrap; overflow-wrap: anywhere; }
.detail-preview .text-link { justify-self: start; padding: 9px 11px; font-size: 12px; }
.pdf-renderer { background: var(--canvas); }
.pdf-renderer-canvas { margin-inline: auto; background: #fff; box-shadow: var(--shadow-card); }
.pdf-renderer-controls { background: var(--surface-subtle); border-bottom: 1px solid var(--border); }
.pdf-renderer-status { font-size: 12px; font-variant-numeric: tabular-nums; }
p.pdf-renderer-status { padding-inline: 10px; text-align: center; }
.document-preview { margin: 0; padding: 12px; background: var(--surface-subtle); border: 1px solid var(--border); border-radius: 4px; font: 13px/1.6 var(--font-sans); white-space: pre-wrap; overflow-wrap: anywhere; }
.text-editor { display: block; min-height: min(44vh, 320px); resize: vertical; font-family: "Cascadia Code", Consolas, monospace; font-weight: 400; line-height: 1.6; tab-size: 2; }
.version-row, .comment-row { display: flex; min-height: 50px; align-items: center; gap: 9px; padding: 8px 0; border-bottom: 1px solid var(--border); }
.version-row:last-child, .comment-row:last-child { border-bottom: 0; }
.version-row > .button, .version-row > small { margin-left: auto; }
.version-row time, .comment-row time { display: block; }
.version-row small, .version-row time, .comment-row small, .comment-row time { color: var(--muted); font-size: 11px; }
.comment-row { align-items: flex-start; overflow-wrap: anywhere; }
.comment-avatar { display: grid; width: 32px; height: 32px; flex-shrink: 0; place-items: center; background: var(--accent-soft); color: var(--accent-text); border-radius: 4px; }
.comment-avatar svg { width: 15px; height: 15px; }
.comment-row p { margin: 3px 0 0; white-space: pre-wrap; }
.comment-form { margin-top: 14px; }
.file-tags { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 10px; }
.file-tags > span { overflow-wrap: anywhere; padding: 3px 6px; background: var(--accent-soft); color: var(--accent-text); border-radius: 3px; font-size: 11px; font-weight: 650; }
.muted { color: var(--muted); }

.toast-stack, .upload-stack {
  position: fixed;
  right: 18px;
  z-index: 30;
  display: grid;
  width: min(342px, calc(100vw - 24px));
  gap: 7px;
  pointer-events: none;
}

.toast-stack { bottom: 18px; }
.upload-stack { top: calc(var(--toolbar-height) + 12px); }
.toast, .upload-item {
  min-width: 0;
  padding: 10px 12px;
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  box-shadow: var(--shadow-float);
  font-size: 12px;
  pointer-events: auto;
}

.toast { display: flex; align-items: center; gap: 8px; }
.toast > svg { width: 17px; height: 17px; color: var(--accent-text); }
.toast-error, .toast-error > svg { color: var(--red); }
.upload-item { display: grid; gap: 6px; overflow-wrap: anywhere; }
.upload-item strong { font-weight: 675; }
.upload-item small { color: var(--muted); }
.upload-item progress { display: block; width: 100%; height: 6px; overflow: hidden; accent-color: var(--accent); border: 0; border-radius: 2px; }
.upload-item progress::-webkit-progress-bar { background: var(--surface-hover); }
.upload-item progress::-webkit-progress-value { background: var(--accent); }
.upload-item progress::-moz-progress-bar { background: var(--accent); }
.upload-item.is-error { color: var(--red); }

.drop-overlay {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: grid;
  place-items: center;
  padding: 15px;
  background: var(--scrim);
  pointer-events: none;
}

.drop-content { display: grid; width: min(430px, 100%); min-height: 186px; align-content: center; justify-items: center; gap: 8px; padding: 20px; background: var(--surface); border: 2px dashed var(--accent); border-radius: 8px; box-shadow: var(--shadow-float); text-align: center; }
.drop-content svg { width: 31px; height: 31px; color: var(--accent-text); }
.drop-content strong { color: var(--text); font-size: 18px; }
.drop-content span { color: var(--muted); font-size: 11px; font-weight: 620; }

body:has(.app-shell.has-immersive-board) { overflow: hidden; overscroll-behavior: none; }
.app-shell.has-immersive-board { height: 100dvh; min-height: 0; overflow: clip; background: var(--canvas); }
.has-immersive-board .app-main { position: relative; height: 100%; min-height: 0; }
.has-immersive-board .topbar,
.has-immersive-board #workspace-view > .hero,
.has-immersive-board #workspace-view > .stats-grid,
.has-immersive-board #board-panel > :is(.board-header, .board-toolbar, .board-footer) { display: none; }
.has-immersive-board .main-content { height: 100%; max-width: none; margin: 0; padding: 0; }
.has-immersive-board #workspace-view, .has-immersive-board #board-panel, .has-immersive-board .board-stage, .has-immersive-board #board-viewport { height: 100%; min-height: 0; }
.has-immersive-board #board-panel { border: 0; border-radius: 0; }
.has-immersive-board .board-grid {
  position: absolute;
  inset: -18px;
  display: block;
  background: var(--canvas) radial-gradient(circle, var(--grid-dot) 1px, transparent 1.15px) 8px 8px / 18px 18px;
  pointer-events: none;
  will-change: transform;
}
.has-immersive-board #board-viewport { overscroll-behavior: none; scrollbar-width: none; }
.has-immersive-board #board-viewport::-webkit-scrollbar { display: none; }
.has-immersive-board .board-tools-floating { position: absolute; inset: 12px auto auto 12px; z-index: 16; display: block; }
.board-tools-floating > .button { min-height: 42px; box-shadow: var(--shadow-card); }
.board-tools-popover { position: absolute; top: calc(100% + 6px); left: 0; width: 218px; max-height: calc(100dvh - 70px); overflow: auto; }
.board-tools-popover button { min-height: 40px; padding-inline: 9px; }
.board-tools-popover .mobile-canvas-menu-item { display: none; }
.has-immersive-board .board-zoom-floating {
  position: absolute;
  inset: 12px 12px auto auto;
  z-index: 16;
  display: flex;
  gap: 1px;
  padding: 2px;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  box-shadow: var(--shadow-card);
}
.board-zoom-floating .icon-button { width: 42px; min-height: 42px; color: var(--text); }

@media (max-width: 1080px) {
  :root { --sidebar-width: 220px; }
  .main-content { padding-right: 23px; padding-left: 23px; }
  .topbar { padding-right: 23px; padding-left: 23px; }
}

@media (max-width: 760px), (max-width: 1024px) and (max-height: 600px) and (pointer: coarse) {
  :root {
    --toolbar-height: 60px;
    --mobile-nav-height: 64px;
    --safe-top: env(safe-area-inset-top, 0px);
    --safe-right: env(safe-area-inset-right, 0px);
    --safe-bottom: env(safe-area-inset-bottom, 0px);
    --safe-left: env(safe-area-inset-left, 0px);
  }
  .app-shell { display: block; }
  body.drawer-open { overflow: hidden; }
  .sidebar {
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    z-index: 21;
    width: min(280px, calc(100vw - 49px));
    padding: var(--safe-top) 0 var(--safe-bottom) var(--safe-left);
    visibility: hidden;
    transform: translateX(-100%);
    transition: transform .18s ease, visibility .18s;
  }

  .sidebar.is-open, .app-shell.sidebar-open .sidebar, body.sidebar-open .sidebar { visibility: visible; transform: translateX(0); }
  .sidebar-backdrop:not([hidden]) { position: fixed; inset: 0; z-index: 20; display: block; width: 100%; height: 100%; padding: 0; background: var(--scrim); border: 0; }
  .brand .mobile-sidebar-close { display: inline-flex; width: 44px; min-height: 44px; margin-left: auto; }
  .sidebar-project { margin-top: 10px; }
  .sidebar-board { margin-bottom: 17px; }
  .nav-item, .workspace-trigger { min-height: 44px; }
  .topbar .mobile-menu { display: inline-flex; width: 44px; min-height: 44px; background: var(--surface-subtle); border-color: var(--border); }
  .topbar { gap: 8px; padding: calc(7px + var(--safe-top)) max(12px, var(--safe-right)) 7px max(12px, var(--safe-left)); }
  .topbar-left, .topbar-right { gap: 7px; }
  .topbar-right { flex: 0 1 auto; }
  .breadcrumbs { gap: 6px; }
  .search-field { width: clamp(145px, 36vw, 252px); min-height: 44px; }
  .topbar:has(.search-field:focus-within) .breadcrumbs { display: none; }
  .topbar:has(.search-field:focus-within) .topbar-left { flex: 0 0 auto; }
  .topbar:has(.search-field:focus-within) .topbar-right { flex: 1; }
  .search-field:focus-within { flex: 1; width: auto; }
  .search-field input { font-size: 16px; }
  .theme-button { width: 44px; min-height: 44px; }
  .main-content { padding: 18px max(12px, var(--safe-right)) calc(var(--mobile-nav-height) + var(--safe-bottom) + 16px) max(12px, var(--safe-left)); }
  .hero { margin-bottom: 14px; }
  #workspace-view.is-searching .hero, #workspace-view.is-searching .stats-grid { display: none; }
  .stats-grid { gap: 8px; margin-bottom: 15px; }

  .mobile-nav {
    position: fixed;
    inset: auto 0 0;
    z-index: 15;
    display: grid;
    min-height: calc(var(--mobile-nav-height) + var(--safe-bottom));
    grid-template-columns: repeat(6, minmax(0, 1fr));
    align-items: stretch;
    gap: 2px;
    padding: 3px max(8px, var(--safe-right)) var(--safe-bottom) max(8px, var(--safe-left));
    background: var(--surface);
    border-top: 1px solid var(--border);
    box-shadow: 0 -4px 18px #1619360a;
  }
  .is-project-member .mobile-nav { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .mobile-tab[data-view="settings"] { font-size: clamp(7px, 2.35vw, 10px); }
  .project-panels, .project-settings-grid { grid-template-columns: 1fr; }
  .project-panel .button { min-height: 42px; }
  .mobile-tab {
    display: flex;
    min-width: 0;
    min-height: 52px;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    padding: 3px 1px;
    background: transparent;
    color: var(--muted);
    border: 0;
    border-radius: var(--radius);
    font-size: 10px;
    font-weight: 700;
    line-height: 1.2;
  }
  .mobile-tab > .icon { width: 20px; height: 20px; }
  .mobile-tab.is-active { background: var(--accent-soft); color: var(--accent-text); }
  body.keyboard-open .mobile-nav { visibility: hidden; }

  .board-viewport { height: clamp(300px, 56dvh, 580px); }
  .app-shell.has-immersive-board {
    position: fixed;
    inset: var(--visible-top, 0px) 0 auto;
    height: var(--visible-height, 100dvh);
  }
  .has-immersive-board .main-content { height: calc(100% - var(--mobile-nav-height) - var(--safe-bottom)); }
  .has-immersive-board .mobile-nav { position: absolute; height: calc(var(--mobile-nav-height) + var(--safe-bottom)); }
  .has-immersive-board .board-zoom-floating { inset: calc(10px + var(--safe-top)) calc(10px + var(--safe-right)) auto auto; }
  .board-zoom-floating .icon-button { width: 44px; min-height: 44px; }
  .has-immersive-board .board-tools-floating { inset: calc(10px + var(--safe-top)) auto auto calc(10px + var(--safe-left)); }
  .board-tools-floating > .button { width: 48px; min-height: 48px; padding: 0; }
  .board-tools-floating > .button .icon { width: 21px; height: 21px; }
  .board-tools-floating > .button > span { display: none; }
  .board-tools-popover { max-height: max(60px, calc(var(--visible-height, 100dvh) - var(--safe-top) - 70px)); }
  .board-tools-popover button { min-height: 44px; }
  .board-tools-popover .mobile-canvas-menu-item { display: flex; }
  .canvas-title.canvas-drag-header, .canvas-image-name.canvas-photo-grip { min-height: 32px; }
  .board-actions .icon-button, .board-toolbar .filter-button { min-height: 44px; }
  .board-actions .icon-button, .segmented .icon-button, .zoom-control .icon-button, .fit-button { width: 44px; min-height: 44px; }
  .zoom-control > button:not(.icon-button) { min-height: 44px; }
  .board-panel.is-list-mode .zoom-control, .board-panel.is-list-mode .fit-button, .is-file-view .board-panel.is-list-mode .board-controls, .is-searching .board-controls { display: none; }
  .board-surface.is-list { min-height: 0; grid-template-columns: 1fr; gap: 7px; padding: 9px; }
  .board-viewport:has(.board-surface.is-list) { min-height: 0; }
  .board-surface.is-list .file-card { display: grid; grid-template-columns: 44px minmax(0, 1fr) 44px; align-items: center; gap: 9px; padding: 5px 7px 5px 9px; border-color: var(--border); }
  .board-surface.is-list .file-card-header { display: contents; }
  .board-surface.is-list .file-icon, .board-surface.is-list .file-preview.preview-image { grid-area: 1 / 1; width: 44px; height: 44px; }
  .board-surface.is-list .file-preview.preview-image { border: 0; }
  .board-surface.is-list .file-preview:not(.preview-image), .board-surface.is-list .file-card-footer { display: none; }
  .board-surface.is-list .file-heading { grid-area: 1 / 2; min-height: 50px; align-content: center; gap: 4px; }
  .board-surface.is-list .file-heading strong { font-size: 14px; }
  .board-surface.is-list .file-heading small { font-size: 11px; }
  .board-surface.is-list .file-mobile-section { display: inline; }
  .board-surface.is-list .file-menu-button { grid-area: 1 / 3; }
  .board-surface.is-list .file-card-footer:has(.file-locate) { display: block; grid-area: 1 / 3; margin: 0; }
  .board-surface.is-list .file-card-footer :is(.file-section, .file-locate span) { display: none; }
  .board-surface.is-list .file-locate { width: 44px; min-height: 44px; justify-content: center; padding: 0; }
  .file-menu-button { width: 44px; min-height: 44px; }

  .context-menu {
    inset: auto max(10px, var(--safe-right)) calc(var(--mobile-nav-height) + var(--safe-bottom) + 8px) max(10px, var(--safe-left)) !important;
    z-index: 28;
    max-width: none;
    max-height: max(76px, calc(var(--visible-height, 100dvh) - var(--mobile-nav-height) - var(--safe-bottom) - 18px));
    overflow: auto;
    overscroll-behavior: contain;
  }
  .popover button { min-height: 44px; font-size: 14px; }
  .toast-stack, .upload-stack { right: max(12px, var(--safe-right)); }
  .toast-stack { bottom: calc(var(--mobile-nav-height) + var(--safe-bottom) + 9px); }
  .upload-stack { top: calc(var(--toolbar-height) + var(--safe-top) + 8px); }
  body:has(.has-immersive-board) .upload-stack { top: calc(var(--visible-top, 0px) + var(--safe-top) + 68px); }
  .utility-row .button, .utility-row .icon-button { min-height: 44px; }
  .utility-row .icon-button { width: 44px; }

  .modal[open] {
    position: fixed;
    inset: var(--visible-top, 0px) 0 auto;
    width: 100%;
    max-width: none;
    height: var(--visible-height, 100dvh);
    max-height: none;
    margin: 0;
    overflow: hidden;
    border: 0;
    border-radius: 0;
  }
  .modal-inner { height: 100%; max-height: none; padding-inline: var(--safe-left) var(--safe-right); }
  .modal-header { align-items: center; padding: calc(8px + var(--safe-top)) 12px 8px; }
  .modal-header-actions { margin-top: 0; }
  .modal-header-actions .icon-button { width: 44px; min-height: 44px; }
  .modal-body { flex: 1; padding: 12px; overscroll-behavior: contain; }
  .detail-tabs { padding: 3px 12px; }
  .detail-tabs .filter-button, .field input, .field select, .modal .button { min-height: 44px; }
  .modal-footer { padding: 7px 12px calc(7px + var(--safe-bottom)); }
  .field input, .field select, .field textarea, .text-editor { font-size: 16px; }
  .modal-editor .modal-body, .modal-editor .editor-form { display: flex; flex-direction: column; }
  .modal-editor .editor-form { flex: 1; min-height: 84px; }
  .modal-editor .text-editor { flex: 1; min-height: 0; resize: none; }
  .modal-editor .detail-footer > .button { flex: 1; padding-inline: 5px; }
  .keyboard-open .modal-header p { display: none; }
  .modal.modal-sheet[open] {
    top: calc(var(--visible-top, 0px) + var(--visible-height, 100dvh));
    height: auto;
    max-height: var(--visible-height, 100dvh);
    transform: translateY(-100%);
    border-radius: 10px 10px 0 0;
  }
  .modal-sheet .modal-inner { height: auto; max-height: var(--visible-height, 100dvh); }
  .modal-sheet .modal-header { padding-top: 8px; }
}

@media (max-width: 535px) {
  .topbar-left { flex: 1 1 auto; }
  .breadcrumbs { display: block; overflow: hidden; line-height: 1.3; text-overflow: ellipsis; }
  .breadcrumbs > :not(:last-child) { display: none; }
  .breadcrumbs > :last-child { font-size: 12px; }
  .search-field { width: clamp(93px, 32vw, 167px); gap: 5px; padding-inline: 6px; }
  .search-field svg { width: 14px; height: 14px; }
  .search-field input { font-size: 16px; }
  .search-field input::placeholder { font-size: 12px; }
  .search-field kbd { display: none; }
  .hero { align-items: start; }
  .hero h1, .utility-view h1 { font-size: clamp(27px, 8vw, 32px); }
  .hero p:not(.eyebrow) { font-size: 13px; }
  .stats-grid { gap: 6px; }
  .stat-card { min-height: 54px; gap: 5px; padding: 6px; }
  .stat-icon { width: 22px; height: 22px; border-radius: 4px; }
  .stat-icon svg { width: 13px; height: 13px; }
  .stat-copy { width: 100%; }
  .stat-number { font-size: 16px; }
  .stat-date { font-size: 13px; }
  .stat-label { font-size: 9px; }
  .board-header, .board-toolbar, .board-footer { padding-inline: 10px; }
  .board-header { min-height: 59px; flex-wrap: nowrap; }
  .board-title p { font-size: 11px; }
  .board-toolbar { align-items: flex-start; gap: 5px; }
  .board-toolbar .filter-button { padding-inline: 7px; }
  .board-filters { flex-basis: 100%; }
  .board-controls { width: 100%; justify-content: flex-start; }
  .board-footer { gap: 6px; }
  .board-legend { gap: 4px; font-size: 10px; }
  .utility-row { gap: 7px; padding-inline: 8px; }
  .utility-row .stat-icon { width: 27px; height: 27px; }
  .utility-row > time { white-space: normal; }
}

@media (max-width: 330px) {
  .topbar { padding-inline: max(8px, var(--safe-left)) max(8px, var(--safe-right)); }
  .stats-grid .stat-icon { display: none; }
  .board-controls { gap: 4px; }
}

@media (pointer: coarse) {
  .popover button { min-height: 42px; }
  .board-item.canvas-item, .board-section { --resize-hit: clamp(26px, calc(24px / var(--board-zoom, 1)), 54px); }
  .canvas-resize, .section-resize { transform: translate(25%, 25%); }
  .canvas-resize svg, .section-resize svg { width: 17px; height: 17px; }
  .section-resize { opacity: .85; }
  .board-section-header .icon-button { width: 35px; min-height: 32px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: 0s !important; animation-duration: 0s !important; }
}
