:root {
  color-scheme: light;
  --bg: #f4f7f9;
  --surface: #ffffff;
  --surface-raised: #ffffff;
  --surface-muted: #f7f9fb;
  --line: #d7dee6;
  --grid-line: #dce3ea;
  --grid-head: #eef3f7;
  --text: #1f2933;
  --muted: #607080;
  --blue: #009fe3;
  --teal: #009fe3;
  --amber: #f2b705;
  --orange: #009fe3;
  --red: #c73535;
  --green: #009fe3;
  --ink: #101820;
  --shadow: 0 10px 24px rgba(31, 41, 51, 0.08);
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

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

body {
  margin: 0;
  color: var(--text);
  background: var(--bg);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 13px;
  line-height: 1.35;
}

a {
  color: var(--blue);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

.app-layout {
  display: grid;
  grid-template-columns: 216px minmax(0, 1fr);
  min-height: 100vh;
}

.app-shell {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 12px;
  width: 216px;
  height: 100vh;
  min-height: 100vh;
  padding: 14px 12px;
  background: #ffffff;
  border-right: 1px solid var(--line);
  backdrop-filter: blur(16px);
  transition: width 160ms ease, padding 160ms ease;
}

.sidebar-head,
.brand,
.main-nav {
  display: flex;
  gap: 8px;
}

.sidebar-head {
  align-items: center;
  justify-content: space-between;
}

.brand {
  align-items: center;
  min-width: 0;
  padding: 3px 7px 10px;
  color: var(--ink);
  font-size: 13px;
  font-weight: 800;
}

.brand:hover {
  text-decoration: none;
}

.brand-mark {
  flex: 0 0 auto;
  display: inline-grid;
  place-items: center;
  width: 30px;
  height: 30px;
  color: #ffffff;
  background: var(--ink);
  border-radius: 7px;
  letter-spacing: 0;
}

.brand-label,
.nav-label {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sidebar-toggle {
  flex: 0 0 auto;
  width: 30px;
  min-width: 30px;
  min-height: 28px;
  padding: 0;
  color: var(--muted);
  background: var(--surface-raised);
  border-color: var(--line);
  font-size: 16px;
}

.sidebar-toggle .nav-label {
  display: none;
}

.sidebar-toggle:hover,
.sidebar-toggle:focus {
  color: var(--ink);
  border-color: var(--green);
}

.main-nav a {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 30px;
  padding: 0 8px;
  color: var(--muted);
  border-radius: 6px;
  font-size: 12px;
  font-weight: 700;
}

.nav-icon {
  flex: 0 0 22px;
  display: inline-grid;
  place-items: center;
  width: 22px;
  min-width: 22px;
  height: 22px;
  color: inherit;
  font-size: 15px;
  line-height: 1;
  text-align: center;
}

.main-nav {
  flex-direction: column;
}

.main-nav a:hover,
.main-nav a.active {
  color: var(--ink);
  background: var(--surface-raised);
  text-decoration: none;
}

.user-menu {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: end;
  gap: 10px;
  margin-top: auto;
  padding: 10px 6px 0;
  border-top: 1px solid var(--line);
}

.user-menu .user-summary {
  display: flex;
  align-items: center;
  width: 100%;
  gap: 8px;
  min-width: 0;
}

.user-avatar {
  flex: 0 0 28px;
  display: inline-grid;
  place-items: center;
  width: 28px;
  height: 28px;
  color: #ffffff;
  background: var(--green);
  border-radius: 6px;
  font-size: 12px;
  font-weight: 900;
}

.user-details {
  display: grid;
  justify-items: start;
  gap: 1px;
  font-size: 12px;
  line-height: 1.1;
}

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

.user-menu form {
  width: 100%;
}

.signout-button {
  width: 100%;
  justify-content: flex-start;
}

@media (min-width: 981px) {
  .app-layout.nav-collapsed {
    grid-template-columns: 56px minmax(0, 1fr);
  }

  .app-layout.nav-collapsed .app-shell {
    align-items: center;
    width: 56px;
    padding: 10px 8px;
    overflow: hidden;
  }

  .app-layout.nav-collapsed .app-shell .nav-label {
    display: none;
  }

  .app-layout.nav-collapsed .app-shell .sidebar-head,
  .app-layout.nav-collapsed .app-shell .main-nav a,
  .app-layout.nav-collapsed .app-shell .user-menu {
    align-items: center;
    justify-content: center;
  }

  .app-layout.nav-collapsed .app-shell .brand {
    display: none;
  }

  .app-layout.nav-collapsed .app-shell .sidebar-toggle {
    margin: 0 auto;
    background: var(--surface-raised);
    box-shadow: inset 0 0 0 1px rgba(0, 159, 227, 0.18);
  }

  .app-layout.nav-collapsed .app-shell .main-nav a {
    width: 36px;
    min-height: 32px;
    padding: 0;
    background: var(--surface-muted);
    border: 1px solid var(--line);
  }

  .app-layout.nav-collapsed .app-shell .main-nav a:hover,
  .app-layout.nav-collapsed .app-shell .main-nav a.active {
    border-color: var(--green);
    background: var(--surface-raised);
  }

  .app-layout.nav-collapsed .app-shell .user-menu {
    padding: 8px 0 0;
  }

  .app-layout.nav-collapsed .app-shell .user-menu form,
  .app-layout.nav-collapsed .app-shell .signout-button {
    width: 36px;
  }

  .app-layout.nav-collapsed .app-shell .signout-button {
    min-height: 32px;
    padding: 0;
    border-color: var(--line);
    justify-content: center;
  }
}

.login-methods {
  display: grid;
  gap: 10px;
}

.login-provider {
  width: 100%;
  justify-content: center;
}

.demo-login {
  margin-top: 18px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.demo-login summary {
  color: var(--muted);
  cursor: pointer;
  font-size: 12px;
  font-weight: 800;
}

.demo-login .stack-form {
  margin-top: 12px;
}

.page {
  width: 100%;
  max-width: none;
  min-width: 0;
  margin: 0;
  padding: 14px 12px 44px;
}

.auth-page {
  display: grid;
  min-height: 100vh;
  padding: 32px 20px;
}

.page-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 10px;
}

.page-heading h1 {
  margin: 0;
  font-size: clamp(20px, 2.2vw, 30px);
  line-height: 1.08;
}

.page-heading-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.project-actions-menu {
  position: relative;
  z-index: 20;
}

.project-header-icon-form {
  margin: 0;
}

.project-actions-menu summary {
  list-style: none;
  cursor: pointer;
}

.project-actions-menu summary::-webkit-details-marker {
  display: none;
}

.project-actions-dropdown {
  position: absolute;
  right: 0;
  top: calc(100% + 6px);
  min-width: 190px;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface-raised);
  box-shadow: var(--shadow);
}

.project-actions-dropdown a,
.project-actions-dropdown button,
.project-actions-dropdown .project-action-disabled {
  display: block;
  width: 100%;
  padding: 6px 8px;
  border: 0;
  border-radius: 4px;
  background: transparent;
  color: var(--text);
  font: inherit;
  text-align: left;
  text-decoration: none;
  cursor: pointer;
  font-size: 12px;
  line-height: 1.2;
}

.project-actions-dropdown .danger-text {
  color: var(--red);
  font-weight: 700;
}

.project-actions-dropdown .project-action-disabled {
  color: var(--muted);
  cursor: default;
}

.project-actions-dropdown a:hover,
.project-actions-dropdown button:hover {
  background: rgba(110, 159, 255, 0.12);
  text-decoration: none;
}

.project-actions-dropdown form {
  margin: 0;
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--teal);
  font-size: 10.5px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

.panel {
  margin-bottom: 14px;
  padding: 14px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.scope-panel {
  margin-bottom: 14px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.project-properties-panel {
  margin-bottom: 14px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.scope-panel summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 42px;
  padding: 8px 12px;
  cursor: pointer;
  border-bottom: 1px solid var(--line);
}

.project-properties-panel summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 42px;
  padding: 8px 12px;
  cursor: pointer;
  border-bottom: 1px solid var(--line);
}

.project-properties-panel summary strong,
.project-properties-panel summary small {
  display: block;
}

.project-properties-panel summary small {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
}

.project-properties-form {
  padding: 16px;
}

.project-properties-form[hidden],
[data-edit-panel][hidden],
[data-form-panel][hidden] {
  display: none;
}

.project-properties-read {
  display: grid;
  gap: 12px;
  padding-bottom: 16px;
}

.project-properties-actions {
  display: flex;
  justify-content: flex-end;
  padding: 0 16px;
}

.project-readonly-summary {
  margin: 16px;
}

.scope-panel summary strong,
.scope-panel summary small {
  display: block;
}

.scope-panel summary small {
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}

.scope-menu-button {
  width: 28px;
  min-width: 28px;
  min-height: 24px;
  padding: 0;
  line-height: 1;
}

.scope-control {
  padding: 10px;
}

.scope-read {
  cursor: context-menu;
}

.scope-inline-editor {
  display: grid;
  gap: 12px;
}

.scope-inline-editor[hidden],
.scope-read[hidden] {
  display: none;
}

.scope-editor-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

.scope-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(320px, 0.9fr);
  gap: 16px;
  padding: 16px;
}

.scope-editor {
  display: grid;
  align-content: start;
  gap: 12px;
}

.markdown-body {
  min-height: 120px;
  padding: 10px 12px;
  background: #fbfcfd;
  border: 1px solid var(--line);
  border-radius: 7px;
  font-size: 12.5px;
  line-height: 1.35;
}

.markdown-body h1,
.markdown-body h2,
.markdown-body h3,
.markdown-body h4,
.markdown-body h5,
.markdown-body h6,
.markdown-body p,
.markdown-body ul,
.markdown-body ol,
.markdown-body pre {
  margin-top: 0;
}

.markdown-body h1 {
  margin-bottom: 8px;
  font-size: 17px;
}

.markdown-body h2 {
  margin-bottom: 7px;
  font-size: 15px;
}

.markdown-body h3 {
  margin-bottom: 6px;
  font-size: 13px;
}

.markdown-body h4 {
  margin-bottom: 6px;
  font-size: 12.5px;
  font-weight: 700;
}

.markdown-body h5,
.markdown-body h6 {
  margin-bottom: 5px;
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
}

.markdown-body p,
.markdown-body ul,
.markdown-body ol {
  margin-bottom: 8px;
}

.markdown-body a {
  color: var(--blue);
  font-weight: 600;
  text-decoration: none;
}

.markdown-body a:hover {
  text-decoration: underline;
}

.markdown-body code,
.markdown-body pre {
  background: #eef1f4;
  border-radius: 5px;
}

.markdown-body code {
  padding: 1px 4px;
}

.markdown-color-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  white-space: nowrap;
}

.markdown-color-swatch {
  width: 13px;
  height: 13px;
  flex: 0 0 auto;
  border: 1px solid rgba(0, 0, 0, 0.22);
  border-radius: 3px;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.28);
}

.markdown-color-text {
  font-weight: 600;
}

.markdown-body pre {
  overflow-x: auto;
  padding: 8px;
}

.markdown-body pre code {
  padding: 0;
}

.markdown-body table {
  width: 100%;
  margin: 0 0 10px;
  border-collapse: collapse;
  font-size: 12px;
}

.markdown-body th,
.markdown-body td {
  padding: 6px 8px;
  border: 1px solid var(--line);
  vertical-align: top;
}

.markdown-body th {
  color: var(--ink);
  background: #eef3f7;
  font-weight: 600;
}

.markdown-body tr:nth-child(even) td {
  background: #f7fafc;
}

.docs-layout {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}

