/* ============================================================================
   OpsFlow Hub — Production Design System (Linear / Vercel Bento Minimalist)
   Background: #F8FAFC · Card Surface: #FFFFFF · Border: 1px #E2E8F0
   Primary Accent: #1E3A5F / #4F46E5 · Typography: Prompt & Inter
   ============================================================================ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&family=Prompt:wght@300;400;500;600;700;800&display=swap');

:root {
  --bg: #F8FAFC;
  --surface: #FFFFFF;
  --surface-subtle: #F1F5F9;
  --surface-hover: #F8FAFC;
  
  --text: #0F172A;
  --text-secondary: #334155;
  --muted: #64748B;
  --muted-light: #94A3B8;
  
  --border: #E2E8F0;
  --border-strong: #CBD5E1;
  --border-focus: #4F46E5;
  
  --primary: #1E3A5F;
  --primary-accent: #4F46E5;
  --primary-light: #EEF2FF;
  --primary-border: #C7D2FE;
  --on-primary: #FFFFFF;
  
  --success: #059669;
  --success-bg: #ECFDF5;
  --success-border: #A7F3D0;
  
  --warning: #D97706;
  --warning-bg: #FFFBEB;
  --warning-border: #FDE68A;
  
  --danger: #DC2626;
  --danger-bg: #FEF2F2;
  --danger-border: #FECACA;
  
  --radius-xl: 16px;
  --radius: 12px;
  --radius-sm: 8px;
  --radius-full: 9999px;
  
  --shadow-xs: 0 1px 2px 0 rgba(15, 23, 42, 0.04);
  --shadow-sm: 0 1px 3px 0 rgba(15, 23, 42, 0.06), 0 1px 2px -1px rgba(15, 23, 42, 0.04);
  --shadow-md: 0 4px 6px -1px rgba(15, 23, 42, 0.07), 0 2px 4px -2px rgba(15, 23, 42, 0.05);
  --shadow-lg: 0 10px 15px -3px rgba(15, 23, 42, 0.08), 0 4px 6px -4px rgba(15, 23, 42, 0.04);
  
  --space-1: 0.5rem;
  --space-2: 0.75rem;
  --space-3: 1rem;
  --space-4: 1.5rem;
  --space-5: 2rem;
  --space-6: 3rem;
  
  --target-size: 28px;
  color-scheme: light;
}

@media (pointer: coarse) {
  :root { --target-size: 44px; }
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

[hidden] {
  display: none !important;
}

html {
  font-size: 100%;
  scroll-behavior: smooth;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Inter', 'Prompt', system-ui, -apple-system, sans-serif;
  font-size: 0.9375rem;
  line-height: 1.6;
  overflow-wrap: anywhere;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  background-image: radial-gradient(rgba(148, 163, 184, 0.12) 1px, transparent 0);
  background-size: 24px 24px;
}

h1, h2, h3, h4 {
  font-family: 'Prompt', 'Inter', sans-serif;
  color: var(--text);
  font-weight: 700;
  letter-spacing: -0.025em;
  line-height: 1.25;
}

h1 { font-size: 1.75rem; }
h2 { font-size: 1.25rem; }
h3 { font-size: 1.125rem; }
p { margin: 0; text-wrap: pretty; color: var(--text-secondary); }

a {
  color: var(--primary-accent);
  text-decoration: none;
  font-weight: 500;
  transition: color 0.15s ease;
}
a:hover {
  color: var(--primary);
  text-decoration: underline;
}

:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.2);
}

.visually-hidden:where(:not(:focus-within, :active)) {
  position: absolute !important;
  clip-path: inset(50%) !important;
  overflow: hidden !important;
  width: 1px !important;
  height: 1px !important;
  margin: -1px !important;
  padding: 0 !important;
  border: 0 !important;
  white-space: nowrap !important;
}

/* ============================================================================
   Layout Container
   ============================================================================ */

.page {
  max-inline-size: 42rem;
  margin-inline: auto;
  padding: var(--space-4) var(--space-4) var(--space-6);
  padding-left: max(var(--space-4), env(safe-area-inset-left, 0px));
  padding-right: max(var(--space-4), env(safe-area-inset-right, 0px));
}

