:root {
  color-scheme: light;
  --bg: #f5f2ec;
  --paper: #fffaf0;
  --ink: #231820;
  --muted: #756956;
  --line: #dacbb0;
  --gold: #d99a27;
  --teal: #137f78;
  --danger: #b5473f;
  --success: #258653;
  --shadow: 0 12px 30px rgba(49, 36, 19, 0.12);
  --bottom-log-height: 42px;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: "Microsoft YaHei", "PingFang SC", Arial, sans-serif;
  overflow: hidden;
  user-select: none;
  -webkit-user-select: none;
}

body[data-log-expanded="true"] {
  --bottom-log-height: 50vh;
}

input,
textarea,
[contenteditable="true"] {
  user-select: text;
  -webkit-user-select: text;
}

button,
input {
  font: inherit;
}

button {
  min-height: 34px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fffaf0;
  color: var(--ink);
  font-size: 12px;
  font-weight: 900;
  cursor: pointer;
}

button:hover {
  border-color: var(--teal);
}

button:disabled {
  opacity: 0.48;
  cursor: not-allowed;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: grid;
  grid-template-columns: minmax(220px, max-content) minmax(180px, 1fr) minmax(360px, max-content);
  align-items: center;
  gap: 16px;
  padding: 14px 22px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 250, 240, 0.94);
  backdrop-filter: blur(14px);
}

body[data-view="projects"] .topbar {
  grid-template-columns: max-content minmax(0, 1fr) auto;
}

.topbar h1 {
  margin: 0;
  font-size: 24px;
  letter-spacing: 0;
}

