/*
 * Taoyen application shell — full-app consistency with *_desktop.html references.
 * Light slate page chrome, navy top bar, white side rails, teal accents.
 * Loaded after taoyen.css; overrides dark fms-* defaults when body.ty-app is set.
 */

:root {
  --ty-navy: #0c1f3f;
  --ty-navy-mid: #1a3460;
  --ty-navy-lite: #253f6e;
  --ty-teal: #0d9488;
  --ty-teal-hi: #14b8a6;
  --ty-teal-bg: #e6f7f6;
  --ty-slate-50: #f8fafc;
  --ty-slate-100: #f1f5f9;
  --ty-slate-200: #e2e8f0;
  --ty-slate-300: #cbd5e1;
  --ty-slate-400: #94a3b8;
  --ty-slate-500: #64748b;
  --ty-slate-600: #475569;
  --ty-slate-700: #334155;
  --ty-slate-800: #1e293b;
  --ty-white: #ffffff;
  --ty-green: #16a34a;
  --ty-font-th: "Sarabun", sans-serif;
  --ty-font-code: "JetBrains Mono", monospace;
  --ty-shadow: 0 1px 3px rgba(0, 0, 0, 0.08), 0 4px 12px rgba(0, 0, 0, 0.06);
  --ty-radius-sm: 6px;
  --ty-radius-lg: 14px;
  --ty-app-rail-w: 220px;
  --ty-app-rail-collapsed: 64px;
  --ty-page-sidebar-w: 280px;
}

/* ── Global app body (signed-in main layout) ── */
/* Viewport-bound shell: only main scrolls; global + workflow rails stay fixed beside content. */
body.ty-app {
  margin: 0 !important;
  height: 100dvh;
  max-height: 100dvh;
  min-height: 100dvh;
  overflow: hidden !important;
  display: flex;
  flex-direction: column;
  background: var(--ty-slate-100) !important;
  color: var(--ty-slate-800) !important;
  font-family: var(--ty-font-th) !important;
  font-size: 15px !important;
  line-height: 1.6 !important;
  -webkit-font-smoothing: antialiased;
}

body.ty-app h1,
body.ty-app h2,
body.ty-app h3,
body.ty-app h4,
body.ty-app h5,
body.ty-app h6 {
  font-family: var(--ty-font-th) !important;
  text-transform: none !important;
  letter-spacing: normal !important;
  color: var(--ty-navy-mid) !important;
  font-weight: 700 !important;
}

/* Dashboard welcome hero: headings above use navy — restore WCAG-friendly contrast on dark gradient */
body.ty-app .welcome-banner {
  color: #ffffff !important;
}

body.ty-app .welcome-banner h1,
body.ty-app .welcome-banner h2,
body.ty-app .welcome-banner h3,
body.ty-app .welcome-banner h4,
body.ty-app .welcome-banner h5,
body.ty-app .welcome-banner h6 {
  color: #ffffff !important;
}

body.ty-app .welcome-banner p {
  color: rgba(255, 255, 255, 0.92) !important;
}

body.ty-app .welcome-banner a {
  color: #e0f2f1 !important;
  text-decoration: underline;
  text-underline-offset: 2px;
}

body.ty-app .welcome-banner a:hover {
  color: #ffffff !important;
}