.docs-sidebar {
  position: sticky;
  top: 18px;
  max-height: calc(100vh - 36px);
  overflow: auto;
  padding: 10px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.docs-nav-list {
  display: grid;
  gap: 2px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.docs-nav-list .docs-nav-list {
  margin: 4px 0 6px 12px;
  padding-left: 10px;
  border-left: 1px solid var(--line);
}

.docs-nav-list a,
.docs-nav-list span {
  display: block;
  padding: 5px 7px;
  color: var(--muted);
  border-radius: 6px;
  font-size: 12px;
  font-weight: 800;
}

.docs-nav-list a:hover,
.docs-nav-list li.active > a {
  color: var(--ink);
  background: var(--surface-raised);
  text-decoration: none;
}

.docs-nav-list li.open > a,
.docs-nav-list li.open > span {
  color: var(--ink);
}

.docs-article {
  min-height: calc(100vh - 120px);
  padding: 20px;
}

.docs-article h1 {
  font-size: 21px;
}

.docs-article h2 {
  margin-top: 18px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
  font-size: 16px;
}

.docs-article h3 {
  margin-top: 14px;
  font-size: 14px;
}

.docs-article h4 {
  margin-top: 12px;
  font-size: 13px;
}

.docs-article h5,
.docs-article h6 {
  margin-top: 10px;
  font-size: 12px;
}

.docs-article li {
  margin: 6px 0;
}

.sheet-heading {
  align-items: center;
}

.project-detail-layout {
  display: flex;
  flex-direction: column;
  gap: 6px;
  height: calc(100dvh - 58px);
  min-height: 0;
}

.project-detail-layout .page-heading,
.project-detail-layout .scope-panel,
.project-detail-layout .project-properties-panel,
.project-detail-layout .sheet-frame,
.project-detail-layout .panel {
  margin-bottom: 0;
}

.project-detail-layout .page-heading h1 {
  font-size: clamp(18px, 1.7vw, 24px);
}

.project-title-with-countdown {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 8px;
}

.project-onair-countdown {
  display: inline-flex;
  align-items: center;
  min-height: 20px;
  padding: 2px 7px;
  border: 1px solid var(--border-strong);
  border-radius: 4px;
  background: var(--surface-muted);
  color: var(--blue);
  font-size: 12px;
  font-weight: 600;
  line-height: 1;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.project-detail-layout .scope-panel summary,
.project-detail-layout .project-properties-panel summary {
  min-height: 34px;
  padding: 6px 10px;
}

.project-detail-layout .scope-panel:not([open]) summary,
.project-detail-layout .project-properties-panel:not([open]) summary {
  min-height: 26px;
  padding: 3px 8px;
  border-bottom: 0;
}

.project-detail-layout .scope-panel:not([open]),
.project-detail-layout .project-properties-panel:not([open]) {
  border-radius: 6px;
  box-shadow: none;
}

.project-detail-layout .scope-panel:not([open]) summary > span,
.project-detail-layout .project-properties-panel:not([open]) summary > span {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.project-detail-layout .scope-panel:not([open]) summary strong,
.project-detail-layout .project-properties-panel:not([open]) summary strong {
  font-size: 11.5px;
  line-height: 1;
}

.project-detail-layout .scope-panel:not([open]) summary small {
  display: none;
}

.project-detail-layout .project-properties-panel:not([open]) summary small {
  display: inline-flex;
  align-items: center;
  min-height: 18px;
  padding: 0 6px;
  color: var(--muted);
  background: var(--surface-muted);
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 10px;
  line-height: 1;
}

.project-detail-layout .scope-panel:not([open]) .scope-menu-button {
  width: 22px;
  min-width: 22px;
  min-height: 20px;
  font-size: 11px;
}

.project-detail-layout .scope-control .markdown-body {
  max-height: 210px;
  overflow: auto;
}

.project-detail-layout .project-properties-read {
  padding-bottom: 10px;
}

.project-detail-layout .project-readonly-summary {
  margin: 8px 10px;
}

.project-detail-layout .project-properties-actions {
  padding: 0 10px;
}

.project-detail-layout .page-heading,
.project-detail-layout .scope-panel,
.project-detail-layout .project-properties-panel {
  flex: 0 0 auto;
}

.project-detail-layout .project-grid-frame {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  min-height: 0;
  margin-bottom: 0;
}

.sheet-frame {
  width: 100%;
  max-width: none;
  margin-bottom: 20px;
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--grid-line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.sheet-toolbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: grid;
  grid-template-columns: minmax(220px, 1fr) auto minmax(160px, auto);
  align-items: center;
  gap: 10px;
  min-height: 42px;
  padding: 6px 10px;
  background: #ffffff;
  border-bottom: 1px solid var(--grid-line);
}

.project-portfolio-toolbar {
  grid-template-columns: minmax(220px, 1fr) auto;
}

.sheet-title {
  display: flex;
  align-items: baseline;
  gap: 7px;
  min-width: 0;
}

.sheet-title strong {
  overflow: hidden;
  font-size: 13.5px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sheet-title span,
.sheet-total {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
}

.sheet-tabs {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-height: 28px;
  padding: 2px;
  background: #eef1f4;
  border: 1px solid var(--grid-line);
  border-radius: 7px;
}

.sheet-tabs span,
.sheet-tabs button {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  padding: 0 8px;
  color: var(--muted);
  background: transparent;
  border: 0;
  border-radius: 5px;
  font-size: 11.5px;
  font-weight: 800;
}

.sheet-tabs .active {
  color: var(--ink);
  background: #ffffff;
  box-shadow: 0 1px 3px rgba(20, 25, 30, 0.12);
}

.sheet-actions {
  display: flex;
  justify-content: end;
  align-items: center;
  gap: 6px;
}

.unsaved-indicator,
.live-sync-indicator {
  display: inline-flex;
  align-items: center;
  min-height: 20px;
  padding: 0 7px;
  border-radius: 999px;
  font-size: 10.5px;
  font-weight: 750;
  white-space: nowrap;
}

.unsaved-indicator {
  color: #006fa6;
  background: #e7f6fd;
  border: 1px solid #b8e3f6;
}

.live-sync-indicator {
  color: var(--muted);
  background: #f7f9fb;
  border: 1px solid var(--grid-line);
}

.live-sync-indicator[data-tone="ok"] {
  color: #006fa6;
  border-color: #b8e3f6;
}

.live-sync-indicator[data-tone="warning"] {
  color: #7a5a00;
  border-color: #e9d28a;
}

.live-sync-indicator[data-tone="error"] {
  color: #ffb4b4;
  border-color: rgba(255, 89, 89, 0.45);
}

.presence-strip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 22px;
  max-width: 260px;
  padding: 0 7px;
  border: 1px solid var(--grid-line);
  border-radius: 999px;
  background: #f7f9fb;
  color: var(--muted);
  font-size: 10.5px;
  font-weight: 750;
  white-space: nowrap;
}

.presence-strip.has-presence-error {
  border-color: rgba(255, 89, 89, 0.42);
}

.presence-count {
  max-width: 86px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.presence-avatars {
  display: inline-flex;
  align-items: center;
  min-width: 0;
}

.presence-avatar,
.presence-more {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  margin-left: -5px;
  border: 1px solid var(--grid-head);
  border-radius: 50%;
  background: #e6edf3;
  color: var(--text);
  font-size: 9.5px;
  font-weight: 850;
  letter-spacing: 0;
}

.presence-avatar:first-child,
.presence-more:first-child {
  margin-left: 0;
}

.presence-avatar.is-current-user {
  background: var(--green);
  color: #ffffff;
}

.presence-more {
  background: #edf2f6;
  color: var(--muted);
}

.sheet-summary {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 0;
  background: var(--grid-head);
  border-bottom: 1px solid var(--grid-line);
}

.sheet-summary span {
  min-height: 30px;
  padding: 7px 9px;
  color: var(--muted);
  border-right: 1px solid var(--grid-line);
  font-size: 11px;
  font-weight: 800;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sheet-summary span:last-child {
  border-right: 0;
}

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

.cost-health-panel {
  display: grid;
  grid-template-columns: repeat(5, minmax(120px, 1fr)) auto;
  gap: 10px;
  padding: 14px;
  background: var(--surface-raised);
  border-bottom: 1px solid var(--grid-line);
}

.cost-health-panel > div,
.cost-health-panel form {
  display: grid;
  align-content: center;
  min-height: 58px;
  padding: 10px 12px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 7px;
}

.cost-health-panel span,
.cost-health-panel small {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.cost-health-panel strong {
  color: var(--ink);
}

.cost-health-panel.is-overrun {
  background: rgba(242, 73, 92, 0.12);
}

.cost-health-panel.is-overrun .cost-health-state {
  border-color: var(--red);
  box-shadow: inset 3px 0 0 var(--red);
}

.cost-health-panel.is-overrun .cost-health-state strong {
  color: var(--red);
}

.logged-cost-row {
  background: rgba(0, 159, 227, 0.07);
}

.cost-comparison-table .cost-actual {
  background: rgba(0, 159, 227, 0.07);
}

.cost-comparison-table .cost-estimate {
  background: rgba(110, 159, 255, 0.06);
}

.cost-comparison-table .is-cost-over {
  box-shadow: inset 2px 0 0 var(--red);
}

.cost-comparison-table .cost-delta-over {
  color: var(--red);
  font-weight: 900;
}

.cost-comparison-table .cost-delta-under {
  color: var(--green);
  font-weight: 900;
}

.cost-comparison-table tfoot td {
  position: sticky;
  bottom: 0;
  z-index: 2;
  background: var(--grid-head);
  border-top: 1px solid var(--line);
  font-weight: 900;
}

.sheet-scroll {
  width: 100%;
  max-height: 68vh;
  overflow: auto;
}

.portfolio-scroll {
  overflow-x: auto;
  overflow-y: visible;
}

.portfolio-scroll .sheet-table thead th {
  position: static;
}

.portfolio-scroll .sheet-table {
  width: max-content;
  min-width: max(100%, 1500px);
}

.project-list-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-height: 38px;
  padding: 6px 10px;
  background: var(--surface-muted);
  border-bottom: 1px solid var(--grid-line);
}

.project-search-form {
  display: flex;
  align-items: center;
  flex: 1 1 520px;
  gap: 6px;
  min-width: min(100%, 360px);
}

.project-search-form input {
  max-width: 620px;
  min-height: 28px;
}

.project-result-count,
.project-pagination span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
}

.project-pagination {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  padding: 8px 10px 10px;
  border-top: 1px solid var(--grid-line);
}

.view-panel {
  display: none;
}

.view-panel.active {
  display: block;
}

.sheet-table {
  width: max-content;
  min-width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 12px;
}

.sheet-table thead th {
  position: sticky;
  top: 0;
  z-index: 4;
  height: 30px;
  padding: 5px 8px;
  color: #3d4852;
  background: var(--grid-head);
  border-right: 1px solid var(--grid-line);
  border-bottom: 1px solid var(--grid-line);
  font-size: 11px;
  font-weight: 900;
  text-transform: none;
}

.sheet-table td {
  height: 34px;
  padding: 5px 8px;
  background: #ffffff;
  border-right: 1px solid var(--grid-line);
  border-bottom: 1px solid var(--grid-line);
}

.sheet-table tbody tr:hover td {
  background: #f8fbff;
}

.sheet-table .row-number {
  position: sticky;
  left: 0;
  z-index: 5;
  width: 46px;
  min-width: 46px;
  max-width: 46px;
  color: var(--muted);
  background: var(--grid-head);
  text-align: center;
  font-weight: 800;
  user-select: none;
  -webkit-user-select: none;
}

.sheet-table thead .row-number {
  z-index: 7;
}

.primary-cell {
  min-width: 280px;
}

.primary-cell a {
  font-weight: 800;
}

.row-open-link {
  display: inline-flex;
  align-items: center;
  max-width: 100%;
  color: var(--ink);
  cursor: pointer;
  text-decoration: underline;
  text-decoration-color: transparent;
  text-decoration-thickness: 2px;
  text-underline-offset: 3px;
  transition: color 120ms ease, text-decoration-color 120ms ease;
}

.row-open-link:hover,
.row-open-link:focus-visible {
  color: var(--green);
  text-decoration-color: currentColor;
}

.row-open-link:focus-visible {
  outline: 1px solid var(--green);
  outline-offset: 2px;
}

.media-sheet {
  min-width: max(100%, 1980px);
}

.planning-sheet {
  min-width: max(100%, 1580px);
}

.task-grid-frame .sheet-toolbar {
  grid-template-columns: minmax(130px, 0.55fr) minmax(420px, 2fr) auto;
  gap: 6px;
  min-height: 34px;
  padding: 4px 7px;
}

.task-grid-frame .sheet-title {
  gap: 7px;
}

.task-grid-frame .sheet-title strong {
  font-size: 12.5px;
}

.task-grid-frame .sheet-tabs {
  min-height: 26px;
  max-width: 100%;
  overflow-x: auto;
  border-radius: 6px;
}

.task-grid-frame .sheet-tabs button {
  min-height: 21px;
  padding: 0 7px;
  font-size: 11px;
  white-space: nowrap;
}

.task-grid-frame .sheet-actions {
  gap: 6px;
}

.task-grid-frame .button.small {
  min-height: 24px;
  padding: 0 7px;
  font-size: 11px;
}

.task-grid-frame .sheet-total {
  font-size: 11px;
}

.project-grid-frame .project-summary {
  display: flex;
  align-items: center;
  min-height: 22px;
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: thin;
}

.project-grid-frame .project-summary span {
  display: inline-flex;
  align-items: center;
  flex: 0 0 auto;
  max-width: 220px;
  min-height: 22px;
  padding: 2px 7px;
  gap: 4px;
  font-size: 10px;
  line-height: 1;
}

.project-grid-frame .project-summary span strong {
  color: var(--ink);
  font-size: 9.5px;
  font-weight: 900;
}

.task-grid-frame .sheet-scroll {
  width: 100%;
  height: calc(100vh - 190px);
  min-height: 360px;
  max-height: none;
  overscroll-behavior: contain;
}

.project-detail-layout .project-grid-frame > .sheet-toolbar,
.project-detail-layout .project-grid-frame > .sheet-summary {
  flex: 0 0 auto;
}

.project-detail-layout .project-grid-frame > .view-panel.active {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
}

.project-detail-layout .project-grid-frame > .view-panel[data-view-panel="grid"].active {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.project-detail-layout .project-grid-frame > .view-panel[data-view-panel="kanban"].active {
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
}

.kanban-view-panel {
  background: var(--surface);
}

.kanban-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 10px;
  border-bottom: 1px solid var(--line);
  background: #f8fafc;
}

.kanban-toolbar strong {
  display: block;
  font-size: 13px;
  color: var(--ink);
}

.kanban-toolbar small {
  display: block;
  margin-top: 2px;
  font-size: 11px;
  color: var(--muted);
}

.kanban-toolbar label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-weight: 800;
  color: var(--muted);
}

.kanban-toolbar select,
.kanban-editor input,
.kanban-editor select,
.kanban-editor textarea {
  min-height: 27px;
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 4px 7px;
  background: #fff;
  color: var(--text);
  font: inherit;
}

.kanban-workspace {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
}

.kanban-workspace.has-open-editor {
  grid-template-columns: minmax(0, 1fr) 320px;
}

.kanban-columns {
  display: grid;
  grid-auto-columns: minmax(230px, 1fr);
  grid-auto-flow: column;
  gap: 8px;
  min-height: 0;
  padding: 8px;
  overflow-x: auto;
  overflow-y: hidden;
}

.kanban-column {
  display: flex;
  flex-direction: column;
  min-width: 230px;
  min-height: 0;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #f4f7fa;
}

.kanban-column header {
  display: flex;
  align-items: center;
  gap: 6px;
  min-height: 32px;
  padding: 6px 8px;
  border-bottom: 1px solid var(--line);
  color: var(--ink);
}

.kanban-column header strong {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 12px;
}

.kanban-column header small {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
}

.kanban-status-dot {
  flex: 0 0 auto;
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: #8aa1b2;
}

.kanban-card-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 1 1 auto;
  min-height: 80px;
  padding: 7px;
  overflow-x: hidden;
  overflow-y: auto;
  scrollbar-gutter: stable;
}

.kanban-column.is-drop-target {
  border-color: var(--blue);
  background: #eef8fd;
}

.kanban-card {
  display: flex;
  flex: 0 0 auto;
  flex-direction: column;
  align-self: stretch;
  width: 100%;
  min-height: 74px;
  border: 1px solid #cbd6df;
  border-radius: 6px;
  padding: 0;
  background: #fff;
  color: var(--text);
  text-align: left;
  cursor: grab;
  box-shadow: 0 1px 2px rgba(20, 31, 43, 0.06);
  overflow: hidden;
}

.kanban-card,
.kanban-card * {
  box-sizing: border-box;
}

.kanban-card:hover,
.kanban-card:focus {
  border-color: var(--blue);
  outline: none;
}

.kanban-card.is-dragging {
  opacity: 0.55;
}

.kanban-card-header {
  display: grid;
  flex: 0 0 auto;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 6px;
  min-width: 0;
  min-height: 26px;
  padding: 5px 7px 5px calc(7px + (var(--kanban-indent, 0) * 9px));
  background: #eef3f7;
  color: var(--ink);
  border-bottom: 1px solid #d8e1e8;
  font-size: 10.5px;
  font-weight: 800;
  line-height: 1.2;
}

.kanban-card.has-department-color .kanban-card-header {
  background: var(--department-bg);
  color: var(--department-fg);
  border-bottom-color: rgba(0, 0, 0, 0.12);
}

.kanban-card-row,
.kanban-card-priority {
  min-width: 0;
  max-width: 88px;
  white-space: nowrap;
}

.kanban-card-title,
.kanban-card-priority {
  overflow: hidden;
  text-overflow: ellipsis;
}

.kanban-card-title {
  min-width: 0;
  white-space: nowrap;
}

.kanban-card-body {
  display: flex;
  flex: 0 0 auto;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
  padding: 7px 7px 7px calc(7px + (var(--kanban-indent, 0) * 9px));
}

.kanban-card-body .kanban-card-priority {
  display: inline-block;
  width: fit-content;
  max-width: 100%;
  padding: 1px 5px;
  border: 1px solid #d8e1e8;
  border-radius: 999px;
  background: #f6f8fb;
  color: var(--muted);
  font-size: 10px;
  font-weight: 800;
  line-height: 1.25;
}

.kanban-card-meta,
.kanban-card-dates {
  display: block;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--muted);
  font-size: 10.5px;
  line-height: 1.25;
}

.kanban-card-description {
  display: -webkit-box;
  min-width: 0;
  overflow: hidden;
  color: var(--text);
  font-size: 11px;
  line-height: 1.3;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.kanban-empty {
  flex: 0 0 auto;
  padding: 10px 6px;
  color: var(--muted);
  font-size: 11px;
  text-align: center;
}

.kanban-editor {
  display: flex;
  flex-direction: column;
  min-height: 0;
  border-left: 1px solid var(--line);
  background: #fff;
  overflow: auto;
}

.kanban-editor[hidden] {
  display: none;
}

.kanban-editor-empty {
  display: grid;
  place-content: center;
  gap: 4px;
  min-height: 180px;
  padding: 18px;
  color: var(--muted);
  text-align: center;
}

.kanban-editor form {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 10px;
}

.kanban-editor form[hidden] {
  display: none;
}

.kanban-editor header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 2px;
}

.kanban-editor header strong {
  min-width: 0;
  overflow: hidden;
  color: var(--ink);
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.kanban-editor label {
  display: flex;
  flex-direction: column;
  gap: 3px;
  color: var(--muted);
  font-size: 10.5px;
  font-weight: 800;
}

.kanban-editor textarea {
  min-height: 82px;
  resize: vertical;
}

.kanban-editor-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.project-detail-layout .project-grid-frame .sheet-scroll,
.project-detail-layout .scope-panel[open] ~ .project-properties-panel[open] ~ .project-grid-frame .sheet-scroll {
  flex: 1 1 auto;
  height: auto;
  min-height: 0;
  max-height: none;
  overflow: auto;
}

.task-grid-frame .sheet-table {
  width: max-content;
  min-width: 100%;
  font-size: 12px;
  line-height: 1.2;
}

.task-grid-frame .sheet-table thead th {
  height: 26px;
  padding: 4px 6px;
  font-size: 10.5px;
}

.task-grid-frame .sheet-table td {
  height: 30px;
  padding: 3px 6px;
}

.task-grid-frame .sheet-table .row-number {
  width: 96px;
  min-width: 96px;
  max-width: 96px;
  padding: 3px 4px;
}

.backup-frame .sheet-scroll {
  width: 100%;
  height: min(68vh, 760px);
}

.backup-table {
  width: max-content;
  min-width: max(100%, 980px);
}

.backup-table td {
  height: 32px;
  padding: 4px 8px;
  white-space: nowrap;
}

.backup-hierarchy {
  padding-left: calc(8px + (var(--indent) * 18px)) !important;
  font-weight: 650;
}

.backup-search,
.backup-pagination {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 8px;
}

.backup-search input {
  min-width: min(460px, 100%);
  min-height: 28px;
}

.backup-pagination {
  justify-content: flex-end;
  margin: 8px 0 0;
}

.backup-root {
  margin: 8px 0 0;
  overflow-wrap: anywhere;
}

.spreadsheet-import-summary label,
.spreadsheet-import-actions {
  max-width: 520px;
}

.spreadsheet-import-grid {
  max-height: 48vh;
}

.spreadsheet-import-grid td {
  vertical-align: top;
}

.backup-catalog {
  padding: 10px;
}

.backup-catalog .section-title {
  margin-bottom: 8px;
}

.backup-catalog .section-title h2 {
  font-size: 14px;
}

.backup-catalog .section-title small {
  font-size: 10.5px;
}

.backup-catalog-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 11.5px;
  line-height: 1.22;
}

.backup-catalog-table th,
.backup-catalog-table td {
  height: 30px;
  padding: 4px 7px;
  border-bottom: 1px solid var(--grid-line);
  vertical-align: middle;
}

.backup-catalog-table th {
  color: var(--muted);
  background: var(--grid-head);
  font-size: 10.5px;
  font-weight: 900;
  text-transform: none;
}

.backup-catalog-table td {
  background: var(--surface);
}

.backup-catalog-table tbody tr:hover td {
  background: #eef9fe;
}

.backup-project-link {
  display: grid;
  gap: 1px;
  color: var(--text);
  text-decoration: none;
}

.backup-project-link strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.backup-project-link small {
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
}

.backup-project-link:hover strong {
  color: var(--green);
}

.task-grid-frame .row-controls {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 2px;
  min-height: 24px;
}

.task-grid-frame .row-index {
  display: inline-flex;
  justify-content: end;
  width: 22px;
  color: var(--ink);
  font-weight: 900;
  font-variant-numeric: tabular-nums;
}

.task-grid-frame .scene-row-summary {
  display: grid;
  gap: 2px;
}

.task-grid-frame .scene-row-summary[hidden] {
  display: none;
}

.scene-details-button {
  width: max-content;
  min-height: 21px;
  padding: 0 6px;
  font-size: 10px;
}

.scene-details-button.has-scene-details {
  color: #006fa6;
  border-color: #b8e3f6;
  background: #e7f6fd;
}

.scene-details-modal {
  position: fixed;
  inset: 0;
  z-index: 1400;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(16, 24, 32, 0.35);
}

.scene-details-modal[hidden] {
  display: none;
}

.related-rows-modal {
  position: fixed;
  inset: 0;
  z-index: 1450;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(16, 24, 32, 0.35);
}

.related-rows-modal[hidden] {
  display: none;
}

.related-rows-dialog {
  width: min(1060px, calc(100vw - 36px));
  max-height: min(680px, calc(100vh - 36px));
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
  box-shadow: 0 22px 55px rgba(31, 41, 51, 0.22);
}

.related-rows-dialog header,
.related-rows-dialog footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
}

.related-rows-dialog footer {
  justify-content: flex-start;
  color: var(--muted);
  border-top: 1px solid var(--line);
  border-bottom: 0;
  font-size: 12px;
}

.related-rows-dialog h2 {
  margin: 0;
  font-size: 16px;
}

.related-rows-table-wrap {
  overflow: auto;
}

.related-rows-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}

