/*
 * PLANEX global typography baseline.
 *
 * The reference Japanese UI text resolves to this local-first font stack at
 * 16px / 24px. Keep the rule network-free so every deployed environment uses
 * an installed Japanese system font when Inter is unavailable.
 */
:root {
  --planex-font-sans: Inter, "Hiragino Kaku Gothic ProN", Meiryo, sans-serif;
  --planex-text-base: 1rem;
  --planex-leading-base: 1.5;
  --planex-shell-text: 1.25rem;
  --planex-shell-leading: 1.5;
  --planex-text-strong: #172033;
}

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  color: var(--planex-text-strong);
  font-family: var(--planex-font-sans) !important;
  font-size: var(--planex-text-base);
  line-height: var(--planex-leading-base);
  text-rendering: optimizeLegibility;
}

/* Text-bearing elements must not fall back to page-local Arial/system stacks.
   Icon fonts remain unaffected because icon-only <i> elements are excluded. */
:where(
  h1,
  h2,
  h3,
  h4,
  h5,
  h6,
  p,
  a,
  span,
  strong,
  b,
  em,
  li,
  dt,
  dd,
  label,
  small,
  caption,
  legend,
  summary,
  blockquote,
  th,
  td
) {
  font-family: var(--planex-font-sans) !important;
}

button,
input,
select,
textarea,
optgroup {
  font-family: var(--planex-font-sans) !important;
  letter-spacing: inherit;
}

/* Interactive copy, data cells, and semantic body copy use the 16px
   reference size. Headings and numeric KPI treatments remain untouched. */
:where(
  p,
  li,
  dt,
  dd,
  label,
  small,
  caption,
  legend,
  summary,
  blockquote,
  th,
  td,
  button,
  input,
  select,
  textarea
) {
  font-size: var(--planex-text-base) !important;
  line-height: var(--planex-leading-base);
}

/* Most legacy compact copy is rendered through links or spans. Raise those
   to the reference baseline while preserving explicitly named titles, KPI
   values, totals, monetary amounts, and counters. */
:where(a, span, em):not(
  [class*="title"],
  [class*="value"],
  [class*="count"],
  [class*="amount"],
  [class*="total"],
  [class*="icon"],
  [class*="title"] *,
  [class*="value"] *,
  [class*="count"] *,
  [class*="amount"] *,
  [class*="total"] *,
  [class*="icon"] *
) {
  font-size: var(--planex-text-base) !important;
  line-height: var(--planex-leading-base) !important;
}

/* Some legacy pages use higher-specificity !important rules for compact
   controls and table copy. Enforce the shared 16px content baseline while
   leaving headings, KPI values, totals, counters, and icons untouched. */
#main-content :where(
  p,
  li,
  dt,
  dd,
  label,
  small,
  caption,
  legend,
  summary,
  blockquote,
  th,
  td,
  button,
  input,
  select,
  textarea,
  optgroup
) {
  font-family: var(--planex-font-sans) !important;
  font-size: var(--planex-text-base) !important;
  line-height: var(--planex-leading-base) !important;
}

#main-content :where(a, span, em):not(
  [class*="title"],
  [class*="value"],
  [class*="count"],
  [class*="amount"],
  [class*="total"],
  [class*="icon"],
  [class*="title"] *,
  [class*="value"] *,
  [class*="count"] *,
  [class*="amount"] *,
  [class*="total"] *,
  [class*="icon"] *
) {
  font-family: var(--planex-font-sans) !important;
  font-size: var(--planex-text-base) !important;
  line-height: var(--planex-leading-base) !important;
}

/* Schedule and legacy design tables previously supplied Arial/Yu Gothic
   container stacks. These explicit overrides keep inherited text aligned
   with the same application-wide font family. */
#main-content #schedule-app,
#main-content .design-invoice-list-shell table,
#main-content .design-master-list-shell table,
#main-content .design-quote-list-shell table {
  font-family: var(--planex-font-sans) !important;
}

/* Normalize legacy compact utilities and common microcopy conventions.
   These selectors intentionally avoid title/value/icon classes. */
:where(
  .text-xs,
  .text-sm,
  [class*="breadcrumb"],
  [class*="-eyebrow"],
  [class*="-kicker"],
  [class*="-label"],
  [class*="-meta"],
  [class*="-description"],
  [class*="-caption"],
  [class*="-note"],
  [class*="-copy"],
  [class*="-badge"],
  [class*="-trend"]
) {
  font-family: var(--planex-font-sans) !important;
  font-size: var(--planex-text-base) !important;
  line-height: var(--planex-leading-base) !important;
}

/* Repeat the class conventions outside :where() so they also win against
   legacy page rules that use !important. */
[class*="-eyebrow"],
[class*="-kicker"],
[class*="-label"],
[class*="-group"],
[class*="-meta"],
[class*="-description"],
[class*="-caption"],
[class*="-note"],
[class*="-copy"],
[class*="-badge"],
[class*="-trend"] {
  font-family: var(--planex-font-sans) !important;
  font-size: var(--planex-text-base) !important;
  line-height: var(--planex-leading-base) !important;
}

.ga-hero .ga-eyebrow {
  font-size: var(--planex-text-base) !important;
  line-height: var(--planex-leading-base) !important;
}

/* The global shell is shared by every authenticated workspace. */
.header :where(a, button, span),
.breadcrumb-bar :where(a, button, span) {
  font-family: var(--planex-font-sans) !important;
  font-size: var(--planex-shell-text) !important;
  line-height: var(--planex-shell-leading) !important;
  font-weight: 700 !important;
}

.header .nav-primary > .nav-item,
.header .nav-primary > .nav-dropdown > .nav-item,
.header-right > .nav-item,
.header-right .lang-toggle,
.header-right .user-profile-btn,
.mobile-nav-toggle {
  min-height: 44px;
}

.breadcrumb-bar {
  min-height: 52px;
}

:where(label, th, summary, button, [class*="-label"]) {
  font-weight: 700;
}

.opsdash-pulse-copy strong,
.opsdash-followup-copy strong,
.cardops-primary strong,
.cardops-holder strong,
.access-identity strong,
.documents-empty strong,
.ga-workspace-meta strong,
.sales-activity-count,
nav b,
[class*="-tabs"] b,
.cell-text {
  font-size: var(--planex-text-base) !important;
  line-height: var(--planex-leading-base) !important;
}

/* Japanese copy needs a little more vertical breathing room at the same size. */
html[lang^="ja"] body {
  line-height: 1.6;
}

html[lang^="ja"] :where(p, li, dt, dd, label, small, th, td, button, input, select, textarea) {
  line-height: 1.6;
}

@media print {
  html { font-size: 12pt; }
}
