/* hub.mikisiamese.com — base styles, mobile-first */

:root {
  --msi-bg: #f4f5f7;
  --msi-card-bg: #ffffff;
  --msi-text: #1c1f26;
  --msi-text-muted: #6b7280;
  --msi-accent: #16233f;
  --msi-accent-hover: #22335c;
  --msi-border: #e2e4e9;
  --msi-error-bg: #fdecec;
  --msi-error-text: #b3261e;
  --msi-success-bg: #eaf7ee;
  --msi-success-text: #1e7a3c;
  --msi-radius: 10px;
}

* {
  box-sizing: border-box;
}

html, body {
  height: 100%;
}

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Noto Sans Thai", Arial, sans-serif;
  background: var(--msi-bg);
  color: var(--msi-text);
  -webkit-text-size-adjust: 100%;
}

.login-page {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 16px;
}

.login-card {
  width: 100%;
  max-width: 360px;
  background: var(--msi-card-bg);
  border: 1px solid var(--msi-border);
  border-radius: var(--msi-radius);
  padding: 32px 24px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
}

.login-logo {
  display: block;
  max-width: 160px;
  width: 100%;
  height: auto;
  margin: 0 auto 24px;
}

.login-title {
  margin: 0 0 20px;
  font-size: 18px;
  font-weight: 600;
  text-align: center;
  color: var(--msi-text);
}

.field {
  margin-bottom: 16px;
}

.field label,
.field-label-standalone {
  display: block;
  font-size: 13px;
  font-weight: 500;
  margin-bottom: 6px;
  color: var(--msi-text-muted);
}

.field input,
.field select {
  width: 100%;
  padding: 12px 14px;
  font-size: 16px; /* prevents iOS zoom-on-focus */
  border: 1px solid var(--msi-border);
  border-radius: 8px;
  background: #fff;
  color: var(--msi-text);
  min-height: 44px; /* touch target */
}

.field input:focus,
.field select:focus {
  outline: none;
  border-color: var(--msi-accent);
  box-shadow: 0 0 0 3px rgba(22, 35, 63, 0.12);
}

.field input:disabled {
  background: var(--msi-bg);
  color: var(--msi-text-muted);
}

.btn-primary {
  width: 100%;
  min-height: 44px;
  padding: 12px 14px;
  font-size: 15px;
  font-weight: 600;
  color: #fff;
  background: var(--msi-accent);
  border: none;
  border-radius: 8px;
  cursor: pointer;
  text-align: center;
  text-decoration: none;
  display: inline-block;
}

.btn-primary:hover,
.btn-primary:focus {
  background: var(--msi-accent-hover);
}

.btn-secondary {
  width: 100%;
  min-height: 44px;
  padding: 12px 14px;
  font-size: 15px;
  font-weight: 600;
  color: var(--msi-accent);
  background: #fff;
  border: 1px solid var(--msi-border);
  border-radius: 8px;
  cursor: pointer;
  text-align: center;
  text-decoration: none;
  display: inline-block;
  margin-top: 10px;
}

.btn-block {
  display: block;
}

.btn-inline {
  width: auto;
  display: inline-block;
}

.form-error {
  margin: 0 0 16px;
  padding: 10px 12px;
  font-size: 14px;
  background: var(--msi-error-bg);
  color: var(--msi-error-text);
  border-radius: 8px;
}

.login-footer {
  margin-top: 20px;
  text-align: center;
  font-size: 12px;
  color: var(--msi-text-muted);
}

@media (min-width: 480px) {
  .login-card {
    padding: 40px 32px;
  }
}

/* --- Admin section --- */

.admin-shell {
  min-height: 100vh;
  min-height: 100dvh;
}

.admin-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 16px;
  background: var(--msi-card-bg);
  border-bottom: 1px solid var(--msi-border);
}

.admin-header-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 600;
  font-size: 14px;
}

.admin-logo {
  height: 28px;
  width: auto;
}

.admin-back-link {
  margin-left: 6px;
  padding: 6px 14px;
  background: var(--msi-accent);
  color: #fff;
  font-weight: 600;
  font-size: 15px;
  border-radius: 8px;
  text-decoration: none;
}

.admin-back-link:hover,
.admin-back-link:focus {
  background: var(--msi-accent-hover);
  text-decoration: none;
}

.admin-nav {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 16px;
  font-size: 14px;
}

.admin-nav a {
  color: var(--msi-accent);
  text-decoration: none;
}

.admin-nav a:hover {
  text-decoration: underline;
}

.admin-nav-logout {
  margin: 0;
}

/* Persistent sidebar (2026-09-22) — .admin-body wraps the sidebar and
   main content side by side; the header stays a full-width bar above. */

.admin-body {
  display: flex;
  align-items: flex-start;
  max-width: 1600px; /* was 1120px — wide tables (Users) fit without scrolling (2026-10-20) */
  margin: 0 auto;
}

/* Users list: the name opens the edit form (2026-10-20). */
.user-name-link { color: inherit; text-decoration: none; font-weight: 500; }
.user-name-link:hover { color: var(--msi-accent-hover); text-decoration: underline; }

.admin-sidebar {
  width: 200px;
  flex: 0 0 200px;
  padding: 20px 12px 40px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  border-right: 1px solid var(--msi-border);
  min-height: calc(100vh - 56px);
}

.admin-sidebar-home {
  display: block;
  padding: 8px 10px;
  margin-bottom: 14px;
  font-weight: 700;
  font-size: 14px;
  border-radius: 8px;
  color: var(--msi-accent);
  text-decoration: none;
}

.admin-sidebar-group {
  margin-bottom: 18px;
}

.admin-sidebar-heading {
  padding: 0 10px;
  margin-bottom: 6px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--msi-text-muted);
}

.admin-sidebar a {
  display: block;
  padding: 8px 10px;
  font-size: 14px;
  color: var(--msi-text);
  text-decoration: none;
  border-radius: 8px;
}

.admin-sidebar a:hover {
  background: var(--msi-bg);
}

.admin-sidebar a.active {
  background: var(--msi-accent);
  color: #fff;
  font-weight: 600;
}

.admin-sidebar > a:last-child {
  margin-top: auto;
  padding-top: 12px;
  border-top: 1px solid var(--msi-border);
  border-radius: 0;
}

@media (max-width: 720px) {
  .admin-body {
    flex-direction: column;
  }

  .admin-sidebar {
    width: 100%;
    flex: none;
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    gap: 4px 6px;
    padding: 12px 16px;
    border-right: none;
    border-bottom: 1px solid var(--msi-border);
    min-height: 0;
  }

  .admin-sidebar-home {
    margin: 0 8px 0 0;
  }

  .admin-sidebar-group {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 0;
  }

  .admin-sidebar-heading {
    display: none;
  }

  .admin-sidebar > a:last-child {
    margin: 0 0 0 8px;
    padding: 8px 10px;
    border-top: none;
    border-left: 1px solid var(--msi-border);
    border-radius: 8px;
  }
}

.admin-main {
  flex: 1 1 auto;
  min-width: 0;
  padding: 20px 16px 48px;
}

.admin-title {
  font-size: 20px;
  margin: 0 0 16px;
}

.link-button {
  background: none;
  border: none;
  padding: 0;
  color: var(--msi-accent);
  font-size: 13px;
  cursor: pointer;
  text-decoration: underline;
}

.link-button-danger {
  color: var(--msi-error-text);
}

.inline-form {
  display: inline;
  margin: 0 0 0 10px;
}

.flash {
  margin: 0 0 16px;
  padding: 10px 12px;
  font-size: 14px;
  border-radius: 8px;
}

.flash-success {
  background: var(--msi-success-bg);
  color: var(--msi-success-text);
}

.flash-error {
  background: var(--msi-error-bg);
  color: var(--msi-error-text);
}

.flash-password {
  margin-top: 8px;
  font-size: 15px;
}

.flash-password code {
  background: rgba(0, 0, 0, 0.06);
  padding: 2px 6px;
  border-radius: 4px;
}

.flash-note {
  margin: 4px 0 0;
  font-size: 12px;
}

.error-list {
  margin: 0;
  padding-left: 18px;
}

.filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 16px;
  margin-bottom: 16px;
}

.filter-bar .field {
  margin-bottom: 0;
  flex: 1 1 160px;
  min-width: 160px;
}

.table-wrap {
  overflow-x: auto;
  background: var(--msi-card-bg);
  border: 1px solid var(--msi-border);
  border-radius: var(--msi-radius);
}

.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
  white-space: nowrap;
}

.table th,
.table td {
  padding: 10px 12px;
  text-align: left;
  border-bottom: 1px solid var(--msi-border);
}

.table th {
  color: var(--msi-text-muted);
  font-weight: 600;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

.table th.sortable {
  cursor: pointer;
  user-select: none;
}

.table th.sortable:hover {
  color: var(--msi-text);
}

.table th.sortable .sort-arrow {
  display: inline-block;
  margin-left: 4px;
  font-size: 9px;
}

.table th.sortable.sort-asc,
.table th.sortable.sort-desc {
  color: var(--msi-text);
}

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

.table-actions {
  white-space: nowrap;
}

.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
}

.badge-active {
  background: var(--msi-success-bg);
  color: var(--msi-success-text);
}

.badge-inactive {
  background: var(--msi-error-bg);
  color: var(--msi-error-text);
}

.text-muted {
  color: var(--msi-text-muted);
  font-size: 13px;
}

.admin-form {
  background: var(--msi-card-bg);
  border: 1px solid var(--msi-border);
  border-radius: var(--msi-radius);
  padding: 20px;
  max-width: 640px;
}

.field-row {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

@media (min-width: 560px) {
  .field-row {
    flex-direction: row;
  }

  .field-row .field {
    flex: 1;
  }
}

.checkbox-group {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 20px;
}

.checkbox-option {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 14px;
  color: var(--msi-text);
}

.checkbox-option input {
  width: auto;
  min-height: auto;
}

.form-actions {
  display: flex;
  gap: 12px;
  margin-top: 20px;
}

.form-actions .btn-primary,
.form-actions .btn-secondary {
  width: auto;
  margin-top: 0;
}

/* NAV Sync status page (2026-09-29) */
.badge-warn {
  background: #fff4e0;
  color: #8a5a00;
}

.badge-muted {
  background: #eef0f3;
  color: var(--msi-text-muted);
}

.admin-subtitle {
  margin: 28px 0 6px;
  font-size: 18px;
}

.resync-form {
  margin-top: 4px;
}

.resync-form .link-button {
  font-size: 12px;
}

/* Module permission matrix on the user form (2026-10-02) */
.perm-section {
  margin-top: 8px;
}

.perm-head {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: flex-start;
  gap: 10px;
}

.perm-sub {
  margin: 2px 0 10px;
  font-size: 12px;
}

.perm-tools {
  display: flex;
  align-items: center;
  gap: 8px;
}

.perm-chip {
  display: inline-block;
  padding: 2px 9px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  background: #fff4dc;
  color: #8a5a00;
}

.btn-secondary.perm-reset {
  width: auto;
  margin-top: 0;
  padding: 6px 12px;
  font-size: 13px;
  min-height: 34px;
}

.perm-admin-note {
  margin: 0 0 10px;
  padding: 8px 12px;
  border-radius: 8px;
  background: var(--msi-success-bg);
  color: var(--msi-success-text);
  font-size: 13px;
}

.perm-matrix {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.perm-matrix th {
  font-size: 12px;
  font-weight: 600;
  color: var(--msi-text-muted);
  text-align: center;
  padding: 8px 6px;
  border-bottom: 1px solid var(--msi-border);
  background: #fafbfc;
}

.perm-matrix th:first-child,
.perm-matrix td:first-child {
  text-align: left;
}

.perm-matrix td {
  padding: 10px 6px;
  border-bottom: 1px solid var(--msi-border);
  text-align: center;
  vertical-align: middle;
}

.perm-matrix .perm-group td {
  background: #f7f8fa;
  font-size: 12px;
  font-weight: 700;
  color: var(--msi-text-muted);
  padding: 6px;
}

.perm-matrix .perm-en {
  display: block;
  font-size: 12px;
  color: var(--msi-text-muted);
}

.perm-matrix tr.perm-off td {
  color: #aab0bc;
}

.perm-na {
  color: #c4c9d4;
}

.perm-box {
  display: inline-grid;
  place-items: center;
  cursor: pointer;
}

.perm-box input {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
}

.perm-box span {
  display: inline-grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border: 1.6px solid #c4c9d4;
  border-radius: 5px;
  background: #fff;
}

.perm-box.is-default span {
  box-shadow: 0 0 0 3px #dfe6f3;
}

.perm-box input:checked + span {
  background: var(--msi-accent);
  border-color: var(--msi-accent);
}

.perm-box input:checked + span::after {
  content: "";
  width: 6px;
  height: 11px;
  border: solid #fff;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg) translate(-1px, -1px);
}

.perm-box input:focus-visible + span {
  outline: 2px solid var(--msi-accent);
  outline-offset: 2px;
}

.perm-box input:disabled + span {
  opacity: 0.55;
  cursor: not-allowed;
}

.perm-legend {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin: 12px 0 6px;
}

.perm-legend div {
  background: #f7f8fa;
  border-radius: 8px;
  padding: 8px 10px;
  font-size: 12px;
  line-height: 1.5;
}

.perm-legend dt {
  font-weight: 700;
  font-size: 13px;
}

.perm-legend dd {
  margin: 0;
  color: var(--msi-text-muted);
}

/* =====================================================================
   Staff pages — dashboard + modules (2026-09-30, modernised).
   Everything is scoped under body.app so the admin section is untouched.
   ===================================================================== */

body.app {
  --app-bg: #f4f6fb;
  --app-surface: #ffffff;
  --app-line: #e5e8f0;
  --app-line-strong: #d3d8e4;
  --app-ink: #0f172a;
  --app-muted: #64748b;
  --app-brand: #16233f;
  --app-brand-2: #2c4a8f;
  --app-brand-soft: #eef2fb;
  --app-ok: #15803d;
  --app-ok-soft: #e9f7ee;
  --app-warn: #a16207;
  --app-warn-soft: #fdf6e3;
  --app-bad: #b91c1c;
  --app-bad-soft: #fdeeee;
  --app-radius: 14px;
  --app-radius-sm: 10px;
  --app-shadow: 0 1px 2px rgba(15, 23, 42, 0.04), 0 1px 3px rgba(15, 23, 42, 0.06);
  --app-shadow-lg: 0 8px 24px rgba(15, 23, 42, 0.08);
  font-family: "Inter", "Noto Sans Thai", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--app-bg);
  color: var(--app-ink);
  font-size: 15px;
  line-height: 1.5;
}

body.app a {
  color: var(--app-brand-2);
}

/* ---- Header ---- */

.app-header {
  position: sticky;
  top: 0;
  z-index: 20;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: saturate(180%) blur(8px);
  border-bottom: 1px solid var(--app-line);
}

.app-header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  max-width: 1600px;
  height: 60px;
  margin: 0 auto;
  padding: 0 20px;
}

.app-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 16px;
  letter-spacing: -0.01em;
  color: var(--app-ink) !important;
  text-decoration: none;
  white-space: nowrap;
}

.app-logo {
  height: 28px;
  width: auto;
}

.app-nav {
  display: flex;
  align-items: center;
  gap: 6px;
}

.app-nav-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 36px;
  padding: 0 12px;
  border-radius: 999px;
  font-size: 14px;
  font-weight: 600;
  color: var(--app-muted) !important;
  text-decoration: none;
}

.app-nav-link:hover,
.app-nav-link.active {
  background: var(--app-brand-soft);
  color: var(--app-brand) !important;
}

.app-user {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: 6px;
  padding-left: 12px;
  border-left: 1px solid var(--app-line);
}

.app-avatar {
  display: inline-grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--app-brand), var(--app-brand-2));
  color: #fff;
  font-size: 14px;
  font-weight: 700;
}

.app-user-name {
  font-size: 14px;
  font-weight: 600;
}

.app-logout {
  margin: 0;
}

.icon-button {
  display: inline-grid;
  place-items: center;
  width: 34px;
  height: 34px;
  padding: 0;
  border: none;
  border-radius: 50%;
  background: transparent;
  color: var(--app-muted);
  cursor: pointer;
}

.icon-button:hover {
  background: var(--app-bad-soft);
  color: var(--app-bad);
}

@media (max-width: 560px) {
  .app-user-name,
  .app-nav-link span {
    display: none;
  }

  .app-header-inner {
    padding: 0 14px;
  }
}

/* ---- Page frame ---- */

.app-main {
  max-width: 1600px;
  margin: 0 auto;
  padding: 24px 20px 64px;
}

.app-main.wide {
  max-width: 1600px;
}

.page-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px 20px;
  margin-bottom: 20px;
}

.page-title {
  margin: 0;
  font-size: 24px;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.page-sub {
  margin: 4px 0 0;
  color: var(--app-muted);
  font-size: 14px;
}

.page-actions {
  display: flex;
  gap: 10px;
}

.app-back {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-bottom: 10px;
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
}

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

body.app .flash {
  border-radius: var(--app-radius-sm);
  padding: 12px 16px;
  margin-bottom: 20px;
  font-weight: 500;
}

body.app .flash-success {
  background: var(--app-ok-soft);
  color: var(--app-ok);
}

body.app .flash-error {
  background: var(--app-bad-soft);
  color: var(--app-bad);
}

/* ---- Cards ---- */

.card {
  background: var(--app-surface);
  border: 1px solid var(--app-line);
  border-radius: var(--app-radius);
  box-shadow: var(--app-shadow);
  padding: 20px;
  margin-bottom: 20px;
}

.card-title {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 16px;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--app-muted);
}

.card-accent {
  border-color: var(--app-brand-2);
  box-shadow: 0 0 0 3px var(--app-brand-soft), var(--app-shadow);
}

/* ---- Buttons ---- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 42px;
  padding: 0 18px;
  border: 1px solid transparent;
  border-radius: var(--app-radius-sm);
  font: inherit;
  font-size: 15px;
  font-weight: 600;
  text-decoration: none !important;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s, box-shadow 0.15s;
}

.btn-brand {
  background: var(--app-brand);
  color: #fff !important;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.2);
}

.btn-brand:hover {
  background: var(--app-brand-2);
}

.btn-ghost {
  background: var(--app-surface);
  border-color: var(--app-line-strong);
  color: var(--app-ink) !important;
}

.btn-ghost:hover {
  background: var(--app-bg);
}

.btn-lg {
  height: 48px;
  padding: 0 24px;
  font-size: 16px;
}

/* ---- Dashboard ---- */

.hello {
  margin-bottom: 24px;
}

.hello h1 {
  margin: 0;
  font-size: 26px;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.hello p {
  margin: 4px 0 0;
  color: var(--app-muted);
}

.notice {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 18px 20px;
  margin-bottom: 28px;
  border-radius: var(--app-radius);
  background: linear-gradient(135deg, var(--app-brand) 0%, var(--app-brand-2) 100%);
  color: #fff;
  box-shadow: var(--app-shadow-lg);
}

.notice-icon {
  display: grid;
  place-items: center;
  flex: 0 0 44px;
  height: 44px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.15);
}

.notice-title {
  margin: 0;
  font-size: 16px;
  font-weight: 700;
}

.notice-body {
  margin: 2px 0 0;
  font-size: 14px;
  opacity: 0.85;
}

.group-title {
  margin: 0 0 12px;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--app-muted);
}

.tile-section {
  margin-bottom: 28px;
}

.tile-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 14px;
}

.tile {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px;
  background: var(--app-surface);
  border: 1px solid var(--app-line);
  border-radius: var(--app-radius);
  box-shadow: var(--app-shadow);
  color: var(--app-ink) !important;
  text-decoration: none;
  transition: transform 0.15s, box-shadow 0.15s, border-color 0.15s;
}

.tile:hover,
.tile:focus-visible {
  transform: translateY(-2px);
  border-color: var(--app-line-strong);
  box-shadow: var(--app-shadow-lg);
}

.tile-icon {
  display: grid;
  place-items: center;
  flex: 0 0 48px;
  height: 48px;
  border-radius: 12px;
  background: var(--app-brand-soft);
  color: var(--app-brand-2);
}

.tile-icon svg {
  width: 24px;
  height: 24px;
}

.tile-text {
  display: flex;
  flex-direction: column;
  min-width: 0;
  flex: 1;
}

.tile-name {
  font-weight: 700;
  font-size: 16px;
}

.tile-desc {
  font-size: 13px;
  color: var(--app-muted);
}

.tile-arrow {
  color: var(--app-line-strong);
  font-size: 20px;
}

.tile:hover .tile-arrow {
  color: var(--app-brand-2);
}

.empty-state {
  padding: 32px;
  text-align: center;
  color: var(--app-muted);
}

/* ---- Forms ---- */

body.app .field {
  margin-bottom: 16px;
}

body.app .field:last-child {
  margin-bottom: 0;
}

body.app .field label,
body.app .field-label {
  display: block;
  margin-bottom: 6px;
  font-size: 13px;
  font-weight: 600;
  color: #334155;
}

body.app .req {
  color: var(--app-bad);
}

body.app .field input,
body.app .field select,
body.app .field textarea,
body.app .input-table input {
  width: 100%;
  height: 42px;
  min-height: 0;
  padding: 0 12px;
  font: inherit;
  font-size: 15px;
  color: var(--app-ink);
  background: #fff;
  border: 1px solid var(--app-line-strong);
  border-radius: var(--app-radius-sm);
  transition: border-color 0.15s, box-shadow 0.15s;
}

body.app .field textarea {
  height: auto;
  min-height: 88px;
  padding: 10px 12px;
  resize: vertical;
}

body.app .field input:focus,
body.app .field select:focus,
body.app .field textarea:focus,
body.app .input-table input:focus {
  outline: none;
  border-color: var(--app-brand-2);
  box-shadow: 0 0 0 3px rgba(44, 74, 143, 0.15);
}

body.app .field input[readonly] {
  background: var(--app-bg);
  color: var(--app-muted);
}

.field-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px 16px;
}

.field-grid .field {
  margin-bottom: 0 !important;
}

.field-grid .span-2 {
  grid-column: span 2;
}

.field-hint {
  margin-top: 6px;
  font-size: 12px;
  color: var(--app-muted);
}

.input-group {
  display: flex;
  gap: 8px;
}

.input-group input {
  flex: 1;
  min-width: 0;
}

.segmented {
  display: flex;
  padding: 4px;
  gap: 4px;
  background: var(--app-bg);
  border: 1px solid var(--app-line);
  border-radius: 12px;
}

.segmented label {
  position: relative;
  flex: 1;
  margin: 0 !important;
}

.segmented input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  opacity: 0;
  cursor: pointer;
}

.segmented span {
  display: block;
  padding: 8px 6px;
  border-radius: 9px;
  text-align: center;
  font-size: 14px;
  font-weight: 700;
  color: var(--app-muted);
  transition: background 0.15s, color 0.15s;
}

.segmented input:checked + span {
  background: #fff;
  color: var(--app-brand);
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.12);
}

.segmented input:focus-visible + span {
  box-shadow: 0 0 0 3px rgba(44, 74, 143, 0.25);
}

.info-strip {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-top: 10px;
  padding: 12px 14px;
  background: var(--app-brand-soft);
  border-radius: var(--app-radius-sm);
}

.info-strip div {
  min-width: 0;
}

.info-strip dt,
.kv dt {
  font-size: 12px;
  color: var(--app-muted);
}

.info-strip dd {
  margin: 0;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.status-line {
  margin-top: 6px;
  font-size: 13px;
}

.status-line .ok,
.nav-value .ok {
  color: var(--app-ok);
  font-weight: 600;
}

.status-line .warn,
.nav-value .warn {
  color: var(--app-warn);
  font-weight: 500;
}

.nav-value {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 42px;
  padding: 0 12px;
  background: var(--app-ok-soft);
  border-radius: var(--app-radius-sm);
  font-size: 15px;
}

.nav-value.is-warn {
  height: auto;
  padding: 8px 12px;
  margin-bottom: 8px;
  background: var(--app-warn-soft);
  font-size: 13px;
}

.nav-value:empty {
  display: none;
}

.chip {
  display: inline-block;
  padding: 1px 8px;
  border-radius: 999px;
  background: rgba(21, 128, 61, 0.12);
  color: var(--app-ok);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.03em;
}

.chip-muted {
  background: var(--app-bg);
  color: var(--app-muted);
}

.input-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0 8px;
  margin-top: -8px;
}

.input-table th {
  padding: 0 4px;
  text-align: left;
  font-size: 12px;
  font-weight: 600;
  color: var(--app-muted);
}

.input-table td {
  padding: 0 4px;
}

.input-table td:first-child {
  width: 64px;
  font-weight: 700;
}

.form-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr);
  gap: 20px;
  align-items: start;
}

.form-layout .card {
  margin-bottom: 20px;
}

.action-bar {
  position: sticky;
  bottom: 0;
  z-index: 10;
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin: 4px -20px 0;
  padding: 14px 20px;
  background: rgba(244, 246, 251, 0.92);
  backdrop-filter: blur(6px);
  border-top: 1px solid var(--app-line);
}

@media (max-width: 900px) {
  .form-layout {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 560px) {
  .field-grid,
  .info-strip {
    grid-template-columns: 1fr;
  }

  .field-grid .span-2 {
    grid-column: auto;
  }
}

/* ---- Lists ---- */

.toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 12px;
  margin-bottom: 16px;
}

.toolbar .field {
  margin: 0 !important;
  min-width: 180px;
}

.toolbar .field.grow {
  flex: 1;
  min-width: 240px;
}

.toolbar-count {
  margin-left: auto;
  padding-bottom: 10px;
  font-size: 14px;
  color: var(--app-muted);
}

.data-table-wrap {
  overflow-x: auto;
  background: var(--app-surface);
  border: 1px solid var(--app-line);
  border-radius: var(--app-radius);
  box-shadow: var(--app-shadow);
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
}

.data-table th {
  position: sticky;
  top: 0;
  padding: 11px 10px;
  background: #f8fafc;
  border-bottom: 1px solid var(--app-line);
  text-align: left;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: var(--app-muted);
  white-space: nowrap;
}

.data-table td {
  padding: 12px 10px;
  border-bottom: 1px solid var(--app-line);
  white-space: nowrap;
}

.data-table tbody tr:last-child td {
  border-bottom: none;
}

.data-table th.sortable {
  cursor: pointer;
  user-select: none;
}

.data-table th.sortable:hover,
.data-table th.sort-asc,
.data-table th.sort-desc {
  color: var(--app-ink);
}

.data-table .sort-arrow {
  margin-left: 4px;
  font-size: 9px;
}

.data-table tr.row-link {
  cursor: pointer;
}

.data-table tr.row-link:hover td {
  background: #f8fafc;
}

.data-table .mono {
  font-variant-numeric: tabular-nums;
}

.data-table .strong {
  font-weight: 700;
}

/* ---- Status badges ---- */

.status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.status::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}

.status-lg {
  padding: 5px 12px;
  font-size: 13px;
}

.status-reported { background: #e8effd; color: #1d4ed8; }
.status-recast { background: var(--app-warn-soft); color: var(--app-warn); }
.status-store_withdraw { background: #f3ecfd; color: #7e22ce; }
.status-management_review { background: var(--app-bad-soft); color: var(--app-bad); }
.status-closed { background: #eef1f5; color: var(--app-muted); }

/* ---- Detail view ---- */

.detail-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 14px;
}

.detail-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr);
  gap: 20px;
  align-items: start;
}

@media (max-width: 900px) {
  .detail-layout {
    grid-template-columns: 1fr;
  }
}

.kv {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px 20px;
  margin: 0;
}

.kv.one-col {
  grid-template-columns: 1fr;
}

.kv dd {
  margin: 2px 0 0;
  font-weight: 600;
}

.kv dd .sub {
  display: block;
  font-weight: 400;
  font-size: 13px;
  color: var(--app-muted);
}

.mini-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.mini-table th,
.mini-table td {
  padding: 8px 10px;
  border-bottom: 1px solid var(--app-line);
  text-align: right;
}

.mini-table th {
  font-size: 12px;
  color: var(--app-muted);
  font-weight: 600;
}

.mini-table th:first-child,
.mini-table td:first-child {
  text-align: left;
  font-weight: 700;
}

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

.pre-line {
  white-space: pre-line;
  margin: 0;
}

.timeline {
  position: relative;
  margin: 0;
  padding: 0 0 0 22px;
  list-style: none;
}

.timeline::before {
  content: "";
  position: absolute;
  top: 6px;
  bottom: 6px;
  left: 6px;
  width: 2px;
  background: var(--app-line);
}

.timeline li {
  position: relative;
  padding-bottom: 18px;
  font-size: 14px;
}

.timeline li:last-child {
  padding-bottom: 0;
}

.timeline li::before {
  content: "";
  position: absolute;
  top: 5px;
  left: -21px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #fff;
  border: 2px solid var(--app-brand-2);
}

.timeline-title {
  font-weight: 700;
}

.timeline-meta {
  font-size: 12px;
  color: var(--app-muted);
}

.timeline-note {
  margin-top: 4px;
  padding: 8px 10px;
  background: var(--app-bg);
  border-radius: 8px;
  white-space: pre-line;
}

.total-card {
  background: linear-gradient(135deg, #ffffff 0%, var(--app-brand-soft) 100%);
}

.total-amount {
  font-size: 30px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--app-brand);
  font-variant-numeric: tabular-nums;
}

.total-breakdown {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin: 12px 0 0;
  padding-top: 12px;
  border-top: 1px solid var(--app-line);
}

.total-breakdown dt {
  font-size: 12px;
  color: var(--app-muted);
}

.total-breakdown dd {
  margin: 0;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.data-table th.num,
.data-table td.num {
  text-align: right;
}

/* ---- Header menu dropdown + dashboard layout (menu / งานของฉัน) ---- */

.app-menu {
  position: relative;
}

.app-menu summary {
  list-style: none;
  cursor: pointer;
}

.app-menu summary::-webkit-details-marker {
  display: none;
}

.app-menu[open] summary {
  background: var(--app-brand-soft);
  color: var(--app-brand) !important;
}

.app-menu-panel {
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  width: 280px;
  max-height: 70vh;
  overflow-y: auto;
  padding: 12px;
  background: var(--app-surface);
  border: 1px solid var(--app-line);
  border-radius: var(--app-radius);
  box-shadow: var(--app-shadow-lg);
}

.menu-group {
  margin-top: 10px;
}

.menu-heading {
  padding: 4px 10px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--app-muted);
}