.topbar p {
  margin: 3px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.brand-block {
  min-width: 0;
}

.brand-link {
  display: inline-flex;
  align-items: center;
  min-width: 0;
  max-width: 100%;
  gap: 9px;
  min-height: 40px;
  padding: 3px 8px 3px 4px;
  border: 1px solid transparent;
  border-radius: 999px;
  background: transparent;
  color: var(--ink);
  font-size: 18px;
}

.brand-link:hover {
  border-color: transparent;
  background: transparent;
}

.brand-link img {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  object-fit: cover;
}

.brand-name-wrap,
.project-crumb {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.brand-name-wrap {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  padding: 0 7px;
  border: 1px solid transparent;
  border-radius: 7px;
}

.brand-link:hover .brand-name-wrap,
.brand-link:focus-visible .brand-name-wrap {
  border-color: #d85d36;
  background: #fff6df;
}

.brand-name {
  font-size: 18px;
  font-weight: 900;
}

.brand-separator {
  color: var(--muted);
  font-weight: 900;
}

.project-crumb {
  max-width: min(34vw, 360px);
  color: var(--muted);
  font-size: 15px;
  font-weight: 900;
}

.collab-strip {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-width: 190px;
  padding: 5px 9px;
  border: 1px solid #eadbbb;
  border-radius: 999px;
  background: #fff6df;
}

.collab-label {
  color: #6b5a46;
  font-size: 12px;
  font-weight: 900;
  white-space: nowrap;
}

.collab-avatars {
  display: flex;
  align-items: center;
  min-height: 34px;
}

.collab-member {
  position: relative;
  display: inline-grid;
  place-items: center;
  margin-left: -6px;
}

.collab-member:first-child {
  margin-left: 0;
}

.collab-avatar-button {
  display: grid;
  place-items: center;
  min-width: 30px;
  width: 30px;
  height: 30px;
  min-height: 30px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
}

.collab-avatar-button:hover {
  border-color: transparent;
}

.collab-avatar-button.static {
  cursor: default;
}

.collab-avatar {
  position: relative;
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border: 2px solid #fffaf0;
  border-radius: 50%;
  background: var(--avatar-bg, #137f78);
  color: #fffdf6;
  font-size: 12px;
  font-weight: 900;
  line-height: 1;
  box-sizing: border-box;
  overflow: hidden;
}

.collab-avatar img {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
}

.collab-avatar.editing {
  border-color: #f7c760;
}

.collab-avatar.editing::after {
  content: "";
  position: absolute;
  right: -1px;
  bottom: -1px;
  width: 8px;
  height: 8px;
  border: 2px solid #fffaf0;
  border-radius: 50%;
  background: #bd8426;
}

.editing-badge {
  position: absolute;
  left: 50%;
  top: -16px;
  z-index: 2;
  transform: translateX(-50%);
  padding: 2px 6px;
  border-radius: 999px;
  background: #2b1708;
  color: #fff6df;
  font-size: 10px;
  font-weight: 900;
  line-height: 1;
  white-space: nowrap;
}

.nudge-popover {
  position: absolute;
  top: 38px;
  left: 50%;
  z-index: 20;
  display: grid;
  gap: 6px;
  width: 134px;
  padding: 8px;
  border: 1px solid #d7be8b;
  border-radius: 8px;
  background: #fffaf0;
  box-shadow: var(--shadow);
  transform: translateX(-50%);
}

.nudge-popover strong {
  overflow: hidden;
  color: #6b5a46;
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.nudge-popover button {
  min-height: 28px;
  padding: 0 8px;
  border-color: #bd8426;
  background: #f7c760;
  color: #2b1708;
}

.nudge-bubble {
  position: absolute;
  left: 50%;
  top: 37px;
  z-index: 18;
  width: max-content;
  max-width: 180px;
  padding: 6px 8px;
  border: 1px solid #dfb657;
  border-radius: 8px;
  background: #fff2cf;
  color: #6f4210;
  font-size: 11px;
  font-weight: 900;
  line-height: 1.25;
  box-shadow: 0 8px 18px rgba(49, 36, 19, 0.14);
  transform: translateX(-50%);
  white-space: normal;
}

.collab-more {
  margin-left: 4px;
  color: #6b5a46;
  font-size: 12px;
  font-weight: 900;
}

.top-actions,
.mode-switch {
  display: flex;
  align-items: center;
  gap: 8px;
}

.top-actions {
  grid-column: 3;
  width: max-content;
  margin-left: auto;
  justify-self: end;
  justify-content: flex-end;
  flex-wrap: wrap;
}

.mode-switch {
  position: relative;
  display: grid;
  grid-template-columns: repeat(3, 58px);
  gap: 4px;
  padding: 4px;
  border: 1px solid #d8c6a6;
  border-radius: 999px;
  background: #fffaf0;
  overflow: hidden;
}

.mode-switch::before {
  content: "";
  position: absolute;
  left: 4px;
  top: 4px;
  width: 58px;
  height: calc(100% - 8px);
  border: 1px solid #bd8426;
  border-radius: 999px;
  background: #f7c760;
  transition: transform 180ms ease;
}

body[data-mode="annotate"] .mode-switch::before {
  transform: translateX(62px);
}

body[data-mode="edit"] .mode-switch::before {
  transform: translateX(124px);
}

.mode-switch button {
  position: relative;
  z-index: 1;
  min-width: 0;
  width: 58px;
  min-height: 30px;
  padding: 0;
  border-color: transparent;
  border-radius: 999px;
  background: transparent;
  transition: color 160ms ease;
}

.mode-switch button:hover {
  border-color: transparent;
}

.mode-switch button.active {
  color: #2b1708;
}

body[data-view="projects"] .mode-switch,
body[data-view="ai-intake"] .mode-switch,
body[data-view="admin"] .mode-switch,
body[data-view="projects"] .details-menu-wrap,
body[data-view="ai-intake"] .details-menu-wrap,
body[data-view="admin"] .details-menu-wrap,
body[data-view="projects"] .save-status,
body[data-view="ai-intake"] .save-status,
body[data-view="admin"] .save-status {
  display: none;
}

body[data-view="board"] .create-project-button,
body[data-view="board"] .admin-button,
body[data-view="board"] .ai-intake-button,
body[data-view="board"] .help-button,
body[data-view="board"] .user-profile-button {
  display: none;
}

.admin-button {
  border-color: #c65b1d;
  background: #f18b32;
  color: #2b1708;
}

.ai-intake-button {
  border-color: #2b8074;
  background: #e4f5ef;
  color: #143f3a;
}

.create-project-button {
  border-color: #bd8426;
  background: #f7c760;
  color: #2b1708;
}

.help-button {
  border-color: #8d7344;
  background: #fffdf7;
  color: #3a2a14;
}

.user-profile-button {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 38px;
  padding: 3px 9px 3px 4px;
  border-radius: 999px;
}

.user-profile-avatar {
  display: inline-grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background-color: var(--avatar-bg, var(--teal));
  background-position: center;
  background-size: cover;
  color: #fffdf6;
  font-size: 12px;
  font-weight: 900;
}

.user-profile-avatar.large {
  width: 58px;
  height: 58px;
  font-size: 18px;
}

.details-menu-wrap {
  position: relative;
}

.details-button {
  display: grid;
  place-items: center;
  width: 36px;
  min-width: 36px;
  height: 36px;
  min-height: 36px;
  padding: 0;
  border-radius: 50%;
  font-size: 18px;
  line-height: 1;
}

.details-menu {
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  z-index: 30;
  display: grid;
  gap: 6px;
  min-width: 150px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper);
  box-shadow: var(--shadow);
}

.details-menu button {
  justify-content: flex-start;
  width: 100%;
  text-align: left;
}

.side-edit-actions {
  display: none;
  gap: 8px;
  margin-bottom: 12px;
}

body[data-view="board"][data-mode="edit"] .side-edit-actions {
  display: grid;
}

.side-edit-actions button {
  width: 100%;
  min-height: 38px;
  border-radius: 8px;
  color: #fffdf6;
}

.side-edit-actions button:disabled {
  border-color: #cfc1aa;
  background: #dfd4c4;
  color: #837764;
  opacity: 1;
}

.save-edit-button {
  border-color: #1f7348;
  background: var(--success);
}

.save-edit-button:hover {
  border-color: #145c38;
}

.cancel-edit-button {
  border-color: #9d352f;
  background: var(--danger);
}

.cancel-edit-button:hover {
  border-color: #842821;
}

.save-status {
  order: -1;
  min-width: 72px;
  color: var(--teal);
  font-size: 12px;
  font-weight: 900;
  text-align: right;
}

.flowmark-shell {
  display: grid;
  grid-template-columns: 240px minmax(0, 1fr) 340px;
  height: calc(100vh - 72px - var(--bottom-log-height));
  min-height: 0;
  overflow: hidden;
}

.bottom-log-bar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 38;
  height: var(--bottom-log-height);
  border-top: 1px solid #d6c4a2;
  background: rgba(255, 250, 240, 0.98);
  color: #3b3026;
  box-shadow: 0 -8px 20px rgba(49, 36, 19, 0.1);
}

.bottom-log-head {
  display: grid;
  grid-template-columns: 34px 12px minmax(0, 1fr);
  align-items: start;
  gap: 10px;
  height: 100%;
  padding: 6px 14px;
}

.bottom-log-toggle {
  display: grid;
  place-items: center;
  width: 28px;
  min-width: 28px;
  height: 28px;
  min-height: 28px;
  padding: 0;
  border-radius: 50%;
  line-height: 1;
}

.bottom-log-status-dot {
  width: 10px;
  height: 10px;
  margin-top: 9px;
  border-radius: 50%;
  background: var(--success);
  box-shadow: 0 0 0 3px rgba(37, 134, 83, 0.14);
}

.bottom-log-bar.has-error .bottom-log-status-dot {
  background: var(--danger);
  box-shadow: 0 0 0 3px rgba(181, 71, 63, 0.15);
}

.bottom-log-content {
  min-width: 0;
  height: 100%;
  overflow: hidden;
  font-size: 12px;
  font-weight: 800;
  line-height: 28px;
}

body[data-log-expanded="true"] .bottom-log-content {
  overflow: auto;
  padding-bottom: 10px;
  line-height: 1.45;
}

.bottom-log-line {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.bottom-log-row {
  display: grid;
  grid-template-columns: 152px minmax(0, 1fr);
  gap: 10px;
  padding: 7px 0;
  border-bottom: 1px solid #eadbbb;
}

.bottom-log-row span {
  color: var(--muted);
}

.bottom-log-row strong {
  min-width: 0;
  overflow-wrap: anywhere;
}

.bottom-log-line.error,
.bottom-log-row.error,
.bottom-log-bar.has-error .bottom-log-line {
  color: var(--danger);
}

body[data-view="board"][data-screen-nav-collapsed="true"] .flowmark-shell {
  grid-template-columns: 54px minmax(0, 1fr) 340px;
}

body[data-view="projects"] .flowmark-shell {
  grid-template-columns: minmax(0, 1fr);
}

body[data-view="ai-intake"] .flowmark-shell {
  grid-template-columns: minmax(0, 1fr);
  height: auto;
  min-height: calc(100vh - 72px);
  overflow: visible;
}

body[data-view="admin"] .flowmark-shell {
  grid-template-columns: minmax(0, 1fr);
  height: auto;
  min-height: calc(100vh - 72px);
  overflow: visible;
}

body[data-view="projects"] .left-pane {
  display: none;
}

body[data-view="projects"] .right-pane {
  display: none;
}

body[data-view="ai-intake"] .left-pane,
body[data-view="ai-intake"] .right-pane,
body[data-view="admin"] .left-pane,
body[data-view="admin"] .right-pane {
  display: none;
}

.left-pane,
.right-pane {
  min-height: 0;
  height: 100%;
  overflow: auto;
  padding: 16px 12px;
  background: rgba(255, 250, 240, 0.72);
}

.left-pane {
  border-right: 1px solid var(--line);
}

.right-pane {
  border-left: 1px solid var(--line);
}

.main-pane {
  min-width: 0;
  min-height: 0;
  height: 100%;
  overflow: auto;
  padding: 18px;
}

body[data-view="ai-intake"] {
  overflow: auto;
}

body[data-view="admin"] {
  overflow: auto;
}

body[data-view="ai-intake"] .main-pane,
body[data-view="admin"] .main-pane {
  height: auto;
  min-height: calc(100vh - 72px);
  overflow: visible;
}

body:not([data-mode="edit"]) .board-view {
  user-select: none;
}

.pane-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 10px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}

.screen-nav-title-text {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.screen-nav-toggle {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  width: 28px;
  min-width: 28px;
  height: 28px;
  min-height: 28px;
  padding: 0;
  border-radius: 50%;
  font-size: 18px;
  line-height: 1;
}

body[data-screen-nav-collapsed="true"] .left-pane {
  padding: 16px 8px;
  overflow: hidden;
}

body[data-screen-nav-collapsed="true"] .screen-nav-title-text {
  display: none;
}

.project-tabs,
.screen-tabs,
.operation-log-list {
  display: grid;
  gap: 8px;
}

.screen-tabs {
  position: relative;
}

.screen-tabs.collapsed {
  display: none;
}

.project-tab,
.screen-tab {
  display: block;
  width: 100%;
  min-height: auto;
  padding: 10px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  text-align: left;
}

.screen-tab-wrap {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: stretch;
  gap: 4px;
}

.screen-tab-wrap.level-2 {
  margin-left: 14px;
  width: calc(100% - 14px);
}

.project-tab.active,
.screen-tab.active,
.screen-tab:hover,
.project-tab:hover {
  border-color: var(--line);
  background: var(--paper);
}

.screen-tab.level-2 {
  margin-left: 0;
  width: 100%;
}

.project-tab strong,
.screen-tab strong {
  display: block;
  font-size: 13px;
}

.project-tab span,
.screen-tab span {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
}

.screen-tab-menu-wrap {
  position: relative;
  display: none;
}

body[data-mode="edit"] .screen-tab-menu-wrap {
  display: block;
}

.screen-tab-menu-button {
  display: grid;
  place-items: center;
  width: 30px;
  min-width: 30px;
  height: 100%;
  min-height: 38px;
  padding: 0;
  border-radius: 8px;
  font-size: 18px;
  line-height: 1;
}

.screen-tab-menu {
  position: absolute;
  right: 0;
  top: calc(100% + 6px);
  z-index: 24;
  display: grid;
  gap: 4px;
  width: 174px;
  padding: 7px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper);
  box-shadow: var(--shadow);
}

.screen-tab-menu button {
  justify-content: flex-start;
  width: 100%;
  min-height: 30px;
  padding: 0 8px;
  text-align: left;
}

.screen-tab-menu [data-disabled-reason] {
  border-color: #d6cbbb;
  background: #eee7dd;
  color: #8b806f;
}

.screen-tab-menu .danger-item {
  color: var(--danger);
}

.screen-drop-line {
  position: absolute;
  z-index: 20;
  height: 3px;
  border-radius: 999px;
  background: var(--teal);
  box-shadow: 0 0 0 2px rgba(19, 127, 120, 0.16);
  pointer-events: none;
}

body.screen-tab-dragging .screen-tab {
  cursor: grabbing;
}

.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 380px));
  gap: 14px;
  align-items: start;
}