/* Gradient “clipped” figures can render invisible if background-clip isn’t applied — use solid navy */
body.ty-app .maintenance-cost-value {
  background: none !important;
  -webkit-background-clip: unset !important;
  background-clip: unset !important;
  -webkit-text-fill-color: unset !important;
  color: var(--ty-navy-mid, #1a3460) !important;
}

body.ty-app .fms-page-title {
  font-family: var(--ty-font-th) !important;
  font-size: 1.5rem !important;
  font-weight: 800 !important;
  color: var(--ty-navy-mid) !important;
  letter-spacing: normal !important;
}

body.ty-app .fms-page-header .text-secondary {
  color: var(--ty-slate-500) !important;
}

/*
 * Navy top bar — body.ty-app sets color: var(--ty-slate-800) !important globally, which makes
 * breadcrumb / brand / user labels inherit dark text and disappear on the navy background.
 * Force light foreground for all workflow-topnav content (matches welcome-banner pattern).
 */
body.ty-app .workflow-topnav {
  color: rgba(255, 255, 255, 0.95) !important;
}

body.ty-app .workflow-topnav .nav-brand {
  color: #ffffff !important;
}

body.ty-app .workflow-topnav .brand-text,
body.ty-app .workflow-topnav .brand-text:link,
body.ty-app .workflow-topnav .brand-text:visited {
  color: #ffffff !important;
}

body.ty-app .workflow-topnav .nav-breadcrumb {
  color: rgba(255, 255, 255, 0.95) !important;
}

body.ty-app .workflow-topnav .nav-breadcrumb .crumb {
  color: #ffffff !important;
}

body.ty-app .workflow-topnav .nav-breadcrumb .sep {
  color: rgba(255, 255, 255, 0.55) !important;
}

body.ty-app .workflow-topnav .nav-right {
  color: rgba(255, 255, 255, 0.95) !important;
}

body.ty-app .workflow-topnav .nav-page-indicator {
  color: rgba(255, 255, 255, 0.9) !important;
  background: rgba(255, 255, 255, 0.1) !important;
  border-color: rgba(255, 255, 255, 0.2) !important;
}

body.ty-app .workflow-topnav .nav-user {
  color: rgba(255, 255, 255, 0.95) !important;
}

body.ty-app .workflow-topnav .nav-user > span:not(.nav-user-role) {
  color: rgba(255, 255, 255, 0.95) !important;
}

body.ty-app .workflow-topnav .nav-user-role {
  color: rgba(255, 255, 255, 0.68) !important;
  font-size: 11px;
  font-family: var(--ty-font-code, "JetBrains Mono", monospace);
}

body.ty-app .workflow-topnav .nav-avatar {
  color: #ffffff !important;
}

/* Shell layout */
.ty-app-shell {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
  background: var(--ty-slate-100);
}

/* Top bar stays visible; body row fills remaining viewport height */
.ty-app-shell > .workflow-topnav,
.ty-app-shell > .ty-topnav {
  flex-shrink: 0;
}

/* Language toggle — EN | TH segment (POST switch_language?locale=) */
.ty-app-shell .workflow-topnav .nav-language-segment {
  display: inline-flex;
  align-items: stretch;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 8px;
  overflow: hidden;
}

.ty-app-shell .workflow-topnav .nav-language-form {
  display: inline-flex;
  margin: 0;
  line-height: 0;
}

.ty-app-shell .workflow-topnav .nav-language-form + .nav-language-form {
  border-left: 1px solid rgba(255, 255, 255, 0.12);
}

.ty-app-shell .workflow-topnav .nav-lang-seg {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 38px;
  height: 38px;
  padding: 0 10px;
  border: none;
  border-radius: 0;
  background: rgba(255, 255, 255, 0.06);
  color: rgba(255, 255, 255, 0.82) !important;
  cursor: pointer;
  transition: background 0.12s ease, color 0.12s ease;
  font: inherit;
  font-size: 12px !important;
  font-weight: 700 !important;
  font-family: var(--ty-font-code, "JetBrains Mono", monospace) !important;
  letter-spacing: 0.06em;
}

.ty-app-shell .workflow-topnav .nav-lang-seg:hover {
  background: rgba(13, 148, 136, 0.22);
  color: #ecfdf5 !important;
}

.ty-app-shell .workflow-topnav .nav-lang-seg--active {
  background: rgba(13, 148, 136, 0.38);
  color: #ecfdf5 !important;
}

.ty-app-shell .workflow-topnav .nav-lang-seg:focus-visible {
  outline: 2px solid var(--ty-teal, #0d9488);
  outline-offset: 2px;
}

/* Logout — right of user block in navy topnav (Devise DELETE sign out) */
.ty-app-shell .workflow-topnav .nav-logout-form {
  display: inline-flex;
  margin: 0;
  line-height: 0;
}

.ty-app-shell .workflow-topnav .nav-logout-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  padding: 0;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.06);
  color: var(--ty-slate-300, #cbd5e1);
  cursor: pointer;
  transition: background 0.12s ease, color 0.12s ease, border-color 0.12s ease;
  font: inherit;
}

.ty-app-shell .workflow-topnav .nav-logout-btn:hover {
  background: rgba(239, 68, 68, 0.18);
  border-color: rgba(248, 113, 113, 0.45);
  color: #fecaca;
}

.ty-app-shell .workflow-topnav .nav-logout-btn:focus-visible {
  outline: 2px solid var(--ty-teal, #0d9488);
  outline-offset: 2px;
}

.ty-app-shell .workflow-topnav .nav-logout-icon {
  display: block;
  flex-shrink: 0;
}

.ty-app-body {
  display: flex;
  flex: 1 1 auto;
  min-height: 0;
  min-width: 0;
  overflow: hidden;
  align-items: stretch;
}

/* Primary app rail (module navigation) — Taoyen white sidebar */
.ty-app-sidebar {
  flex: 0 0 var(--ty-app-rail-collapsed);
  width: var(--ty-app-rail-collapsed);
  min-width: var(--ty-app-rail-collapsed);
  align-self: stretch;
  min-height: 0;
  background: var(--ty-white);
  border-right: 1px solid var(--ty-slate-200);
  box-shadow: var(--ty-shadow);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transition: flex-basis 0.3s ease, width 0.3s ease, min-width 0.3s ease;
  z-index: 95;
}

.ty-app-sidebar.expanded {
  flex-basis: var(--ty-app-rail-w);
  width: var(--ty-app-rail-w);
  min-width: var(--ty-app-rail-w);
}

.ty-app-sidebar.collapsed {
  flex-basis: var(--ty-app-rail-collapsed);
  width: var(--ty-app-rail-collapsed);
  min-width: var(--ty-app-rail-collapsed);
}

.ty-app-sidebar.expanded .ty-nav-text {
  opacity: 1;
  visibility: visible;
  width: auto;
  max-width: none;
  min-width: 0;
  flex: 0 1 auto;
  overflow: visible;
}

.ty-app-sidebar.expanded .ty-logo-text {
  opacity: 1;
  visibility: visible;
  width: auto;
  margin-left: 10px;
}

.ty-app-sidebar.expanded .ty-nav-section-title {
  display: block;
}

.ty-app-sidebar.expanded .ty-user-meta {
  display: flex;
}

/* Collapsed rail: icons only — no label text, section headings, or logo wordmark */
.ty-app-sidebar.collapsed .ty-nav-text {
  opacity: 0;
  visibility: hidden;
  width: 0;
  max-width: 0;
  min-width: 0;
  margin: 0;
  padding: 0;
  overflow: hidden;
  flex: 0 0 0;
  pointer-events: none;
  white-space: nowrap;
}

.ty-app-sidebar.collapsed .ty-logo-text {
  opacity: 0;
  visibility: hidden;
  width: 0;
  max-width: 0;
  margin: 0;
  overflow: hidden;
  flex: 0 0 0;
  pointer-events: none;
}

.ty-app-sidebar.collapsed .ty-sidebar-header {
  justify-content: center;
  padding: 0 8px;
}

.ty-app-sidebar.collapsed .ty-nav-section-title {
  display: none;
}

.ty-app-sidebar.collapsed .ty-nav-item {
  justify-content: center;
  gap: 0;
  padding: 10px 8px;
}

.ty-app-sidebar.collapsed .ty-user-meta {
  display: none;
}

.ty-app-sidebar.collapsed .ty-user-row {
  justify-content: center;
}

.ty-sidebar-header {
  height: 54px;
  min-height: 54px;
  display: flex;
  align-items: center;
  padding: 0 12px;
  border-bottom: 1px solid var(--ty-slate-200);
  cursor: pointer;
  flex-shrink: 0;
  background: var(--ty-slate-50);
}

.ty-sidebar-header:hover {
  background: var(--ty-slate-100);
}

.ty-logo-mark {
  width: 32px;
  height: 32px;
  background: var(--ty-teal);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  color: var(--ty-white);
  font-weight: 700;
  flex-shrink: 0;
}

.ty-logo-text {
  margin-left: 10px;
  font-size: 13px;
  font-weight: 700;
  color: var(--ty-navy-mid);
  white-space: nowrap;
  transition: opacity 0.25s ease;
}

.ty-nav-links {
  padding: 8px 8px 12px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1;
  overflow-y: auto;
  min-height: 0;
}

.ty-nav-section-title {
  margin: 12px 8px 6px;
  font-size: 10px;
  color: var(--ty-slate-400);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-weight: 700;
}

.ty-nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--ty-radius-sm);
  color: var(--ty-slate-600);
  text-decoration: none;
  transition: background 0.12s, color 0.12s;
  white-space: nowrap;
  border: none;
  background: transparent;
  width: 100%;
  text-align: left;
  cursor: pointer;
  font-family: var(--ty-font-th);
  font-size: 13px;
}

