:root {
  --forma-teal: #08766c;
  --forma-deep: #065e56;
  --forma-tint: #e3f4f0;
  --forma-ink: #202b2e;
  --forma-line: #dce5e3;
  --forma-paper: #fcfdfc;
}

#home-settings, #home-wiki { display: none; }

body[data-active-screen=projects] {
  min-height: 100dvh;
  padding-bottom: 0;
  background: var(--forma-paper);
  color: var(--forma-ink);
}

body[data-active-screen=projects] .app-header {
  height: auto;
  min-height: calc(60px + env(safe-area-inset-top, 0px));
  padding: env(safe-area-inset-top, 0px) max(20px, env(safe-area-inset-right, 0px)) 0 max(20px, env(safe-area-inset-left, 0px));
  justify-content: space-between;
  background: var(--forma-paper);
  border-bottom: 1px solid var(--forma-line);
  box-shadow: none;
}

body[data-active-screen=projects] .brand {
  gap: 8px;
  color: var(--forma-ink);
  font-size: 1.25rem;
  font-weight: 750;
  letter-spacing: -.035em;
}

body[data-active-screen=projects] .brand img { width: 32px; height: 32px; }
body[data-active-screen=projects] .app-nav,
body[data-active-screen=projects] .project-status { display: none; }

body[data-active-screen=projects] #home-settings,
body[data-active-screen=projects] #home-wiki {
  display: grid;
  place-items: center;
  width: 44px;
  min-height: 44px;
  padding: 0;
  border: 1px solid transparent;
  box-shadow: none;
  background: transparent;
  color: var(--forma-ink);
  font-size: 1.45rem;
}

#projects-screen { max-width: 760px; padding: clamp(22px, 5vw, 46px) clamp(16px, 5vw, 36px) 36px; }
#projects-screen .home-hero { display: grid; gap: 18px; margin: 0; padding: 0; border: 0; }
#projects-screen h1 { margin: 0; font-size: clamp(2rem, 5vw, 2.6rem); letter-spacing: -.045em; }

#projects-screen .primary {
  width: 100%;
  min-height: 56px;
  border-color: var(--forma-teal);
  background: var(--forma-teal);
  box-shadow: none;
  font-size: 1rem;
}

