/* Theme — data-erp-theme เดียวกับ ERP/HR (erp_theme localStorage); default dark */
html[data-erp-theme="dark"] {
  /* Dark mode — hierarchy: chrome เข้มสุด → หน้าอ่อน → การ์ดสว่างสุด */
  --bg: #232040;
  --bg-warm: #2a2748;
  --surface: #2f2b52;
  --surface-hover: #38345e;
  --surface-2: #262348;
  --bg-elevated: #222e44;
  --topbar-bg: #121824;
  --topbar-bg-2: #0f1520;
  --topbar-text: #f1f5f9;
  --topbar-muted: #94a3b8;
  --topbar-border: rgba(46, 61, 90, 0.85);
  --border: rgba(255, 255, 255, 0.11);
  --border-strong: rgba(255, 255, 255, 0.18);
  --border-light: rgba(255, 255, 255, 0.07);
  --text: #f3f4f6;
  --text-secondary: #c4bfd9;
  --muted: #8b85a8;
  --danger: #f87171;
  --success: #34d399;

  --accent: #e76f51;
  --accent-hover: #f4896c;
  --accent-light: #f4896c;
  --accent-dark: #f5a089;
  --accent-soft: rgba(231, 111, 81, 0.18);
  --accent-ring: rgba(231, 111, 81, 0.28);
  --accent-glow: 0 4px 20px rgba(231, 111, 81, 0.32);
  --accent-glow-sm: 0 2px 10px rgba(231, 111, 81, 0.25);

  /* Sidebar / Topbar — โทนเดียวกับ embedded ERP */
  --sidebar-w: 260px;
  --sidebar-collapsed-w: 76px;
  --sidebar-bg: #121824;
  --sidebar-bg-2: #0f1520;
  --sidebar-bg-hover: rgba(255, 255, 255, 0.06);
  --sidebar-border: rgba(46, 61, 90, 0.85);
  --sidebar-text: #f1f5f9;
  --sidebar-muted: #94a3b8;
  --sidebar-active-bg: rgba(231, 111, 81, 0.22);
  --sidebar-active-text: #fff;

  --radius: 16px;
  --radius-sm: 10px;
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.28), 0 4px 14px rgba(0, 0, 0, 0.2);
  --shadow: 0 8px 30px rgba(0, 0, 0, 0.38);
  --shadow-lg: 0 16px 48px rgba(0, 0, 0, 0.5);
  --font: 'Segoe UI', system-ui, -apple-system, sans-serif;
  color-scheme: dark;
}

html[data-erp-theme="light"] {
  /* โทนสว่างแบบ HR/ERP (cream) — accent coral ของ Smart Office */
  --bg: #F7F4EF;
  --bg-warm: #F0EBE3;
  --surface: #FFFFFF;
  --surface-hover: #FAF8F5;
  --surface-2: #F0EBE3;
  --bg-elevated: #F0EBE3;
  --topbar-bg: #FFFFFF;
  --topbar-bg-2: #FAF8F5;
  --topbar-text: #1A1714;
  --topbar-muted: #6B645C;
  --topbar-border: #DDD4C6;
  --border: rgba(40, 30, 10, 0.12);
  --border-strong: rgba(40, 30, 10, 0.2);
  --border-light: rgba(40, 30, 10, 0.07);
  --text: #1A1714;
  --text-secondary: #4A453F;
  --muted: #6B645C;
  --danger: #C63438;
  --success: #218358;

  --accent: #e76f51;
  --accent-hover: #f4896c;
  --accent-light: #d65a3c;
  --accent-dark: #c24f34;
  --accent-soft: rgba(231, 111, 81, 0.12);
  --accent-ring: rgba(231, 111, 81, 0.22);
  --accent-glow: 0 4px 20px rgba(231, 111, 81, 0.2);
  --accent-glow-sm: 0 2px 10px rgba(231, 111, 81, 0.16);

  --sidebar-w: 260px;
  --sidebar-collapsed-w: 76px;
  --sidebar-bg: #FFFFFF;
  --sidebar-bg-2: #FAF8F5;
  --sidebar-bg-hover: rgba(40, 30, 10, 0.06);
  --sidebar-border: #DDD4C6;
  --sidebar-text: #1A1714;
  --sidebar-muted: #6B645C;
  --sidebar-active-bg: rgba(231, 111, 81, 0.14);
  --sidebar-active-text: #1A1714;

  --radius: 16px;
  --radius-sm: 10px;
  --shadow-sm: 0 1px 3px rgba(40, 30, 10, 0.06), 0 4px 14px rgba(40, 30, 10, 0.05);
  --shadow: 0 8px 30px rgba(40, 30, 10, 0.1);
  --shadow-lg: 0 16px 48px rgba(40, 30, 10, 0.12);
  --font: 'Segoe UI', system-ui, -apple-system, sans-serif;
  color-scheme: light;
}

html[data-erp-theme="light"] body {
  background:
    radial-gradient(ellipse 80% 50% at 70% -10%, rgba(231, 111, 81, 0.08), transparent 55%),
    radial-gradient(ellipse 60% 40% at 10% 100%, rgba(168, 132, 26, 0.06), transparent 50%),
    var(--bg);
}

html[data-erp-theme="light"] .login-wrap {
  background:
    radial-gradient(ellipse 70% 55% at 18% 12%, rgba(231, 111, 81, 0.12), transparent),
    radial-gradient(ellipse 50% 45% at 88% 88%, rgba(168, 132, 26, 0.08), transparent),
    var(--bg);
}

html[data-erp-theme="light"] .login-card,
html[data-erp-theme="light"] .card,
html[data-erp-theme="light"] .topbar {
  box-shadow: var(--shadow);
}

html[data-erp-theme="light"] .sidebar {
  background:
    linear-gradient(180deg, var(--sidebar-bg) 0%, var(--sidebar-bg-2) 100%),
    radial-gradient(ellipse 120% 40% at 50% 100%, rgba(231, 111, 81, 0.05), transparent 60%);
  border-right-color: var(--sidebar-border);
  box-shadow: 4px 0 18px rgba(40, 30, 10, 0.06);
}
html[data-erp-theme="light"] .sidebar-brand-main {
  color: var(--sidebar-text);
}
html[data-erp-theme="light"] .sidebar-brand-sub {
  text-shadow: none;
}
html[data-erp-theme="light"] .sidebar-user-card {
  background: rgba(40, 30, 10, 0.04);
}
html[data-erp-theme="light"] .sidebar-user-name {
  color: var(--sidebar-text);
}

html[data-erp-theme="light"] .topbar {
  box-shadow: 0 1px 8px rgba(40, 30, 10, 0.06);
}

html[data-erp-theme="light"] .topbar .btn-ghost {
  background: rgba(40, 30, 10, 0.04);
  color: var(--topbar-text);
}
html[data-erp-theme="light"] .topbar .btn-ghost:hover {
  background: var(--accent-soft);
  border-color: rgba(231, 111, 81, 0.4);
  color: var(--accent-dark);
}

html[data-erp-theme="light"] .topbar-search,
html[data-erp-theme="light"] .topbar-icon-btn,
html[data-erp-theme="light"] .topbar-search kbd {
  background: rgba(40, 30, 10, 0.04);
}

html[data-erp-theme="light"] .topbar-icon-btn:hover {
  background: var(--accent-soft);
}

