/* =====================================================================
   PIHU Local Typography & Linear/Vercel Slender Readability SSOT (0 CDN)
   - Inter (300/400/500/600/700, vietnamese + latin)
   - JetBrains Mono (400/500/600, latin)
   ===================================================================== */

@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 300;
  font-display: swap;
  src: url('/fonts/inter-vietnamese-300-normal.woff2') format('woff2');
  unicode-range: U+0102-0103, U+0110-0111, U+0128-0129, U+0168-0169, U+01A0-01A1, U+01AF-01B0, U+0300-0301, U+0303-0304, U+0308-0309, U+0323, U+0329, U+1EA0-1EF9, U+20AB;
}

@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 300;
  font-display: swap;
  src: url('/fonts/inter-latin-300-normal.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+FEFF, U+FFFD;
}

@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('/fonts/inter-vietnamese-400-normal.woff2') format('woff2');
  unicode-range: U+0102-0103, U+0110-0111, U+0128-0129, U+0168-0169, U+01A0-01A1, U+01AF-01B0, U+0300-0301, U+0303-0304, U+0308-0309, U+0323, U+0329, U+1EA0-1EF9, U+20AB;
}

@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('/fonts/inter-latin-400-normal.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+FEFF, U+FFFD;
}

@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url('/fonts/inter-vietnamese-500-normal.woff2') format('woff2');
  unicode-range: U+0102-0103, U+0110-0111, U+0128-0129, U+0168-0169, U+01A0-01A1, U+01AF-01B0, U+0300-0301, U+0303-0304, U+0308-0309, U+0323, U+0329, U+1EA0-1EF9, U+20AB;
}

@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url('/fonts/inter-latin-500-normal.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+FEFF, U+FFFD;
}

@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url('/fonts/inter-vietnamese-600-normal.woff2') format('woff2');
  unicode-range: U+0102-0103, U+0110-0111, U+0128-0129, U+0168-0169, U+01A0-01A1, U+01AF-01B0, U+0300-0301, U+0303-0304, U+0308-0309, U+0323, U+0329, U+1EA0-1EF9, U+20AB;
}

@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url('/fonts/inter-latin-600-normal.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+FEFF, U+FFFD;
}

@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url('/fonts/inter-vietnamese-700-normal.woff2') format('woff2');
  unicode-range: U+0102-0103, U+0110-0111, U+0128-0129, U+0168-0169, U+01A0-01A1, U+01AF-01B0, U+0300-0301, U+0303-0304, U+0308-0309, U+0323, U+0329, U+1EA0-1EF9, U+20AB;
}

@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url('/fonts/inter-latin-700-normal.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+FEFF, U+FFFD;
}

@font-face {
  font-family: 'JetBrains Mono';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('/fonts/jetbrains-mono-latin-400-normal.woff2') format('woff2');
}

@font-face {
  font-family: 'JetBrains Mono';
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url('/fonts/jetbrains-mono-latin-500-normal.woff2') format('woff2');
}

@font-face {
  font-family: 'JetBrains Mono';
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url('/fonts/jetbrains-mono-latin-600-normal.woff2') format('woff2');
}

html,
body {
  font-family: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif !important;
  font-size: 13.5px;
  line-height: 1.5;
  font-weight: 400;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-feature-settings: "cv02", "cv03", "cv04", "cv11";
  text-rendering: optimizeLegibility;
}

.font-mono,
code,
pre,
kbd {
  font-family: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, Consolas, monospace !important;
}

/* Slender Linear/Vercel weight hierarchy (400/500 primary, 600 headings only) */
button.font-semibold,
a.font-semibold,
label.font-semibold,
span.font-semibold,
.af-btn-primary,
.af-badge-solid,
.af-badge-neutral {
  font-weight: 500 !important;
}

.font-bold {
  font-weight: 600 !important;
}

/* Lift microscopic utility classes cleanly while staying refined */
.text-\[9px\],
.text-\[9\.5px\] {
  font-size: 11px !important;
  line-height: 1.35 !important;
}