.page-heading {
  margin-bottom: 14px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--paper);
  box-shadow: var(--shadow);
}

.page-heading h2 {
  margin: 0;
  font-size: 22px;
}

.page-heading p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.project-card,
.board-section,
.operation-log-item,
.project-summary,
.empty-state {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--paper);
  box-shadow: var(--shadow);
}

.project-card {
  position: relative;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding: 0;
}

.project-pin-button {
  position: absolute;
  left: 10px;
  top: 10px;
  z-index: 2;
  display: grid;
  place-items: center;
  width: 34px;
  min-width: 34px;
  height: 34px;
  min-height: 34px;
  padding: 0;
  border-color: rgba(255, 247, 223, 0.82);
  border-radius: 50%;
  background: rgba(35, 24, 32, 0.58);
  color: #fff7df;
  font-size: 20px;
  line-height: 1;
  opacity: 0;
  transform: translateY(-4px);
  transition: opacity 140ms ease, transform 140ms ease, background 140ms ease, color 140ms ease;
}

.project-card:hover .project-pin-button,
.project-card.is-pinned .project-pin-button,
.project-pin-button:focus-visible {
  opacity: 1;
  transform: translateY(0);
}

.project-card.is-pinned .project-pin-button {
  border-color: #bd8426;
  background: #f7c760;
  color: #2b1708;
}

.project-card img,
.project-preview-image {
  width: 100%;
  height: 190px;
  border-radius: 0;
  background: #231820;
}

.project-card img {
  object-fit: cover;
}

.project-preview-image {
  background-position: center;
  background-repeat: no-repeat;
  background-size: cover;
}

.project-preview-empty {
  height: 190px;
  background: #24191f;
}

.project-card-body {
  display: grid;
  gap: 12px;
  padding: 14px;
}

.project-card h2 {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-width: 0;
  margin: 0;
  font-size: 21px;
}