.ty-nav-item:hover {
  background: var(--ty-slate-50);
  color: var(--ty-navy-mid);
}

.ty-nav-item.active {
  background: var(--ty-teal-bg);
  color: var(--ty-teal);
  border-right: 3px solid var(--ty-teal);
  margin-right: -1px;
}

.ty-nav-icon {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  color: currentColor;
}

.ty-nav-text {
  transition: opacity 0.25s ease, visibility 0.25s ease;
}

.ty-nav-footer {
  margin-top: auto;
  padding: 12px;
  border-top: 1px solid var(--ty-slate-200);
  background: var(--ty-slate-50);
}

.ty-user-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}

.ty-user-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--ty-navy-lite);
  border: 2px solid var(--ty-teal);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  color: var(--ty-white);
  flex-shrink: 0;
}

.ty-user-meta {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.ty-user-name {
  font-size: 12px;
  font-weight: 600;
  color: var(--ty-navy-mid);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ty-user-role {
  font-size: 10px;
  color: var(--ty-slate-500);
  text-transform: uppercase;
  font-family: var(--ty-font-code);
}

.ty-logout-btn {
  color: #dc2626 !important;
}

.ty-logout-btn:hover {
  background: #fef2f2 !important;
}

/* Workflow / PM step column */
.ty-page-sidebar {
  flex: 0 0 0;
  width: 0;
  min-width: 0;
  overflow: hidden;
  border-right: none;
  transition: flex-basis 0.3s ease, width 0.3s ease, min-width 0.3s ease;
  background: var(--ty-white);
}

.ty-page-sidebar.expanded {
  flex-basis: var(--ty-page-sidebar-w);
  width: var(--ty-page-sidebar-w);
  min-width: var(--ty-page-sidebar-w);
  align-self: stretch;
  min-height: 0;
  overflow-y: auto;
  border-right: 1px solid var(--ty-slate-200);
}

.ty-page-sidebar.collapsed {
  flex-basis: 0;
  width: 0;
  min-width: 0;
  border: none;
}

/* Main content — flex fills remainder; scroll here so side rails stay fixed */
.ty-app-body .ty-main-content,
.ty-app-body .fms-main-content {
  flex: 1 1 auto;
  min-width: 0;
  min-height: 0;
  margin-left: 0 !important;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-y: contain;
  background: var(--ty-slate-100);
}

.ty-content-wrapper {
  padding: 28px 32px 80px;
  max-width: 1400px;
  margin: 0 auto;
}

/* Step sidebar in ty-page-sidebar column — fill the rail only */
.ty-app-shell .ty-page-sidebar .workflow-sidebar {
  width: 100%;
  min-height: 100%;
  background: var(--ty-white) !important;
  color: var(--ty-slate-700) !important;
  padding: 24px 0 !important;
}

/* Embedded PM workflow: sidebar is a flex sibling of .workflow-main — fixed rail on desktop */
.ty-app-shell .workflow-body > .workflow-sidebar {
  width: 100%;
  min-width: 0;
  flex-shrink: 0;
  align-self: stretch;
  background: var(--ty-white) !important;
  color: var(--ty-slate-700) !important;
  padding: 24px 0 !important;
  border-bottom: 1px solid var(--ty-slate-200);
  overflow-y: auto;
}

@media (min-width: 1024px) {
  .ty-app-shell .workflow-body > .workflow-sidebar {
    width: 220px;
    min-width: 220px;
    border-bottom: none;
    border-right: 1px solid var(--ty-slate-200);
  }
}

.ty-app-shell .workflow-sidebar .sidebar-title {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--ty-slate-400);
  padding: 0 20px;
  margin-bottom: 14px;
}

.ty-app-shell .workflow-sidebar .step-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.ty-app-shell .workflow-sidebar .step-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 20px;
  cursor: default;
}