.related-rows-table th,
.related-rows-table td {
  padding: 7px 9px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  white-space: nowrap;
}

.related-row-root-path {
  max-width: 260px;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
}

.related-rows-table th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: var(--grid-head);
  color: var(--muted);
  font-size: 11px;
  text-transform: uppercase;
}

.related-rows-table tbody tr {
  cursor: pointer;
}

.related-rows-table tbody tr:hover {
  background: #eef9fe;
}

.related-rows-table tbody tr.is-current {
  background: rgba(0, 159, 227, 0.12);
}

.related-row-badge {
  display: inline-flex;
  align-items: center;
  min-height: 19px;
  max-width: 130px;
  padding: 2px 7px;
  border: 1px solid #d8e1e8;
  border-radius: 4px;
  background: #f6f8fb;
  color: var(--ink);
  font-weight: 750;
  overflow: hidden;
  text-overflow: ellipsis;
}

.related-row-badge.has-status-color {
  border-color: transparent;
  background: var(--status-bg);
  color: var(--status-fg);
}

.stage-warning-modal {
  position: fixed;
  inset: 0;
  z-index: 1500;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(16, 24, 32, 0.35);
}

.stage-warning-modal[hidden] {
  display: none;
}

.stage-warning-dialog {
  width: min(520px, calc(100vw - 36px));
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
  box-shadow: 0 22px 55px rgba(31, 41, 51, 0.22);
}

.stage-warning-dialog header,
.stage-warning-dialog footer {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
}

.stage-warning-dialog header {
  flex-direction: column;
  align-items: flex-start;
}

.stage-warning-dialog header strong {
  font-size: 15px;
}

.stage-warning-dialog header span,
.stage-warning-body {
  color: var(--muted);
  font-size: 12px;
}

.stage-warning-body {
  padding: 12px;
  color: var(--text);
}

.stage-warning-body p {
  margin: 0 0 8px;
}

.stage-warning-body ul {
  max-height: 150px;
  margin: 0;
  padding-left: 18px;
  overflow: auto;
  color: var(--muted);
}

.stage-warning-dialog footer {
  justify-content: flex-end;
  border-top: 1px solid var(--line);
  border-bottom: 0;
}

.scene-details-dialog {
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr) auto auto;
  width: min(980px, calc(100vw - 36px));
  max-height: min(760px, calc(100vh - 36px));
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 6px;
  box-shadow: 0 22px 55px rgba(31, 41, 51, 0.22);
}

.scene-details-header,
.scene-details-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
}

.scene-details-header h2 {
  margin: 0;
  font-size: 16px;
}

.scene-details-footer {
  justify-content: flex-end;
  border-top: 1px solid var(--line);
  border-bottom: 0;
}

.scene-details-sync-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 12px;
  background: var(--surface-muted);
  border-top: 1px solid var(--line);
  font-size: 11px;
}

.scene-details-sync-bar[hidden] {
  display: none;
}

.scene-details-sync-option {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--text);
  font-weight: 750;
}

.scene-details-sync-status {
  min-width: 0;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.scene-details-sync-status[data-tone="ok"] {
  color: #0c6b42;
}

.scene-details-sync-status[data-tone="warning"] {
  color: #9a5a00;
}

.scene-details-sync-status[data-tone="error"] {
  color: var(--red);
}

.scene-details-tabs {
  display: flex;
  gap: 2px;
  padding: 6px 8px 0;
  background: var(--surface-muted);
  border-bottom: 1px solid var(--line);
}

.scene-details-tabs button {
  min-height: 26px;
  padding: 0 10px;
  color: var(--muted);
  background: transparent;
  border: 0;
  border-radius: 5px 5px 0 0;
  font-size: 11px;
  font-weight: 800;
}

.scene-details-tabs button.active {
  color: var(--ink);
  background: var(--surface);
  box-shadow: inset 0 -2px 0 var(--green);
}

.scene-details-panel {
  display: none;
  min-height: 0;
  padding: 10px 12px;
  overflow: hidden;
}

.scene-details-panel.active {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 8px;
}

.scene-details-panel[data-scene-details-panel="json"].active {
  grid-template-rows: minmax(0, 1fr);
}

.scene-details-toolbar {
  display: flex;
  justify-content: flex-end;
}

.scene-details-grid-wrap {
  min-height: 0;
  overflow: auto;
  border: 1px solid var(--grid-line);
  border-radius: 5px;
}

.scene-details-grid {
  width: 100%;
  min-width: 860px;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 11px;
}

.scene-details-grid th,
.scene-details-grid td {
  padding: 4px;
  background: var(--surface);
  border-right: 1px solid var(--grid-line);
  border-bottom: 1px solid var(--grid-line);
}

.scene-details-grid th {
  position: sticky;
  top: 0;
  z-index: 1;
  height: 28px;
  color: #34495a;
  background: var(--grid-head);
  text-align: left;
}

.scene-details-grid input,
.scene-details-grid select {
  width: 100%;
  min-height: 26px;
  padding: 0 7px;
  color: var(--text);
  background: #ffffff;
  border: 1px solid transparent;
  border-radius: 4px;
  font-size: 11px;
}

.scene-details-grid input:focus,
.scene-details-grid select:focus {
  outline: none;
  border-color: var(--green);
  box-shadow: 0 0 0 2px rgba(0, 159, 227, 0.12);
}

.scene-details-check {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 26px;
  color: var(--text);
  font-size: 11px;
  font-weight: 700;
}

.scene-details-grid .scene-details-check input {
  width: auto;
  min-height: 0;
  margin: 0;
}

.scene-details-json-wrap {
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  gap: 8px;
  min-height: 0;
}

.scene-details-json-editor {
  width: 100%;
  min-height: 360px;
  resize: none;
  color: var(--text);
  background: #ffffff;
  border: 1px solid var(--grid-line);
  border-radius: 5px;
  font: 12px/1.45 ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
}

.scene-details-json-error {
  margin: 0;
  color: var(--red);
  font-size: 12px;
  font-weight: 750;
}

.task-grid-frame .row-collapse-toggle,
.task-grid-frame .row-drag-handle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  min-width: 18px;
  min-height: 18px;
  margin: 0;
  padding: 0;
  color: var(--muted);
  background: transparent;
  border: 1px solid transparent;
  border-radius: 3px;
  font-size: 12px;
  line-height: 1;
}

.task-grid-frame .row-collapse-toggle:hover,
.task-grid-frame .row-collapse-toggle:focus,
.task-grid-frame .row-drag-handle:hover,
.task-grid-frame .row-drag-handle:focus {
  color: var(--ink);
  background: var(--surface-raised);
  border-color: var(--line);
}

.task-grid-frame .row-drag-handle {
  cursor: grab;
  font-weight: 900;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}

.task-grid-frame .row-drag-handle:active {
  cursor: grabbing;
}

.task-grid-frame .is-compact-row td {
  height: 30px;
}

.task-grid-frame .has-inherited-preview td {
  height: 34px;
}

.task-grid-frame .is-scene-row td {
  height: 68px;
}

.task-grid-frame .media-sheet {
  min-width: max(100%, 1900px);
}

.task-grid-frame .planning-sheet {
  min-width: max(100%, 1580px);
}

.task-grid-frame .task-table {
  --reference-row-width: 88px;
  --reference-attachment-width: 88px;
  --reference-preview-width: 112px;
  --reference-attachment-left: var(--reference-row-width);
  --reference-preview-left: calc(var(--reference-row-width) + var(--reference-attachment-width));
  --reference-title-left: calc(var(--reference-row-width) + var(--reference-attachment-width) + var(--reference-preview-width));
}

.task-grid-frame .planning-sheet {
  --reference-title-left: calc(var(--reference-row-width) + var(--reference-attachment-width));
}

.task-grid-frame .media-sheet th:nth-child(2),
.task-grid-frame .media-sheet td:nth-child(2) {
  width: 118px;
}

.task-grid-frame .preview-cell {
  width: var(--reference-preview-width);
  min-width: var(--reference-preview-width);
  max-width: var(--reference-preview-width);
}

.task-grid-frame .hierarchy-cell {
  min-width: 250px;
}

.task-grid-frame .description-cell {
  min-width: 280px;
  max-width: 420px;
  height: auto;
  vertical-align: top;
}

.task-grid-frame .description-cell .sheet-cell-value {
  min-height: 18px;
  overflow: visible;
  color: var(--text);
  line-height: 1.25;
  text-overflow: clip;
  white-space: pre-wrap;
  word-break: break-word;
}

.task-grid-frame .custom-column-header,
.task-grid-frame .custom-field-cell {
  min-width: 150px;
  max-width: 260px;
}

.sheet-table[data-custom-column-add-action] thead th,
.sheet-table[data-custom-column-remove-action] thead th[data-custom-column-key] {
  cursor: context-menu;
}

.task-grid-frame .custom-field-cell .sheet-cell-value {
  white-space: pre-wrap;
  word-break: break-word;
}

.task-grid-frame .scene-link-cell {
  min-width: 138px;
}

.task-grid-frame .numeric {
  max-width: 74px;
}

.task-grid-frame .date-input {
  min-width: 106px;
}

.task-grid-frame .compact-select {
  min-width: 76px;
}

.task-grid-frame .dependency-input {
  min-width: 92px;
  font-variant-numeric: tabular-nums;
}

.task-grid-frame .cell-input,
.task-grid-frame .cell-select,
.task-grid-frame .cell-textarea {
  min-height: 23px;
  padding: 2px 5px;
  border-radius: 3px;
  font-size: 11.5px;
}

.task-grid-frame .cell-textarea {
  position: absolute;
  top: 24px;
  left: 12px;
  right: 0;
  z-index: 12;
  height: 24px;
  min-height: 24px;
  max-height: 24px;
  overflow: hidden;
  opacity: 0;
  pointer-events: none;
  resize: none;
  line-height: 1.25;
  box-shadow: 0 14px 34px rgba(0, 0, 0, 0.35);
}

.task-grid-frame .cell-stack:hover .cell-textarea,
.task-grid-frame .cell-stack:focus-within .cell-textarea {
  opacity: 1;
  pointer-events: auto;
}

.task-grid-frame .cell-textarea:focus {
  height: 92px;
  max-height: 92px;
  overflow: auto;
  resize: none;
}

.task-grid-frame .hierarchy-cell .cell-stack {
  margin-left: calc(var(--indent, 0) * 22px);
  padding-left: 9px;
}

.task-grid-frame .is-child-row .hierarchy-cell .cell-stack::before {
  top: 14px;
  width: 16px;
}

.task-grid-frame .row-menu-button {
  position: static;
  width: 18px;
  min-width: 18px;
  min-height: 18px;
  margin: 0;
  padding: 0;
  transform: none;
  opacity: 0;
  font-size: 11px;
}

.task-grid-frame tr:hover .row-menu-button,
.task-grid-frame .row-menu-button:focus {
  opacity: 1;
}

.task-grid-frame .task-preview {
  width: 100px;
  border-radius: 4px;
}

.task-grid-frame img[data-preview-zoom] {
  cursor: zoom-in;
}

.task-grid-frame img[data-preview-zoom]:hover {
  border-color: var(--green);
}

.task-grid-frame .has-inherited-preview .task-preview {
  width: 50px;
}

.task-grid-frame .preview-note {
  margin-top: 2px;
  font-size: 10px;
}

.task-grid-frame .empty-preview {
  width: 34px;
  height: 20px;
  aspect-ratio: auto;
}

.task-grid-frame .preview-input {
  display: none;
}

.task-grid-frame .attachment-cell {
  min-width: 88px;
  width: 88px;
}

.task-grid-frame .attachment-list {
  display: grid;
  gap: 2px;
}

.task-grid-frame .attachment-empty {
  display: none;
}

.task-grid-frame .attach-form {
  margin-top: 0;
}

.task-grid-frame .attach-label {
  width: 24px;
  min-width: 24px;
  min-height: 22px;
  padding: 0;
}

.task-grid-frame .is-active-row td {
  background: #eef9fe;
}

.task-grid-frame .is-selected-row td {
  background: rgba(87, 148, 242, 0.16);
  box-shadow: inset 0 1px 0 rgba(87, 148, 242, 0.28), inset 0 -1px 0 rgba(87, 148, 242, 0.18);
}

.task-grid-frame .is-selected-row .row-number {
  color: #006fa6;
}

.task-grid-frame .is-selected-row .row-index {
  font-weight: 700;
}

.task-grid-frame .is-active-cell {
  box-shadow: inset 0 0 0 1px rgba(0, 159, 227, 0.65);
}

.task-grid-frame [data-sheet-cell] {
  position: relative;
  cursor: text;
}

.task-grid-frame [data-sheet-cell][data-cell-readonly="true"] {
  cursor: default;
}

.task-grid-frame .sheet-cell-value {
  display: block;
  min-height: 18px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--text);
}

.row-type-value {
  display: inline-flex !important;
  align-items: center;
  gap: 5px;
  max-width: 100%;
  min-height: 20px;
}

.row-type-icon {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  border-radius: 4px;
  font-size: 11px;
  line-height: 1;
}