.project-card-title-text {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.project-status-badge {
  flex: 0 0 auto;
  padding: 4px 7px;
  border: 1px solid #d9c49e;
  border-radius: 999px;
  background: #fff;
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
}

.project-status-badge.status-pending_review {
  border-color: #d99a27;
  background: #fff3c7;
  color: #714600;
}

.project-status-badge.status-pinned {
  border-color: #bd8426;
  background: #f7c760;
  color: #2b1708;
}

.project-status-badge.status-published,
.project-status-badge.status-active {
  border-color: #b7d8c1;
  background: #edf9f0;
  color: #246542;
}

.project-status-badge.status-archived {
  border-color: #ccc3b4;
  background: #eee7dd;
}

.project-card p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
}

.project-metrics {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.project-owner-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.owner-box {
  padding: 9px;
  border: 1px solid #eadbbb;
  border-radius: 8px;
  background: #fff;
}

.owner-box span {
  display: block;
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
}

.owner-box strong {
  display: block;
  margin-top: 4px;
  font-size: 13px;
  line-height: 1.35;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.owner-empty {
  color: var(--ink);
}

.owner-summary-list {
  display: grid;
  gap: 5px;
  margin-top: 5px;
}

.owner-summary-person,
.owner-picker-person {
  display: inline-flex;
  align-items: center;
  min-width: 0;
  gap: 7px;
}

.owner-summary-person strong,
.owner-picker-person span:last-child {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.owner-summary-person .collab-avatar.small,
.owner-picker-person .collab-avatar.small {
  flex: 0 0 auto;
  width: 22px;
  height: 22px;
  border-width: 1px;
  font-size: 10px;
}

.owner-picker {
  display: grid;
  gap: 6px;
  height: 190px;
  max-height: 190px;
  align-content: start;
  overflow: auto;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.owner-picker + small {
  display: none;
}

.owner-picker-option {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  width: 100%;
  min-height: 34px;
  border: 1px solid transparent;
  border-color: transparent;
  background: transparent;
  text-align: left;
  outline: none;
}

.owner-picker-option:hover {
  border-color: transparent;
  background: #fffaf0;
}

.owner-picker-option:focus,
.owner-picker-option:focus-visible {
  outline: none;
}

.owner-picker-option.selected {
  border-color: #cfded3;
  background: #f1faf4;
}

.owner-picker-option span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.owner-picker-option strong {
  flex: 0 0 auto;
  color: var(--success);
  font-size: 11px;
}

.project-card-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.project-card-actions .open-project-button {
  min-width: 126px;
  border-color: #1f7348;
  background: var(--success);
  color: #fffdf6;
}

.project-card-actions .open-project-button:hover {
  border-color: #145c38;
}

.ghost-action {
  background: #fff;
}

.button-feedback {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  transition: border-color 160ms ease, color 160ms ease;
}

.button-feedback::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 0;
  background: var(--button-feedback-fill, var(--success));
  transform: scaleX(0);
  transform-origin: left center;
}

.button-feedback-label {
  position: relative;
  z-index: 1;
}

.button-feedback[data-feedback-tone="green"] {
  --button-feedback-fill: #258653;
}

.button-feedback[data-feedback-tone="orange"] {
  --button-feedback-fill: #d8891f;
}

.button-feedback.is-feedback-active {
  border-color: var(--button-feedback-fill, var(--success));
  color: #fffdf6;
}

.button-feedback.is-feedback-active::before {
  animation: buttonFeedbackFill 260ms ease-out forwards, buttonFeedbackDrain 520ms ease-in 3.26s forwards;
}

.button-feedback.is-feedback-active:disabled {
  opacity: 1;
  cursor: default;
}

@keyframes buttonFeedbackFill {
  from {
    transform: scaleX(0);
    transform-origin: left center;
  }
  to {
    transform: scaleX(1);
    transform-origin: left center;
  }
}

@keyframes buttonFeedbackDrain {
  from {
    transform: scaleX(1);
    transform-origin: right center;
  }
  to {
    transform: scaleX(0);
    transform-origin: right center;
  }
}

.user-id-field code {
  display: block;
  min-height: 34px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  overflow-wrap: anywhere;
  font-size: 12px;
}

.ai-intake-page {
  display: grid;
  gap: 14px;
}

.ai-intake-header,
.ai-intake-panel,
.ai-rules-panel {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--paper);
  box-shadow: var(--shadow);
}

.ai-intake-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  padding: 18px;
}

.ai-intake-header h1,
.ai-intake-panel h2,
.ai-rules-panel h2 {
  margin: 0;
}

.ai-intake-header p,
.ai-intake-panel li,
.ai-intake-panel p,
.ai-rules-panel p {
  color: var(--muted);
  line-height: 1.6;
}

.eyebrow {
  margin: 0 0 5px;
  color: var(--teal);
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

.ai-intake-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(320px, 0.9fr);
  gap: 14px;
}

.ai-intake-panel,
.ai-rules-panel {
  padding: 16px;
}

.ai-intake-panel ul {
  margin: 10px 0 0;
  padding-left: 20px;
}

.ai-link-field {
  display: grid;
  gap: 7px;
}

.ai-link-field > span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}

.ai-prompt-display {
  margin: 0;
  padding: 12px;
  border: 1px solid #eadbbb;
  border-radius: 8px;
  background: #fffdf7;
  color: var(--ink);
  font-family: Consolas, "Courier New", monospace;
  font-size: 12px;
  line-height: 1.5;
  white-space: pre-wrap;
  user-select: text;
}

.ai-link-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 10px;
}

.ai-rule-section {
  margin-top: 10px;
  border: 1px solid #eadbbb;
  border-radius: 8px;
  background: #fffdf7;
}

.ai-rule-section summary {
  cursor: pointer;
  padding: 10px 12px;
  font-size: 13px;
  font-weight: 900;
}

.ai-rule-section pre {
  max-height: none;
  margin: 0;
  overflow: visible;
  padding: 12px;
  border-top: 1px solid #eadbbb;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  font-family: Consolas, "Courier New", monospace;
  font-size: 12px;
  line-height: 1.55;
  user-select: text;
}

.admin-page {
  display: grid;
  gap: 14px;
}

.admin-header,
.admin-summary,
.admin-table-wrap {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--paper);
  box-shadow: var(--shadow);
}