.page--wide {
  max-inline-size: 82rem;
}

/* ============================================================================
   Site Header (Glassmorphic Top Navigation)
   ============================================================================ */

.site-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  padding: 0.875rem 1.25rem;
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-sm);
  margin-block-end: var(--space-5);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.625rem;
  font-family: 'Prompt', 'Inter', sans-serif;
  font-size: 1rem;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.01em;
}

.brand::before {
  content: '';
  display: inline-block;
  width: 10px;
  height: 10px;
  background: var(--primary-accent);
  border-radius: var(--radius-full);
  box-shadow: 0 0 0 4px var(--primary-light);
}

.brand:hover {
  text-decoration: none;
}

.site-nav {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.site-nav a {
  display: inline-flex;
  align-items: center;
  padding: 0.4rem 0.875rem;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--muted);
  border-radius: var(--radius-sm);
  transition: all 0.15s ease;
}

.site-nav a:hover {
  color: var(--text);
  background: var(--surface-subtle);
  text-decoration: none;
}

.site-nav a[aria-current="page"] {
  color: var(--primary-accent);
  background: var(--primary-light);
  font-weight: 600;
}

.page-title {
  margin-block-end: 0.375rem;
  font-size: 1.625rem;
}

.page-lead {
  color: var(--muted);
  font-size: 0.9375rem;
  margin-block-end: var(--space-5);
  line-height: 1.5;
}

.stack > * + * {
  margin-block-start: var(--space-4);
}

/* ============================================================================
   Segmented Controls & Tabs (iOS / Linear Style)
   ============================================================================ */

.segmented {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  background: var(--surface-subtle);
  padding: 4px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
}

.segmented button[role="tab"],
.segmented .btn {
  flex: 1 1 10rem;
  min-block-size: 2.75rem;
  padding: 0.5rem 1rem;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--muted);
  background: transparent;
  border: 0;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.15s ease;
}

.segmented button[role="tab"][aria-selected="true"] {
  background: var(--surface);
  color: var(--primary-accent);
  font-weight: 600;
  box-shadow: var(--shadow-sm);
}

.segmented button[role="tab"]:hover:not([aria-selected="true"]) {
  color: var(--text);
}

/* Radio button segmented cards */
.segmented label {
  flex: 1 1 8.5rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-block-size: 2.75rem;
  padding: 0.5rem 1rem;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--muted);
  background: transparent;
  border-radius: var(--radius-sm);
  cursor: pointer;
  text-align: center;
  transition: all 0.15s ease;
  user-select: none;
}

.segmented input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.segmented label:hover {
  color: var(--text);
}

.segmented label:has(input:checked) {
  background: var(--surface);
  color: var(--primary-accent);
  font-weight: 600;
  box-shadow: var(--shadow-sm);
}

/* ============================================================================
   Form Inputs & Selects
   ============================================================================ */

.field {
  display: grid;
  gap: 0.375rem;
}

.field > label,
.field > .label,
fieldset > legend {
  font-family: 'Prompt', 'Inter', sans-serif;
  font-weight: 600;
  font-size: 0.875rem;
  color: var(--text);
}

.hint {
  color: var(--muted);
  font-size: 0.8125rem;
  line-height: 1.4;
}

.req-note {
  color: var(--muted);
  font-size: 0.8125rem;
  margin-block-end: var(--space-2);
}

input[type="text"],
input[type="number"],
input[type="search"],
input[type="date"],
input[type="time"],
select,
textarea {
  inline-size: 100%;
  min-block-size: 2.875rem;
  padding: 0.625rem 0.875rem;
  font-family: inherit;
  font-size: 0.9375rem;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  box-shadow: var(--shadow-xs);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

input[type="search"] {
  padding-left: 1rem;
}

textarea {
  min-block-size: 6rem;
  resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.15), var(--shadow-xs);
}

select:disabled,
input:disabled {
  color: var(--muted-light);
  background: var(--surface-subtle);
  border-color: var(--border);
  cursor: not-allowed;
}

fieldset {
  border: 0;
  margin: 0;
  padding: 0;
  min-inline-size: 0;
}

.error-msg {
  display: none;
  color: var(--danger);
  font-size: 0.8125rem;
  font-weight: 500;
  margin-top: 2px;
}

