/* ═══════════════════════════════════════════════
   WORKFLOW PAGE STYLES - Based on Original HTML Templates
   Matches: 01-05_request_approval_quote_extra_close_desktop.html
   ══════════════════════════════════════════════ */

/* CSS Variables */
:root {
  --navy: #0c1f3f;
  --navy-mid: #1a3460;
  --navy-border: #253f6e;
  --teal: #0d9488;
  --teal-hi: #14b8a6;
  --teal-pale: #f0fdfa;
  --teal-bg: #e6f7f6;
  --amber: #d97706;
  --amber-pale: #fffbeb;
  --red: #dc2626;
  --red-pale: #fef2f2;
  --green: #16a34a;
  --green-pale: #f0fdf4;
  --slate-50: #f8fafc;
  --slate-100: #f1f5f9;
  --slate-200: #e2e8f0;
  --slate-300: #cbd5e1;
  --slate-400: #94a3b8;
  --slate-500: #64748b;
  --slate-600: #475569;
  --slate-700: #334155;
  --slate-800: #1e293b;
  --slate-900: #0f172a;
  --white: #ffffff;
  --font-th: 'Sarabun', sans-serif;
  --font-code: 'JetBrains Mono', monospace;
  --radius-sm: 6px;
  --radius: 10px;
  --radius-lg: 14px;
  --shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

/* Hide dashboard layout completely */
body.workflow-page .dashboard-wrapper,
body.workflow-page .top-header {
  display: none !important;
}

/* Body reset */
body.workflow-page {
  margin: 0 !important;
  padding: 0 !important;
  background: var(--slate-100) !important;
  font-family: var(--font-th);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Topnav Bar - Navy */
.workflow-topnav {
  background: var(--navy);
  height: 54px;
  display: flex;
  align-items: center;
  padding: 0 28px;
  gap: 0;
  position: sticky;
  top: 0;
  z-index: 200;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
  flex-shrink: 0;
}

/* Toggle Button for Navigation */
.nav-toggle-btn {
  position: fixed;
  left: 220px;
  top: 50%;
  transform: translateY(-50%);
  width: 24px;
  height: 48px;
  background: var(--teal);
  border: none;
  border-radius: 0 8px 8px 0;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  z-index: 300;
  transition: all 0.3s ease;
  box-shadow: 2px 0 8px rgba(0, 0, 0, 0.15);
}

.nav-toggle-btn:hover {
  background: var(--teal-hi);
  width: 28px;
}

.nav-toggle-btn.with-sidebar {
  left: 0;
  border-radius: 0 8px 8px 0;
}

.nav-toggle-btn span {
  display: block;
  width: 14px;
  height: 2px;
  background: white;
  border-radius: 2px;
  transition: all 0.3s ease;
}

.nav-toggle-btn span:nth-child(2) {
  width: 8px;
  margin: -2px 0;
}

/* Global nav expanded state */
body.workflow-page [data-navigation-target="globalNav"].expanded {
  /* Default state - sidebar visible */
}

/* Global nav collapsed state */
body.workflow-page [data-navigation-target="globalNav"].collapsed {
  /* Collapsed - page sidebar should be shown */
}

/* Page sidebar collapsed state */
body.workflow-page .workflow-sidebar.collapsed {
  margin-left: -220px;
}

/* Page sidebar expanded state */
body.workflow-page .workflow-sidebar.expanded {
  margin-left: 0;
}

/* Main content adjustments */
body.workflow-page .workflow-main.with-sidebar {
  margin-left: 220px;
}

body.workflow-page .workflow-main:not(.with-sidebar) {
  margin-left: 0;
}

/* Body reset */
body.workflow-page {
  margin: 0 !important;
  padding: 0 !important;
  background: var(--slate-100) !important;
  font-family: var(--font-th);
  min-height: 100vh;
}

/* Topnav Bar - Navy */
.workflow-topnav {
  background: var(--navy);
  height: 54px;
  display: flex;
  align-items: center;
  padding: 0 28px;
  gap: 0;
  position: sticky;
  top: 0;
  z-index: 200;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
}

.workflow-topnav .nav-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--white);
  font-weight: 700;
  font-size: 15px;
  text-decoration: none;
}

.workflow-topnav .nav-brand-mark {
  width: 28px;
  height: 28px;
  background: var(--teal);
  border-radius: 7px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  color: var(--white);
}

.workflow-topnav .brand-text {
  color: var(--white);
  text-decoration: none;
}

.workflow-topnav .nav-breadcrumb {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-left: 20px;
  font-size: 13px;
  color: rgba(255, 255, 255, 0.92);
}

.workflow-topnav .nav-breadcrumb .crumb {
  color: #ffffff;
}

.workflow-topnav .nav-breadcrumb .sep {
  color: rgba(255, 255, 255, 0.55);
}

.workflow-topnav .nav-right {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 16px;
}