.text-\[10px\],
.text-\[10\.5px\] {
  font-size: 12px !important;
  line-height: 1.45 !important;
}

.text-\[11px\],
.text-\[11\.5px\] {
  font-size: 12.5px !important;
  line-height: 1.45 !important;
}

.text-xs {
  font-size: 12.5px !important;
  line-height: 1.45 !important;
}

.text-sm {
  font-size: 13.5px !important;
  line-height: 1.5 !important;
}

.af-input {
  font-size: 13px;
  line-height: 1.45;
  font-weight: 400;
}

.sidebar-nav-item {
  font-size: 13px !important;
  line-height: 1.45 !important;
  font-weight: 450 !important;
}

.sidebar-nav-item.active {
  font-weight: 500 !important;
}

/* Node Palette readability: crisp slender titles and wrap-friendly descriptions */
#nodes-palette-aside .palette-node-text > div {
  font-size: 12.5px !important;
  line-height: 1.4 !important;
  font-weight: 500 !important;
}

#nodes-palette-aside .palette-node-text > p {
  font-size: 11.5px !important;
  line-height: 1.4 !important;
  font-weight: 400 !important;
}

/* Prevent badge/pill text clipping while keeping pills compact */
.af-badge-solid,
.af-badge-neutral,
.agent-insp-default-pill {
  line-height: 1.35 !important;
}

.agent-insp-default-pill {
  font-size: 11px !important;
}

/* Prevent collapsed/expanded node palette width regression when Tailwind isn't rebuilt for 272px */
#nodes-palette-aside {
  width: 272px !important;
  min-width: 272px !important;
  flex-shrink: 0;
}
#nodes-palette-aside.w-\[58px\] {
  width: 58px !important;
  min-width: 58px !important;
}

/* Subtle polish on Node Inspector container */
#modal-body label {
  line-height: 1.45;
  font-weight: 500;
}

/* =====================================================================
   Global Anti-Wrap Guardrails & Explicit Responsive Dimensions
   ===================================================================== */
.af-badge-solid,
.af-badge-neutral,
.af-badge-green {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  white-space: nowrap;
  flex-shrink: 0;
}

button.af-btn-primary:not(.whitespace-normal),
button.af-btn-outline:not(.whitespace-normal) {
  white-space: nowrap;
  flex-shrink: 0;
}

.overflow-x-auto table thead th,
.af-table-wrap table thead th {
  white-space: nowrap;
}

/* Studio Canvas Minimap: crisp single-line header + clipped SVG frame */
#canvas-minimap {
  width: 216px !important;
  height: auto !important;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
#canvas-minimap > div:first-child {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  white-space: nowrap;
  font-family: 'Inter', system-ui, -apple-system, sans-serif !important;
  font-size: 11px !important;
  line-height: 1.25 !important;
}
#canvas-minimap > div:first-child span {
  white-space: nowrap;
  flex-shrink: 0;
}
#canvas-minimap-svg {
  width: 100%;
  height: 82px !important;
  flex-shrink: 0;
  display: block;
}

/* Chat Requests & Projects selects & analytics responsive grid */
#ws-cloud-secret-select {
  min-width: 175px;
}
#chatreq-role-filter {
  min-width: 170px;
}
#chatreq-assignee-filter {
  min-width: 155px;
}
#chatreq-pagesize-select {
  min-width: 105px;
}
@media (min-width: 768px) and (max-width: 1439px) {
  #chatreq-analytics-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  }
}

/* Knowledge RBAC 4-tier quota grid: 2x2 on laptop, 4-col on wide screens */
#ks-rbac-tier-quotas-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.625rem;
}
@media (min-width: 1440px) {
  #ks-rbac-tier-quotas-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}
@media (max-width: 639px) {
  #ks-rbac-tier-quotas-grid {
    grid-template-columns: minmax(0, 1fr);
  }
}