.ty-app-shell .workflow-sidebar .step-item.active {
  background: var(--ty-teal-bg);
  border-right: 3px solid var(--ty-teal);
}

.ty-app-shell .workflow-sidebar .step-bubble {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: 2px solid var(--ty-slate-300);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
  flex-shrink: 0;
  color: var(--ty-slate-400);
}

.ty-app-shell .workflow-sidebar .step-item.active .step-bubble {
  background: var(--ty-teal);
  border-color: var(--ty-teal);
  color: var(--ty-white);
}

.ty-app-shell .workflow-sidebar .step-item.done .step-bubble {
  background: var(--ty-green);
  border-color: var(--ty-green);
  color: var(--ty-white);
}

.ty-app-shell .workflow-sidebar .step-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--ty-slate-700);
  line-height: 1.3;
}

.ty-app-shell .workflow-sidebar .step-item.active .step-label {
  color: var(--ty-teal);
}

.ty-app-shell .workflow-sidebar .step-label-thai {
  font-size: 12px;
  color: var(--ty-slate-600);
  margin-top: 2px;
}

.ty-app-shell .workflow-sidebar .step-api {
  font-size: 10px;
  font-family: var(--ty-font-code);
  color: var(--ty-slate-400);
  margin-top: 2px;
}

.ty-app-shell .workflow-sidebar .step-hint {
  font-size: 11px;
  font-family: var(--ty-font-th);
  color: var(--ty-slate-500);
  margin-top: 4px;
  line-height: 1.35;
  font-weight: 400;
}