.workflow-topnav .nav-page-indicator {
  font-size: 11px;
  font-family: var(--font-code);
  color: var(--slate-500);
  background: rgba(255, 255, 255, 0.06);
  padding: 3px 10px;
  border-radius: 20px;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.workflow-topnav .nav-user {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--slate-300);
  font-size: 13px;
}

.workflow-topnav .nav-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--navy-border);
  border: 2px solid var(--teal);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  color: var(--white);
}

/* Alert Banner */
.workflow-alert-banner {
  background: var(--amber-pale);
  border-bottom: 3px solid var(--amber);
  padding: 11px 28px;
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 13px;
  font-weight: 600;
  color: #92400e;
}

.workflow-alert-banner .alert-timer {
  margin-left: auto;
  font-family: var(--font-code);
  background: var(--white);
  border: 1px solid #fbbf24;
  padding: 3px 12px;
  border-radius: 20px;
  font-size: 11px;
  color: var(--amber);
}

/* Page Content Container */
body.workflow-page .workflow-container {
  display: flex !important;
  flex-direction: column !important;
  flex: 1 !important;
}

body.workflow-page .workflow-body {
  display: flex !important;
  flex: 1 !important;
}

/* WHITE Sidebar (not dark navy!) */
body.workflow-page .workflow-sidebar {
  width: 220px !important;
  background: var(--white) !important;
  border-right: 1px solid var(--slate-200) !important;
  padding: 24px 0 !important;
  overflow-y: auto !important;
  flex-shrink: 0 !important;
}

/* Sidebar text colors for WHITE background */
body.workflow-page .workflow-sidebar {
  color: var(--slate-700) !important;
}

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

body.workflow-page .workflow-sidebar .step-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 20px;
  cursor: pointer;
}

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

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

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

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

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

body.workflow-page .workflow-sidebar .step-item.active .step-label {
  color: var(--teal);
}

body.workflow-page .workflow-sidebar .step-api {
  font-size: 10px;
  font-family: var(--font-code);
  color: var(--slate-600);
  margin-top: 2px;
}

/* Short user-facing tip under each step (not API / code) */
body.workflow-page .workflow-sidebar .step-hint {
  font-size: 11px;
  font-family: var(--font-th, "Sarabun", sans-serif);
  color: var(--slate-500);
  margin-top: 4px;
  line-height: 1.35;
  font-weight: 400;
}

/* Main Content Area */
body.workflow-page .workflow-main {
  flex: 1 !important;
  overflow-y: auto !important;
  padding: 28px 32px 80px !important;
  background: var(--slate-100) !important;
}

/* Step Connector */
body.workflow-page .workflow-sidebar .step-connector {
  width: 2px;
  height: 12px;
  background: var(--slate-200);
  margin: 0 30px;
}

body.workflow-page .workflow-sidebar .step-item.done + .step-connector {
  background: var(--green);
}

/* ── Step link styles (done = clickable back-nav, locked = greyed future) ── */
body.workflow-page .workflow-sidebar .step-item.done .step-label--link {
  color: var(--teal);
  text-decoration: none;
  font-size: 13px;
  font-weight: 600;
  display: block;
}

body.workflow-page .workflow-sidebar .step-item.done .step-label--link:hover {
  text-decoration: underline;
}

body.workflow-page .workflow-sidebar .step-item.active .step-label--current {
  color: var(--slate-800);
  text-decoration: none;
  font-size: 13px;
  font-weight: 600;
  display: block;
}

body.workflow-page .workflow-sidebar .step-item.active .step-label--current:hover {
  text-decoration: underline;
  color: var(--teal);
}

body.workflow-page .workflow-sidebar .step-item.locked .step-bubble {
  background: transparent;
  border-color: var(--slate-200);
  color: var(--slate-300);
}

body.workflow-page .workflow-sidebar .step-item.locked .step-label--locked {
  color: var(--slate-400);
  font-size: 13px;
  font-weight: 600;
}

body.workflow-page .workflow-sidebar .step-item.locked .step-hint {
  color: var(--slate-300);
}

/* ── View-only mode: lock form inputs, keep links & buttons live ── */
.wo-view-only-notice {
  background: #eff6ff;
  border: 1.5px solid #bfdbfe;
  border-radius: 8px;
  padding: 10px 16px;
  font-size: 13px;
  color: #1d4ed8;
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 500;
}

/* Lock text inputs, textareas, selects — leave buttons/links untouched */
.wo-view-only input:not([type="submit"]):not([type="button"]):not([type="reset"]):not([type="file"]),
.wo-view-only textarea,
.wo-view-only select {
  pointer-events: none;
  background: var(--slate-100) !important;
  color: var(--slate-500) !important;
  cursor: not-allowed;
  border-color: var(--slate-200) !important;
  box-shadow: none !important;
}

/* Hide primary form-submission action bar; navigational links in the bar still render via link_to */
.wo-view-only .action-bar .btn-primary[type="submit"],
.wo-view-only .action-bar button[type="submit"],
.wo-view-only .qc-confirm-btn,
.wo-view-only .qc-select-form,
.wo-view-only .qc-confirm-hint {
  display: none;
}