:is(input, select, textarea):user-invalid {
  border-color: var(--danger);
}

:is(input, select, textarea):user-invalid + .error-msg {
  display: block;
}

fieldset:has(input:user-invalid) .error-msg {
  display: block;
}

/* ============================================================================
   Buttons & Micro-interactions
   ============================================================================ */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  min-block-size: 2.875rem;
  min-inline-size: var(--target-size);
  padding: 0.625rem 1.25rem;
  font-family: 'Prompt', 'Inter', sans-serif;
  font-size: 0.9375rem;
  font-weight: 600;
  border-radius: var(--radius);
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow-xs);
  text-decoration: none;
  cursor: pointer;
  transition: all 0.15s cubic-bezier(0.16, 1, 0.3, 1);
}

.btn:hover:not([disabled]) {
  background: var(--surface-hover);
  border-color: var(--muted);
  box-shadow: var(--shadow-sm);
  transform: translateY(-1px);
}

.btn:active:not([disabled]) {
  transform: translateY(0);
}

.btn--primary {
  background: var(--primary);
  border-color: var(--primary);
  color: var(--on-primary);
  box-shadow: 0 1px 3px rgba(30, 58, 95, 0.25);
}

.btn--primary:hover:not([disabled]) {
  background: #152A45;
  border-color: #152A45;
  color: var(--on-primary);
  box-shadow: 0 4px 8px rgba(30, 58, 95, 0.3);
}

.btn--block {
  inline-size: 100%;
}

.btn--text {
  border-color: transparent;
  background: transparent;
  color: var(--primary-accent);
  padding-inline: 0.5rem;
  box-shadow: none;
  font-size: 0.875rem;
}

.btn--text:hover:not([disabled]) {
  background: var(--primary-light);
  border-color: transparent;
  color: var(--primary-accent);
  box-shadow: none;
  transform: none;
}

.btn--danger-text {
  border-color: transparent;
  background: transparent;
  color: var(--danger);
  padding-inline: 0.5rem;
  box-shadow: none;
  font-size: 0.875rem;
}

.btn--danger-text:hover:not([disabled]) {
  background: var(--danger-bg);
  border-color: transparent;
  color: var(--danger);
  box-shadow: none;
  transform: none;
}

.btn[disabled] {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none !important;
}

.actions {
  display: grid;
  gap: var(--space-2);
  margin-block-start: var(--space-5);
}

/* ============================================================================
   Panels, Cards & Summaries (Linear / Bento Aesthetic)
   ============================================================================ */

.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: var(--space-4);
  box-shadow: var(--shadow-sm);
  container-type: inline-size;
}

.summary {
  display: grid;
  gap: 0.625rem;
  background: var(--surface-subtle);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: var(--space-3);
}

.summary-row {
  display: grid;
  grid-template-columns: 9rem 1fr;
  gap: var(--space-2);
  align-items: baseline;
  padding-block: 0.25rem;
  border-block-end: 1px dashed var(--border);
}

.summary-row:last-child {
  border-block-end: 0;
}

.summary-row dt {
  color: var(--muted);
  font-size: 0.875rem;
  font-weight: 500;
}

.summary-row dd {
  margin: 0;
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--text);
}

@container (inline-size < 24rem) {
  .summary-row {
    grid-template-columns: 1fr;
    gap: 0.125rem;
  }
}

.req-id {
  font-family: 'Inter', monospace;
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--primary);
  display: inline-block;
  padding: 0.25rem 0.75rem;
  background: var(--primary-light);
  border: 1px solid var(--primary-border);
  border-radius: var(--radius-sm);
}

/* ============================================================================
   List Items & Feed (History Tab)
   ============================================================================ */

.list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: var(--space-3);
}

.list-item {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: var(--space-4);
  box-shadow: var(--shadow-sm);
  display: grid;
  gap: 0.5rem;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.list-item:hover {
  border-color: var(--border-strong);
  box-shadow: var(--shadow-md);
}

.list-item__top {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: var(--space-2);
  align-items: center;
}

.list-item__title {
  font-family: 'Prompt', 'Inter', sans-serif;
  font-weight: 600;
  font-size: 1rem;
  color: var(--text);
}

.list-item__meta {
  color: var(--muted);
  font-size: 0.8125rem;
  line-height: 1.5;
}

.list-item__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-block-start: 0.375rem;
  padding-block-start: 0.625rem;
  border-block-start: 1px solid var(--border);
}