.ty-app-shell .workflow-sidebar .step-connector {
  width: 2px;
  height: 12px;
  background: var(--ty-slate-200);
  margin: 0 30px;
}

.ty-app-shell .workflow-sidebar .step-item.done + .step-connector {
  background: var(--ty-green);
}

/* Menu toggle — inside global sidebar rail (sticky top), not viewport-fixed */
.ty-sidebar-toggle-host {
  flex-shrink: 0;
  position: sticky;
  top: 0;
  z-index: 6;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 8px 6px;
  background: var(--ty-slate-50);
  border-bottom: 1px solid var(--ty-slate-200);
}

.ty-app-sidebar.expanded .ty-sidebar-toggle-host {
  justify-content: stretch;
  padding: 10px 10px 10px 12px;
}

.ty-app-sidebar.collapsed .ty-sidebar-toggle-host {
  padding: 8px 4px;
}

/* Navy default → teal hover (same as toolbar / index header buttons) */
.ty-nav-toggle {
  position: static;
  width: 100%;
  max-width: 100%;
  height: 44px;
  min-height: 44px;
  border-radius: var(--ty-radius-sm);
  background: linear-gradient(135deg, var(--ty-navy) 0%, #0a1830 100%);
  background-color: var(--ty-navy);
  border: 1px solid #0a1830;
  color: var(--ty-white);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 1px 2px rgba(12, 31, 63, 0.15);
  transition: transform 0.15s ease, background 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}

.ty-app-sidebar.collapsed .ty-nav-toggle {
  width: 48px;
  max-width: 48px;
  min-width: 48px;
  height: 48px;
  min-height: 48px;
  margin: 0 auto;
  border-radius: var(--ty-radius-sm);
}

.ty-nav-toggle:hover {
  background: var(--ty-teal);
  background-color: var(--ty-teal);
  border-color: var(--ty-teal);
  box-shadow: 0 2px 8px rgba(13, 148, 136, 0.25);
}

.ty-nav-toggle:active {
  transform: scale(0.98);
}

.ty-nav-toggle:focus-visible {
  outline: 2px solid var(--ty-teal);
  outline-offset: 2px;
}

/* ── Light-theme overrides for shared fms-* components ── */
body.ty-app .fms-card {
  background: var(--ty-white);
  border: 1px solid var(--ty-slate-200);
  border-radius: var(--ty-radius-lg);
  box-shadow: var(--ty-shadow);
}

body.ty-app .fms-card::before {
  display: none;
}

body.ty-app .fms-card-header {
  background: var(--ty-navy-mid);
  /* Must win over .fms-card { color: #1e293b !important } (dashboard.css) or text inherits as black on navy */
  color: var(--ty-white) !important;
  border-bottom: none;
  padding: 13px 20px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-family: var(--ty-font-th, "Sarabun", sans-serif);
}

body.ty-app .fms-card-header .fms-card-title {
  font-family: var(--ty-font-th) !important;
  letter-spacing: normal;
  text-transform: none;
  font-size: 14px;
  font-weight: 700;
  color: var(--ty-white) !important;
}

body.ty-app .fms-card-body {
  background: var(--ty-white);
  color: var(--ty-slate-800);
}

body.ty-app .fms-table thead {
  background: var(--ty-slate-50) !important;
  border-bottom: 2px solid var(--ty-teal) !important;
}

body.ty-app .fms-table thead th {
  color: var(--ty-navy-mid) !important;
  font-family: var(--ty-font-th) !important;
  text-transform: none;
  letter-spacing: normal;
  font-size: 12px;
  font-weight: 700;
}

body.ty-app .fms-table tbody td {
  color: var(--ty-slate-700) !important;
}

body.ty-app .fms-table tbody tr:hover {
  background: var(--ty-slate-50) !important;
}

body.ty-app .fms-table .col-id {
  color: var(--ty-teal) !important;
}

body.ty-app .fms-btn-primary {
  background: var(--ty-teal) !important;
  color: var(--ty-white) !important;
  box-shadow: none;
  font-family: var(--ty-font-th) !important;
  text-transform: none;
  letter-spacing: normal;
  border-radius: var(--ty-radius-sm);
}

body.ty-app .fms-btn-primary:hover:not(:disabled) {
  background: var(--ty-teal-hi) !important;
  transform: none;
}

body.ty-app .fms-btn-secondary {
  border-color: var(--ty-slate-300) !important;
  color: var(--ty-slate-700) !important;
  font-family: var(--ty-font-th) !important;
  text-transform: none;
  letter-spacing: normal;
}

body.ty-app .fms-request-card {
  background: var(--ty-white) !important;
  border: 1px solid var(--ty-slate-200) !important;
}

body.ty-app .fms-request-card:hover {
  border-color: var(--ty-teal) !important;
  background: var(--ty-slate-50) !important;
}

body.ty-app .fms-label,
body.ty-app label.fms-label {
  color: var(--ty-slate-600) !important;
  font-family: var(--ty-font-th) !important;
  text-transform: none;
  letter-spacing: normal;
}

body.ty-app .fms-value {
  color: var(--ty-slate-800) !important;
}

/* PM dashboard / FMS request lists — :root --text-secondary is gray-400 for dark UI; on white cards it fails WCAG */
body.ty-app .fms-dashboard-container .fms-info-label {
  color: var(--ty-slate-600) !important;
}

body.ty-app .fms-dashboard-container .fms-info-value {
  color: var(--ty-slate-800) !important;
}

body.ty-app .fms-dashboard-container .fms-empty-state,
body.ty-app .fms-dashboard-container .fms-empty-state p {
  color: var(--ty-slate-600) !important;
}

body.ty-app .fms-dashboard-container .fms-dashboard-header {
  border-bottom-color: var(--ty-slate-200) !important;
}

/* Request ref: inline gold on white was ~1.5:1 contrast */
body.ty-app .fms-dashboard-container .fms-request-ref {
  font-family: var(--ty-font-code, "JetBrains Mono", monospace) !important;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.05em;
  color: var(--ty-navy-mid) !important;
}

/* Optional column header accents on navy — slightly brighter than raw gold-400/blue for readability */
body.ty-app .fms-card-header.pm-dash-header--gold {
  color: #fde68a !important;
}

body.ty-app .fms-card-header.pm-dash-header--blue {
  color: #93c5fd !important;
}

/* Status pills — unstyled badges inherited invisible/light text; force readable chips */
body.ty-app .fms-request-card .status-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border-radius: var(--ty-radius-sm);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.03em;
  line-height: 1.3;
  border: 1px solid var(--ty-slate-200);
  background: var(--ty-slate-100);
  color: var(--ty-slate-800) !important;
  font-family: var(--ty-font-th) !important;
  white-space: nowrap;
}

