:root {
  --cbs-radius-sm: 12px;
  --cbs-radius-md: 16px;
  --cbs-radius-lg: 20px;
  --cbs-card-pad-phase14: clamp(14px, 1.4vw, 18px);
  --cbs-toolbar-gap-phase14: 10px;
  --cbs-shadow-phase14: 0 8px 24px rgba(42, 28, 10, 0.10);
  --cbs-border-soft-phase14: 1px solid rgba(74, 46, 18, 0.12);
}

body.phase14-polish-ready {
  text-rendering: optimizeLegibility;
}

.phase14-app-shell {
  padding-inline: var(--page-gutter, 16px);
}

[data-phase14-scroll="true"] {
  scroll-padding-bottom: max(var(--scroll-clearance, 156px), calc(env(safe-area-inset-bottom, 0px) + 112px));
}

#writer-app[data-phase14-scroll="true"] {
  scroll-padding-bottom: max(var(--writer-scroll-clearance, 210px), calc(env(safe-area-inset-bottom, 0px) + 156px));
}

.phase14-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--cbs-toolbar-gap-phase14);
}

.phase14-toolbar > * {
  min-width: 0;
}

.phase14-control,
.phase14-toolbar button,
.phase14-toolbar a[role="button"],
.phase14-toolbar select,
.phase14-toolbar input,
.phase14-toolbar textarea {
  min-height: var(--tap-target-min, 44px);
  border-radius: var(--cbs-radius-sm);
}

.phase14-toolbar button,
.phase14-toolbar a[role="button"] {
  padding-inline: 12px;
}

.phase14-card-zone > div[style*="border-radius"],
.phase14-card-zone section,
.phase14-card-zone article,
.phase14-card-zone .card,
.phase14-card-zone .panel,
.phase14-card-zone .sheet,
.phase14-card-zone .tile,
.phase14-card-zone .empty-state {
  border-radius: var(--cbs-radius-md);
}

.phase14-card-zone .empty-state,
.phase14-card-zone [data-empty-state="true"] {
  padding: clamp(18px, 2vw, 24px);
}

#bottom-nav,
#project-nav,
#mobile-format-bar,
#tag-float-bar,
#scene-nav-mobile,
#overflow-sheet {
  box-shadow: var(--cbs-shadow-phase14);
}

#bottom-nav button,
#project-nav button,
#mobile-format-bar button,
#tag-float-bar button,
#scene-nav-mobile button,
#overflow-sheet button {
  min-height: var(--tap-target-min, 44px);
}

#bottom-nav .label,
#bottom-nav .tab-label,
#project-nav .label,
#project-nav .tab-label,
.phase14-toolbar .chip,
.phase14-toolbar .pill,
.phase14-card-zone .chip,
.phase14-card-zone .pill {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#callsheet-app select,
#schedule-app select,
#stripboard-app select,
#locations-app select,
#wardrobe-app select,
#props-app select,
#artdept-app select,
#auditions-app select,
#contacts-app select {
  max-width: 100%;
}

#callsheet-app input,
#schedule-app input,
#stripboard-app input,
#locations-app input,
#wardrobe-app input,
#props-app input,
#artdept-app input,
#auditions-app input,
#contacts-app input,
#callsheet-app textarea,
#schedule-app textarea,
#stripboard-app textarea,
#locations-app textarea,
#wardrobe-app textarea,
#props-app textarea,
#artdept-app textarea,
#auditions-app textarea,
#contacts-app textarea {
  border-radius: var(--cbs-radius-sm);
}

html[data-cbs-tier="phone"] .phase14-app-shell {
  padding-inline: var(--page-gutter-mobile, 14px);
}

html[data-cbs-tier="phone"] .phase14-toolbar {
  align-items: stretch;
}

html[data-cbs-tier="phone"] .phase14-toolbar button,
html[data-cbs-tier="phone"] .phase14-toolbar a[role="button"],
html[data-cbs-tier="phone"] .phase14-toolbar select,
html[data-cbs-tier="phone"] .phase14-toolbar input {
  flex: 1 1 140px;
}

html[data-cbs-tier="phone"] #bottom-nav,
html[data-cbs-tier="phone"] #project-nav,
html[data-cbs-tier="phone"] #mobile-format-bar,
html[data-cbs-tier="phone"] #tag-float-bar,
html[data-cbs-tier="phone"] #scene-nav-mobile {
  backdrop-filter: blur(10px);
}

html[data-cbs-tier="tablet"] .phase14-app-shell {
  padding-inline: clamp(16px, 2vw, 24px);
}

html[data-cbs-tier="tablet"] .phase14-toolbar button,
html[data-cbs-tier="tablet"] .phase14-toolbar a[role="button"],
html[data-cbs-tier="tablet"] .phase14-toolbar select,
html[data-cbs-tier="tablet"] .phase14-toolbar input {
  flex: 0 1 auto;
}

#project-nav,
#project-nav.phase14-toolbar {
  display: flex !important;
  flex-wrap: nowrap !important;
  align-items: flex-end !important;
  gap: 3px !important;
}

/* Bottom nav must also stay as a single scrollable row — never let
   the phase14-toolbar flex-wrap:wrap bleed in here */
#bottom-nav-inner,
#bottom-nav-inner.phase14-toolbar {
  flex-wrap: nowrap !important;
  overflow-x: auto !important;
}

#project-nav .tab-group-tabs {
  flex-wrap: nowrap !important;
}

#project-nav .tab {
  flex: 0 0 auto;
}


body.cbs-header-compact .app-brand .brand-sub {
  display: none;
}
body.cbs-header-compact #project-nav {
  overflow-x: auto !important;
  scrollbar-width: none;
}
body.cbs-header-compact #project-nav::-webkit-scrollbar {
  display: none;
}
body.cbs-header-compact #project-nav .tab-label {
  display: none !important;
}
body.cbs-header-compact #project-nav .tab {
  padding: 8px 12px !important;
  gap: 0 !important;
  min-width: 40px !important;
  justify-content: center !important;
}
body.cbs-header-compact #project-nav .tab-icon {
  font-size: 1rem;
}
body.cbs-header-compact .tab-group {
  margin-right: 4px !important;
}
body.cbs-header-compact .tab-group[data-group="Development"]::before { content: "Dev"; }
body.cbs-header-compact .tab-group[data-group="Pre-Production"]::before { content: "Pre-Prod"; }
body.cbs-header-compact .tab-group[data-group="Scheduling"]::before { content: "Sched"; }
body.cbs-header-compact .tab-group[data-group="Production"]::before { content: "Prod"; }
body.cbs-header-compact .header-actions {
  gap: 4px !important;
}
body.cbs-header-compact .header-actions .btn {
  padding: 5px 8px !important;
  font-size: .74rem !important;
  min-height: 30px !important;
}
body.cbs-header-compact .tools-btn-label {
  display: none !important;
}