.admin-header {
  padding: 18px;
}

.admin-header h1 {
  margin: 0;
}

.admin-header p {
  margin: 4px 0 0;
  color: var(--muted);
  line-height: 1.6;
}

.admin-summary {
  display: grid;
  grid-template-columns: minmax(180px, 0.4fr) minmax(0, 1fr);
  gap: 10px;
  padding: 12px;
}

.admin-summary div {
  min-width: 0;
  padding: 10px;
  border: 1px solid #eadbbb;
  border-radius: 8px;
  background: #fffdf7;
}

.admin-summary span,
.admin-user-main span,
.admin-user-meta span,
.admin-table-loading {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.admin-summary strong {
  display: block;
  margin-top: 4px;
  overflow-wrap: anywhere;
  font-size: 14px;
}

.admin-table-wrap {
  padding: 12px;
}

.admin-table {
  display: grid;
  gap: 8px;
}

.admin-user-row {
  display: grid;
  grid-template-columns: 48px minmax(180px, 1fr) minmax(130px, 0.35fr) auto;
  gap: 12px;
  align-items: center;
  min-height: 76px;
  padding: 10px;
  border: 1px solid #eadbbb;
  border-radius: 8px;
  background: #fffdf7;
}

.admin-avatar {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background-color: var(--avatar-bg, var(--teal));
  background-position: center;
  background-size: cover;
  color: #fffdf6;
  font-size: 14px;
  font-weight: 900;
}

.admin-user-main,
.admin-user-meta {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.admin-user-main strong,
.admin-user-main span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.role-badge {
  justify-self: start;
  padding: 4px 7px;
  border: 1px solid #d9c49e;
  border-radius: 999px;
  background: #fff;
  color: var(--muted) !important;
  font-weight: 900 !important;
}

.role-badge.role-super_admin {
  border-color: #c65b1d;
  background: #ffe2c4;
  color: #713100 !important;
}

.role-badge.role-sub_admin {
  border-color: #2b8074;
  background: #e4f5ef;
  color: #143f3a !important;
}

.admin-role-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 6px;
}

.admin-role-actions button {
  min-height: 32px;
  white-space: nowrap;
}

.admin-role-actions button.selected {
  border-color: #1f7348;
  background: var(--success);
  color: #fffdf6;
}

.metric {
  padding: 8px;
  border: 1px solid #eadbbb;
  border-radius: 8px;
  background: #fff;
}

.metric strong {
  display: block;
  font-size: 18px;
}

.metric span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}

.board-view {
  display: grid;
  gap: 18px;
}

.board-section {
  display: grid;
  grid-template-columns: minmax(280px, 360px) minmax(0, 1fr);
  gap: 14px;
  padding: 14px;
}

.shot-panel {
  position: sticky;
  top: 90px;
  align-self: start;
}

.shot-title h2 {
  margin: 0;
  font-size: 20px;
}

.shot-title span {
  display: block;
  margin: 3px 0 10px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}

.shot-wrap {
  position: relative;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #21171c;
}

.shot-wrap img {
  display: block;
  width: 100%;
  height: auto;
}

.pin,
.component-index {
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  transform: translate(-50%, -50%);
  border: 2px solid #fff;
  border-radius: 50%;
  background: var(--gold);
  color: #2b1708;
  font-size: 12px;
  font-weight: 900;
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.25);
}

.pin {
  position: absolute;
  left: var(--x);
  top: var(--y);
  touch-action: none;
}

body[data-mode="edit"] .shot-wrap .pin {
  cursor: grab;
}

body[data-mode="edit"] .shot-wrap .pin:active {
  cursor: grabbing;
}

.component-index {
  position: static;
  flex: 0 0 24px;
  transform: none;
}

.notes {
  display: grid;
  gap: 12px;
}

.note-card {
  display: grid;
  grid-template-columns: 150px minmax(0, 1fr);
  gap: 12px;
  padding: 12px;
  border: 1px solid #eadbbb;
  border-radius: 8px;
  background: #fff;
}

.note-image img,
.crop-ref {
  width: 150px;
  height: 96px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background-color: #24191f;
  object-fit: cover;
  cursor: zoom-in;
}

.crop-ref {
  background-image: var(--crop-src);
  background-repeat: no-repeat;
  background-size: var(--bg-w) var(--bg-h);
  background-position: var(--bg-x) var(--bg-y);
}

.note-copy {
  min-width: 0;
}

.note-copy h3 {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-width: 0;
  margin: 0 0 8px;
  font-size: 17px;
}

.component-title-wrap {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  flex: 1 1 auto;
}

