:root {
  --primary: #24486e;
  --primary-dark: #16324f;
  --accent: #d9a15b;
  --bg: #eef4f9;
  --surface: #ffffff;
  --surface-soft: #f5f8fc;
  --border: #d6e2ee;
  --text: #20364f;
  --muted: #66788f;
  --danger: #bf5a5a;
  --success: #2a6a81;
  --warning: #bf8351;
  --shadow: 0 20px 45px rgba(22, 50, 79, 0.08);
  --shadow-soft: 0 12px 28px rgba(22, 50, 79, 0.06);
  --primary-04: rgba(36, 72, 110, 0.04);
  --primary-06: rgba(36, 72, 110, 0.06);
  --primary-08: rgba(36, 72, 110, 0.08);
  --primary-10: rgba(36, 72, 110, 0.1);
  --primary-12: rgba(36, 72, 110, 0.12);
  --primary-14: rgba(36, 72, 110, 0.14);
  --primary-18: rgba(36, 72, 110, 0.18);
  --accent-10: rgba(217, 161, 91, 0.1);
  --accent-16: rgba(217, 161, 91, 0.16);
  --danger-10: rgba(191, 90, 90, 0.1);
  --danger-12: rgba(191, 90, 90, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Sarabun", "Segoe UI", Tahoma, sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at top center, rgba(217, 161, 91, 0.07), transparent 24%),
    linear-gradient(180deg, #f9fbfd 0%, var(--bg) 100%);
}

body.app-page {
  background:
    radial-gradient(circle at top right, rgba(217, 161, 91, 0.08), transparent 20%),
    radial-gradient(circle at top left, var(--primary-06), transparent 26%),
    linear-gradient(180deg, #f8fbfd 0%, #eef4f9 100%);
}

a {
  color: inherit;
  text-decoration: none;
}

button,
input,
select,
textarea {
  font: inherit;
}

.login-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(circle at top left, rgba(227, 163, 93, 0.16), transparent 30%),
    radial-gradient(circle at bottom right, var(--primary-12), transparent 42%),
    linear-gradient(180deg, #f4f7fb 0%, #e7eef6 100%);
}

.login-wrapper {
  width: 100%;
  max-width: 480px;
}

.wide-layout {
  max-width: 980px;
}

.login-card,
.panel,
.stat-card {
  background: var(--surface);
  border: 1px solid var(--primary-08);
  border-radius: 22px;
  box-shadow: var(--shadow);
}

.login-card {
  padding: 32px;
}

.login-header {
  display: grid;
  gap: 8px;
}

.login-header h1 {
  margin: 12px 0 8px;
  font-size: 1.9rem;
  line-height: 1.25;
}

.login-header p,
.brand p,
.topbar p,
.table-toolbar p,
.data-list small,
.form-message {
  color: var(--muted);
}

.login-badge,
.stat-card span,
.status-badge {
  display: inline-flex;
  align-items: center;
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 0.85rem;
}

.login-badge,
.stat-card span {
  background: var(--primary-08);
  color: var(--primary);
}

.form-grid {
  display: grid;
  gap: 16px;
}

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

.form-grid label {
  display: grid;
  gap: 8px;
}

.full-width {
  grid-column: 1 / -1;
}

/* แก้บั๊ก: เดิม dropdown "ประเภทครุภัณฑ์" ไม่มีวิธีเพิ่มหมวดหมู่ใหม่ในหน้าเว็บเลย
   ทำให้ dropdown ว่างเปล่าถ้ายังไม่เคยมีใครเพิ่มข้อมูลตรงในฐานข้อมูล เพิ่มปุ่ม
   "+ เพิ่มหมวดหมู่" ไว้ข้าง select ให้กดเพิ่มได้ทันที */
.input-with-action {
  display: flex;
  gap: 8px;
  align-items: center;
}

.input-with-action select {
  flex: 1;
}

.input-with-action .btn {
  flex-shrink: 0;
  white-space: nowrap;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px 14px;
  color: var(--text);
  background: linear-gradient(180deg, #ffffff 0%, #fdfefe 100%);
  box-shadow: inset 0 1px 2px rgba(255, 255, 255, 0.7);
}

input:focus,
select:focus,
textarea:focus {
  outline: 2px solid var(--primary-14);
  border-color: var(--primary);
  box-shadow: 0 0 0 4px var(--primary-04);
}

.btn {
  border: 0;
  border-radius: 12px;
  padding: 12px 18px;
  cursor: pointer;
  font-weight: 600;
  transition: transform 0.15s ease, opacity 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}

.btn:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-soft);
}

.btn-primary {
  color: #fff;
  background: linear-gradient(135deg, #2e5a88 0%, #1d3f63 100%);
}

.btn-secondary {
  color: var(--primary);
  background: linear-gradient(180deg, #f8fbff 0%, #ecf3fa 100%);
  border: 1px solid var(--primary-08);
}

.btn-danger {
  color: #fff;
  background: linear-gradient(135deg, #d16a6a 0%, #b44d4d 100%);
}

.btn-block {
  width: 100%;
}

.btn-sm {
  padding: 6px 12px;
  font-size: 0.85rem;
  border-radius: 8px;
}

.user-role-select {
  padding: 6px 8px;
  border-radius: 8px;
  border: 1px solid var(--primary-08);
  font-size: 0.9rem;
}

.divider-text {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 18px 0 14px;
  color: var(--muted);
  font-size: 0.95rem;
}

.divider-text::before,
.divider-text::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--primary-12);
}

.helper-text {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.6;
}

.notice-box {
  margin-top: 18px;
  padding: 16px;
  border-radius: 14px;
  background: linear-gradient(180deg, #fbfdff 0%, var(--surface-soft) 100%);
  border: 1px solid var(--border);
}

.notice-box a {
  color: var(--primary);
  font-weight: 600;
}

.layout {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 280px 1fr;
}

.sidebar {
  padding: 24px 18px;
  color: #fff;
  background:
    radial-gradient(circle at top right, rgba(217, 161, 91, 0.18), transparent 18%),
    linear-gradient(180deg, rgba(19, 43, 68, 0.99) 0%, rgba(36, 72, 110, 0.99) 100%);
  position: sticky;
  top: 0;
  height: 100vh;
  box-shadow: 18px 0 40px rgba(16, 36, 57, 0.14);
}

.brand h1 {
  margin: 0;
  font-size: 1.3rem;
}

.menu {
  display: grid;
  gap: 8px;
  margin: 32px 0;
}

.menu-link {
  padding: 13px 14px;
  border-radius: 14px;
  color: rgba(255, 255, 255, 0.82);
  border: 1px solid transparent;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease, transform 0.15s ease;
}

.menu-link.active,
.menu-link:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.11);
  border-color: rgba(255, 255, 255, 0.08);
  transform: translateX(2px);
}

.content {
  padding: 28px;
  min-width: 0;
}

.topbar h2,
.panel-header h3,
.section-title-row h3 {
  color: var(--primary-dark);
}

.topbar,
.table-toolbar,
.panel-header,
.user-panel {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.user-panel {
  padding: 12px 16px;
  border-radius: 16px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.72) 0%, rgba(236, 243, 250, 0.96) 100%);
  border: 1px solid var(--primary-08);
  flex-direction: column;
  align-items: flex-end;
  box-shadow: var(--shadow-soft);
}

.stats-grid,
.panel-grid {
  display: grid;
  gap: 18px;
}

.stats-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin: 24px 0;
}

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

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