/* ═══════════════════════════════════════════════
   COMPONENT STYLES - From Original HTML Templates
   ══════════════════════════════════════════════ */

/* Page Header */
body.workflow-page .page-header {
  margin-bottom: 24px;
}

body.workflow-page .page-header-left h1 {
  font-size: 22px;
  font-weight: 800;
  color: var(--navy-mid);
}

body.workflow-page .page-header-left .subtitle {
  font-size: 12px;
  color: var(--slate-400);
  margin-top: 5px;
  font-family: var(--font-code);
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.method-tag {
  display: inline-block;
  background: #f59e0b;
  color: var(--white);
  font-size: 10px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 4px;
  font-family: var(--font-code);
}

.kpi-tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: var(--green-pale);
  border: 1px solid #86efac;
  border-radius: 20px;
  padding: 2px 8px;
  font-size: 10px;
  font-family: var(--font-code);
  color: var(--green);
  font-weight: 600;
}

/* Annotation Box */
.ann {
  background: var(--amber-pale);
  border: 1.5px dashed #fbbf24;
  border-radius: var(--radius-sm);
  padding: 9px 13px;
  font-family: var(--font-code);
  font-size: 10.5px;
  color: #78350f;
  line-height: 1.65;
}

.ann strong {
  color: #92400e;
}

.ann .ak {
  color: #b45309;
  font-weight: 600;
}

.ann .av {
  color: #374151;
}

/* Card */
.card {
  background: var(--white);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  border: 1px solid var(--slate-200);
  margin-bottom: 18px;
  overflow: hidden;
}

.card-head {
  background: var(--navy-mid);
  color: var(--white);
  padding: 13px 20px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.card-head h2 {
  font-size: 14px;
  font-weight: 700;
}

.card-head .ch-meta {
  margin-left: auto;
  font-size: 10px;
  font-family: var(--font-code);
  color: var(--slate-400);
}

.card-body {
  padding: 20px;
}

.two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
}

.three-col {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 18px;
}

/* Info Grid */
.info-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 16px;
}

.info-cell {
  background: var(--slate-50);
  border: 1px solid var(--slate-200);
  border-radius: var(--radius-sm);
  padding: 10px 13px;
}

.info-cell .ic-lbl {
  font-size: 10px;
  color: var(--slate-600);
  font-family: var(--font-code);
}

.info-cell .ic-val {
  font-size: 15px;
  font-weight: 700;
  color: var(--navy-mid);
  margin-top: 3px;
}

.info-cell .ic-sub {
  font-size: 10.5px;
  color: var(--slate-500);
  margin-top: 2px;
}

/* Category Chips */
.cat-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: var(--teal-bg);
  border: 1px solid var(--teal);
  border-radius: 20px;
  padding: 3px 10px;
  font-size: 12px;
  color: var(--teal);
  font-weight: 600;
}

.chip .cc {
  font-family: var(--font-code);
  font-size: 9px;
  color: var(--slate-600);
}

/* Read-Only Field */
.ro-field {
  background: var(--slate-50);
  border: 1px solid var(--slate-200);
  border-radius: var(--radius-sm);
  padding: 9px 11px;
  font-size: 13.5px;
  color: var(--slate-700);
  line-height: 1.5;
}

/* Timeline */
.timeline {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.tl-row {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 9px 0;
  border-bottom: 1px solid var(--slate-100);
}

.tl-row:last-child {
  border-bottom: none;
}

.tl-dot {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  flex-shrink: 0;
}

.tl-done {
  background: var(--green-pale);
  color: var(--green);
}

.tl-now {
  background: var(--amber);
  color: var(--white);
}

.tl-pending {
  background: var(--slate-100);
  color: var(--slate-700);
}

.tl-text .tt {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--slate-700);
}

.tl-text .ts {
  font-size: 10px;
  font-family: var(--font-code);
  color: var(--slate-600);
  margin-top: 2px;
}

/* Form Elements */
.fg-item {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 12px;
}

.fld-label {
  font-size: 12px;
  font-weight: 700;
  color: var(--slate-600);
  display: flex;
  align-items: baseline;
  gap: 4px;
}

.fld-label .eng {
  font-family: var(--font-code);
  font-size: 9.5px;
  color: var(--slate-600);
  font-weight: 400;
}

body.workflow-page textarea {
  width: 100%;
  border: 1.5px solid var(--slate-200);
  border-radius: var(--radius-sm);
  padding: 8px 11px;
  font-size: 13.5px;
  font-family: var(--font-th);
  resize: vertical;
  min-height: 80px;
  outline: none;
}

body.workflow-page textarea:focus {
  border-color: var(--teal);
  box-shadow: 0 0 0 3px rgba(13, 148, 136, .12);
}

/* Decision Buttons */
.decision-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin-top: 14px;
}