.component-title-text {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.note-copy p {
  display: flex;
  gap: 0;
  min-width: 0;
  margin: 4px 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.55;
  overflow: hidden;
  white-space: nowrap;
}

.note-copy p strong {
  flex: 0 0 auto;
}

.note-copy p span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.completion-control {
  display: none;
  align-items: center;
  gap: 5px;
  color: var(--teal);
  font-size: 12px;
  white-space: nowrap;
}

body[data-mode="annotate"] .completion-control {
  display: inline-flex;
}

body[data-mode="edit"] [contenteditable="true"] {
  outline: 2px dashed rgba(19, 127, 120, 0.34);
  outline-offset: 2px;
  border-radius: 4px;
}

.screen-edit-tools,
.shot-edit-tools,
.section-edit-tools,
.edit-card-tools,
.asset-row-tools,
.mini-delete {
  display: none;
}

body[data-mode="edit"] .screen-edit-tools,
body[data-mode="edit"] .shot-edit-tools,
body[data-mode="edit"] .section-edit-tools,
body[data-mode="edit"] .edit-card-tools,
body[data-mode="edit"] .asset-row-tools,
body[data-mode="edit"] .mini-delete {
  display: flex;
}

.screen-edit-tools,
.shot-edit-tools,
.section-edit-tools,
.edit-card-tools,
.asset-row-tools {
  flex-wrap: wrap;
  gap: 6px;
}

.screen-edit-tools {
  padding-bottom: 8px;
  border-bottom: 1px solid var(--line);
}

.shot-edit-tools,
.section-edit-tools,
.edit-card-tools,
.asset-row-tools {
  margin-top: 8px;
}

.edit-card-tools button,
.asset-row-tools button,
.screen-edit-tools button,
.shot-edit-tools button,
.section-edit-tools button {
  min-height: 28px;
  padding: 0 8px;
  font-size: 11px;
}

.edit-card-tools [data-edit-component-crop],
.asset-row-tools [data-edit-subasset-crop] {
  border-color: #1f7348;
  background: var(--success);
  color: #fffdf6;
}

.edit-card-tools [data-delete-component] {
  border-color: #963832;
  background: var(--danger);
  color: #fffdf6;
}

.resource-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

.resource-strip code {
  display: inline-block;
  max-width: 180px;
  padding: 4px 7px;
  border: 1px solid #eadbbb;
  border-radius: 999px;
  background: #fffaf0;
  color: #6d4a12;
  font-size: 11px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.resource-chip-wrap {
  display: inline-flex;
  align-items: center;
  gap: 3px;
}

.mini-delete {
  align-items: center;
  justify-content: center;
  width: 20px;
  min-width: 20px;
  height: 20px;
  min-height: 20px;
  padding: 0;
  border-color: #e6b8aa;
  color: var(--danger);
  line-height: 1;
}

.asset-breakdown {
  margin-top: 10px;
}

.asset-breakdown h4 {
  margin: 0 0 6px;
  font-size: 13px;
}

.asset-row {
  display: grid;
  grid-template-columns: 68px minmax(0, 1fr);
  grid-template-areas: "thumb body";
  gap: 8px;
  align-items: start;
  padding: 7px 0;
  border-top: 1px dashed #eadbbb;
}

.asset-thumb-wrap {
  grid-area: thumb;
  width: 68px;
  min-width: 68px;
}

.asset-row-body {
  grid-area: body;
  min-width: 0;
}

.asset-row img,
.asset-row .crop-ref,
.asset-thumb-placeholder {
  width: 68px;
  height: 48px;
  border-radius: 7px;
  object-fit: cover;
  background-color: #24191f;
}

.asset-row .crop-ref.asset-thumb {
  width: 68px !important;
  height: 48px !important;
  background-image: var(--crop-src);
  background-size: var(--asset-bg-w) var(--asset-bg-h);
  background-position: var(--asset-bg-x) var(--asset-bg-y);
}

.asset-row strong,
.asset-row span {
  display: block;
  font-size: 12px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.asset-row span {
  margin-top: 2px;
  color: var(--muted);
}

.operation-log-item {
  display: grid;
  gap: 4px;
  padding: 10px;
  border-left: 3px solid var(--teal);
  box-shadow: none;
}

.operation-log-item strong {
  font-size: 13px;
}

.operation-log-item p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
}

.operation-log-diff {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  align-items: baseline;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.operation-log-old {
  color: #958a77;
  text-decoration: line-through;
}

.operation-log-arrow {
  color: #8f6b24;
  font-weight: 900;
}

.operation-log-new {
  color: var(--ink);
  font-weight: 800;
}

.project-summary {
  display: grid;
  gap: 6px;
  margin-bottom: 12px;
  padding: 10px;
  box-shadow: none;
}

.project-summary p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
}

.collab-editing {
  color: #9f4a24 !important;
  font-weight: 900;
}

.collab-notice {
  display: grid;
  gap: 8px;
  margin-top: 8px;
  padding: 9px;
  border: 1px solid #e3a63d;
  border-radius: 8px;
  background: #fff2cf;
  color: #6f4210;
  font-size: 12px;
}

.collab-notice button {
  justify-self: start;
  min-height: 28px;
  padding: 0 10px;
}

.empty-state {
  padding: 20px;
  color: var(--muted);
  box-shadow: none;
}

.image-preview {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: 42px;
  background: rgba(22, 16, 13, 0.84);
}

.image-preview[hidden] {
  display: none;
}

.image-preview button {
  position: absolute;
  right: 20px;
  top: 18px;
}

.image-preview img,
.image-preview-crop {
  max-width: min(96vw, 1100px);
  max-height: 88vh;
  border-radius: 10px;
  background: #22181e;
}

.image-preview-crop {
  background-repeat: no-repeat;
}

.confirm-dialog-backdrop {
  position: fixed;
  inset: 0;
  z-index: 70;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(35, 24, 32, 0.42);
}

.confirm-dialog-backdrop[hidden] {
  display: none !important;
}

.confirm-dialog {
  width: min(420px, 100%);
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--paper);
  box-shadow: var(--shadow);
}

.confirm-dialog h2 {
  margin: 0;
  color: var(--ink);
  font-size: 18px;
  line-height: 1.45;
}

.confirm-dialog-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 16px;
}

.confirm-dialog-actions button {
  min-height: 40px;
  border-radius: 8px;
  color: #fffdf6;
}

.save-switch-button {
  border-color: #1f7348;
  background: var(--success);
}

.cancel-switch-button {
  border-color: #9d352f;
  background: var(--danger);
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 75;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(35, 24, 32, 0.42);
  user-select: none;
}

.modal-backdrop[hidden] {
  display: none !important;
}

.modal-panel {
  position: relative;
  width: min(560px, 100%);
  max-height: min(86vh, 720px);
  overflow: auto;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--paper);
  box-shadow: var(--shadow);
  user-select: none;
}

[data-project-panel] .modal-panel {
  width: min(620px, calc(100vw - 40px));
  max-height: calc(100vh - 28px);
  overflow: visible;
}

.announcement-panel {
  width: min(480px, calc(100vw - 40px));
  margin: auto;
  color: inherit;
}

.announcement-panel::backdrop {
  background: rgba(35, 24, 32, 0.42);
}

.announcement-content {
  line-height: 1.8;
}

.compact-modal {
  width: min(420px, 100%);
}

.help-backdrop {
  padding: 18px;
}

.help-panel {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  width: min(1120px, calc(100vw - 36px));
  height: min(820px, calc(100vh - 36px));
  max-height: calc(100vh - 36px);
  overflow: hidden;
  padding: 16px;
}

.help-layout {
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  min-height: 0;
  border: 1px solid #eadbbb;
  border-radius: 8px;
  background: #fffdf7;
  overflow: hidden;
}

.help-nav {
  display: grid;
  align-content: start;
  gap: 8px;
  min-height: 0;
  padding: 12px;
  border-right: 1px solid #eadbbb;
  overflow: auto;
  background: #fffaf0;
}