.stat-card,
.panel {
  padding: 20px;
  backdrop-filter: blur(4px);
}

.stat-card strong {
  display: block;
  margin-top: 12px;
  font-size: 2rem;
}

.data-list {
  display: grid;
  gap: 10px;
}

.data-item {
  padding: 14px;
  border-radius: 14px;
  background: linear-gradient(180deg, #fafcff 0%, var(--surface-soft) 100%);
  border: 1px solid var(--border);
  box-shadow: 0 6px 18px rgba(22, 50, 79, 0.03);
}

.table-wrapper {
  width: 100%;
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 760px;
}

th,
td {
  padding: 14px 12px;
  border-bottom: 1px solid var(--border);
  text-align: left;
  vertical-align: top;
}

th {
  color: var(--primary-dark);
  background: linear-gradient(180deg, #f8fbff 0%, #eef4fa 100%);
}

tr:hover td {
  background: rgba(255, 255, 255, 0.55);
}

.row-unmatched td {
  background: rgba(255, 196, 0, 0.14);
}

.row-unmatched .receive-item-name {
  color: #9a6b00;
  font-weight: 600;
}

.file-input-label {
  display: inline-flex;
  align-items: center;
  cursor: pointer;
}

.hint-text {
  color: var(--muted);
  font-size: 0.85rem;
  margin: -4px 0 12px;
}

.table-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.table-actions .btn {
  padding: 8px 12px;
  font-size: 0.9rem;
}

.search-box {
  min-width: 280px;
}

.toolbar-inline,
.section-title-row,
.summary-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.section-title-row {
  justify-content: space-between;
  margin-bottom: 12px;
}

.summary-bar {
  justify-content: flex-end;
  padding-top: 14px;
}

.detail-card {
  display: grid;
  gap: 14px;
}

.detail-card p {
  margin: 0;
}

.status-badge.active,
.status-badge.approved,
.status-badge.good {
  background: var(--primary-10);
  color: var(--success);
}

.status-badge.damaged,
.status-badge.pending,
.status-badge.low,
.status-badge.low_stock {
  background: var(--danger-10);
  color: var(--warning);
}

.status-badge.lost,
.status-badge.disposed,
.status-badge.inactive,
.status-badge.rejected,
.status-badge.cancelled,
.status-badge.out_of_stock {
  background: var(--danger-12);
  color: var(--danger);
}

.status-badge.issued,
.status-badge.approved {
  background: var(--primary-10);
  color: var(--success);
}

.empty-state {
  padding: 18px;
  text-align: center;
  color: var(--muted);
  border: 1px dashed var(--border);
  border-radius: 14px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.72) 0%, rgba(245, 248, 252, 0.9) 100%);
}

body[data-page="home"] {
  min-height: 100vh;
  background:
    radial-gradient(circle at top right, rgba(93, 178, 255, 0.12), transparent 18%),
    radial-gradient(circle at top left, rgba(36, 72, 110, 0.08), transparent 24%),
    linear-gradient(180deg, #fcfeff 0%, #eef5fb 100%);
}

.home-shell {
  max-width: 1360px;
  margin: 0 auto;
  padding: 28px;
}

.home-hero {
  padding: 28px;
  border-radius: 32px;
  border: 1px solid rgba(255, 255, 255, 0.78);
  background:
    radial-gradient(circle at 78% 20%, rgba(120, 189, 255, 0.26), transparent 24%),
    linear-gradient(115deg, rgba(255, 255, 255, 0.98) 0%, rgba(230, 243, 255, 0.96) 58%, rgba(198, 227, 255, 0.94) 100%);
  box-shadow: 0 24px 60px rgba(22, 50, 79, 0.08);
}

.home-topbar,
.home-hero-content,
.home-brand {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}

.home-brand-mark {
  width: 88px;
  height: 88px;
  border-radius: 26px;
  display: grid;
  place-items: center;
  font-size: 1.8rem;
  font-weight: 800;
  color: #fff;
  background: linear-gradient(135deg, #183c78 0%, #295eb2 100%);
  box-shadow: 0 16px 34px rgba(29, 63, 99, 0.28);
}

.home-kicker {
  margin: 0 0 6px;
  color: var(--primary);
  font-weight: 700;
}

.home-hero h1 {
  margin: 0;
  font-size: clamp(2.3rem, 4vw, 4rem);
  line-height: 1.08;
  color: var(--primary-dark);
}

.home-hero-content {
  margin-top: 28px;
  align-items: stretch;
}

.home-hero-copy {
  flex: 1 1 60%;
}

.home-hero-copy p {
  margin: 0;
  max-width: 720px;
  font-size: 1.22rem;
  line-height: 1.8;
  color: #516781;
}

.home-hero-actions {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  margin-top: 26px;
}

.home-hero-panel {
  flex: 1 1 32%;
  display: grid;
  gap: 16px;
}

.home-stat {
  padding: 22px;
  border-radius: 22px;
  border: 1px solid var(--primary-08);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.94) 0%, rgba(241, 247, 252, 0.94) 100%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.86);
}

.home-stat strong {
  display: block;
  margin-bottom: 8px;
  color: var(--primary-dark);
  font-size: 1.1rem;
}

.home-stat span {
  color: var(--muted);
  line-height: 1.65;
}

.home-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 22px;
  margin-top: 28px;
}

.home-card {
  display: grid;
  gap: 16px;
  padding: 28px;
  border-radius: 28px;
  border: 1px solid var(--primary-08);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.98) 0%, rgba(250, 252, 255, 0.96) 100%);
  box-shadow: var(--shadow-soft);
  transition: transform 0.18s ease, box-shadow 0.18s ease;
}

.home-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 18px 36px rgba(22, 50, 79, 0.11);
}

.home-card-icon {
  width: 76px;
  height: 76px;
  border-radius: 24px;
  display: grid;
  place-items: center;
  font-size: 1.4rem;
  font-weight: 800;
}

.home-card h2 {
  margin: 0;
  font-size: 2rem;
  line-height: 1.15;
}

.home-card p {
  margin: 0;
  color: #5d6f86;
  line-height: 1.7;
}

.home-card span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  width: 100%;
  margin-top: 10px;
  border-radius: 14px;
  font-weight: 700;
  color: #fff;
  box-shadow: 0 12px 24px rgba(22, 50, 79, 0.12);
  text-shadow: 0 1px 1px rgba(0, 0, 0, 0.12);
}

.home-card-blue .home-card-icon,
.home-card-blue h2 {
  color: #1f63d0;
}

.home-card-blue .home-card-icon {
  background: radial-gradient(circle, rgba(88, 156, 255, 0.24) 0%, rgba(88, 156, 255, 0.12) 70%);
}