.dec-btn {
  border: none;
  border-radius: var(--radius);
  padding: 16px;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  font-family: var(--font-th);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  transition: all .15s;
}

.dec-approve {
  background: var(--teal);
  color: var(--white);
}

.dec-approve:hover {
  background: var(--teal-hi);
}

.dec-reject {
  background: var(--white);
  color: var(--red);
  border: 2.5px solid var(--red);
}

.dec-reject:hover {
  background: var(--red-pale);
}

.dec-sub {
  font-size: 10px;
  font-family: var(--font-code);
  opacity: .8;
}

/* Badges */
.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 700;
}

.bdg-red {
  background: var(--red-pale);
  color: var(--red);
}

.bdg-green {
  background: var(--green-pale);
  color: var(--green);
}

.bdg-teal {
  background: var(--teal-bg);
  color: var(--teal);
}

.bdg-amber {
  background: var(--amber-pale);
  color: var(--amber);
}

/* Action Bar */
.action-bar {
  position: sticky;
  bottom: 0;
  background: var(--white);
  border-top: 1px solid var(--slate-200);
  padding: 13px 32px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  box-shadow: 0 -2px 12px rgba(0, 0, 0, .07);
  z-index: 100;
}

.action-bar-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  margin-left: auto;
}

@media (max-width: 640px) {
  .action-bar {
    flex-direction: column;
    align-items: stretch;
    padding: 12px 16px;
  }

  .action-bar-actions {
    margin-left: 0;
    width: 100%;
    flex-direction: column;
  }

  .action-bar .btn,
  .action-bar-actions .btn,
  .action-bar-actions button {
    width: 100%;
    justify-content: center;
  }
}