/* Status Badges with Pulse Indicator */
.status {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  padding: 0.2rem 0.625rem;
  font-size: 0.75rem;
  font-weight: 600;
  border-radius: var(--radius-full);
  border: 1px solid var(--border);
  color: var(--muted);
  background: var(--surface-subtle);
  white-space: nowrap;
}

.status--open {
  border-color: var(--warning-border);
  background: var(--warning-bg);
  color: #B45309;
}
.status--open::before {
  content: '';
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #F59E0B;
  box-shadow: 0 0 0 2px rgba(245, 158, 11, 0.2);
}

.status--closed {
  border-color: var(--success-border);
  background: var(--success-bg);
  color: var(--success);
}
.status--closed::before {
  content: '';
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--success);
}

.status--cancelled {
  border-color: var(--danger-border);
  background: var(--danger-bg);
  color: var(--danger);
}

.text-danger { color: var(--danger); }
.text-muted { color: var(--muted); }

.empty {
  color: var(--muted);
  text-align: center;
  padding: var(--space-6) var(--space-3);
  background: var(--surface);
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius-xl);
  font-size: 0.9375rem;
}

/* ============================================================================
   Dialogs (Native Modal with Backdrop Blur)
   ============================================================================ */

dialog {
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: var(--space-5);
  max-inline-size: min(34rem, calc(100vw - 2rem));
  color: var(--text);
  background: var(--surface);
  box-shadow: var(--shadow-lg);
}

dialog::backdrop {
  background: rgba(15, 23, 42, 0.4);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}

dialog h2 {
  font-size: 1.25rem;
}

dialog .dialog-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: var(--space-2);
  margin-block-start: var(--space-4);
  padding-block-start: var(--space-3);
  border-block-start: 1px solid var(--border);
}

/* ============================================================================
   Dashboard Bento Grid & Data Table
   ============================================================================ */

/* Bento KPI Grid */
.kpis {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(13rem, 1fr));
  gap: var(--space-3);
  margin-block-end: var(--space-5);
}

.kpi {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: var(--space-4);
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 0.5rem;
  transition: all 0.2s ease;
}