body.ty-app .fms-request-card .status-badge.DRAFT {
  background: #f1f5f9;
  border-color: #cbd5e1;
  color: #334155 !important;
}

body.ty-app .fms-request-card .status-badge.PENDING_APPROVAL,
body.ty-app .fms-request-card .status-badge.pending_approval {
  background: #fef3c7;
  border-color: #fcd34d;
  color: #92400e !important;
}

body.ty-app .fms-request-card .status-badge.APPROVED {
  background: #d1fae5;
  border-color: #6ee7b7;
  color: #065f46 !important;
}

body.ty-app .fms-request-card .status-badge.ASSIGNED {
  background: #e0e7ff;
  border-color: #a5b4fc;
  color: #3730a3 !important;
}

body.ty-app .fms-request-card .status-badge.IN_PROGRESS,
body.ty-app .fms-request-card .status-badge.in_progress {
  background: #dbeafe;
  border-color: #93c5fd;
  color: #1e40af !important;
}

body.ty-app .fms-request-card .status-badge.CLOSED {
  background: #f1f5f9;
  border-color: #cbd5e1;
  color: #475569 !important;
}

body.ty-app .fms-request-card .status-badge.REJECTED {
  background: #fee2e2;
  border-color: #fca5a5;
  color: #991b1b !important;
}