/* Buttons */
.btn {
  padding: 9px 22px;
  border-radius: var(--radius-sm);
  font-size: 13.5px;
  font-weight: 700;
  cursor: pointer;
  border: none;
  font-family: var(--font-th);
  transition: all .14s;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.btn-primary {
  background: var(--teal);
  color: var(--white);
}

.btn-ghost {
  background: transparent;
  color: var(--slate-400);
}

.btn-secondary {
  background: var(--white);
  color: var(--slate-600);
  border: 1.5px solid var(--slate-200);
}

.btn-secondary:hover {
  background: var(--slate-50);
}

/* ═══════════════════════════════════════════════
   FORM COMPONENTS - From 01_request_desktop.html
   ═══════════════════════════════════════════════ */

/* Form Grid */
.fg {
  display: grid;
  gap: 16px;
  margin-bottom: 16px;
}

.fg-2 {
  grid-template-columns: 1fr 1fr;
}

.fg-3 {
  grid-template-columns: 1fr 1fr 1fr;
}

.fg-4 {
  grid-template-columns: 1fr 1fr 1fr 1fr;
}

.fg-1 {
  grid-template-columns: 1fr;
}

/* Form Item */
.fg-item {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

/* Field Label */
.fld-label {
  font-size: 12px;
  font-weight: 700;
  color: var(--slate-600);
  display: flex;
  align-items: baseline;
  gap: 4px;
  flex-wrap: wrap;
}

.fld-label .req {
  color: var(--red);
}

.fld-label .eng {
  font-family: var(--font-code);
  font-size: 9.5px;
  color: var(--slate-600);
  font-weight: 400;
}

.fld-label .type {
  font-family: var(--font-code);
  font-size: 9.5px;
  color: var(--teal);
  font-weight: 400;
}

/* Form Inputs */
body.workflow-page input[type=text],
body.workflow-page input[type=number],
body.workflow-page input[type=date],
body.workflow-page select,
body.workflow-page textarea {
  width: 100%;
  border: 1.5px solid #e2e8f0;
  border-radius: var(--radius-sm);
  padding: 8px 11px;
  font-size: 13.5px;
  font-family: var(--font-th);
  color: #1e293b;
  background: #ffffff;
  transition: border-color .14s, box-shadow .14s;
  outline: none;
}

body.workflow-page input:focus,
body.workflow-page select:focus,
body.workflow-page textarea:focus {
  border-color: var(--teal);
  box-shadow: 0 0 0 3px rgba(13, 148, 136, .12);
}

body.workflow-page input.readonly-fld,
body.workflow-page input[readonly] {
  background: #f8fafc;
  color: #475569;
  cursor: default;
}

/* Field Hint */
.fld-hint {
  font-size: 10px;
  color: #94a3b8;
  font-family: var(--font-code);
}

/* Category Grid */
.cat-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 9px;
}

.cat-item {
  border: 1.5px solid var(--slate-200);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  cursor: pointer;
  transition: all .14s;
  display: flex;
  align-items: flex-start;
  gap: 8px;
}

.cat-item:hover {
  border-color: var(--teal);
  background: var(--teal-pale);
}

.cat-item.selected {
  border-color: var(--teal);
  background: var(--teal-bg);
}

.cat-item input[type=checkbox] {
  accent-color: var(--teal);
  width: 14px;
  height: 14px;
  margin-top: 3px;
  flex-shrink: 0;
  cursor: pointer;
}

.cat-name {
  font-size: 12.5px;
  font-weight: 600;
  color: #334155;
  line-height: 1.3;
}

.cat-code {
  font-family: var(--font-code);
  font-size: 9.5px;
  color: var(--slate-400);
  display: block;
  margin-top: 2px;
}

.cat-note {
  font-size: 11px;
  color: var(--slate-400);
  margin-top: 8px;
  font-style: italic;
}

/* Truck Badge */
.truck-badge {
  background: var(--teal-bg);
  border: 1.5px solid var(--teal-hi);
  border-radius: var(--radius);
  padding: 14px 18px;
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 18px;
}

.truck-icon-wrap {
  font-size: 32px;
}

.truck-info h3 {
  font-size: 17px;
  font-weight: 800;
  color: var(--navy-mid);
}

.truck-info p {
  font-size: 12px;
  color: var(--slate-500);
  margin-top: 3px;
}

.truck-badge-right {
  margin-left: auto;
  text-align: right;
}

.status-dot {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  font-weight: 700;
}

.status-dot::before {
  content: '';
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: currentColor;
}

.status-available {
  color: var(--green);
}

.status-repair {
  color: var(--red);
}

/* Section Divider */
.sec-divider {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .07em;
  color: var(--slate-400);
  border-bottom: 1px solid var(--slate-200);
  padding-bottom: 7px;
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

/* Radio Group */
.radio-group {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 10px;
}

.radio-card {
  border: 2px solid var(--slate-200);
  border-radius: var(--radius);
  padding: 13px 15px;
  cursor: pointer;
  transition: all .14s;
  display: flex;
  align-items: center;
  gap: 10px;
}

.radio-card:hover {
  border-color: var(--teal);
  background: var(--teal-pale);
}

.radio-card.selected {
  border-color: var(--teal);
  background: var(--teal-bg);
}

.radio-card input[type=radio] {
  accent-color: var(--teal);
  width: 15px;
  height: 15px;
  flex-shrink: 0;
}

.radio-label .rl-th {
  font-size: 13px;
  font-weight: 700;
  color: var(--slate-700);
}

.radio-label .rl-en {
  font-size: 10px;
  font-family: var(--font-code);
  color: var(--slate-400);
}

/* Page Wrap & Body */
.ty-page-wrap {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.ty-body {
  display: flex;
  flex: 1;
}

/* Ty-main alias */
.ty-main {
  flex: 1;
  padding: 28px 32px 80px;
  max-width: calc(100% - 220px);
  min-width: 0;
  background: var(--slate-100);
  overflow-y: auto;
}

/* Page Header */
.ty-page-header {
  margin-bottom: 24px;
  display: flex;
  align-items: flex-start;
  gap: 24px;
  justify-content: space-between;
}

.ty-page-header-left h1 {
  font-size: 22px;
  font-weight: 800;
  color: var(--navy-mid);
  line-height: 1.2;
}

/* Read-only field alias */
.ty-readonly-fld {
  background: var(--slate-50);
  color: var(--slate-600);
  cursor: default;
}

/* Alert Banner */
.alert-banner {
  background: var(--amber-pale);
  border-bottom: 3px solid var(--amber);
  padding: 11px 28px;
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 13px;
  font-weight: 600;
  color: #92400e;
}

.alert-banner .alert-timer {
  margin-left: auto;
  font-family: var(--font-code);
  background: var(--white);
  border: 1px solid #fbbf24;
  padding: 3px 12px;
  border-radius: 20px;
  font-size: 11px;
  color: var(--amber);
}

/* Workflow Container */
body.workflow-page .workflow-container {
  display: flex !important;
  flex-direction: column !important;
  flex: 1 !important;
}

body.workflow-page .workflow-body {
  display: flex !important;
  flex: 1 !important;
}

body.workflow-page .workflow-main {
  flex: 1 !important;
  overflow-y: auto !important;
  padding: 28px 32px 80px !important;
  background: var(--slate-100) !important;
}

/* Card icon */
.card-head .ch-icon {
  font-size: 16px;
}

/* ═══════════════════════════════════════════════
   QUOTE COMPARISON STYLES (Step 3)
   ═══════════════════════════════════════════════ */

.quote-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin-top: 16px;
}

.quote-card {
  border: 2px solid var(--slate-200);
  border-radius: var(--radius-lg);
  padding: 18px;
  cursor: pointer;
  transition: all 0.16s;
  position: relative;
  background: var(--white);
}

.quote-card:hover {
  border-color: var(--teal);
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(13,148,136,0.12);
}

.quote-card.selected {
  border-color: var(--teal);
  background: var(--teal-bg);
}

.quote-card.best::before {
  content: '⭐ ราคาดีที่สุด';
  position: absolute;
  top: -12px;
  left: 16px;
  background: var(--amber);
  color: var(--white);
  font-size: 10px;
  font-weight: 700;
  padding: 2px 10px;
  border-radius: 20px;
}

.q-name {
  font-size: 15px;
  font-weight: 800;
  color: var(--navy-mid);
}

.q-meta {
  font-size: 10px;
  color: var(--slate-400);
  font-family: var(--font-code);
  margin-bottom: 12px;
  margin-top: 3px;
}

.q-price {
  font-size: 26px;
  font-weight: 800;
  color: var(--teal);
  margin: 8px 0 4px;
}

.q-days {
  font-size: 12.5px;
  color: var(--slate-600);
  margin-bottom: 12px;
}

.q-items {
  border-top: 1px solid var(--slate-200);
  padding-top: 10px;
}

.q-row {
  display: flex;
  justify-content: space-between;
  font-size: 11.5px;
  padding: 4px 0;
  border-bottom: 1px solid var(--slate-100);
}

.q-row:last-child {
  border-bottom: none;
}

.q-cat {
  font-family: var(--font-code);
  font-size: 9.5px;
  color: var(--slate-400);
}

.q-select-btn {
  width: 100%;
  margin-top: 12px;
  padding: 9px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  border: 2px solid var(--teal);
  background: var(--white);
  color: var(--teal);
  font-family: var(--font-th);
  transition: all 0.14s;
}

.quote-card.selected .q-select-btn {
  background: var(--teal);
  color: var(--white);
}

.wo-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 20px;
}

.wo-cell {
  background: var(--white);
  border: 1px solid var(--slate-200);
  border-radius: var(--radius-sm);
  padding: 8px 13px;
}

.wo-cell .wl {
  font-size: 10px;
  color: var(--slate-400);
  font-family: var(--font-code);
}

.wo-cell .wv {
  font-size: 13.5px;
  font-weight: 700;
  color: var(--navy-mid);
  margin-top: 2px;
}

.threshold-banner {
  background: #fffbeb;
  border: 2px solid #fcd34d;
  border-radius: var(--radius);
  padding: 14px 18px;
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 18px;
}

.threshold-banner h3 {
  font-size: 14px;
  font-weight: 700;
  color: var(--navy-mid);
}

.threshold-banner p {
  font-size: 12.5px;
  color: var(--slate-600);
  margin-top: 3px;
}

.thr-pill {
  display: inline-block;
  background: var(--amber);
  color: var(--white);
  padding: 2px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 700;
  margin-left: 6px;
}

/* ═══════════════════════════════════════════════
   EXTRA ITEMS STYLES (Step 4)
   ═══════════════════════════════════════════════ */

.context-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 18px;
}