.kpi:hover {
  border-color: var(--border-strong);
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.kpi__label {
  color: var(--muted);
  font-size: 0.8125rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

.kpi__value {
  font-family: 'Inter', sans-serif;
  font-size: 2.25rem;
  font-weight: 800;
  line-height: 1.1;
  color: var(--text);
  letter-spacing: -0.03em;
}

.kpi--focus {
  border-color: var(--warning-border);
  background: linear-gradient(180deg, #FFFFFF 0%, #FFFDF8 100%);
}

.kpi--focus .kpi__value {
  color: #D97706;
}

/* Toolbar Controls */
.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  align-items: end;
  margin-block-end: var(--space-4);
  background: var(--surface);
  padding: var(--space-3);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-xs);
}

.toolbar .field {
  flex: 1 1 11rem;
}

.toolbar__spacer {
  flex: 1 1 auto;
}

.dept-filter .segmented label {
  flex: 0 1 auto;
  min-block-size: 2.375rem;
  padding-inline: 0.875rem;
  font-size: 0.8125rem;
}

/* Responsive Modern Data Table */
.table-wrapper {
  overflow: auto;
  max-inline-size: 100%;
  max-block-size: min(44rem, 75vh);
  container-type: inline-size;
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

.table-wrapper table {
  inline-size: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 0.875rem;
  --label-2: "สายงานบริการ";
  --label-3: "สถานะ";
  --label-4: "เวลาที่ยื่นคำขอ";
  --label-5: "ผู้ยื่นคำขอ";
  --label-6: "ชิ้นงาน / ขอบเขตงาน";
  --label-7: "ผลการดำเนินงาน";
}

.table-wrapper caption {
  text-align: start;
  padding: 0.875rem 1.25rem;
  font-weight: 600;
  color: var(--muted);
  border-block-end: 1px solid var(--border);
  background: var(--surface-subtle);
}

.table-wrapper th,
.table-wrapper td {
  padding: 0.875rem 1.25rem;
  border-block-end: 1px solid var(--border);
  text-align: start;
  vertical-align: middle;
}

.table-wrapper thead {
  position: sticky;
  inset-block-start: 0;
  z-index: 2;
}

.table-wrapper thead th {
  background: var(--surface-subtle);
  color: var(--muted);
  font-family: 'Prompt', 'Inter', sans-serif;
  font-weight: 600;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  white-space: nowrap;
}

.table-wrapper tbody tr {
  transition: background 0.12s ease;
}

.table-wrapper tbody tr:hover {
  background: var(--surface-hover);
}

.table-wrapper tbody th {
  position: sticky;
  inset-inline-start: 0;
  background: inherit;
  font-family: 'Inter', monospace;
  font-weight: 600;
  font-size: 0.875rem;
  white-space: nowrap;
}

.table-wrapper tbody tr:last-child > * {
  border-block-end: 0;
}

@container (inline-size < 740px) {
  .table-wrapper table,
  .table-wrapper tbody,
  .table-wrapper tr,
  .table-wrapper th,
  .table-wrapper td {
    display: block;
  }
  .table-wrapper thead {
    display: none;
  }
  .table-wrapper tr {
    border-block-end: 1px solid var(--border);
    padding: var(--space-3);
  }
  .table-wrapper th,
  .table-wrapper td {
    border-block-end: 0;
    padding: 0.25rem 0;
  }
  .table-wrapper tbody th {
    position: static;
    font-size: 1rem;
    margin-block-end: 0.375rem;
  }
  .table-wrapper td:nth-child(2)::before { content: var(--label-2) ": "; color: var(--muted); font-weight: 500; }
  .table-wrapper td:nth-child(3)::before { content: var(--label-3) ": "; color: var(--muted); font-weight: 500; }
  .table-wrapper td:nth-child(4)::before { content: var(--label-4) ": "; color: var(--muted); font-weight: 500; }
  .table-wrapper td:nth-child(5)::before { content: var(--label-5) ": "; color: var(--muted); font-weight: 500; }
  .table-wrapper td:nth-child(6)::before { content: var(--label-6) ": "; color: var(--muted); font-weight: 500; }
  .table-wrapper td:nth-child(7)::before { content: var(--label-7) ": "; color: var(--muted); font-weight: 500; }
}

/* ============================================================================
   QR Code Cards & Print Layout
   ============================================================================ */

.qr-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(14rem, 1fr));
  gap: var(--space-3);
}

.qr-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: var(--space-4);
  text-align: center;
  display: grid;
  gap: var(--space-2);
  break-inside: avoid;
  box-shadow: var(--shadow-sm);
}

.qr-card svg {
  inline-size: 100%;
  max-inline-size: 12rem;
  block-size: auto;
  margin-inline: auto;
}

.qr-card__url {
  font-family: 'Inter', monospace;
  font-size: 0.75rem;
  color: var(--muted);
  word-break: break-all;
}

@media print {
  body {
    background: #FFFFFF !important;
    background-image: none !important;
  }
  .no-print {
    display: none !important;
  }
  .page {
    padding: 0;
    max-inline-size: none;
  }
  .qr-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .qr-card {
    border: 1px solid #94A3B8;
    box-shadow: none;
  }
}

/* ============================================================================
   Fabrication Team Indicator (กลุ่มงานสร้างประกอบระบุอัตโนมัติจาก QR Code)
   ============================================================================ */

.team-indicator-card {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-xs);
}