@media (max-width: 768px) {
  .ty-content-wrapper {
    padding: 16px;
  }

  .ty-app-sidebar.expanded {
    position: fixed;
    left: 0;
    top: 54px;
    bottom: 0;
    z-index: 150;
    box-shadow: 8px 0 24px rgba(0, 0, 0, 0.12);
  }

  .ty-page-sidebar.expanded {
    display: none;
  }
}

@media print {
  .ty-topnav,
  .workflow-topnav,
  .ty-app-sidebar,
  .ty-page-sidebar,
  .ty-nav-toggle {
    display: none !important;
  }

  .ty-app-body .ty-main-content,
  .ty-app-body .fms-main-content {
    margin-left: 0 !important;
  }
}

/* ═══ PM request /new — override components.css .workflow-container row + min-height inside main ═══ */
.ty-app-shell .ty-content-wrapper > .workflow-container {
  flex-direction: column !important;
  min-height: 0 !important;
  width: 100%;
}

.ty-app-shell .ty-content-wrapper .workflow-body {
  flex-direction: column !important;
  flex: 1 1 auto;
  min-height: 0;
  min-width: 0;
  width: 100%;
}

/* Shell already pads `.ty-content-wrapper`; drop duplicate `.workflow-main` padding from components.css */
body.pm-request-new.ty-app .ty-content-wrapper .workflow-main {
  padding: 0 !important;
  background: transparent !important;
  overflow-x: hidden;
  overflow-y: visible;
}