.ctx {
  background: var(--white);
  border: 1px solid var(--slate-200);
  border-radius: var(--radius-sm);
  padding: 7px 12px;
}

.ctx .cl {
  font-size: 10px;
  color: var(--slate-400);
  font-family: var(--font-code);
}

.ctx .cv {
  font-size: 13px;
  font-weight: 700;
  color: var(--navy-mid);
  margin-top: 2px;
}

.ctx.highlight {
  border-color: var(--teal);
  background: var(--teal-bg);
}

table {
  width: 100%;
  border-collapse: collapse;
}

thead {
  background: var(--slate-50);
}

th {
  text-align: left;
  padding: 9px 12px;
  font-size: 11px;
  font-weight: 700;
  color: var(--slate-500);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  border-bottom: 2px solid var(--slate-200);
}

td {
  padding: 9px 12px;
  font-size: 13px;
  border-bottom: 1px solid var(--slate-100);
  vertical-align: middle;
}

tr:last-child td {
  border-bottom: none;
}

.pr {
  text-align: right;
  font-weight: 700;
}

.cat-b {
  display: inline-block;
  background: var(--teal-bg);
  border: 1px solid var(--teal);
  border-radius: 4px;
  padding: 1px 6px;
  font-size: 9.5px;
  font-family: var(--font-code);
  color: var(--teal);
}

.new-b {
  display: inline-block;
  background: #fff7ed;
  border: 1px solid var(--amber);
  border-radius: 4px;
  padding: 1px 6px;
  font-size: 9.5px;
  font-weight: 700;
  color: #92400e;
}

.tr-orig {
  background: var(--slate-50);
}

.tr-sub {
  background: var(--slate-50);
  font-weight: 700;
}

.tr-extra {
  background: #fff7ed;
}

.tr-extra-sub {
  background: #fff7ed;
  font-weight: 700;
}

.tr-grand {
  background: var(--teal-bg);
  font-weight: 700;
  font-size: 14px;
}