.menu-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 10px;
  color: var(--app-ink) !important;
  font-weight: 600;
  text-decoration: none;
}

.menu-link:hover,
.menu-link.active {
  background: var(--app-brand-soft);
  color: var(--app-brand) !important;
}

.menu-icon {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 8px;
  background: var(--app-brand-soft);
  color: var(--app-brand-2);
}

.menu-icon svg {
  width: 16px;
  height: 16px;
}

.dash-layout {
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  gap: 24px;
  align-items: start;
}

.dash-menu {
  position: sticky;
  top: 84px;
}

.dash-menu .menu-group:first-of-type {
  margin-top: 0;
}

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

  .dash-menu {
    display: none; /* phones use the header "เมนู" button */
  }
}

.widget-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}

.widget {
  margin: 0;
  padding: 16px;
}

.widget-head {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 8px;
  color: var(--app-ink) !important;
  text-decoration: none;
}

.widget-head .tile-icon {
  flex-basis: 40px;
  height: 40px;
}

.widget-title {
  flex: 1;
  font-weight: 700;
  font-size: 16px;
}

.widget-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 4px;
  border-top: 1px solid var(--app-line);
  color: var(--app-ink) !important;
  text-decoration: none;
  font-size: 14px;
}

a.widget-row:hover {
  color: var(--app-brand-2) !important;
}

.count {
  min-width: 32px;
  padding: 2px 10px;
  border-radius: 999px;
  text-align: center;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.count-bad { background: var(--app-bad-soft); color: var(--app-bad); }
.count-warn { background: var(--app-warn-soft); color: var(--app-warn); }
.count-brand { background: var(--app-brand-soft); color: var(--app-brand-2); }
.count-muted { background: var(--app-bg); color: var(--app-muted); }

.widget-foot {
  margin: 8px 0 0;
  padding-top: 10px;
  border-top: 1px solid var(--app-line);
  font-size: 13px;
  color: var(--app-muted);
}

.menu-empty {
  margin: 0;
  padding: 8px 10px;
}

.input-table th.col-desc {
  width: 34%;
}

.kv-3 {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

@media (max-width: 700px) {
  .kv-3 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.mini-table th.left,
.mini-table td.left {
  text-align: left;
  font-weight: 400;
}

@media (max-width: 560px) {
  .app-menu-panel {
    position: fixed;
    top: 68px;
    left: 12px;
    right: 12px;
    width: auto;
  }
}

/* ---- Mobile: ☰ button + slide-in drawer from the left (≤ 900px) ---- */

.hamburger {
  display: none;
  place-items: center;
  width: 40px;
  height: 40px;
  margin-left: -8px;
  padding: 0;
  border: none;
  border-radius: 10px;
  background: transparent;
  color: var(--app-ink);
  cursor: pointer;
}

.hamburger:hover {
  background: var(--app-brand-soft);
}

.drawer {
  position: fixed;
  top: 0;
  bottom: 0;
  left: 0;
  z-index: 50;
  display: flex;
  flex-direction: column;
  width: min(300px, 85vw);
  background: var(--app-surface);
  box-shadow: 8px 0 32px rgba(15, 23, 42, 0.18);
  transform: translateX(-105%);
  transition: transform 0.22s ease;
  visibility: hidden;
}

.drawer.open {
  transform: translateX(0);
  visibility: visible;
}

.drawer-overlay {
  position: fixed;
  inset: 0;
  z-index: 40;
  background: rgba(15, 23, 42, 0.4);
}

body.drawer-open {
  overflow: hidden;
}

.drawer-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 16px;
  border-bottom: 1px solid var(--app-line);
}

.drawer-user {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-width: 0;
  line-height: 1.3;
}

.drawer-user span {
  font-size: 12px;
  color: var(--app-muted);
}

.drawer-close:hover {
  background: var(--app-bg);
  color: var(--app-ink);
}

.drawer-body {
  flex: 1;
  overflow-y: auto;
  padding: 12px;
}

.drawer-body .menu-group {
  margin-top: 14px;
}

.drawer-foot {
  margin: 0;
  padding: 12px 16px 20px;
  border-top: 1px solid var(--app-line);
}

@media (max-width: 900px) {
  .hamburger {
    display: grid;
  }

  .app-menu,
  .app-nav-link,
  .app-user .app-user-name {
    display: none;
  }

  .app-header-inner {
    gap: 8px;
  }

  .app-brand {
    margin-right: auto;
  }

  .app-user {
    border-left: none;
    padding-left: 0;
  }
}

@media (min-width: 901px) {
  .drawer,
  .drawer-overlay {
    display: none !important;
  }
}

/* ---- Server-side list: sort links, compact filters, pager ---- */

.data-table th.sortable a {
  color: inherit !important;
  text-decoration: none;
}

.toolbar .field.field-sm {
  min-width: 130px;
}

.pager {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 6px;
  margin-top: 20px;
}

.pager-btn {
  display: inline-grid;
  place-items: center;
  min-width: 38px;
  height: 38px;
  padding: 0 12px;
  border: 1px solid var(--app-line-strong);
  border-radius: var(--app-radius-sm);
  background: var(--app-surface);
  color: var(--app-ink) !important;
  font-weight: 600;
  text-decoration: none;
}

a.pager-btn:hover {
  background: var(--app-brand-soft);
  border-color: var(--app-brand-2);
}

.pager-btn.current {
  background: var(--app-brand);
  border-color: var(--app-brand);
  color: #fff !important;
}

.pager-gap {
  padding: 0 4px;
  color: var(--app-muted);
}

.toolbar input[type="date"] {
  min-width: 160px;
}

.status-found { background: var(--app-ok-soft); color: var(--app-ok); }

.field-grid-3 {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

@media (max-width: 560px) {
  .field-grid-3 {
    grid-template-columns: 1fr;
  }
}

.status-rejected { background: #eef1f5; color: var(--app-bad); }

details.edit-values > summary {
  cursor: pointer;
  list-style: none;
  margin-bottom: 0;
}

details.edit-values > summary::-webkit-details-marker {
  display: none;
}

details.edit-values > summary::before {
  content: "▸";
  margin-right: 6px;
}

details.edit-values[open] > summary {
  margin-bottom: 16px;
}

details.edit-values[open] > summary::before {
  content: "▾";
}

/* =====================================================================
   รายงานการประชุม / Meeting Minutes module (2026-10-02). Prefix mm-.
   ===================================================================== */

.mm-tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 16px;
  border-bottom: 1px solid var(--app-line);
}

.mm-tab {
  padding: 10px 16px;
  margin-bottom: -1px;
  border-bottom: 2px solid transparent;
  font-weight: 600;
  color: var(--app-muted) !important;
  text-decoration: none;
}

.mm-tab.active {
  color: var(--app-brand) !important;
  border-bottom-color: var(--app-brand-2);
}

.mm-tab-badge {
  margin-left: 6px;
  padding: 1px 8px;
  border-radius: 999px;
  background: var(--app-bad-soft);
  color: var(--app-bad);
  font-size: 12px;
}

.mm-check {
  display: flex;
  align-items: center;
  gap: 6px;
  height: 42px;
  padding: 0 12px;
  border: 1px solid var(--app-line-strong);
  border-radius: var(--app-radius-sm);
  background: #fff;
  font-size: 14px;
  white-space: nowrap;
  cursor: pointer;
}

.mm-check input {
  width: 16px;
  height: 16px;
}

.mm-type {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 999px;
  background: #f5f3ff;
  color: #6d28d9;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}

.mm-round {
  margin-left: 6px;
  font-size: 12px;
  color: var(--app-muted);
}

.mm-no,
.mm-mono {
  font-family: Inter, sans-serif;
  font-weight: 700;
  color: var(--app-brand-2);
}

.mm-no {
  font-size: 15px;
}

.mm-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}

.mm-pill-draft { background: #f1f5f9; color: #475569; }
.mm-pill-published { background: var(--app-ok-soft); color: var(--app-ok); }
.mm-act-open { background: var(--app-brand-soft); color: var(--app-brand-2); }
.mm-act-done { background: var(--app-ok-soft); color: var(--app-ok); }
.mm-act-late { background: var(--app-bad-soft); color: var(--app-bad); }
.mm-act-cancelled { background: #f1f5f9; color: #94a3b8; text-decoration: line-through; }
.mm-att-present { background: var(--app-ok-soft); color: var(--app-ok); }
.mm-att-absent { background: var(--app-bad-soft); color: var(--app-bad); }
.mm-att-leave { background: var(--app-warn-soft); color: var(--app-warn); }

.mm-prog {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--app-muted);
}

.mm-bar {
  display: inline-block;
  width: 80px;
  height: 6px;
  border-radius: 9px;
  background: #e8ebf2;
  overflow: hidden;
  vertical-align: middle;
}

.mm-bar i {
  display: block;
  height: 100%;
  background: var(--app-ok);
}

.mm-bar-wide {
  width: 100%;
  height: 8px;
}

.mm-late {
  color: var(--app-bad) !important;
  font-weight: 600;
  font-size: inherit;
}

span.mm-late {
  margin-left: 4px;
  font-size: 12px;
}

.mm-small {
  font-size: 13px;
}

.mm-empty {
  margin: 4px 0;
}

/* ---- form ---- */

.mm-grid2 {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 20px;
  align-items: start;
}

.mm-row {
  display: flex;
  gap: 12px;
}

.mm-row > .field {
  flex: 1;
  min-width: 0;
}

.mm-row2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.mm-timepair {
  display: flex;
  align-items: center;
  gap: 6px;
}

body.app .mm-timepair input {
  padding: 0 8px;
}

.mm-warn {
  color: var(--app-bad) !important;
  font-weight: 600;
}

.mm-card-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 10px;
  margin-bottom: 8px;
}

.mm-card-head .card-title {
  margin-bottom: 8px;
}

.mm-att {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 0;
  border-bottom: 1px solid var(--app-line);
}

.mm-att:last-child {
  border-bottom: none;
}

.mm-av {
  display: inline-grid;
  flex: none;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--app-brand), var(--app-brand-2));
  color: #fff;
  font-size: 13px;
  font-weight: 700;
}

.mm-av.ext {
  background: #e2e8f0;
  color: #475569;
}

.mm-att-name {
  flex: 1;
  min-width: 0;
}

.mm-att-name b {
  display: block;
  font-weight: 600;
}

.mm-att-name small {
  color: var(--app-muted);
  font-size: 12px;
}

.segmented.mm-seg {
  flex: none;
  padding: 2px;
  gap: 2px;
  border-radius: 9px;
}

.segmented.mm-seg span {
  padding: 4px 10px;
  font-size: 12px;
  border-radius: 7px;
}

.segmented.mm-seg input:checked + .mm-seg-present,
.segmented.mm-seg input:checked + .mm-fs-done { background: var(--app-ok-soft); color: var(--app-ok); }
.segmented.mm-seg input:checked + .mm-seg-absent,
.segmented.mm-seg input:checked + .mm-fs-cancelled { background: var(--app-bad-soft); color: var(--app-bad); }
.segmented.mm-seg input:checked + .mm-seg-leave { background: var(--app-warn-soft); color: var(--app-warn); }
.segmented.mm-seg input:checked + .mm-fs-open { background: var(--app-brand-soft); color: var(--app-brand-2); }

.icon-button.mm-x {
  flex: none;
  font-size: 18px;
  color: #94a3b8;
}

.mm-add-row {
  display: flex;
  gap: 8px;
  margin-top: 10px;
}

body.app .mm-add-row input {
  flex: 1;
  min-width: 0;
  height: 40px;
  padding: 0 12px;
  font: inherit;
  font-size: 14px;
  border: 1px solid var(--app-line-strong);
  border-radius: var(--app-radius-sm);
}

.mm-add-row.mm-ext input:first-child {
  flex: 1.3;
}

.mm-agenda {
  border: 1px solid var(--app-line);
  border-radius: 12px;
  padding: 14px;
  margin-bottom: 14px;
  background: #fff;
}

.mm-agenda-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}

body.app .mm-agenda-head input[type="text"] {
  flex: 1;
  height: 40px;
  padding: 0 12px;
  font: inherit;
  font-size: 15px;
  font-weight: 600;
  border: 1px solid var(--app-line-strong);
  border-radius: var(--app-radius-sm);
}

.mm-anum {
  flex: none;
  display: inline-block;
  margin-right: 8px;
  padding: 3px 10px;
  border-radius: 8px;
  background: var(--app-brand);
  color: #fff;
  font-size: 13px;
  font-weight: 700;
}

.mm-agenda-head .mm-anum {
  margin-right: 0;
}

.mm-move {
  display: flex;
  gap: 2px;
}

.mm-move .icon-button:disabled {
  opacity: 0.3;
  cursor: default;
}

.mm-ai {
  margin-top: 4px;
  padding: 12px;
  border: 1px solid var(--app-line);
  border-radius: 10px;
  background: #f8fafc;
}

.mm-ai h4 {
  margin: 0 0 8px;
  font-size: 13px;
}

.mm-airow {
  display: grid;
  grid-template-columns: minmax(0, 2.4fr) minmax(0, 1.3fr) minmax(0, 0.9fr) 32px;
  gap: 8px;
  margin-bottom: 8px;
}

body.app .mm-airow input,
body.app .mm-airow select,
body.app .mm-follow-table input[type="text"] {
  width: 100%;
  height: 38px;
  padding: 0 10px;
  font: inherit;
  font-size: 14px;
  background: #fff;
  border: 1px solid var(--app-line-strong);
  border-radius: var(--app-radius-sm);
}

.mm-link {
  padding: 4px 0;
  border: none;
  background: none;
  color: var(--app-brand-2);
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}

.mm-addbig {
  width: 100%;
  padding: 14px;
  border: 1.5px dashed var(--app-line-strong);
  border-radius: 12px;
  background: none;
  color: var(--app-brand-2);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}

.mm-addbig:hover {
  background: var(--app-brand-soft);
}

.mm-follow {
  border-color: #c9d5f0;
}

.mm-follow-table td {
  white-space: normal;
  vertical-align: middle;
}

.mm-follow-table td:nth-child(6) {
  min-width: 200px;
}

.mm-drop {
  position: relative;
  display: block;
  margin-top: 10px;
  padding: 18px;
  border: 1.5px dashed var(--app-line-strong);
  border-radius: 12px;
  text-align: center;
  color: var(--app-muted);
  cursor: pointer;
}

.mm-drop.over {
  background: var(--app-brand-soft);
  border-color: var(--app-brand-2);
}

.mm-drop input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.mm-picked {
  margin: 8px 0 0;
  padding-left: 20px;
  font-size: 14px;
}

.mm-bar-right {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-left: auto;
}

.action-bar .btn-ghost:first-child {
  margin-right: auto;
}

/* ---- files ---- */

.mm-file {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 0;
  border-bottom: 1px solid var(--app-line);
}

.mm-file:last-of-type {
  border-bottom: none;
}

.mm-file-icon {
  display: inline-grid;
  flex: none;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 8px;
  font-size: 10px;
  font-weight: 700;
  background: #f1f5f9;
  color: #475569;
}

.mm-file-pdf { background: #fdeeee; color: #b91c1c; }
.mm-file-xls { background: #e9f7ee; color: #15803d; }
.mm-file-doc { background: #e8f0fe; color: #1d4ed8; }
.mm-file-ppt { background: #fff1e6; color: #c2410c; }
.mm-file-img { background: var(--app-brand-soft); color: var(--app-brand-2); }

.mm-file-name {
  flex: 1;
  min-width: 0;
  font-weight: 600;
  overflow-wrap: anywhere;
}

.mm-file-name span {
  display: block;
  font-size: 12px;
  font-weight: 400;
}

.mm-remove {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--app-bad);
  white-space: nowrap;
}

/* ---- view ---- */

.mm-ag {
  padding: 14px 0;
  border-bottom: 1px solid var(--app-line);
}

.mm-ag:first-of-type {
  padding-top: 0;
}

.mm-ag:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.mm-ag h3 {
  display: flex;
  align-items: center;
  margin: 0 0 8px;
  font-size: 16px;
}

.mm-ag p {
  margin: 0 0 6px;
  color: #334155;
}

.mm-concl {
  margin: 8px 0 4px;
  padding: 8px 12px;
  border-left: 3px solid var(--app-brand-2);
  border-radius: 0 8px 8px 0;
  background: var(--app-brand-soft);
}

.mm-concl b {
  display: block;
  font-size: 12px;
  color: var(--app-brand-2);
}

.mini-table.mm-mini {
  margin-top: 10px;
  border: 1px solid var(--app-line);
  border-radius: 10px;
  border-collapse: separate;
  border-spacing: 0;
  overflow: hidden;
}

.mini-table.mm-mini th,
.mini-table.mm-mini td {
  text-align: left;
  font-weight: 400;
  vertical-align: top;
}

.mini-table.mm-mini th {
  background: #fafbfc;
  font-weight: 600;
}

.mm-mini td:first-child {
  font-weight: 500;
}

.mm-note {
  display: block;
  margin-top: 2px;
  font-size: 12px;
  color: var(--app-muted);
}

.mm-trail td {
  padding-top: 0 !important;
  font-size: 12px;
  color: var(--app-muted);
}

.mm-trail span {
  display: inline-block;
  margin-right: 14px;
}

.mm-upd-cell {
  width: 1%;
  white-space: nowrap;
  text-align: right !important;
}

.mm-upd summary {
  list-style: none;
}

.mm-upd summary::-webkit-details-marker {
  display: none;
}

.btn.mm-btn-sm {
  height: 30px;
  padding: 0 10px;
  font-size: 13px;
}

.mm-upd-form {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 6px;
  margin-top: 6px;
}

body.app .mm-upd-form input[type="text"],
body.app .mm-del-form input[type="text"] {
  width: 220px;
  height: 32px;
  padding: 0 8px;
  font: inherit;
  font-size: 13px;
  border: 1px solid var(--app-line-strong);
  border-radius: 8px;
}

.mm-kv dt {
  font-size: 12px;
}

.mm-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
}

.mm-inline-form {
  display: inline;
  margin: 0;
}

.mm-danger {
  border-color: #f3c7c7;
}

.btn.mm-btn-danger,
.mm-danger-link {
  color: var(--app-bad) !important;
}

.mm-del-form {
  display: flex;
  gap: 8px;
  margin-top: 8px;
}

/* ---- settings ---- */

.mm-type-form {
  margin-bottom: 20px;
}

.mm-filter {
  width: 260px;
  height: 34px;
  padding: 0 10px;
  font: inherit;
  font-size: 14px;
  border: 1px solid var(--app-line-strong);
  border-radius: 8px;
}

.mm-member-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 4px 12px;
  max-height: 320px;
  overflow-y: auto;
  padding: 8px;
  border: 1px solid var(--app-line);
  border-radius: var(--app-radius-sm);
}

body.app .mm-member {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin: 0;
  padding: 6px;
  border-radius: 8px;
  font-weight: 400;
  cursor: pointer;
}

body.app .mm-member input {
  width: 16px;
  height: 16px;
  min-height: 0;
  padding: 0;
  margin-top: 3px;
  flex: none;
}

.mm-member:hover {
  background: var(--app-bg);
}

.mm-member b {
  display: block;
  font-weight: 600;
  color: var(--app-ink);
}

.mm-member small {
  color: var(--app-muted);
  font-size: 12px;
}

.mm-member[hidden] {
  display: none;
}

.mm-row-off td {
  color: #94a3b8;
}

.mm-actions-cell {
  text-align: right;
}

@media (max-width: 900px) {
  .mm-grid2,
  .mm-row2 {
    grid-template-columns: 1fr;
  }

  .mm-row {
    flex-direction: column;
    gap: 0;
  }

  .mm-airow {
    grid-template-columns: 1fr 1fr 32px;
  }

  .mm-airow input[type="text"] {
    grid-column: 1 / -1;
  }
}

.perm-chip[hidden],
.perm-admin-note[hidden] {
  display: none;
}

.segmented.mm-seg label {
  flex: none;
}

.segmented.mm-seg span {
  white-space: nowrap;
}

.mm-row > .field:has(.mm-timepair) {
  flex: 1.5;
}

body.app .mm-timepair input {
  min-width: 0;
  flex: 1;
}

/* ==== ซ่อมบำรุง / Maintenance (2026-10-05) — all classes start with mt- ==== */

body.app .mt-tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--app-line); margin: 0 0 16px; overflow-x: auto; }
body.app .mt-tabs a { padding: 10px 16px; font-weight: 600; color: var(--app-muted); border-bottom: 2px solid transparent; text-decoration: none; white-space: nowrap; }
body.app .mt-tabs a.on { color: var(--app-brand); border-color: var(--app-brand); }