.row-type-label {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

.row-type-task .row-type-icon {
  color: #1f75cb;
  background: rgba(31, 117, 203, 0.12);
}

.row-type-header .row-type-icon {
  color: #536878;
  background: rgba(83, 104, 120, 0.14);
}

.row-type-milestone .row-type-icon {
  color: #9a5a00;
  background: rgba(240, 173, 78, 0.18);
}

.row-type-scene .row-type-icon {
  color: #006fa6;
  background: rgba(0, 159, 227, 0.14);
}

.task-grid-frame .task-title-value {
  display: flex;
  align-items: center;
  gap: 5px;
}

.task-grid-frame .hierarchy-cell.has-department-color .task-title-value {
  min-height: 20px;
  padding: 2px 6px;
  color: var(--department-fg);
  background: var(--department-bg);
  border-radius: 4px;
}

.task-grid-frame .hierarchy-cell.has-department-color .task-title-value .sheet-cell-value,
.task-grid-frame .hierarchy-cell.has-department-color .task-title-value [data-sheet-display] {
  color: inherit;
}

.task-grid-frame .hierarchy-cell.has-department-color .title-collapse-toggle {
  color: var(--department-fg);
  background: rgba(255, 255, 255, 0.14);
  border-color: rgba(255, 255, 255, 0.35);
}

.task-grid-frame .status-cell.has-status-color .sheet-cell-value,
.task-grid-frame .priority-cell.has-status-color .sheet-cell-value {
  display: inline-flex;
  align-items: center;
  min-height: 20px;
  max-width: 100%;
  padding: 2px 7px;
  border-radius: 4px;
  color: var(--status-fg);
  background: var(--status-bg);
  font-weight: 750;
}

.task-grid-frame .task-title-value [data-sheet-display] {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

.task-grid-frame .overdue-marker {
  flex: 0 0 auto;
  color: var(--red);
  font-weight: 900;
  line-height: 1;
}

.task-grid-frame .hierarchy-cell .sheet-cell-value {
  font-weight: 750;
}

.gitlab-sync-state {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: center;
  width: 17px;
  height: 17px;
  border: 1px solid #96a3af;
  border-radius: 999px;
  background: #eef3f7;
  color: var(--muted);
  font-size: 10px;
  font-weight: 900;
  line-height: 1;
  cursor: help;
}

.gitlab-sync-state::before {
  content: "?";
}

.gitlab-sync-state.ok {
  border-color: #1f9d55;
  background: #e6f6ed;
  color: #187244;
}

.gitlab-sync-state.ok::before {
  content: "✓";
}

.gitlab-sync-state.pending,
.gitlab-sync-state.pending-sync,
.gitlab-sync-state.running-sync {
  border-color: var(--blue);
  background: #e6f6fc;
  color: #006fa6;
}

.gitlab-sync-state.pending::before,
.gitlab-sync-state.pending-sync::before,
.gitlab-sync-state.running-sync::before {
  content: "↻";
}

.gitlab-sync-state.conflict,
.gitlab-sync-state.error,
.gitlab-sync-state.missing-configuration,
.gitlab-sync-state.missing-repository,
.gitlab-sync-state.pending-delete {
  border-color: var(--red);
  background: #fdeaea;
  color: var(--red);
}

.gitlab-sync-state.conflict::before,
.gitlab-sync-state.error::before,
.gitlab-sync-state.missing-configuration::before,
.gitlab-sync-state.missing-repository::before,
.gitlab-sync-state.pending-delete::before {
  content: "!";
}

.gitlab-sync-state.warning,
.gitlab-sync-state.dry-run,
.gitlab-sync-state.skipped {
  border-color: var(--amber);
  background: #fff7dd;
  color: #8a6400;
}

.gitlab-sync-state.warning::before,
.gitlab-sync-state.dry-run::before,
.gitlab-sync-state.skipped::before {
  content: "!";
}

.task-grid-frame .sheet-cell-editor {
  position: absolute;
  inset: 2px 3px;
  z-index: 24;
}

.task-grid-frame .sheet-cell-editor .cell-input,
.task-grid-frame .sheet-cell-editor .cell-select,
.task-grid-frame .sheet-cell-editor .cell-textarea {
  width: 100%;
  min-width: 0;
  height: 100%;
  min-height: 26px;
  margin: 0;
}

.task-grid-frame .sheet-cell-editor .cell-textarea {
  position: static;
  top: auto;
  right: auto;
  bottom: auto;
  left: auto;
  min-height: 74px;
  max-height: none;
  overflow: auto;
  opacity: 1;
  pointer-events: auto;
  resize: vertical;
}

.task-grid-frame [data-sheet-cell].is-editing {
  overflow: visible;
  box-shadow: inset 0 0 0 1px var(--green);
}

.task-grid-frame .dependency-value {
  font-variant-numeric: tabular-nums;
}

.task-grid-frame tr.is-dragging td {
  opacity: 0.38;
}

.task-grid-frame tr.is-drop-before td {
  box-shadow: inset 0 3px 0 var(--green);
}

.task-grid-frame tr.is-drop-after td {
  box-shadow: inset 0 -3px 0 var(--green);
}

.media-sheet th:nth-child(3),
.media-sheet td:nth-child(3) {
  width: 180px;
}

.cell-input,
.cell-select,
.cell-textarea {
  width: 100%;
  min-height: 32px;
  padding: 5px 7px;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 4px;
  font-size: 13px;
}

.cell-textarea {
  min-height: 46px;
  line-height: 1.3;
}

.cell-input:hover,
.cell-select:hover,
.cell-textarea:hover,
.cell-input:focus,
.cell-select:focus,
.cell-textarea:focus {
  background: #ffffff;
  border-color: var(--blue);
  outline: 0;
}

.strong-input {
  color: var(--ink);
  font-weight: 800;
}

.preview-input {
  margin-top: 7px;
  color: var(--muted);
  font-size: 11px;
}

.numeric {
  max-width: 92px;
}

.date-input {
  min-width: 124px;
}

.compact-select {
  min-width: 96px;
}

.hours-cell {
  display: grid;
  grid-template-columns: repeat(2, minmax(76px, 1fr));
  gap: 6px;
}

.hierarchy-cell {
  min-width: 330px;
}

.hierarchy-cell .cell-stack {
  position: relative;
  margin-left: calc(var(--indent, 0) * 36px);
  padding-left: 12px;
  border-left: 3px solid rgba(37, 99, 235, calc(0.18 + (var(--indent, 0) * 0.1)));
}

.is-child-row td {
  background: #f8fbff;
}

.is-dirty td {
  box-shadow: inset 0 -2px 0 rgba(37, 99, 235, 0.18);
}

.task-grid-frame.has-unsaved-changes [data-grid-save-all] {
  border-color: rgba(0, 159, 227, 0.7);
  box-shadow: 0 0 0 1px rgba(0, 159, 227, 0.14);
}

.task-grid-frame .has-remote-update td {
  animation: remote-row-update 2.2s ease-out;
}

@keyframes remote-row-update {
  0% {
    background: rgba(38, 166, 91, 0.22);
  }
  100% {
    background: transparent;
  }
}

.is-child-row .hierarchy-cell .cell-stack::before {
  content: "";
  position: absolute;
  top: 18px;
  left: -3px;
  width: 22px;
  border-top: 2px solid rgba(37, 99, 235, 0.45);
  transform: translateX(-100%);
}

.row-menu-button {
  display: block;
  width: 28px;
  min-width: 28px;
  min-height: 24px;
  margin: 4px auto 0;
  padding: 0;
  color: var(--muted);
  background: #ffffff;
  border: 1px solid var(--grid-line);
  border-radius: 5px;
  font-size: 12px;
  line-height: 1;
}

.grid-context-menu {
  position: fixed;
  z-index: 1000;
  min-width: 172px;
  padding: 4px;
  background: #ffffff;
  border: 1px solid var(--grid-line);
  border-radius: 5px;
  box-shadow: 0 16px 40px rgba(20, 25, 30, 0.2);
}

.grid-context-menu button {
  display: flex;
  justify-content: flex-start;
  width: 100%;
  min-height: 26px;
  padding: 0 8px;
  color: var(--text);
  background: transparent;
  border: 0;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 700;
  text-align: left;
}

.grid-context-menu button:hover {
  background: #eef4ff;
}

.grid-context-menu button.danger {
  color: var(--red);
  background: transparent;
  border-color: transparent;
}

.grid-context-menu button.danger:hover {
  color: #ffffff;
  background: var(--red);
}

.grid-context-menu hr {
  height: 1px;
  margin: 4px 3px;
  background: var(--grid-line);
  border: 0;
}

.attachment-cell {
  position: relative;
  min-width: 120px;
}

.attachment-list {
  display: grid;
  gap: 4px;
  max-width: 220px;
}

.attachment-dropdown {
  display: inline-block;
  position: relative;
  margin-right: 4px;
}

.attachment-dropdown[open] {
  z-index: 1700;
}

.attachment-summary {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-width: 38px;
  height: 24px;
  padding: 0 6px;
  color: var(--blue);
  background: var(--surface-raised);
  border: 1px solid var(--line);
  border-radius: 4px;
  cursor: pointer;
  font-size: 11px;
  font-weight: 800;
  list-style: none;
}

.attachment-summary::-webkit-details-marker {
  display: none;
}

.attachment-summary:hover {
  border-color: var(--blue);
  background: #e7f6fd;
}

.attachment-dropdown .attachment-list {
  position: fixed;
  top: var(--attachment-popover-top, 0);
  left: var(--attachment-popover-left, 0);
  z-index: 1700;
  width: var(--attachment-popover-width, min(520px, calc(100vw - 16px)));
  max-width: none;
  max-height: var(--attachment-popover-max-height, min(320px, calc(100vh - 16px)));
  padding: 6px;
  overflow: auto;
  background: var(--surface);
  border: 1px solid var(--grid-line);
  border-radius: 6px;
  box-shadow: var(--shadow);
}

.attachment-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 22px;
  align-items: start;
  gap: 4px;
  min-width: 0;
}

.attachment-list a {
  overflow: visible;
  color: var(--blue);
  font-size: 12px;
  font-weight: 800;
  line-height: 1.25;
  overflow-wrap: anywhere;
  text-overflow: clip;
  white-space: normal;
}

.attachment-list a[data-attachment-image-preview] {
  cursor: zoom-in;
}

.attachment-kind {
  display: inline-block;
  margin-right: 4px;
  padding: 1px 4px;
  color: var(--muted);
  background: #eef9fe;
  border: 1px solid #c6eafa;
  border-radius: 3px;
  font-size: 9.5px;
  font-weight: 800;
}

.attachment-item.is-link .attachment-kind {
  color: var(--blue);
}

.attachment-delete-form {
  display: flex;
  margin: 0;
}

.attachment-delete-button.icon-button {
  width: 18px;
  min-width: 18px;
  min-height: 18px;
  padding: 0;
  font-size: 14px;
  line-height: 1;
}

.attach-form {
  margin-top: 8px;
}

.file-input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.attach-label {
  min-height: 30px;
  cursor: pointer;
}

.button-icon {
  width: 14px;
  height: 14px;
  display: block;
}

.sheet-form-panel {
  border-color: var(--grid-line);
  box-shadow: none;
}

.section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}

.section-title h2,
.book-section h2 {
  margin: 0;
  font-size: 16px;
  line-height: 1.18;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 20px;
}

.current-window-panel {
  border-color: #b8d9d2;
}

.disk-usage-panel {
  border-color: #c7d8e9;
}

.disk-usage-list {
  display: grid;
  gap: 6px;
}

.disk-usage-row {
  display: grid;
  grid-template-columns: minmax(180px, 0.35fr) minmax(260px, 1fr) auto;
  gap: 12px;
  align-items: center;
  min-height: 42px;
  padding: 7px 9px;
  background: var(--surface);
  border: 1px solid var(--grid-line);
  border-radius: 5px;
}

.disk-usage-main strong,
.disk-usage-main small,
.disk-usage-meter small {
  display: block;
}

.disk-usage-main small,
.disk-usage-meter small {
  overflow: hidden;
  color: var(--muted);
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.disk-usage-percent {
  color: var(--blue);
  font-size: 15px;
}

.section-title small {
  display: block;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}

.current-project-table {
  width: max-content;
  min-width: max(100%, 920px);
}

.current-project-table th,
.current-project-table td {
  height: 46px;
}

.finance-panel {
  margin-bottom: 14px;
}

.finance-table {
  width: max-content;
  min-width: max(100%, 980px);
}

.finance-table th,
.finance-table td {
  height: 38px;
  padding-block: 6px;
}

.finance-inline-form {
  display: grid;
  grid-template-columns: minmax(120px, 1fr) auto;
  gap: 6px;
  align-items: center;
  min-width: 210px;
}

.finance-inline-form input {
  height: 30px;
}

.calendar-heading {
  align-items: end;
}

.calendar-toolbar {
  display: flex;
  gap: 8px;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
}

.calendar-summary-panel {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: center;
  padding-block: 12px;
}

.calendar-legend,
.calendar-counts {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

.calendar-legend-item,
.calendar-counts span {
  display: inline-flex;
  gap: 6px;
  align-items: center;
  color: var(--muted);
  font-size: 12px;
}

.legend-swatch {
  width: 12px;
  height: 12px;
  border-radius: 3px;
  border: 1px solid rgba(16, 24, 32, 0.12);
}

.legend-swatch.project {
  background: var(--blue);
}

.legend-swatch.forecast.in-progress {
  background: #284f7c;
}

.legend-swatch.forecast.won {
  background: #2c8f57;
}

.legend-swatch.forecast.lost {
  background: var(--red);
}

.calendar-panel {
  padding: 0;
  overflow-x: auto;
  overflow-y: hidden;
}

.calendar-grid {
  min-width: 980px;
  background: var(--grid-line);
}

.calendar-weekdays,
.calendar-week {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 1px;
}

.calendar-weekdays > div {
  min-height: 34px;
  display: flex;
  align-items: center;
  padding: 0 10px;
  color: #314253;
  background: var(--grid-head);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
}

.calendar-day {
  min-height: 142px;
  padding: 8px;
  background: #ffffff;
}

.calendar-day.outside-month {
  background: #f7f9fb;
}

.calendar-day.today {
  box-shadow: inset 0 0 0 2px rgba(0, 159, 227, 0.28);
}

.calendar-day header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
  color: #314253;
}

.calendar-day.outside-month header {
  color: #8794a1;
}

.calendar-day header span {
  color: var(--blue);
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
}

.calendar-day-events {
  display: grid;
  gap: 5px;
}

.calendar-event {
  display: grid;
  gap: 1px;
  padding: 6px 7px;
  border-radius: 5px;
  color: #ffffff;
  text-decoration: none;
  border: 1px solid rgba(16, 24, 32, 0.1);
  box-shadow: 0 1px 2px rgba(16, 24, 32, 0.08);
}

.calendar-event:hover {
  text-decoration: none;
  filter: brightness(0.97);
}

.calendar-event strong,
.calendar-event small,
.calendar-event em {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.calendar-event strong {
  font-size: 12px;
  font-weight: 800;
}

.calendar-event small,
.calendar-event em,
.calendar-event-kind {
  font-size: 10px;
  font-style: normal;
  opacity: 0.9;
}

.calendar-event-kind {
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0;
}

.calendar-event-project {
  background: var(--blue);
}

.calendar-event-crm.forecast-in-progress {
  background: #284f7c;
}

.calendar-event-crm.forecast-won {
  background: #2c8f57;
}

.calendar-event-crm.forecast-lost {
  background: var(--red);
}

.calendar-list-table {
  min-width: max(100%, 980px);
}

.project-inquiry-panel {
  border-color: #8bb8e8;
}

.project-inquiry-list {
  display: grid;
  gap: 10px;
}

.project-inquiry-card {
  padding: 12px;
  background: #fbfcfd;
  border: 1px solid var(--line);
  border-radius: 7px;
}

.project-inquiry-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.project-inquiry-heading strong,
.project-inquiry-heading small,
.project-inquiry-form span {
  display: block;
}

.project-inquiry-form {
  display: grid;
  grid-template-columns: repeat(4, minmax(130px, 1fr)) minmax(220px, 1.4fr) auto;
  gap: 8px;
  align-items: end;
}

.project-inquiry-form label {
  min-width: 0;
}

.project-inquiry-form span {
  margin-bottom: 4px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
}

.project-inquiry-form select,
.project-inquiry-form textarea {
  min-height: 34px;
  width: 100%;
}

.project-inquiry-form textarea {
  resize: vertical;
}

.project-inquiry-actions {
  display: flex;
  justify-content: flex-end;
}

.inquiry-ranking-panel table {
  min-width: 620px;
}

.assignment-queue-list {
  display: grid;
  gap: 14px;
}

.assignment-queue {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 7px;
}

.assignment-queue-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 50px;
  padding: 12px 14px;
  background: #fbfcfd;
  cursor: pointer;
}

.assignment-queue[open] .assignment-queue-heading {
  border-bottom: 1px solid var(--line);
}

.assignment-queue-heading::-webkit-details-marker {
  display: none;
}

.assignment-queue-heading strong,
.assignment-queue-heading small {
  display: block;
}

.assignment-queue-summary {
  display: flex;
  align-items: center;
  gap: 8px;
}

.assignment-queue-summary small {
  color: var(--muted);
  white-space: nowrap;
}

.assignment-queue-heading b {
  display: inline-grid;
  place-items: center;
  min-width: 32px;
  height: 28px;
  color: #ffffff;
  background: var(--ink);
  border-radius: 999px;
}

.assignment-table {
  min-width: 980px;
}

.assignment-queue-placeholder,
.assignment-queue-empty {
  margin: 0;
  padding: 12px 14px;
}

.assignment-form {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 240px;
}

.assignment-form select {
  min-width: 140px;
  min-height: 34px;
}

.department-site-shell {
  display: grid;
  gap: 14px;
}

.department-site-topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  padding: 6px;
  background: rgba(255, 255, 255, 0.94);
  border: 1px solid var(--line);
  border-radius: 6px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(10px);
}

.department-site-topbar a {
  min-height: 26px;
  padding: 5px 9px;
  color: var(--ink);
  border-radius: 4px;
  font-size: 12px;
  font-weight: 650;
}

.department-site-topbar a:hover {
  background: var(--surface-raised);
}

.department-site-topbar a.active {
  color: #ffffff;
  background: var(--blue);
  text-decoration: none;
}

.department-site-header {
  align-items: end;
  margin-bottom: 0;
}

.department-site-stat {
  display: grid;
  justify-items: end;
  min-width: 120px;
}