/* ── PM request checklist (aligned with pm_01_request_desktop.html) ── */
.pm-template-picker__hint {
  font-size: 0.8125rem;
  line-height: 1.45;
  color: var(--slate-600, #475569);
  margin: 0 0 1rem;
}

.card-head.pm-head {
  background: linear-gradient(135deg, #6d28d9 0%, #7c3aed 100%);
}

.checklist-scope-divider {
  margin-bottom: 14px;
}

/* Softer than default .sec-divider (less “shouting” all-caps) */
.checklist-scope-divider.sec-divider {
  text-transform: none;
  letter-spacing: 0.02em;
  font-size: 12px;
  font-weight: 600;
  color: var(--slate-600, #475569);
}

.pm-checklist {
  display: flex;
  flex-direction: column;
  gap: 0;
  border: 1.5px solid var(--slate-200);
  border-radius: var(--radius);
  overflow: hidden;
  margin-bottom: 14px;
}

.pm-check-group {
  border-bottom: 1px solid var(--slate-100);
}

.pm-check-group:last-of-type {
  border-bottom: none;
}

.pm-group-header {
  background: var(--slate-50);
  padding: 8px 14px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--slate-500);
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-code);
  border-bottom: 1px solid var(--slate-200);
}

.pm-group-header .gh-cat {
  color: #7c3aed;
}

.pm-items {
  padding: 8px 14px 10px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

label.pm-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 8px 12px;
  border: 1.5px solid var(--slate-200);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: border-color 0.13s, background 0.13s;
  margin: 0;
}

label.pm-item:hover {
  border-color: #8b5cf6;
  background: #f5f3ff;
}

label.pm-item.checked {
  border-color: #7c3aed;
  background: #f5f3ff;
}

label.pm-item.custom-item {
  border-style: dashed;
  border-color: var(--slate-300);
}

label.pm-item .pm-include-cb {
  accent-color: #7c3aed;
  width: 14px;
  height: 14px;
  margin-top: 3px;
  flex-shrink: 0;
  cursor: pointer;
}

.pm-item-info {
  flex: 1;
  min-width: 0;
}

.pm-item-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--slate-700);
  line-height: 1.3;
}

.pm-item-detail {
  font-size: 10.5px;
  font-family: var(--font-code);
  color: var(--slate-400);
  margin-top: 1px;
}

.pm-item-right {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
  flex-shrink: 0;
}

.qty-wrap {
  display: flex;
  align-items: center;
  gap: 4px;
}

.qty-wrap .pm-qty-input {
  width: 4.5rem;
  padding: 4px 6px;
  font-size: 12px;
  text-align: center;
}

.qty-unit {
  font-size: 10px;
  color: var(--slate-500);
  font-family: var(--font-code);
}

.pm-line-est,
.est-cost {
  font-size: 11px;
  font-weight: 700;
  color: #7c3aed;
  min-width: 4.5rem;
  text-align: right;
  font-family: var(--font-code);
}

.pm-custom-remove {
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  padding: 0;
  border: 1px solid var(--slate-300);
  border-radius: var(--radius-sm);
  background: var(--white);
  color: var(--slate-600);
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
}

.pm-custom-remove:hover {
  background: #fef2f2;
  border-color: var(--red);
  color: var(--red);
}

.pm-checklist-summary {
  padding: 12px 14px;
  background: var(--slate-50);
  border-top: 1px solid var(--slate-200);
}

.pm-checklist-summary .summary-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 13px;
  padding: 4px 0;
}

.pm-checklist-summary .label {
  color: var(--slate-600);
  font-weight: 600;
}

.pm-checklist-summary .value {
  font-family: var(--font-code);
  font-weight: 700;
  color: #7c3aed;
}

.add-item-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  padding: 10px 14px;
  border: 1.5px dashed var(--slate-200);
  border-radius: var(--radius-sm);
  background: var(--slate-50);
  margin-top: 12px;
}

.add-item-row .add-item-label {
  font-size: 11px;
  font-weight: 700;
  color: var(--slate-500);
  font-family: var(--font-code);
  white-space: nowrap;
}

/* PM request — custom line: single aligned toolbar (desktop) */
.add-item-row.pm-add-custom {
  flex-direction: column;
  align-items: stretch;
  gap: 8px;
}

.pm-add-custom__heading {
  flex: 0 0 auto;
}

.pm-add-custom__fields {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px 10px;
  align-items: center;
  width: 100%;
}

.pm-add-custom__name {
  min-width: 0;
  width: 100%;
}

.pm-add-custom__category {
  width: 100%;
  min-width: 0;
}

.pm-add-custom__est {
  width: 100%;
  max-width: 100%;
}

.pm-add-custom__btn {
  justify-self: start;
}

@media (min-width: 768px) {
  .pm-add-custom__fields {
    grid-template-columns: minmax(12rem, 1fr) minmax(7rem, 10rem) minmax(6.5rem, 7.5rem) auto;
    align-items: center;
  }

  .pm-add-custom__est {
    width: 7.5rem;
    max-width: 7.5rem;
  }

  .pm-add-custom__btn {
    justify-self: stretch;
    white-space: nowrap;
  }
}

.input-with-suffix {
  position: relative;
  display: flex;
  align-items: center;
}