#projects-screen .primary:hover { background: var(--forma-deep); }
#projects-screen .primary span { margin-right: 5px; font-size: 1.2em; }
#projects-screen .project-tools { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin: 10px 0 22px; }
#projects-screen .project-tools button { min-width: 0; min-height: 48px; padding: 6px; border: 1px solid var(--forma-line); color: var(--forma-ink); font-size: .875rem; }
#projects-screen .project-tools button:hover,
body[data-active-screen=projects] #home-settings:hover,
body[data-active-screen=projects] #home-wiki:hover { background: var(--forma-tint); }
#project-search-row { margin-bottom: 10px; }
#project-search { width: 100%; }
:is(#project-list,#library-list) { grid-template-columns: 1fr; gap: 0; }

:is(#projects-screen,#library-screen) .project-card {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  overflow: visible;
  border: 0;
  border-bottom: 1px solid var(--forma-line);
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

:is(#projects-screen,#library-screen) .project-card:first-child { border-top: 1px solid var(--forma-line); }
:is(#projects-screen,#library-screen) .card-open { display: grid; grid-template-columns: 62px minmax(0, 1fr) auto; align-items: center; gap: 12px; padding: 11px 5px; border-radius: 8px; box-shadow: none; }
:is(#projects-screen,#library-screen) .card-open:hover { background: var(--forma-tint); }
:is(#projects-screen,#library-screen) .card-open img,
:is(#projects-screen,#library-screen) .card-placeholder { width: 62px; height: 52px; border-radius: 8px; object-fit: cover; background: var(--forma-tint); color: var(--forma-deep); font-size: 1.35rem; }
:is(#projects-screen,#library-screen) .card-open strong { margin: 0; color: var(--forma-ink); font-size: .97rem; }
:is(#projects-screen,#library-screen) .card-chevron { margin: 0 3px; color: var(--forma-deep); font-size: 1.35rem; }
#projects-screen #projects-empty, #projects-screen #search-empty { margin: 18px 0 0; font-size: .9rem; }

.project-card-menu > summary, .viewtools > summary { list-style: none; cursor: pointer; }
.project-card-menu > summary::-webkit-details-marker, .viewtools > summary::-webkit-details-marker { display: none; }
.project-card-menu > summary { display: grid; place-items: center; width: 44px; min-height: 44px; border-radius: 8px; font-size: 1.3rem; }
.project-card-menu > summary:hover { background: var(--forma-tint); }
:is(#projects-screen,#library-screen) .project-card-menu .card-actions {
  position: absolute;
  z-index: 5;
  right: 0;
  display: grid;
  min-width: 9rem;
  gap: 3px;
  margin: 0;
  padding: 5px;
  border: 1px solid var(--forma-line);
  border-radius: 10px;
  background: #fff;
  box-shadow: 0 8px 24px #1c332b20;
}

:is(#projects-screen,#library-screen) .project-card-menu:not([open]) .card-actions { display: none; }
:is(#projects-screen,#library-screen) .project-card-menu button { min-height: 44px; padding: 5px 9px; text-align: left; font-size: .875rem; }

body.selection-workspace { --workspace-context: 96px; --green: var(--forma-teal); --accent: var(--forma-teal); }
body.selection-workspace[data-selection-mode=none] { --workspace-context: 62px; }

body.selection-workspace .app-header,
body.selection-workspace #context-actions,
body.selection-workspace #mobile-toolbar { border-color: var(--forma-line); background: var(--forma-paper); color: var(--forma-ink); }
body.selection-workspace #header-export { border-color: var(--forma-teal); background: var(--forma-teal); }
body.selection-workspace #workspace-back,
body.selection-workspace #mobile-menu { border-color: var(--forma-line); background: #fff; color: var(--forma-ink); }

body.selection-workspace #context-actions { gap: 1px; padding-top: 2px; padding-bottom: 4px; justify-content: center; }
#selection-strip { display: flex; align-items: center; justify-content: space-between; min-height: 38px; gap: 8px; }
#selection-strip[hidden] { display: none; }
body.selection-workspace #selection-status { flex: 1; color: var(--forma-ink); font-size: .8rem; }
#context-body-more { flex: 0 0 44px; height: 44px; width: 44px; min-height: 44px; padding: 0; border: 0; background: transparent; box-shadow: none; font-size: 1.25rem; color: var(--forma-ink); }
#context-body-more[hidden] { display: none; }
#context-body-more:hover { background: var(--forma-tint); }

body.selection-workspace .context-group[data-context-mode=body]:not([hidden]) { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); overflow: visible; }
body.selection-workspace .context-group[data-context-mode=body] button { width: 100%; min-width: 0; min-height: 44px; padding: 4px; border-color: var(--forma-line); background: #fff; color: var(--forma-ink); font-size: .875rem; }
body.selection-workspace #context-transform-size { background: var(--forma-tint); border-color: #a0cfc8; color: var(--forma-deep); font-weight: 680; }
body.selection-workspace #add-first-part { flex: 1; min-height: 48px; border-color: var(--forma-teal); background: var(--forma-teal); color: #fff; font-size: .96rem; }
body.selection-workspace #mobile-toolbar button { color: var(--forma-ink); }
body.selection-workspace #mobile-toolbar button.active { background: var(--forma-tint); color: var(--forma-deep); border-color: #a0cfc8; }

body.selection-workspace .viewtools { display: block; left: max(12px, env(safe-area-inset-left, 0px)); right: auto; }
.viewtools > summary { display: flex; align-items: center; gap: 7px; min-height: 44px; padding: 6px 12px; border: 1px solid #d2deec; border-radius: 9px; background: #ffffffed; color: var(--forma-ink); font-size: .875rem; font-weight: 650; }
.viewtools .view-options { position: absolute; bottom: calc(100% + 5px); left: 0; display: grid; gap: 3px; min-width: 114px; padding: 4px; border: 1px solid var(--forma-line); border-radius: 9px; background: #fff; box-shadow: 0 6px 20px #1c332b24; }
.viewtools:not([open]) .view-options { display: none; }
.viewtools .view-options button { text-align: left; }
summary:focus-visible { outline: 2px solid var(--forma-teal); outline-offset: -2px; }

@media (min-width: 851px) and (min-height: 501px) {
  body.selection-workspace .context-group[data-context-mode=body]:not([hidden]) { grid-template-columns: repeat(4, minmax(105px, 160px)); }
  body.selection-workspace #add-first-part { max-width: 540px; }
}