.department-site-stat strong {
  color: var(--blue);
  font-size: 30px;
  line-height: 1;
}

.department-site-stat span {
  color: var(--muted);
  font-size: 12px;
}

.department-site-stat.compact {
  min-width: 72px;
}

.department-site-stat.compact strong {
  font-size: 24px;
}

.department-site-overview-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
}

.department-site-function {
  display: grid;
  gap: 6px;
  min-height: 132px;
  padding: 14px;
  color: var(--ink);
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 7px;
  box-shadow: var(--shadow);
}

.department-site-function:hover {
  border-color: var(--blue);
  text-decoration: none;
}

.department-site-function span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
}

.department-site-function strong {
  color: var(--blue);
  font-size: 28px;
  line-height: 1;
}

.department-site-function small {
  color: var(--muted);
}

.department-site-vars dl {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 8px;
  margin: 0;
}

.department-site-vars dl div {
  padding: 8px;
  background: #f8fafc;
  border: 1px solid var(--line);
  border-radius: 5px;
}

.department-site-vars dt {
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
}

.department-site-vars dd {
  margin: 2px 0 0;
  font-size: 13px;
}

.department-site-table {
  min-width: 1120px;
  font-size: 12px;
}

.department-site-table th,
.department-site-table td {
  padding: 6px 7px;
}

.department-site-table .primary-cell a {
  font-weight: 700;
}

.department-site-config textarea {
  width: 100%;
  min-height: 360px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
  font-size: 12px;
  line-height: 1.4;
}

.metric {
  min-height: 110px;
  padding: 18px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.metric span {
  display: block;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.metric strong {
  display: block;
  margin-top: 12px;
  font-size: clamp(24px, 3vw, 34px);
  line-height: 1;
}

.metric-grid.compact .metric {
  min-height: 86px;
}

.split-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(340px, 0.65fr);
  gap: 20px;
}

.button,
button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 32px;
  padding: 0 10px;
  color: var(--ink);
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 5px;
  font: inherit;
  font-size: 12px;
  font-weight: 800;
  line-height: 1.1;
  cursor: pointer;
}

.button.primary,
button.primary {
  color: #ffffff;
  background: var(--green);
  border-color: var(--green);
}

.button.active,
button.active {
  color: #ffffff;
  background: var(--green);
  border-color: var(--green);
}

.button.small {
  min-height: 26px;
  padding: 0 8px;
  font-size: 11px;
}

.button.danger,
button.danger {
  color: #ffffff;
  background: var(--red);
  border-color: var(--red);
}

.button.danger:disabled,
button.danger:disabled {
  color: var(--muted);
  background: #eef3f8;
  border-color: var(--line);
  cursor: not-allowed;
}

.button:disabled,
button:disabled {
  opacity: 0.58;
  cursor: not-allowed;
}

.sheet-tabs button {
  min-height: 22px;
  padding: 0 8px;
  line-height: 1;
}

.icon-button {
  width: 32px;
  min-width: 32px;
  padding: 0;
}

.table-wrap {
  width: 100%;
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
}

th,
td {
  padding: 9px 8px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: middle;
}

th {
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0;
}

td small,
.muted {
  display: block;
  color: var(--muted);
  font-size: 12px;
}

.task-table th:first-child,
.task-table td:first-child {
  width: 180px;
}

.sheet-table.task-table .row-number {
  width: 46px;
  min-width: 46px;
  max-width: 46px;
}

.task-grid-frame .sheet-table.task-table th.row-number,
.task-grid-frame .sheet-table.task-table td.row-number {
  width: 88px;
  min-width: 88px;
  max-width: 88px;
  padding-right: 4px;
  padding-left: 4px;
}

.task-grid-frame .row-controls {
  justify-content: flex-start;
  gap: 2px;
  user-select: none;
  -webkit-user-select: none;
}

.task-grid-frame .row-index {
  flex: 0 0 38px;
  width: 38px;
  min-width: 38px;
  cursor: default;
  user-select: none;
  -webkit-user-select: none;
}

.project-grid-frame .row-index {
  font-weight: 500;
}

.task-grid-frame .row-collapse-toggle,
.task-grid-frame .row-drag-handle,
.task-grid-frame .row-menu-button {
  flex: 0 0 18px;
}

.task-grid-frame .title-collapse-toggle {
  flex: 0 0 18px;
  color: var(--ink);
  background: var(--surface);
  border-color: var(--line);
  cursor: pointer;
}

.reference-pin-button {
  min-width: 70px;
}

.reference-pin-button[aria-pressed="true"] {
  color: #ffffff;
  background: var(--blue);
  border-color: var(--blue);
}

.task-grid-frame:not(.is-reference-pinned) .sheet-table.task-table th.row-number,
.task-grid-frame:not(.is-reference-pinned) .sheet-table.task-table td.row-number {
  position: static;
  left: auto;
  z-index: auto;
}

.task-grid-frame.is-reference-pinned .sheet-table.task-table th.row-number,
.task-grid-frame.is-reference-pinned .sheet-table.task-table td.row-number,
.task-grid-frame.is-reference-pinned .sheet-table.task-table th.attachment-cell,
.task-grid-frame.is-reference-pinned .sheet-table.task-table td.attachment-cell,
.task-grid-frame.is-reference-pinned .sheet-table.task-table th.preview-cell,
.task-grid-frame.is-reference-pinned .sheet-table.task-table td.preview-cell,
.task-grid-frame.is-reference-pinned .sheet-table.task-table th.hierarchy-cell,
.task-grid-frame.is-reference-pinned .sheet-table.task-table td.hierarchy-cell {
  position: sticky;
}

.task-grid-frame.is-reference-pinned .sheet-table.task-table th.row-number,
.task-grid-frame.is-reference-pinned .sheet-table.task-table td.row-number {
  left: 0;
}

.task-grid-frame.is-reference-pinned .sheet-table.task-table th.attachment-cell,
.task-grid-frame.is-reference-pinned .sheet-table.task-table td.attachment-cell {
  left: var(--reference-attachment-left);
}

.task-grid-frame.is-reference-pinned .sheet-table.task-table th.preview-cell,
.task-grid-frame.is-reference-pinned .sheet-table.task-table td.preview-cell {
  left: var(--reference-preview-left);
}

.task-grid-frame.is-reference-pinned .sheet-table.task-table th.hierarchy-cell,
.task-grid-frame.is-reference-pinned .sheet-table.task-table td.hierarchy-cell {
  left: var(--reference-title-left);
  box-shadow: 4px 0 10px rgba(31, 41, 51, 0.08);
}

.task-grid-frame.is-reference-pinned .sheet-table.task-table thead th.row-number,
.task-grid-frame.is-reference-pinned .sheet-table.task-table thead th.attachment-cell,
.task-grid-frame.is-reference-pinned .sheet-table.task-table thead th.preview-cell,
.task-grid-frame.is-reference-pinned .sheet-table.task-table thead th.hierarchy-cell {
  z-index: 36;
  background: var(--grid-head);
}

.task-grid-frame.is-reference-pinned .sheet-table.task-table tbody td.row-number {
  z-index: 24;
  background: var(--grid-head);
}

.task-grid-frame.is-reference-pinned .sheet-table.task-table tbody td.attachment-cell {
  z-index: 23;
  background: var(--surface);
}

.task-grid-frame.is-reference-pinned .sheet-table.task-table tbody td.preview-cell {
  z-index: 22;
  background: var(--surface);
}

.task-grid-frame.is-reference-pinned .sheet-table.task-table tbody td.hierarchy-cell {
  z-index: 21;
  background: var(--surface);
}

.task-grid-frame.is-reference-pinned .sheet-table.task-table tbody tr:hover td.attachment-cell,
.task-grid-frame.is-reference-pinned .sheet-table.task-table tbody tr:hover td.preview-cell,
.task-grid-frame.is-reference-pinned .sheet-table.task-table tbody tr:hover td.hierarchy-cell {
  background: #f8fbff;
}

.task-grid-frame.is-reference-pinned .sheet-table.task-table tbody tr.is-active-row td.attachment-cell,
.task-grid-frame.is-reference-pinned .sheet-table.task-table tbody tr.is-active-row td.preview-cell,
.task-grid-frame.is-reference-pinned .sheet-table.task-table tbody tr.is-active-row td.hierarchy-cell {
  background: #eef9fe;
}

.task-grid-frame.is-reference-pinned .sheet-table.task-table tbody tr.is-selected-row td.attachment-cell,
.task-grid-frame.is-reference-pinned .sheet-table.task-table tbody tr.is-selected-row td.preview-cell,
.task-grid-frame.is-reference-pinned .sheet-table.task-table tbody tr.is-selected-row td.hierarchy-cell {
  background: rgba(87, 148, 242, 0.16);
}

.task-grid-frame.is-reference-pinned .sheet-table.task-table tbody td.attachment-cell:has(.attachment-dropdown[open]) {
  z-index: 42;
}

.task-preview {
  display: block;
  width: 160px;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  background: #101820;
  border: 1px solid #101820;
  border-radius: 6px;
}

.task-preview.inherited-preview {
  border-color: var(--blue);
}

.preview-note {
  display: block;
  margin-top: 4px;
  font-size: 11px;
  font-weight: 800;
}

.empty-preview {
  display: block;
  width: 160px;
  aspect-ratio: 16 / 9;
  background: rgba(255, 255, 255, 0.02);
  border: 1px dashed var(--line);
  border-radius: 6px;
}

.scene-link-cell {
  min-width: 190px;
}

.scene-pill {
  width: max-content;
  color: #006fa6;
  background: #dff3fc;
}

.status,
.pill {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  padding: 0 7px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 800;
}

.status.todo,
.status.planning {
  color: var(--muted);
  background: #eef0f1;
}

.status.in-progress,
.pill.active {
  color: #ffffff;
  background: var(--blue);
}

.status.blocked,
.status.canceled,
.status.lost {
  color: #ffffff;
  background: var(--red);
}

.status.review {
  color: #ffffff;
  background: var(--amber);
}

.status.completed,
.status.done,
.pill.inactive {
  color: #ffffff;
  background: var(--green);
}

.progress {
  width: 120px;
  height: 8px;
  overflow: hidden;
  background: #e9e5db;
  border-radius: 999px;
}

.progress span {
  display: block;
  height: 100%;
  background: var(--teal);
}

.crm-import-progress {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(180px, 260px);
  gap: 12px;
  align-items: center;
  margin-bottom: 10px;
  padding: 8px 10px;
  color: var(--ink);
  background: #eef7fb;
  border: 1px solid #b9dce9;
  border-radius: 5px;
}

.crm-import-progress[hidden] {
  display: none;
}

.crm-import-progress strong {
  display: block;
  font-size: 12px;
}

.crm-import-progress small {
  display: block;
  color: var(--muted);
  font-size: 11px;
}

.crm-opportunity-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  min-width: 260px;
}

.crm-opportunity-actions form {
  display: inline-flex;
  gap: 5px;
  align-items: center;
}

.crm-opportunity-actions select {
  width: 150px;
  min-width: 150px;
}

.crm-inline-status-form {
  display: inline-flex;
  margin-left: 6px;
}

.indeterminate-progress {
  position: relative;
  height: 7px;
  overflow: hidden;
  background: #d7edf5;
  border-radius: 999px;
}

.indeterminate-progress span {
  position: absolute;
  top: 0;
  bottom: 0;
  left: -35%;
  width: 35%;
  background: var(--blue);
  border-radius: inherit;
  animation: indeterminate-progress 1.05s ease-in-out infinite;
}

@keyframes indeterminate-progress {
  from {
    transform: translateX(0);
  }
  to {
    transform: translateX(390%);
  }
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(180px, 1fr));
  gap: 10px;
}

.stack-form {
  display: grid;
  gap: 10px;
}

.project-create-form {
  display: grid;
  gap: 16px;
}

.scope-write-panel {
  padding: 14px;
  background: var(--surface-raised);
  border: 1px solid var(--line);
  border-radius: 7px;
}

.scope-write-panel textarea,
.scope-editor textarea {
  min-height: 320px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
  font-size: 12.5px;
  line-height: 1.35;
}

.scope-write-panel textarea {
  min-height: 380px;
}

label {
  display: grid;
  gap: 4px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
}

input,
select,
textarea {
  width: 100%;
  min-height: 34px;
  padding: 7px 8px;
  color: var(--text);
  background: #fffefa;
  border: 1px solid var(--line);
  border-radius: 5px;
  font: inherit;
  font-size: 12.5px;
}

textarea {
  resize: vertical;
}

.wide {
  grid-column: span 2;
}

.form-actions {
  display: flex;
  align-items: end;
  gap: 8px;
}

.inline-form {
  display: flex;
  align-items: center;
  gap: 8px;
}

.inline-form select,
.inline-form input {
  width: auto;
  min-width: 96px;
}

.replace-form {
  display: flex;
  gap: 10px;
  max-width: 520px;
}

.check-row {
  display: flex;
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 10px;
  text-transform: none;
}

.check-row input {
  width: 18px;
  min-height: 18px;
}

.project-log-panel,
.project-log-workbench {
  display: grid;
  gap: 14px;
}

.project-log-workbench {
  grid-template-rows: auto auto minmax(0, 1fr);
  height: calc(100vh - 236px);
  min-height: 360px;
  gap: 6px;
  padding: 6px;
}

.project-log-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 24px;
  padding: 0 2px;
}

.project-log-header strong,
.project-log-header small {
  display: block;
}

.project-log-header strong {
  color: var(--ink);
  font-size: 13px;
}

.project-log-header small,
.project-log-header span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
}

.project-log-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  gap: 10px;
}

.project-log-workbench .project-log-form {
  padding: 5px;
  background: var(--surface-raised);
  border: 1px solid var(--line);
  border-radius: 6px;
}

.project-log-workbench .project-log-form label {
  gap: 3px;
}

.project-log-workbench .project-log-form input {
  min-height: 28px;
  padding: 4px 8px;
}

.project-log-workbench .project-log-form .button {
  min-height: 28px;
  padding: 0 10px;
}

.project-log-autocomplete {
  max-height: 248px;
  overflow: auto;
  padding: 4px;
}

.project-log-autocomplete button {
  display: grid;
  grid-template-columns: minmax(72px, auto) minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  min-height: 28px;
  padding: 4px 8px;
}

.project-log-autocomplete button.active,
.project-log-autocomplete button:hover {
  background: #e8f4fb;
}

.project-log-autocomplete button.is-hint {
  cursor: default;
  background: #f8fbfd;
}

.project-log-autocomplete button.is-hint.active,
.project-log-autocomplete button.is-hint:hover {
  background: #f8fbfd;
}

.project-log-autocomplete .log-suggestion-value {
  color: var(--ink);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px;
  font-weight: 900;
}