.team-indicator-card__icon {
  width: 2.25rem;
  height: 2.25rem;
  border-radius: var(--radius);
  background: var(--primary-light);
  border: 1px solid var(--primary-border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  flex-shrink: 0;
}

.team-indicator-card__body {
  flex: 1 1 auto;
  min-width: 0;
}

.team-indicator-card__label {
  display: block;
  font-size: 0.6875rem;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

.team-indicator-card__name {
  font-family: 'Prompt', 'Inter', sans-serif;
  font-size: 0.9375rem;
  font-weight: 700;
  color: var(--text);
  line-height: 1.25;
}

/* ============================================================================
   Topic Selection Hub (ปุ่มกดแยกตามหัวข้อ)
   ============================================================================ */

.topic-hub-header {
  margin-block-end: var(--space-4);
}

.topic-hub-title {
  font-family: 'Prompt', 'Inter', sans-serif;
  font-size: 1.125rem;
  font-weight: 700;
  color: var(--text);
  margin-block-end: 0.25rem;
}

.topic-hub-desc {
  font-size: 0.875rem;
  color: var(--muted);
  line-height: 1.4;
}

.topic-grid {
  display: grid;
  gap: var(--space-3);
}

.topic-card {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1.125rem 1.25rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-sm);
  text-decoration: none;
  color: inherit;
  cursor: pointer;
  width: 100%;
  text-align: left;
  font: inherit;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.topic-card:hover {
  border-color: var(--border-strong);
  background: var(--surface-hover);
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.topic-card:active {
  transform: translateY(0) scale(0.99);
}

.topic-card__icon-wrap {
  width: 3.25rem;
  height: 3.25rem;
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 1.5rem;
  transition: transform 0.2s ease;
}

.topic-card:hover .topic-card__icon-wrap {
  transform: scale(1.08);
}

.topic-card--qc .topic-card__icon-wrap {
  background: #EEF2FF;
  color: #4F46E5;
  border: 1px solid #C7D2FE;
}
.topic-card--welder .topic-card__icon-wrap {
  background: #FFF7ED;
  color: #EA580C;
  border: 1px solid #FED7AA;
}
.topic-card--stud .topic-card__icon-wrap {
  background: #F0FDF4;
  color: #16A34A;
  border: 1px solid #BBF7D0;
}
.topic-card--vt .topic-card__icon-wrap {
  background: #F5F3FF;
  color: #7C3AED;
  border: 1px solid #DDD6FE;
}
.topic-card--vehicle .topic-card__icon-wrap {
  background: #F0F9FF;
  color: #0284C7;
  border: 1px solid #BAE6FD;
}

.topic-card__body {
  flex: 1 1 auto;
  min-width: 0;
}

.topic-card__header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-block-end: 0.25rem;
}

.topic-card__title {
  font-family: 'Prompt', 'Inter', sans-serif;
  font-size: 1rem;
  font-weight: 700;
  color: var(--text);
  line-height: 1.3;
}

.topic-card__badge {
  font-size: 0.6875rem;
  font-weight: 600;
  padding: 0.15rem 0.5rem;
  border-radius: var(--radius-full);
  background: var(--surface-subtle);
  border: 1px solid var(--border);
  color: var(--muted);
  white-space: nowrap;
}

.topic-card__desc {
  font-size: 0.8125rem;
  color: var(--muted);
  line-height: 1.4;
}

.topic-card__action {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2.25rem;
  height: 2.25rem;
  border-radius: var(--radius-full);
  background: var(--surface-subtle);
  color: var(--muted);
  flex-shrink: 0;
  font-size: 1rem;
  font-weight: bold;
  transition: all 0.2s ease;
}

.topic-card:hover .topic-card__action {
  background: var(--primary-accent);
  color: #FFFFFF;
  transform: translateX(3px);
}

/* Form Top Bar with Back Button */
.topic-header-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
  padding: 0.75rem 1rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-xs);
  margin-block-end: var(--space-4);
}

.btn-back-topics {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  font-family: 'Prompt', 'Inter', sans-serif;
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--primary-accent);
  background: var(--primary-light);
  border: 1px solid var(--primary-border);
  padding: 0.45rem 0.875rem;
  border-radius: var(--radius);
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-back-topics:hover {
  background: #E0E7FF;
  border-color: #A5B4FC;
  transform: translateX(-2px);
}

.active-topic-indicator {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-family: 'Prompt', 'Inter', sans-serif;
  font-size: 0.9375rem;
  font-weight: 700;
  color: var(--text);
}

.active-topic-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.75rem;
  height: 1.75rem;
  border-radius: var(--radius-sm);
  background: var(--surface-subtle);
  font-size: 1rem;
}