.help-nav-group {
  border: 1px solid #eadbbb;
  border-radius: 8px;
  background: #fff;
  overflow: hidden;
}

.help-nav-group summary {
  cursor: pointer;
  padding: 10px 11px;
  color: #4c3715;
  font-size: 13px;
  font-weight: 900;
}

.help-nav-group div {
  display: grid;
  gap: 2px;
  padding: 0 6px 8px;
}

.help-nav button {
  justify-content: flex-start;
  min-height: 30px;
  padding: 0 9px;
  border-color: transparent;
  background: transparent;
  color: var(--muted);
  text-align: left;
}

.help-nav button:hover,
.help-nav button.active {
  border-color: #cfded3;
  background: #f0faf4;
  color: #185d3b;
}

.help-content {
  min-width: 0;
  overflow: auto;
  padding: 20px 24px 28px;
  background: #fffdf7;
}

.help-content-header {
  display: grid;
  gap: 4px;
  margin-bottom: 14px;
}

.help-content-header p {
  margin: 0;
  color: var(--teal);
  font-size: 12px;
  font-weight: 900;
}

.help-content-header h2 {
  margin: 0;
  font-size: 25px;
}

.help-body {
  display: grid;
  gap: 12px;
  color: var(--ink);
}

.help-body h3 {
  margin: 6px 0 0;
  font-size: 16px;
}

.help-body p {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.75;
}

.help-figure {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 124px;
  padding: 14px;
  border: 1px solid #eadbbb;
  border-radius: 8px;
  background: linear-gradient(135deg, #fff7df, #eef8f2);
  overflow: hidden;
}

.help-chip,
.help-mode-pill,
.help-action-demo,
.help-tool-demo,
.help-arrow,
.help-card-demo,
.help-prompt-demo,
.help-pane-demo,
.help-main-demo,
.help-log-demo {
  border: 1px solid #dacbb0;
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  font-size: 12px;
  font-weight: 900;
}

.help-chip,
.help-mode-pill,
.help-action-demo,
.help-tool-demo,
.help-arrow,
.help-log-demo {
  display: inline-grid;
  place-items: center;
  min-height: 32px;
  padding: 0 10px;
  white-space: nowrap;
}

.help-chip.active,
.help-mode-pill.active {
  border-color: #bd8426;
  background: #f7c760;
  color: #2b1708;
}

.help-card-demo {
  display: grid;
  gap: 5px;
  min-width: 160px;
  padding: 12px;
}

.help-card-demo span,
.help-pane-demo span,
.help-main-demo span {
  color: var(--muted);
  font-size: 11px;
}

.help-prompt-demo {
  flex: 1 1 auto;
  min-width: 0;
  padding: 11px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.help-arrow {
  border-color: #cfded3;
  background: #f0faf4;
  color: #185d3b;
}

.layout-figure {
  align-items: stretch;
}

.help-pane-demo,
.help-main-demo {
  display: grid;
  place-items: center;
  gap: 4px;
  min-height: 96px;
  padding: 10px;
  text-align: center;
}

.help-pane-demo {
  width: 130px;
}

.help-main-demo {
  flex: 1 1 auto;
  min-width: 180px;
  border-color: #cbd9e6;
  background: #f4f9ff;
}

.mode-figure,
.edit-mode-figure,
.screen-tools-figure,
.component-tools-figure,
.resource-tools-figure,
.identity-figure,
.logs-figure {
  flex-wrap: wrap;
}

.help-action-demo.green,
.help-tool-demo.green {
  border-color: #1f7348;
  background: var(--success);
  color: #fffdf6;
}

.help-action-demo.red,
.help-tool-demo.red {
  border-color: #963832;
  background: var(--danger);
  color: #fffdf6;
}

.help-pin-demo {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border: 2px solid #fff;
  border-radius: 50%;
  background: var(--gold);
  color: #2b1708;
  font-size: 13px;
  font-weight: 900;
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.22);
}

.crop-tools-figure {
  justify-content: center;
}

.help-image-demo {
  position: relative;
  width: min(360px, 100%);
  height: 120px;
  border: 1px solid #cab985;
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.58), rgba(255, 255, 255, 0)),
    linear-gradient(90deg, #e9f2d4 0 28%, #fff0c5 28% 66%, #d8edf3 66%);
  overflow: hidden;
}

.help-crop-box {
  position: absolute;
  left: 28%;
  top: 24%;
  width: 46%;
  height: 48%;
  border: 2px solid #fff7df;
  box-shadow: 0 0 0 999px rgba(0, 0, 0, 0.38);
}

.resource-tools-figure code,
.identity-figure code {
  padding: 7px 9px;
  border: 1px solid #eadbbb;
  border-radius: 999px;
  background: #fff;
  color: #6d4a12;
  font-size: 12px;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.modal-header h2 {
  margin: 0;
  font-size: 19px;
}

.modal-header button {
  width: 34px;
  min-width: 34px;
  padding: 0;
}

.form-grid {
  display: grid;
  gap: 12px;
}

[data-project-panel] .form-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px 12px;
}

[data-project-panel] .form-grid > :not(.owner-field) {
  grid-column: 1 / -1;
}

[data-project-panel] textarea {
  min-height: 66px;
  max-height: 78px;
  resize: vertical;
}

.form-grid label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}

.owner-field > span {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.owner-field > span::after {
  content: "支持多选";
  color: var(--teal);
  font-size: 11px;
  font-weight: 900;
}

.form-grid small {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
}

.required-mark,
.field-error {
  color: var(--danger);
}

.field-error {
  font-size: 12px !important;
}

.form-grid input,
.form-grid textarea,
.form-grid select,
.delete-project-zone input {
  width: 100%;
  min-height: 36px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  user-select: text;
}

.form-grid select {
  min-height: 96px;
}

.avatar-picker,
.preview-picker {
  display: grid;
  gap: 8px;
  justify-items: center;
  min-height: 90px;
  padding: 12px;
  background: #fff;
}

.preview-picker {
  position: relative;
  place-items: center;
  aspect-ratio: 2 / 1;
  height: auto;
  min-height: 0;
  overflow: hidden;
  background-position: center;
  background-repeat: no-repeat;
  background-size: cover;
}

.preview-picker::before,
.preview-picker::after {
  content: "";
  position: absolute;
  left: 50%;
  top: calc(50% - 12px);
  width: 68px;
  height: 2px;
  border-radius: 999px;
  background: #d85d36;
  transform: translate(-50%, -50%);
}

.preview-picker::after {
  width: 2px;
  height: 68px;
}

.preview-picker.has-preview::before,
.preview-picker.has-preview::after {
  display: none;
}

.preview-picker img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border-radius: 8px;
  object-fit: cover;
  background: #24191f;
  background-position: center;
  background-repeat: no-repeat;
  background-size: cover;
}