.project-log-autocomplete .log-suggestion-label {
  overflow: hidden;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.project-log-autocomplete button.is-hint .log-suggestion-value {
  color: var(--blue);
}

.project-log-autocomplete button.is-hint .log-suggestion-label {
  color: var(--ink);
}

.project-log-list {
  display: grid;
  gap: 0;
}

.project-log-scroll {
  align-content: start;
  overflow: auto;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 6px;
}

.project-log-entry {
  display: grid;
  gap: 5px;
  padding: 12px 14px;
  background: var(--surface-raised);
  border: 1px solid var(--line);
  border-left: 3px solid var(--blue);
  border-radius: 7px;
}

.project-log-workbench .project-log-entry {
  grid-template-columns: 74px 92px minmax(116px, 160px) minmax(84px, 128px) minmax(82px, 118px) minmax(0, 1fr) 28px;
  align-items: center;
  gap: 8px;
  min-height: 28px;
  padding: 3px 8px;
  background: transparent;
  border: 0;
  border-bottom: 1px solid var(--grid-line);
  border-left: 2px solid var(--blue);
  border-radius: 0;
  font-size: 12px;
}

.project-log-workbench .project-log-entry:hover {
  background: #eef9fe;
}

.project-log-workbench .project-log-entry:last-child {
  border-bottom: 0;
}

.project-log-workbench .project-log-heading {
  position: sticky;
  top: 0;
  z-index: 2;
  min-height: 26px;
  color: var(--muted);
  background: var(--grid-head);
  border-left-color: transparent;
  font-size: 10px;
  font-weight: 900;
  text-transform: uppercase;
}

.project-log-entry.cost {
  border-left-color: var(--green);
}

.project-log-entry.incident {
  border-left-color: var(--red);
}

.project-log-entry strong,
.project-log-entry small {
  display: block;
}

.project-log-workbench .project-log-entry strong,
.project-log-workbench .project-log-entry small {
  display: inline;
}

.project-log-entry small {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.project-log-entry p {
  margin: 0;
  color: var(--text);
}

.project-log-workbench .project-log-entry p {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.project-log-workbench .log-kind,
.project-log-workbench time,
.project-log-workbench .log-person,
.project-log-workbench .log-meta,
.project-log-workbench .log-value {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.project-log-workbench .log-kind {
  color: var(--muted);
  font-size: 10px;
  font-weight: 900;
  text-transform: uppercase;
}

.project-log-workbench time,
.project-log-workbench .log-person,
.project-log-workbench .log-meta {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
}

.project-log-workbench .log-value {
  color: var(--ink);
  font-size: 12px;
}

.project-log-workbench .log-actions {
  display: flex;
  justify-content: flex-end;
}

.project-log-workbench .log-actions form {
  margin: 0;
}

.project-log-workbench .log-actions .icon-button {
  width: 22px;
  min-width: 22px;
  min-height: 22px;
  padding: 0;
  font-size: 14px;
  line-height: 1;
}

.template-list,
.mini-list {
  display: grid;
  gap: 10px;
}

.template-strip,
.mini-list > div {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 12px;
  padding: 13px;
  color: var(--text);
  background: #fffefa;
  border: 1px solid var(--line);
  border-radius: 7px;
}

.template-strip:hover {
  text-decoration: none;
  border-color: var(--blue);
}

.sync-log-wrap {
  max-height: 280px;
  overflow: auto;
}

.sync-log-table {
  width: 100%;
  min-width: 760px;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 11.5px;
}

.sync-log-table th {
  position: sticky;
  top: 0;
  z-index: 2;
  height: 26px;
  padding: 4px 7px;
  color: var(--muted);
  background: var(--grid-head);
  border-bottom: 1px solid var(--grid-line);
  font-size: 10.5px;
  font-weight: 700;
  text-transform: none;
}

.sync-log-table td {
  height: 26px;
  padding: 3px 7px;
  color: var(--text);
  background: var(--surface);
  border-bottom: 1px solid var(--grid-line);
  vertical-align: middle;
  white-space: nowrap;
}

.sync-log-table tbody tr:hover td {
  background: #eef9fe;
}

.sync-log-message {
  max-width: 620px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sync-log-status {
  display: inline-flex;
  align-items: center;
  min-height: 18px;
  padding: 0 6px;
  color: var(--muted);
  background: var(--surface-raised);
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 10px;
  font-weight: 700;
  text-transform: lowercase;
}

.sync-log-status.success,
.sync-log-status.ok,
.sync-log-status.skipped {
  color: var(--green);
}

.sync-log-status.warning,
.sync-log-status.conflict,
.sync-log-status.missing-configuration,
.sync-log-status.missing-repository {
  color: #7a5a00;
}

.sync-log-status.error {
  color: var(--red);
}

.gitlab-explorer {
  display: grid;
  gap: 12px;
}

.explorer-context-note {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  padding: 8px 10px;
  color: var(--text);
  background: var(--surface-soft);
  border: 1px solid var(--grid-line);
  border-radius: 4px;
  font-size: 12px;
}

.explorer-context-note span {
  color: var(--muted);
}

.explorer-modal {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: grid;
  align-items: start;
  justify-items: center;
  padding: 6vh 24px 24px;
  background: rgba(16, 24, 32, 0.28);
}

.explorer-modal-panel {
  display: grid;
  gap: 10px;
  width: min(1180px, 96vw);
  max-height: 86vh;
  padding: 12px;
  overflow: auto;
  background: var(--surface);
  border: 1px solid var(--grid-line);
  border-radius: 6px;
  box-shadow: var(--shadow);
}

.project-import-modal {
  position: fixed;
  inset: 0;
  z-index: 90;
  display: grid;
  align-items: start;
  justify-items: center;
  padding: 5vh 18px 18px;
  background: rgba(16, 24, 32, 0.26);
}

.project-import-panel {
  display: grid;
  gap: 10px;
  width: min(1080px, 96vw);
  max-height: 90vh;
  padding: 12px;
  overflow: auto;
  background: var(--surface);
  border: 1px solid var(--grid-line);
  border-radius: 6px;
  box-shadow: var(--shadow);
}

.project-import-head {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: start;
}

.project-import-head strong,
.project-import-head small {
  display: block;
}

.project-import-head small {
  color: var(--muted);
  font-size: 11px;
}

.project-import-panel label {
  display: grid;
  gap: 4px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}

.project-import-panel .project-import-check {
  display: flex;
  gap: 7px;
  align-items: center;
  color: var(--ink);
  font-weight: 600;
}

.project-import-options {
  display: grid;
  gap: 6px;
  margin: 0;
  padding: 8px;
  border: 1px solid var(--grid-line);
  border-radius: 5px;
}

.project-import-options legend {
  padding: 0 4px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
}

.project-import-check input {
  width: 14px;
  height: 14px;
  margin: 0;
}

.project-import-panel select {
  min-height: 30px;
  padding: 4px 7px;
}

.project-import-progress {
  display: grid;
  gap: 5px;
  color: var(--muted);
  font-size: 12px;
}

.project-import-progress progress {
  width: 100%;
  height: 12px;
}

.project-import-actions {
  display: flex;
  justify-content: end;
}

.project-import-recipe {
  border: 1px solid var(--grid-line);
  border-radius: 5px;
  background: var(--surface-muted);
}

.project-import-recipe summary {
  cursor: pointer;
  padding: 7px 9px;
  color: var(--ink);
  font-size: 11.5px;
  font-weight: 800;
}

.project-import-recipe label {
  padding: 0 9px 8px;
}

.project-import-recipe-scroll {
  max-height: 210px;
  overflow: auto;
  border-top: 1px solid var(--grid-line);
}

.project-import-recipe table,
.project-import-preview-scroll table {
  width: 100%;
  border-collapse: collapse;
  font-size: 11px;
}

.project-import-recipe th,
.project-import-recipe td,
.project-import-preview-scroll th,
.project-import-preview-scroll td {
  padding: 5px 7px;
  border-bottom: 1px solid var(--grid-line);
  text-align: left;
  vertical-align: middle;
}

.project-import-recipe th,
.project-import-preview-scroll th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: var(--grid-head);
  color: var(--muted);
  font-size: 10px;
}

.project-import-recipe td strong,
.project-import-recipe td small {
  display: block;
}

.project-import-recipe td small {
  color: var(--blue);
  font-size: 9px;
}

.project-import-recipe select,
.project-import-recipe input {
  min-height: 26px;
  padding: 3px 6px;
  font-size: 11px;
}

.project-import-recipe-actions {
  display: flex;
  justify-content: flex-end;
  gap: 6px;
  padding: 7px 9px;
}

.project-import-preview-summary {
  padding: 0 9px 7px;
  color: var(--muted);
  font-size: 11px;
}

.project-import-preview-scroll {
  max-height: 180px;
  overflow: auto;
  border-top: 1px solid var(--grid-line);
}

.explorer-modal-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: start;
}

.explorer-modal-head strong,
.explorer-modal-head small {
  display: block;
}

.explorer-modal-head small {
  color: var(--muted);
  font-size: 11px;
}

.explorer-controls,
.explorer-layout,
.explorer-load-panel,
.explorer-output-head {
  display: flex;
  gap: 10px;
  align-items: end;
}

.explorer-controls label,
.explorer-load-panel label {
  display: grid;
  gap: 3px;
  min-width: 180px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}

.explorer-controls select,
.explorer-controls input,
.explorer-load-panel input {
  min-height: 30px;
  padding: 4px 7px;
}

.explorer-search {
  flex: 1;
}

.explorer-status {
  min-height: 18px;
  color: var(--muted);
  font-size: 12px;
}

.explorer-page-status {
  margin: -4px 0 8px;
}

.explorer-status.success {
  color: var(--green);
}

.explorer-status.error {
  color: var(--red);
}

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

.explorer-results-wrap {
  flex: 1;
  max-height: 260px;
  overflow: auto;
  border: 1px solid var(--grid-line);
}

.explorer-results-table,
.explorer-grid {
  min-width: 800px;
  font-size: 12px;
}

.explorer-grid .explorer-select-cell {
  width: 34px;
  min-width: 34px;
  max-width: 34px;
  padding-left: 4px;
  padding-right: 4px;
  text-align: center;
}

.explorer-grid .explorer-select-cell input {
  width: 14px;
  height: 14px;
  margin: 0;
}

.explorer-results-table th,
.explorer-grid th {
  position: sticky;
  top: 0;
  z-index: 1;
  padding: 5px 7px;
  background: var(--grid-head);
  border-bottom-color: var(--grid-line);
  font-size: 10.5px;
  text-transform: none;
}

.explorer-results-table td,
.explorer-grid td {
  height: 30px;
  padding: 4px 7px;
  background: var(--surface);
  border-bottom-color: var(--grid-line);
}

.explorer-project-row {
  cursor: pointer;
}

.explorer-project-row:hover td,
.explorer-project-row.is-selected td,
.explorer-grid tbody tr:hover td {
  background: #eef9fe;
}

.explorer-grid tbody tr.is-selected td {
  background: #dff4ff;
}

.explorer-grid tbody tr.is-selected:hover td {
  background: #d4effc;
}

.explorer-link-cell,
.explorer-selected-project-link {
  color: var(--blue);
  font-weight: 700;
}

.explorer-link-cell a,
.explorer-selected-project-link {
  color: inherit;
  text-decoration: none;
}

.explorer-link-cell a:hover,
.explorer-selected-project-link:hover {
  text-decoration: underline;
}

.explorer-selected-project-link:not([href]) {
  color: var(--ink);
  pointer-events: none;
}

.explorer-task-cell {
  min-width: 260px;
  padding-left: calc(7px + (var(--explorer-indent, 0) * 18px)) !important;
  white-space: nowrap;
}

.explorer-task-cell[data-indent-level="0"] {
  color: var(--ink);
  font-weight: 700;
}

.explorer-task-cell:not([data-indent-level="0"]) {
  color: var(--ink);
  font-weight: 500;
}

.explorer-task-label {
  display: inline-flex;
  align-items: center;
  min-height: 18px;
  max-width: 100%;
}

.explorer-row-toggle,
.explorer-row-toggle-spacer {
  display: inline-grid;
  place-items: center;
  width: 18px;
  height: 18px;
  margin-right: 3px;
  vertical-align: middle;
}

.explorer-row-toggle {
  padding: 0;
  color: var(--blue);
  background: #ffffff;
  border: 1px solid #b8d7e8;
  border-radius: 3px;
  font-size: 12px;
  font-weight: 800;
  line-height: 1;
  cursor: pointer;
}

.explorer-row-toggle:hover {
  background: #eef9fe;
}

.explorer-indent-guide {
  display: inline-block;
  width: 11px;
  height: 15px;
  margin-right: 5px;
  border-left: 1px solid #b8c6d4;
  border-bottom: 1px solid #b8c6d4;
  transform: translateY(-3px);
  vertical-align: middle;
}

.explorer-load-panel {
  width: min(360px, 34vw);
  align-content: start;
  align-items: stretch;
  flex-direction: column;
  padding: 10px;
  background: var(--surface-raised);
  border: 1px solid var(--grid-line);
  border-radius: 6px;
}

.explorer-load-panel strong,
.explorer-output-head strong {
  display: block;
}

.explorer-load-panel small,
.explorer-output-head small {
  display: block;
  color: var(--muted);
  font-size: 11px;
}

.explorer-output-head {
  justify-content: space-between;
  align-items: center;
}

.explorer-output-actions {
  display: flex;
  gap: 6px;
  align-items: center;
}

.explorer-selection-count {
  color: var(--muted);
  font-size: 11px;
  line-height: 1;
  white-space: nowrap;
}

.explorer-output-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(220px, 280px);
  gap: 10px;
  align-items: stretch;
}

.explorer-grid-wrap {
  max-height: calc(100vh - 250px);
  min-height: 220px;
  overflow: auto;
  border: 1px solid var(--grid-line);
}

.explorer-version-panel {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 8px;
  min-height: 220px;
  max-height: calc(100vh - 250px);
  padding: 9px;
  overflow: hidden;
  background: var(--surface-raised);
  border: 1px solid var(--grid-line);
  border-radius: 6px;
}

.explorer-version-panel strong,
.explorer-version-panel small {
  display: block;
}

.explorer-version-panel small {
  color: var(--muted);
  font-size: 11px;
}

.explorer-version-list {
  display: grid;
  align-content: start;
  gap: 4px;
  overflow: auto;
}

.explorer-version-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
  min-height: 26px;
  padding: 4px 6px;
  background: var(--surface);
  border: 1px solid var(--grid-line);
  border-radius: 4px;
  font-size: 11px;
}

.explorer-version-row span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.explorer-version-row code {
  padding: 1px 4px;
  color: var(--blue);
  background: #eef9fe;
  border: 1px solid #c6eafa;
  border-radius: 3px;
  font-size: 10.5px;
}

.explorer-preview {
  width: 70px;
  height: 40px;
  object-fit: contain;
  background: #ffffff;
  border: 1px solid var(--grid-line);
  border-radius: 3px;
}

.explorer-preview[data-preview-zoom] {
  cursor: zoom-in;
}

.explorer-preview[data-preview-zoom]:hover {
  border-color: var(--blue);
  box-shadow: 0 0 0 2px rgba(0, 156, 222, 0.18);
}

.explorer-warnings {
  display: grid;
  gap: 4px;
  padding: 8px;
  color: #7a5a00;
  background: #fff8dc;
  border: 1px solid #e6d48f;
  border-radius: 6px;
  font-size: 12px;
}

@media (max-width: 980px) {
  .explorer-output-layout {
    grid-template-columns: 1fr;
  }

  .explorer-version-panel {
    max-height: 180px;
  }
}

.flash-stack {
  display: grid;
  gap: 8px;
  position: fixed;
  top: 14px;
  right: 18px;
  z-index: 1600;
  width: min(420px, calc(100vw - 36px));
  margin: 0;
}

.flash {
  padding: 12px 14px;
  background: #eef6f4;
  border: 1px solid #b8d9d2;
  border-radius: 7px;
  box-shadow: 0 14px 34px rgba(0, 0, 0, 0.35);
  font-weight: 700;
}

.flash.error {
  background: #fff0ed;
  border-color: #f2b8ad;
}

.book-cover {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(280px, 420px);
  gap: 24px;
  margin-bottom: 20px;
  padding: 28px;
  color: #ffffff;
  background: #101820;
  border-radius: 8px;
}

.book-cover h2 {
  margin: 0 0 10px;
  font-size: 34px;
}

.book-cover dl {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin: 0;
}

.book-cover dt {
  color: #a7b0b7;
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.book-cover dd {
  margin: 4px 0 0;
  font-size: 18px;
  font-weight: 800;
}

.book-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.inline-book-grid {
  padding: 14px;
}

.book-item {
  display: grid;
  grid-template-columns: 180px minmax(0, 1fr);
  gap: 14px;
  padding: 12px;
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 7px;
}

.book-item img {
  width: 180px;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  border-radius: 6px;
}

.book-item h3 {
  margin: 0 0 6px;
}

.scene-book {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.scene-card {
  display: grid;
  gap: 12px;
  padding: 12px;
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 7px;
}

.scene-card-main {
  display: grid;
  grid-template-columns: 180px minmax(0, 1fr);
  gap: 14px;
  align-items: start;
}

.scene-card-main img {
  width: 180px;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  background: #101820;
  border: 1px solid #101820;
  border-radius: 6px;
}

.scene-card h3 {
  margin: 0 0 6px;
}

.scene-automation-list {
  display: grid;
  gap: 8px;
  padding-left: 12px;
  border-left: 3px solid #dff3fc;
}

.scene-automation-row {
  display: grid;
  gap: 3px;
  padding: 9px 10px;
  background: #fbfaf5;
  border: 1px solid var(--line);
  border-radius: 6px;
}

.scene-automation-row span {
  color: var(--teal);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
}

.scene-automation-row p {
  margin: 2px 0 0;
  color: var(--muted);
}

.gantt-panel {
  overflow-x: auto;
  padding: 14px;
}

.gantt-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 12px;
}

.gantt-summary span {
  min-height: 46px;
  padding: 10px 12px;
  color: var(--muted);
  background: #fbfaf5;
  border: 1px solid var(--line);
  border-radius: 7px;
  font-size: 12px;
  font-weight: 800;
}

.gantt-summary strong {
  display: block;
  margin-top: 3px;
  color: var(--ink);
}

.gantt-toolbar {
  display: flex;
  align-items: end;
  justify-content: flex-end;
  gap: 8px;
  margin-bottom: 8px;
}

.gantt-toolbar label {
  display: grid;
  gap: 3px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
}

.gantt-toolbar select {
  min-height: 26px;
  padding: 0 24px 0 8px;
  color: var(--text);
  background: var(--surface-raised);
  border: 1px solid var(--grid-line);
  border-radius: 5px;
  font-size: 11px;
  font-weight: 800;
}

.gantt-filter-summary {
  margin-right: auto;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
}

.gantt-grid {
  display: grid;
  grid-template-columns: minmax(240px, 1.2fr) minmax(360px, 2fr) minmax(92px, 0.42fr) minmax(92px, 0.42fr) minmax(130px, 0.62fr);
  min-width: 1040px;
  overflow: hidden;
  border: 1px solid var(--grid-line);
  border-radius: 7px;
}

.gantt-head,
.gantt-task,
.gantt-track,
.gantt-date,
.gantt-dependency,
.gantt-empty {
  min-height: 48px;
  padding: 9px 10px;
  background: #ffffff;
  border-right: 1px solid var(--grid-line);
  border-bottom: 1px solid var(--grid-line);
}

.gantt-head {
  min-height: 34px;
  color: #3d4852;
  background: var(--grid-head);
  font-size: 11px;
  font-weight: 900;
}

.gantt-task strong,
.gantt-date strong {
  display: block;
}

.gantt-date,
.gantt-dependency {
  display: flex;
  align-items: center;
}

.gantt-track {
  position: relative;
  display: flex;
  align-items: center;
  background-image: linear-gradient(to right, rgba(138, 154, 163, 0.18) 1px, transparent 1px);
  background-size: 10% 100%;
}

.gantt-bar {
  display: block;
  min-width: 7px;
  height: 16px;
  background: var(--blue);
  border-radius: 999px;
}

.gantt-task.is-critical {
  border-left: 4px solid var(--red);
}

.gantt-task.is-summary {
  background: #f6f8fb;
}

.gantt-task.is-summary strong::after {
  content: " summary";
  margin-left: 6px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
}

.gantt-track.is-summary .gantt-bar {
  height: 10px;
  background: #64748b;
  border-radius: 3px;
}

.gantt-track.is-critical .gantt-bar {
  background: var(--red);
}

.gantt-track.is-summary.is-critical .gantt-bar {
  background: var(--red);
}

.gantt-empty {
  grid-column: 1 / -1;
  color: var(--muted);
}

.admin-grid {
  display: grid;
  grid-template-columns: minmax(280px, 0.8fr) minmax(0, 1.2fr);
  gap: 20px;
}

.admin-layout {
  display: grid;
  grid-template-columns: 190px minmax(0, 1fr);
  gap: 14px;
  align-items: start;
}

.admin-entity-nav {
  position: sticky;
  top: 18px;
  z-index: 9;
  display: grid;
  gap: 3px;
  padding: 6px;
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 6px;
  box-shadow: var(--shadow);
}

.admin-entity-nav a {
  display: flex;
  align-items: center;
  min-height: 24px;
  padding: 0 7px;
  color: var(--muted);
  background: transparent;
  border: 1px solid transparent;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 500;
  line-height: 1.15;
}

.admin-entity-nav a:hover,
.admin-entity-nav a.active {
  color: var(--ink);
  background: var(--surface-raised);
  border-color: var(--green);
}

.admin-entity-nav a.active {
  font-weight: 650;
}

.admin-entity-panel {
  display: none;
  scroll-margin-top: 138px;
}

.admin-entity-panel.active {
  display: block;
}

.admin-create-row {
  margin-bottom: 16px;
}

.inline-edit-list {
  display: grid;
  gap: 10px;
}

.inline-edit-row {
  display: grid;
  grid-template-columns: repeat(4, minmax(120px, 1fr)) auto;
  align-items: end;
  gap: 10px;
  padding: 12px;
  background: #fffefa;
  border: 1px solid var(--line);
  border-radius: 7px;
}

.inline-edit-row.departments {
  grid-template-columns: minmax(150px, 1fr) minmax(80px, 0.45fr) minmax(110px, 0.5fr) minmax(120px, 0.6fr) minmax(130px, 0.65fr) minmax(80px, 0.4fr) auto;
}

.inline-edit-row.users {
  grid-template-columns: minmax(150px, 1fr) minmax(200px, 1fr) minmax(130px, 0.75fr) minmax(140px, 0.75fr) minmax(120px, 0.6fr) auto auto auto auto;
}

.admin-bulk-grid-form,
.admin-users-grid-form {
  display: grid;
  gap: 10px;
}

.admin-grid-wrap,
.admin-users-grid-wrap {
  max-height: min(62vh, 720px);
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #ffffff;
}

.admin-table {
  min-width: 1160px;
  font-size: 12px;
  table-layout: fixed;
}

.wide-admin-table {
  min-width: 1380px;
}

.compact-admin-grid-wrap {
  max-width: 920px;
}

.compact-admin-table {
  min-width: 680px;
}

.admin-table th,
.admin-table td {
  padding: 5px 6px;
}

.admin-table td {
  height: 34px;
}

.admin-table thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: #f6f8fb;
}

.admin-table input,
.admin-table select,
.admin-table textarea {
  width: 100%;
  min-height: 30px;
  padding: 5px 7px;
  font-size: 12px;
}

.admin-table input:not([type="hidden"]):not([type="checkbox"]),
.admin-table select,
.admin-table textarea {
  color: var(--ink);
  background: transparent;
  border-color: transparent;
  box-shadow: none;
}

.admin-table select {
  appearance: none;
  background-image: none;
}

.admin-table textarea {
  overflow: hidden;
}

.admin-table td:hover input:not([type="hidden"]):not([type="checkbox"]),
.admin-table td:hover select,
.admin-table td:hover textarea,
.admin-table td:focus-within input:not([type="hidden"]):not([type="checkbox"]),
.admin-table td:focus-within select,
.admin-table td:focus-within textarea {
  background: #ffffff;
  border-color: var(--grid-line);
  box-shadow: inset 0 0 0 1px rgba(0, 114, 206, 0.16);
}

.admin-table td:hover select,
.admin-table td:focus-within select {
  appearance: auto;
}

.admin-table textarea {
  resize: vertical;
}

.admin-table .compact-check {
  justify-content: center;
  gap: 0;
}

.admin-table .compact-check input[type="hidden"] {
  display: none;
}

.admin-table .compact-check input[type="checkbox"] {
  width: 16px;
  min-height: 16px;
}

.admin-menu-acl {
  min-width: 150px;
  font-size: 12px;
}

.admin-menu-acl summary {
  cursor: pointer;
  color: var(--blue);
  font-weight: 600;
  white-space: nowrap;
}

.admin-menu-acl-options {
  display: grid;
  grid-template-columns: repeat(2, minmax(90px, 1fr));
  gap: 4px 8px;
  margin-top: 8px;
  padding: 8px;
  background: #ffffff;
  border: 1px solid var(--grid-line);
  border-radius: 6px;
  box-shadow: 0 10px 28px rgba(20, 34, 56, 0.12);
}

.admin-menu-acl-options label {
  display: flex;
  align-items: center;
  gap: 5px;
  min-height: 18px;
  font-size: 11px;
  white-space: nowrap;
}

.admin-menu-acl-options input[type="checkbox"] {
  width: 14px;
  min-height: 14px;
  flex: 0 0 auto;
}

.api-token-panel {
  display: grid;
  grid-template-columns: minmax(280px, 1fr) auto;
  align-items: end;
  gap: 10px;
  margin-bottom: 12px;
}

.api-token-panel input[readonly] {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px;
}

.user-activity-filter {
  align-items: end;
}

.user-activity-result {
  display: grid;
  gap: 8px;
}

.section-title.compact {
  margin-bottom: 0;
}

.section-title h3 {
  margin: 0;
  font-size: 14px;
}

.user-activity-preview {
  max-height: 520px;
  margin: 0;
  padding: 10px;
  overflow: auto;
  color: var(--ink);
  background: #f7f9fb;
  border: 1px solid var(--grid-line);
  border-radius: 6px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 11px;
  line-height: 1.45;
  white-space: pre;
}

.access-request-list {
  display: grid;
  gap: 10px;
  margin: 0 0 18px;
}

.access-request-row {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) minmax(430px, 1.25fr) auto;
  align-items: end;
  gap: 12px;
  padding: 12px;
  background: #e7f6fd;
  border: 1px solid #b8e3f6;
  border-radius: 7px;
}