.input-with-suffix .input-suffix {
  position: absolute;
  right: 8px;
  font-size: 11px;
  font-family: var(--font-code);
  color: var(--slate-400);
  pointer-events: none;
}

.input-with-suffix .form-input {
  padding-right: 1.75rem;
}

/* ── PM request /new — form column layout (pm_01-style cards + grids); shell / sidebars unchanged ── */
body.ty-app.pm-request-new .ty-content-wrapper .workflow-main {
  max-width: 920px;
  margin-left: auto;
  margin-right: auto;
}

body.ty-app.pm-request-new .pm-request-form-layout {
  width: 100%;
}

/*
 * dashboard.css forces light .card-head — restore workflow-style bars for this form only.
 * Keep Taoyen colors: navy default, teal accent (cost), PM gradient (template + checklist card).
 */
body.ty-app.pm-request-new .pm-request-form .card-head:not(.pm-head):not(.card-head--teal) {
  background: var(--navy-mid) !important;
  color: var(--white) !important;
  border-bottom: none !important;
}

body.ty-app.pm-request-new .pm-request-form .card-head.card-head--teal {
  background: linear-gradient(135deg, var(--teal-600) 0%, var(--teal-500) 100%) !important;
  color: var(--white) !important;
  border-bottom: none !important;
}

body.ty-app.pm-request-new .pm-request-form .card-head.pm-head {
  background: linear-gradient(135deg, var(--pm-500) 0%, var(--pm-600) 100%) !important;
  color: var(--white) !important;
  border-bottom: none !important;
}

body.ty-app.pm-request-new .pm-request-form .card-head h2 {
  color: var(--white) !important;
  font-size: 14px;
  font-weight: 700;
  margin: 0;
  line-height: 1.3;
}

body.ty-app.pm-request-new .pm-request-form .card-head .ch-meta {
  color: rgba(255, 255, 255, 0.72) !important;
}

body.ty-app.pm-request-new .pm-request-form .card-head .ch-icon {
  color: var(--white) !important;
}

body.ty-app.pm-request-new .pm-request-form .card-head .ch-icon svg {
  display: block;
}

/* Mock-style two-column field grids */
body.ty-app.pm-request-new .pm-request-form .pm-fg {
  display: grid;
  gap: 1rem 1.125rem;
}

body.ty-app.pm-request-new .pm-request-form .pm-fg-2 {
  grid-template-columns: 1fr 1fr;
}

body.ty-app.pm-request-new .pm-request-form .pm-fg-full {
  grid-column: 1 / -1;
}

@media (max-width: 767px) {
  body.ty-app.pm-request-new .pm-request-form .pm-fg-2 {
    grid-template-columns: 1fr;
  }
}

body.ty-app.pm-request-new .pm-template-checklist-card .card-head.pm-head {
  align-items: center;
}

body.ty-app.pm-request-new .pm-template-checklist-card .card-head.pm-head h2 {
  font-size: 15px;
  font-weight: 700;
  line-height: 1.3;
}

body.ty-app.pm-request-new .pm-checklist-subdivider {
  margin-top: 1.25rem;
  padding-top: 0.25rem;
}

body.ty-app.pm-request-new .workflow-required-pill {
  font-size: 10px;
  font-weight: 700;
  font-family: var(--font-code);
  color: #7c3aed;
  background: rgba(109, 40, 217, 0.08);
  border: 1px solid rgba(109, 40, 217, 0.25);
  padding: 2px 10px;
  border-radius: 999px;
}

/* 3-column template tiles on desktop (mockup .template-grid) */
body.ty-app.pm-request-new .pm-template-picker__grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.75rem 1rem;
}

@media (max-width: 1023px) {
  body.ty-app.pm-request-new .pm-template-picker__grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 639px) {
  body.ty-app.pm-request-new .pm-template-picker__grid {
    grid-template-columns: 1fr;
  }
}

/* PM /new — title row (no Tailwind dependency) */
body.ty-app.pm-request-new .page-header {
  margin-bottom: 1.25rem;
}

body.ty-app.pm-request-new .pm-request-page-title {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin: 0;
  font-size: clamp(1.125rem, 2.2vw, 1.375rem);
  font-weight: 800;
  color: var(--navy-mid, #1a3460);
  line-height: 1.25;
}

body.ty-app.pm-request-new .pm-request-page-title__icon {
  flex-shrink: 0;
}

/* Footer actions: flow with document — do not stick over form (conflicts with ty-shell scroll) */
body.ty-app.pm-request-new .pm-request-form > .action-bar {
  position: static;
  bottom: auto;
  left: auto;
  right: auto;
  z-index: auto;
  margin-top: 2rem;
  padding: 1.25rem 0 0;
  background: transparent;
  border-top: 1px solid var(--slate-200, #e2e8f0);
  box-shadow: none;
}

body.ty-app.pm-request-new .truck-badge {
  border: 1px solid var(--slate-200, #e2e8f0);
  border-left-width: 4px;
  border-left-color: var(--navy-500, #0c1f3f);
}