.preview-picker img[hidden] {
  display: none !important;
}

.preview-picker span {
  position: relative;
  z-index: 1;
  align-self: end;
  margin-bottom: 6px;
}

.preview-picker.has-preview span {
  padding: 4px 8px;
  border-radius: 999px;
  background: rgba(255, 250, 240, 0.86);
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 14px;
}

.modal-actions:has([data-save-project-config]) {
  align-items: center;
}

.delete-project-entry {
  margin-right: auto;
}

.primary-action {
  border-color: #1f7348;
  background: var(--success);
  color: #fffdf6;
}

.danger-action {
  border-color: #9d352f;
  background: var(--danger);
  color: #fffdf6;
}

.delete-project-zone {
  position: absolute;
  left: 16px;
  right: 16px;
  bottom: 70px;
  z-index: 2;
  display: grid;
  gap: 8px;
  margin-top: 14px;
  padding: 12px;
  border: 1px solid #e6b8aa;
  border-radius: 8px;
  background: #fff6f3;
  box-shadow: var(--shadow);
}

.delete-project-zone p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
}

.delete-project-zone button[data-cancel-delete-project] {
  justify-self: start;
}

.crop-editor-backdrop {
  position: fixed;
  inset: 0;
  z-index: 90;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 12px;
  padding: 16px;
  background: rgba(18, 12, 22, 0.84);
}

.crop-editor-backdrop[hidden] {
  display: none !important;
}

.crop-editor-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: #fff7df;
  font-size: 13px;
  font-weight: 900;
}

.crop-editor-title {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.crop-editor-actions {
  display: flex;
  flex: 0 0 auto;
  gap: 8px;
}

.crop-editor-actions button {
  min-height: 34px;
  padding: 0 14px;
  border: 1px solid rgba(255, 247, 223, 0.42);
  border-radius: 999px;
  background: rgba(255, 250, 240, 0.12);
  color: #fff7df;
  font-size: 13px;
}

.crop-editor-actions .primary {
  border-color: #bd8426;
  background: #f7c760;
  color: #2b1708;
}

.crop-editor-stage {
  display: grid;
  place-items: center;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
}

.crop-editor-viewport {
  position: relative;
  display: inline-block;
  max-width: min(92vw, 980px);
  max-height: calc(100vh - 92px);
  overflow: hidden;
  border-radius: 8px;
  background: #1f1721;
  touch-action: none;
}

.crop-editor-viewport img {
  display: block;
  width: auto;
  height: auto;
  max-width: min(92vw, 980px);
  max-height: calc(100vh - 92px);
  object-fit: contain;
  pointer-events: none;
  user-select: none;
  background: #1f1721;
  box-shadow: 0 18px 60px rgba(0, 0, 0, 0.45);
}

.project-preview-mode .crop-editor-viewport {
  display: block;
  max-width: calc(100vw - 80px);
  max-height: calc(100vh - 150px);
  overflow: visible;
  border: 0;
  border-radius: 0;
  background: transparent;
  cursor: grab;
}

.project-preview-mode .crop-editor-viewport:active {
  cursor: grabbing;
}

.project-preview-mode .crop-editor-viewport img {
  position: absolute;
  z-index: 1;
  display: block;
  max-width: none;
  max-height: none;
  object-fit: fill;
  pointer-events: none;
}

.crop-selection {
  position: absolute;
  border: 2px solid #f7c760;
  background: rgba(247, 199, 96, 0.12);
  box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.42);
  cursor: move;
}

.project-preview-mode .crop-selection {
  z-index: 2;
  border-color: #fff7df;
  background: transparent;
  box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.58);
  cursor: inherit;
  pointer-events: none;
}

.project-preview-mode .crop-handle {
  display: none;
}

.crop-handle {
  position: absolute;
  width: 12px;
  height: 12px;
  border: 2px solid #2b1708;
  border-radius: 50%;
  background: #f7c760;
  transform: translate(-50%, -50%);
}

.crop-handle[data-crop-handle="n"] { left: 50%; top: 0; cursor: ns-resize; }
.crop-handle[data-crop-handle="s"] { left: 50%; top: 100%; cursor: ns-resize; }
.crop-handle[data-crop-handle="e"] { left: 100%; top: 50%; cursor: ew-resize; }
.crop-handle[data-crop-handle="w"] { left: 0; top: 50%; cursor: ew-resize; }
.crop-handle[data-crop-handle="ne"] { left: 100%; top: 0; cursor: nesw-resize; }
.crop-handle[data-crop-handle="nw"] { left: 0; top: 0; cursor: nwse-resize; }
.crop-handle[data-crop-handle="se"] { left: 100%; top: 100%; cursor: nwse-resize; }
.crop-handle[data-crop-handle="sw"] { left: 0; top: 100%; cursor: nesw-resize; }

@media (max-width: 1100px) {
  .flowmark-shell {
    grid-template-columns: 220px minmax(0, 1fr);
  }

  .right-pane {
    position: static;
    grid-column: 1 / -1;
    height: auto;
    border-left: 0;
    border-top: 1px solid var(--line);
  }
}

@media (max-width: 820px) {
  .topbar {
    position: static;
    display: grid;
    grid-template-columns: 1fr;
  }

  .flowmark-shell,
  .board-section,
  .project-card,
  .note-card {
    grid-template-columns: 1fr;
  }

  .left-pane,
  .right-pane,
  .shot-panel {
    position: static;
    height: auto;
  }

  body {
    overflow: auto;
  }

  .flowmark-shell,
  .main-pane {
    height: auto;
    overflow: visible;
  }

  .left-pane {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .project-metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .help-panel {
    width: calc(100vw - 20px);
    height: calc(100vh - 20px);
  }

  .help-layout {
    grid-template-columns: 1fr;
  }

  .help-nav {
    max-height: 220px;
    border-right: 0;
    border-bottom: 1px solid #eadbbb;
  }
}