.access-request-identity {
  display: grid;
  gap: 3px;
}

.access-request-identity small {
  color: var(--muted);
  font-size: 12px;
}

.access-request-approval {
  display: grid;
  grid-template-columns: minmax(130px, 1fr) minmax(130px, 1fr) auto auto;
  align-items: end;
  gap: 10px;
}

.inline-edit-row.project-types {
  grid-template-columns: minmax(160px, 0.9fr) minmax(140px, 0.7fr) minmax(240px, 1.2fr) repeat(5, minmax(100px, 0.6fr)) auto;
}

.inline-edit-row.department-rates {
  grid-template-columns: minmax(160px, 1fr) minmax(120px, 0.55fr) minmax(140px, 0.65fr) minmax(140px, 0.65fr) minmax(90px, 0.45fr) auto;
}

.inline-edit-row.offices {
  grid-template-columns: minmax(200px, 1fr) minmax(120px, 0.5fr) minmax(100px, 0.45fr) auto auto;
}

.inline-edit-row.compact-entity {
  grid-template-columns: minmax(200px, 1fr) minmax(260px, 2fr) auto;
}

.inline-edit-row.lookup-options {
  grid-template-columns: minmax(180px, 1fr) minmax(220px, 1.2fr) minmax(90px, 0.4fr) auto auto;
}

.inline-edit-row.client-contacts {
  grid-template-columns: minmax(150px, 0.8fr) minmax(150px, 0.8fr) minmax(140px, 0.7fr) minmax(180px, 1fr) minmax(120px, 0.7fr) minmax(220px, 1.2fr) auto auto;
}

.inline-edit-row.processor-rules {
  grid-template-columns: minmax(170px, 0.9fr) minmax(140px, 0.7fr) minmax(170px, 0.9fr) minmax(150px, 0.8fr) minmax(110px, 0.5fr) minmax(130px, 0.6fr) minmax(70px, 0.35fr) auto auto;
}

.inline-edit-row.estimation-rules {
  grid-template-columns: minmax(150px, 0.8fr) minmax(140px, 0.55fr) minmax(90px, 0.4fr) minmax(240px, 1.2fr) auto auto;
}

.inline-edit-row.gitlab-secret-row {
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: start;
}

.gitlab-secret-edit-form {
  grid-template-columns: repeat(3, minmax(170px, 1fr)) minmax(160px, 0.9fr) auto auto;
  align-items: end;
}

.gitlab-secret-edit-form .muted {
  align-self: center;
  min-width: 170px;
}

.gitlab-secret-actions {
  display: flex;
  justify-content: flex-end;
  align-self: end;
}

.gitlab-secret-actions form {
  margin: 0;
}

.gitlab-secret-note {
  grid-column: 1 / -1;
}

.project-resource-list {
  display: grid;
  gap: 8px;
  padding: 14px;
}

.project-resource-row {
  grid-template-columns: minmax(130px, 0.55fr) minmax(160px, 0.8fr) minmax(220px, 1.3fr) minmax(120px, 0.6fr) auto auto;
  background: var(--surface-raised);
}

.project-repository-wrap {
  margin: 10px 10px 0;
}

.project-repository-grid {
  min-width: max(100%, 1060px);
  font-size: 11.5px;
}

.project-repository-grid th {
  height: 27px;
  padding: 4px 7px;
  font-size: 10.5px;
  font-weight: 750;
}

.project-repository-grid td {
  height: 31px;
  padding: 3px 6px;
}

.project-repository-grid input,
.project-repository-grid select {
  min-height: 24px;
  padding: 2px 6px;
  color: var(--text);
  background: var(--surface-raised);
  border-color: var(--grid-line);
  border-radius: 3px;
  font-size: 11.5px;
}

.project-repository-grid input[readonly],
.project-repository-grid select:disabled {
  color: var(--muted);
  background: transparent;
}

.project-repository-grid .repo-sync-cell {
  width: 74px;
}

.project-repository-grid .repo-sync-cell label {
  display: flex;
  align-items: center;
  gap: 5px;
  color: var(--text);
  font-size: 11px;
  font-weight: 600;
  text-transform: none;
}

.project-repository-grid .repo-sync-cell input {
  width: 14px;
  min-height: 14px;
}

.project-repository-grid .repo-action-cell {
  display: flex;
  align-items: center;
  gap: 4px;
  width: 94px;
  white-space: nowrap;
}

.project-repository-grid .repo-action-cell form {
  margin: 0;
}

.project-repository-grid .repo-action-cell .icon-button {
  width: 24px;
  min-width: 24px;
  min-height: 24px;
  font-size: 12px;
  line-height: 1;
}

.project-resource-empty {
  padding: 14px;
}

.project-repository-create {
  grid-template-columns: minmax(130px, 0.7fr) minmax(130px, 0.7fr) minmax(150px, 0.8fr) minmax(300px, 1.6fr) auto auto;
  align-items: end;
  gap: 8px;
}

.project-repository-create label {
  gap: 3px;
}

.project-repository-create input,
.project-repository-create select {
  min-height: 28px;
  padding: 4px 7px;
  font-size: 11.5px;
}

.project-repository-create .wide {
  grid-column: span 1;
}

.project-repository-create .form-actions {
  justify-content: flex-end;
}

.sheet-inline-create {
  margin: 0 14px 14px;
  padding: 14px;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--line);
  border-radius: 7px;
}

.compact-delete-form {
  display: flex;
  justify-content: flex-end;
  margin: -4px 14px 8px;
}

.project-row-actions {
  width: 54px;
  text-align: center;
}

.project-delete-form {
  display: inline-flex;
  margin: 0;
}

/* Smartsheet-inspired light sheet theme. */
body {
  background: var(--bg);
}

a {
  color: var(--blue);
}

a:hover {
  color: var(--green);
  text-decoration: none;
}

.app-shell {
  background: #ffffff;
  border-right-color: var(--line);
  box-shadow: 8px 0 24px rgba(31, 41, 51, 0.06);
}

.brand {
  color: var(--ink);
}

.brand-mark {
  color: #ffffff;
  background: var(--green);
}

.main-nav a {
  color: #4e5f6d;
}

.main-nav a:hover,
.main-nav a.active,
.user-menu strong {
  color: var(--ink);
}

.eyebrow {
  color: var(--green);
}

.panel,
.scope-panel,
.sheet-frame {
  background: var(--surface);
  border-color: var(--line);
  box-shadow: var(--shadow);
}

.sheet-toolbar,
.sheet-summary,
.sheet-table thead th,
.sheet-table .row-number,
.gantt-head {
  background: var(--grid-head);
}

.sheet-toolbar,
.sheet-summary,
.sheet-frame,
.sheet-table thead th,
.sheet-table td,
.sheet-table .row-number,
th,
td {
  border-color: var(--grid-line);
}

.sheet-tabs {
  background: var(--surface-muted);
  border-color: var(--line);
}

.sheet-tabs .active {
  color: var(--ink);
  background: var(--surface-raised);
  box-shadow: inset 0 -2px 0 var(--green);
}

.sheet-tabs span,
.sheet-tabs button,
.sheet-title span,
.sheet-total,
.sheet-summary span,
th,
td small,
.muted,
.section-title small {
  color: var(--muted);
}

.sheet-table thead th,
.gantt-head {
  color: #34495a;
}

.sheet-table td,
.gantt-task,
.gantt-track,
.gantt-date,
.gantt-dependency,
.gantt-empty {
  background: var(--surface);
}

.sheet-table tbody tr:hover td,
.is-child-row td {
  background: #f8fbfd;
}

.is-dirty td {
  box-shadow: inset 0 -2px 0 rgba(0, 159, 227, 0.35);
}

.hierarchy-cell .cell-stack {
  border-left-color: rgba(0, 159, 227, calc(0.22 + (var(--indent, 0) * 0.08)));
}

.is-child-row .hierarchy-cell .cell-stack::before {
  border-top-color: rgba(0, 159, 227, 0.45);
}

.markdown-body,
.gantt-summary span,
.template-strip,
.mini-list > div,
.book-item,
.scene-card,
.scene-automation-row,
.inline-edit-row,
.assignment-queue-heading {
  background: var(--surface-raised);
  border-color: var(--line);
}

.markdown-body code,
.markdown-body pre {
  background: #f1f5f8;
}

.scope-panel summary,
.assignment-queue,
.assignment-queue-heading,
.scene-automation-list {
  border-color: var(--line);
}

input,
select,
textarea,
.cell-input,
.cell-select,
.cell-textarea {
  color: var(--text);
  background: #ffffff;
  border-color: #cfd8e2;
}

input::placeholder,
textarea::placeholder {
  color: #8a98a6;
}

input[type="checkbox"] {
  width: 16px;
  min-height: 16px;
  padding: 0;
  accent-color: var(--green);
}

.cell-input:hover,
.cell-select:hover,
.cell-textarea:hover,
.cell-input:focus,
.cell-select:focus,
.cell-textarea:focus,
input:focus,
select:focus,
textarea:focus {
  background: #ffffff;
  border-color: var(--green);
  outline: 0;
  box-shadow: 0 0 0 2px rgba(0, 159, 227, 0.14);
}