/* status pills */
body.app .mt-st-reported { background: #e8effd; color: #1d4ed8; }
body.app .mt-st-assigned { background: #e0f2fe; color: #0369a1; }
body.app .mt-st-in_progress { background: var(--app-warn-soft); color: var(--app-warn); }
body.app .mt-st-waiting_parts { background: #f3ecfd; color: #7e22ce; }
body.app .mt-st-pending_approval { background: #fff1e6; color: #c2410c; }
body.app .mt-st-outsourced { background: #fdf2f8; color: #be185d; }
body.app .mt-st-done { background: var(--app-ok-soft); color: var(--app-ok); }
body.app .mt-st-closed { background: #eef1f5; color: var(--app-muted); }
body.app .mt-st-cancelled { background: #eef1f5; color: var(--app-muted); }
body.app .mt-st-rejected { background: #eef1f5; color: var(--app-bad); }

body.app .mt-urg { display: inline-flex; align-items: center; gap: 6px; font-weight: 700; font-size: 13px; white-space: nowrap; }
body.app .mt-urg i { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }
body.app .mt-urg-1 { color: #b91c1c; } body.app .mt-urg-1 i { background: #dc2626; }
body.app .mt-urg-2 i { background: #f59e0b; }
body.app .mt-urg-3 { color: var(--app-muted); } body.app .mt-urg-3 i { background: #cbd5e1; }
body.app .mt-type { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 700; background: var(--app-brand-soft); color: var(--app-brand); white-space: nowrap; }
body.app .mt-type-machine { background: #ecfeff; color: #0e7490; }
body.app .mt-flag { display: inline-block; background: #fff7ed; color: #9a3412; border-radius: 6px; padding: 1px 7px; font-size: 12px; font-weight: 700; }
body.app .mt-late { color: var(--app-bad); font-weight: 700; }
body.app .mt-flag.mt-late { background: var(--app-bad-soft); }

/* list */
body.app .mt-chips { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
body.app .mt-chip { display: inline-flex; align-items: center; gap: 6px; padding: 7px 14px; border-radius: 999px; background: #fff; border: 1px solid var(--app-line); font-weight: 600; font-size: 14px; color: var(--app-ink); text-decoration: none; }
body.app .mt-chip b { font-size: 14px; }
body.app .mt-chip.red b { color: #dc2626; }
body.app .mt-chip.on { background: var(--app-brand); border-color: var(--app-brand); color: #fff; }
body.app .mt-chip.on b { color: #fff; }
body.app .mt-bar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 14px; }
body.app .mt-bar input[type=search] { flex: 1 1 260px; }
body.app .mt-bar input, body.app .mt-bar select { height: 42px; border: 1px solid var(--app-line-strong); border-radius: 10px; padding: 0 12px; font: inherit; background: #fff; color: var(--app-ink); }
body.app .mt-count { margin-left: auto; white-space: nowrap; }
body.app .mt-more { position: relative; }
body.app .mt-more summary { cursor: pointer; font-weight: 600; color: var(--app-brand); padding: 10px 4px; list-style: none; white-space: nowrap; }
body.app .mt-more summary::-webkit-details-marker { display: none; }
body.app .mt-more-panel { position: absolute; z-index: 20; top: 44px; left: 0; width: 320px; display: grid; gap: 10px; padding: 14px; background: #fff; border: 1px solid var(--app-line); border-radius: 12px; box-shadow: 0 10px 30px rgba(15, 23, 42, 0.12); }
body.app .mt-more-panel label { display: grid; gap: 4px; font-size: 13px; color: var(--app-muted); }
body.app .mt-more-panel select, body.app .mt-more-panel input { height: 38px; width: 100%; }
body.app .mt-clear { font-size: 13px; }
body.app .mt-table td { vertical-align: middle; }
body.app .mt-table tr td:first-child { border-left: 4px solid transparent; }
body.app .mt-table tr.mt-u1 td:first-child { border-left-color: #dc2626; }
body.app .mt-table tr.mt-u2 td:first-child { border-left-color: #f59e0b; }
body.app .mt-table tr.mt-row-closed td:first-child { border-left-color: transparent; }
body.app .mt-row-closed td { color: var(--app-muted); }
body.app .mt-no { font-weight: 700; color: var(--app-brand); text-decoration: none; white-space: nowrap; }
body.app .mt-title { font-weight: 600; }
body.app .mt-sub { font-size: 12.5px; color: var(--app-muted); margin-top: 2px; }
body.app .mt-chip-out { background: #fdf2f8; color: #be185d; }
body.app .mt-legend { display: flex; gap: 14px; font-size: 12px; color: var(--app-muted); margin-top: 8px; }
body.app .mt-legend i { display: inline-block; width: 4px; height: 12px; margin-right: 5px; vertical-align: -1px; }

/* report form */
body.app .mt-cats { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 8px; }
body.app .mt-cats label { position: relative; margin: 0 !important; }
body.app .mt-cats input { position: absolute; opacity: 0; inset: 0; cursor: pointer; }
body.app .mt-cats span { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; min-height: 84px; padding: 10px 6px; border: 1.5px solid var(--app-line); border-radius: 12px; background: #fff; text-align: center; font-size: 13px; font-weight: 600; line-height: 1.3; }
body.app .mt-cats b { font-size: 24px; line-height: 1; }
body.app .mt-cats input:checked + span { border-color: var(--app-brand); background: var(--app-brand-soft); color: var(--app-brand); }
body.app .mt-cats input:focus-visible + span { box-shadow: 0 0 0 3px rgba(44, 74, 143, 0.25); }
body.app .mt-floors { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); }
body.app .mt-floors label.wide { grid-column: span 2; }
body.app .mt-room-search { position: relative; }
body.app .mt-room-hits { position: absolute; z-index: 15; left: 0; right: 0; top: 100%; display: grid; gap: 2px; padding: 6px; background: #fff; border: 1px solid var(--app-line); border-radius: 10px; box-shadow: 0 10px 30px rgba(15, 23, 42, 0.12); }
body.app .mt-room-hits[hidden] { display: none; }
body.app .mt-room-hits button { text-align: left; padding: 8px 10px; border: 0; border-radius: 8px; background: transparent; font: inherit; cursor: pointer; }
body.app .mt-room-hits button:hover { background: var(--app-brand-soft); }
body.app .mt-dupe { padding: 12px 14px; border-radius: 10px; background: var(--app-warn-soft); color: #713f12; font-size: 14px; }
body.app .mt-dupe ul { margin: 6px 0 0; padding-left: 18px; }
body.app .mt-urgency { display: grid; gap: 8px; }
body.app .mt-urgency label { position: relative; margin: 0 !important; }
body.app .mt-urgency input { position: absolute; opacity: 0; inset: 0; cursor: pointer; }
body.app .mt-urgency span { display: grid; gap: 2px; padding: 10px 14px; border: 1.5px solid var(--app-line); border-radius: 12px; background: #fff; }
body.app .mt-urgency b { display: flex; align-items: center; gap: 8px; }
body.app .mt-urgency b i { width: 11px; height: 11px; border-radius: 50%; }
body.app .mt-urgency-1 b i { background: #dc2626; } body.app .mt-urgency-2 b i { background: #f59e0b; } body.app .mt-urgency-3 b i { background: #cbd5e1; }
body.app .mt-urgency small { color: var(--app-muted); font-size: 12.5px; }
body.app .mt-urgency input:checked + span { border-color: var(--app-brand); background: var(--app-brand-soft); }
body.app .mt-urgency-1 input:checked + span { border-color: #dc2626; background: #fef2f2; }

/* photos */
body.app .mt-photo-row { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 8px; }
body.app .mt-photo { position: relative; width: 96px; height: 96px; border-radius: 10px; background: #e2e8f0 center / cover no-repeat; border: 1px solid var(--app-line); display: block; }
body.app .field .mt-photo-add, body.app .mt-photo-add { width: 96px; height: 96px; border-radius: 10px; border: 2px dashed var(--app-line-strong); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; color: var(--app-muted); font-size: 12px; background: #fff; cursor: pointer; margin: 0 !important; }
body.app .mt-photo-add span { font-size: 24px; }
body.app .field .mt-photo-add[hidden], body.app .mt-photo-add[hidden] { display: none; }
body.app .mt-photo-del { position: absolute; top: 4px; right: 4px; width: 24px; height: 24px; border-radius: 50%; border: 0; background: rgba(15, 23, 42, 0.7); color: #fff; font-size: 16px; line-height: 1; cursor: pointer; }
body.app .mt-photo-kb { position: absolute; bottom: 4px; right: 6px; font-size: 10px; color: #fff; text-shadow: 0 1px 2px rgba(0, 0, 0, 0.7); }

/* job page */
body.app .mt-confirm { display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap; padding: 14px 18px; margin-bottom: 16px; border: 1px solid #86efac; border-radius: 14px; background: var(--app-ok-soft); }
body.app .mt-confirm > div:first-child { display: grid; gap: 2px; }
body.app .mt-confirm b { color: var(--app-ok); font-size: 16px; }
body.app .mt-confirm-actions { display: flex; gap: 8px; align-items: flex-start; flex-wrap: wrap; }
body.app .mt-reopen details summary { list-style: none; }
body.app .mt-reopen details summary::-webkit-details-marker { display: none; }
body.app .mt-reopen details[open] { display: grid; gap: 6px; }
body.app .mt-reopen textarea { min-width: 240px; }
body.app .mt-symptom { margin: 14px 0 6px; font-size: 15px; }
body.app .mt-note-line { font-size: 14px; }
body.app .mt-h3 { font-size: 14px; margin: 18px 0 6px; color: var(--app-muted); }
body.app .kv .span-3 { grid-column: 1 / -1; }
body.app .mt-part-form { display: grid; grid-template-columns: 2fr 0.8fr 0.8fr 1.1fr 1fr auto; gap: 6px; margin-top: 8px; }
body.app .mt-part-form input, body.app .mt-room-form input, body.app .mt-room-form select, body.app .mt-full { height: 38px; border: 1px solid var(--app-line-strong); border-radius: 9px; padding: 0 10px; font: inherit; min-width: 0; }
body.app .mt-full { width: 100%; }
body.app .mt-link-btn { border: 0; background: none; color: var(--app-bad); cursor: pointer; font: inherit; font-size: 13px; padding: 0; }
body.app .mt-costs { display: grid; gap: 4px; margin: 14px 0 0; padding: 12px 14px; background: var(--app-bg); border-radius: 10px; }
body.app .mt-costs div { display: flex; justify-content: space-between; gap: 10px; }
body.app .mt-costs dt { color: var(--app-muted); }
body.app .mt-costs dd { margin: 0; font-weight: 600; }
body.app .mt-cost-total { border-top: 1px solid var(--app-line); padding-top: 4px; margin-top: 2px; }
body.app .mt-cost-total dd { font-size: 16px; }
body.app .mt-big { font-size: 20px; font-weight: 700; }
body.app .mt-two-btn { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
body.app .mt-fold summary { cursor: pointer; }
body.app .mt-fold[open] summary { margin-bottom: 10px; }
body.app .mt-sub-form { padding: 10px 0; border-top: 1px solid var(--app-line); }
body.app .mt-sub-form:first-of-type { border-top: 0; }
body.app .mt-danger { color: var(--app-bad); }
body.app .mt-seg-wrap { flex-wrap: wrap; }
body.app .mt-seg-wrap label { flex: 1 1 40%; }

/* settings + report */
body.app .mt-narrow { max-width: 760px; }
body.app .mt-card-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 10px; }
body.app .mt-card-head .card-title { margin: 0; }
body.app .mt-check { display: flex !important; align-items: center; gap: 8px; font-weight: 500; }
body.app .mt-check input { width: auto !important; height: auto !important; }
body.app .mt-place-pick { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 12px; }
body.app .mt-place-pick select { height: 40px; border: 1px solid var(--app-line-strong); border-radius: 10px; padding: 0 10px; font: inherit; }
body.app .mt-floor-links { display: inline-flex; }
body.app .mt-floor-links a { padding: 7px 14px; border-radius: 9px; font-weight: 700; color: var(--app-muted); text-decoration: none; }
body.app .mt-floor-links a.on { background: #fff; color: var(--app-brand); box-shadow: 0 1px 3px rgba(15, 23, 42, 0.12); }
body.app .mt-room-tools { display: grid; gap: 10px; margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--app-line); }
body.app .mt-room-form { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
body.app .mt-room-form input[type=text] { flex: 1 1 200px; }
body.app .mt-w-s { width: 90px; flex: 0 0 90px !important; }
body.app .mt-w-m { width: 170px; flex: 0 0 170px !important; }
body.app .mt-edit-row td { background: var(--app-brand-soft); }
body.app .mt-report th.center { text-align: center; }
body.app .mt-total-row td { font-weight: 700; background: var(--app-bg); }

@media (max-width: 900px) {
  body.app .mt-cats { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  body.app .mt-part-form { grid-template-columns: 1fr 1fr; }
  body.app .mt-part-form input:first-child { grid-column: 1 / -1; }
  body.app .mt-count { margin-left: 0; }
  body.app .mt-more-panel { width: min(320px, calc(100vw - 40px)); }
}


/* HR-linked users + HR แผนก mapping (2026-10-07) */
.hr-card {
  border: 1px solid var(--msi-border);
  border-radius: var(--msi-radius);
  background: #f6f8fb;
  padding: 14px 16px;
}
.hr-card-head {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 12px;
  align-items: baseline;
}
.hr-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 10px 18px;
  margin: 10px 0 0;
}
.hr-grid dt {
  font-size: 12px;
  color: var(--msi-text-muted);
}
.hr-grid dd {
  margin: 2px 0 0;
  font-size: 14px;
  color: var(--msi-text);
  word-break: break-word;
}
tr.row-warn td {
  background: #fff8ea;
}

/* ==== NPD Projects (2026-10-19) — classes start with np- (list/tabs/chips reuse the generic mt- ones) ==== */
body.app .np-c-blue { background: #e8effd; color: #1d4ed8; }
body.app .np-c-purple { background: #f3ecfd; color: #7e22ce; }
body.app .np-c-amber { background: var(--app-warn-soft); color: var(--app-warn); }
body.app .np-c-teal { background: #e6f6f9; color: #0e7490; }
body.app .np-c-green { background: var(--app-ok-soft); color: var(--app-ok); }
body.app .np-c-grey { background: #eef1f5; color: var(--app-muted); }
body.app .np-c-red { background: var(--app-bad-soft); color: var(--app-bad); }
body.app .np-tag { display: inline-block; padding: 1px 7px; border-radius: 5px; font-size: 11px; font-weight: 700; vertical-align: 1px; }
body.app .np-tag-ext { background: #e6f6f9; color: #0e7490; }
body.app .np-tag-int { background: var(--app-brand-soft); color: var(--app-brand); }
body.app .np-tag-note { background: var(--app-warn-soft); color: var(--app-warn); }
body.app .np-badge { display: inline-block; min-width: 20px; padding: 0 6px; border-radius: 99px; background: var(--app-bad); color: #fff; font-size: 11px; line-height: 18px; text-align: center; }
body.app .np-cust { font-weight: 700; letter-spacing: 0.02em; }
body.app .np-sync { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 12px; margin: -6px 0 14px; font-size: 13px; color: var(--app-muted); }
body.app .np-sync-warn { color: var(--app-warn); font-weight: 600; }
body.app .np-sync-error { flex-basis: 100%; padding: 8px 12px; border-radius: 8px; background: var(--app-bad-soft); color: var(--app-bad); font-weight: 600; }
body.app .np-link-btn { border: 0; background: none; padding: 0; font: inherit; font-size: 13px; font-weight: 600; color: var(--app-brand-2); cursor: pointer; }
body.app .np-hint { margin: 10px 0 0; font-size: 12.5px; color: var(--app-muted); }
body.app .np-note { padding: 10px 14px; border-radius: 10px; background: var(--app-brand-soft); font-size: 14px; }

/* list */
body.app .np-table td { vertical-align: middle; }
body.app .np-table tr td:first-child { border-left: 4px solid transparent; }
body.app .np-table tr.np-quiet td:first-child { border-left-color: #dc2626; }
body.app .np-table td.np-wrap { white-space: normal; min-width: 180px; }
body.app .np-table td.np-subject { color: #334155; max-width: 340px; }

/* unassigned */
body.app .np-un-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; font-size: 14px; }
body.app .np-un { display: flex; gap: 16px; align-items: flex-start; justify-content: space-between; flex-wrap: wrap; padding: 16px 18px; margin-bottom: 12px; }
body.app .np-un-main { flex: 1 1 380px; min-width: 0; }
body.app .np-un-subj { font-weight: 700; font-size: 15.5px; overflow-wrap: anywhere; }
body.app .np-un-subj a { color: var(--app-ink); text-decoration: none; }
body.app .np-un-subj a:hover { color: var(--app-brand-2); text-decoration: underline; }
body.app .np-suggest { display: inline-block; margin-top: 8px; padding: 4px 10px; border-radius: 8px; background: var(--app-warn-soft); color: #713f12; font-size: 13px; }
body.app .np-un-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
body.app .np-un-actions form { margin: 0; }
body.app .np-pop { position: relative; }
body.app .np-pop > summary { list-style: none; }
body.app .np-pop > summary::-webkit-details-marker { display: none; }
body.app .np-pop-panel { position: absolute; z-index: 25; right: 0; top: 48px; width: min(440px, calc(100vw - 40px)); padding: 16px; background: #fff; border: 1px solid var(--app-line); border-radius: 12px; box-shadow: 0 12px 32px rgba(15, 23, 42, 0.16); }
body.app .np-form .field { margin-bottom: 12px; }
body.app .np-form select[multiple], body.app .np-form select { width: 100%; }
body.app .np-filter-input { margin-bottom: 6px; height: 36px !important; font-size: 14px !important; }

/* project page */
body.app .np-quick-status { display: flex; align-items: center; gap: 8px; }
body.app .np-quick-status select { height: 42px; border: 1px solid var(--app-line-strong); border-radius: 10px; padding: 0 12px; font: inherit; background: #fff; }
body.app .np-note-form { display: flex; gap: 8px; align-items: flex-start; margin-bottom: 8px; }
body.app .np-note-form textarea { flex: 1; min-height: 42px; padding: 9px 12px; border: 1px solid var(--app-line-strong); border-radius: 10px; font: inherit; resize: vertical; }
body.app .np-tl { list-style: none; margin: 0; padding: 0; }
body.app .np-tl-item { display: flex; gap: 12px; align-items: flex-start; padding: 12px 0; border-bottom: 1px solid var(--app-line); }
body.app .np-tl-item:last-child { border-bottom: 0; }
body.app .np-dot { flex: none; display: grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; font-size: 15px; }
body.app .np-dot-ext { background: #e6f6f9; }
body.app .np-dot-int { background: var(--app-brand-soft); }
body.app .np-dot-note { background: var(--app-warn-soft); }
body.app .np-tl-body { flex: 1; min-width: 0; }
body.app .np-tl-line { font-size: 13.5px; overflow-wrap: anywhere; }
body.app .np-tl-subj { margin-top: 2px; font-weight: 600; overflow-wrap: anywhere; }
body.app .np-tocc { overflow-wrap: anywhere; }
body.app .np-note-text { margin-top: 4px; }
body.app .np-open { flex: none; align-self: center; font-weight: 600; font-size: 13px; white-space: nowrap; text-decoration: none; }
body.app .np-meta { display: grid; gap: 4px; margin: 14px 0 0; padding-top: 12px; border-top: 1px solid var(--app-line); font-size: 13px; }
body.app .np-meta div { display: flex; justify-content: space-between; gap: 10px; }
body.app .np-meta dt { color: var(--app-muted); }
body.app .np-meta dd { margin: 0; font-weight: 600; }
body.app .np-steps { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; font-size: 14px; }
body.app .np-steps li { display: flex; align-items: center; gap: 10px; color: var(--app-muted); }
body.app .np-steps i { width: 11px; height: 11px; border-radius: 50%; background: var(--app-line-strong); flex: none; }
body.app .np-steps li.done { color: var(--app-ink); }
body.app .np-steps li.done i { background: var(--app-ok); }
body.app .np-steps li.cur { color: var(--app-ink); font-weight: 700; }
body.app .np-steps li.cur i { background: var(--app-warn); box-shadow: 0 0 0 3px var(--app-warn-soft); }
body.app .np-thread { padding: 8px 0; border-top: 1px solid var(--app-line); font-size: 14px; }
body.app .np-thread:first-of-type { border-top: 0; }
body.app .np-thread summary { cursor: pointer; }
body.app .np-merge summary { color: var(--app-bad); }
body.app .np-inline { display: flex; gap: 8px; margin-top: 8px; }
body.app .np-inline select { flex: 1; min-width: 0; height: 40px; border: 1px solid var(--app-line-strong); border-radius: 10px; padding: 0 10px; font: inherit; }

/* settings */
body.app .np-st-list { list-style: none; margin: 12px 0 0; padding: 0; display: grid; gap: 6px; }
body.app .np-st-list li { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 9px 10px; border: 1px solid var(--app-line); border-radius: 10px; background: #fff; }
body.app .np-st-list li.off { background: #fafbfd; }
body.app .np-st-list li.off .status { opacity: 0.55; }
body.app .np-st-list li.drag { opacity: 0.4; }
body.app .np-st-list li.editing { background: var(--app-brand-soft); }
body.app .np-grip { cursor: grab; color: var(--app-muted); user-select: none; padding: 0 4px; font-size: 16px; }
body.app .np-st-count { color: var(--app-muted); font-size: 13px; margin-left: auto; }
body.app .np-st-flags { display: inline-flex; gap: 4px; }
body.app .np-btn-sm { height: 34px; padding: 0 12px; font-size: 13px; }
body.app .np-st-edit, body.app .np-st-add { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; flex: 1; }
body.app .np-st-add { margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--app-line); }
body.app .np-st-edit input[type=text], body.app .np-st-add input[type=text] { flex: 1 1 180px; height: 38px; border: 1px solid var(--app-line-strong); border-radius: 9px; padding: 0 10px; font: inherit; }
body.app .np-st-edit select, body.app .np-st-add select { height: 38px; border: 1px solid var(--app-line-strong); border-radius: 9px; padding: 0 8px; font: inherit; }

/* copy subject (2026-10-20, icon button) */
body.app .np-actions { flex: none; align-self: center; display: flex; align-items: center; gap: 6px; }
body.app .np-copy { position: relative; display: inline-grid; place-items: center; width: 28px; height: 28px; padding: 0; border: 1px solid transparent; border-radius: 8px; background: var(--app-brand-soft); color: var(--app-brand-2); cursor: pointer; vertical-align: middle; flex: none; transition: background .15s, color .15s, border-color .15s; }
body.app .np-copy:hover { background: var(--app-brand-2); color: #fff; }
body.app .np-copy:focus-visible { outline: none; border-color: var(--app-brand-2); box-shadow: 0 0 0 3px var(--app-brand-soft); }
body.app .np-copy svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; grid-area: 1 / 1; }
body.app .np-copy .np-ic-ok { opacity: 0; transform: scale(.6); transition: opacity .15s, transform .15s; }
body.app .np-copy .np-ic-copy { transition: opacity .15s, transform .15s; }
body.app .np-copy.ok { background: var(--app-ok); color: #fff; }
body.app .np-copy.ok .np-ic-copy { opacity: 0; transform: scale(.6); }
body.app .np-copy.ok .np-ic-ok { opacity: 1; transform: none; }
body.app .np-copy.fail { background: #dc2626; color: #fff; }
body.app .np-copy-tip { position: absolute; bottom: calc(100% + 6px); left: 50%; transform: translateX(-50%) translateY(4px); background: #16233f; color: #fff; font-size: 11.5px; font-weight: 600; white-space: nowrap; padding: 4px 8px; border-radius: 6px; opacity: 0; pointer-events: none; transition: opacity .15s, transform .15s; z-index: 5; }
body.app .np-copy.ok .np-copy-tip, body.app .np-copy.fail .np-copy-tip { opacity: 1; transform: translateX(-50%); }
body.app .np-un-subj .np-copy { margin-left: 6px; }

/* members (2026-10-20): photo + nickname */
body.app .np-av { display: inline-block; border-radius: 50%; object-fit: cover; background: #e2e8f0; flex: none; vertical-align: middle; }
body.app .np-av-i { display: inline-grid; place-items: center; background: linear-gradient(135deg, var(--app-brand), var(--app-brand-2)); color: #fff; font-weight: 700; line-height: 1; }
body.app .np-av-more { display: inline-grid; place-items: center; background: #e2e8f0; color: #475569; font-size: 10px; font-weight: 700; }
body.app .np-av-wrap { position: relative; display: inline-flex; flex: none; }
body.app .np-av-star { display: none; position: absolute; right: -4px; bottom: -3px; width: 13px; height: 13px; border-radius: 50%; background: #f5b400; color: #fff; font-size: 9px; line-height: 13px; text-align: center; box-shadow: 0 0 0 2px #fff; }
body.app .np-chip.owner .np-av-star { display: block; }
body.app .np-chips { display: flex; flex-wrap: wrap; gap: 6px; }
body.app .np-team .np-chips { margin-bottom: 8px; }
body.app .np-chip { display: inline-flex; align-items: center; gap: 7px; padding: 3px 6px 3px 3px; border-radius: 999px; background: #fff; border: 1px solid var(--app-line); color: #1e293b; font-size: 13px; font-weight: 600; box-shadow: 0 1px 2px rgba(15, 23, 42, .05); }
body.app dd .np-chip { padding-right: 12px; }
body.app .np-chip.owner { border-color: #f5c84c; background: #fffaeb; }
body.app .np-chip.owner .np-av { box-shadow: 0 0 0 2px #f5b400; }
body.app .np-chip-name { padding-right: 2px; }
body.app .np-chip .np-star { display: inline-grid !important; place-items: center; width: 22px; height: 22px; margin: 0 !important; border-radius: 50%; cursor: pointer; color: #cbd5e1; font-size: 14px; font-weight: 400; }
body.app .np-chip .np-star:hover { color: #f5b400; background: #fff4d6; }
body.app .np-star input { position: absolute; opacity: 0; width: 0; height: 0; }
body.app .np-chip.owner .np-star { color: #f5b400; }
body.app .np-chip-x { display: inline-grid; place-items: center; width: 22px; height: 22px; border: 0; border-radius: 50%; background: none; padding: 0; color: #94a3b8; cursor: pointer; font-size: 11px; }
body.app .np-chip-x:hover { color: #dc2626; background: #fee2e2; }
body.app .np-stack { display: inline-flex; align-items: center; margin-right: 8px; vertical-align: middle; }
body.app .np-stack-i { display: inline-flex; border-radius: 50%; box-shadow: 0 0 0 2px #fff; }
body.app .np-stack-i + .np-stack-i { margin-left: -6px; }
body.app .np-stack-i.owner .np-av { box-shadow: 0 0 0 2px #f5b400; }
body.app .np-proj-sub { display: flex; align-items: center; margin-top: 4px; }
body.app .np-dept-group { margin-bottom: 12px; }
body.app .np-dept-head { font-size: 12px; font-weight: 700; color: var(--app-muted); text-transform: uppercase; letter-spacing: 0.03em; margin-bottom: 4px; }
body.app .np-dept { padding: 3px 0; }

/* list: latest subject opens the email (2026-10-20) */
body.app .np-subj-link { color: #334155 !important; text-decoration: none; }
body.app .np-subj-link:hover { color: var(--app-brand-2) !important; text-decoration: underline; }
body.app .np-subj-line { display: flex; align-items: flex-start; gap: 6px; }
body.app .np-subj-line .np-subj-link { padding-top: 4px; }

@media (max-width: 900px) {
  body.app .np-pop-panel { position: fixed; left: 16px; right: 16px; top: 80px; width: auto; max-height: calc(100vh - 100px); overflow: auto; }
  body.app .np-tl-item { flex-wrap: wrap; }
  body.app .np-actions { margin-left: 46px; }
}

/* ==== HRM: ทะเบียนพนักงาน (hm-) + ขออัตรากำลัง (rq-) (2026-10-21) — tabs/chips/bar reuse mt- ==== */
body.app .nowrap { white-space: nowrap; }
body.app .mono { font-variant-numeric: tabular-nums; }
body.app .btn.btn-sm { height: 34px; padding: 0 12px; font-size: 13px; }
body.app .hm-n { display: inline-block; min-width: 20px; padding: 0 6px; border-radius: 999px; background: #eef1f5; color: var(--app-muted); font-size: 12px; text-align: center; margin-left: 2px; }
body.app .hm-n.bad { background: var(--app-bad-soft); color: var(--app-bad); }
body.app .hm-kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-bottom: 14px; }
body.app .hm-kpi { background: #fff; border: 1px solid var(--app-line); border-radius: 12px; padding: 10px 16px; }
body.app .hm-kpi > span { display: block; color: var(--app-muted); font-size: 13px; }
body.app .hm-kpi b { font-size: 26px; line-height: 1.25; }
body.app .hm-kpi small { font-size: 13px; color: var(--app-muted); font-weight: 500; }
body.app .hm-neg { color: var(--app-bad); font-weight: 700; }
body.app .hm-pos { color: #0e7490; font-weight: 700; }
body.app .hm-zero { color: #c0c5cf; }
body.app .hm-sum td, body.app .hm-sum th { padding-top: 7px; padding-bottom: 7px; }
body.app .hm-sum .hm-gname { font-weight: 700; vertical-align: top; border-right: 1px solid var(--app-line); width: 170px; }
body.app .hm-sum .hm-gsub { font-weight: 700; font-size: 16px; text-align: center; border-left: 1px solid var(--app-line); vertical-align: middle; width: 100px; }
body.app .hm-sum .hm-gsub .hm-sub { font-weight: 500; }
body.app .hm-total td { background: #fff7cc; font-weight: 700; font-size: 15px; border-bottom: 2px solid #e8d77a; }
body.app .hm-g1 td { background: #fbf3fb; } body.app .hm-g2 td { background: #f7f7f8; } body.app .hm-g3 td { background: #f2f9ee; }
body.app .hm-g4 td { background: #fdf4ee; } body.app .hm-g5 td { background: #eef7fc; }
body.app .hm-lnk { color: inherit; text-decoration: underline dotted; text-underline-offset: 3px; }
body.app .hm-open { display: inline-block; min-width: 24px; text-align: center; border-radius: 6px; background: var(--app-warn-soft); color: var(--app-warn); font-weight: 700; font-size: 13px; padding: 0 6px; text-decoration: none; }
body.app .hm-legend { flex-wrap: wrap; }
body.app .hm-excluded { font-size: 13px; color: var(--app-muted); margin-top: 8px; }
body.app .hm-note { font-size: 13px; color: var(--app-muted); margin: -4px 0 10px; }
body.app .hm-person { display: flex; align-items: center; gap: 10px; }
body.app .hm-name { font-weight: 600; line-height: 1.25; }
body.app .hm-sub { font-size: 12px; color: var(--app-muted); }
body.app .hm-tag { display: inline-block; border-radius: 999px; padding: 1px 9px; font-size: 12px; font-weight: 600; white-space: nowrap; }
body.app .hm-tag-ok { background: var(--app-ok-soft); color: var(--app-ok); }
body.app .hm-tag-warn { background: var(--app-warn-soft); color: var(--app-warn); }
body.app .hm-tag-bad { background: var(--app-bad-soft); color: var(--app-bad); }
body.app .hm-tag-info { background: #e6f6f9; color: #0e7490; }
body.app .hm-tag-grey { background: #eef1f5; color: #475569; }
body.app .hm-today td { background: #fffbea; }
body.app .hm-two { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
body.app .hm-settings { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 2fr); gap: 20px; align-items: start; }
body.app .hm-settings input[type=text], body.app .hm-settings select { width: 100%; }
body.app .hm-num { width: 80px; text-align: right; }
body.app .hm-inline-form { display: flex; gap: 8px; margin-top: 12px; }
body.app .hm-inline-form input { flex: 1; }
body.app .hm-danger { margin-top: 12px; font-size: 13px; }
body.app .hm-danger form { display: inline-block; margin: 6px 6px 0 0; }
body.app .hm-muted-row td { color: var(--app-muted); }
@media (max-width: 900px) {
  body.app .hm-kpis { grid-template-columns: 1fr 1fr; }
  body.app .hm-two, body.app .hm-settings { grid-template-columns: 1fr; }
}
@media print {
  body.app .app-header, body.app .drawer, body.app .dash-menu, body.app .page-actions, body.app .hm-tabs, body.app .hm-legend, body.app .hm-excluded, body.app .app-back { display: none !important; }
  body.app { background: #fff; }
  body.app .hm-sum td, body.app .hm-sum th { padding: 3px 8px; font-size: 12px; }
  body.app .hm-kpis { grid-template-columns: repeat(4, 1fr); }
  body.app * { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}

/* ขออัตรากำลัง */
body.app .rq-st-dept, body.app .rq-st-hr, body.app .rq-st-final { background: var(--app-warn-soft); color: var(--app-warn); }
body.app .rq-st-done { background: var(--app-ok-soft); color: var(--app-ok); }
body.app .rq-st-cancelled { background: #eef1f5; color: var(--app-muted); }
body.app .rq-ln-pending { background: #eef1f5; color: #475569; }
body.app .rq-ln-rejected { background: var(--app-bad-soft); color: var(--app-bad); }
body.app .rq-ln-recruiting { background: var(--app-warn-soft); color: var(--app-warn); }
body.app .rq-ln-filled { background: var(--app-ok-soft); color: var(--app-ok); }
body.app .rq-ln-cancelled { background: #eef1f5; color: var(--app-muted); }
body.app .rq-tag { display: inline-block; border-radius: 999px; padding: 1px 9px; font-size: 12px; font-weight: 600; background: #eef1f5; color: #475569; white-space: nowrap; }
body.app .rq-r-replace { background: #eef1f5; color: #334155; }
body.app .rq-r-more_work, body.app .rq-r-expand, body.app .rq-r-other { background: var(--app-brand-soft); color: var(--app-brand); }
body.app .rq-lv-skilled { background: var(--app-brand-soft); color: var(--app-brand); }
body.app .rq-lv-trainee { background: #f3ecfd; color: #7e22ce; }
body.app .rq-prog { display: inline-flex; gap: 2px; vertical-align: middle; }
body.app .rq-prog i { width: 12px; height: 6px; border-radius: 2px; background: #e5e7eb; }
body.app .rq-prog i.f { background: var(--app-ok); }
body.app .rq-search { flex: 1 1 260px; }
body.app .rq-search input { width: 100%; height: 38px; border: 1px solid var(--app-line-strong); border-radius: 10px; padding: 0 12px; font: inherit; }
body.app .rq-fyi { margin-top: 18px; }
body.app .rq-fyi-list { margin: 0; padding-left: 18px; display: grid; gap: 6px; }
/* form */
body.app .rq-h { font-size: 15px; margin: 18px 0 8px; }
body.app .rq-line { background: #fff; border: 1px solid var(--app-line); border-radius: 14px; padding: 12px; margin-bottom: 10px; box-shadow: var(--app-shadow); }
body.app .rq-line-top { display: flex; align-items: center; gap: 8px; }
body.app .rq-no { width: 26px; height: 26px; flex: none; border-radius: 50%; background: var(--app-brand-soft); color: var(--app-brand); font-weight: 700; font-size: 13px; display: grid; place-items: center; }
body.app .rq-pos { flex: 0 1 360px; min-width: 0; font-weight: 600; }
body.app .rq-copy { margin-left: auto; display: inline-flex; align-items: center; gap: 6px; height: 34px; padding: 0 12px; border: 1px solid var(--app-line-strong); border-radius: 8px; background: #fff; color: var(--app-muted); font: inherit; font-size: 13px; white-space: nowrap; cursor: pointer; }
body.app .rq-copy:hover { background: #f1f3f8; color: inherit; }
body.app .rq-ic { border: 0; background: none; color: var(--app-muted); font-size: 18px; width: 34px; height: 34px; border-radius: 8px; cursor: pointer; }
body.app .rq-ic:hover { background: #f1f3f8; }
body.app .rq-pos-name, body.app .rq-replace, body.app .rq-note { width: 100%; margin-top: 8px; }
body.app .rq-seg { display: flex; background: #eceef2; border-radius: 10px; padding: 3px; margin-top: 10px; }
body.app .rq-seg label { flex: 1; }
body.app .rq-seg input { position: absolute; opacity: 0; pointer-events: none; }
body.app .rq-seg span { display: block; text-align: center; padding: 8px 4px; border-radius: 8px; font-size: 14px; color: var(--app-muted); cursor: pointer; }
body.app .rq-seg input:checked + span { background: #fff; color: var(--app-ink); font-weight: 700; box-shadow: 0 1px 2px rgba(0, 0, 0, .08); }
body.app .rq-rs { margin-top: 10px; }
body.app .rq-rl { display: block; font-size: 12px; color: var(--app-muted); margin-bottom: 4px; }
body.app .rq-chips { display: flex; gap: 6px; }
body.app .rq-chips label { flex: 1; }
body.app .rq-chips input { position: absolute; opacity: 0; pointer-events: none; }
body.app .rq-chips span { display: block; text-align: center; padding: 7px 2px; border: 1px solid var(--app-line-strong); border-radius: 999px; font-size: 13px; cursor: pointer; background: #fff; white-space: nowrap; }
body.app .rq-chips input:checked + span { background: var(--app-brand); border-color: var(--app-brand); color: #fff; font-weight: 600; }
body.app .rq-seg input:focus-visible + span, body.app .rq-chips input:focus-visible + span { outline: 2px solid var(--app-brand-2); outline-offset: 1px; }
body.app .rq-req { margin-top: 8px; font-size: 12px; color: var(--app-muted); background: #fafbfc; border-radius: 8px; padding: 6px 9px; }
body.app .rq-note-btn { border: 0; background: none; color: var(--app-muted); font-size: 13px; padding: 8px 0 0; cursor: pointer; }
body.app .rq-add { display: block; width: 100%; border: 1.5px dashed #b6bcc8; background: none; border-radius: 14px; padding: 12px; font: inherit; font-weight: 700; color: var(--app-brand); cursor: pointer; }
body.app .rq-sumbar { background: var(--app-brand-soft); color: var(--app-brand); border-radius: 12px; padding: 10px 14px; font-size: 14px; margin: 12px 0 16px; }
/* request page */
body.app .rq-steps { list-style: none; margin: 0; padding: 0; }
body.app .rq-steps li { display: flex; gap: 10px; padding-bottom: 14px; position: relative; font-size: 14px; }
body.app .rq-steps li::before { content: ""; position: absolute; left: 11px; top: 24px; bottom: 0; width: 2px; background: var(--app-line); }
body.app .rq-steps li:last-child::before { display: none; }
body.app .rq-steps small { display: block; color: var(--app-muted); font-size: 12px; }
body.app .rq-dot { width: 24px; height: 24px; flex: none; border-radius: 50%; display: grid; place-items: center; font-size: 12px; font-weight: 700; z-index: 1; background: #fff; border: 2px solid var(--app-line-strong); color: var(--app-muted); }
body.app .rq-steps .ok .rq-dot { background: var(--app-ok); border-color: var(--app-ok); color: #fff; }
body.app .rq-steps .bad .rq-dot { background: var(--app-bad); border-color: var(--app-bad); color: #fff; }
body.app .rq-steps .now .rq-dot { background: #d97706; border-color: #d97706; color: #fff; }
body.app .rq-steps .now > div { font-weight: 700; }
body.app .rq-steps .skip { color: var(--app-muted); }
body.app .rq-steps .skip .rq-dot { background: #eef1f5; border-color: #eef1f5; }
body.app .rq-target { font-size: 14px; margin: 0 0 6px; }
body.app .rq-check { display: flex; align-items: flex-start; gap: 10px; padding: 9px 0; border-bottom: 1px solid #f0f1f4; cursor: pointer; }
body.app .rq-check input { width: 20px; height: 20px; margin-top: 1px; flex: none; }
body.app .rq-check small { display: block; color: var(--app-muted); }
body.app .rq-two { display: grid; gap: 8px; }
body.app .rq-two .btn { width: 100%; }
body.app .rq-reject { color: var(--app-bad) !important; border-color: #f1c6c3 !important; }
body.app .rq-approve .field { margin-top: 10px; }
body.app .rq-approve .field input { width: 100%; }
body.app .rq-note-box { background: #fafbfc; border-radius: 10px; padding: 8px 12px; font-size: 14px; margin: 0 0 10px; }
body.app .rq-fill-row td { background: #fffbea; }
body.app .rq-fill { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
body.app .rq-fill select { flex: 1 1 260px; min-width: 0; }
body.app .rq-code { width: 150px; }
body.app .rq-cancel-line { margin-top: 6px; font-size: 13px; }
body.app .rq-cancel-line summary { cursor: pointer; color: var(--app-muted); }
body.app .rq-cancel-line form { display: flex; gap: 8px; margin-top: 6px; }
body.app .rq-history { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; font-size: 14px; }
body.app .rq-pos-form { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; align-items: end; }
body.app .rq-pos-form label { display: grid; gap: 4px; font-size: 13px; color: var(--app-muted); }
body.app .rq-pos-form label.wide { grid-column: span 2; }
body.app .rq-pos-form input, body.app .rq-pos-form select { width: 100%; }
@media (max-width: 900px) { body.app .rq-pos-form { grid-template-columns: 1fr 1fr; } }
body.app .rq-view > div, body.app .hm-two > section { min-width: 0; }
body.app .card .hm-flat-wrap { border: 0; box-shadow: none; border-radius: 0; }
body.app .rq-view { grid-template-columns: minmax(0, 1.9fr) minmax(0, 1fr); }
body.app .rq-line select, body.app .rq-line input[type=text], body.app .rq-fill select, body.app .rq-fill input,
body.app .rq-cancel-line input, body.app .hm-settings input, body.app .hm-settings select, body.app .hm-inline-form input,
body.app .rq-pos-form input, body.app .rq-pos-form select, body.app .rq-approve .field input {
  height: 40px; border: 1px solid var(--app-line-strong); border-radius: 10px; padding: 0 10px; font: inherit; font-size: 14px; background: #fff; color: var(--app-ink); }
body.app .rq-line select.rq-pos { height: 40px; font-weight: 600; }
@media (max-width: 900px) {
  body.app .rq-view { grid-template-columns: 1fr; }
  body.app .rq-view > div:last-child { order: -1; }
}
@media print { body.app .app-side-layout { display: block; } }
@media (max-width: 1300px) {
  body.app .app-side-main .rq-view { grid-template-columns: 1fr; }
  body.app .app-side-main .rq-view > div:last-child { order: -1; }
}

/* ขอบเขตงาน per person (2026-10-22) */
body.app .rq-scope-box { margin-top: 10px; }
body.app .rq-scope-box select, body.app .rq-scope-box input { width: 100%; }
body.app .rq-scope-other { margin-top: 6px; }
body.app .rq-pos-form textarea { width: 100%; border: 1px solid var(--app-line-strong); border-radius: 10px; padding: 8px 10px; font: inherit; font-size: 14px; }
body.app .rq-pos-form label small { color: var(--app-muted); font-weight: 400; }
body.app .rq-line .rq-scope-box select, body.app .rq-line .rq-scope-box input { height: 40px; border: 1px solid var(--app-line-strong); border-radius: 10px; padding: 0 10px; font: inherit; font-size: 14px; background: #fff; }

/* ขอบเขตงาน chips — manpower settings (2026-10-22) */
body.app .rq-scope-edit { display: grid; gap: 6px; font-size: 13px; color: var(--app-muted); }
body.app .rq-scope-lbl small { font-weight: 400; }
body.app .rq-scope-chips { display: flex; flex-wrap: wrap; gap: 6px; }
body.app .rq-scope-chip { display: inline-flex; align-items: center; gap: 4px; padding: 4px 4px 4px 10px; border-radius: 999px;
  background: var(--app-brand-soft); color: var(--app-brand); font-size: 13px; font-weight: 600; }
body.app .rq-scope-x { border: 0; background: transparent; color: var(--app-muted); font-size: 16px; line-height: 1; width: 22px; height: 22px; border-radius: 50%; cursor: pointer; }
body.app .rq-scope-x:hover { background: var(--app-bad-soft); color: var(--app-bad); }
body.app .rq-scope-empty { font-size: 12px; color: var(--app-muted); padding: 4px 0; }
body.app .rq-scope-edit.has .rq-scope-empty { display: none; }
body.app .rq-scope-add { display: flex; gap: 6px; }
body.app .rq-scope-add input { flex: 1; min-width: 0; }
body.app .rq-scope-add .btn { height: 40px; white-space: nowrap; }

/* NAV item pictures (2026-10-22) — item_thumb() in src/includes/item_picture.php */
.item-pic { display: inline-flex; align-items: center; justify-content: center; flex: none; overflow: hidden;
  border: 1px solid #e2e4e9; border-radius: 8px; background: #fafaf7; vertical-align: middle; }
.item-pic img { width: 100%; height: 100%; object-fit: contain; display: block; }
a.item-pic { cursor: zoom-in; }
a.item-pic:focus-visible { outline: 2px solid #16233f; outline-offset: 2px; }
.item-pic--sm { width: 48px; height: 48px; }
.item-pic--md { width: 96px; height: 96px; }
.item-pic--lg { width: 200px; height: 200px; max-width: 100%; }
.item-pic--none { color: #6b7280; font-size: 9px; line-height: 1.15; text-align: center; padding: 2px; }
.item-pic--lg.item-pic--none { font-size: 13px; }
.item-pic-viewer { border: 0; border-radius: 14px; padding: 16px; max-width: min(92vw, 720px); background: #fafaf7; }
.item-pic-viewer::backdrop { background: rgba(8, 12, 22, .78); }
.item-pic-viewer img { display: block; max-width: 100%; max-height: 75vh; margin: 0 auto; image-rendering: auto; min-width: min(60vw, 420px); object-fit: contain; }
.item-pic-viewer-caption { margin-top: 8px; text-align: center; color: #6b7280; font-size: 13px; }
.item-pic-viewer form { position: absolute; top: 6px; right: 8px; margin: 0; }
.item-pic-viewer-close { border: 0; background: transparent; font-size: 26px; line-height: 1; cursor: pointer; color: #1c1f26; }

/* Admin › Item pictures page */
.pic-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; margin: 12px 0 8px; }
.pic-stat { background: #fff; border: 1px solid #e2e4e9; border-radius: 10px; padding: 12px 14px; }
.pic-stat b { display: block; font-size: 22px; font-variant-numeric: tabular-nums; }
.pic-stat span { color: #6b7280; font-size: 13px; }
.pic-meter { height: 8px; background: #e2e4e9; border-radius: 99px; overflow: hidden; margin: 6px 0 4px; }
.pic-meter i { display: block; height: 100%; background: #16233f; }
.pic-actions { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0; }
.pic-actions form { margin: 0; }
.pic-path { font-family: Consolas, ui-monospace, monospace; font-size: 12.5px; overflow-wrap: anywhere; }
.pic-tabs { display: flex; gap: 6px; margin: 16px 0 8px; flex-wrap: wrap; }
.pic-tabs a { padding: 5px 12px; border: 1px solid #d3d8e4; border-radius: 999px; text-decoration: none; color: #1c1f26; font-size: 13px; }
.pic-tabs a.active { background: #16233f; border-color: #16233f; color: #fff; }

/* item picture in a card's top-right corner (แจ้งงานหาย report + form, 2026-10-22).
   Only what sits next to the picture makes room; everything below keeps full width. */
.card-pic-corner { position: relative; }                       /* report page: picture sits in the corner */
.card-pic-corner > .card-pic { position: absolute; top: 20px; right: 20px; }
@media (max-width: 700px) { .card-pic-corner > .card-pic { position: static; margin-bottom: 10px; } }   /* phone: above the fields */
.card-pic-wrap > .card-pic { float: right; margin: 0 0 8px 16px; } /* form: first field makes room, rest full width */
.card-pic-wrap > .card-pic[hidden] { display: none; }
.card-pic-wrap > .card-pic + .card-title + .field > .input-group { display: flex; }   /* row next to the picture shrinks */
.card-pic-wrap > .card-pic + .card-title + .field > .input-group ~ *,
.card-pic-wrap > .card-pic + .card-title + .field ~ * { clear: right; }                  /* everything below: full width */

/* ==== Menu badge (any module with <key>_menu_badge) (2026-10-25) ==== */
.menu-badge { margin-left: auto; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px; background: #dc2626; color: #fff; font-size: 11px; font-weight: 700; line-height: 20px; text-align: center; }

/* ==== Ticket (tk-) (2026-10-25) ==== */
body.app .tk-sp { flex: 1; }
body.app .tk-small { font-size: 12.5px; }
body.app .tk-mono { font-family: ui-monospace, Consolas, monospace; font-size: .95em; }
body.app .tk-link { background: none; border: 0; padding: 0; font: inherit; color: var(--app-brand-2); cursor: pointer; text-decoration: underline; text-underline-offset: 2px; }
body.app .tk-h { font-size: 16px; margin: 0 0 12px; }
body.app .tk-h small { font-weight: 400; font-size: 13px; }
body.app .tk-2col { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }
body.app .tk-inline { display: flex; align-items: center; gap: 8px; }
body.app .tk-inline input { width: 110px; }
body.app .tk-flash { animation: tkflash 1.2s; }
@keyframes tkflash { 0%, 60% { box-shadow: 0 0 0 4px #fecaca; } }

/* tabs / toolbar / chips */
body.app .tk-queue { padding: 0 0 8px; overflow: hidden; }
body.app .tk-tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--app-line); padding: 0 12px; overflow-x: auto; }
body.app .tk-tabs-card { background: #fff; border: 1px solid var(--app-line); border-radius: 12px 12px 0 0; margin-bottom: 0; border-bottom: 0; }
body.app .tk-tabs-card + .card, body.app .tk-tabs-card + form.card { border-top-left-radius: 0; border-top-right-radius: 0; }
body.app .tk-tabs a { padding: 12px 14px; font-weight: 600; color: var(--app-muted); border-bottom: 2px solid transparent; text-decoration: none; white-space: nowrap; }
body.app .tk-tabs a.on { color: var(--app-brand); border-color: var(--app-brand); }
body.app .tk-n { display: inline-block; min-width: 20px; padding: 0 6px; border-radius: 999px; background: #eef1f5; color: var(--app-muted); font-size: 12px; text-align: center; }
body.app .tk-n.r { background: #dc2626; color: #fff; }
body.app .tk-tool { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 12px 16px; border-bottom: 1px solid var(--app-line); }
body.app .tk-tool select, body.app .tk-tool input[type=date] { height: 34px; width: auto; padding: 0 8px; font-size: 13px; }
body.app .tk-search { height: 36px; flex: 1 1 260px; max-width: 420px; padding: 0 12px; font-size: 14px; }
body.app .tk-chipf { display: inline-flex; align-items: center; height: 32px; padding: 0 12px; border: 1px solid var(--app-line-strong); border-radius: 999px; background: #fff; font: inherit; font-size: 13px; font-weight: 600; color: var(--app-ink); text-decoration: none; cursor: pointer; white-space: nowrap; }
body.app .tk-chipf.on { background: var(--app-brand); border-color: var(--app-brand); color: #fff; }
body.app .tk-def { border-style: dashed; color: var(--app-muted); }
body.app .tk-def.on-def { border-style: solid; background: #fef9c3; border-color: #fde68a; color: #854d0e; cursor: default; }
body.app .tk-pinnote { padding: 8px 16px; background: #fff1f2; color: #9f1239; font-size: 13px; font-weight: 600; border-bottom: 1px solid #fecdd3; }
body.app .tk-empty { padding: 40px 16px; text-align: center; color: var(--app-muted); }

/* list */
body.app .tk-tw { overflow-x: auto; }
body.app .tk-table { width: 100%; border-collapse: collapse; font-size: 14px; }
body.app .tk-table th { text-align: left; padding: 10px 12px; font-size: 12px; color: var(--app-muted); font-weight: 700; border-bottom: 1px solid var(--app-line); white-space: nowrap; background: #fafbfd; }
body.app .tk-table th a { color: inherit; text-decoration: none; }
body.app .tk-table td { padding: 10px 12px; border-bottom: 1px solid var(--app-line); vertical-align: middle; }
body.app .tk-table tbody tr { cursor: pointer; }
body.app .tk-table tbody tr:hover { background: #f8fafc; }
body.app .tk-table tr.hot { background: #fff1f2; }
body.app .tk-table tr.hot td:first-child { box-shadow: inset 4px 0 0 #e11d48; }
body.app .tk-table tr.hot:hover { background: #ffe4e6; }
body.app .tk-loctable tbody tr { cursor: default; }
body.app .tk-loctable select { height: 34px; font-size: 13px; max-width: 280px; }
body.app .tk-why { color: #be123c; font-size: 12px; font-weight: 700; }
body.app .tk-late { color: #be123c; font-weight: 700; }
body.app .tk-unread { display: inline-block; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px; background: var(--app-brand-2); color: #fff; font-size: 11px; font-weight: 700; line-height: 20px; text-align: center; }
body.app .tk-foot { display: flex; justify-content: space-between; align-items: center; padding: 10px 16px; font-size: 13px; color: var(--app-muted); }
body.app .tk-foot .btn { margin-left: 6px; }

/* pills / tags / avatars */
body.app .tk-pill { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: 12px; font-weight: 700; white-space: nowrap; }
body.app .tk-pill-warn { background: var(--app-warn-soft); color: var(--app-warn); }
body.app .tk-pill-info { background: #e0f2fe; color: #0369a1; }
body.app .tk-pill-ok { background: var(--app-ok-soft); color: var(--app-ok); }
body.app .tk-pill-grey { background: #eef1f5; color: #475569; }
body.app .tk-pill-bad { background: var(--app-bad-soft); color: var(--app-bad); }
/* งานรอฉันตอบ — reason chips + tags (2026-10-26) */
body.app .tk-subchips { display: flex; flex-wrap: wrap; gap: 8px; padding: 12px 16px 0; }
body.app .tk-subchips .tk-chipf { height: 28px; font-size: 12.5px; }
body.app .tk-cn { margin-left: 6px; font-weight: 700; opacity: .7; }
body.app .tk-wtags { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; }
body.app .tk-wtag { display: inline-block; padding: 1px 8px; border-radius: 6px; font-size: 11px; font-weight: 700; white-space: nowrap; border: 1px solid currentColor; background: #fff; }
body.app .tk-wtag.tk-why-do { color: #1d4ed8; }
body.app .tk-wtag.tk-why-ack { color: #7c3aed; }
body.app .tk-wtag.tk-why-decide { color: #be123c; }
body.app .tk-wtag.tk-why-confirm { color: #047857; }
body.app .tk-card .tk-wtags { margin: 6px 0 2px; }
body.app .tk-tag { display: inline-block; padding: 1px 7px; border-radius: 6px; font-size: 11px; font-weight: 700; white-space: nowrap; }
body.app .tk-tag-brand { background: var(--app-brand-soft); color: var(--app-brand-2); }
body.app .tk-tag-info { background: #e0f2fe; color: #0369a1; }
body.app .tk-tag-grey { background: #eef1f5; color: #475569; }
body.app .tk-av { display: inline-grid; place-items: center; border-radius: 50%; object-fit: cover; flex: none; vertical-align: middle; border: 2px solid #fff; }
body.app .tk-av-i { color: #fff; font-weight: 700; }
body.app .tk-stack { display: inline-flex; vertical-align: middle; }
body.app .tk-stack .tk-av + .tk-av { margin-left: -8px; }

/* board */
body.app .tk-board { display: grid; grid-template-columns: repeat(var(--cols), minmax(240px, 1fr)); gap: 12px; padding: 14px; overflow-x: auto; background: #f8fafc; }
body.app .tk-col h4 { margin: 0 0 8px; font-size: 13px; color: var(--app-muted); display: flex; gap: 6px; }
body.app .tk-col h4 span { background: #e2e8f0; border-radius: 999px; padding: 0 8px; font-size: 12px; }
body.app .tk-card { display: block; background: #fff; border: 1px solid var(--app-line); border-radius: 10px; padding: 10px 12px; margin-bottom: 8px; color: var(--app-ink); text-decoration: none; box-shadow: var(--app-shadow); }
body.app .tk-card:hover { border-color: var(--app-brand-2); }
body.app .tk-card.hot { background: #fff1f2; border-color: #fda4af; box-shadow: inset 4px 0 0 #e11d48; }
body.app .tk-card-no { font-size: 11.5px; color: var(--app-muted); }
body.app .tk-card-title { font-weight: 600; margin: 3px 0 6px; line-height: 1.35; }
body.app .tk-card-foot { display: flex; align-items: center; gap: 8px; font-size: 12px; }

/* new ticket */
body.app .tk-new { max-width: 980px; }
body.app .tk-tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 10px; }
body.app .tk-tile { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; min-height: 92px; padding: 14px; border: 1.5px solid var(--app-line-strong); border-radius: 12px; background: #fff; font: inherit; text-align: left; cursor: pointer; color: var(--app-ink); }
body.app .tk-tile:hover { border-color: var(--app-brand-2); background: var(--app-brand-soft); }
body.app .tk-tile b { font-size: 16px; }
body.app .tk-tile small { color: var(--app-muted); font-size: 12.5px; line-height: 1.35; }
body.app .tk-tile-ic { font-size: 26px; line-height: 1; margin-bottom: 4px; }
body.app .tk-tiles-sm .tk-tile { min-height: 74px; }
body.app .tk-tiles-sm .tk-tile-ic { font-size: 20px; }
body.app .tk-crumb { margin: 0 0 10px; }
body.app .tk-other { margin: 14px 0 0; font-size: 14px; color: var(--app-muted); }
body.app .tk-other .tk-link { margin-left: 6px; }
body.app .tk-picked { padding: 10px 14px; background: var(--app-brand-soft); border-radius: 10px; font-size: 15px; }
body.app .tk-navrow { display: grid; grid-template-columns: minmax(220px, 320px) 1fr; gap: 14px; align-items: start; }
body.app .tk-navrow input { height: 42px; }
body.app .tk-navcard { display: flex; gap: 12px; align-items: flex-start; }
body.app .tk-navcard img { width: 84px; height: 84px; object-fit: contain; border: 1px solid var(--app-line); border-radius: 8px; background: #fff; }
body.app .tk-nopic { display: grid; place-items: center; width: 84px; height: 84px; border: 1px dashed var(--app-line-strong); border-radius: 8px; font-size: 11px; color: var(--app-muted); }
body.app .tk-dup { margin-top: 8px; padding: 8px 10px; border-radius: 8px; background: var(--app-warn-soft); color: var(--app-warn); font-size: 13px; }
body.app .tk-row { display: grid; grid-template-columns: minmax(160px, 230px) auto 1fr 30px; gap: 10px; align-items: start; padding: 10px; border: 1px solid var(--app-line); border-radius: 10px; margin-bottom: 8px; background: #fafbfd; }
body.app .tk-row select { height: 40px; }
body.app .tk-row-del { height: 40px; border: 0; background: none; font-size: 20px; color: var(--app-muted); cursor: pointer; }
body.app .tk-seg { display: inline-flex; border: 1px solid var(--app-line-strong); border-radius: 10px; overflow: hidden; height: 40px; }
body.app .tk-seg button { border: 0; background: #fff; padding: 0 12px; font: inherit; font-size: 13px; font-weight: 600; color: var(--app-muted); cursor: pointer; white-space: nowrap; }
body.app .tk-seg button + button { border-left: 1px solid var(--app-line-strong); }
body.app .tk-seg button.on { background: var(--app-brand); color: #fff; }
body.app .tk-submit { display: flex; justify-content: flex-end; gap: 10px; margin-bottom: 40px; }

/* person picker */
body.app .tk-pick { position: relative; display: flex; flex-wrap: wrap; align-items: center; gap: 6px; min-height: 40px; padding: 4px 6px; border: 1px solid var(--app-line-strong); border-radius: 10px; background: #fff; }
body.app .tk-pick.tk-pick-empty { border-color: #fca5a5; }
body.app .tk-pick-chips { display: contents; }
body.app .tk-pick-in { flex: 1 1 140px; min-width: 120px; height: 30px; border: 0 !important; box-shadow: none !important; padding: 0 4px; font-size: 14px; outline: none; }
body.app .tk-chip { display: inline-flex; align-items: center; gap: 6px; padding: 2px 4px 2px 2px; border-radius: 999px; background: var(--app-brand-soft); font-size: 13px; font-weight: 600; }
body.app .tk-chip .tk-av { border: 0; }
body.app .tk-chip button { border: 0; background: none; cursor: pointer; font-size: 15px; color: var(--app-muted); padding: 0 4px; }
body.app .tk-pick-list { position: absolute; z-index: 30; left: -1px; right: -1px; top: calc(100% + 4px); max-height: 300px; overflow-y: auto; background: #fff; border: 1px solid var(--app-line-strong); border-radius: 10px; box-shadow: var(--app-shadow-lg); }
body.app .tk-pick-opt { display: flex; align-items: center; gap: 10px; padding: 7px 10px; cursor: pointer; }
body.app .tk-pick-opt:hover { background: var(--app-brand-soft); }
body.app .tk-pick-opt small { display: block; color: var(--app-muted); font-size: 12px; }
body.app .tk-pick-opt.near { background: #f0fdf4; }
body.app .tk-pick-opt.near:hover { background: #dcfce7; }
body.app .tk-pick-none { padding: 10px; font-size: 13px; color: var(--app-muted); }

/* attachments */
body.app .tk-attach-row { display: flex; flex-wrap: wrap; gap: 8px; }
body.app .tk-attach-row:not(:empty) { margin-bottom: 8px; }
body.app .tk-attach-tools { display: flex; align-items: center; gap: 6px; }
body.app .tk-attach-btn { cursor: pointer; }
body.app .tk-thumb { position: relative; width: 72px; height: 72px; border-radius: 8px; background: #eee center / cover; border: 1px solid var(--app-line); }
body.app .tk-thumb-del { position: absolute; top: -7px; right: -7px; width: 22px; height: 22px; border-radius: 50%; border: 0; background: #0f172a; color: #fff; cursor: pointer; line-height: 1; }
body.app .tk-filechip { display: inline-flex; align-items: center; gap: 4px; padding: 4px 10px; border-radius: 8px; background: #f1f5f9; font-size: 13px; color: var(--app-ink); text-decoration: none; }

/* ticket page */
body.app .tk-head { display: flex; gap: 18px; }
body.app .tk-head.hot { border-color: #fda4af; box-shadow: inset 4px 0 0 #e11d48, var(--app-shadow); }
body.app .tk-head-main { flex: 1; min-width: 0; }
body.app .tk-head-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; font-size: 13px; color: var(--app-muted); }
body.app .tk-title { margin: 6px 0 8px; font-size: 22px; line-height: 1.3; }
body.app .tk-head-facts { display: flex; flex-wrap: wrap; gap: 6px 22px; font-size: 13.5px; }
body.app .tk-detail { margin-top: 12px; padding: 12px 14px; background: #f8fafc; border-radius: 10px; line-height: 1.55; }
body.app .tk-confirm { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; background: #f0f9ff; border-color: #7dd3fc; }
body.app .tk-confirm-btns { display: flex; gap: 8px; align-items: flex-start; }
body.app .tk-view { display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: 20px; align-items: start; }
body.app .tk-msgs { max-height: 62vh; overflow-y: auto; padding-right: 4px; }
body.app .tk-msg { display: flex; gap: 10px; margin: 0 0 12px; }
body.app .tk-msg.me { flex-direction: row-reverse; }
body.app .tk-bub { max-width: 78%; padding: 8px 12px; border-radius: 12px; background: #f1f5f9; }
body.app .tk-msg.me .tk-bub { background: var(--app-brand-soft); }
body.app .tk-bub-h { font-size: 12.5px; margin-bottom: 2px; }
body.app .tk-bub-h small { color: var(--app-muted); }
body.app .tk-bub-t { line-height: 1.5; overflow-wrap: anywhere; }
body.app .tk-files { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
body.app .tk-fimg img { display: block; width: 140px; height: 140px; object-fit: cover; border-radius: 8px; border: 1px solid var(--app-line); }
body.app .tk-sys { margin: 0 0 12px; text-align: center; font-size: 12.5px; color: var(--app-muted); }
body.app .tk-sys.warn { color: #b45309; background: var(--app-warn-soft); border-radius: 8px; padding: 6px 10px; }
body.app .tk-newmark { display: flex; align-items: center; gap: 10px; margin: 6px 0 12px; color: #dc2626; font-size: 12px; font-weight: 700; }
body.app .tk-newmark::before, body.app .tk-newmark::after { content: ""; flex: 1; border-top: 1px solid #fca5a5; }
body.app .tk-say { margin-top: 12px; border-top: 1px solid var(--app-line); padding-top: 12px; }
body.app .tk-say textarea { width: 100%; }
body.app .tk-say-bar { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; margin-top: 8px; }
body.app .tk-locrow { padding: 10px 0; border-bottom: 1px solid var(--app-line); }
body.app .tk-locrow:last-of-type { border-bottom: 0; }
body.app .tk-locrow-h { display: flex; align-items: center; gap: 8px; }
body.app .tk-st-not_ours { background: #fff7ed; margin: 0 -12px; padding: 10px 12px; border-radius: 10px; }
body.app .tk-st-removed { opacity: .55; }
body.app .tk-mode { font-size: 11px; font-weight: 700; padding: 1px 7px; border-radius: 6px; }
body.app .tk-mode-do { background: var(--app-brand-soft); color: var(--app-brand-2); }
body.app .tk-mode-fyi { background: #f3e8ff; color: #7e22ce; }
body.app .tk-warnline { color: #b45309; margin-top: 4px; }
body.app .tk-people { list-style: none; margin: 8px 0; padding: 0; }
body.app .tk-people li { display: flex; align-items: center; gap: 8px; padding: 3px 0; font-size: 14px; }
body.app .tk-okt { color: var(--app-ok); font-weight: 600; }
body.app .tk-rowbtns { display: flex; flex-wrap: wrap; gap: 6px; align-items: flex-start; }
body.app .tk-pop > summary { list-style: none; }
body.app .tk-pop > summary::-webkit-details-marker { display: none; }
body.app .tk-pop[open] { flex-basis: 100%; }
body.app .tk-popform { display: flex; flex-direction: column; gap: 8px; margin-top: 8px; padding: 10px; border: 1px solid var(--app-line); border-radius: 10px; background: #fafbfd; }
body.app .tk-popform .btn { align-self: flex-start; }
body.app .tk-addrow { margin-top: 10px; }
body.app .tk-cancel { margin: 0 4px 20px; font-size: 13px; }

/* settings */
body.app .tk-sgroups { display: flex; flex-direction: column; gap: 12px; }
body.app .tk-sgroup { border: 1px solid var(--app-line-strong); border-radius: 12px; padding: 10px 12px; background: #fff; }
body.app .tk-sgroup-h { display: flex; align-items: center; gap: 8px; }
body.app .tk-sgroup-h .tk-in-name { font-weight: 700; flex: 0 1 240px; }
body.app .tk-sgroup-h .tk-in-hint { flex: 1; }
body.app .tk-in-icon { width: 56px !important; text-align: center; }
body.app .tk-sgroup input, body.app .tk-stopics input.tk-in-name { height: 36px; }
body.app .tk-stopics { list-style: none; margin: 8px 0 6px 28px; padding: 0; min-height: 30px; border-left: 2px solid var(--app-line); padding-left: 8px; }
body.app .tk-stopics li { display: flex; align-items: center; gap: 8px; padding: 4px; border-radius: 8px; flex-wrap: wrap; }
body.app .tk-stopics li:hover { background: #f8fafc; }
body.app .tk-stopics .tk-in-name { flex: 0 1 300px; }
body.app .tk-handle { cursor: grab; color: var(--app-muted); font-size: 18px; user-select: none; padding: 0 2px; }
body.app .tk-ticon { width: 22px; text-align: center; }
body.app .tk-ghost { opacity: .4; }
body.app .tk-chk { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; white-space: nowrap; font-weight: 500; }
body.app .tk-chk input { width: auto; height: auto; }
body.app .tk-addtopic { margin-left: 38px; font-size: 13px; }
body.app .tk-sbar { display: flex; align-items: center; gap: 10px; margin-top: 16px; }
body.app .tk-checks { display: flex; flex-direction: column; gap: 8px; margin: 6px 0 20px; }
body.app .tk-locgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 8px; margin-top: 10px; }
body.app .tk-locpick { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 8px 10px; border: 1px solid var(--app-line); border-radius: 10px; }
body.app .tk-locpick.on { border-color: var(--app-brand-2); background: var(--app-brand-soft); }
body.app .tk-locpick select { width: auto; height: 32px; font-size: 13px; }
body.app .tk-general { max-width: 720px; }

@media (max-width: 900px) {
  body.app .tk-view { grid-template-columns: 1fr; }
  body.app .tk-2col, body.app .tk-navrow { grid-template-columns: 1fr; }
  body.app .tk-row { grid-template-columns: 1fr 30px; }
  body.app .tk-row .tk-seg, body.app .tk-row .tk-row-people { grid-column: 1; }
  body.app .tk-row .tk-row-del { grid-row: 1; grid-column: 2; }
  body.app .tk-head { flex-direction: column; }
  body.app .tk-sgroup-h { flex-wrap: wrap; }
}
body.app :is(.tk-new, .tk-view, .tk-queue, .tk-settings, .tk-confirm) [hidden] { display: none !important; }
body.app :is(.tk-new, .tk-view, .tk-queue, .tk-settings, .tk-confirm) :is(input[type=text], input[type=search], input[type=number], input[type=date], input:not([type]), select, textarea) {
  min-height: 0; height: 40px; padding: 0 10px; font: inherit; font-size: 14px; color: var(--app-ink); background: #fff;
  border: 1px solid var(--app-line-strong); border-radius: var(--app-radius-sm); width: 100%; max-width: 100%;
}
body.app :is(.tk-new, .tk-view, .tk-queue, .tk-settings, .tk-confirm) textarea { height: auto; padding: 8px 10px; line-height: 1.5; resize: vertical; }
body.app :is(.tk-new, .tk-view, .tk-queue, .tk-settings, .tk-confirm) :is(input, select, textarea):focus { outline: none; border-color: var(--app-brand-2); box-shadow: 0 0 0 3px var(--app-brand-soft); }
body.app .tk-tool :is(select, input[type=date]) { width: auto; height: 34px; font-size: 13px; }
body.app .tk-tool .tk-search, body.app .tk-settings .tk-search { width: auto; }
body.app .tk-pick .tk-pick-in { height: 30px; width: auto; border: 0 !important; box-shadow: none !important; padding: 0 4px; }
body.app .tk-locpick select, body.app .tk-inline input { width: auto; }
body.app .tk-loctable select { width: 100%; }
body.app .tk-av-i { background: #64748b; }
body.app .tk-pick-opt .tk-av, body.app .tk-chip .tk-av { border: 0; }

/* ==== Dashboard: each person's own card order (2026-10-25) ==== */
.widget-bar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.widget-bar .group-title { margin-right: auto; }
.widget-sort-btn { border: 0; background: none; font: inherit; font-size: 13px; font-weight: 600; color: var(--app-muted); cursor: pointer; padding: 4px 8px; border-radius: 8px; }
.widget-sort-btn:hover { background: var(--app-brand-soft); color: var(--app-brand); }
.widget-sort-bar { display: flex; align-items: center; gap: 12px; font-size: 13px; color: var(--app-muted); }
.widget-sort-bar[hidden], .widget-sort-btn[hidden] { display: none; }
.widget-sort-link { border: 0; background: none; font: inherit; font-size: 13px; color: var(--app-brand-2); cursor: pointer; text-decoration: underline; padding: 0; }
.widget { position: relative; }
.widget-handle { display: none; }
.widget-grid.sorting .widget { cursor: grab; outline: 2px dashed var(--app-line-strong); outline-offset: -2px; }
.widget-grid.sorting .widget-handle { display: block; position: absolute; top: 8px; right: 10px; color: var(--app-muted); font-size: 18px; }
.widget-grid.sorting .widget-head .tile-arrow { visibility: hidden; }
.widget-ghost { opacity: .35; }
body.app .tk-table td.tk-fit { width: 1%; padding-right: 4px; }
/* queue list: every column only as wide as its content → even gaps; spare width goes to the last column */
/* list: every column width:1% → the browser shares the spare width out equally (full width, even gaps), pure CSS */
body.app .tk-compact { width: 100%; }
body.app .tk-compact th, body.app .tk-compact td { width: 1%; white-space: nowrap; padding-right: 22px; }
body.app .tk-compact td.tk-fit { padding-right: 10px; }
body.app .tk-ttl { width: max-content; max-width: min(420px, 28vw); white-space: normal; }
body.app .tk-tpc { width: max-content; max-width: min(260px, 18vw); white-space: normal; }
@media (max-width: 1300px) { body.app .tk-compact th, body.app .tk-compact td { padding-right: 10px; padding-left: 8px; } }

/* Hub pages use the whole screen width (header + content), 2026-10-25 — was capped at 1600px */
.app-header-inner, .app-main, .app-main.wide { max-width: none; }
.widget-grid { grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }  /* cards stretch to fill the row */

/* ==== NPD project → Tickets (2026-10-25) ==== */
body.app .tk-tile-dim { opacity: .6; border-style: dashed; }
body.app .tk-tile-dim:hover { opacity: 1; }
body.app .tk-npdhead { margin: -4px 0 14px; padding: 8px 12px; border-radius: 10px; background: var(--app-brand-soft); font-size: 14px; }
body.app .tk-mtx { margin: 10px 0 0; display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
body.app .tk-npdlist { list-style: none; margin: 0; padding: 0; }
body.app .tk-npdlist li { padding: 7px 0; border-bottom: 1px solid var(--app-line); font-size: 13.5px; }
body.app .tk-npdlist li:last-child { border-bottom: 0; }
body.app .tk-npd-l1 { margin-bottom: 2px; }
body.app .tk-npd-subj { display: block; color: var(--app-brand-2); text-decoration: none; overflow-wrap: anywhere; }
body.app .tk-npd-subj:hover { text-decoration: underline; }
body.app .tk-npd-note { background: #fffbeb; margin: 0 -8px; padding: 7px 8px !important; border-radius: 8px; }
body.app .tk-mscform { display: flex; gap: 8px; }
body.app .tk-mscform input { flex: 1; }
body.app .tk-msc { border-color: #86efac; }
body.app .np-msc { margin: 6px 0 0; display: flex; flex-wrap: wrap; gap: 6px; }
body.app .np-msc-chip { display: inline-block; padding: 3px 10px; border-radius: 999px; background: var(--app-ok-soft); color: var(--app-ok); font-size: 13px; }
body.app .np-msc-chip a { color: inherit; }
body.app .np-tickets .mt-card-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
body.app .np-newtk { position: relative; }
body.app .np-newtk > summary { list-style: none; }
body.app .np-newtk > summary::-webkit-details-marker { display: none; }
body.app .np-newtk-menu { position: absolute; right: 0; top: calc(100% + 6px); z-index: 20; width: 320px; padding: 6px; background: #fff; border: 1px solid var(--app-line-strong); border-radius: 12px; box-shadow: var(--app-shadow-lg); }
body.app .np-newtk-item { display: flex; gap: 10px; align-items: flex-start; padding: 9px 10px; border-radius: 8px; color: var(--app-ink); text-decoration: none; }
body.app .np-newtk-item:hover { background: var(--app-brand-soft); }
body.app .np-newtk-item > span:first-child { font-size: 20px; line-height: 1.2; }
body.app .np-newtk-item small { display: block; color: var(--app-muted); font-size: 12px; }
body.app .np-newtk-item.dim { opacity: .65; }
body.app .np-newtk-sep { padding: 6px 10px 2px; font-size: 11.5px; color: var(--app-muted); border-top: 1px solid var(--app-line); margin-top: 4px; }
body.app .np-tklist { list-style: none; margin: 0; padding: 0; }
body.app .np-tklist li { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; padding: 8px 0; border-bottom: 1px solid var(--app-line); font-size: 13.5px; }
body.app .np-tklist li:last-child { border-bottom: 0; }
body.app .np-tk-no { font-weight: 700; }
body.app .np-tk-topic { flex: 1; min-width: 120px; }
body.app .np-tk-who { width: 100%; font-size: 12px; }

/* ==== Ticket: NAV autofill + "ทำพร้อมกัน" sets (2026-10-26) ==== */
body.app .tk-acwrap { position: relative; }
body.app .tk-ac { position: absolute; z-index: 40; left: 0; top: calc(100% + 4px); width: max-content; min-width: 100%; max-width: min(620px, 90vw); max-height: 340px; overflow-y: auto; background: #fff; border: 1px solid var(--app-line-strong); border-radius: 10px; box-shadow: var(--app-shadow-lg); }
body.app .tk-ac-opt { padding: 8px 10px; cursor: pointer; font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
body.app .tk-ac-opt small { color: var(--app-muted); }
body.app .tk-ac-opt:hover, body.app .tk-ac-opt.on { background: var(--app-brand-soft); }
body.app .tk-dupbox { margin-top: 14px; border-top: 1px dashed var(--app-line-strong); padding-top: 12px; }
body.app .tk-dupbox summary { cursor: pointer; font-weight: 600; color: var(--app-brand-2); }
body.app .tk-duppanel { margin-top: 10px; padding: 12px; border: 1px solid var(--app-line); border-radius: 10px; background: #fafbfd; }
body.app .tk-duptools { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 8px; }
body.app .tk-duptools input[type=search] { flex: 1 1 240px; width: auto; height: 34px; }
body.app .tk-dupchips { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-bottom: 8px; }
body.app .tk-chip-po { padding: 2px 4px 2px 10px; }
body.app .tk-duplist { max-height: 420px; overflow-y: auto; border: 1px solid var(--app-line); border-radius: 8px; background: #fff; }
body.app .tk-dupopt { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; padding: 7px 10px; border-bottom: 1px solid var(--app-line); cursor: pointer; font-size: 13.5px; }
body.app .tk-dupopt:last-child { border-bottom: 0; }
body.app .tk-dupopt input { width: auto; height: auto; }
body.app .tk-dupopt.on { background: var(--app-brand-soft); }
body.app .tk-set { padding: 14px 18px; }
body.app .tk-set-h { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; }
body.app .tk-setlist { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
body.app .tk-setitem { display: inline-flex; align-items: center; gap: 8px; padding: 6px 10px; border: 1px solid var(--app-line); border-radius: 10px; color: var(--app-ink); text-decoration: none; font-size: 13px; }
body.app .tk-setitem span small { display: block; color: var(--app-muted); }
body.app .tk-setitem:hover { border-color: var(--app-brand-2); }
body.app .tk-setitem.on { border-color: var(--app-brand); box-shadow: 0 0 0 2px var(--app-brand-soft); }
body.app .tk-pick.tk-pick-empty { border-color: var(--app-line-strong); } body.app .tk-row .tk-pick.tk-pick-empty { border-color: #fca5a5; }  /* red only where a person is required */

/* ---------------------------------------------------------------- เข้างาน (attendance, 2026-10-26) */
/* Pages with the left เมนู: let wide tables scroll inside their box on phones instead of widening the page. */
body.app .app-side-main { min-width: 0; }
body.app .at-pick input, body.app .at-pick select { font: inherit; padding: 9px 10px; border: 1px solid var(--app-line); border-radius: 10px; background: #fff; color: var(--app-ink); }
body.app .at-dayline { margin: 0 0 12px; }
body.app .hm-kpis.at-kpis { grid-template-columns: repeat(6, minmax(0, 1fr)); }
body.app .at-k-ok b { color: var(--app-ok); }
body.app .at-k-warn b { color: var(--app-warn); }
body.app .at-k-bad b { color: var(--app-bad); }
body.app .at-k-unk b { color: #7c3aed; }
body.app .at-k-info b { color: #0e7490; }
body.app .at-zero { color: #c0c6cf; }
body.app .at-sum .at-warn, body.app a.at-warn { color: var(--app-warn); font-weight: 700; }
body.app .at-sum .at-bad, body.app a.at-bad, body.app .hm-table .at-bad { color: var(--app-bad); font-weight: 700; }
body.app .at-sum .at-unk, body.app a.at-unk, body.app .hm-table .at-unk { color: #7c3aed; font-weight: 700; }
body.app .hm-table .at-warn { color: var(--app-warn); font-weight: 700; }
body.app .at-sum th.at-hgroup { text-align: center; border-bottom: 1px solid var(--app-line); }
body.app .at-sum th.at-sub { font-size: 11px; font-weight: 500; }
body.app tr.at-clk { cursor: pointer; }
body.app tr.at-clk:hover td { filter: brightness(0.97); }
body.app tr.at-sel td { box-shadow: inset 0 0 0 9999px rgba(22, 35, 63, 0.07); }
body.app a.at-plain { color: inherit; text-decoration: none; }
body.app .at-detail { margin-top: 18px; scroll-margin-top: 70px; }
body.app .at-detail h3 { margin: 0 0 8px; font-size: 16px; }
body.app .at-detail h3 .text-muted { font-weight: 500; }
body.app .at-tag-ok { background: var(--app-ok-soft); color: var(--app-ok); }
body.app .at-tag-warn { background: var(--app-warn-soft); color: var(--app-warn); }
body.app .at-tag-bad { background: var(--app-bad-soft); color: var(--app-bad); }
body.app .at-tag-info { background: #e6f6f9; color: #0e7490; }
body.app .at-tag-unk { background: #f1eaff; color: #6d28d9; }
body.app .at-tag-grey { background: #eef1f5; color: #475569; }
body.app .at-cal { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 6px; max-width: 820px; }
body.app .at-cal-h { font-size: 12px; color: var(--app-muted); text-align: center; }
body.app .at-cal-d { background: #fff; border: 1px solid var(--app-line); border-radius: 10px; padding: 6px 7px; min-height: 64px; font-size: 11.5px; line-height: 1.35; overflow: hidden; }
body.app .at-cal-d b { display: block; font-size: 13px; }
body.app .at-cal-d span { color: var(--app-muted); }
body.app .at-cal-d.at-empty { background: none; border: 0; }
body.app .at-cal-d.at-none { background: #fafafa; color: #cbd5e1; }
body.app .at-cal-d.at-st-in { border-left: 4px solid var(--app-ok); }
body.app .at-cal-d.at-st-late { border-left: 4px solid var(--app-warn); background: #fffaf0; }
body.app .at-cal-d.at-st-leave { border-left: 4px solid #0e7490; background: #effafc; }
body.app .at-cal-d.at-st-abs { border-left: 4px solid var(--app-bad); background: #fff3f3; }
body.app .at-cal-d.at-st-unk { border-left: 4px solid #7c3aed; background: #f7f2ff; }
body.app .at-cal-d.at-st-off { background: #f3f4f6; color: #94a3b8; }
body.app .at-sum .at-lv { display: none; background-color: rgba(14, 116, 144, 0.06); }
body.app .at-sum.at-lv-open .at-lv { display: table-cell; }
body.app .at-sum .hm-total td.at-lv { background-color: #fff7cc; }
body.app .at-sum.at-lv-open .at-lv-sum { display: none; }
body.app .at-lv-btn { font: inherit; font-size: 12px; line-height: 1; padding: 2px 6px; margin-left: 2px; border: 1px solid var(--app-line); border-radius: 6px; background: #fff; color: #0e7490; cursor: pointer; }
body.app .at-lv-btn:hover { background: #e6f6f9; }
@media print { body.app .at-lv-btn { display: none; } }
@media (max-width: 700px) {
  body.app .hm-kpis.at-kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  body.app .at-cal { gap: 3px; }
  body.app .at-cal-d { min-height: 48px; padding: 4px; font-size: 10px; }
  body.app .at-cal-d span { display: none; }
}
@media print {
  body.app .at-chips, body.app .at-pick { display: none !important; }
  body.app tr.at-sel td { box-shadow: none; }
}

/* แผนกที่ดูแลเพิ่ม — extra departments on the user form (2026-10-27) */
.xd-field { margin-top: 4px; }
.xd-sub { margin: 2px 0 8px; font-size: 12px; }
.xd-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; min-height: 28px; align-items: center; }
.xd-chip { display: inline-flex; align-items: center; gap: 4px; padding: 3px 4px 3px 10px; border-radius: 999px; background: #e8eefb; color: var(--msi-accent); font-size: 13px; font-weight: 600; }
.xd-chip button { border: 0; background: transparent; color: inherit; font-size: 16px; line-height: 1; width: 22px; height: 22px; border-radius: 50%; cursor: pointer; padding: 0; min-height: 0; }
.xd-chip button:hover { background: rgba(22, 35, 63, 0.12); }
.xd-none { font-size: 13px; }
.xd-pick { border: 1px solid var(--msi-border); border-radius: var(--msi-radius); background: var(--msi-card-bg); }
.xd-pick > summary { cursor: pointer; padding: 9px 12px; font-size: 14px; font-weight: 600; color: var(--msi-accent); list-style: none; }
.xd-pick > summary::-webkit-details-marker { display: none; }
.xd-pick > summary::before { content: '+ '; }
.xd-pick[open] > summary::before { content: '− '; }
.xd-pick[open] > summary { border-bottom: 1px solid var(--msi-border); }
.xd-pick .xd-search { display: block; margin: 10px 12px 0; width: calc(100% - 24px); max-width: calc(100% - 24px); }
.xd-groups { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 4px 16px; padding: 6px 12px 12px; }
.xd-group { border: 0; margin: 0; padding: 0; }
.xd-group legend { font-size: 12px; font-weight: 700; color: var(--msi-text-muted); padding: 8px 0 2px; }
.xd-opt { display: flex; align-items: center; gap: 8px; padding: 5px 4px; border-radius: 6px; font-size: 14px; cursor: pointer; }
.xd-opt:hover { background: #f4f6fa; }
.xd-opt input { width: auto; min-height: auto; margin: 0; }
.xd-opt small { color: var(--msi-text-muted); font-size: 11px; }
.xd-opt .xd-home { display: none; margin-left: auto; font-style: normal; font-size: 11px; color: var(--msi-text-muted); background: #eef0f3; border-radius: 999px; padding: 1px 7px; }
.xd-opt.is-home { cursor: default; opacity: 0.6; }
.xd-opt.is-home .xd-home { display: inline; }
.xd-opt[hidden], .xd-group[hidden] { display: none; }
.user-xd { display: block; font-size: 11px; color: var(--msi-text-muted); }

/* ==== แจ้งลางาน / Leave (2026-10-27) — all classes start with lv- (phone first) ==== */

body.app .lv-page { max-width: 560px; margin: 0 auto; }
body.app .lv-page.lv-page-wide { max-width: 900px; }
body.app .lv-mt { margin-top: 12px; }
body.app .lv-bad { color: var(--app-bad); }
body.app .lv-hint { font-size: 13px; color: var(--app-muted); margin: 6px 2px 0; }
body.app .lv-note { font-size: 14px; background: var(--app-warn-soft); border-color: #f3e1a7; }
body.app .lv-h2 { font-size: 16px; margin: 18px 0 8px; }
body.app .lv-h2row { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 8px; }
body.app .lv-h2row .lv-h2, body.app .lv-h2row p { margin: 0; }
body.app .lv-inline { display: inline; margin: 0; }

/* buttons (big, thumb friendly) */
body.app .lv-btn { display: block; width: 100%; border: 0; border-radius: 12px; padding: 14px; font: inherit; font-size: 16px; font-weight: 600; text-align: center; cursor: pointer; text-decoration: none; }
body.app .lv-btn-p { background: var(--app-brand); color: #fff; }
body.app .lv-btn-g { background: #fff; color: var(--app-brand); border: 1px solid var(--app-line-strong); }
body.app .lv-btn-ok { background: var(--app-ok); color: #fff; }
body.app .lv-btn-no { background: #fff; color: var(--app-bad); border: 1px solid #f1c6c3; }
body.app .lv-row2 { display: flex; gap: 8px; }
body.app .lv-row2 .lv-btn { padding: 11px; font-size: 15px; }

/* vacation card */
body.app .lv-quota { text-align: center; padding: 20px 14px; margin-bottom: 12px; }
body.app .lv-quota-sm { padding: 14px; }
body.app .lv-quota-lbl { color: var(--app-muted); font-size: 13px; }
body.app .lv-quota-big { font-size: 44px; font-weight: 700; color: var(--app-brand); line-height: 1.1; }
body.app .lv-quota-sm .lv-quota-big { font-size: 34px; }
body.app .lv-quota-big small, body.app .lv-num small { font-size: 18px; font-weight: 600; color: var(--app-ink); }
body.app .lv-quota-sub { color: var(--app-muted); font-size: 12px; margin-top: 4px; }
body.app .lv-bd-wrap summary { color: var(--app-brand); font-size: 13px; font-weight: 600; margin-top: 6px; cursor: pointer; list-style: none; }
body.app .lv-bd-wrap summary::-webkit-details-marker { display: none; }
body.app .lv-bd-wrap[open] summary { font-size: 0; }
body.app .lv-bd-wrap[open] summary::after { content: "▴ ซ่อนรายละเอียด"; font-size: 13px; }
body.app .lv-bd { border-top: 1px solid var(--app-line); margin-top: 10px; padding-top: 10px; text-align: left; font-size: 13px; display: grid; grid-template-columns: 1fr auto; gap: 3px 12px; }
body.app .lv-bd .lv-tt { border-top: 1px solid var(--app-line); padding-top: 5px; font-weight: 700; }
body.app .lv-bd .lv-m { color: var(--app-bad); }
body.app .lv-bd .lv-p { color: var(--app-ok); }
body.app .lv-num { font-size: 28px; font-weight: 700; color: var(--app-brand); }
body.app .lv-sumgrid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin: 12px 0; }
body.app .lv-sumgrid > .card { margin: 0; }

/* เบี้ยขยัน */
body.app .lv-dil { padding: 14px; margin-bottom: 12px; }
body.app .lv-dil-h { display: flex; justify-content: space-between; align-items: center; font-size: 13px; }
body.app .lv-dil-h b { font-size: 15px; }
body.app .lv-dil-txt { font-size: 13px; }
body.app .lv-steps { display: flex; gap: 6px; margin: 10px 0 8px; }
body.app .lv-steps span { flex: 1; text-align: center; border-radius: 8px; padding: 6px 0; font-size: 13px; font-weight: 600; background: #eef0f3; color: #94a3b8; }
body.app .lv-steps span.done { background: var(--app-ok-soft); color: var(--app-ok); }
body.app .lv-steps span.now { background: var(--app-brand); color: #fff; }
body.app .lv-steps span.lost { background: var(--app-bad-soft); color: var(--app-bad); text-decoration: line-through; }
body.app .lv-wl { background: var(--app-warn-soft); border: 1px solid #f3e1a7; color: #7a4b06; border-radius: 10px; padding: 9px 11px; font-size: 13px; margin-top: 10px; }
body.app .lv-wl[hidden], body.app .lv-sum[hidden] { display: none; }

/* lists */
body.app .lv-sec { font-size: 13px; font-weight: 600; color: var(--app-muted); margin: 18px 2px 8px; display: flex; justify-content: space-between; }
body.app .lv-badge { background: var(--app-bad); color: #fff; border-radius: 99px; padding: 1px 8px; font-size: 12px; margin-left: 4px; }
body.app .lv-item { background: #fff; border: 1px solid var(--app-line); border-radius: 12px; padding: 12px; margin-bottom: 8px; }
body.app .lv-item-link { color: inherit; text-decoration: none; display: block; }
body.app .lv-item-t { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; }
body.app .lv-ty { font-weight: 600; }
body.app .lv-d { font-size: 13px; }
body.app .lv-no { color: var(--app-muted); font-size: 11.5px; }
body.app .lv-item-ft { display: flex; justify-content: space-between; align-items: center; margin-top: 8px; gap: 8px; }
body.app .lv-cancel { background: none; border: 0; padding: 4px 0; font: inherit; font-size: 13px; color: var(--app-bad); cursor: pointer; }
body.app .lv-warn-line { font-size: 12.5px; color: #7a4b06; background: var(--app-warn-soft); border-radius: 8px; padding: 6px 8px; margin-top: 8px; }
body.app .lv-linkrow { display: flex; justify-content: space-between; align-items: center; background: #fff; border: 1px solid var(--app-line); border-radius: 12px; padding: 14px; color: var(--app-ink); text-decoration: none; font-weight: 500; margin-bottom: 8px; }
body.app .lv-linkrow span { color: var(--app-muted); }
body.app .lv-hrbar { display: flex; flex-wrap: wrap; gap: 6px 14px; align-items: center; background: var(--app-brand-soft); border: 1px solid #d6dff3; border-radius: 12px; padding: 12px 14px; color: var(--app-ink); text-decoration: none; font-size: 13px; margin-bottom: 12px; }
body.app .lv-hrbar > b { font-size: 15px; }
body.app .lv-hrbar i { margin-left: auto; font-style: normal; color: var(--app-muted); }

/* status pills */
body.app .lv-st { display: inline-block; border-radius: 99px; padding: 2px 10px; font-size: 12px; font-weight: 500; white-space: nowrap; }
body.app .lv-s-wait { background: var(--app-warn-soft); color: var(--app-warn); }
body.app .lv-s-ok { background: var(--app-ok-soft); color: var(--app-ok); }
body.app .lv-s-hr { background: #e6f6f9; color: #0e7490; }
body.app .lv-s-no { background: var(--app-bad-soft); color: var(--app-bad); }
body.app .lv-s-done { background: #eef0f3; color: #475569; }
body.app .lv-s-closed { background: #f3eefe; color: #6d28d9; }
body.app .lv-tag { display: inline-block; font-size: 11px; border-radius: 6px; padding: 0 6px; background: #eef0f3; color: #475569; margin-top: 2px; }
body.app .lv-tag-ex { background: #e6f6f9; color: #0e7490; }

/* person + key/value */
body.app .lv-who { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
body.app .lv-who b { display: block; }
body.app .lv-who span { font-size: 12px; color: var(--app-muted); }
body.app .lv-kv { font-size: 13px; display: grid; grid-template-columns: 80px 1fr; gap: 3px 8px; margin-bottom: 10px; }
body.app .lv-kv > span { color: var(--app-muted); }
body.app .lv-att { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; color: var(--app-brand); background: var(--app-brand-soft); border-radius: 6px; padding: 2px 8px; text-decoration: none; }
body.app .lv-view-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; margin-bottom: 12px; }
body.app .lv-docs { border-top: 1px solid var(--app-line); padding-top: 10px; display: flex; flex-wrap: wrap; gap: 8px; align-items: center; font-size: 13px; }
body.app .lv-thumbs { display: flex; gap: 8px; flex-wrap: wrap; width: 100%; }
body.app .lv-thumbs img { width: 96px; height: 96px; object-fit: cover; border-radius: 10px; border: 1px solid var(--app-line); }
body.app .lv-cancel-box summary, body.app .lv-hr-box summary { cursor: pointer; font-weight: 600; color: var(--app-brand); }
body.app .lv-cancel-box summary { color: var(--app-bad); }
body.app .lv-hr-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--app-line); font-size: 13px; }
body.app .lv-hr-row:last-child { border-bottom: 0; }
body.app .lv-hr-row input[type=text], body.app .lv-hr-row input[type=date], body.app .lv-hr-row select { height: 36px; border: 1px solid var(--app-line-strong); border-radius: 8px; padding: 0 8px; font: inherit; }

/* form */
body.app .lv-f { display: block; font-weight: 600; font-size: 13px; margin: 14px 0 6px; }
body.app .lv-inp { width: 100%; border: 1px solid var(--app-line-strong); border-radius: 10px; padding: 11px 12px; font: inherit; font-size: 16px; background: #fff; color: var(--app-ink); }
body.app textarea.lv-inp { resize: vertical; min-height: 64px; }
body.app .lv-types { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
body.app .lv-ty-b { display: block; cursor: pointer; }
body.app .lv-ty-b input { position: absolute; opacity: 0; pointer-events: none; }
body.app .lv-ty-b span { display: block; border: 1px solid var(--app-line-strong); background: #fff; border-radius: 10px; padding: 11px 10px; font-size: 14px; min-height: 46px; }
body.app .lv-ty-b span small { display: block; color: var(--app-muted); font-size: 11px; font-weight: 400; }
body.app .lv-ty-b input:checked + span { border: 2px solid var(--app-brand); background: var(--app-brand-soft); padding: 10px 9px; font-weight: 600; }
body.app .lv-ty-b input:focus-visible + span { outline: 2px solid var(--app-brand); outline-offset: 2px; }
body.app .lv-more { grid-column: 1 / -1; }
body.app .lv-more summary { color: var(--app-brand); font-size: 13px; text-align: center; padding: 6px; cursor: pointer; list-style: none; }
body.app .lv-more summary::-webkit-details-marker { display: none; }
body.app .lv-more > .lv-types { margin-top: 4px; }
body.app .lv-seg { display: flex; background: #eceef2; border-radius: 10px; padding: 3px; }
body.app .lv-seg label { flex: 1; cursor: pointer; }
body.app .lv-seg input { position: absolute; opacity: 0; pointer-events: none; }
body.app .lv-seg span { display: block; text-align: center; padding: 9px 4px; border-radius: 8px; font-size: 14px; color: var(--app-muted); }
body.app .lv-seg input:checked + span { background: #fff; color: var(--app-ink); font-weight: 600; box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08); }
body.app .lv-dates { display: flex; gap: 8px; align-items: center; }
body.app .lv-dates > .lv-inp { flex: 1; min-width: 0; }
body.app .lv-to { display: flex; gap: 8px; align-items: center; flex: 1; min-width: 0; color: var(--app-muted); }
body.app .lv-to[hidden], body.app #lv_part_wrap[hidden], body.app #lv_time_wrap[hidden], body.app #lv_doc_wrap[hidden], body.app #lv_cert[hidden] { display: none; }
body.app .lv-to .lv-inp { flex: 1; min-width: 0; }
body.app .lv-toggle { display: flex; align-items: center; gap: 10px; background: #fff; border: 1px solid var(--app-line-strong); border-radius: 10px; padding: 10px 12px; margin-top: 10px; cursor: pointer; }
body.app .lv-toggle input { position: absolute; opacity: 0; pointer-events: none; }
body.app .lv-toggle i { display: inline-block; width: 40px; height: 24px; border-radius: 99px; background: #d1d5db; position: relative; flex: none; transition: background .15s; }
body.app .lv-toggle i::after { content: ""; position: absolute; left: 3px; top: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; transition: left .15s; }
body.app .lv-toggle input:checked + i { background: var(--app-ok); }
body.app .lv-toggle input:checked + i::after { left: 19px; }
body.app .lv-photos .mt-photo-row { margin-top: 0; }
body.app .lv-photos .lv-photo-add { width: 100%; height: auto; min-height: 64px; padding: 12px; border: 1.5px dashed var(--app-line-strong); color: var(--app-brand); font-weight: 600; }
body.app .lv-photos .lv-photo-add span { font-size: 15px; }
body.app .lv-photos .lv-photo-add small { color: var(--app-muted); font-weight: 400; font-size: 11px; }
body.app .lv-photos .mt-photo ~ .lv-photo-add { width: 96px; min-height: 96px; }
body.app .lv-photos .mt-photo ~ .lv-photo-add small { display: none; }
body.app .lv-sum { background: var(--app-brand-soft); border-radius: 12px; padding: 12px; margin: 16px 0 12px; font-size: 13px; }
body.app .lv-sum b { font-size: 15px; }
body.app .lv-pts { color: var(--app-muted); }
body.app .lv-res { background: #fff; border: 1px solid var(--app-line); border-radius: 10px; margin-top: 6px; overflow: hidden; }
body.app .lv-res:not(:has(.lv-res-row:not([hidden]))) { display: none; }
body.app .lv-res-row { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-bottom: 1px solid var(--app-line); cursor: pointer; }
body.app .lv-res-row[hidden] { display: none; }
body.app .lv-res-row:last-child { border-bottom: 0; }
body.app .lv-res-row input { flex: none; }
body.app .lv-res-row:has(input:checked) { background: var(--app-brand-soft); }
body.app .lv-res-row b { display: block; font-size: 14px; font-weight: 600; }
body.app .lv-res-row small { display: block; color: var(--app-muted); font-size: 12px; }

/* history */
body.app .lv-mon { font-size: 12px; font-weight: 600; color: var(--app-muted); margin: 14px 2px 6px; }
body.app .lv-hrow { background: #fff; border: 1px solid var(--app-line); border-radius: 12px; padding: 10px 12px; margin-bottom: 6px; display: flex; justify-content: space-between; gap: 8px; color: inherit; text-decoration: none; }
body.app .lv-hrow-l b { display: block; font-size: 14px; }
body.app .lv-hrow-l span { font-size: 12px; color: var(--app-muted); }
body.app .lv-hrow-r { text-align: right; font-size: 12px; color: var(--app-muted); white-space: nowrap; }
body.app .lv-hrow-r b { display: block; color: var(--app-ink); font-size: 13px; }

/* settings (desktop) */
body.app .lv-set-lay { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 20px; align-items: start; }
body.app .lv-set-lay > div:only-child { grid-column: 1 / -1; }
body.app .lv-set-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; align-items: start; }
body.app .lv-ed { position: sticky; top: 76px; }
body.app .lv-ed .lv-f input, body.app .lv-ed .lv-f select { display: block; width: 100%; margin-top: 4px; font-weight: 400; }
body.app .lv-formgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; margin: 10px 0; }
body.app .lv-formgrid label { display: grid; gap: 4px; font-size: 12.5px; color: var(--app-muted); font-weight: 600; }
body.app .lv-formgrid small { font-weight: 400; font-size: 11.5px; }
body.app .lv-formgrid input[type=text], body.app .lv-formgrid input[type=date], body.app .lv-formgrid select, body.app .lv-ed input[type=text], body.app .lv-ed input[type=date], body.app .lv-ed select,
body.app .card .data-table input[type=text], body.app .card .mt-bar input[type=text], body.app .card .mt-bar input[type=date] { height: 38px; border: 1px solid var(--app-line-strong); border-radius: 8px; padding: 0 10px; font: inherit; color: var(--app-ink); background: #fff; min-width: 0; max-width: 100%; }
body.app .lv-formgrid input[type=text], body.app .lv-formgrid input[type=date], body.app .lv-formgrid select { width: 100%; }
body.app .lv-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 16px; flex-wrap: wrap; }
body.app .lv-actions .btn-ghost:first-child { margin-right: auto; }
body.app .lv-chk { display: flex; align-items: center; gap: 8px; font-size: 14px; padding: 4px 0; cursor: pointer; }
body.app .lv-checks { display: flex; flex-wrap: wrap; gap: 2px 16px; }
body.app .lv-comm { border-top: 1px solid var(--app-line); padding: 10px 0; }
body.app .lv-comm summary { cursor: pointer; }

@media (max-width: 1200px) {
  body.app .lv-set-lay, body.app .lv-set-2 { grid-template-columns: 1fr; }
  body.app .lv-ed { position: static; }
}
@media (max-width: 600px) {
  body.app .lv-sumgrid { grid-template-columns: 1fr 1fr; }
  body.app .lv-sumgrid > .lv-quota { grid-column: 1 / -1; }
  body.app .lv-quota-big { font-size: 40px; }
}
body.app .lv-formgrid label.lv-chk { display: flex; align-self: end; font-weight: 400; color: var(--app-ink); }
body.app .lv-late { max-width: 760px; }
body.app .lv-tier-table input[type=text] { height: 36px; border: 1px solid var(--app-line-strong); border-radius: 8px; padding: 0 8px; font: inherit; }

/* ==== นำเข้า / Import RT / RTS (2026-11-03) — all classes start with im- (PC first; tabs/bar reuse mt-) ==== */
body.app .im-page { padding-bottom: 40px; }
body.app .im-page [hidden] { display: none !important; }
body.app .im-head { display: flex; gap: 12px; align-items: flex-start; justify-content: space-between; flex-wrap: wrap; }
body.app .im-head-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
body.app .im-small { font-size: 12px; }
body.app .im-mt { margin-top: 14px; }
body.app .im-red { color: var(--app-bad) !important; }
body.app .im-ok { color: var(--app-ok); font-weight: 700; }
body.app .im-bad { color: var(--app-bad); font-weight: 700; }
body.app .im-blue { color: #0e7490; }
body.app .im-pill { display: inline-block; border-radius: 999px; padding: 1px 9px; font-size: 12px; font-weight: 700; vertical-align: middle; }
body.app .im-rt { background: var(--app-warn-soft); color: var(--app-warn); }
body.app .im-rts { background: #e6f6f9; color: #0e7490; }
body.app .im-st { display: inline-block; border-radius: 999px; padding: 2px 10px; font-size: 12px; font-weight: 700; white-space: nowrap; }
body.app .im-st-exp { background: #eef2fb; color: #2c4a8f; }
body.app .im-st-draft { background: var(--app-warn-soft); color: var(--app-warn); }
body.app .im-st-wait { background: #fff1e6; color: #c2410c; }
body.app .im-st-ok { background: var(--app-ok-soft); color: var(--app-ok); }
body.app .im-st-off { background: #eef1f5; color: var(--app-muted); }
body.app .im-tag { display: inline-block; border-radius: 5px; padding: 0 6px; font-size: 11.5px; font-weight: 600; background: #eef1f5; color: #475569; }
body.app .im-tag-c { background: #e6f6f9; color: #0e7490; }
body.app .im-tag-v { background: #f3ecfd; color: #7e22ce; }
body.app .im-tag-n, body.app .im-tag-new { background: var(--app-warn-soft); color: var(--app-warn); }
body.app .im-kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; margin: 6px 0 16px; }
body.app .im-kpi { background: #fff; border: 1px solid var(--app-line); border-radius: 12px; padding: 10px 14px; display: flex; flex-direction: column; text-decoration: none; color: var(--app-ink); }
body.app .im-kpi span { font-size: 12px; color: var(--app-muted); }
body.app .im-kpi b { font-size: 24px; line-height: 1.2; }
body.app .im-kpi small { font-size: 11.5px; color: var(--app-muted); }
body.app .im-kpi-link:hover { border-color: var(--app-brand-2); }
body.app .im-tabn { display: inline-block; min-width: 20px; padding: 0 6px; border-radius: 999px; background: #eef1f5; font-size: 12px; text-align: center; }
body.app .im-filterrow { display: flex; gap: 8px; align-items: flex-start; flex-wrap: wrap; }
body.app .im-filterrow .mt-bar { flex: 1 1 600px; }
body.app .im-filters input[type=text], body.app .im-filters input[type=month], body.app .im-filters select { max-width: 190px; }
body.app .im-colpick { position: relative; }
body.app .im-colpick > summary { list-style: none; height: 42px; display: inline-flex; align-items: center; }
body.app .im-colpick > summary::-webkit-details-marker { display: none; }
body.app .im-colpanel { position: absolute; right: 0; top: 46px; z-index: 30; width: 260px; padding: 12px 14px; box-shadow: var(--app-shadow-lg); }
body.app .im-chk { display: inline-flex; align-items: center; gap: 6px; font-size: 13.5px; margin: 3px 12px 3px 0; font-weight: 500; color: var(--app-ink); }
body.app .im-colpanel .im-chk { display: flex; }
body.app .im-colbtns { display: flex; gap: 6px; margin-top: 10px; }
body.app .im-listcard { padding: 0; overflow: hidden; }
body.app .im-list td { font-size: 13.5px; }
body.app .im-no { font-weight: 700; color: var(--app-brand); text-decoration: none; }
body.app .im-empty { text-align: center; padding: 30px !important; }
body.app .im-pager { display: flex; gap: 4px; flex-wrap: wrap; align-items: center; margin-top: 12px; }
body.app .im-card { margin-bottom: 14px; }
body.app .im-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 4px 14px; }
body.app .im-grid .im-span2 { grid-column: span 2; }
body.app .im-grid .im-span4 { grid-column: 1 / -1; }
@media (max-width: 900px) { body.app .im-grid { grid-template-columns: 1fr 1fr; } }
@media (max-width: 560px) { body.app .im-grid { grid-template-columns: 1fr; } body.app .im-grid .im-span2 { grid-column: auto; } }
body.app .im-static { padding-top: 8px; }
body.app .im-seg { display: inline-flex; border: 1px solid var(--app-line-strong); border-radius: 10px; overflow: hidden; }
body.app .im-seg label { padding: 9px 22px; cursor: pointer; font-weight: 700; margin: 0 !important; border-right: 1px solid var(--app-line-strong); }
body.app .im-seg label:last-child { border-right: 0; }
body.app .im-seg label.on { background: var(--app-brand); color: #fff; }
body.app .im-seg input { display: none; }
body.app .im-ta-host { position: relative; }
body.app .im-ta { position: absolute; left: 0; right: 0; z-index: 40; background: #fff; border: 1px solid var(--app-line-strong); border-radius: 10px; box-shadow: var(--app-shadow-lg); max-height: 320px; overflow: auto; }
body.app .im-ta button { display: block; width: 100%; text-align: left; border: 0; background: none; padding: 8px 12px; font: inherit; font-size: 13.5px; cursor: pointer; border-bottom: 1px solid #f0f1f4; }
body.app .im-ta button:hover { background: var(--app-brand-soft); }
body.app .im-newsender:not(.is-on) { display: none; }
body.app .im-note { background: #fffbea; border: 1px solid #f3e3a5; border-radius: 10px; padding: 10px 14px; font-size: 13px; color: #5b4a0b; margin: 0 0 12px; }
body.app .im-note-info { background: #e6f6f9; border-color: #b6e0e8; color: #0b5566; }
body.app .im-note-warn { background: var(--app-warn-soft); border-color: #f0d9a0; }
body.app .im-note-bad { background: var(--app-bad-soft); border-color: #f5c2c2; color: #7f1d1d; }
body.app .im-note a { color: inherit; }
body.app .im-edit td { padding: 4px 6px; vertical-align: top; }
body.app .im-edit input[type=text], body.app .im-edit select { height: 34px; border: 1px solid var(--app-line-strong); border-radius: 8px; padding: 0 8px; font: inherit; font-size: 13px; background: #fff; color: var(--app-ink); width: 100%; min-width: 0; }
body.app .im-edit input.num { text-align: right; }
body.app .im-edit input.im-invalid { border-color: var(--app-bad); background: var(--app-bad-soft); }
body.app .im-scrollx { overflow-x: auto; }
body.app .im-lines { min-width: 1250px; }
body.app .im-lines td:nth-child(5) input, body.app .im-lines td:nth-child(6) input { width: 76px; display: inline-block; }
body.app .im-lines td:nth-child(5) select, body.app .im-lines td:nth-child(6) select { width: 70px; display: inline-block; margin-left: 3px; }
body.app .im-w-inv { min-width: 130px; } body.app .im-w-desc { min-width: 240px; } body.app .im-w-v { width: 96px !important; }
body.app .im-w-sel { min-width: 130px; } body.app .im-w-wh { width: 120px !important; text-transform: uppercase; }
body.app .im-export { display: flex; flex-direction: column; gap: 3px; margin-top: 3px; }
body.app .im-export input { height: 28px !important; font-size: 12px !important; }
body.app tr.im-sel td { background: var(--app-brand-soft); }
body.app .im-linebar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 10px; }
body.app .im-linesearch { height: 34px; border: 1px solid var(--app-line-strong); border-radius: 8px; padding: 0 10px; font: inherit; }
body.app .im-bulk { display: inline-flex; gap: 6px; align-items: center; flex-wrap: wrap; background: var(--app-brand-soft); border-radius: 10px; padding: 5px 10px; font-size: 13px; }
body.app .im-bulk select { height: 32px; border: 1px solid var(--app-line-strong); border-radius: 8px; font: inherit; font-size: 13px; }
body.app .im-actions { display: flex; gap: 8px; align-items: center; justify-content: flex-end; margin-top: 12px; }
body.app .im-modal { position: fixed; inset: 0; background: rgba(15,23,42,.45); z-index: 100; display: flex; align-items: flex-start; justify-content: center; padding: 40px 16px; overflow: auto; }
body.app .im-modal[hidden] { display: none; }
body.app .im-modal-box { width: 100%; max-width: 980px; padding: 18px 20px; }
body.app .im-modal textarea { width: 100%; font: 12.5px/1.4 ui-monospace, Menlo, Consolas, monospace; border: 1px solid var(--app-line-strong); border-radius: 10px; padding: 8px; }
body.app .im-pastetable select { height: 30px; font: inherit; font-size: 12px; border-radius: 6px; border: 1px solid var(--app-line-strong); }
body.app .im-pastetable td { font-size: 12.5px; white-space: nowrap; }
body.app .im-dl { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px 16px; margin: 0; }
body.app .im-dl > div { min-width: 0; }
body.app .im-dl .im-span2 { grid-column: span 2; } body.app .im-dl .im-span4 { grid-column: 1 / -1; }
body.app .im-dl dt { font-size: 12px; color: var(--app-muted); }
body.app .im-dl dd { margin: 2px 0 0; font-weight: 600; overflow-wrap: anywhere; }
@media (max-width: 760px) { body.app .im-dl { grid-template-columns: 1fr 1fr; } }
body.app .im-steps { display: flex; gap: 8px; flex-wrap: wrap; }
body.app .im-step { flex: 1 1 170px; border: 1px solid var(--app-line); border-radius: 10px; padding: 8px 12px; display: flex; flex-direction: column; gap: 2px; background: #fafbfc; }
body.app .im-step.done { background: var(--app-ok-soft); border-color: #bfe3cb; }
body.app .im-step.cur { border-color: var(--app-brand); box-shadow: 0 0 0 2px var(--app-brand-soft); background: #fff; }
body.app .im-step.skip { opacity: .65; }
body.app .im-step-n { font-weight: 700; }
body.app .im-step-d { font-size: 12px; color: var(--app-muted); }
body.app .im-step-who { font-size: 12.5px; color: var(--app-ok); font-weight: 600; }
body.app .im-step-who small { color: var(--app-muted); font-weight: 400; margin-left: 4px; }
body.app .im-approve-bar { display: flex; gap: 10px; align-items: center; justify-content: flex-end; flex-wrap: wrap; margin-top: 12px; }
body.app .im-sendback { position: relative; }
body.app .im-sendback > summary { list-style: none; }
body.app .im-sendback > summary::-webkit-details-marker { display: none; }
body.app .im-inline-form { display: inline-flex; gap: 6px; align-items: center; margin-top: 6px; }
body.app .im-inline-form input[type=text], body.app .im-upload select, body.app .im-upload input[type=text] { height: 38px; border: 1px solid var(--app-line-strong); border-radius: 8px; padding: 0 10px; font: inherit; min-width: 220px; }
body.app .im-upload select { min-width: 0; }
body.app .im-inline { display: inline; }
body.app .im-files { list-style: none; margin: 0 0 12px; padding: 0; }
body.app .im-files li { padding: 6px 0; border-bottom: 1px solid #f0f1f4; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
body.app .im-upload { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
body.app .im-hist summary { cursor: pointer; }
body.app .im-hist ul { margin: 10px 0 0; padding-left: 18px; font-size: 13.5px; }
body.app .im-hist li { margin-bottom: 4px; }
body.app .im-danger { margin-top: 8px; }
body.app .im-danger summary { cursor: pointer; }
body.app .im-danger form { margin-top: 8px; }
body.app tr.im-off td { color: #9aa3b2; }
body.app .im-handle { cursor: grab; color: #9aa3b2; width: 24px; font-size: 16px; }
body.app .im-editbox { border: 1px solid var(--app-brand); border-radius: 12px; padding: 14px 16px; margin-top: 14px; box-shadow: var(--app-shadow-lg); }
body.app .im-editbox h3 { margin: 0 0 10px; font-size: 16px; }
body.app .im-flow { display: flex; flex-wrap: wrap; align-items: stretch; gap: 0; margin-bottom: 14px; }
body.app .im-fs { border: 1px solid var(--app-line); border-radius: 10px; padding: 8px 12px; min-width: 140px; display: flex; flex-direction: column; background: #fff; }
body.app .im-fs-ok { background: var(--app-ok-soft); border-color: #bfe3cb; color: var(--app-ok); justify-content: center; }
body.app .im-fa { align-self: center; color: #9aa3b2; padding: 0 8px; font-size: 18px; }
body.app .im-chip { display: inline-flex; align-items: center; gap: 4px; background: var(--app-brand-soft); color: var(--app-brand); border-radius: 999px; padding: 1px 10px; font-size: 12.5px; font-weight: 600; margin: 2px 4px 2px 0; }
body.app .im-chip a { color: #9aa3b2; text-decoration: none; }
body.app .im-chip-role { background: #f1ecfb; color: #5b3fa6; }
body.app .im-chips { display: flex; flex-wrap: wrap; align-items: center; gap: 2px; border: 1px solid var(--app-line-strong); border-radius: 10px; padding: 5px 8px; min-height: 44px; background: #fff; }
body.app .im-chipin { border: 0 !important; outline: none; flex: 1 1 160px; height: 32px; font: inherit; padding: 0 4px !important; }
body.app .im-standin { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; padding: 4px 0; font-size: 13.5px; }
body.app .im-standin input[type=text], body.app .im-standin select { height: 34px; border: 1px solid var(--app-line-strong); border-radius: 8px; padding: 0 8px; font: inherit; width: auto; }
body.app .im-standin a { color: #9aa3b2; text-decoration: none; }
body.app .im-2col { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
@media (max-width: 900px) { body.app .im-2col { grid-template-columns: 1fr; } }
body.app .im-bar { background: #eef1f5; border-radius: 6px; height: 12px; overflow: hidden; }
body.app .im-bar i { display: block; height: 100%; background: var(--app-brand-2); border-radius: 6px; }
body.app .im-months { display: grid; grid-template-columns: repeat(12, 1fr); gap: 6px; align-items: end; }
body.app .im-month { display: flex; flex-direction: column; align-items: center; font-size: 12px; }
body.app .im-mbar { height: 120px; width: 100%; max-width: 36px; background: #f4f6fb; border-radius: 6px; display: flex; align-items: flex-end; overflow: hidden; }
body.app .im-mbar i { display: block; width: 100%; background: var(--app-brand-2); }
body.app .im-month small { color: var(--app-muted); font-size: 10.5px; }
body.app .im-step-who.im-bad { color: var(--app-bad); }
body.app .im-listcard .data-table-wrap { overflow-x: auto; }
body.app .im-card .data-table select, body.app .im-upload select { height: 36px; border: 1px solid var(--app-line-strong); border-radius: 8px; padding: 0 8px; font: inherit; font-size: 13px; background: #fff; }
body.app .im-page .btn:disabled { opacity: .45; cursor: not-allowed; }
body.app .im-tag-l { background: var(--app-ok-soft); color: var(--app-ok); }
body.app .im-tag-t { background: #eef1f5; color: #475569; }
body.app .im-edit input[type=date], body.app .im-standin input[type=date] { height: 34px; border: 1px solid var(--app-line-strong); border-radius: 8px; padding: 0 6px; font: inherit; font-size: 13px; background: #fff; color: var(--app-ink); width: 100%; min-width: 130px; }
body.app .im-export input[type=date] { height: 28px; font-size: 12px; }
body.app .im-colrow { display: flex; align-items: center; gap: 6px; border-radius: 6px; }
body.app .im-colrow:hover { background: #f4f6fb; }
body.app .im-colrow .im-chk { margin: 2px 0; flex: 1; }
body.app .im-colpanel { max-height: 70vh; overflow: auto; }
body.app .im-colrow .im-handle { color: #475569; font-size: 18px; padding: 0 2px; }
body.app .im-mv { border: 1px solid var(--app-line-strong); background: #fff; border-radius: 6px; width: 26px; height: 24px; font-size: 11px; color: var(--app-brand); cursor: pointer; padding: 0; }
body.app .im-mv:hover { background: var(--app-brand-soft); }
body.app .im-colpanel { width: 300px; }

/* นำเข้า — รอเลขใบขน + คลังรับของ + grams (2026-11-03) */
body.app .im-st-entry { background: #fdecd2; color: #9a4b00; }
body.app .im-st-wh { background: #efe7fb; color: #6b3fb0; }
body.app .im-warn { color: var(--app-warn); font-weight: 700; }
body.app .im-panel { border: 2px solid var(--app-brand); }
body.app .im-whbox { border: 1px solid var(--app-line); border-radius: 10px; padding: 10px 12px; margin-bottom: 8px; }
body.app .im-whbox.ok { background: var(--app-ok-soft); border-color: #bfe3cb; }
body.app .im-whbox.mine { border: 2px solid var(--app-brand); }
body.app .im-whhead { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
body.app .im-whlines { margin-top: 8px; }
body.app .im-whform { display: flex; gap: 8px; justify-content: flex-end; align-items: center; flex-wrap: wrap; margin-top: 8px; }
body.app .im-whform input[type=text] { height: 38px; border: 1px solid var(--app-line-strong); border-radius: 8px; padding: 0 10px; font: inherit; min-width: 260px; }
body.app .im-grm { font-size: 11.5px; color: #0e7490; font-weight: 600; margin-top: 2px; min-height: 0; }
body.app .im-panel .im-edit input[type=text], body.app .im-panel .im-edit select { height: 34px; border: 1px solid var(--app-line-strong); border-radius: 8px; padding: 0 8px; font: inherit; width: 100%; }
body.app .im-bulk .im-bulk-desc { height: 32px; border: 1px solid var(--app-line-strong); border-radius: 8px; padding: 0 8px; font: inherit; font-size: 13px; width: 170px; }
body.app .im-bulk select { max-width: 190px; }
/* นำเข้า — ค่าใช้จ่ายตามมาทีหลัง (2026-11-04) */
body.app .im-round { border: 1px solid #f0d9a0; background: #fffbea; border-radius: 10px; padding: 12px 14px; }
body.app .im-round .data-table { background: #fff; }
body.app .im-round-head td { background: #f7f8fb; font-weight: 600; font-size: 12.5px; color: #4b5563; }

/* ==== ซ่อมบำรุง round 2 (2026-11-04): อนุมัติตามสายบังคับบัญชา · สิทธิ์เปลี่ยนสถานะ · พิมพ์ใบงานที่เลือก ==== */
body.app .mt-st-waiting_approval { background: #fff1e6; color: #c2410c; }
body.app .mt-st-approved { background: #e6f6f9; color: #0e7490; }
body.app .mt-st-waiting { background: #f3ecfd; color: #7e22ce; }
body.app .mt-st-assigned { background: #e8effd; color: #1d4ed8; }
body.app .mt-tab-n { display: inline-block; min-width: 20px; margin-left: 4px; padding: 0 6px; border-radius: 99px; background: #c2410c; color: #fff; font-size: 11.5px; line-height: 19px; text-align: center; }
body.app .mt-why { color: #7e22ce; font-weight: 600; }
body.app .mt-why-tag { display: inline-block; padding: 3px 10px; border-radius: 999px; background: #f3ecfd; color: #7e22ce; font-size: 12px; font-weight: 700; }
body.app .mt-row-wait td { background: #fffaf5; }

/* list: tick boxes + print bar */
body.app .mt-table th.mt-pick, body.app .mt-table td.mt-pick { width: 40px; text-align: center; padding-left: 6px; padding-right: 6px; cursor: default; }
body.app .mt-pick input { width: 18px; height: 18px; cursor: pointer; accent-color: var(--app-brand); vertical-align: middle; }
body.app .mt-table tr.mt-picked td { background: #f1f5fd; }
body.app .mt-printed { font-size: 12.5px; color: #475569; white-space: nowrap; }
body.app .mt-print-bar { position: sticky; bottom: 0; z-index: 30; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: 10px; padding: 10px 16px; border-radius: 12px; background: var(--app-brand); color: #fff; box-shadow: 0 -6px 20px rgba(15, 23, 42, 0.18); }
body.app .mt-print-bar[hidden] { display: none; }
body.app .mt-print-bar b { font-size: 15px; }
body.app .mt-print-bar .mt-print-go { background: #fff; color: var(--app-brand); border-color: #fff; font-weight: 700; }
body.app .mt-print-bar .mt-print-go:disabled { opacity: .5; }
body.app .mt-print-bar .mt-print-clear { background: transparent; color: #fff; border-color: rgba(255, 255, 255, 0.6); }
body.app .mt-print-opt { margin-left: auto; display: inline-flex; align-items: center; gap: 6px; font-size: 13.5px; cursor: pointer; }
body.app .mt-print-opt input { width: 17px; height: 17px; }

/* job page: approval */
body.app .mt-approve { margin-bottom: 16px; padding: 14px 18px; border: 2px solid #fdba74; border-radius: 14px; background: #fff7ed; }
body.app .mt-approve-head { display: grid; gap: 2px; margin-bottom: 8px; }
body.app .mt-approve-head b { color: #9a3412; font-size: 17px; }
body.app .mt-approve-head span { color: #7c2d12; font-size: 13.5px; }
body.app .mt-approve-form { display: grid; gap: 8px; max-width: 640px; }
body.app .mt-approve-form textarea { width: 100%; border: 1px solid var(--app-line-strong); border-radius: 10px; padding: 8px 10px; font: inherit; background: #fff; }
body.app .mt-ok-btn { background: var(--app-ok); border-color: var(--app-ok); }
body.app .mt-wait-line { margin-bottom: 16px; padding: 10px 14px; border-radius: 10px; background: #fff7ed; color: #7c2d12; font-size: 14px; }
body.app .mt-line-ok { margin: 4px 0 8px; padding: 6px 10px; border-radius: 8px; background: var(--app-ok-soft); color: var(--app-ok); font-size: 13.5px; }
body.app .mt-line-ok .sub { display: block; color: var(--app-muted); }

/* job page: status card */
body.app .mt-move-btns { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
body.app .mt-move-label { font-size: 13px; color: var(--app-muted); margin-right: 2px; }
body.app .mt-move-btns .btn.on { outline: 3px solid rgba(44, 74, 143, 0.35); }
body.app .mt-move-locked { opacity: .45; cursor: not-allowed; }
body.app .mt-move-form { margin-top: 12px; padding-top: 12px; border-top: 1px dashed var(--app-line); }
body.app .mt-move-form[hidden], body.app .mt-move-form [hidden] { display: none !important; }
body.app .mt-move-title { margin: 0 0 8px; font-size: 14px; }
body.app .mt-vendor-box { padding: 10px 12px; margin-bottom: 10px; border-radius: 10px; background: #fdf2f8; }
body.app .mt-details-form [hidden] { display: none !important; }

/* settings: approval + status rights */
body.app .mt-set-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 16px; align-items: start; }
body.app .mt-rule { display: flex !important; gap: 10px; align-items: flex-start; padding: 8px 0; }
body.app .mt-rule input { margin-top: 4px; }
body.app .mt-rule span { display: grid; gap: 1px; }
body.app .mt-rule small { color: var(--app-muted); font-size: 12.5px; }
body.app .mt-chiprow { display: flex; flex-wrap: wrap; gap: 6px; }
body.app .mt-chip-form { display: inline; margin: 0; }
body.app .mt-pchip { display: inline-flex; align-items: center; gap: 4px; margin: 2px 4px 2px 0; padding: 2px 10px; border-radius: 999px; background: var(--app-brand-soft); color: var(--app-brand); font-size: 12.5px; font-weight: 600; white-space: nowrap; }
body.app .mt-pchip i { font-style: normal; font-weight: 400; opacity: .8; }
body.app .mt-pchip button { border: 0; background: none; padding: 0 0 0 2px; color: inherit; opacity: .6; cursor: pointer; font: inherit; }
body.app .mt-pchip-auto { background: var(--app-ok-soft); color: var(--app-ok); }
body.app .mt-pchip-man { background: #f1ecfb; color: #5b3fa6; }
body.app .mt-pchip-out { background: #eef1f5; color: #94a3b8; text-decoration: line-through; }
body.app .mt-pchip-fb { background: var(--app-warn-soft); color: var(--app-warn); }
body.app .mt-pchip-warn { background: var(--app-warn-soft); color: #92400e; white-space: normal; }
body.app .mt-row-warn td { background: #fffaf0; }
body.app .mt-rights th.c, body.app .mt-rights td.c { text-align: center; }
body.app .mt-rights input[type=checkbox] { width: 18px; height: 18px; accent-color: var(--app-brand); }
body.app .mt-rights select { height: 34px; border: 1px solid var(--app-line-strong); border-radius: 8px; padding: 0 8px; font: inherit; background: #fff; }
body.app .mt-nowrap { white-space: nowrap; }
body.app .mt-link-ok { color: var(--app-ok); font-weight: 600; }
body.app .warn { color: var(--app-warn); }
@media (max-width: 720px) {
  body.app .mt-print-opt { margin-left: 0; }
  body.app .mt-approve { padding: 12px; }
}

/* ---------------------------------------------------------------- เข้างาน › ตั้งค่า ใครดูข้อมูลได้ (attendance viewers, 2026-11-05) */
body.app .at-step { display: flex; align-items: center; gap: 8px; }
body.app .at-step span { display: inline-flex; align-items: center; justify-content: center; width: 24px; height: 24px; border-radius: 50%; background: var(--app-brand); color: #fff; font-size: 13px; flex: none; }
body.app .at-sel { height: 38px; border: 1px solid var(--app-line-strong); border-radius: 9px; padding: 0 10px; font: inherit; background: #fff; color: var(--app-ink); }
body.app .mt-room-form input.at-w-id { flex: 0 1 160px; }
body.app .at-v-add { margin-top: 12px; }
body.app .at-v-chk { display: inline-flex; align-items: center; gap: 6px; font-weight: 500; margin: 0; }
body.app .at-v-chk input { width: auto; height: auto; }
body.app .at-vt td { vertical-align: middle; }
body.app .at-v-act { text-align: right; white-space: nowrap; }
body.app .at-v-warn td { background: #fffaf0; }
body.app .at-v-sel td { background: var(--app-brand-soft); }
body.app .at-v-none { color: var(--app-warn); font-weight: 600; }
body.app .at-v-off td { color: var(--app-muted); }
body.app .at-v-sub td { background: #f7f8fa; font-size: 12px; font-weight: 700; color: var(--app-muted); padding-top: 6px; padding-bottom: 6px; }
body.app .at-v-yes { color: var(--app-ok); font-weight: 700; margin-right: 10px; }
body.app .at-v-del { border: 0; background: none; padding: 0; color: var(--app-bad); font: inherit; font-weight: 600; cursor: pointer; }
body.app .at-v-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 10px; }
body.app .at-v-head .card-title { margin: 0; }
body.app .at-tag { display: inline-block; border-radius: 999px; padding: 0 8px; font-size: 11.5px; font-weight: 600; margin-right: 4px; }
body.app .at-tag-a { background: var(--app-ok-soft); color: var(--app-ok); }
body.app .at-tag-m { background: #f1ecfb; color: #5b3fa6; }
body.app .at-sw { display: inline-flex; align-items: center; gap: 8px; border: 0; background: none; padding: 2px 0; font: inherit; font-weight: 700; color: var(--app-muted); cursor: pointer; white-space: nowrap; }
body.app .at-sw i { position: relative; display: inline-block; width: 38px; height: 21px; border-radius: 999px; background: #cbd0d8; transition: background .15s; }
body.app .at-sw i::after { content: ""; position: absolute; left: 2px; top: 2px; width: 17px; height: 17px; border-radius: 50%; background: #fff; transition: left .15s; }
body.app .at-sw.on { color: var(--app-ok); }
body.app .at-sw.on i { background: var(--app-ok); }
body.app .at-sw.on i::after { left: 19px; }
body.app .at-m-jg { display: none; }
@media (max-width: 720px) {
  body.app .at-vt .at-col-jg { display: none; }
  body.app .at-m-jg { display: block; font-size: 12px; color: var(--app-muted); }
  body.app .at-sw span { font-size: 12.5px; }
  body.app .data-table.at-vt td { white-space: normal; }
  body.app .data-table.at-vt td.at-v-act, body.app .data-table.at-vt .at-sw { white-space: nowrap; }
}

/* ---------------------------------------------------------------- แจ้งลางาน: ผู้อนุมัติ / รอคัดค้าน / ไม่มีใน Tigersoft (2026-11-05, 049) */
body.app .lv-s-veto { background: #fdf2f8; color: #a21caf; }
body.app .lv-badge-veto { background: #a21caf; }
body.app .lv-item-veto { border: 2px solid #f0abfc; background: #fdf4ff; }
body.app .lv-veto-line { font-size: 12.5px; color: #86198f; margin-bottom: 6px; }
body.app .lv-veto-box { border: 2px solid #f0abfc; background: #fdf4ff; color: #4a044e; font-size: 13.5px; }
body.app .lv-veto-box > b { display: block; color: #86198f; font-size: 14.5px; margin-bottom: 2px; }
body.app .lv-veto-bar { height: 8px; border-radius: 99px; background: #f5d0fe; overflow: hidden; margin-top: 8px; }
body.app .lv-veto-bar i { display: block; height: 100%; background: #c026d3; }
body.app .lv-pchip { display: inline-flex; align-items: center; gap: 4px; margin: 2px 4px 2px 0; padding: 2px 10px; border-radius: 999px; background: var(--app-brand-soft); color: var(--app-brand); font-size: 12.5px; font-weight: 600; white-space: nowrap; }
body.app .lv-pchip i { font-style: normal; font-weight: 400; opacity: .8; }
body.app .lv-pchip button { border: 0; background: none; padding: 0 0 0 2px; color: inherit; opacity: .6; cursor: pointer; font: inherit; font-size: 15px; line-height: 1; }
body.app .lv-pchip button:hover { opacity: 1; }
body.app .lv-pchip-auto { background: var(--app-ok-soft); color: var(--app-ok); }
body.app .lv-pchip-man { background: #f1ecfb; color: #5b3fa6; }
body.app .lv-pchip-out { background: #eef1f5; color: #94a3b8; text-decoration: line-through; }
body.app .lv-pchip-fb { background: var(--app-warn-soft); color: var(--app-warn); white-space: normal; }
body.app .lv-pchip-ntf { background: #e6f6f9; color: #0e7490; }
body.app .lv-pchip-veto { background: #fdf2f8; color: #a21caf; }
body.app .lv-ap-row { display: flex; align-items: flex-start; gap: 14px; padding: 11px 0; border-bottom: 1px solid var(--app-line); }
body.app .lv-ap-row:last-child { border-bottom: 0; }
body.app .lv-ap-tx { flex: 1; min-width: 0; }
body.app .lv-ap-tx > b { display: block; font-size: 14px; }
body.app .lv-ap-tx span { display: block; font-size: 12.5px; color: var(--app-muted); }
body.app .lv-ap-ctl { flex: none; max-width: 58%; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
body.app .lv-ap-chips { justify-content: flex-end; }
body.app .lv-ap-chipf { display: inline; margin: 0; }
body.app .lv-ap-add { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
body.app .lv-ap-add input[type=text], body.app .lv-ap-add input[type=search], body.app .lv-ap-add select { width: auto; min-width: 0; }
body.app .lv-ap-inline { display: inline-flex; align-items: center; gap: 6px; flex-wrap: wrap; margin: 0; }
body.app .lv-ap-inline input[type=text] { width: 150px; }
body.app .lv-ap-head { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; justify-content: space-between; }
body.app .lv-ap-head .text-muted { font-size: 12.5px; }
body.app .lv-w-s { width: 80px !important; }
body.app .lv-w-l { width: 260px !important; }
body.app .lv-danger { color: var(--app-bad); }
body.app .lv-row-off td { color: var(--app-muted); }
body.app .lv-row-warn td { background: #fffaf0; }
@media (max-width: 760px) {
  body.app .lv-ap-row { flex-direction: column; gap: 6px; }
  body.app .lv-ap-ctl, body.app .lv-ap-chips { max-width: none; justify-content: flex-start; }
  body.app .lv-w-l { width: 100% !important; }
  body.app .lv-ap-add input[type=text], body.app .lv-ap-add input[type=search], body.app .lv-ap-add select { flex: 1 1 160px; }
}
/* ซ่อมบำรุง — edit approvers under the clicked department (2026-11-05) */
body.app .mt-row-editing td { background: var(--app-brand-soft) !important; }
body.app tr.mt-dept-edit-row > td { padding: 0 0 14px; background: var(--app-brand-soft); }
body.app .mt-dept-edit { margin: 0 10px; padding: 14px 16px; border: 2px solid var(--app-brand); border-radius: 12px; background: #fff; box-shadow: 0 8px 24px rgba(22, 35, 63, 0.12); }
body.app .mt-dept-edit-title { margin: 0; font-size: 17px; color: var(--app-brand); }

/* แจ้งลางาน › ตั้งค่า › ผู้อนุมัติ: names wrap onto more lines so "แก้ไข" stays visible on the right (2026-11-05d) */
body.app .data-table.lv-ap-depts td { white-space: normal; vertical-align: top; }
body.app .data-table.lv-ap-depts td:first-child { width: 220px; }
body.app .data-table.lv-ap-depts td:nth-child(3), body.app .data-table.lv-ap-depts td:last-child { white-space: nowrap; width: 1%; }

/* ---- Production BOM (prod_bom, 2026-11-09) ---- */
body.app textarea.bom-q { width: 100%; height: 44px; min-height: 44px !important; resize: none; overflow-y: auto; font: inherit; line-height: 1.4; }
body.app .bom-dt-under { margin-top: 10px; }
body.app .bom-search-btn { min-width: 0 !important; }
body.app .bom-chips { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: -4px 0 14px; }
body.app .bom-chip { border: 1px solid var(--app-line-strong); background: #fff; border-radius: 999px; padding: 4px 12px; font-size: 13px; font-weight: 600; color: var(--app-brand); text-decoration: none; }
body.app .bom-chip i { font-style: normal; font-weight: 400; opacity: .7; margin-left: 4px; }
body.app .bom-chip.on { background: var(--app-brand); border-color: var(--app-brand); color: #fff; }
body.app .bom-chip-new:not(.on) { color: #c2410c; }
body.app .bom-chips .toolbar-count { padding: 0; }
body.app .bom-hint { background: var(--app-brand-soft); border-radius: var(--app-radius-sm); padding: 8px 14px; margin-bottom: 12px; font-size: 13.5px; }
body.app .bom-st { display: inline-block; border-radius: 999px; padding: 2px 10px; font-size: 12px; font-weight: 700; white-space: nowrap; }
body.app .bom-st-lg { padding: 4px 12px; font-size: 13px; }
body.app .bom-st-cert { background: var(--app-ok-soft); color: var(--app-ok); }
body.app .bom-st-new { background: #ffedd5; color: #c2410c; }   /* New = orange (Nakorn 2026-11-09) */
body.app .bom-st-other { background: #eef1f5; color: var(--app-muted); }
body.app .bom-tag { display: inline-block; border-radius: 6px; padding: 0 6px; font-size: 11px; font-weight: 700; margin-right: 3px; background: #eef1f5; color: #475569; }
body.app .bom-tag-lg { font-size: 14px; padding: 2px 9px; }
body.app .bom-g-me { background: #e8edf3; color: #334155; }
body.app .bom-g-mt { background: #f1ecfb; color: #5b3fa6; }
body.app .bom-g-cs { background: #fdecf3; color: #a3244f; }
body.app .bom-g-da { background: #e6f6f9; color: #0e7490; }
body.app .bom-g-ac { background: #fdf6e3; color: #a16207; }
body.app .bom-list .sub, body.app .bom-lines .sub, body.app .bom-kv .sub { display: block; font-size: 11.5px; color: var(--app-muted); font-weight: 400; }
body.app .bom-list td, body.app .bom-lines td { padding-top: 7px; padding-bottom: 7px; vertical-align: middle; }
body.app .bom-pic-col { width: 56px; padding-right: 0 !important; }
body.app .bom-head { display: flex; gap: 20px; align-items: flex-start; flex-wrap: wrap; }
body.app .bom-head-pic { flex: none; }
body.app .bom-kv { flex: 1; min-width: 260px; margin: 0; }
body.app .bom-comments .bom-none { margin: 0; }
body.app .bom-comment { display: flex; gap: 14px; padding: 8px 0; border-top: 1px solid var(--app-line); }
body.app .bom-comment:first-of-type { border-top: 0; padding-top: 0; }
body.app .bom-comment-date { flex: none; width: 90px; color: var(--app-muted); font-size: 13px; }
body.app .bom-comment-text { flex: 1; white-space: normal; font-size: 14px; line-height: 1.55; }
body.app .bom-tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 10px; margin-bottom: 14px; }
body.app .bom-tile { background: #fff; border: 1px solid var(--app-line); border-radius: var(--app-radius-sm); padding: 10px 14px; box-shadow: var(--app-shadow); }
body.app .bom-tile b { display: block; font-size: 18px; margin: 2px 0; }
body.app .bom-tile > span:last-child { font-size: 12px; color: var(--app-muted); }
body.app .bom-lines tr.bom-grp td { background: #f6f7fa; font-weight: 700; color: var(--app-brand); font-size: 13px; padding-top: 6px; padding-bottom: 6px; }
body.app .bom-lines td:nth-child(3) { white-space: normal; min-width: 200px; }
body.app .bom-list td:nth-child(3) { white-space: normal; min-width: 180px; }
body.app .bom-sub-link { margin-left: 6px; font-size: 11.5px; font-weight: 600; }
body.app .bom-foot { font-size: 12px; margin-top: 8px; }
body.app .bom-ac-wrap { position: relative; }
body.app .bom-ac { position: absolute; left: 0; right: 0; top: 100%; margin-top: 4px; z-index: 50; background: #fff; border: 1px solid var(--app-line-strong); border-radius: var(--app-radius-sm); box-shadow: var(--app-shadow-lg); max-height: 420px; overflow-y: auto; min-width: 280px; }
body.app .bom-ac-item { display: flex; gap: 10px; align-items: center; padding: 7px 12px; color: var(--app-ink); text-decoration: none; border-bottom: 1px solid var(--app-line); }
body.app .bom-ac-item:last-child { border-bottom: 0; }
body.app .bom-ac-item:hover, body.app .bom-ac-item.on { background: var(--app-brand-soft); }
body.app .bom-ac-item img, body.app .bom-ac-nopic { width: 36px; height: 36px; object-fit: contain; border-radius: 6px; background: #f1f3f7; flex: none; }
body.app .bom-ac-part { width: 36px; flex: none; font-size: 10.5px; font-weight: 700; text-align: center; color: #5b3fa6; background: #f1ecfb; border-radius: 6px; padding: 10px 0; }
body.app .bom-ac-text { min-width: 0; font-size: 13.5px; line-height: 1.35; }
body.app .bom-ac-text small { display: block; color: var(--app-muted); font-size: 11.5px; }
body.app .bom-ac-text .bom-st { padding: 0 7px; font-size: 11px; }
@media (max-width: 640px) {
  body.app .bom-comment { flex-direction: column; gap: 2px; }
  body.app .bom-head-pic .item-pic--lg { width: 140px; height: 140px; }
}

/* ---- โลหะ (metal, 2026-11-09, migration 055) ---- */
body.app .ml-price { display: flex; flex-wrap: wrap; gap: 4px 6px; align-items: baseline; font-size: 13px; color: #334155; background: #fff; border: 1px solid var(--app-line); border-radius: var(--app-radius-sm); padding: 8px 14px; margin-bottom: 14px; }
body.app .ml-price b { color: var(--app-ink); }
body.app .ml-boxes { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-bottom: 14px; }
body.app .ml-box { background: #fff; border: 1px solid var(--app-line); border-radius: var(--app-radius); padding: 12px 16px; box-shadow: var(--app-shadow); }
body.app .ml-box h3 { margin: 0 0 8px; font-size: 14px; display: flex; gap: 6px; align-items: center; }
body.app .ml-box dl { margin: 0; display: grid; grid-template-columns: 1fr auto; gap: 2px 10px; font-size: 13px; }
body.app .ml-box dt { color: var(--app-muted); }
body.app .ml-box dt .mono { font-size: 11.5px; }
body.app .ml-box dd { margin: 0; text-align: right; font-variant-numeric: tabular-nums; }
body.app .ml-box-big { border-top: 1px solid var(--app-line); margin-top: 8px; padding-top: 8px; display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
body.app .ml-box-big span { font-size: 12.5px; color: var(--app-muted); }
body.app .ml-box-big b { font-size: 19px; font-variant-numeric: tabular-nums; }
body.app .ml-box-big small { font-size: 12px; font-weight: 400; color: var(--app-muted); }
body.app .ml-box-ok .ml-box-big b { color: var(--app-ok); }
body.app .ml-box-bad { border-color: #f3c1bb; }
body.app .ml-box-bad .ml-box-big b { color: var(--app-bad); }
body.app .ml-tag { display: inline-block; border-radius: 999px; padding: 0 8px; font-size: 11px; font-weight: 700; line-height: 1.7; white-space: nowrap; }
body.app .ml-tag-miki { background: var(--app-brand-soft); color: var(--app-brand); }
body.app .ml-tag-pan { background: #e6f5f3; color: #0f766e; }
body.app .ml-warnbar { background: var(--app-warn-soft); border: 1px solid #f0dca0; border-radius: var(--app-radius-sm); padding: 9px 14px; font-size: 13.5px; color: #5b4a0b; margin-bottom: 14px; }
body.app .ml-note { background: #f6f7fa; border: 1px dashed var(--app-line-strong); border-radius: var(--app-radius-sm); padding: 8px 14px; font-size: 13px; color: var(--app-muted); margin-bottom: 14px; }
body.app .ml-chip-sep { width: 1px; height: 22px; background: var(--app-line-strong); margin: 0 4px; }
body.app .ml-allrows { margin-left: auto; font-size: 13px; color: var(--app-muted); text-decoration: none; }
body.app .ml-table th { white-space: nowrap; vertical-align: bottom; line-height: 1.3; }
body.app .ml-table td { vertical-align: top; }
body.app .ml-table .sub, body.app .ml-jobs .sub, body.app .ml-set .sub, body.app .ml-warn .sub { display: block; font-size: 11px; color: var(--app-muted); font-weight: 400; }
body.app .ml-table td:nth-child(3) { white-space: normal; min-width: 170px; }
body.app .ml-table .ml-sep { border-left: 2px solid var(--app-line); }
body.app .ml-table tr.ml-grp td { background: #f6f7fa; font-weight: 700; color: var(--app-brand); font-size: 13px; padding-top: 6px; padding-bottom: 6px; }
body.app .ml-table .ml-need { color: var(--app-bad); font-weight: 700; }
body.app .ml-jobs .ml-need { color: var(--app-bad); font-weight: 700; }
body.app .ml-table td.ml-pure { background: #fbf7ea; font-weight: 700; }
body.app .ml-table th.ml-purehead { background: #f6efd6; }
body.app .ml-foot { font-size: 12px; margin-top: 8px; line-height: 1.6; }
body.app .ml-set input[type=text], body.app .ml-set select, body.app #s5 input[type=text], body.app .ml-w-cust { border: 1px solid var(--app-line-strong); border-radius: 8px; padding: 5px 8px; font: inherit; font-size: 13.5px; background: #fff; }
body.app .ml-w-num { width: 96px; text-align: right; }
body.app .ml-w-label { width: 150px; }
body.app .ml-w-code { width: 70px; }
body.app .ml-w-item { width: 170px; }
body.app .ml-w-cust { width: 260px; }
body.app .ml-set tr.ml-newrow td { background: #fafbfd; }
body.app .ml-save { margin-top: 10px; }
@media (max-width: 1100px) {
  body.app .ml-boxes { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 560px) {
  body.app .ml-boxes { grid-template-columns: 1fr; }
  body.app .ml-allrows { margin-left: 0; }
}
body.app #s5 .ml-w-num { flex: 0 0 110px; width: 110px; }
body.app #s1 .ml-w-cust { flex: 0 1 260px; }
body.app .ml-worker { white-space: nowrap; }
body.app .ml-worker > img { width: 30px; height: 30px; border-radius: 50%; object-fit: cover; vertical-align: top; margin-right: 6px; background: #eef0f4; }
body.app .ml-worker > span { display: inline-block; vertical-align: top; }
body.app .ml-table .ml-info, body.app .ml-table th.ml-info { color: var(--app-muted); }
body.app .ml-table td.ml-info a { color: var(--app-muted); }
body.app .ml-castjobs .ml-worker { display: flex; gap: 6px; align-items: flex-start; padding: 2px 0; }
body.app .ml-castjobs .ml-worker + .ml-worker { border-top: 1px dashed var(--app-line); padding-top: 4px; margin-top: 2px; }
body.app #s6 .ml-w-cast { flex: 0 1 260px; border: 1px solid var(--app-line-strong); border-radius: 8px; padding: 5px 8px; font: inherit; }

/* ---------------------------------------------------------------------------
   Sales Order (sales_orders, 2026-11-10) — list boxes, order page lines,
   department strip, settings. Prefix so-.
   ------------------------------------------------------------------------- */
body.app .so-kpis { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 12px; margin-bottom: 14px; }
body.app .so-kpi { background: var(--app-surface); border: 1px solid var(--app-line); border-radius: var(--app-radius); padding: 10px 14px; text-decoration: none; color: var(--app-ink); display: flex; flex-direction: column; gap: 2px; }
body.app .so-kpi:hover { border-color: var(--app-line-strong); }
body.app .so-kpi.on { border-color: var(--app-brand); box-shadow: 0 0 0 2px var(--app-brand-soft); }
body.app .so-kpi-l { font-size: 12.5px; color: var(--app-muted); display: flex; align-items: center; gap: 6px; }
body.app .so-kpi-l i { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }
body.app .so-kpi b { font-size: 24px; line-height: 1.2; }
body.app .so-k-late i { background: var(--app-bad); } body.app .so-k-late b { color: var(--app-bad); }
body.app .so-k-risk i { background: var(--app-warn); } body.app .so-k-risk b { color: var(--app-warn); }
body.app .so-k-nopo i { background: #6d28d9; } body.app .so-k-nopo b { color: #6d28d9; }
body.app .so-k-ok i { background: var(--app-ok); }
body.app .so-k-nojob i { background: #94a3b8; } body.app .so-k-nojob b { color: #475569; }
@media (max-width: 1100px) { body.app .so-kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 900px) { body.app .so-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

body.app .so-st { display: inline-block; border-radius: 999px; padding: 1px 10px; font-size: 12px; font-weight: 700; white-space: nowrap; }
body.app .so-st-late { background: var(--app-bad-soft); color: var(--app-bad); }
body.app .so-st-risk { background: var(--app-warn-soft); color: var(--app-warn); }
body.app .so-st-nopo { background: #f1ecfb; color: #5b21b6; }
body.app .so-st-ok { background: var(--app-ok-soft); color: var(--app-ok); }
body.app .so-st-done { background: #f1f3f7; color: var(--app-muted); }
body.app .so-st-nojob { background: #eef0f4; color: #475569; border: 1px dashed #b6bcc7; }
body.app .so-late { color: var(--app-bad); font-weight: 700; }
body.app .so-list td.so-rmk-cell { white-space: normal; min-width: 200px; max-width: 360px; font-size: 12.5px; }
body.app .so-ac-so { padding: 10px 0; color: var(--app-brand); background: var(--app-brand-soft); }

body.app .so-title { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
body.app .so-ty { border: 1px solid var(--app-line-strong); border-radius: 6px; padding: 0 7px; font-size: 13px; font-weight: 600; color: #334155; background: #fff; }
body.app .so-head { padding: 14px 18px; }
body.app .so-hgrid { margin: 0; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px 18px; }
body.app .so-hgrid dt { color: var(--app-muted); font-size: 12px; }
body.app .so-hgrid dd { margin: 0; font-weight: 600; overflow-wrap: anywhere; }
@media (max-width: 800px) { body.app .so-hgrid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

body.app .so-lines-card { padding: 0; overflow: hidden; }
body.app .so-lines-head { padding: 12px 16px; border-bottom: 1px solid var(--app-line); }
body.app .so-tool { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; padding: 10px 16px; border-bottom: 1px solid var(--app-line); background: #fafbfc; }
body.app .so-tool input[type=search] { width: 300px; max-width: 100%; border: 1px solid var(--app-line-strong); border-radius: 8px; padding: 5px 9px; font: inherit; }
body.app .so-tool select { border: 1px solid var(--app-line-strong); border-radius: 8px; padding: 5px 8px; font: inherit; }
body.app .so-chk { display: inline-flex; gap: 5px; align-items: center; font-size: 13px; cursor: pointer; }
body.app .so-grow { flex: 1; }
body.app .so-line { border-top: 1px solid var(--app-line); }
body.app .so-line:first-of-type { border-top: 0; }
body.app .so-line[hidden] { display: none; }
body.app .so-row { display: flex; gap: 12px; align-items: center; padding: 9px 16px; cursor: pointer; }
body.app .so-row:hover { background: #f8f9fb; }
body.app .so-car { width: 14px; color: var(--app-muted); font-size: 11px; flex: none; transition: transform .15s; }
body.app .so-line.open .so-car { transform: rotate(90deg); }
body.app .so-it { flex: 1; min-width: 0; font-size: 13px; }
body.app .so-it .sub { display: block; color: var(--app-muted); font-size: 12px; }
body.app .so-legacy { color: #1e293b; }
body.app .so-q { display: flex; gap: 16px; text-align: right; flex: none; }
body.app .so-q span { display: block; font-size: 11px; color: var(--app-muted); }
body.app .so-q b { font-size: 15px; font-variant-numeric: tabular-nums; }
body.app .so-body { display: none; padding: 0 16px 14px 42px; }
body.app .so-line.open .so-body { display: block; }
body.app .so-rmk { display: inline-block; margin: 2px 0 8px; font-size: 12.5px; background: #fdf6e3; border: 1px solid #f0dca0; border-radius: 6px; padding: 2px 9px; max-width: 100%; }
body.app .so-rmk b { color: #a16207; }
body.app .so-none { margin: 4px 0; font-size: 13px; }
body.app .so-pos { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin: 4px 0 8px; font-size: 12.5px; }
body.app .so-pob { border: 1px solid var(--app-line-strong); background: #fff; border-radius: 999px; padding: 3px 11px; font: inherit; font-size: 12.5px; color: var(--app-brand); cursor: pointer; }
body.app .so-pob small { color: var(--app-muted); margin-left: 3px; }
body.app .so-pob.on { background: var(--app-brand); border-color: var(--app-brand); color: #fff; }
body.app .so-pob.on small { color: #cbd5e1; }
body.app .so-flow { display: flex; flex-wrap: wrap; gap: 3px; }
body.app .so-flow span { min-width: 40px; text-align: center; border: 1px solid var(--app-line); border-radius: 6px; padding: 1px 4px; font-size: 10.5px; color: #9aa1ad; background: #fff; line-height: 1.25; }
body.app .so-flow span b { display: block; font-size: 12.5px; color: #c4c9d2; font-weight: 600; }
body.app .so-flow span.on { background: #e8f0ff; border-color: #93b4f5; color: var(--app-brand); }
body.app .so-flow span.on b { color: var(--app-brand); font-weight: 800; }
body.app .so-flow span.cx:not(.on) { color: #d1a3a3; }
/* 2026-11-11: popups (same as ติดตามงานผลิต) — item no. + department numbers clickable */
body.app .so-item-btn { border: 0; background: none; padding: 0; font: inherit; color: inherit; text-decoration: underline; text-decoration-color: #c9d6ea; text-underline-offset: 3px; cursor: pointer; }
body.app .so-item-btn:hover, body.app .so-item-btn:focus-visible { color: var(--app-brand); text-decoration-color: currentColor; }
body.app .so-flow-click span.on { cursor: pointer; }
body.app .so-flow-click span.on:hover { background: #d7e5ff; border-color: var(--app-brand); }
body.app .so-pcm { margin-top: 8px; border-top: 1px dashed var(--app-line); padding-top: 6px; font-size: 12.5px; }
body.app .so-pcm div { display: flex; gap: 12px; padding: 2px 0; }
body.app .so-pcm .mono { color: var(--app-brand); width: 72px; flex: none; }
@media (max-width: 700px) {
  body.app .so-row { flex-wrap: wrap; }
  body.app .so-q { width: 100%; justify-content: flex-end; }
  body.app .so-body { padding-left: 16px; }
}

body.app .so-set-form .so-set-row { display: flex; gap: 10px; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--app-line); }
body.app .so-set-row span { flex: 1; }
body.app .so-set-row input[type=number] { width: 80px; text-align: right; border: 1px solid var(--app-line-strong); border-radius: 8px; padding: 5px 8px; font: inherit; }
body.app .so-set-row select { border: 1px solid var(--app-line-strong); border-radius: 8px; padding: 5px 8px; font: inherit; }
body.app .so-drag { display: flex; flex-wrap: wrap; gap: 6px; margin: 6px 0 10px; }
body.app .so-dchip { display: inline-flex; align-items: center; gap: 4px; border: 1px solid var(--app-line-strong); background: #fff; border-radius: 8px; padding: 4px 6px 4px 8px; font-weight: 700; font-size: 13px; color: var(--app-brand); user-select: none; }
body.app .so-dchip.cx { color: #b45353; }
body.app .so-dh { font-style: normal; color: #b6bcc7; cursor: grab; font-weight: 400; }
body.app .so-dx { border: 0; background: none; color: #9aa1ad; font-size: 15px; cursor: pointer; padding: 0 2px; line-height: 1; }
body.app .so-dx:hover { color: var(--app-bad); }
body.app .so-new { border: 1px dashed var(--app-line-strong); background: #fff; border-radius: 8px; padding: 2px 8px; font: inherit; font-weight: 700; color: var(--app-brand); cursor: pointer; }
body.app .so-set-add { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
body.app .so-set-add input[type=text] { border: 1px solid var(--app-line-strong); border-radius: 8px; padding: 6px 9px; font: inherit; width: 220px; }
body.app .so-types input[type=text] { border: 1px solid var(--app-line-strong); border-radius: 8px; padding: 4px 8px; font: inherit; width: 180px; }
body.app .so-offscreen { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
body.app select.so-f-ship { max-width: 240px; }

/* ---- ติดตามงานผลิต (prod_tracking, 2026-11-10, migration 056) — layout from Oros's mockup ---- */
body.app .pt-head .page-actions { align-items: center; flex-wrap: wrap; }
body.app .pt-status { font-size: 13px; color: var(--app-muted); }
body.app .pt-status.dirty { color: #8a3b00; font-weight: 600; }
body.app .pt-status.err { color: #b42318; font-weight: 600; }
body.app .pt-link { font-size: 13.5px; padding: 4px 6px; border: 0; background: none; color: var(--app-brand); text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }
body.app .pt-filters { padding: 18px 20px; display: flex; flex-wrap: wrap; align-items: flex-end; gap: 12px 14px; margin-bottom: 12px; }
body.app .pt-filters .field { margin: 0; }
body.app .pt-f-search { flex: 1 1 380px; min-width: 0; }
body.app .pt-toggle { display: flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 14px; border: 1px solid var(--app-line-strong); border-radius: var(--app-radius-sm); background: #fff; cursor: pointer; font-size: 14px; font-weight: 500; white-space: nowrap; }
body.app .pt-toggle input { width: 18px !important; height: 18px !important; min-height: 0 !important; margin: 0; padding: 0; accent-color: var(--app-brand); cursor: pointer; }
body.app .pt-terms { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 6px; font-size: 13px; color: var(--app-muted); }
body.app .pt-term { display: inline-flex; align-items: center; gap: 2px; padding: 2px 4px 2px 10px; border-radius: 999px; border: 1px solid; font-size: 13px; }
body.app .pt-term b { font-weight: 600; }
body.app .pt-term button { width: 24px; height: 24px; border: 0; border-radius: 999px; background: none; color: inherit; cursor: pointer; font-size: 15px; line-height: 1; }
body.app .pt-term.ok { background: #eef3fb; color: var(--app-brand); border-color: #c9d6ea; }
body.app .pt-term.miss { background: #fff4e8; color: #8a3b00; border-color: #f2c899; }
body.app .pt-chips { margin: 0 0 10px; }
body.app .bom-chip.pt-chip-late:not(.on) { color: #b91c1c; }
body.app .pt-summary { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; font-size: 14px; color: var(--app-muted); margin-bottom: 10px; }
body.app .pt-push { margin-left: auto; }
body.app .pt-warn { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 4px 6px; font-size: 13px; padding: 2px 4px 2px 10px; border-radius: 999px; border: 1px solid #f2c899; background: #fff4e8; color: #8a3b00; }
body.app .pt-warn[hidden], body.app .pt-hidden-wrap[hidden] { display: none; }
body.app .pt-warn button { font-size: 13px; padding: 2px 6px; border: 0; background: none; color: #8a3b00; font-weight: 600; text-decoration: underline; cursor: pointer; }
body.app .pt-hidden-wrap { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 6px; }
body.app .pt-hidden-chip { font-size: 13px; padding: 2px 10px; min-height: 30px; border: 1px dashed #9aa6b8; border-radius: 999px; background: #fff; color: var(--app-brand); cursor: pointer; }
body.app .pt-table-card { overflow: hidden; padding: 0; }
body.app .pt-scroll { overflow-x: auto; }
body.app .pt-table { border-collapse: separate; border-spacing: 0; font-size: 14px; min-width: 100%; }
body.app .pt-table th, body.app .pt-table td { white-space: nowrap; }
body.app .pt-table th[hidden], body.app .pt-table td[hidden] { display: none; }
body.app .pt-table thead tr { background: #f7f9fc; color: var(--app-muted); font-size: 12.5px; text-align: left; }
body.app .pt-table th.pt-col { padding: 6px 6px 6px 8px; border-bottom: 1px solid var(--app-line); font-weight: 600; cursor: grab; background: #f7f9fc; }
body.app .pt-table th.pt-col.sorted { background: #e9f0fb; }
body.app .pt-th { display: flex; align-items: center; gap: 4px; }
body.app .pt-th.right { justify-content: flex-end; }
body.app .pt-th.center { justify-content: center; }
body.app .pt-sort { font-weight: 600; font-size: 12.5px; color: var(--app-muted); background: none; border: 0; padding: 6px 2px; min-height: 32px; cursor: pointer; display: flex; align-items: center; gap: 4px; white-space: nowrap; }
body.app span.pt-sort { cursor: default; }
body.app .sorted .pt-sort { color: var(--app-brand); }
body.app .pt-sort .mark { font-size: 13px; color: var(--app-brand); min-width: 10px; }
body.app .pt-hide { font-size: 15px; line-height: 1; width: 24px; height: 24px; border: 0; border-radius: 6px; background: none; color: #8a95a6; cursor: pointer; }
body.app .pt-hide:hover { background: #e3e8f0; color: var(--app-ink); }
body.app .pt-table th.pt-loc { position: relative; padding: 4px 3px; border-bottom: 1px solid var(--app-line); border-right: 1px solid #eef1f5; width: 50px; min-width: 50px; text-align: center; vertical-align: bottom; cursor: grab; }
body.app .pt-loc-hide { position: absolute; top: 1px; right: 1px; z-index: 1; width: 18px; height: 18px; padding: 0; font-size: 13px; line-height: 1; border: 0; border-radius: 4px; background: #fff; color: var(--app-muted); cursor: pointer; opacity: 0; }
body.app th.pt-loc:hover .pt-loc-hide, body.app th.pt-loc:focus-within .pt-loc-hide { opacity: 1; }
body.app .pt-loc-btn { width: 100%; min-height: 48px; padding: 4px 0; border-radius: 8px; border: 2px solid transparent; color: var(--app-muted); display: flex; flex-direction: column; align-items: center; justify-content: flex-end; line-height: 1.2; text-decoration: none; }
body.app .pt-loc-btn .code { font-size: 12.5px; font-weight: 600; }
body.app .pt-loc-btn .count { font-size: 14px; font-weight: 700; }
body.app .pt-loc-btn .new { font-size: 10px; font-weight: 700; margin-bottom: 2px; padding: 0 4px; border-radius: 4px; background: #c8962e; color: #fff; }
body.app .pt-loc-btn.has { background: var(--app-brand); color: #fff; }
body.app .pt-loc-btn.active { border-color: #c8962e; }
body.app .pt-table th.drop-target { box-shadow: inset 3px 0 0 #c8962e; }
body.app .pt-table th.dragging { opacity: .45; }
body.app .pt-table td { padding: 8px 10px; border-top: 1px dashed #e7ebf1; }
body.app .pt-table tr.first td { border-top: 1px solid #d5dbe4; }
body.app .pt-table td.num { text-align: right; }
body.app .pt-table td.center { text-align: center; }
body.app .pt-table td[data-k="po"] { font-weight: 600; color: var(--app-brand); }
body.app .pt-table td[data-k="item"] { font-weight: 500; }
body.app .pt-table td.pt-t-wrap { white-space: normal; min-width: 200px; max-width: 280px; }
body.app .pt-table td.pt-pic { padding: 4px 8px; }
body.app .pt-table td.pt-lc { padding: 4px; border-right: 1px solid #eef1f5; text-align: center; }
body.app .pt-lc-btn { display: block; width: 100%; min-height: 30px; line-height: 30px; border: 0; border-radius: 6px; background: var(--app-brand); color: #fff; font-weight: 700; font-size: 14px; cursor: pointer; padding: 0 4px; }
body.app .pt-lc-btn:hover, body.app .pt-lc-btn:focus-visible { background: #c8962e; }
body.app .pt-badge { margin-left: 6px; font-size: 12px; font-weight: 600; padding: 1px 8px; border-radius: 999px; background: #fdecd9; color: #8a3b00; font-family: inherit; }
body.app .pt-empty { margin: 0; padding: 28px 20px; text-align: center; color: var(--app-muted); }
body.app .pt-foot { font-size: 12.5px; margin-top: 10px; }
body.app .pt-modal { position: fixed; inset: 0; z-index: 1000; background: rgba(15, 23, 42, .45); display: flex; align-items: center; justify-content: center; padding: 16px; }
body.app .pt-modal[hidden] { display: none; }
body.app .pt-modal-box { width: 100%; max-width: 620px; max-height: 85vh; display: flex; flex-direction: column; padding: 0; }
body.app .pt-modal-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 14px 18px; border-bottom: 1px solid var(--app-line); }
body.app .pt-modal-head h2 { margin: 0; font-size: 16px; }
body.app .pt-modal-x { width: 36px; height: 36px; border: 0; border-radius: 8px; background: #f1f3f7; font-size: 20px; line-height: 1; cursor: pointer; }
body.app .pt-modal-body { padding: 12px 18px 18px; overflow-y: auto; }
body.app .pt-jobs { width: 100%; border-collapse: collapse; font-size: 14px; }
body.app .pt-jobs th { text-align: left; font-size: 12.5px; color: var(--app-muted); font-weight: 600; padding: 6px 8px; border-bottom: 1px solid var(--app-line); }
body.app .pt-jobs td { padding: 8px; border-bottom: 1px solid #eef1f5; vertical-align: middle; }
body.app .pt-jobs .num { text-align: right; }
body.app .pt-worker { display: inline-flex; align-items: center; gap: 8px; }
body.app .pt-worker img, body.app .pt-w-nopic { width: 34px; height: 34px; border-radius: 50%; object-fit: cover; background: #eef0f4; flex: none; display: inline-flex; align-items: center; justify-content: center; font-size: 11px; font-weight: 700; color: var(--app-muted); }
body.app .pt-tag { font-size: 11px; font-weight: 700; padding: 1px 6px; border-radius: 6px; background: #fdf6e3; color: #a16207; }
body.app .pt-toggle select { min-height: 0 !important; height: 30px; padding: 0 6px; width: auto; border: 1px solid var(--app-line-strong); border-radius: 8px; font: inherit; background: #fff; }
body.app .pt-table .pt-frozen { position: sticky; z-index: 2; background: #fff; }
body.app .pt-table thead .pt-frozen { z-index: 3; background: #f7f9fc; }
body.app .pt-table thead .pt-frozen.sorted { background: #e9f0fb; }
body.app .pt-table .pt-frozen-last { box-shadow: 4px 0 6px -4px rgba(15, 23, 42, .25); }
body.app .pt-item-btn { border: 0; background: none; padding: 0; font: inherit; font-weight: 500; color: var(--app-brand); text-decoration: underline; text-decoration-color: #c9d6ea; text-underline-offset: 3px; cursor: pointer; }
body.app .pt-item-btn:hover, body.app .pt-item-btn:focus-visible { text-decoration-color: currentColor; }
body.app .pt-modal-box:has(.pt-item-head) { max-width: 760px; }
body.app .pt-item-head { display: flex; gap: 16px; align-items: flex-start; flex-wrap: wrap; }
body.app .pt-item-pic { width: 140px; height: 140px; object-fit: contain; border-radius: 10px; background: #f1f3f7; border: 1px solid var(--app-line); flex: none; }
body.app .pt-item-nopic { display: inline-flex; align-items: center; justify-content: center; font-size: 12px; color: var(--app-muted); }
body.app .pt-kv { flex: 1; min-width: 240px; margin: 0; display: grid; grid-template-columns: max-content 1fr; gap: 4px 12px; font-size: 14px; }
body.app .pt-kv dt { color: var(--app-muted); font-size: 13px; }
body.app .pt-kv dd { margin: 0; }
body.app .pt-item-h { font-size: 14px; margin: 16px 0 6px; }
body.app .pt-item-cm { display: flex; gap: 12px; padding: 6px 0; border-top: 1px solid #eef1f5; font-size: 13.5px; }
body.app .pt-item-cm > span:first-child { flex: none; width: 84px; }
body.app .pt-jobs tr.pt-item-grp td { background: #f6f7fa; font-weight: 700; color: var(--app-brand); font-size: 13px; padding: 5px 8px; }
body.app .pt-item-more { margin: 12px 0 0; font-size: 13.5px; }

/* ---- ติดตามงานผลิต — มุมมองที่ Admin ตั้ง (prod_tracking settings, 2026-11-11, migration 060) ---- */
body.app .pt-views { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 6px; }
body.app .pt-views-lbl { font-size: 13px; color: var(--app-muted); }
body.app .pt-vchip { display: inline-flex; align-items: center; gap: 5px; padding: 6px 12px; border: 1px solid var(--app-line-strong); border-radius: 999px; background: #fff; font-size: 13.5px; font-weight: 600; color: var(--app-brand); text-decoration: none; }
body.app .pt-vchip:hover { border-color: var(--app-brand-2); }
body.app .pt-vchip.on { background: var(--app-brand); border-color: var(--app-brand); color: #fff; }
body.app .pt-vchip .star { color: #d4a017; }
body.app .pt-vchip.on .star { color: #ffd54a; }
body.app .pt-star-form { display: inline-flex; align-items: center; gap: 4px; font-size: 13px; }
body.app .pt-set-tag.star { background: #fff8e1; color: #8a6400; }
body.app .pt-table th a.pt-sort { color: inherit; text-decoration: none; }
body.app .pt-set-views td { vertical-align: middle; }
body.app .pt-set-views tr.pt-set-sel td { background: #fff8e8; }
body.app .pt-set-tag { display: inline-block; padding: 2px 8px; border-radius: 999px; background: var(--app-brand-soft); color: var(--app-brand-2); font-size: 12px; margin: 1px 3px 1px 0; }
body.app .pt-set-tag.def { background: var(--app-ok-soft); color: var(--app-ok); }
body.app .pt-set-tag.p { background: #fce4ec; color: #ad1457; }
body.app .pt-set-acts { white-space: nowrap; }
body.app .pt-set-inline { display: inline; }
body.app .pt-set-new { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 12px; }
body.app .pt-set-new input, body.app .pt-set-name, body.app .pt-set-cust, body.app .pt-set-row select { padding: 7px 9px; border: 1px solid var(--app-line-strong); border-radius: 8px; font-size: 14px; background: #fff; }
body.app .pt-set-name { width: 280px; max-width: 100%; }
body.app .pt-set-cust { width: 100%; max-width: 560px; }
body.app .pt-set-edithead { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 8px; margin: 22px 0 10px; }
body.app .pt-set-edithead h2 { font-size: 19px; margin: 0; }
body.app .pt-set-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px; margin: 8px 0; font-size: 14px; }
body.app .pt-set-row.pt-set-top { align-items: flex-start; }
body.app .pt-set-lbl { min-width: 210px; padding-top: 4px; }
body.app .pt-set-drag, body.app .pt-set-who { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; padding: 10px; border: 1px dashed var(--app-line-strong); border-radius: 10px; background: #fff; min-height: 46px; }
body.app .pt-set-who { flex: 1; min-width: 260px; }
body.app .pt-set-who select, body.app .pt-set-who input { border: 0; outline: 0; font-size: 13.5px; background: transparent; min-width: 200px; padding: 4px; }
body.app .pt-set-poolwrap { display: flex; align-items: flex-start; gap: 8px; margin-top: 8px; }
body.app .pt-set-poolh { font-size: 13px; color: var(--app-muted); padding-top: 6px; white-space: nowrap; }
body.app .pt-set-pool { display: flex; flex-wrap: wrap; gap: 6px; flex: 1; min-height: 34px; padding: 2px; border-radius: 8px; }
body.app .pt-set-chip { display: inline-flex; align-items: center; gap: 5px; padding: 4px 6px; border: 1px solid var(--app-line-strong); border-radius: 8px; background: #fff; font-size: 13px; user-select: none; }
body.app .pt-set-chip b { font-weight: 600; }
body.app .pt-set-dh { color: #9aa6b8; font-style: normal; cursor: grab; letter-spacing: -2px; padding: 0 2px; }
body.app .pt-set-chip button { border: 0; background: none; color: var(--app-muted); cursor: pointer; font-size: 15px; line-height: 1; padding: 0 3px; }
body.app .pt-set-chip button:hover { color: var(--app-ink); }
body.app .pt-set-drag .pt-set-add, body.app .pt-set-pool .pt-set-x, body.app .pt-set-pool .pt-set-dh { display: none; }
body.app .pt-set-pool .pt-set-chip { background: #f7f8fa; color: var(--app-muted); }
body.app .pt-set-chip.lock { background: #f3f4f6; }
body.app .pt-set-chip.locblock { border-color: #c7a35a; background: #fffaf0; }
body.app .pt-set-chip.loc { border-color: #d9c18c; }
body.app .pt-set-chip.loc.empty { opacity: .55; }
body.app .pt-set-pool .pt-set-chip.loc { border-color: var(--app-line-strong); }
body.app .pt-set-newb { background: #fff4e8; color: #8a3b00; border-radius: 4px; padding: 0 4px; font-size: 11px; }
body.app .pt-set-chip.sortable-ghost { opacity: .4; }
body.app .pt-set-radio { display: flex; align-items: center; gap: 8px; margin: 8px 0; font-size: 14px; }
body.app .pt-set-sub { margin: 4px 0 6px 26px; }
body.app .pt-set-preview { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
body.app .pt-set-preview .pt-term { padding: 2px 10px; }
body.app .pt-set-rule { background: #f8fafc; border: 1px solid var(--app-line); border-radius: 10px; padding: 10px 12px; font-size: 13px; margin: 12px 0 0; }
body.app .pt-set-del { display: flex; justify-content: flex-end; margin: -6px 0 24px; }
@media (max-width: 640px) {
  body.app .pt-set-lbl { min-width: 0; width: 100%; }
}
/* ติดตามงานผลิต — ประเภทใบสั่งผลิต (061) */
body.app .pt-set-h3 { font-size: 14px; margin: 16px 0 6px; }
body.app .pt-set-types { display: flex; flex-wrap: wrap; gap: 6px; }
body.app .pt-set-type { display: inline-flex; align-items: center; gap: 6px; padding: 5px 10px; border: 1px solid var(--app-line-strong); border-radius: 8px; background: #fff; font-size: 13px; cursor: pointer; }
body.app .pt-set-type span { color: var(--app-muted); }
body.app .pt-set-type i { font-style: normal; font-size: 12px; color: var(--app-muted); background: #f3f4f6; border-radius: 999px; padding: 0 6px; }
body.app .pt-set-type:has(input:checked) { border-color: var(--app-brand); background: var(--app-brand-soft); }
body.app .pt-set-type.empty { opacity: .6; }
body.app .pt-set-tnames input { width: 100%; max-width: 280px; padding: 6px 8px; border: 1px solid var(--app-line-strong); border-radius: 8px; font-size: 14px; }
/* ติดตามงานผลิต — tick-box filters ลูกค้า / ประเภทใบสั่งผลิต / Location (2026-11-11e) */
body.app .pt-fdd-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; flex-basis: 100%; }
body.app .pt-fdd { position: relative; }
body.app .pt-fbtn { display: inline-flex; align-items: center; gap: 6px; padding: 8px 12px; border: 1px solid var(--app-line-strong); border-radius: 10px; background: #fff; font-size: 14px; font-weight: 600; color: var(--app-brand); cursor: pointer; }
body.app .pt-fbtn.on { border-color: var(--app-brand); background: var(--app-brand-soft); }
body.app .pt-fbtn i { font-style: normal; background: var(--app-brand); color: #fff; border-radius: 999px; padding: 0 7px; font-size: 12px; }
body.app .pt-fpanel { position: absolute; top: calc(100% + 6px); left: 0; z-index: 60; width: 380px; max-width: calc(100vw - 32px); background: #fff; border: 1px solid var(--app-line-strong); border-radius: 12px; box-shadow: 0 12px 30px rgba(15, 23, 42, .15); padding: 10px; }
body.app .pt-fsearch { width: 100%; padding: 7px 9px; border: 1px solid var(--app-line-strong); border-radius: 8px; font-size: 13.5px; margin-bottom: 6px; }
body.app .pt-flist { max-height: 320px; overflow-y: auto; }
body.app .pt-fopt { display: flex; align-items: center; gap: 8px; padding: 5px 4px; font-size: 13.5px; border-radius: 6px; cursor: pointer; }
body.app .pt-fopt[hidden] { display: none; }
body.app .pt-fopt:hover { background: #f6f7fa; }
body.app .pt-fopt.on { background: var(--app-brand-soft); }
body.app .pt-fopt b { font-weight: 600; min-width: 100px; }
body.app .pt-fopt span { color: var(--app-muted); flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
body.app .pt-fopt em { font-style: normal; font-size: 12px; color: var(--app-muted); }
body.app .pt-ffoot { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-top: 8px; padding-top: 8px; border-top: 1px solid #eef1f5; font-size: 12.5px; }
body.app .pt-fnote { font-size: 12.5px; color: #6b4e00; background: #fff8e1; border: 1px solid #f1d58a; border-radius: 8px; padding: 5px 9px; }
body.app .pt-fhint { font-size: 12.5px; }

/* ---- ติดตามงานผลิต: เตือนงานหล่อ + งานตามช่าง (062, Oros 2026-11-11) ---- */
body.app .pt-chip-sep { width: 1px; height: 22px; background: var(--app-line-strong); margin: 0 4px; }
body.app .bom-chip.pt-chip-castlate:not(.on) { color: #b91c1c; border-color: #f5c2c2; background: #fff5f5; }
body.app .bom-chip.pt-chip-castsoon:not(.on) { color: #9a4a00; border-color: #f2c899; background: #fff8ef; }
body.app .pt-table tr.pt-cast-late > td:first-child { box-shadow: inset 4px 0 0 #dc2626; }
body.app .pt-table tr.pt-cast-soon > td:first-child { box-shadow: inset 4px 0 0 #f59e0b; }
body.app .pt-table td.pt-castby { white-space: nowrap; font-size: 13px; }
body.app .pt-table td.pt-castby .sub { display: block; font-size: 11.5px; color: var(--app-muted); }
body.app .pt-cs-late b, body.app .pt-cs-soon b { display: inline-block; padding: 2px 9px; border-radius: 999px; font-weight: 700; font-size: 12.5px; }
body.app .pt-cs-late b { background: #dc2626; color: #fff; }
body.app .pt-cs-soon b { background: #fde7c7; color: #9a4a00; border: 1px solid #f5b968; }
body.app .pt-cs-late .mono { color: #b91c1c; font-weight: 600; }
body.app .pt-cs-soon .mono { color: #9a4a00; font-weight: 600; }
body.app .pt-table tr.pt-cast-late > td, body.app .pt-table tr.pt-cast-late > td.pt-frozen { background: #fff1f1; }
body.app .pt-table tr.pt-cast-soon > td, body.app .pt-table tr.pt-cast-soon > td.pt-frozen { background: #fff8eb; }
body.app .pt-cs-wait b { color: var(--app-ink); font-weight: 500; }
body.app .pt-cs-done b, body.app .pt-cs-nodue b, body.app .pt-cs-pastdue b { color: var(--app-muted); font-weight: 400; }
body.app .pt-cast-steps { margin: 0 0 12px; padding-left: 22px; display: grid; gap: 10px; font-size: 14px; }
body.app .pt-num-in { width: 76px !important; min-height: 0 !important; height: 34px; padding: 0 8px !important; text-align: right; display: inline-block; }
body.app .pt-wk-find .bom-ac-wrap input { min-width: 320px; }
body.app .pt-wk-choices { padding: 12px 16px; margin-bottom: 12px; display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
body.app .pt-wk-choices p { width: 100%; margin: 0 0 2px; font-size: 14px; }
body.app .pt-wk-choice { display: inline-flex; gap: 6px; align-items: baseline; border: 1px solid var(--app-line-strong); border-radius: 999px; padding: 5px 12px; font-size: 13.5px; color: var(--app-ink); text-decoration: none; background: #fff; }
body.app .pt-wk-choice:hover { background: var(--app-brand-soft); }
body.app .pt-wk-choice small { color: var(--app-muted); }
/* ติดตามงานผลิต: header row stays on top + ⛶ เต็มจอ (Oros 2026-11-12) */
body.app .pt-table-card .pt-scroll { max-height: calc(100vh - 150px); overflow: auto; }
body.app .pt-table thead th, body.app .pt-table thead th.pt-loc { position: sticky; top: 0; z-index: 3; }
body.app .pt-table thead th.pt-frozen { z-index: 5; }
body.app .pt-full-btn { order: -1; padding: 4px 12px; min-height: 0; height: 30px; font-size: 13px; }
body.app .pt-full-bar { display: none; }
body.app .pt-table-card.pt-full { position: fixed; inset: 0; z-index: 900; margin: 0; border-radius: 0; display: flex; flex-direction: column; background: #fff; }
body.app .pt-table-card.pt-full .pt-full-bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 6px 12px; border-bottom: 1px solid var(--app-line); font-size: 13.5px; font-weight: 600; background: #fff; }
body.app .pt-table-card.pt-full .pt-full-exit { padding: 4px 12px; min-height: 0; height: 30px; font-size: 13px; }
body.app .pt-table-card.pt-full .pt-full-exit small { color: var(--app-muted); font-weight: 400; }
body.app .pt-table-card.pt-full .pt-scroll { flex: 1; max-height: none; }
body.app.pt-full-on { overflow: hidden; }
body.app .pt-cast-sub { margin: 10px 0 4px; font-weight: 600; font-size: 13.5px; }
body.app .pt-cast-sub .text-muted { font-weight: 400; }
body.app .pt-cast-types { display: flex; flex-wrap: wrap; gap: 6px 14px; }
body.app .pt-cast-type { display: inline-flex; align-items: center; gap: 5px; font-size: 13px; }
body.app .pt-cast-type b { min-width: 14px; }
body.app .pt-cast-custs { display: flex; flex-wrap: wrap; gap: 6px 16px; }
body.app .pt-cast-cust { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; }
body.app .pt-cast-cust input[type=text] { width: 160px !important; min-height: 0 !important; height: 34px; padding: 0 8px !important; }
body.app .pt-cast-locs { display: flex; flex-wrap: wrap; gap: 6px; margin: 6px 0 2px; }
body.app .pt-cast-loc { display: inline-flex; align-items: center; gap: 5px; border: 1px solid var(--app-line-strong); border-radius: 999px; padding: 3px 10px; font-size: 13px; cursor: pointer; background: #fff; }
body.app .pt-cast-loc input { width: 15px !important; height: 15px !important; min-height: 0 !important; margin: 0; accent-color: var(--app-brand); }
body.app .pt-wk-find { align-items: flex-end; }
body.app .pt-wk-locs { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: 0 0 10px; }
body.app .pt-wk-locs .pt-vchip i { font-style: normal; opacity: .7; margin-left: 3px; font-weight: 400; }
body.app .pt-wk { width: 100%; }
body.app .pt-wk-head { cursor: pointer; }
body.app .pt-wk-head:hover td { background: #f7f9fc; }
body.app .pt-wk-detail { display: none; }
body.app .pt-wk-grp.open .pt-wk-detail { display: table-row; }
body.app .pt-wk-detail > td { background: #fafbfd; padding: 6px 12px 12px 56px !important; }
body.app .pt-wk-toggle { width: 30px; text-align: center; color: var(--app-muted); }
body.app .pt-wk-grp.open .pt-wk-toggle span { display: inline-block; transform: rotate(180deg); }
body.app .pt-wk-grp + .pt-wk-grp .pt-wk-head td { border-top: 1px solid #d5dbe4; }
body.app .pt-wk-unassigned .pt-wk-head td { background: #fff8ef; }
body.app .pt-wk-none-ic { width: 34px; height: 34px; border-radius: 50%; background: #fdecd9; display: inline-flex; align-items: center; justify-content: center; flex: none; }
body.app .pt-worker small { display: block; font-size: 11.5px; color: var(--app-muted); }
body.app .pt-wk-wait { color: #9a4a00; }
body.app .pt-wk-long { color: #b91c1c; font-weight: 700; }
body.app .pt-wk-soon { margin-left: 4px; font-size: 11.5px; font-weight: 600; padding: 1px 7px; border-radius: 999px; background: #fff3d6; color: #9a4a00; }
body.app .pt-wk .pt-jobs .sub { display: block; font-size: 11.5px; color: var(--app-muted); }

/* ---- ซ่อมบำรุง 2026-11-13: ลากเรียงห้อง · ห้อง / แผนกผู้แจ้ง filters · left menu stays + scrolls on its own */
.dash-menu { max-height: calc(100vh - 100px); overflow-y: auto; overscroll-behavior: contain; }
body.app .mt-bar select { max-width: 260px; }
body.app .mt-bar select:disabled { background: #f4f5f7; color: var(--app-muted); }
body.app .mt-room-table .mt-dh-col { width: 34px; padding-right: 0; }
body.app .mt-dh { display: inline-block; cursor: grab; color: #9aa1ad; font-size: 18px; line-height: 1; padding: 2px 4px; border-radius: 6px; user-select: none; touch-action: none; }
body.app .mt-dh:hover { color: var(--app-ink); background: #eef0f3; }
body.app .mt-dh:active { cursor: grabbing; }
body.app .mt-room-ghost { opacity: .45; background: #eef4ff; }
body.app .mt-room-hint { margin: 4px 0 8px; }
body.app .mt-room-saved { margin-left: 8px; font-weight: 600; color: #15803d; }
body.app .mt-room-saved.bad { color: #b91c1c; }

/* ---------- Sales Order: ประวัติการขาย tab in the item popup + ตั้งค่า ④ (2026-11-24) ---------- */
body.app .pt-modal-box.so-h-wide { max-width: 1080px; }
body.app .so-h-tabs { display: flex; gap: 4px; margin: -4px 0 12px; border-bottom: 1px solid var(--app-line); }
body.app .so-h-tab { border: 1px solid transparent; border-bottom: 0; background: none; padding: 8px 14px; margin-bottom: -1px; border-radius: 8px 8px 0 0; font: inherit; font-weight: 600; color: var(--app-muted); cursor: pointer; }
body.app .so-h-tab.on { color: var(--app-ink); background: var(--app-surface); border-color: var(--app-line); border-bottom: 2px solid var(--app-surface); }
body.app .so-h-sum { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 8px; margin-bottom: 12px; }
body.app .so-h-sum > div { border: 1px solid var(--app-line); border-radius: var(--app-radius-sm); padding: 8px 10px; }
body.app .so-h-sum span { display: block; font-size: 12px; color: var(--app-muted); }
body.app .so-h-sum b { display: block; font-size: 19px; margin-top: 2px; font-variant-numeric: tabular-nums; }
body.app .so-h-sum b.so-h-d { font-size: 15px; }
body.app .so-h-sum small { font-size: 12px; font-weight: 500; color: var(--app-muted); }
body.app .so-h-bar { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; font-size: 13px; color: var(--app-muted); }
body.app .so-h-bar select { font: inherit; padding: 5px 8px; border: 1px solid var(--app-line-strong); border-radius: 8px; margin-left: 4px; }
body.app .so-h-bar .so-h-xl { margin-left: auto; padding: 4px 12px; min-height: 0; font-size: 13px; line-height: 1.5; }
body.app .so-h-wrap { overflow-x: auto; }
body.app .so-h-table { font-size: 13px; }
body.app .so-h-table td, body.app .so-h-table th { white-space: nowrap; }
body.app .so-h-table tr.so-h-open td { background: var(--app-brand-soft); }
body.app .so-h-table tr.so-h-year td { background: #f8fafc; font-weight: 700; font-size: 12px; color: #334155; }
body.app .so-h-table tr.so-h-neg td { color: var(--app-bad); }
body.app .so-h-table td.so-h-ship { font-size: 12px; }
body.app .so-h-tag { display: inline-block; font-size: 11px; font-weight: 600; padding: 0 6px; border-radius: 999px; background: var(--app-bad-soft); color: var(--app-bad); }
body.app .so-h-note { font-size: 12px; margin: 8px 0 0; }
body.app .mt-room-form input.so-h-add { flex: 0 1 260px; }
@media (max-width: 720px) {
  body.app .so-h-sum { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* TH | EN switch in the top bar (2026-11-24) */
body.app .lang-switch { display: inline-flex; margin: 0 0 0 6px; border: 1px solid var(--app-line-strong); border-radius: 999px; overflow: hidden; flex: none; }
body.app .lang-switch button { border: 0; background: transparent; padding: 4px 10px; font: 600 12px/1.4 Inter, system-ui, sans-serif; color: var(--app-muted); cursor: pointer; }
body.app .lang-switch button.on { background: var(--app-brand); color: #fff; cursor: default; }
body.app .lang-switch button:not(.on):hover { background: var(--app-brand-soft); color: var(--app-brand); }