html[data-erp-theme="light"] .card-title {
  color: var(--text);
  border-left-color: #8b85a8;
  background: linear-gradient(
    105deg,
    rgba(168, 163, 196, 0.18) 0%,
    rgba(240, 235, 227, 0.9) 42%,
    rgba(255, 255, 255, 0.98) 100%
  );
  box-shadow: none;
}
html[data-erp-theme="light"] .card-title::after {
  background: linear-gradient(90deg, transparent 0%, rgba(40, 30, 10, 0.03) 100%);
}
html[data-erp-theme="light"] .card.tone-orange > .card-title {
  color: #c24f34;
  background: linear-gradient(105deg, rgba(231, 111, 81, 0.16) 0%, rgba(231, 111, 81, 0.05) 45%, #fff 100%);
}
html[data-erp-theme="light"] .card.tone-green > .card-title {
  color: #0f766e;
  background: linear-gradient(105deg, rgba(16, 185, 129, 0.14) 0%, rgba(16, 185, 129, 0.04) 45%, #fff 100%);
}
html[data-erp-theme="light"] .card.tone-blue > .card-title {
  color: #1d4ed8;
  background: linear-gradient(105deg, rgba(59, 130, 246, 0.14) 0%, rgba(59, 130, 246, 0.04) 45%, #fff 100%);
}
html[data-erp-theme="light"] .card.tone-purple > .card-title {
  color: #6d28d9;
  background: linear-gradient(105deg, rgba(139, 92, 246, 0.14) 0%, rgba(139, 92, 246, 0.04) 45%, #fff 100%);
}
html[data-erp-theme="light"] .card.tone-red > .card-title {
  color: #b91c1c;
  background: linear-gradient(105deg, rgba(239, 68, 68, 0.12) 0%, rgba(239, 68, 68, 0.04) 45%, #fff 100%);
}

html[data-erp-theme="light"] .data-table th {
  background: var(--surface-2);
  color: var(--muted);
}

html[data-erp-theme="light"] .ui-lang-btn:hover,
html[data-erp-theme="light"] .ui-theme-btn:hover {
  color: var(--topbar-text);
}
html[data-erp-theme="light"] .ui-theme-btn.active,
html[data-erp-theme="light"] .ui-theme-btn[aria-pressed="true"],
html[data-erp-theme="light"] .ui-lang-btn.active,
html[data-erp-theme="light"] .ui-lang-btn[aria-pressed="true"] {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

html[data-erp-theme="light"] .login-card .ui-lang-switch,
html[data-erp-theme="light"] .login-card .ui-theme-switch {
  border-color: var(--border);
  background: var(--bg-elevated);
}
html[data-erp-theme="light"] .login-card .ui-lang-btn,
html[data-erp-theme="light"] .login-card .ui-theme-btn {
  color: var(--muted);
}
html[data-erp-theme="light"] .login-card .ui-lang-btn:hover,
html[data-erp-theme="light"] .login-card .ui-theme-btn:hover {
  color: var(--text);
}

html[data-erp-theme="light"] .kpi-stat-item.tone-green .kpi-stat-val { color: #047857; }
html[data-erp-theme="light"] .kpi-stat-item.tone-orange .kpi-stat-val { color: #c24f34; }
html[data-erp-theme="light"] .kpi-stat-item.tone-red .kpi-stat-val { color: #b91c1c; }
html[data-erp-theme="light"] .kpi-stat-item.tone-blue .kpi-stat-val { color: #1d4ed8; }
html[data-erp-theme="light"] .kpi-stat-item.tone-purple .kpi-stat-val { color: #6d28d9; }
html[data-erp-theme="light"] .kpi-stat-item.tone-yellow .kpi-stat-val { color: #a16207; }

html[data-erp-theme="light"] .qdm-act-bar .btn-primary-soft {
  color: var(--accent-dark);
}

html[data-erp-theme="light"] .inbox-item.tone-purple .inbox-item-icon { color: #6d28d9; }
html[data-erp-theme="light"] .inbox-item.tone-blue .inbox-item-icon { color: #1d4ed8; }

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: var(--font);
  font-size: 14px;
  background:
    radial-gradient(ellipse 80% 50% at 70% -10%, rgba(231, 111, 81, 0.07), transparent 55%),
    radial-gradient(ellipse 60% 40% at 10% 100%, rgba(139, 92, 246, 0.07), transparent 50%),
    var(--bg);
  color: var(--text);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

.hidden { display: none !important; }

a { color: var(--accent-dark); font-weight: 500; }
a:hover { color: var(--accent); }

/* ── Login ── */
.login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background:
    radial-gradient(ellipse 70% 55% at 18% 12%, rgba(231, 111, 81, 0.16), transparent),
    radial-gradient(ellipse 50% 45% at 88% 88%, rgba(139, 92, 246, 0.12), transparent),
    var(--bg);
}
.login-card {
  background: var(--surface);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-lg);
  padding: 36px 32px;
  width: 100%;
  max-width: 420px;
}
.login-card h1 {
  margin: 0 0 4px;
  font-size: 1.35rem;
  font-weight: 800;
  letter-spacing: -0.01em;
  color: var(--text);
  text-align: center;
  line-height: 1.3;
}
.login-card h1 .brand-sub {
  display: block;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--accent);
  letter-spacing: 0.02em;
  margin-top: 2px;
}
.login-logo-wrap {
  text-align: center;
  margin-bottom: 16px;
}
.login-logo {
  width: 72px;
  height: 72px;
  object-fit: contain;
  filter: drop-shadow(0 4px 14px rgba(231, 111, 81, 0.2));
}
.login-card > p,
.login-embedded-note {
  margin: 0 0 20px;
  color: var(--text-secondary);
  font-size: 13px;
  line-height: 1.55;
}
.field { margin-bottom: 16px; }
.field label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 6px;
}
.field input {
  width: 100%;
  padding: 11px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-family: inherit;
  background: var(--bg-warm);
  color: var(--text);
  transition: border-color 0.15s, box-shadow 0.15s, background 0.15s;
}
.field input:focus {
  outline: none;
  border-color: var(--accent);
  background: var(--surface-hover);
  box-shadow: 0 0 0 3px var(--accent-ring);
}

/* ── Buttons — brick orange ── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 18px;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  background: var(--accent);
  color: #fff;
  box-shadow: var(--accent-glow-sm);
  transition: transform 0.12s, box-shadow 0.15s, background 0.15s;
}
.btn:hover {
  background: var(--accent-hover);
  box-shadow: var(--accent-glow);
  transform: translateY(-1px);
}
.btn:active { transform: translateY(0); }
.btn:disabled { opacity: 0.55; cursor: not-allowed; transform: none; box-shadow: none; }
.btn-ghost {
  background: var(--surface);
  color: var(--text-secondary);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
}
.btn-ghost:hover {
  background: var(--accent-soft);
  border-color: rgba(231, 111, 81, 0.35);
  color: var(--accent-dark);
  box-shadow: var(--shadow-sm);
}
.btn-danger {
  background: var(--danger);
  color: #fff;
  box-shadow: 0 2px 10px rgba(220, 76, 76, 0.25);
}
.btn-sm { padding: 7px 14px; font-size: 13px; }
.msg { margin-top: 14px; font-size: 13px; }
.msg.err { color: var(--danger); }
.msg.ok { color: var(--success); }

/* ── App shell — fixed sidebar (embedded style) ── */
.app-shell {
  min-height: 100vh;
  --sidebar-current-w: var(--sidebar-w);
}
.app-shell.sidebar-collapsed {
  --sidebar-current-w: var(--sidebar-collapsed-w);
}

.sidebar {
  position: fixed;
  left: 0;
  top: 0;
  z-index: 200;
  width: var(--sidebar-w);
  height: 100vh;
  background:
    linear-gradient(180deg, var(--sidebar-bg) 0%, var(--sidebar-bg-2) 70%, #0b0e14 100%),
    radial-gradient(ellipse 120% 40% at 50% 100%, rgba(231, 111, 81, 0.06), transparent 60%);
  border-right: 1px solid var(--sidebar-border);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  box-shadow: 4px 0 24px rgba(0, 0, 0, 0.28);
  transition: width 0.25s ease;
  overflow: hidden;
}
.sidebar.collapsed { width: var(--sidebar-collapsed-w); }
.sidebar-brand {
  padding: 22px 14px 22px 16px;
  border-bottom: 1px solid var(--sidebar-border);
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 112px;
  position: relative;
  flex-shrink: 0;
}
.sidebar.collapsed .sidebar-brand { justify-content: center; padding: 22px 10px; }
.sidebar-brand-logo {
  width: 72px;
  height: 72px;
  object-fit: contain;
  flex-shrink: 0;
  filter: drop-shadow(0 4px 14px rgba(0, 0, 0, 0.35));
}
.sidebar.collapsed .sidebar-brand-logo {
  width: 56px;
  height: 56px;
}
.sidebar-brand-name {
  line-height: 1.2;
  min-width: 0;
  transition: opacity 0.2s, width 0.2s;
  white-space: nowrap;
}
.sidebar.collapsed .sidebar-brand-name { opacity: 0; width: 0; overflow: hidden; }
.sidebar-brand-main {
  display: block;
  font-size: 17px;
  font-weight: 800;
  color: rgba(255, 255, 255, 0.88);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.sidebar-brand-sub {
  display: block;
  font-size: 15px;
  font-weight: 800;
  color: var(--accent-light);
  margin-top: 4px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  text-shadow: 0 0 18px rgba(231, 111, 81, 0.35);
}
.sidebar-toggle {
  position: absolute;
  right: -13px;
  top: 100px;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-secondary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  z-index: 210;
  box-shadow: var(--shadow-sm);
  transition: color 0.15s, border-color 0.15s, background 0.15s;
}
.sidebar-toggle:hover {
  color: var(--accent);
  border-color: var(--accent);
  background: var(--surface-hover);
}
.sidebar-nav {
  flex: 1;
  padding: 12px 10px;
  overflow-y: auto;
  overflow-x: hidden;
}
.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  text-align: left;
  padding: 11px 14px;
  margin-bottom: 4px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--sidebar-muted);
  font-size: 14px;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.sidebar.collapsed .nav-item { justify-content: center; padding: 12px 0; gap: 0; }
.nav-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 10px;
  flex-shrink: 0;
  font-size: 0.92rem;
  background: color-mix(in srgb, var(--nav-ico, #94a3b8) 22%, transparent);
  color: var(--nav-ico, #94a3b8);
}
.nav-label {
  line-height: 1.2;
  white-space: nowrap;
  transition: opacity 0.2s, width 0.2s;
}
.sidebar.collapsed .nav-label { opacity: 0; width: 0; overflow: hidden; }
.nav-item:hover { background: var(--sidebar-bg-hover); color: var(--sidebar-text); }
.nav-item.active {
  background: var(--sidebar-active-bg);
  color: var(--sidebar-active-text);
  font-weight: 600;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
}
.nav-item.active .nav-icon {
  background: color-mix(in srgb, var(--nav-ico, var(--accent)) 32%, transparent);
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--nav-ico, var(--accent)) 35%, transparent);
  color: var(--nav-ico, var(--accent-dark));
}
.sidebar-foot {
  padding: 12px 10px 16px;
  border-top: 1px solid var(--sidebar-border);
  flex-shrink: 0;
}
.sidebar-action {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 10px 14px;
  margin-bottom: 4px;
  border: none;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--sidebar-muted);
  font-size: 14px;
  font-family: inherit;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.sidebar.collapsed .sidebar-action { justify-content: center; padding: 10px 0; gap: 0; }
.sidebar-action:hover { background: var(--sidebar-bg-hover); color: var(--sidebar-text); }
.sidebar-action-label {
  white-space: nowrap;
  transition: opacity 0.2s, width 0.2s;
}
.sidebar.collapsed .sidebar-action-label { opacity: 0; width: 0; overflow: hidden; }
.sidebar-user-card {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--sidebar-border);
}
.sidebar.collapsed .sidebar-user-card { justify-content: center; padding: 10px 8px; }
.sidebar-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), #f4896c);
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.sidebar-user-meta { min-width: 0; transition: opacity 0.2s, width 0.2s; }
.sidebar.collapsed .sidebar-user-meta { opacity: 0; width: 0; overflow: hidden; }
.sidebar-user-name {
  font-size: 13px;
  font-weight: 600;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sidebar-user-role { font-size: 11px; color: var(--sidebar-muted); margin-top: 2px; }

.main {
  margin-left: var(--sidebar-current-w);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  min-width: 0;
  background: transparent;
  transition: margin-left 0.25s ease;
}
.topbar {
  background: linear-gradient(90deg, var(--topbar-bg) 0%, var(--topbar-bg-2) 100%);
  border-bottom: 1px solid var(--topbar-border);
  padding: 18px 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  position: sticky;
  top: 0;
  z-index: 50;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.25);
}
.topbar-left h2 {
  margin: 0;
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--topbar-text);
}
.topbar-greeting { margin: 4px 0 0; font-size: 14px; color: var(--topbar-muted); }
.topbar-right { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }
.topbar .btn-ghost {
  background: rgba(255, 255, 255, 0.06);
  border-color: var(--topbar-border);
  color: var(--topbar-text);
  box-shadow: none;
}
.topbar .btn-ghost:hover {
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(231, 111, 81, 0.45);
  color: #fff;
}
.topbar-search {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--topbar-border);
  border-radius: 999px;
  padding: 8px 14px;
  min-width: 220px;
  color: var(--topbar-muted);
}
.topbar-search i { color: var(--topbar-muted); }
.topbar-search input {
  border: none;
  background: transparent;
  outline: none;
  font-size: 14px;
  font-family: inherit;
  color: var(--topbar-text);
  width: 140px;
}
.topbar-search input::placeholder { color: var(--topbar-muted); opacity: 0.85; }
.topbar-search kbd {
  font-size: 11px;
  padding: 2px 6px;
  border-radius: 6px;
  border: 1px solid var(--topbar-border);
  background: rgba(255, 255, 255, 0.06);
  color: var(--topbar-muted);
}
.topbar-icon-btn {
  position: relative;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 1px solid var(--topbar-border);
  background: rgba(255, 255, 255, 0.06);
  color: var(--topbar-text);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  transition: border-color 0.15s, color 0.15s, background 0.15s;
}
.topbar-icon-btn:hover {
  border-color: rgba(231, 111, 81, 0.5);
  color: var(--accent-light);
  background: rgba(231, 111, 81, 0.12);
}
.topbar-badge {
  position: absolute;
  top: 2px;
  right: 2px;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 999px;
  background: var(--danger) !important;
  color: #fff !important;
  font-size: 11px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.topbar-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.content { padding: 24px 28px 36px; flex: 1; }

@media (max-width: 900px) {
  .topbar-search { display: none; }
}

/* ── Cards ── */
.card {
  background: var(--surface);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  padding: 22px;
  margin-bottom: 18px;
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  transition: box-shadow 0.2s, border-color 0.2s;
}
.card:hover {
  box-shadow: var(--shadow);
  border-color: var(--border-strong);
}
.card-title {
  font-weight: 700;
  font-size: 15px;
  color: var(--text);
  margin: -22px -22px 18px;
  padding: 14px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  border-bottom: 1px solid var(--border);
  border-left: 4px solid #a8a3c4;
  background: linear-gradient(
    105deg,
    rgba(168, 163, 196, 0.16) 0%,
    rgba(42, 37, 72, 0.35) 42%,
    rgba(47, 43, 82, 0.95) 100%
  );
  box-shadow: inset 0 -1px 0 rgba(255, 255, 255, 0.03);
  position: relative;
  overflow: hidden;
}
.card-title::after {
  content: '';
  position: absolute;
  top: 0;
  right: 0;
  width: 40%;
  height: 100%;
  background: linear-gradient(90deg, transparent 0%, rgba(255, 255, 255, 0.04) 100%);
  pointer-events: none;
}
.card.tone-orange > .card-title {
  border-left-color: var(--accent);
  color: #fdba8c;
  background: linear-gradient(105deg, rgba(231, 111, 81, 0.28) 0%, rgba(231, 111, 81, 0.1) 45%, rgba(47, 43, 82, 0.95) 100%);
  border-bottom-color: rgba(231, 111, 81, 0.28);
}
.card.tone-green > .card-title {
  border-left-color: #34d399;
  color: #6ee7b7;
  background: linear-gradient(105deg, rgba(16, 185, 129, 0.28) 0%, rgba(16, 185, 129, 0.1) 45%, rgba(47, 43, 82, 0.95) 100%);
  border-bottom-color: rgba(16, 185, 129, 0.28);
}
.card.tone-blue > .card-title {
  border-left-color: #60a5fa;
  color: #93c5fd;
  background: linear-gradient(105deg, rgba(59, 130, 246, 0.28) 0%, rgba(59, 130, 246, 0.1) 45%, rgba(47, 43, 82, 0.95) 100%);
  border-bottom-color: rgba(59, 130, 246, 0.28);
}
.card.tone-purple > .card-title {
  border-left-color: #a78bfa;
  color: #c4b5fd;
  background: linear-gradient(105deg, rgba(139, 92, 246, 0.28) 0%, rgba(139, 92, 246, 0.1) 45%, rgba(47, 43, 82, 0.95) 100%);
  border-bottom-color: rgba(139, 92, 246, 0.28);
}
.card.tone-red > .card-title {
  border-left-color: #f87171;
  color: #fca5a5;
  background: linear-gradient(105deg, rgba(239, 68, 68, 0.25) 0%, rgba(239, 68, 68, 0.1) 45%, rgba(47, 43, 82, 0.95) 100%);
  border-bottom-color: rgba(239, 68, 68, 0.25);
}

.toolbar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 14px; }
.toolbar input,
.toolbar select,
.card .field input,
.card .field select {
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-family: inherit;
  background: var(--bg-warm);
  color: var(--text);
  transition: border-color 0.15s, box-shadow 0.15s, background 0.15s;
}
.toolbar input:focus,
.toolbar select:focus,
.card .field input:focus,
.card .field select:focus {
  outline: none;
  border-color: var(--accent);
  background: var(--surface-hover);
  box-shadow: 0 0 0 3px var(--accent-ring);
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
}
.data-table th,
.data-table td {
  padding: 11px 14px;
  border-bottom: 1px solid var(--border-light);
  text-align: left;
}
.data-table td { color: var(--text); }
.data-table th {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.06) 0%, rgba(255, 255, 255, 0.03) 100%);
  font-weight: 600;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  border-bottom: 1px solid var(--border);
}
.data-table tbody tr { transition: background 0.12s; }
.data-table tbody tr:hover td { background: var(--accent-soft); }
.data-table tbody tr:last-child td { border-bottom: none; }
.data-table code {
  font-size: 13px;
  background: rgba(231, 111, 81, 0.1);
  color: var(--accent-dark);
  padding: 2px 7px;
  border-radius: 4px;
  border: 1px solid rgba(231, 111, 81, 0.18);
}

.link {
  color: var(--accent-dark);
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
}
.link:hover { color: var(--accent); text-decoration: underline; }

/* ── Modal ── */
.modal-backdrop {
  position: fixed; inset: 0;
  background: rgba(10, 8, 24, 0.72);
  backdrop-filter: blur(6px);
  display: flex; align-items: center; justify-content: center;
  padding: 20px; z-index: 1000;
}
.modal {
  background: var(--surface);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  max-width: 640px;
  width: 100%;
  max-height: 90vh;
  overflow: auto;
  box-shadow: var(--shadow-lg);
}
.modal.modal-wide { max-width: 820px; }
.modal-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 22px;
  font-weight: 700;
  font-size: 15px;
  color: var(--accent-light);
  background: linear-gradient(
    135deg,
    rgba(231, 111, 81, 0.22) 0%,
    rgba(231, 111, 81, 0.08) 50%,
    rgba(47, 43, 82, 0.98) 100%
  );
  border-left: 4px solid var(--accent);
  border-bottom: 1px solid var(--border);
}
.modal-body { padding: 22px; }
.modal-close {
  border: none;
  background: var(--bg-warm);
  width: 32px; height: 32px;
  border-radius: 8px;
  font-size: 1.2rem;
  cursor: pointer;
  color: var(--muted);
  transition: background 0.15s, color 0.15s;
}
.modal-close:hover {
  background: var(--accent-soft);
  color: var(--accent-dark);
}

.form-row { display: flex; flex-wrap: wrap; gap: 12px; margin-bottom: 14px; }
.form-row .field { flex: 1; min-width: 160px; margin-bottom: 0; }

.tabs { display: flex; gap: 6px; margin-bottom: 18px; flex-wrap: wrap; }
.tab {
  padding: 8px 16px;
  border: 1px solid var(--border);
  background: var(--bg-warm);
  border-radius: 999px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  font-family: inherit;
  color: var(--text-secondary);
  transition: all 0.15s;
}
.tab:hover {
  border-color: rgba(231, 111, 81, 0.35);
  color: var(--accent-dark);
  background: var(--accent-soft);
}
.tab.active {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
  box-shadow: var(--accent-glow-sm);
}

.checkbox-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 8px; }
.checkbox-grid label { font-size: 13px; display: flex; gap: 6px; align-items: center; color: var(--text-secondary); }

/* ── KPI panels — embedded-style (แนวทางเดียวกับ ERP chat.html) ── */
.kpi-bento {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 20px;
  align-items: stretch;
}
.eo-kpi-section {
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.eo-kpi-section-label {
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: var(--text);
  padding: 13px 16px 13px 18px;
  border-radius: 10px;
  border: 1px solid var(--border);
  border-left: none;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  box-shadow: var(--shadow-sm);
  margin-bottom: 8px;
  position: relative;
  overflow: hidden;
}
.eo-kpi-section-label::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 5px;
  border-radius: 10px 0 0 10px;
  background: linear-gradient(180deg, var(--accent-light) 0%, var(--accent) 55%, var(--accent-dark) 100%);
}
.eo-kpi-section-label::after {
  content: '';
  position: absolute;
  top: 0;
  right: 0;
  width: 35%;
  height: 100%;
  background: linear-gradient(90deg, transparent 0%, rgba(255, 255, 255, 0.04) 100%);
  pointer-events: none;
}
.eo-kpi-section-label > span:first-child {
  position: relative;
  z-index: 1;
}
.eo-kpi-section-label .eo-section-hint {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  margin-left: auto;
  padding: 3px 10px;
  border-radius: 999px;
  position: relative;
  z-index: 1;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.1);
}
.eo-section-overview .eo-kpi-section-label {
  border-color: rgba(59, 130, 246, 0.35);
  color: #93c5fd;
  background: linear-gradient(
    118deg,
    rgba(59, 130, 246, 0.28) 0%,
    rgba(96, 165, 250, 0.12) 38%,
    rgba(47, 43, 82, 0.95) 100%
  );
  box-shadow: 0 2px 10px rgba(59, 130, 246, 0.12);
}
.eo-section-overview .eo-kpi-section-label::before {
  background: linear-gradient(180deg, #60a5fa 0%, #3b82f6 50%, #2563eb 100%);
}
.eo-section-overview .eo-kpi-section-label .eo-section-hint {
  color: #93c5fd;
  background: rgba(59, 130, 246, 0.18);
  border-color: rgba(59, 130, 246, 0.28);
}
.eo-section-ops .eo-kpi-section-label {
  border-color: rgba(16, 185, 129, 0.35);
  color: #6ee7b7;
  background: linear-gradient(
    118deg,
    rgba(16, 185, 129, 0.28) 0%,
    rgba(52, 211, 153, 0.12) 38%,
    rgba(47, 43, 82, 0.95) 100%
  );
  box-shadow: 0 2px 10px rgba(16, 185, 129, 0.12);
}
.eo-section-ops .eo-kpi-section-label::before {
  background: linear-gradient(180deg, #34d399 0%, #10b981 50%, #059669 100%);
}
.eo-section-ops .eo-kpi-section-label .eo-section-hint {
  color: #6ee7b7;
  background: rgba(16, 185, 129, 0.18);
  border-color: rgba(16, 185, 129, 0.28);
}
.eo-section-risk .eo-kpi-section-label {
  border-color: rgba(231, 111, 81, 0.4);
  color: #fdba8c;
  background: linear-gradient(
    118deg,
    rgba(231, 111, 81, 0.3) 0%,
    rgba(244, 137, 108, 0.12) 38%,
    rgba(47, 43, 82, 0.95) 100%
  );
  box-shadow: 0 2px 10px rgba(231, 111, 81, 0.14);
}
.eo-section-risk .eo-kpi-section-label::before {
  background: linear-gradient(180deg, #f4896c 0%, var(--accent) 50%, #c4563d 100%);
}
.eo-section-risk .eo-kpi-section-label .eo-section-hint {
  color: #fdba8c;
  background: rgba(231, 111, 81, 0.18);
  border-color: rgba(231, 111, 81, 0.3);
}
.eo-section-ai .eo-kpi-section-label {
  border-color: rgba(139, 92, 246, 0.35);
  color: #c4b5fd;
  background: linear-gradient(
    118deg,
    rgba(139, 92, 246, 0.28) 0%,
    rgba(167, 139, 250, 0.12) 38%,
    rgba(47, 43, 82, 0.95) 100%
  );
  box-shadow: 0 2px 10px rgba(139, 92, 246, 0.12);
}
.eo-section-ai .eo-kpi-section-label::before {
  background: linear-gradient(180deg, #a78bfa 0%, #8b5cf6 50%, #7c3aed 100%);
}
.eo-section-ai .eo-kpi-section-label .eo-section-hint {
  color: #c4b5fd;
  background: rgba(139, 92, 246, 0.18);
  border-color: rgba(139, 92, 246, 0.28);
}
.kpi-stat-strip {
  margin: 0;
  flex: 1;
  display: grid;
  gap: 1px;
  background: var(--border);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  min-height: 0;
}
.kpi-stat-strip.cols-2 { grid-template-columns: 1fr 1fr; }
.kpi-stat-strip.cols-3 { grid-template-columns: repeat(3, 1fr); }
.kpi-stat-item {
  background: var(--surface);
  padding: 14px 16px;
  position: relative;
  min-height: 84px;
}
.kpi-stat-item::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 3px;
  background: var(--border-strong);
}
.kpi-stat-item.tone-green::before { background: #10b981; }
.kpi-stat-item.tone-orange::before { background: var(--accent); }
.kpi-stat-item.tone-red::before { background: #dc4c4c; }
.kpi-stat-item.tone-blue::before { background: #3b82f6; }
.kpi-stat-item.tone-purple::before { background: #8b5cf6; }
.kpi-stat-item.tone-yellow::before { background: #d4a054; }
.kpi-stat-val {
  display: block;
  font-size: 22px;
  font-weight: 800;
  line-height: 1.15;
  color: var(--text);
  word-break: break-word;
}
.kpi-stat-item.tone-green .kpi-stat-val { color: #34d399; }
.kpi-stat-item.tone-orange .kpi-stat-val { color: var(--accent-light); }
.kpi-stat-item.tone-red .kpi-stat-val { color: #f87171; }
.kpi-stat-item.tone-blue .kpi-stat-val { color: #60a5fa; }
.kpi-stat-item.tone-purple .kpi-stat-val { color: #a78bfa; }
.kpi-stat-item.tone-yellow .kpi-stat-val { color: #fbbf24; }
.kpi-stat-lbl {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-top: 6px;
  text-transform: none;
  letter-spacing: 0;
  line-height: 1.4;
}
.kpi-stat-sub {
  display: block;
  font-size: 13px;
  color: var(--muted);
  margin-top: 4px;
  line-height: 1.4;
  opacity: 1;
}
.kpi-risk-list {
  margin: 0;
  flex: 1;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}
.kpi-risk-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 14px;
  border-bottom: 1px solid var(--border-light);
}
.kpi-risk-item:last-child { border-bottom: none; }
.kpi-risk-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}
.kpi-risk-dot.tone-red { background: #dc4c4c; box-shadow: 0 0 6px rgba(220, 76, 76, 0.4); }
.kpi-risk-dot.tone-orange { background: var(--accent); box-shadow: 0 0 6px rgba(231, 111, 81, 0.4); }
.kpi-risk-dot.tone-yellow { background: #d4a054; }
.kpi-risk-dot.tone-purple { background: #8b5cf6; }
.kpi-risk-dot.tone-green { background: #10b981; }
.kpi-risk-text {
  flex: 1;
  font-size: 13px;
  color: var(--text-secondary);
  min-width: 0;
}
.kpi-risk-val {
  font-size: 18px;
  font-weight: 800;
  flex-shrink: 0;
}
.kpi-risk-val.tone-red { color: #f87171; }
.kpi-risk-val.tone-orange { color: var(--accent-light); }
.kpi-risk-val.tone-yellow { color: #fbbf24; }
.kpi-risk-val.tone-purple { color: #a78bfa; }
.kpi-risk-val.tone-green { color: #34d399; }

/* ── Dashboard stat cards (mockup top row) ── */
.stat-cards-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 20px;
}
.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 18px 14px;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 130px;
}
.stat-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}
.stat-card-icon {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
}
.stat-card.tone-orange .stat-card-icon { background: rgba(231, 111, 81, 0.18); color: var(--accent-light); }
.stat-card.tone-green .stat-card-icon { background: rgba(16, 185, 129, 0.18); color: #34d399; }
.stat-card.tone-purple .stat-card-icon { background: rgba(139, 92, 246, 0.18); color: #a78bfa; }
.stat-card.tone-red .stat-card-icon { background: rgba(239, 68, 68, 0.18); color: #f87171; }
.stat-card-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  line-height: 1.35;
}
.stat-card-value {
  font-size: 28px;
  font-weight: 800;
  line-height: 1.1;
  color: var(--text);
  letter-spacing: -0.02em;
}
.stat-card.tone-orange .stat-card-value { color: var(--accent-light); }
.stat-card.tone-green .stat-card-value { color: #34d399; }
.stat-card.tone-purple .stat-card-value { color: #a78bfa; }
.stat-card.tone-red .stat-card-value { color: #f87171; }
.stat-card-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: auto;
}
.stat-card-delta {
  font-size: 12px;
  font-weight: 600;
  color: var(--success);
}
.stat-card-spark {
  display: flex;
  align-items: flex-end;
  gap: 3px;
  height: 24px;
  opacity: 0.55;
}
.stat-card-spark span {
  width: 4px;
  border-radius: 2px;
  background: currentColor;
}
.stat-card.tone-orange .stat-card-spark { color: var(--accent); }
.stat-card.tone-green .stat-card-spark { color: #10b981; }
.stat-card.tone-purple .stat-card-spark { color: #8b5cf6; }
.stat-card.tone-red .stat-card-spark { color: #ef4444; }

/* ── Digital Signature ── */
.sig-profile-preview {
  width: 220px;
  min-height: 80px;
  border: 1px dashed var(--border);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  font-size: 13px;
  background: var(--bg-warm);
  padding: 8px;
}
.sig-profile-img {
  max-width: 200px;
  max-height: 72px;
  object-fit: contain;
}
.sig-doc-picked {
  margin-top: 10px;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  background: rgba(59, 130, 246, 0.08);
  border: 1px solid rgba(59, 130, 246, 0.22);
  font-size: 13px;
}
.sig-sign-stage {
  position: relative;
  margin: 0 auto;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-warm);
  overflow: hidden;
  max-width: 100%;
}
.sig-sign-doc-layer {
  line-height: 0;
}
.sig-sign-doc-img {
  display: block;
  max-width: 100%;
  height: auto;
}
.sig-sign-overlay-wrap {
  position: absolute;
  left: 0;
  top: 0;
  z-index: 2;
  cursor: grab;
  touch-action: none;
  user-select: none;
  border: 2px dashed rgba(231, 111, 81, 0.85);
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.15);
  box-sizing: border-box;
}
.sig-sign-overlay-wrap:active { cursor: grabbing; }
.sig-sign-overlay {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  pointer-events: none;
  filter: drop-shadow(0 2px 6px rgba(0, 0, 0, 0.25));
}
.sig-resize-handle {
  position: absolute;
  right: -4px;
  bottom: -4px;
  width: 14px;
  height: 14px;
  background: var(--accent, #E76F51);
  border: 2px solid #fff;
  border-radius: 3px;
  cursor: nwse-resize;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.2);
}
.sig-pdf-nav {
  justify-content: center;
  gap: 10px;
}
.sig-preview-panel { margin-top: 14px; }
.sig-preview-frame-wrap {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: var(--surface);
}
.sig-preview-frame {
  width: 100%;
  min-height: 420px;
  border: none;
  display: block;
}
.sig-preview-embed {
  width: 100%;
  min-height: 520px;
  border: none;
  display: block;
}
.sig-preview-hint {
  margin: 0 0 8px;
  padding: 0 8px;
  font-size: 12px;
  color: var(--muted);
  text-align: center;
}
.sig-preview-img {
  max-width: 100%;
  height: auto;
  display: block;
  margin: 0 auto;
}
.sig-detail-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px 16px;
  font-size: 13px;
}
.sig-detail-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
}
.sig-detail-record {
  padding: 10px 12px;
  border: 1px dashed var(--border);
  border-radius: var(--radius-sm);
  font-size: 13px;
  margin-bottom: 8px;
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}
.topbar-titles { min-width: 0; }
.topbar-menu-btn {
  display: none;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  flex-shrink: 0;
  border: 1px solid var(--topbar-border);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.06);
  color: var(--topbar-text);
  cursor: pointer;
  font-size: 18px;
}
.topbar-menu-btn:hover {
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(231, 111, 81, 0.45);
  color: #fff;
}
.sidebar-backdrop {
  display: none;
}

/* ── Dashboard (charts) ── */
.dash-charts-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 14px;
  margin: 4px 0 14px;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface);
}
.dash-range-label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  cursor: pointer;
}
.dash-range-label i { color: var(--accent-light); }
.dash-range-select {
  min-width: 140px;
  min-height: 44px;
  padding: 10px 14px;
  border: 1px solid #cbd5e1;
  border-radius: 10px;
  background: #f1f5f9;
  color: #0f172a;
  font-size: 15px;
  font-family: inherit;
  font-weight: 600;
  cursor: pointer;
}
.dash-range-select:focus {
  outline: none;
  background: #fff;
  box-shadow: 0 0 0 3px rgba(148, 163, 184, 0.35);
}
.dash-charts {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 18px;
  margin-bottom: 18px;
}
.dash-chart-card {
  display: flex;
  flex-direction: column;
  min-height: 320px;
}
.dash-chart-wrap {
  position: relative;
  flex: 1;
  min-height: 220px;
  padding: 4px 4px 8px;
}
.dash-chart-wrap--donut {
  max-width: 280px;
  margin: 0 auto;
  width: 100%;
}
.dash-foot {
  font-size: 13px;
  color: var(--muted);
  text-align: right;
  margin: 4px 0 0;
}
.table-scroll { width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }

@media (max-width: 1100px) {
  .dash-charts { grid-template-columns: 1fr; }
}

/* ── Mobile Mode (e-Office shell + Dashboard) ── */
@media (max-width: 768px) {
  body.eo-nav-locked { overflow: hidden; }

  .app-shell {
    --sidebar-current-w: 0px;
  }
  .app-shell.sidebar-collapsed {
    --sidebar-current-w: 0px;
  }

  .sidebar {
    width: min(86vw, 300px) !important;
    transform: translateX(-105%);
    transition: transform 0.25s ease;
    box-shadow: none;
  }
  .app-shell.sidebar-open .sidebar {
    transform: translateX(0);
    box-shadow: 8px 0 32px rgba(0, 0, 0, 0.45);
  }
  .sidebar.collapsed { width: min(86vw, 300px) !important; }
  .sidebar.collapsed .sidebar-brand-name,
  .sidebar.collapsed .nav-label,
  .sidebar.collapsed .sidebar-action-label,
  .sidebar.collapsed .sidebar-user-meta {
    opacity: 1;
    width: auto;
    overflow: visible;
  }
  .sidebar.collapsed .sidebar-brand { justify-content: flex-start; padding: 22px 14px 22px 16px; }
  .sidebar.collapsed .nav-item { justify-content: flex-start; padding: 11px 14px; gap: 12px; }
  .sidebar-toggle { display: none; }

  .sidebar-backdrop {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 190;
    background: rgba(8, 10, 18, 0.55);
    backdrop-filter: blur(2px);
    border: none;
    padding: 0;
    margin: 0;
    cursor: pointer;
  }
  .sidebar-backdrop[hidden] { display: none !important; }

  .main { margin-left: 0; }
  .content { padding: 14px 12px 28px; }
  .topbar {
    padding: 12px 12px;
    gap: 10px;
  }
  .topbar-left h2 { font-size: 18px; }
  .topbar-greeting { font-size: 12px; }
  .topbar-menu-btn { display: inline-flex; }
  .topbar-search { display: none; }
  .topbar-avatar { width: 36px; height: 36px; font-size: 12px; }

  .kpi-bento { grid-template-columns: 1fr; gap: 12px; }
  .kpi-stat-strip.cols-3,
  .kpi-stat-strip.cols-2 { grid-template-columns: 1fr 1fr; gap: 8px; }
  .stat-cards-row { grid-template-columns: 1fr 1fr; gap: 10px; }
  .stat-card { padding: 14px; }
  .stat-card-value { font-size: 22px; }

  .dash-charts-toolbar {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
  }
  .dash-range-select {
    width: 100%;
    min-height: 50px;
    font-size: 16px;
  }
  .dash-charts { gap: 12px; }
  .dash-chart-card { min-height: 280px; margin-bottom: 0; }
  .dash-chart-wrap { min-height: 200px; }
  .dash-foot { text-align: left; font-size: 12px; }
  .card { padding: 16px; margin-bottom: 12px; }
  .card-title {
    margin: -16px -16px 14px;
    padding: 12px 14px;
    font-size: 14px;
  }

  /* Pending list as cards on mobile */
  .dash-pending-table thead { display: none; }
  .dash-pending-table,
  .dash-pending-table tbody,
  .dash-pending-table tr,
  .dash-pending-table td {
    display: block;
    width: 100%;
  }
  .dash-pending-table tr {
    padding: 12px 14px;
    margin-bottom: 10px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--surface-2);
  }
  .dash-pending-table td {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    padding: 6px 0;
    border: none;
    text-align: right;
  }
  .dash-pending-table td::before {
    content: attr(data-label);
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--muted);
    text-align: left;
    flex-shrink: 0;
  }
  .dash-pending-table td:first-child {
    font-weight: 650;
    padding-top: 0;
  }
  .dash-pending-table td:last-child { padding-bottom: 0; }
}

@media (max-width: 520px) {
  .stat-cards-row { grid-template-columns: 1fr; }
  .kpi-stat-strip.cols-3 { grid-template-columns: 1fr; }
}

/* ── DMS preview / thumbnail (Phase 5c) ── */
.dms-thumb {
  width: 48px;
  height: 48px;
  object-fit: cover;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg-warm);
  display: block;
}
.dms-thumb-ph {
  display: inline-flex;
  width: 48px;
  height: 48px;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  border-radius: 8px;
  background: var(--surface-2);
  border: 1px dashed var(--border);
}
.dms-preview-wrap {
  text-align: center;
  max-height: 70vh;
  overflow: auto;
  padding: 8px;
  background: var(--surface-2);
  border-radius: 10px;
}
.dms-preview-img {
  max-width: 100%;
  height: auto;
  border-radius: 8px;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
}


/* ── Notification inbox (Workflow) ── */
.notify-inbox {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.notify-tabs {
  margin-bottom: 0;
}

.notify-tab-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  margin-left: 4px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  background: rgba(0, 0, 0, 0.08);
  color: inherit;
}

.tab.active .notify-tab-count {
  background: rgba(255, 255, 255, 0.22);
  color: #fff;
}

.notify-scroll-panel {
  --notify-row-h: 58px;
  max-height: calc(var(--notify-row-h) * 10 + 8px * 9);
  overflow-y: auto;
  overflow-x: hidden;
  padding-right: 4px;
  scrollbar-width: thin;
  scrollbar-color: var(--border-strong) transparent;
}

.notify-scroll-panel::-webkit-scrollbar {
  width: 6px;
}

.notify-scroll-panel::-webkit-scrollbar-thumb {
  background: var(--border-strong);
  border-radius: 999px;
}

.notify-scroll-panel::-webkit-scrollbar-thumb:hover {
  background: var(--muted);
}

.notify-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.notify-item {
  display: flex;
  gap: 12px;
  padding: 14px 16px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface);
  transition: border-color 0.15s, box-shadow 0.15s, background 0.15s;
}

.notify-item.compact {
  padding: 10px 12px;
  gap: 10px;
  min-height: var(--notify-row-h);
}

.notify-item.unread {
  border-color: rgba(231, 111, 81, 0.4);
  background: linear-gradient(135deg, rgba(231, 111, 81, 0.16) 0%, rgba(47, 43, 82, 0.9) 55%);
  box-shadow: 0 1px 4px rgba(231, 111, 81, 0.12);
}

.notify-item.unread:hover {
  border-color: rgba(231, 111, 81, 0.5);
  box-shadow: var(--accent-glow-sm);
}

.notify-item.read {
  border-color: var(--border-light);
  background: var(--bg-warm);
  opacity: 0.92;
}

.notify-item.read:hover {
  opacity: 1;
  border-color: var(--border);
}

.notify-item-icon {
  flex-shrink: 0;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
}

.notify-item.compact .notify-item-icon {
  width: 34px;
  height: 34px;
  font-size: 14px;
}

.notify-item.unread .notify-item-icon {
  background: var(--accent-soft);
  color: var(--accent-dark);
}

.notify-item.read .notify-item-icon {
  background: var(--border-light);
  color: var(--muted);
}

.notify-item-body {
  flex: 1;
  min-width: 0;
}

.notify-item-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 2px;
}

.notify-item-title {
  font-weight: 700;
  font-size: 14px;
  color: var(--text);
  line-height: 1.35;
}

.notify-item.compact .notify-item-title {
  font-size: 13px;
}

.notify-item.read .notify-item-title {
  font-weight: 600;
  color: var(--text-secondary);
}

.notify-item-desc {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.45;
  margin-bottom: 6px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.notify-item.compact .notify-item-desc {
  font-size: 12px;
  margin-bottom: 4px;
  -webkit-line-clamp: 1;
}

.notify-item.read .notify-item-desc {
  color: var(--muted);
}

.notify-item-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
}

.notify-item-time {
  font-size: 12px;
  color: var(--muted);
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.notify-item.compact .notify-item-time {
  font-size: 11px;
}

.notify-item-actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.notify-empty {
  text-align: center;
  padding: 28px 16px;
  color: var(--muted);
  font-size: 13px;
  border: 1px dashed var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-warm);
}

.notify-empty i {
  display: block;
  font-size: 24px;
  margin-bottom: 8px;
  opacity: 0.45;
}

.notify-card-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.notify-header-badge {
  margin-left: 6px;
  background: var(--accent) !important;
  color: #fff !important;
}

/* ── Workflow page tabs (ใช้งาน / ตั้งค่า) ── */
.wf-page-tabs {
  margin-bottom: 20px;
}

.wf-setup-hint {
  margin: 0 0 14px;
  padding: 10px 14px;
  font-size: 13px;
  line-height: 1.55;
  color: var(--text-secondary);
  background: rgba(139, 92, 246, 0.08);
  border: 1px solid rgba(139, 92, 246, 0.18);
  border-radius: var(--radius-sm);
}
.wf-tpl-edit-badge {
  font-size: 12px;
  font-weight: 700;
  color: #c4b5fd;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(139, 92, 246, 0.18);
  border: 1px solid rgba(139, 92, 246, 0.35);
}
#wf-tpl-code[readonly] {
  opacity: 0.75;
  cursor: not-allowed;
}

.notify-section-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 22px;
  height: 22px;
  padding: 0 7px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
}

/* ── My Inbox ── */
.stat-cards-row.cols-4 { grid-template-columns: repeat(4, 1fr); }
.inbox-filters { margin-bottom: 8px; }
.inbox-list { display: flex; flex-direction: column; gap: 10px; }
.inbox-item {
  display: flex;
  gap: 14px;
  align-items: flex-start;
  padding: 14px 16px;
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
}
.inbox-item.tone-purple { border-left-color: #a78bfa; }
.inbox-item.tone-blue { border-left-color: #60a5fa; }
.inbox-item.tone-orange { border-left-color: var(--accent); }
.inbox-item-icon {
  width: 40px; height: 40px; border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  background: var(--accent-soft); color: var(--accent-light); flex-shrink: 0;
}
.inbox-item.tone-purple .inbox-item-icon { background: rgba(139, 92, 246, 0.18); color: #a78bfa; }
.inbox-item.tone-blue .inbox-item-icon { background: rgba(96, 165, 250, 0.18); color: #60a5fa; }
.inbox-item-body { flex: 1; min-width: 0; }
.inbox-item-top { display: flex; justify-content: space-between; gap: 8px; margin-bottom: 4px; }
.inbox-kind {
  font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em;
  color: var(--muted);
}
.inbox-at { font-size: 12px; color: var(--muted); white-space: nowrap; }
.inbox-title { font-weight: 650; color: var(--text); margin-bottom: 2px; }
.inbox-sub { font-size: 13px; color: var(--text-secondary); }
.inbox-item-actions { display: flex; flex-wrap: wrap; gap: 6px; justify-content: flex-end; flex-shrink: 0; }
.nav-badge {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 18px; height: 18px; padding: 0 5px; margin-left: 6px;
  border-radius: 999px; font-size: 10px; font-weight: 700;
  background: var(--accent); color: #fff;
}
.nav-item.collapsed .nav-badge,
.sidebar.collapsed .nav-badge { position: absolute; top: 6px; right: 8px; margin: 0; }

/* ── Document Timeline ── */
.doc-timeline { margin: 16px 0 8px; }
.doc-timeline-title {
  font-weight: 700; margin-bottom: 12px; display: flex; align-items: center; gap: 8px;
}
.doc-timeline-list {
  position: relative;
  padding-left: 22px;
  display: flex;
  flex-direction: column;
  gap: 0;
}
.doc-timeline-list::before {
  content: '';
  position: absolute;
  left: 7px; top: 4px; bottom: 4px;
  width: 2px;
  background: var(--border-strong);
}
.doc-tl-item {
  position: relative;
  padding: 0 0 14px 12px;
}
.doc-tl-item:last-child { padding-bottom: 0; }
.doc-tl-dot {
  position: absolute;
  left: -19px; top: 4px;
  width: 12px; height: 12px;
  border-radius: 50%;
  background: var(--accent);
  border: 2px solid var(--surface);
  box-shadow: 0 0 0 2px rgba(231, 111, 81, 0.35);
}
.doc-tl-item.kind-wf_approve .doc-tl-dot,
.doc-tl-item.kind-signed .doc-tl-dot { background: #34d399; box-shadow: 0 0 0 2px rgba(52, 211, 153, 0.35); }
.doc-tl-item.kind-wf_reject .doc-tl-dot { background: #f87171; box-shadow: 0 0 0 2px rgba(248, 113, 113, 0.35); }
.doc-tl-item.kind-wf_pending .doc-tl-dot,
.doc-tl-item.kind-sign_request .doc-tl-dot { background: #a78bfa; box-shadow: 0 0 0 2px rgba(167, 139, 250, 0.35); }
.doc-tl-head { display: flex; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.doc-tl-title { font-weight: 650; font-size: 13px; }
.doc-tl-at { font-size: 11px; color: var(--muted); }
.doc-tl-detail { font-size: 12px; color: var(--text-secondary); margin-top: 2px; }
.doc-tl-actor { font-size: 11px; color: var(--muted); margin-top: 2px; }

.inbox-item.is-overdue {
  border-left-color: #f87171;
  background: rgba(248, 113, 113, 0.08);
}
.nav-badge-overdue { background: #ef4444; }
.badge-overdue {
  display: inline-block;
  margin-left: 6px;
  padding: 1px 7px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 700;
  background: rgba(248, 113, 113, 0.2);
  color: #f87171;
}
.row-overdue td { background: rgba(248, 113, 113, 0.06); }

/* Language / Theme switch EN | TH · Dark | Light */
.login-lang-row {
  display: flex;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 8px;
  margin: -4px 0 12px;
}
.ui-lang-switch,
.ui-theme-switch {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 3px 6px;
  border-radius: 999px;
  border: 1px solid var(--topbar-border, rgba(255, 255, 255, 0.14));
  background: rgba(255, 255, 255, 0.06);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
  user-select: none;
}
.login-card .ui-lang-switch,
.login-card .ui-theme-switch {
  border-color: var(--border, #2e3d5a);
  background: var(--bg-elevated, #222e44);
}
.ui-lang-sep,
.ui-theme-sep {
  color: var(--topbar-muted, #94a3b8);
  opacity: 0.7;
  padding: 0 2px;
}
.ui-lang-btn,
.ui-theme-btn {
  border: none;
  background: transparent;
  color: var(--topbar-muted, #94a3b8);
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 999px;
  font: inherit;
  font-weight: 700;
}
.ui-lang-btn:hover,
.ui-theme-btn:hover { color: #fff; }
.ui-lang-btn.active,
.ui-lang-btn[aria-pressed="true"],
.ui-theme-btn.active,
.ui-theme-btn[aria-pressed="true"] {
  background: rgba(231, 111, 81, 0.22);
  color: #fff;
}

@media (max-width: 900px) {
  .stat-cards-row.cols-4 { grid-template-columns: 1fr 1fr; }
  .inbox-item { flex-wrap: wrap; }
  .inbox-item-actions { width: 100%; justify-content: flex-start; }
}

/* ── ISO QDM — toolbar / combo แนว ERP Ops ── */
.qdm-page { display: flex; flex-direction: column; gap: 14px; }
.qdm-page-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
}
.qdm-page-head h3 {
  margin: 0;
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text);
}
.qdm-page-head p {
  margin: 4px 0 0;
  font-size: 13px;
  color: var(--muted);
}
.qdm-page .tabs.qdm-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0;
  padding: 10px 12px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 12px;
}
.qdm-page .tabs.qdm-tabs .tab {
  min-height: 40px;
  padding: 8px 16px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
}
.qdm-page .tabs.qdm-tabs .tab i { opacity: 0.9; }
.qdm-toolbar-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}
.qdm-filter-card {
  padding: 14px 16px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 12px;
}
.qdm-filter-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 16px;
  align-items: flex-end;
}
.qdm-filter-row .field {
  margin: 0;
  min-width: 160px;
  flex: 0 1 200px;
}
.qdm-filter-row .field label {
  display: block;
  margin-bottom: 6px;
  font-size: 12px;
  font-weight: 650;
  letter-spacing: 0.02em;
  color: var(--muted);
  text-transform: uppercase;
}
.qdm-filter-row .field-check {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  padding-bottom: 2px;
  color: var(--text-secondary);
  font-size: 14px;
  flex: 0 0 auto;
}
.qdm-filter-row .field-actions {
  flex: 0 0 auto;
  display: flex;
  gap: 8px;
  align-items: center;
}

/* ERP ops-input — ช่องสว่าง อ่านชัด (override dark theme) */
.qdm-page .ops-input,
.qdm-page input.ops-input,
.qdm-page select.ops-input,
.qdm-page textarea.ops-input,
.qdm-page .card .field .ops-input,
.qdm-page .card .field input.ops-input,
.qdm-page .card .field select.ops-input {
  width: 100%;
  min-height: 44px;
  padding: 10px 14px;
  font-size: 15px;
  font-weight: 600;
  font-family: inherit;
  border-radius: 10px;
  border: 1px solid #94a3b8;
  background-color: #ffffff;
  background-image: none;
  color: #0f172a;
  -webkit-text-fill-color: #0f172a;
  caret-color: #0f172a;
  color-scheme: light;
  box-sizing: border-box;
  appearance: none;
  -webkit-appearance: none;
}
.qdm-page select.ops-input,
.qdm-page .card .field select.ops-input {
  background-color: #ffffff;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%230f172a' d='M1.4 1.2L6 5.8l4.6-4.6L12 2.6 6 8.6 0 2.6z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 36px;
  cursor: pointer;
  color: #0f172a;
  -webkit-text-fill-color: #0f172a;
}
.qdm-page select.ops-input option,
.qdm-page select.ops-input optgroup {
  background-color: #ffffff;
  color: #0f172a;
  -webkit-text-fill-color: #0f172a;
  font-weight: 600;
}
.qdm-page .ops-input::placeholder {
  color: #64748b;
  opacity: 1;
  -webkit-text-fill-color: #64748b;
  font-weight: 500;
}
.qdm-page .ops-input:hover,
.qdm-page .card .field .ops-input:hover {
  border-color: #64748b;
  background-color: #ffffff;
  color: #0f172a;
  -webkit-text-fill-color: #0f172a;
}
.qdm-page .ops-input:focus,
.qdm-page .card .field .ops-input:focus,
.qdm-page .card .field select.ops-input:focus {
  outline: none;
  background-color: #ffffff;
  border-color: #475569;
  box-shadow: 0 0 0 3px rgba(148, 163, 184, 0.45);
  color: #0f172a;
  -webkit-text-fill-color: #0f172a;
}
.qdm-page .ops-input.ops-w-md { max-width: 240px; }
.qdm-page .ops-input.ops-w-lg { max-width: 360px; }
.qdm-page .ops-input.ops-grow { flex: 1 1 220px; min-width: 180px; max-width: 420px; }

.qdm-page .btn {
  min-height: 40px;
}
.qdm-page .btn-sm {
  min-height: 36px;
  padding: 8px 14px;
}
.qdm-act-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
}
.qdm-act-bar .btn-primary-soft {
  background: rgba(231, 111, 81, 0.16);
  color: var(--accent-light);
  border: 1px solid rgba(231, 111, 81, 0.35);
  box-shadow: none;
}
.qdm-act-bar .btn-primary-soft:hover {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}
.qdm-detail-meta {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 10px 16px;
  margin: 12px 0 0;
}
.qdm-detail-meta .meta-item {
  background: var(--bg-warm);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 12px;
}
.qdm-detail-meta .meta-label {
  display: block;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  margin-bottom: 4px;
}
.qdm-detail-meta .meta-val {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
}
.qdm-upload-card {
  max-width: 720px;
}
.qdm-upload-card .form-row {
  margin-bottom: 4px;
}
.qdm-upload-card .field {
  margin-bottom: 12px;
}
.qdm-chk-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 4px 0 14px;
  font-size: 14px;
  color: var(--text-secondary);
}
.qdm-dist-box {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: flex-end;
  margin-top: 12px;
  padding: 12px;
  background: var(--bg-warm);
  border: 1px dashed var(--border);
  border-radius: 10px;
}
.qdm-ack-line {
  margin: 12px 0 0;
  color: var(--text-secondary);
  font-size: 13px;
}

@media (max-width: 700px) {
  .qdm-filter-row .field { flex: 1 1 100%; max-width: none; }
  .qdm-page .ops-input.ops-w-md,
  .qdm-page .ops-input.ops-w-lg { max-width: none; }
}