.button,
button,
.row-menu-button {
  color: var(--text);
  background: var(--surface-raised);
  border-color: #cfd8e2;
}

.button:hover,
button:hover,
.template-strip:hover {
  border-color: var(--green);
  text-decoration: none;
}

.button.primary,
button.primary {
  color: #ffffff;
  background: var(--green);
  border-color: var(--green);
}

.button.active,
button.active {
  color: #ffffff;
  background: var(--green);
  border-color: var(--green);
}

.grid-context-menu {
  background: var(--surface-raised);
  border-color: var(--line);
  box-shadow: 0 18px 38px rgba(31, 41, 51, 0.18);
}

.grid-context-menu button {
  color: var(--text);
}

.grid-context-menu button:hover {
  background: #eaf7fd;
}

.grid-context-menu button.danger {
  color: var(--red);
  background: transparent;
  border-color: transparent;
}

.grid-context-menu button.danger:hover {
  color: #ffffff;
  background: var(--red);
}

.grid-context-menu hr {
  background: var(--line);
}

.metric,
.current-window-panel,
.assignment-queue-panel,
.sheet-form-panel {
  background: var(--surface);
  border-color: var(--line);
}

.current-window-panel {
  border-left: 3px solid var(--green);
}

.assignment-queue-panel {
  border-left: 3px solid var(--green);
}

.metric strong,
.gantt-summary strong,
.primary-cell a,
.sheet-title strong,
.assignment-queue-heading strong {
  color: var(--ink);
}

.assignment-queue-heading b {
  color: #ffffff;
  background: var(--green);
}

.progress {
  background: #dfe7ee;
}

.progress span {
  background: var(--green);
}

.status.todo,
.status.planning {
  color: #34495a;
  background: #e7edf3;
}

.status.in-progress,
.pill.active {
  color: #ffffff;
  background: var(--blue);
}

.status.review {
  color: #101820;
  background: var(--amber);
}

.status.completed,
.pill.inactive {
  color: #ffffff;
  background: var(--green);
}

.scene-pill {
  color: #ffffff;
  background: var(--green);
}

.book-cover {
  color: var(--ink);
  background: var(--surface-raised);
  border: 1px solid var(--line);
}

.book-cover dt {
  color: var(--muted);
}

.scene-automation-list {
  border-left-color: var(--green);
}

.scene-automation-row span {
  color: var(--green);
}

.gantt-track {
  background-color: #fbfdfe;
  background-image: linear-gradient(to right, rgba(96, 112, 128, 0.13) 1px, transparent 1px);
}

.gantt-bar {
  background: var(--blue);
}

.gantt-track.is-critical .gantt-bar {
  background: var(--red);
}

.gantt-task.is-critical {
  border-left-color: var(--red);
}

.flash {
  color: var(--text);
  background: #e7f4ef;
  border-color: #a9d5c8;
}

.flash.error {
  background: #fdecec;
  border-color: #efb5b5;
}

.login-panel {
  display: grid;
  place-items: center;
  min-height: 100%;
}

.login-panel .panel {
  width: min(520px, 100%);
}

/* Read-only viewer for the native Smartsheet backup structure. */
.backup-viewer {
  display: flex;
  width: 100%;
  min-height: calc(100vh - 112px);
  flex-direction: column;
}

.backup-viewer-header {
  display: flex;
  flex: 0 0 auto;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.backup-viewer-header h1 {
  margin: 0;
  font-size: 22px;
  line-height: 1.12;
}

.backup-context {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 11px;
}

.backup-viewer-actions,
.backup-grid-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.backup-tabs {
  display: flex;
  flex: 0 0 auto;
  flex-wrap: wrap;
  gap: 4px;
  margin-bottom: 8px;
  border-bottom: 1px solid var(--line);
  padding-bottom: 7px;
}

.backup-tab {
  min-height: 26px;
  border: 1px solid var(--line);
  border-radius: 5px;
  color: var(--muted);
  padding: 4px 8px;
  font-size: 11px;
  font-weight: 800;
}

.backup-tab:hover,
.backup-tab.active {
  border-color: rgba(0, 159, 227, 0.55);
  background: #e7f6fd;
  color: var(--ink);
  text-decoration: none;
}

.backup-tab-panel {
  min-height: 0;
  flex: 1 1 auto;
}

.backup-rows-view,
.backup-gantt-view {
  display: flex;
  flex-direction: column;
}

.backup-grid-toolbar {
  display: flex;
  flex: 0 0 auto;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 7px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}

.backup-grid-scroll,
.backup-gantt-scroll {
  min-height: 0;
  flex: 1 1 auto;
  width: 100%;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface-muted);
}

.backup-rich-grid {
  width: max-content;
  min-width: 100%;
  border-collapse: collapse;
  font-size: 11.5px;
  line-height: 1.25;
}

.backup-rich-grid th,
.backup-rich-grid td {
  border-bottom: 1px solid var(--grid-line);
  padding: 5px 7px;
  text-align: left;
  vertical-align: top;
}

.backup-rich-grid th {
  position: sticky;
  top: 0;
  z-index: 3;
  min-width: 124px;
  background: var(--grid-head);
  color: var(--muted);
  font-size: 10.5px;
  font-weight: 800;
}

.backup-rich-grid th span,
.backup-rich-grid th small {
  display: block;
}

.backup-rich-grid th small {
  margin-top: 2px;
  color: #6f7884;
  font-size: 8.5px;
  font-weight: 700;
}

.backup-rich-grid td {
  min-width: 140px;
  max-width: 340px;
  overflow-wrap: anywhere;
}

.backup-rich-grid tbody tr:hover td,
.backup-rich-grid tbody tr:hover .backup-row-number {
  background: #eaf7fd;
}

.backup-rich-grid tbody tr.is-selected td,
.backup-rich-grid tbody tr.is-selected .backup-row-number {
  background: #dff2fb;
}

.backup-rich-grid tr[data-row-depth]:not([data-row-depth="0"]) td,
.backup-rich-grid tr[data-row-depth]:not([data-row-depth="0"]) .backup-row-number {
  background: #fbfdff;
}

.backup-rich-grid tr[data-row-depth]:not([data-row-depth="0"]):hover td,
.backup-rich-grid tr[data-row-depth]:not([data-row-depth="0"]):hover .backup-row-number {
  background: #eaf7fd;
}

.backup-row-number {
  position: sticky;
  left: 0;
  z-index: 2;
  width: 70px;
  min-width: 70px !important;
  max-width: 70px;
  background: var(--surface-muted);
  color: var(--muted);
  font-size: 10.5px;
  font-variant-numeric: tabular-nums;
  font-weight: 800;
  text-align: right !important;
}

.backup-row-number span {
  display: inline-block;
  min-width: 24px;
}

.backup-row-copy {
  width: 20px;
  height: 20px;
  min-height: 20px;
  margin-left: 4px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--surface-raised);
  color: var(--muted);
  font-size: 11px;
  line-height: 1;
}

.backup-row-copy:hover {
  border-color: var(--blue);
  color: var(--blue);
  background: #e7f6fd;
}

.backup-rich-grid thead .backup-row-number {
  z-index: 4;
  background: var(--grid-head);
}

.backup-cell.is-number {
  font-variant-numeric: tabular-nums;
  text-align: right;
}

.backup-cell.is-date,
.backup-cell.is-duration {
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.backup-cell.is-empty {
  color: #68717c;
}

.backup-tree-cell {
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr);
  gap: 5px;
  min-width: 0;
  padding-left: calc(var(--backup-indent, 0) * 14px);
}

.backup-row-toggle,
.backup-row-toggle-spacer {
  width: 18px;
  height: 18px;
}

.backup-row-toggle {
  min-height: 18px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--surface-raised);
  color: var(--ink);
  font-size: 11px;
  font-weight: 900;
  line-height: 1;
}

.backup-row-toggle:hover {
  border-color: var(--blue);
  background: rgba(110, 159, 255, 0.12);
}

.backup-cell-body {
  min-width: 0;
}

.backup-cell-text {
  white-space: pre-wrap;
}

.backup-cell-image-button {
  display: inline-block;
  min-height: 0;
  margin: 0 5px 5px 0;
  border: 0;
  background: transparent;
  padding: 0;
}

.backup-cell-image {
  display: block;
  width: 82px;
  height: 58px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--surface-raised);
  object-fit: cover;
}

.backup-cell-image:hover {
  border-color: var(--blue);
}

.backup-checkbox {
  display: inline-block;
  width: 17px;
  height: 17px;
  min-height: 17px;
  border: 1px solid var(--line);
  border-radius: 3px;
  background: var(--surface-muted);
}

.backup-checkbox.checked {
  border-color: var(--blue);
  background: var(--blue);
}

.backup-cell-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.backup-cell-chips span {
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface-raised);
  padding: 1px 6px;
  font-size: 10.5px;
  font-weight: 700;
}

.backup-stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(112px, 1fr));
  gap: 8px;
}

.backup-stats > div,
.backup-overview-cards article,
.backup-item-card {
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
}

.backup-stats > div {
  display: grid;
  gap: 2px;
  padding: 10px;
}

.backup-stats strong {
  font-size: 18px;
}

.backup-stats span,
.backup-item-card span,
.backup-item-card small {
  color: var(--muted);
  font-size: 11px;
}

.backup-overview-cards,
.backup-item-list {
  display: grid;
  gap: 8px;
  margin-top: 10px;
}

.backup-overview-cards {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.backup-overview-cards article,
.backup-item-card {
  padding: 10px;
}

.backup-overview-cards h2,
.backup-item-card h2 {
  margin: 0 0 5px;
  font-size: 13px;
}

.backup-overview-cards p,
.backup-item-card p {
  margin: 0;
  color: var(--muted);
}

.backup-item-card a {
  display: inline-block;
  margin-top: 8px;
  font-size: 11px;
  font-weight: 800;
}

.backup-item-card small {
  display: block;
  margin-top: 6px;
}

.backup-metadata {
  min-height: calc(100vh - 300px);
  margin: 0;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface-muted);
  padding: 10px;
  color: var(--text);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 11px;
  line-height: 1.35;
}

.backup-empty {
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
  color: var(--muted);
  padding: 16px;
}

.backup-gantt-board {
  width: max-content;
  min-width: max(100%, 960px);
}

.backup-gantt-heading,
.backup-gantt-row {
  display: grid;
  grid-template-columns: 300px minmax(660px, 1fr);
}

.backup-gantt-heading {
  position: sticky;
  top: 0;
  z-index: 2;
  background: var(--grid-head);
  color: var(--muted);
  font-size: 11px;
}

.backup-gantt-heading strong,
.backup-gantt-task,
.backup-gantt-timeline {
  min-height: 28px;
  border-bottom: 1px solid var(--grid-line);
  padding: 6px 8px;
}

.backup-gantt-task {
  padding-left: calc(8px + var(--backup-indent, 0) * 14px);
  background: var(--surface-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.backup-gantt-task span {
  display: inline-block;
  width: 30px;
  color: var(--muted);
  font-size: 10.5px;
  text-align: right;
}

.backup-gantt-timeline {
  position: relative;
  background-color: var(--surface-muted);
  background-image: linear-gradient(to right, rgba(155, 163, 175, 0.12) 1px, transparent 1px);
  background-size: 12% 100%;
}

.backup-gantt-bar {
  position: absolute;
  top: 7px;
  bottom: 7px;
  left: var(--backup-gantt-left);
  width: var(--backup-gantt-width);
  min-width: 6px;
  border: 1px solid rgba(110, 159, 255, 0.72);
  border-radius: 2px;
  background: rgba(110, 159, 255, 0.28);
}

.backup-image-modal {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: grid;
  place-items: center;
  background: var(--ink);
  padding: 28px;
}

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

.backup-image-modal img {
  box-sizing: border-box;
  max-width: min(1200px, 100%);
  max-height: calc(100vh - 56px);
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 4px;
  object-fit: contain;
}

.backup-image-close {
  position: fixed;
  top: 16px;
  right: 18px;
  width: 36px;
  height: 36px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--surface);
  color: var(--ink);
  font-size: 26px;
  line-height: 1;
}

.backup-image-download {
  position: fixed;
  top: 18px;
  right: 64px;
  min-height: 32px;
  padding: 7px 10px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--surface);
  color: var(--ink);
  font-size: 12px;
  font-weight: 800;
  text-decoration: none;
}

.backup-image-nav {
  position: fixed;
  top: 50%;
  width: 38px;
  height: 52px;
  padding: 0;
  transform: translateY(-50%);
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--surface);
  color: var(--ink);
  font-size: 24px;
  font-weight: 900;
}

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

.backup-image-prev {
  left: 18px;
}

.backup-image-next {
  right: 18px;
}

@media (max-width: 760px) {
  .backup-viewer-header,
  .backup-grid-toolbar {
    align-items: stretch;
    flex-direction: column;
  }

  .backup-stats,
  .backup-overview-cards {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 980px) {
  .app-layout,
  .app-layout.nav-collapsed {
    grid-template-columns: 1fr;
  }

  .app-shell,
  .page-heading,
  .split-layout {
    align-items: stretch;
    flex-direction: column;
  }

  .app-shell {
    position: static;
    width: auto;
    height: auto;
    min-height: 0;
    padding: 14px 20px;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .main-nav {
    flex-direction: row;
    flex-wrap: wrap;
  }

  .user-menu {
    align-items: flex-start;
    justify-content: start;
    margin-top: 0;
    border-top: 0;
  }

  .user-menu .user-details {
    justify-items: start;
  }

  .metric-grid,
  .split-layout,
  .admin-grid,
  .docs-layout,
  .scope-layout,
  .book-cover,
  .book-grid,
  .scene-book,
  .gantt-summary {
    grid-template-columns: 1fr;
  }

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

  .cost-health-panel {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .admin-entity-nav {
    position: static;
  }

  .inline-edit-row,
  .inline-edit-row.departments,
  .inline-edit-row.users,
  .inline-edit-row.project-types,
  .inline-edit-row.department-rates,
  .inline-edit-row.offices,
  .inline-edit-row.compact-entity,
  .inline-edit-row.lookup-options,
  .inline-edit-row.processor-rules,
  .inline-edit-row.estimation-rules {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .inline-edit-row.gitlab-secret-row {
    grid-template-columns: 1fr;
  }

  .gitlab-secret-edit-form {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .gitlab-secret-actions {
    justify-content: flex-start;
  }

  .access-request-row {
    grid-template-columns: 1fr;
  }

  .access-request-approval {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .project-log-form {
    grid-template-columns: 1fr;
  }

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

  .project-inquiry-actions {
    justify-content: flex-start;
  }

  .project-detail-layout {
    height: auto;
    min-height: 0;
  }

  .project-detail-layout .project-grid-frame {
    min-height: 520px;
  }

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

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

  .kanban-workspace.has-open-editor {
    grid-template-columns: 1fr;
    grid-template-rows: minmax(280px, 1fr) auto;
  }

  .kanban-editor {
    border-top: 1px solid var(--line);
    border-left: 0;
  }

  .sheet-toolbar {
    position: static;
    grid-template-columns: 1fr;
    align-items: stretch;
  }

  .sheet-actions {
    justify-content: start;
    flex-wrap: wrap;
  }

  .page-heading-actions {
    justify-content: flex-start;
  }

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

@media (max-width: 640px) {
  .page {
    width: min(100vw - 24px, 1440px);
    padding-top: 18px;
  }

  .form-grid,
  .book-item,
  .scene-card-main,
  .cost-health-panel,
  .inline-edit-row,
  .inline-edit-row.departments,
  .inline-edit-row.users,
  .inline-edit-row.project-types,
  .inline-edit-row.department-rates,
  .inline-edit-row.offices,
  .inline-edit-row.compact-entity,
  .inline-edit-row.lookup-options,
  .inline-edit-row.processor-rules,
  .inline-edit-row.estimation-rules,
  .inline-edit-row.gitlab-secret-row,
  .gitlab-secret-edit-form,
  .access-request-approval,
  .template-strip,
  .mini-list > div {
    grid-template-columns: 1fr;
  }

  .wide {
    grid-column: span 1;
  }

  .inline-form {
    flex-wrap: wrap;
  }

  .project-inquiry-heading,
  .project-inquiry-form {
    grid-template-columns: 1fr;
    align-items: stretch;
  }

  .project-inquiry-heading {
    flex-direction: column;
  }

  .task-preview,
  .book-item img,
  .scene-card-main img {
    width: 136px;
  }

  .sheet-tabs {
    overflow-x: auto;
    justify-content: start;
  }

  .sheet-summary {
    grid-template-columns: 1fr;
  }
}

@media print {
  .app-shell,
  .print-heading .button,
  .flash-stack {
    display: none;
  }

  body {
    background: #ffffff;
  }

  .app-layout {
    display: block;
  }

  .page {
    width: 100%;
    padding: 0;
  }

  .panel,
  .book-cover {
    box-shadow: none;
    break-inside: avoid;
  }
}