.home-card-blue {
  background: linear-gradient(180deg, #ffffff 0%, #f5f9ff 100%);
}

.home-card-blue span {
  background: linear-gradient(135deg, #4588f0 0%, #2d65d0 100%);
}

.home-card-green .home-card-icon,
.home-card-green h2 {
  color: #13a15f;
}

.home-card-green .home-card-icon {
  background: radial-gradient(circle, rgba(75, 207, 125, 0.24) 0%, rgba(75, 207, 125, 0.12) 70%);
}

.home-card-green {
  background: linear-gradient(180deg, #ffffff 0%, #f4fff8 100%);
}

.home-card-green span {
  background: linear-gradient(135deg, #27c27c 0%, #0f9f61 100%);
}

.home-card-orange .home-card-icon,
.home-card-orange h2 {
  color: #e48812;
}

.home-card-orange .home-card-icon {
  background: radial-gradient(circle, rgba(255, 186, 76, 0.26) 0%, rgba(255, 186, 76, 0.14) 70%);
}

.home-card-orange {
  background: linear-gradient(180deg, #ffffff 0%, #fffaf1 100%);
}

.home-card-orange span {
  background: linear-gradient(135deg, #ffad2f 0%, #f38a09 100%);
}

.home-card-purple .home-card-icon,
.home-card-purple h2 {
  color: #7446d8;
}

.home-card-blue span,
.home-card-green span,
.home-card-orange span,
.home-card-purple span {
  color: #fff;
}

.home-card p,
.home-stat span,
.home-hero-copy p {
  color: #445a74;
}

.home-card-purple .home-card-icon {
  background: radial-gradient(circle, rgba(148, 116, 241, 0.24) 0%, rgba(148, 116, 241, 0.12) 70%);
}

.home-card-purple {
  background: linear-gradient(180deg, #ffffff 0%, #faf7ff 100%);
}

.home-card-purple span {
  background: linear-gradient(135deg, #8661eb 0%, #6944d1 100%);
}

body[data-page="dashboard"] {
  background:
    radial-gradient(circle at top left, rgba(98, 181, 255, 0.12), transparent 24%),
    radial-gradient(circle at top right, rgba(35, 69, 107, 0.08), transparent 30%),
    linear-gradient(180deg, #fbfdff 0%, #eef4fa 52%, #f7f9fc 100%);
}

body[data-page="dashboard"] .topbar {
  margin-bottom: 10px;
  padding: 26px 28px;
  border: 1px solid rgba(255, 255, 255, 0.6);
  border-radius: 28px;
  background:
    radial-gradient(circle at 86% 20%, rgba(118, 191, 255, 0.18), transparent 18%),
    linear-gradient(135deg, rgba(255, 255, 255, 0.94) 0%, rgba(241, 248, 255, 0.97) 65%, rgba(222, 239, 255, 0.95) 100%);
  box-shadow: 0 22px 48px rgba(23, 48, 77, 0.07);
}

body[data-page="dashboard"] .topbar h2 {
  margin: 0;
  font-size: 2.25rem;
  line-height: 1.15;
  color: var(--primary-dark);
}

body[data-page="dashboard"] .topbar p {
  margin: 12px 0 0;
  max-width: 760px;
  color: #5f7187;
}

body[data-page="dashboard"] .user-panel {
  min-width: 170px;
  padding: 18px 20px;
  border: 1px solid rgba(35, 69, 107, 0.08);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.86) 0%, rgba(238, 243, 248, 0.96) 100%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.8);
}

body[data-page="dashboard"] .stats-grid {
  gap: 22px;
}

body[data-page="dashboard"] .stat-card {
  position: relative;
  overflow: hidden;
  min-height: 126px;
  border: 1px solid rgba(35, 69, 107, 0.08);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.98) 0%, rgba(246, 249, 252, 0.96) 100%);
}

body[data-page="dashboard"] .stat-card::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 6px;
  background: linear-gradient(180deg, #e3a35d 0%, #23456b 100%);
}

body[data-page="dashboard"] .stat-card::after {
  content: "";
  position: absolute;
  top: -38px;
  right: -18px;
  width: 118px;
  height: 118px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(35, 69, 107, 0.09) 0%, rgba(35, 69, 107, 0) 72%);
}

body[data-page="dashboard"] .stat-card span {
  position: relative;
  z-index: 1;
  background: rgba(35, 69, 107, 0.07);
}

body[data-page="dashboard"] .stat-card strong {
  position: relative;
  z-index: 1;
  margin-top: 18px;
  font-size: 2.35rem;
  color: var(--primary-dark);
}

body[data-page="dashboard"] .stats-grid .stat-card:nth-child(1) {
  background: linear-gradient(180deg, #fff8ef 0%, #fff1dc 100%);
  border-color: rgba(227, 163, 93, 0.24);
}

body[data-page="dashboard"] .stats-grid .stat-card:nth-child(1)::before {
  background: linear-gradient(180deg, #f0a54a 0%, #d9851f 100%);
}

body[data-page="dashboard"] .stats-grid .stat-card:nth-child(1) span {
  background: rgba(240, 165, 74, 0.14);
  color: #9a5a14;
}

body[data-page="dashboard"] .stats-grid .stat-card:nth-child(1) strong {
  color: #8f4d10;
}

body[data-page="dashboard"] .stats-grid .stat-card:nth-child(2) {
  background: linear-gradient(180deg, #eef8ff 0%, #dff1ff 100%);
  border-color: rgba(68, 145, 214, 0.22);
}

body[data-page="dashboard"] .stats-grid .stat-card:nth-child(2)::before {
  background: linear-gradient(180deg, #4fa3eb 0%, #256fae 100%);
}

body[data-page="dashboard"] .stats-grid .stat-card:nth-child(2) span {
  background: rgba(79, 163, 235, 0.14);
  color: #1f5d91;
}

body[data-page="dashboard"] .stats-grid .stat-card:nth-child(2) strong {
  color: #174e7f;
}

body[data-page="dashboard"] .stats-grid .stat-card:nth-child(3) {
  background: linear-gradient(180deg, #eefcf5 0%, #def8ea 100%);
  border-color: rgba(74, 169, 118, 0.22);
}

body[data-page="dashboard"] .stats-grid .stat-card:nth-child(3)::before {
  background: linear-gradient(180deg, #4baa76 0%, #2d7e53 100%);
}

body[data-page="dashboard"] .stats-grid .stat-card:nth-child(3) span {
  background: rgba(75, 170, 118, 0.14);
  color: #2d7e53;
}

body[data-page="dashboard"] .stats-grid .stat-card:nth-child(3) strong {
  color: #266c47;
}

body[data-page="dashboard"] .stats-grid .stat-card:nth-child(4) {
  background: linear-gradient(180deg, #fff3f2 0%, #ffe4e1 100%);
  border-color: rgba(219, 104, 104, 0.2);
}

body[data-page="dashboard"] .stats-grid .stat-card:nth-child(4)::before {
  background: linear-gradient(180deg, #e07c7c 0%, #bb4b4b 100%);
}

body[data-page="dashboard"] .stats-grid .stat-card:nth-child(4) span {
  background: rgba(224, 124, 124, 0.14);
  color: #a44040;
}

body[data-page="dashboard"] .stats-grid .stat-card:nth-child(4) strong {
  color: #923535;
}

body[data-page="dashboard"] .stats-grid .stat-card:nth-child(5) {
  background: linear-gradient(180deg, #f5f2ff 0%, #ebe4ff 100%);
  border-color: rgba(131, 111, 214, 0.22);
}

body[data-page="dashboard"] .stats-grid .stat-card:nth-child(5)::before {
  background: linear-gradient(180deg, #8b72e8 0%, #5d46ba 100%);
}

body[data-page="dashboard"] .stats-grid .stat-card:nth-child(5) span {
  background: rgba(139, 114, 232, 0.14);
  color: #6245c7;
}

body[data-page="dashboard"] .stats-grid .stat-card:nth-child(5) strong {
  color: #5438b8;
}

body[data-page="dashboard"] .stats-grid .stat-card:nth-child(6) {
  background: linear-gradient(180deg, #eefbf9 0%, #daf4ef 100%);
  border-color: rgba(61, 171, 154, 0.22);
}

body[data-page="dashboard"] .stats-grid .stat-card:nth-child(6)::before {
  background: linear-gradient(180deg, #37b7a2 0%, #227868 100%);
}

body[data-page="dashboard"] .stats-grid .stat-card:nth-child(6) span {
  background: rgba(55, 183, 162, 0.14);
  color: #217869;
}

body[data-page="dashboard"] .stats-grid .stat-card:nth-child(6) strong {
  color: #1b6a5d;
}

body[data-page="dashboard"] .stats-grid .stat-card:nth-child(7) {
  background: linear-gradient(180deg, #fff7ec 0%, #ffecd0 100%);
  border-color: rgba(224, 164, 68, 0.22);
}

body[data-page="dashboard"] .stats-grid .stat-card:nth-child(7)::before {
  background: linear-gradient(180deg, #efb04d 0%, #ca7f17 100%);
}

body[data-page="dashboard"] .stats-grid .stat-card:nth-child(7) span {
  background: rgba(239, 176, 77, 0.16);
  color: #a86410;
}

body[data-page="dashboard"] .stats-grid .stat-card:nth-child(7) strong {
  color: #90510d;
}

body[data-page="dashboard"] .stats-grid .stat-card:nth-child(8) {
  background: linear-gradient(180deg, #f0f7ff 0%, #deecff 100%);
  border-color: rgba(94, 145, 212, 0.22);
}

body[data-page="dashboard"] .stats-grid .stat-card:nth-child(8)::before {
  background: linear-gradient(180deg, #6fa8ea 0%, #396fb7 100%);
}

body[data-page="dashboard"] .stats-grid .stat-card:nth-child(8) span {
  background: rgba(111, 168, 234, 0.16);
  color: #315f9a;
}

body[data-page="dashboard"] .stats-grid .stat-card:nth-child(8) strong {
  color: #264d82;
}

body[data-page="dashboard"] .stats-grid .stat-card:nth-child(9) {
  background: linear-gradient(180deg, #eefaf3 0%, #ddf3e7 100%);
  border-color: rgba(77, 170, 114, 0.22);
}

body[data-page="dashboard"] .stats-grid .stat-card:nth-child(9)::before {
  background: linear-gradient(180deg, #59bf7c 0%, #2f8551 100%);
}

body[data-page="dashboard"] .stats-grid .stat-card:nth-child(9) span {
  background: rgba(89, 191, 124, 0.16);
  color: #2f7d4e;
}

body[data-page="dashboard"] .stats-grid .stat-card:nth-child(9) strong {
  color: #256641;
}

body[data-page="dashboard"] .stats-grid .stat-card:nth-child(10) {
  background: linear-gradient(180deg, #fff1f7 0%, #ffe1ee 100%);
  border-color: rgba(217, 99, 151, 0.22);
}

body[data-page="dashboard"] .stats-grid .stat-card:nth-child(10)::before {
  background: linear-gradient(180deg, #ea76b0 0%, #bf4e84 100%);
}

body[data-page="dashboard"] .stats-grid .stat-card:nth-child(10) span {
  background: rgba(234, 118, 176, 0.16);
  color: #ac4a79;
}

body[data-page="dashboard"] .stats-grid .stat-card:nth-child(10) strong {
  color: #963d68;
}

body[data-page="dashboard"] .stats-grid .stat-card:nth-child(11) {
  background: linear-gradient(180deg, #f3f4ff 0%, #e6e8ff 100%);
  border-color: rgba(115, 121, 221, 0.22);
}

body[data-page="dashboard"] .stats-grid .stat-card:nth-child(11)::before {
  background: linear-gradient(180deg, #7d83ed 0%, #525abe 100%);
}

body[data-page="dashboard"] .stats-grid .stat-card:nth-child(11) span {
  background: rgba(125, 131, 237, 0.16);
  color: #565cc8;
}

body[data-page="dashboard"] .stats-grid .stat-card:nth-child(11) strong {
  color: #494fab;
}

body[data-page="dashboard"] .stats-grid .stat-card:nth-child(12) {
  background: linear-gradient(180deg, #eefbff 0%, #def4fb 100%);
  border-color: rgba(69, 172, 201, 0.22);
}

body[data-page="dashboard"] .stats-grid .stat-card:nth-child(12)::before {
  background: linear-gradient(180deg, #57bfd8 0%, #27839d 100%);
}

body[data-page="dashboard"] .stats-grid .stat-card:nth-child(12) span {
  background: rgba(87, 191, 216, 0.16);
  color: #267c92;
}

body[data-page="dashboard"] .stats-grid .stat-card:nth-child(12) strong {
  color: #1e697d;
}

body[data-page="dashboard"] .panel {
  border: 1px solid rgba(35, 69, 107, 0.08);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.99) 0%, rgba(249, 252, 255, 0.97) 100%);
}

body[data-page="dashboard"] .panel-header {
  margin-bottom: 16px;
}

body[data-page="dashboard"] .panel-header h3 {
  margin: 0;
  font-size: 1.55rem;
  color: var(--primary-dark);
}

body[data-page="dashboard"] .data-list {
  gap: 12px;
}

body[data-page="dashboard"] .data-item {
  border-radius: 16px;
  background: linear-gradient(180deg, #fbfdff 0%, #f2f7fb 100%);
  border: 1px solid #d4deea;
}

body[data-page="dashboard"] .data-item strong {
  color: var(--primary-dark);
}

body[data-page="dashboard"] .dashboard-grid .panel:nth-child(1) {
  background: linear-gradient(180deg, #fffaf2 0%, #fff3e2 100%);
  border-color: rgba(231, 174, 87, 0.18);
}

body[data-page="dashboard"] .dashboard-grid .panel:nth-child(2) {
  background: linear-gradient(180deg, #f2f8ff 0%, #e7f1ff 100%);
  border-color: rgba(88, 156, 229, 0.18);
}

body[data-page="dashboard"] .dashboard-grid .panel:nth-child(3) {
  background: linear-gradient(180deg, #f1fbf6 0%, #e4f7ec 100%);
  border-color: rgba(84, 180, 120, 0.18);
}

body[data-page="dashboard"] .dashboard-grid .panel:nth-child(4) {
  background: linear-gradient(180deg, #fff4f6 0%, #ffe8ee 100%);
  border-color: rgba(217, 105, 138, 0.18);
}

body[data-page="dashboard"] .dashboard-grid .panel:nth-child(5) {
  background: linear-gradient(180deg, #f6f4ff 0%, #ece8ff 100%);
  border-color: rgba(134, 119, 224, 0.18);
}

body[data-page="dashboard"] .dashboard-grid .panel:nth-child(6) {
  background: linear-gradient(180deg, #f1fcfb 0%, #e2f7f4 100%);
  border-color: rgba(64, 177, 160, 0.18);
}

body[data-page="dashboard"] .dashboard-grid .panel:nth-child(7) {
  background: linear-gradient(180deg, #fff8f1 0%, #ffeedf 100%);
  border-color: rgba(222, 150, 67, 0.18);
}

body[data-page="dashboard"] .dashboard-grid .panel:nth-child(8) {
  background: linear-gradient(180deg, #f3f7ff 0%, #e7edff 100%);
  border-color: rgba(110, 128, 226, 0.18);
}

.hidden-block {
  display: none;
}

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

  .stats-grid,
  .panel-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

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

@media (max-width: 1080px) {
  .home-hero-content,
  .home-topbar,
  .home-brand {
    align-items: flex-start;
    flex-direction: column;
  }

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

  .two-columns,
  .layout {
    grid-template-columns: 1fr;
  }

  .sidebar {
    height: auto;
    position: relative;
  }

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

  .user-panel,
  .topbar,
  .table-toolbar,
  .toolbar-inline,
  .section-title-row,
  .summary-bar {
    align-items: flex-start;
    flex-direction: column;
  }

  .content {
    padding: 20px;
  }

  .login-wrapper {
    max-width: 620px;
  }
}

@media (max-width: 640px) {
  .home-shell {
    padding: 14px;
  }

  .home-hero,
  .home-card {
    padding: 20px;
    border-radius: 22px;
  }

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

  .home-brand-mark {
    width: 72px;
    height: 72px;
    border-radius: 20px;
    font-size: 1.5rem;
  }

  .home-hero h1 {
    font-size: 2rem;
  }

  .login-card,
  .panel,
  .stat-card {
    border-radius: 16px;
  }

  .login-card {
    padding: 24px;
  }

  .login-page {
    padding: 14px;
  }

  .login-header h1 {
    font-size: 1.55rem;
  }

  .content {
    padding: 14px;
  }

  .panel,
  .stat-card {
    padding: 16px;
  }

  th,
  td {
    padding: 11px 10px;
  }

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

  .user-panel {
    width: 100%;
    align-items: flex-start;
  }

  .search-box {
    min-width: 100%;
  }
}

body[data-page="asset_inspection"] .annual-open-box {
  display: grid;
  grid-template-columns: minmax(240px, 1fr) minmax(320px, 1.6fr);
  gap: 16px;
  align-items: end;
  padding: 16px;
  margin-bottom: 18px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: linear-gradient(180deg, #fbfdff 0%, #f4f8fc 100%);
}

body[data-page="asset_inspection"] .annual-open-box strong,
body[data-page="asset_inspection"] .qr-scan-header strong,
body[data-page="asset_inspection"] .inspection-active-summary strong {
  display: block;
  color: var(--primary-dark);
}

body[data-page="asset_inspection"] .annual-open-box small,
body[data-page="asset_inspection"] .qr-scan-header small,
body[data-page="asset_inspection"] .inspection-active-summary small {
  display: block;
  margin-top: 4px;
  color: var(--muted);
}

body[data-page="asset_inspection"] .annual-open-controls {
  display: grid;
  grid-template-columns: minmax(130px, 0.8fr) minmax(160px, 1fr) auto;
  gap: 12px;
  align-items: end;
}

body[data-page="asset_inspection"] .inspection-manual-title {
  justify-content: flex-start;
  margin: 4px 0 12px;
}

body[data-page="asset_inspection"] .inspection-active-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: linear-gradient(180deg, #fbfdff 0%, #f5f8fc 100%);
}

body[data-page="asset_inspection"] .qr-scan-panel {
  display: grid;
  gap: 14px;
  margin: 14px 0 18px;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: #fbfdff;
}

body[data-page="asset_inspection"] .qr-scan-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

body[data-page="asset_inspection"] .qr-scan-grid {
  display: grid;
  grid-template-columns: minmax(260px, 0.9fr) minmax(280px, 1.1fr);
  gap: 16px;
  align-items: stretch;
}

body[data-page="asset_inspection"] .qr-camera-box {
  position: relative;
  min-height: 220px;
  overflow: hidden;
  border: 1px dashed var(--border);
  border-radius: 14px;
  background: #10243a;
}

body[data-page="asset_inspection"] #qrScannerVideo {
  width: 100%;
  height: 100%;
  min-height: 220px;
  object-fit: cover;
  display: block;
}

body[data-page="asset_inspection"] .qr-camera-fallback {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 18px;
  color: #dce8f5;
  text-align: center;
  background: linear-gradient(180deg, rgba(16, 36, 58, 0.88) 0%, rgba(22, 50, 79, 0.96) 100%);
}

body[data-page="asset_inspection"] .qr-token-box {
  display: grid;
  align-content: center;
  gap: 12px;
}

body[data-page="asset_inspection"] .selected-row td {
  background: var(--primary-04);
}

.status-badge.open {
  background: var(--primary-10);
  color: var(--success);
}

.status-badge.closed {
  background: var(--danger-12);
  color: var(--danger);
}

@media (max-width: 980px) {
  body[data-page="asset_inspection"] .annual-open-box,
  body[data-page="asset_inspection"] .qr-scan-grid {
    grid-template-columns: 1fr;
  }

  body[data-page="asset_inspection"] .annual-open-controls {
    grid-template-columns: 1fr;
  }

  body[data-page="asset_inspection"] .inspection-active-summary,
  body[data-page="asset_inspection"] .qr-scan-header {
    align-items: flex-start;
    flex-direction: column;
  }
}
.public-inspection-actions {
  margin: 14px 0 10px;
}

.public-inspection-actions .btn {
  width: 100%;
  justify-content: center;
}

.public-inspection-summary {
  margin: 8px 0 12px;
}

.public-inspection-summary small {
  display: block;
  margin-top: 4px;
  color: var(--muted);
}
body[data-page="asset_inspection"] .inspection-confirmed-summary {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  margin: 14px 0;
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: linear-gradient(180deg, #fbfdff 0%, #f4f8fc 100%);
}

body[data-page="asset_inspection"] .inspection-confirmed-summary strong {
  display: block;
  color: var(--primary-dark);
}

body[data-page="asset_inspection"] .inspection-confirmed-summary small {
  display: block;
  margin-top: 4px;
  color: var(--muted);
}

body[data-page="asset_inspection"] .confirmed-latest-list {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
  max-width: 760px;
}

body[data-page="asset_inspection"] .confirmed-latest-list span {
  display: inline-flex;
  align-items: center;
  max-width: 320px;
  min-height: 32px;
  padding: 6px 10px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: #ffffff;
  color: var(--primary-dark);
  font-size: 0.9rem;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

@media (max-width: 980px) {
  body[data-page="asset_inspection"] .inspection-confirmed-summary {
    flex-direction: column;
  }

  body[data-page="asset_inspection"] .confirmed-latest-list {
    justify-content: flex-start;
    max-width: 100%;
  }
}

.public-inspection-edit {
  display: grid;
  gap: 12px;
  margin: 16px 0 8px;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: #fbfdff;
}

.public-inspection-edit label {
  display: grid;
  gap: 6px;
  color: var(--primary-dark);
  font-weight: 700;
}

.public-inspection-edit input {
  width: 100%;
  min-height: 46px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--text);
  font: inherit;
  font-weight: 400;
}

/* Mobile-first application shell and shared interaction patterns. */
.mobile-menu-toggle,
.mobile-menu-close,
.mobile-menu-overlay,
.mobile-scan-button {
  display: none;
}

.btn,
.menu-link,
button,
input,
select,
textarea,
.file-input-label {
  min-height: 44px;
}

.table-wrapper {
  max-width: 100%;
  overflow: auto;
  overscroll-behavior-inline: contain;
  border-radius: 14px;
  -webkit-overflow-scrolling: touch;
}

.toolbar-filters {
  display: grid;
  grid-template-columns: repeat(3, minmax(150px, 1fr));
  gap: 10px;
  width: min(100%, 720px);
}

.select-search-input {
  margin-bottom: 8px;
}

.input-with-action {
  flex-wrap: wrap;
}

.input-with-action .select-search-input {
  flex: 1 1 100%;
}

.screen-actions,
.mobile-pagination,
.file-preview-item {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.mobile-pagination {
  justify-content: flex-end;
  margin-top: 14px;
}

.mobile-pagination span {
  min-width: 110px;
  text-align: center;
}

.pagination-hidden {
  display: none !important;
}

.file-preview-list {
  display: grid;
  gap: 10px;
  margin-top: 8px;
}

.file-preview-item {
  justify-content: space-between;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface-soft);
}

.file-preview-item img {
  width: 72px;
  height: 72px;
  border-radius: 10px;
  object-fit: cover;
}

.file-preview-item span {
  flex: 1;
  min-width: 0;
  overflow-wrap: anywhere;
}

.field-invalid {
  border-color: var(--danger) !important;
}

.field-error {
  color: var(--danger);
  line-height: 1.45;
}

.global-save-status {
  position: fixed;
  z-index: 1300;
  right: 18px;
  bottom: max(18px, env(safe-area-inset-bottom));
  max-width: min(420px, calc(100vw - 36px));
  padding: 13px 16px;
  border-radius: 14px;
  color: #fff;
  box-shadow: 0 18px 40px rgba(16, 36, 57, 0.24);
}

.global-save-status.is-loading { background: var(--primary); }
.global-save-status.is-success { background: #287052; }
.global-save-status.is-error { background: var(--danger); }

.document-share-button {
  margin-inline-start: 8px;
}

[hidden] {
  display: none !important;
}

@media (max-width: 1080px) {
  html {
    scroll-padding-bottom: 120px;
  }

  body.app-page {
    overflow-x: hidden;
  }

  .layout {
    display: block;
    min-width: 0;
  }

  .sidebar {
    position: fixed;
    z-index: 1200;
    inset: 0 auto 0 0;
    width: min(88vw, 340px);
    height: 100dvh;
    overflow-y: auto;
    transform: translateX(-105%);
    transition: transform 0.22s ease;
  }

  body.menu-open {
    overflow: hidden;
  }

  body.menu-open .sidebar {
    transform: translateX(0);
  }

  .mobile-menu-toggle {
    position: sticky;
    z-index: 900;
    top: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    padding: 10px 16px;
    border: 0;
    color: #fff;
    background: var(--primary-dark);
    box-shadow: 0 6px 18px rgba(16, 36, 57, 0.18);
  }

  .mobile-menu-close {
    position: absolute;
    top: 10px;
    right: 10px;
    display: grid;
    place-items: center;
    width: 44px;
    border: 0;
    border-radius: 50%;
    color: #fff;
    background: rgba(255, 255, 255, 0.12);
    font-size: 1.7rem;
  }

  .mobile-menu-overlay {
    position: fixed;
    z-index: 1100;
    inset: 0;
    width: 100%;
    height: 100%;
    border: 0;
    background: rgba(10, 24, 38, 0.58);
  }

  body.menu-open .mobile-menu-overlay {
    display: block;
  }

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

  .content {
    width: 100%;
    min-width: 0;
    padding-bottom: calc(96px + env(safe-area-inset-bottom));
  }

  .two-columns,
  .toolbar-filters {
    grid-template-columns: 1fr;
  }

  .form-actions {
    position: sticky;
    bottom: env(safe-area-inset-bottom);
    z-index: 20;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    padding: 10px;
    border: 1px solid var(--border);
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.96);
    box-shadow: 0 -8px 26px rgba(22, 50, 79, 0.1);
  }

  .mobile-scan-button {
    position: fixed;
    z-index: 850;
    right: 14px;
    bottom: max(14px, env(safe-area-inset-bottom));
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    min-width: 124px;
    min-height: 52px;
    padding: 10px 16px;
    border-radius: 999px;
    color: #fff;
    background: linear-gradient(135deg, #2e5a88 0%, #16324f 100%);
    box-shadow: 0 14px 30px rgba(22, 50, 79, 0.28);
    font-weight: 700;
  }
}

@media (max-width: 640px) {
  body,
  button,
  input,
  select,
  textarea {
    font-size: 16px;
  }

  h1, h2, h3, p, td, th, label, .menu-link {
    overflow-wrap: anywhere;
    word-break: normal;
  }

  .topbar h2 {
    font-size: 1.55rem;
    line-height: 1.35;
  }

  .panel-header,
  .table-toolbar {
    align-items: stretch;
  }

  .screen-actions,
  .screen-actions .btn,
  .table-toolbar .btn {
    width: 100%;
  }

  .mobile-card-table {
    min-width: 0;
  }

  .mobile-card-table thead {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
  }

  .mobile-card-table,
  .mobile-card-table tbody,
  .mobile-card-table tr,
  .mobile-card-table td {
    display: block;
    width: 100%;
  }

  .mobile-card-table tbody {
    display: grid;
    gap: 14px;
  }

  .mobile-card-table tr {
    overflow: hidden;
    border: 1px solid var(--border);
    border-radius: 16px;
    background: #fff;
    box-shadow: var(--shadow-soft);
  }

  .mobile-card-table td {
    display: grid;
    grid-template-columns: minmax(105px, 38%) 1fr;
    gap: 10px;
    min-height: 44px;
    padding: 11px 13px;
    border-bottom: 1px solid var(--border);
  }

  .mobile-card-table td::before {
    content: attr(data-label);
    color: var(--muted);
    font-weight: 700;
  }

  .mobile-card-table td:last-child {
    border-bottom: 0;
  }

  .mobile-card-table td:has(.empty-state) {
    display: block;
  }

  .mobile-card-table td:has(.empty-state)::before {
    content: none;
  }

  .mobile-card-table .table-actions {
    display: grid;
    grid-template-columns: 1fr;
  }

  .mobile-card-table .table-actions .btn {
    width: 100%;
  }

  .input-with-action,
  .mobile-pagination {
    align-items: stretch;
    flex-direction: column;
  }

  .input-with-action {
    flex-wrap: nowrap;
  }

  .input-with-action .btn,
  .mobile-pagination .btn {
    width: 100%;
  }

  .form-actions {
    grid-template-columns: 1fr;
  }

  .global-save-status {
    right: 12px;
    bottom: calc(76px + env(safe-area-inset-bottom));
    max-width: calc(100vw - 24px);
  }
}

/* Step 4 - Asset registry V2 */
.form-note{padding:12px 14px;border:1px solid var(--border,#d9dee7);border-radius:10px;background:rgba(15,98,254,.04);font-size:.92rem;line-height:1.55}
#assetForm h4{margin:12px 0 0;padding:10px 0 6px;border-bottom:1px solid var(--border,#e5e7eb)}
#assetForm input[readonly]{background:#f5f7fa;cursor:not-allowed}
@media (max-width:768px){#assetForm h4{font-size:1rem}.form-note{font-size:.88rem}.table-actions .btn{min-height:42px}}

/* V2 Step 9 - mobile annual inspection */
.inspection-mini-stats{display:grid;grid-template-columns:repeat(6,minmax(95px,1fr));gap:10px;margin:12px 0}
.mini-stat{border:1px solid var(--border,#d9dee8);border-radius:12px;padding:12px;background:#fff}.mini-stat span{display:block;font-size:.82rem;color:#667085}.mini-stat strong{display:block;font-size:1.35rem;margin-top:4px}
.mobile-inspection-toolbar{display:flex;justify-content:space-between;gap:12px;margin:10px 0 14px}.mobile-inspection-toolbar small{display:block;color:#667085;margin-top:4px}
.inspection-mobile-grid{display:grid;grid-template-columns:minmax(280px,1fr) minmax(280px,1fr);gap:16px;align-items:start}
.inspection-mobile-camera video{width:100%;min-height:220px;max-height:420px;object-fit:cover;background:#111;border-radius:14px}
.mobile-asset-card{display:grid;grid-template-columns:110px 1fr;gap:12px;align-items:center;margin-top:12px;padding:12px;border:1px solid var(--border,#d9dee8);border-radius:14px;background:#fff}
.mobile-asset-card img{width:110px;height:90px;object-fit:cover;border-radius:10px}.mobile-asset-card strong,.mobile-asset-card span,.mobile-asset-card small{display:block}.mobile-asset-card small{margin-top:6px;color:#667085}
.discrepancy-row{display:flex;justify-content:space-between;gap:12px;align-items:center;padding:12px 0;border-bottom:1px solid var(--border,#e5e7eb)}.discrepancy-row small{display:block;margin-top:4px;word-break:break-word}
#mobileInspectionV2Panel details{margin-top:14px;border:1px solid var(--border,#e5e7eb);border-radius:12px;padding:10px 12px}#mobileInspectionV2Panel summary{cursor:pointer;font-weight:700}
@media (max-width: 820px){.inspection-mini-stats{grid-template-columns:repeat(2,1fr)}.inspection-mobile-grid{grid-template-columns:1fr}.inspection-mobile-camera video{min-height:240px}.mobile-sticky-actions{position:sticky;bottom:0;z-index:5;background:rgba(255,255,255,.96);padding:10px 0}.mobile-sticky-actions .btn{min-height:48px;flex:1}.discrepancy-row{align-items:stretch;flex-direction:column}.discrepancy-row>div:last-child{display:grid;grid-template-columns:1fr 1fr;gap:8px}.mobile-asset-card{grid-template-columns:88px 1fr}.mobile-asset-card img{width:88px;height:76px}}

/* V2 Step 10 - repair & warranty workflow */
.repair-qr-box{display:grid;grid-template-columns:minmax(280px,1fr) minmax(300px,1fr);gap:16px;align-items:start}.repair-camera-box video{width:100%;min-height:220px;max-height:380px;object-fit:cover;background:#111;border-radius:14px}.repair-warranty-card strong,.repair-warranty-card small{display:block}.repair-warranty-card .status-badge{margin:8px 0}.repair-metrics-inline{display:flex;gap:8px;flex-wrap:wrap;margin:8px 0}.repair-metrics-inline span{padding:6px 10px;border-radius:999px;background:#f3f5f8;font-size:.84rem}.repair-workflow-head{display:flex;align-items:flex-start;justify-content:space-between;gap:12px}.repair-workflow-head small{display:block;margin-top:4px;color:#667085}#repairWorkflowV2Panel details{margin-top:12px;border:1px solid var(--border,#e5e7eb);border-radius:12px;padding:10px 12px}#repairWorkflowV2Panel summary{font-weight:700;cursor:pointer}
@media(max-width:820px){.repair-qr-box{grid-template-columns:1fr}.repair-camera-box video{min-height:240px}.repair-workflow-head{flex-direction:column}.repair-metrics-inline{display:grid;grid-template-columns:1fr 1fr}.repair-metrics-inline span:last-child{grid-column:1/-1}}


/* Fast manual asset lookup for annual inspection */
.asset-quick-search-field{position:relative;align-self:start}
.asset-search-wrap{position:relative}
.asset-search-wrap input{padding-right:44px;width:100%}
.asset-search-clear{position:absolute;right:8px;top:50%;transform:translateY(-50%);width:34px;height:34px;border:0;border-radius:10px;background:#eef4fa;color:#294d72;font-size:24px;line-height:1;cursor:pointer}
.field-hint{margin-top:6px;color:#718399;font-size:.82rem}
.asset-search-results{position:absolute;z-index:40;left:0;right:0;top:calc(100% - 2px);max-height:360px;overflow:auto;background:#fff;border:1px solid #cddbea;border-radius:14px;box-shadow:0 16px 36px rgba(32,61,91,.18);padding:6px}
.asset-search-result{display:flex;width:100%;flex-direction:column;align-items:flex-start;gap:3px;padding:11px 12px;border:0;border-bottom:1px solid #edf2f7;background:#fff;text-align:left;cursor:pointer;color:#18334f}
.asset-search-result:last-child{border-bottom:0}.asset-search-result:hover,.asset-search-result:focus{background:#eef6ff;outline:none}.asset-search-result strong{font-size:1rem;color:#174f82}.asset-search-result span{font-weight:600}.asset-search-result small{color:#62778d;line-height:1.35}
.asset-search-loading,.asset-search-empty{padding:16px;color:#62778d;text-align:center}
.asset-search-selected{margin-top:8px;border:1px solid #b7d6f3;background:#f2f8fe;border-radius:12px;padding:10px 12px;display:flex;flex-direction:column;gap:3px}.asset-search-selected strong{color:#174f82}.asset-search-selected small{color:#62778d;line-height:1.4}
@media(max-width:768px){.asset-quick-search-field{grid-column:1/-1}.asset-search-results{position:fixed;left:12px;right:12px;top:auto;bottom:12px;max-height:55vh;border-radius:18px;box-shadow:0 18px 48px rgba(0,0,0,.28)}.asset-search-result{padding:14px}.asset-search-wrap input{font-size:16px;min-height:50px}}

/* Inspection multi-photo evidence */
.inspection-photo-capture-box{border:1px solid var(--border,#d8e2ee);border-radius:14px;padding:14px;background:#fff}.inspection-photo-capture-box .field-label{display:flex;justify-content:space-between;gap:12px;margin-bottom:8px;font-weight:700}.inspection-photo-buttons{margin:8px 0;flex-wrap:wrap}.inspection-file-button{cursor:pointer}.inspection-photo-preview{display:grid;grid-template-columns:repeat(auto-fill,minmax(110px,1fr));gap:10px;margin-top:10px}.inspection-photo-thumb{position:relative;border:1px solid #d8e2ee;border-radius:12px;overflow:hidden;background:#f6f9fc;min-height:96px}.inspection-photo-thumb img{width:100%;height:100px;object-fit:cover;display:block}.inspection-photo-thumb button{position:absolute;top:5px;right:5px;width:30px;height:30px;border:0;border-radius:50%;background:rgba(20,40,60,.82);color:#fff;font-size:20px;line-height:1;cursor:pointer}.inspection-photo-thumb small{display:block;padding:6px 8px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.inspection-photo-uploading{opacity:.65}@media(max-width:700px){.inspection-photo-preview{grid-template-columns:repeat(3,minmax(0,1fr))}.inspection-photo-thumb img{height:92px}.inspection-photo-buttons .btn{min-height:46px}}
.field-survey-shortcut{display:flex;align-items:center;justify-content:space-between;gap:16px;border-left:5px solid #2f75b5;background:#f7fbff}.field-survey-shortcut p{margin:4px 0 0;color:#64748b}@media(max-width:700px){.field-survey-shortcut{align-items:stretch;flex-direction:column}.field-survey-shortcut .btn{width:100%;min-height:50px}}

/* Survey 2570: print report in the same page (no popup required) */
.survey-print-area{display:none}
@media print{
  @page{size:A4 landscape;margin:10mm}
  body.survey-printing > *:not(#survey2570PrintArea){display:none !important}
  body.survey-printing #survey2570PrintArea{display:block !important;position:static !important;width:100% !important;margin:0 !important;padding:0 !important;background:#fff !important;color:#111 !important}
  body.survey-printing .survey-print-report{font-family:Tahoma,"Noto Sans Thai",sans-serif;font-size:10px;color:#111}
  body.survey-printing .survey-print-report h1{font-size:18px;margin:0;text-align:center}
  body.survey-printing .survey-print-report h2{font-size:13px;margin:4px 0 10px;text-align:center;font-weight:400}
  body.survey-printing .survey-print-report .meta{display:flex;justify-content:space-between;gap:12px;margin:8px 0 10px;font-size:10px}
  body.survey-printing .survey-print-report .summary{display:grid;grid-template-columns:repeat(4,1fr);gap:6px;margin:8px 0 12px}
  body.survey-printing .survey-print-report .summary div{border:1px solid #bbb;border-radius:6px;padding:6px 8px}
  body.survey-printing .survey-print-report .summary b{font-size:14px;display:block;margin-top:2px}
  body.survey-printing .survey-print-report table{width:100%;border-collapse:collapse;table-layout:fixed}
  body.survey-printing .survey-print-report th,body.survey-printing .survey-print-report td{border:1px solid #999;padding:4px;vertical-align:top;overflow-wrap:anywhere}
  body.survey-printing .survey-print-report th{background:#eef3f8 !important;text-align:center;font-weight:700}
  body.survey-printing .survey-print-report .c{text-align:center}
  body.survey-printing .survey-print-report .sub{font-size:8px;color:#444;margin-top:2px}
  body.survey-printing .survey-print-report .photos{display:flex;gap:3px;flex-wrap:wrap}
  body.survey-printing .survey-print-report .photos img{width:34px;height:30px;object-fit:cover;border:1px solid #aaa;border-radius:3px}
  body.survey-printing .survey-print-report th:nth-child(1){width:3%}
  body.survey-printing .survey-print-report th:nth-child(2){width:7%}
  body.survey-printing .survey-print-report th:nth-child(3){width:15%}
  body.survey-printing .survey-print-report th:nth-child(4){width:7%}
  body.survey-printing .survey-print-report th:nth-child(5){width:8%}
  body.survey-printing .survey-print-report th:nth-child(6){width:8%}
  body.survey-printing .survey-print-report th:nth-child(7){width:6%}
  body.survey-printing .survey-print-report th:nth-child(8){width:10%}
  body.survey-printing .survey-print-report th:nth-child(9){width:10%}
  body.survey-printing .survey-print-report th:nth-child(10){width:9%}
  body.survey-printing .survey-print-report th:nth-child(11){width:9%}
  body.survey-printing .survey-print-report th:nth-child(12){width:8%}
  body.survey-printing .survey-print-report tr{break-inside:avoid;page-break-inside:avoid}
  body.survey-printing .survey-print-report thead{display:table-header-group}
  body.survey-printing .survey-print-report .sign{display:flex;justify-content:flex-end;margin-top:24px}
  body.survey-printing .survey-print-report .sign div{width:260px;text-align:center;line-height:1.8}
  body.survey-printing{-webkit-print-color-adjust:exact;print-color-adjust:exact}
}

/* Native hidden semantics must override grid/flex layouts on every screen. */
[hidden]{display:none!important}
/* Compact grouped sidebar: keep destinations reachable without a long menu. */
.sidebar{height:100dvh;overflow-y:auto;overscroll-behavior:contain;scrollbar-width:thin}
.sidebar .menu{gap:6px;margin:20px 0}
.sidebar .menu-group{min-width:0;border:1px solid rgba(255,255,255,.12);border-radius:12px}
.sidebar .menu-group summary{display:flex;align-items:center;justify-content:space-between;gap:8px;min-height:46px;padding:10px 12px;cursor:pointer;font-weight:600;font-size:14px;list-style:none;color:#fff;border-radius:11px;touch-action:manipulation}
.sidebar .menu-group summary::-webkit-details-marker{display:none}
.sidebar .menu-group summary::after{content:'⌄';font-size:18px;flex:none;transition:transform .15s}
.sidebar .menu-group[open] summary::after{transform:rotate(180deg)}
.sidebar .menu-group[open] summary{background:rgba(255,255,255,.07)}
.sidebar .menu-group summary:hover{background:rgba(255,255,255,.12)}
.sidebar .menu-group summary:focus-visible{outline:3px solid #93caff;outline-offset:2px}
.sidebar .menu-group-links{display:grid;gap:3px;padding:4px 6px 8px}
.sidebar .menu-group .menu-link{font-size:13px;line-height:1.5;min-height:44px;padding:10px 12px;border-radius:8px;white-space:normal;overflow-wrap:anywhere}
.sidebar .menu>.menu-link{min-height:46px;padding:10px 12px;font-size:14px}
@media(max-width:1080px){.sidebar{padding-top:62px}.sidebar .menu-group summary{min-height:48px}.sidebar .menu-group .menu-link{min-height:46px;font-size:14px}}
@media print{.sidebar{display:none!important}}
