
:root {
  --primary: #2563eb;
  --primary-soft: rgba(37, 99, 235, .2);
  --success: #16a34a;
  --warning: #f59e0b;
  --danger: #dc2626;
  --info: #0891b2;
  --bg: #0f172a;
  --bg-2: #111827;
  --surface: #1e293b;
  --surface-strong: rgba(15, 23, 42, .92);
  --surface-soft: rgba(30, 41, 59, .75);
  --text-primary: #f8fafc;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  --border: rgba(148, 163, 184, .2);
  --shadow: 0 24px 80px rgba(2, 6, 23, .35);
  --radius: 16px;
  --radius-sm: 8px;
  --sidebar-width: 280px;
  --topbar-height: 72px;
  --statusbar-height: 34px;
  color-scheme: dark;
}

body[data-theme="light"] {
  --bg: #f8fafc;
  --bg-2: #eef2f7;
  --surface: #ffffff;
  --surface-strong: rgba(255, 255, 255, .94);
  --surface-soft: rgba(255, 255, 255, .78);
  --text-primary: #0f172a;
  --text-secondary: #475569;
  --text-muted: #64748b;
  --border: rgba(15, 23, 42, .14);
  --shadow: 0 22px 70px rgba(15, 23, 42, .16);
  color-scheme: light;
}


* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
  margin: 0;
  font-family: Inter, "Sarabun", "Noto Sans Thai", ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg);
  color: var(--text-primary);
  letter-spacing: 0;
  line-height: 1.6;
}

body {
  overflow: hidden;
}

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

button {
  border: 0;
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
  opacity: .58;
}

.app-shell {
  display: grid;
  grid-template-columns: var(--sidebar-width) minmax(0, 1fr);
  grid-template-rows: var(--topbar-height) minmax(0, 1fr) var(--statusbar-height);
  height: 100vh;
  background:
    linear-gradient(180deg, rgba(8, 145, 178, .14), transparent 38%),
    linear-gradient(135deg, rgba(37, 99, 235, .12), transparent 48%),
    var(--bg);
}

.sidebar {
  grid-row: 1 / 4;
  display: flex;
  flex-direction: column;
  gap: 18px;
  padding: 20px 14px;
  border-right: 1px solid var(--border);
  background: var(--surface-strong);
  backdrop-filter: blur(18px);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 10px;
  min-height: 44px;
}

.brand-mark {
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  border-radius: 12px;
  overflow: hidden;
  background: #fff;
  box-shadow: 0 12px 34px rgba(37, 99, 235, .18);
}

.brand-logo {
  width: 100%;
  height: 100%;
  object-fit: contain;
  padding: 5px;
}

.brand h1 {
  margin: 0;
  font-size: 16px;
  font-weight: 750;
}

.brand span {
  display: block;
  margin-top: 2px;
  color: var(--text-secondary);
  font-size: 12px;
}

.nav {
  display: flex;
  flex-direction: column;
  gap: 4px;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 0 8px 20px 8px;
}

/* Slim scrollbar for sidebar */
.nav::-webkit-scrollbar {
  width: 4px;
}
.nav::-webkit-scrollbar-track {
  background: transparent;
}
.nav::-webkit-scrollbar-thumb {
  background: transparent;
  border-radius: 4px;
}
.nav:hover::-webkit-scrollbar-thumb {
  background: var(--border);
}

.nav-group-label {
  margin: 24px 14px 6px;
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.nav-btn {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-height: 42px;
  padding: 10px 14px;
  border-radius: 999px;
  color: var(--text-secondary);
  background: transparent;
  text-align: left;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.nav-btn:hover {
  color: var(--text-primary);
  background: rgba(148, 163, 184, .08);
}

.nav-btn.active {
  color: var(--primary);
  background: var(--primary-soft);
  font-weight: 500;
  box-shadow: none;
}

.topbar {
  grid-column: 2;
  display: grid;
  grid-template-columns: minmax(260px, 1fr) auto;
  align-items: center;
  gap: 16px;
  padding: 14px 22px;
  border-bottom: 1px solid var(--border);
  background: rgba(15, 23, 42, .62);
  backdrop-filter: blur(18px);
}

body[data-theme="light"] .topbar {
  background: rgba(255, 255, 255, .78);
}

.search-box {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  padding: 0 14px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface-soft);
}

.search-box input {
  width: 100%;
  border: 0;
  outline: 0;
  color: var(--text-primary);
  background: transparent;
}

.top-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}

.icon-btn,
.primary-btn,
.ghost-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 40px;
  border-radius: var(--radius-sm);
}

.icon-btn {
  position: relative;
  width: 40px;
  color: var(--text-secondary);
  border: 1px solid var(--border);
  background: var(--surface-soft);
}

.notification-badge {
  position: absolute;
  top: -5px;
  right: -5px;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 999px;
  color: #fff;
  font-size: 11px;
  font-weight: 800;
  line-height: 18px;
  background: #dc2626;
  box-shadow: 0 0 0 2px var(--surface);
}

.notification-badge.is-hidden {
  display: none;
}

.notification-panel {
  position: fixed;
  top: 72px;
  right: 24px;
  z-index: 40;
  width: min(420px, calc(100vw - 32px));
  max-height: calc(100vh - 120px);
  overflow: auto;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-lg);
}

.notification-panel.is-hidden {
  display: none;
}

.notification-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
}

.notification-panel-header strong,
.notification-panel-header span {
  display: block;
}

.notification-panel-header span {
  margin-top: 2px;
  color: var(--text-secondary);
  font-size: 12px;
}

.notification-list {
  display: grid;
  gap: 8px;
  padding-top: 10px;
}

.notification-item {
  display: grid;
  gap: 6px;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: rgba(15, 23, 42, .18);
}

body[data-theme="light"] .notification-item {
  background: rgba(255, 255, 255, .86);
}

.notification-item.is-unread {
  border-color: rgba(37, 99, 235, .46);
  background: rgba(37, 99, 235, .10);
}

.notification-item strong,
.notification-item span,
.notification-item small {
  display: block;
}

.notification-item span,
.notification-item small {
  color: var(--text-secondary);
  line-height: 1.4;
}

.primary-btn {
  padding: 0 14px;
  color: #fff;
  background: var(--primary);
}

.ghost-btn {
  padding: 0 12px;
  color: var(--text-primary);
  border: 1px solid var(--border);
  background: rgba(148, 163, 184, .08);
}

.danger-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 40px;
  padding: 0 12px;
  border-radius: var(--radius-sm);
  color: #fecaca;
  border: 1px solid rgba(220, 38, 38, .28);
  background: rgba(220, 38, 38, .12);
}

body[data-theme="light"] .danger-btn {
  color: #b91c1c;
  border-color: rgba(220, 38, 38, .24);
  background: rgba(220, 38, 38, .08);
}

.table-action {
  min-height: 30px;
  padding: 0 9px;
  font-size: 12px;
  white-space: nowrap;
}

.table-subtext {
  display: block;
  margin-top: 3px;
  font-size: 12px;
}

.table-action-group {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}

.workspace {
  grid-column: 2;
  overflow: auto;
  padding: 22px;
}

.page {
  display: flex;
  flex-direction: column;
  gap: 18px;
  max-width: 1560px;
  margin: 0 auto;
}

.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.page-title h2 {
  margin: 0;
  font-size: 26px;
  line-height: 1.2;
}

.page-title p {
  margin: 6px 0 0;
  color: var(--text-secondary);
}

.grid {
  display: grid;
  gap: 14px;
}

.kpi-grid {
  grid-template-columns: repeat(6, minmax(150px, 1fr));
}

.content-grid {
  grid-template-columns: minmax(0, 2fr) minmax(320px, .9fr);
}

.card,
.panel,
.kpi-card,
.table-shell,
.drawer {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface-soft);
  box-shadow: var(--shadow);
  backdrop-filter: blur(14px);
}

.kpi-card {
  min-height: 116px;
  padding: 16px;
}

.kpi-card span {
  color: var(--text-secondary);
  font-size: 13px;
}

.kpi-card strong {
  display: block;
  margin-top: 10px;
  font-size: 28px;
}

.kpi-card small {
  display: block;
  margin-top: 8px;
  color: var(--text-muted);
}

.panel {
  padding: 16px;
}

.panel h3 {
  margin: 0 0 14px;
  font-size: 15px;
}

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

.asset-card {
  display: grid;
  gap: 12px;
}

.matrix-shell {
  max-height: min(62vh, 640px);
  overflow: auto;
  border-radius: var(--radius-md);
}

.matrix-shell th,
.matrix-shell td {
  min-width: 112px;
  text-align: center;
}

.matrix-shell td:first-child,
.matrix-shell th:first-child {
  position: sticky;
  left: 0;
  z-index: 2;
  min-width: 240px;
  max-width: 300px;
  text-align: left;
  background: var(--surface-strong);
}

.matrix-shell th {
  position: sticky;
  top: 0;
  z-index: 3;
  background: var(--surface-strong);
}

.matrix-shell th:first-child {
  z-index: 4;
}

.matrix-shell th strong,
.matrix-shell th small {
  display: block;
  white-space: normal;
  line-height: 1.25;
}

.matrix-shell td:first-child strong {
  white-space: normal;
  line-height: 1.35;
}

.matrix-shell input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: var(--primary);
  cursor: pointer;
}

.matrix-shell input[type="checkbox"]:disabled {
  cursor: not-allowed;
  opacity: .72;
}

.matrix-protected-col {
  background: rgba(37, 99, 235, .08);
}

body[data-theme="light"] .matrix-protected-col {
  background: rgba(37, 99, 235, .06);
}

.matrix-lock-note {
  display: inline-flex;
  width: fit-content;
  margin-top: 4px;
  padding: 2px 6px;
  border-radius: 999px;
  color: var(--text-muted);
  border: 1px solid var(--border);
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.field,
.select {
  min-height: 40px;
  padding: 0 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  background: rgba(15, 23, 42, .28);
}

option {
  background: var(--surface);
  color: var(--text-primary);
}

body[data-theme="light"] .field,
body[data-theme="light"] .select {
  background: #fff;
}

body[data-theme="light"] option {
  background: #fff;
  color: #0f172a;
}

.print-layout-select {
  min-width: 246px;
  color: var(--text-primary);
  background: rgba(15, 23, 42, .34);
}

body[data-theme="light"] .print-layout-select {
  background: #fff;
}

.table-shell {
  overflow: hidden;
}

.table-shell.matrix-shell {
  overflow: auto;
}

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

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

th {
  color: var(--text-secondary);
  font-weight: 700;
}

tbody tr:hover td {
  background: rgba(148, 163, 184, .06);
}

body[data-theme="light"] tbody tr:hover td {
  background: rgba(37, 99, 235, .06);
}

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 0 9px;
  border-radius: 999px;
  color: var(--text-primary);
  background: rgba(148, 163, 184, .14);
  border: 1px solid transparent;
  font-size: 12px;
  font-weight: 700;
}

.badge.success { background: rgba(22, 163, 74, .22); color: #bbf7d0; }
.badge.warning { background: rgba(245, 158, 11, .22); color: #fde68a; }
.badge.danger { background: rgba(220, 38, 38, .22); color: #fecaca; }
.badge.info { background: rgba(8, 145, 178, .24); color: #a5f3fc; }

body[data-theme="light"] .badge {
  color: #0f172a;
  background: rgba(148, 163, 184, .16);
}

body[data-theme="light"] .badge.success {
  color: #166534;
  background: rgba(22, 163, 74, .14);
  border-color: rgba(22, 163, 74, .18);
}

body[data-theme="light"] .badge.warning {
  color: #92400e;
  background: rgba(245, 158, 11, .16);
  border-color: rgba(245, 158, 11, .2);
}

body[data-theme="light"] .badge.danger {
  color: #b91c1c;
  background: rgba(220, 38, 38, .14);
  border-color: rgba(220, 38, 38, .18);
}

body[data-theme="light"] .badge.info {
  color: #155e75;
  background: rgba(8, 145, 178, .14);
  border-color: rgba(8, 145, 178, .18);
}

.chart-list,
.timeline,
.alert-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.bar-row {
  display: grid;
  grid-template-columns: minmax(120px, .8fr) minmax(0, 1.5fr) 48px;
  align-items: center;
  gap: 10px;
  color: var(--text-secondary);
  font-size: 13px;
}

.bar-track {
  height: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(148, 163, 184, .16);
}

.bar-fill {
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--primary), var(--info));
}

.timeline-item,
.alert-item {
  display: grid;
  gap: 4px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: rgba(15, 23, 42, .22);
}

body[data-theme="light"] .timeline-item,
body[data-theme="light"] .alert-item {
  background: rgba(255, 255, 255, .86);
}

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

.signal-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: rgba(15, 23, 42, .22);
}

body[data-theme="light"] .signal-row {
  background: rgba(255, 255, 255, .86);
}

.signal-row strong,
.signal-row small {
  display: block;
}

.signal-row small {
  margin-top: 4px;
  color: var(--text-secondary);
  line-height: 1.35;
}

.qr-passport {
  display: grid;
  justify-items: start;
  gap: 10px;
}

.qr-passport img {
  width: min(180px, 100%);
  aspect-ratio: 1;
  border-radius: var(--radius-sm);
  background: #fff;
}

.qr-detail-list {
  display: grid;
  gap: 8px;
  width: min(420px, 100%);
}

.qr-detail-list div {
  display: grid;
  grid-template-columns: 120px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-soft);
}

.qr-detail-list span {
  color: var(--text-secondary);
  font-size: 12px;
}

.qr-detail-list strong {
  min-width: 0;
  overflow-wrap: anywhere;
  font-size: 13px;
}

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

.status-bar {
  grid-column: 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  padding: 0 22px;
  border-top: 1px solid var(--border);
  color: var(--text-muted);
  background: var(--surface-strong);
  font-size: 12px;
}

.status-copy {
  color: var(--text-secondary);
}

.login-footer {
  width: min(1120px, 100%);
  margin: 0 auto;
  padding: 10px 2px 0;
  color: var(--text-secondary);
  font-size: 12px;
  text-align: center;
}

body[data-theme="light"] .login-footer {
  color: var(--text-muted);
}

.login-view {
  position: relative;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  overflow: hidden;
  padding: 8px;
  background: linear-gradient(180deg, #06101d 0%, #081525 100%);
}

.login-view::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(circle at 74% 34%, rgba(14, 165, 233, .12) 0, rgba(14, 165, 233, .12) 1px, transparent 1px),
    radial-gradient(circle at 26% 20%, rgba(255, 255, 255, .05) 0, rgba(255, 255, 255, .05) 1px, transparent 1px);
  background-size: 100% 100%, 100% 100%;
  opacity: .45;
}

.login-view::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(circle at 14% 18%, rgba(14, 165, 233, .12), transparent 34%);
}

.login-stage {
  position: relative;
  z-index: 1;
  flex: 1;
  display: grid;
  place-items: stretch;
}

.login-showcase {
  position: relative;
  display: grid;
  width: 100%;
  min-height: calc(100vh - 16px);
  grid-template-columns: minmax(0, 1.12fr) minmax(420px, .88fr);
  gap: 0;
  align-items: stretch;
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 28px 90px rgba(2, 6, 23, .38);
}

.login-showcase-copy {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 46px 48px 34px;
  background:
    conic-gradient(from 180deg at 50% 50%, rgba(46, 170, 220, 0) 0deg, rgba(46, 170, 220, 0.03) 180deg, rgba(46, 170, 220, 0.15) 360deg),
    linear-gradient(180deg, #071a34 0%, #0a2a4d 52%, #0d637b 100%);
  border-right: 1px solid rgba(255, 255, 255, .06);
  backdrop-filter: blur(18px);
  overflow: hidden;
  color: #fff;
}

@keyframes radar-sweep {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

.login-showcase-copy::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(90deg, transparent 49.8%, rgba(255, 255, 255, .04) 49.8%, rgba(255, 255, 255, .04) 50.2%, transparent 50.2%),
    linear-gradient(0deg, transparent 49.8%, rgba(255, 255, 255, .04) 49.8%, rgba(255, 255, 255, .04) 50.2%, transparent 50.2%),
    radial-gradient(circle at 50% 50%, transparent 15%, rgba(255, 255, 255, .08) 15.2%, transparent 15.4%),
    radial-gradient(circle at 50% 50%, transparent 30%, rgba(255, 255, 255, .06) 30.2%, transparent 30.4%),
    radial-gradient(circle at 50% 50%, transparent 45%, rgba(255, 255, 255, .05) 45.2%, transparent 45.4%),
    radial-gradient(circle at 50% 50%, transparent 60%, rgba(46, 170, 220, .1) 60.2%, transparent 60.4%),
    radial-gradient(circle at 50% 50%, transparent 75%, rgba(46, 170, 220, .05) 75.2%, transparent 75.4%);
}

.login-showcase-copy::after {
  content: "";
  position: absolute;
  top: -50%;
  left: -50%;
  right: -50%;
  bottom: -50%;
  pointer-events: none;
  background: conic-gradient(from 0deg at 50% 50%, rgba(0, 0, 0, 0) 0deg, rgba(0, 0, 0, 0.4) 60deg, rgba(0, 0, 0, 0) 120deg, rgba(0, 0, 0, 0) 180deg, rgba(0, 0, 0, 0.4) 240deg, rgba(0, 0, 0, 0) 300deg);
  animation: radar-sweep 16s linear infinite;
}

.login-hero-panel {
  color: #fff;
}

.login-mark-chip {
  position: relative;
  z-index: 1;
  display: grid;
  place-items: center;
  width: 58px;
  height: 58px;
  border-radius: 18px;
  color: #fff;
  font-size: 22px;
  font-weight: 800;
  background: linear-gradient(180deg, #13b4e8 0%, #2b6ef3 100%);
  box-shadow: 0 18px 30px rgba(26, 126, 255, .28);
}

.login-hero-copy {
  position: relative;
  z-index: 1;
  max-width: 900px;
  margin: auto 0;
}

.login-eyebrow {
  display: block;
  color: #35dbff;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .12em;
  text-transform: uppercase;
}

.login-hero-copy h1 {
  margin: 16px 0 14px;
  max-width: 900px;
  color: #fff;
  font-size: 64px;
  line-height: 1.02;
  font-weight: 700;
  letter-spacing: 0;
}

.login-hero-copy p {
  margin: 0;
  max-width: 640px;
  color: rgba(255, 255, 255, .88);
  font-size: 16px;
  line-height: 1.55;
}

.login-hero-footnote {
  position: relative;
  z-index: 1;
  color: rgba(226, 232, 240, .88);
  font-size: 12px;
}

.login-feature-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-top: 32px;
}

.login-feature-item {
  display: flex;
  align-items: center;
  gap: 12px;
  color: rgba(255, 255, 255, 0.9);
  font-size: 15px;
  font-weight: 500;
}

.login-feature-item i {
  color: #35dbff;
  width: 20px;
  height: 20px;
}

.login-auth-panel {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 36px 44px 24px;
  background: #fff;
  color: #0f172a;
}

body[data-theme="light"] .login-auth-panel,
body[data-theme="dark"] .login-auth-panel {
  background: #fff;
}

.login-auth-shell {
  width: min(100%, 520px);
  margin: 0 auto;
  display: grid;
  gap: 20px;
  align-content: start;
}

.login-brand-lockup {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 92px;
}

.login-bsa-logo {
  width: min(220px, 100%);
  height: auto;
  display: block;
  color: transparent;
  font-size: 0;
}

.login-bsa-fallback {
  display: none;
  color: #2563eb;
  font-size: 82px;
  font-style: italic;
  font-weight: 900;
  letter-spacing: -.08em;
  line-height: .9;
}

.login-brand-lockup.logo-failed .login-bsa-fallback {
  display: block;
}

.login-auth-header {
  display: grid;
  gap: 6px;
  margin: 0;
}

.login-auth-header span {
  color: #2563eb;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .12em;
  text-transform: uppercase;
}

.login-auth-header h2 {
  margin: 0;
  font-size: 36px;
  line-height: 1.06;
  font-family: "Segoe UI", "Noto Sans Thai", Inter, sans-serif;
  font-weight: 700;
  letter-spacing: 0;
}

.login-auth-header p {
  margin: 0;
  color: #64748b;
  font-size: 15px;
  line-height: 1.5;
}

.login-form {
  gap: 14px;
}

.login-form label {
  color: #0f172a;
  font-size: 14px;
  font-weight: 700;
}

.login-form .field {
  min-height: 54px;
  border-color: #d7e2f0;
  border-radius: 14px;
  color: #0f172a;
  background: #fff;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .7);
}

.login-form .field::placeholder {
  color: #94a3b8;
}

.login-submit {
  min-height: 58px;
  border-radius: 14px;
  font-size: 16px;
  box-shadow: 0 18px 34px rgba(37, 99, 235, .24);
}

.login-auth-hints {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 12px;
}

.login-auth-hints span {
  color: #94a3b8;
  font-size: 11px;
}

.login-panel-footer {
  display: grid;
  gap: 10px;
  margin-top: auto;
  padding-top: 18px;
  border-top: 0;
  color: #94a3b8;
  font-size: 12px;
  text-align: center;
}

.login-policy-links {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px 16px;
  line-height: 1.35;
}

.login-policy-links a {
  color: #b0b8c8;
  text-decoration: none;
}

.login-policy-links a:hover {
  color: #2563eb;
}

.login-panel-footer span {
  color: #64748b;
  font-size: 11px;
}

.login-brand-premium,
.login-card-header {
  display: flex;
  align-items: center;
  gap: 14px;
}

.login-brand-premium span,
.login-card-header span,
.login-headline span {
  display: block;
  color: var(--text-secondary);
  font-size: 12px;
}

.login-brand-premium strong {
  display: block;
  margin-top: 4px;
  font-size: 18px;
}

.login-headline {
  max-width: 560px;
}

.login-headline h1 {
  margin: 10px 0 12px;
  font-size: 54px;
  line-height: 1;
}

.login-headline p {
  margin: 0;
  max-width: 500px;
  color: var(--text-secondary);
  font-size: 16px;
  line-height: 1.55;
}

.login-signal-grid,
.login-hero-signal-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.login-signal-grid div,
.login-hero-signal-grid div {
  min-height: 74px;
  padding: 12px 13px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, .05), transparent),
    rgba(148, 163, 184, .10);
}

.login-signal-grid span,
.login-hero-signal-grid span {
  display: block;
  color: var(--text-secondary);
  font-size: 11px;
}

.login-signal-grid strong,
.login-hero-signal-grid strong {
  display: block;
  margin-top: 8px;
  font-size: 20px;
}

.login-card {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  justify-content: center;
  width: 100%;
  padding: 34px;
  border: 1px solid rgba(15, 23, 42, .06);
  border-radius: 0;
  background: #fff;
  box-shadow: none;
  backdrop-filter: blur(18px);
}

.login-system-strip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 24px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  background: rgba(148, 163, 184, .08);
  font-size: 12px;
}

.login-system-strip strong {
  color: var(--text-primary);
}

.login-card-header {
  margin-bottom: 24px;
}

.login-card-header h2 {
  margin: 2px 0 0;
  font-size: 30px;
}

.login-card .form-stack {
  margin-top: 22px;
}

.login-card .primary-btn {
  min-height: 46px;
  box-shadow: 0 14px 32px rgba(37, 99, 235, .26);
  transition: transform .18s ease, box-shadow .18s ease;
}

.login-card .primary-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 18px 38px rgba(37, 99, 235, .32);
}

.primary-btn.is-loading {
  pointer-events: none;
  opacity: 0.8;
  position: relative;
  color: transparent !important;
}

.primary-btn.is-loading > i,
.primary-btn.is-loading > span {
  visibility: hidden;
}

.primary-btn.is-loading::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: 20px;
  height: 20px;
  margin-left: -10px;
  margin-top: -10px;
  border: 2px solid rgba(255,255,255,0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.login-card .field {
  min-height: 46px;
  background: rgba(15, 23, 42, .34);
}

.login-auth-panel .login-form label {
  color: #0f172a;
  font-size: 14px;
  font-weight: 700;
}

.login-auth-panel .login-form .field {
  min-height: 54px;
  border-color: #d7e2f0;
  border-radius: 14px;
  color: #0f172a;
  background: #fff;
}

.login-auth-panel .login-form .field::placeholder {
  color: #94a3b8;
}

.login-card .field:focus {
  outline: 2px solid rgba(37, 99, 235, .35);
  border-color: rgba(37, 99, 235, .55);
}

.login-access-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 16px;
}

.login-access-tags span {
  min-height: 26px;
  padding: 5px 9px;
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--text-secondary);
  background: rgba(148, 163, 184, .10);
  font-size: 12px;
}

.login-brand-mark {
  width: 64px;
  height: 64px;
  border-radius: 18px;
  border: 1px solid rgba(148, 163, 184, .22);
  box-shadow: 0 18px 42px rgba(15, 23, 42, .14);
}

body[data-theme="light"] .login-brand-mark {
  border-color: rgba(148, 163, 184, .28);
  box-shadow: 0 16px 34px rgba(15, 23, 42, .10);
}

.form-stack {
  display: grid;
  gap: 12px;
}

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

.software-editor-panel {
  border-color: color-mix(in srgb, var(--primary) 32%, var(--border));
}

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

.software-form-main,
.software-form-section {
  display: grid;
  gap: 12px;
}

.software-form-section {
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: rgba(15, 23, 42, .14);
}

body[data-theme="light"] .software-form-section {
  background: rgba(248, 250, 252, .86);
}

.software-section-title,
.software-summary-label {
  color: var(--text-secondary);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.software-license-hint {
  margin: 0;
  color: var(--text-secondary);
  font-size: 12px;
}

.software-license-summary {
  position: sticky;
  top: 16px;
  display: grid;
  gap: 8px;
  padding: 16px;
  border: 1px solid color-mix(in srgb, var(--primary) 38%, var(--border));
  border-radius: var(--radius-sm);
  background: linear-gradient(180deg, rgba(37, 99, 235, .16), rgba(14, 165, 233, .07));
}

body[data-theme="light"] .software-license-summary {
  background: linear-gradient(180deg, rgba(37, 99, 235, .10), rgba(14, 165, 233, .05));
}

.software-license-summary strong {
  color: var(--text-primary);
  font-size: 34px;
  line-height: 1;
}

.software-license-summary small {
  color: var(--text-secondary);
}

.software-summary-metrics {
  display: grid;
  gap: 6px;
  margin-top: 8px;
  color: var(--text-secondary);
  font-size: 12px;
}

.software-summary-metrics b {
  color: var(--text-primary);
}

.asset-editor-panel {
  border-color: color-mix(in srgb, #22c55e 28%, var(--border));
}

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

.asset-form-main,
.asset-form-section {
  display: grid;
  gap: 12px;
}

.asset-form-section {
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: rgba(15, 23, 42, .14);
}

body[data-theme="light"] .asset-form-section {
  background: rgba(248, 250, 252, .88);
}

.asset-form-section.is-muted {
  opacity: .64;
}

.asset-section-title {
  color: var(--text-secondary);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.asset-form-aside {
  position: sticky;
  top: 16px;
  display: grid;
  gap: 10px;
  padding: 16px;
  border: 1px solid color-mix(in srgb, #22c55e 34%, var(--border));
  border-radius: var(--radius-sm);
  background: linear-gradient(180deg, rgba(34, 197, 94, .14), rgba(14, 165, 233, .07));
}

body[data-theme="light"] .asset-form-aside {
  background: linear-gradient(180deg, rgba(34, 197, 94, .10), rgba(14, 165, 233, .05));
}

.asset-form-aside strong {
  color: var(--text-primary);
  font-size: 24px;
  line-height: 1.1;
}

.asset-form-aside small {
  color: var(--text-secondary);
}

.asset-photo-preview {
  display: grid;
  place-items: center;
  min-height: 150px;
  overflow: hidden;
  border: 1px dashed var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  background: rgba(15, 23, 42, .18);
  text-align: center;
}

body[data-theme="light"] .asset-photo-preview {
  background: #fff;
}

.asset-photo-preview img {
  width: 100%;
  height: 180px;
  object-fit: cover;
  display: block;
}

.asset-photo-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.asset-photo-actions .is-hidden {
  display: none;
}

.asset-photo-status {
  color: var(--text-secondary);
  font-size: 12px;
  line-height: 1.45;
}

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

.asset-detail-metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.asset-detail-metric {
  display: grid;
  gap: 4px;
  min-height: 84px;
  padding: 12px 13px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: rgba(148, 163, 184, .08);
}

.asset-detail-metric span {
  color: var(--text-secondary);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
}

.asset-detail-metric strong {
  color: var(--text-primary);
  font-size: 18px;
  line-height: 1.15;
}

.asset-detail-metric small {
  color: var(--text-secondary);
  font-size: 12px;
}

.asset-detail-tabs-panel {
  padding-top: 10px;
  padding-bottom: 10px;
}

.asset-detail-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.tab-btn {
  min-height: 36px;
  padding: 0 14px;
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--text-secondary);
  background: rgba(148, 163, 184, .08);
}

.tab-btn.active {
  color: #fff;
  background: var(--primary);
  border-color: transparent;
}

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

.asset-detail-tab-panel {
  display: grid;
  gap: 14px;
}

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

.asset-detail-block {
  display: grid;
  gap: 10px;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: rgba(15, 23, 42, .14);
}

body[data-theme="light"] .asset-detail-block {
  background: rgba(248, 250, 252, .88);
}

.asset-detail-block--wide {
  grid-column: 1 / -1;
}

.asset-detail-block h3 {
  margin: 0;
  color: var(--text-primary);
  font-size: 14px;
  font-weight: 700;
}

.text-area {
  min-height: 80px;
  padding-top: 10px;
  resize: vertical;
}

.form-action-align {
  align-items: end;
  padding-top: 22px;
}

.policy-condition-grid {
  grid-template-columns: minmax(0, 1fr) minmax(180px, .7fr) minmax(0, 1fr);
}

.policy-editor-grid {
  margin-top: 16px;
}

.checkbox-row {
  display: inline-flex !important;
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 8px !important;
}

.checkbox-row input {
  width: 16px;
  height: 16px;
  accent-color: var(--primary);
}

.form-stack label {
  display: grid;
  gap: 6px;
  color: var(--text-secondary);
  font-size: 13px;
}

.audit-scan-grid {
  grid-template-columns: minmax(0, 1.2fr) minmax(320px, .8fr);
}

.audit-scan-actions {
  margin: 14px 0;
}

.audit-image-capture {
  position: relative;
  overflow: hidden;
  cursor: pointer;
}

.audit-image-input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
}

.audit-camera-shell {
  position: relative;
  overflow: hidden;
  min-height: 240px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: #020617;
}

.audit-camera-video {
  width: 100%;
  height: 100%;
  min-height: 240px;
  object-fit: cover;
  display: block;
}

.audit-camera-overlay {
  position: absolute;
  inset: auto 12px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  border-radius: calc(var(--radius-sm) - 2px);
  color: #fff;
  background: rgba(15, 23, 42, .72);
  backdrop-filter: blur(10px);
}

.audit-camera-overlay strong {
  font-size: 13px;
  font-weight: 700;
}

.audit-camera-overlay .badge {
  flex: 0 0 auto;
}

.audit-camera-overlay .badge.info {
  color: #dbeafe;
  border-color: rgba(96, 165, 250, .3);
  background: rgba(30, 64, 175, .22);
}

.audit-payload-field {
  min-height: 92px;
  padding-top: 10px;
  resize: vertical;
}

.qr-payload-preview {
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-soft);
}

body[data-theme="light"] .qr-payload-preview {
  background: rgba(255, 255, 255, .88);
}

.toast-root {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 40;
  display: grid;
  gap: 10px;
}

.toast {
  width: min(360px, calc(100vw - 40px));
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-strong);
  box-shadow: var(--shadow);
}

.modal-root {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: grid;
  place-items: center;
}

.modal-root.is-hidden {
  display: none;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(2, 6, 23, .72);
}

.modal-card {
  position: relative;
  z-index: 1;
  width: min(520px, calc(100vw - 32px));
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface-strong);
  box-shadow: var(--shadow);
  padding: 18px;
}

.modal-header h3 {
  margin: 0;
}

.modal-body {
  display: grid;
  gap: 12px;
  margin-top: 12px;
}

.modal-body p {
  margin: 0;
  color: var(--text-secondary);
}

.modal-field {
  display: grid;
  gap: 6px;
}

.modal-field span {
  color: var(--text-secondary);
  font-size: 13px;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 16px;
}

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

@media (max-width: 1100px) {
  .app-shell {
    grid-template-columns: 82px minmax(0, 1fr);
  }

  .sidebar {
    padding-inline: 10px;
  }

  .brand h1,
  .brand span,
  .nav-btn span,
  .nav-group-label {
    display: none;
  }

  .kpi-grid {
    grid-template-columns: repeat(3, minmax(150px, 1fr));
  }

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

  .audit-scan-grid,
  .policy-condition-grid,
  .form-grid {
    grid-template-columns: 1fr;
  }

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

  .software-license-summary {
    position: static;
  }

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

  .asset-form-aside {
    position: static;
  }

  .asset-detail-metrics,
  .asset-detail-grid {
    grid-template-columns: 1fr;
  }

  .asset-detail-block--wide {
    grid-column: auto;
  }
}

@media (max-width: 920px) {
  .login-showcase--split {
    grid-template-columns: 1fr;
    min-height: auto;
  }

  .login-hero-panel {
    min-height: 320px;
    padding: 28px 24px;
  }

  .login-auth-panel {
    min-height: auto;
    padding: 30px 24px 18px;
  }

  .login-hero-copy h1 {
    font-size: 46px;
  }

  .login-auth-header h2 {
    font-size: 30px;
  }
}

@media (max-width: 760px) {
  body {
    overflow: auto;
  }

  .app-shell {
    display: block;
    height: auto;
    min-height: 100vh;
  }

  .sidebar {
    position: sticky;
    top: 0;
    z-index: 10;
    flex-direction: row;
    overflow-x: auto;
    border-right: 0;
    border-bottom: 1px solid var(--border);
  }

  .topbar,
  .workspace,
  .status-bar {
    padding-inline: 14px;
  }

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

  .top-actions {
    justify-content: space-between;
  }

  .print-layout-select {
    width: 100%;
    min-width: 0;
  }

  .status-bar {
    padding-block: 10px;
  }

  .audit-camera-overlay {
    inset: auto 8px 8px;
    flex-direction: column;
    align-items: flex-start;
  }

  .login-view {
    padding: 0;
  }

  .login-showcase {
    border-radius: 0;
    min-height: 100vh;
  }

  .login-hero-panel {
    padding: 22px 16px;
  }

  .login-auth-panel {
    padding: 24px 16px 16px;
  }

  .login-card,
  .login-footer {
    width: 100%;
  }

  .login-hero-copy h1 {
    font-size: 34px;
  }

  .login-auth-header h2 {
    font-size: 28px;
  }

  .login-hero-copy p {
    font-size: 15px;
  }

  .login-policy-links {
    gap: 6px 14px;
    font-size: 11px;
  }

  .login-panel-footer span {
    font-size: 11px;
  }

  .kpi-grid {
    grid-template-columns: repeat(2, minmax(132px, 1fr));
  }
}


    @keyframes slideUpFade {
      from { opacity: 0; transform: translateY(10px); }
      to { opacity: 1; transform: translateY(0); }
    }
  
' +
      '@page{size:' + profile.pageSize + ';margin:' + profile.pageMargin + ';}*{box-sizing:border-box}html,body{margin:0;font-family:Arial,sans-serif;color:#111;background:#fff}.sheet{display:grid;grid-template-columns:repeat(' + profile.columns + ',' + profile.labelWidth + ');grid-auto-rows:' + profile.labelHeight + ';gap:' + profile.gap + ';justify-content:center;align-content:start;padding:' + profile.sheetPadding + ';break-after:page;page-break-after:always}.sheet:last-child{break-after:auto;page-break-after:auto}.label{width:' + profile.labelWidth + ';height:' + profile.labelHeight + ';border:1px solid #111;padding:2mm;display:grid;grid-template-columns:18mm 1fr;gap:2mm;overflow:hidden;break-inside:avoid;page-break-inside:avoid}.label img{width:18mm;height:18mm}.asset-id{font-size:10px;font-weight:700;line-height:1.1}.meta{font-size:7px;line-height:1.25}.muted{color:#444}.checksum{font-size:6px;word-break:break-all}@media screen{body{padding:12px;background:#f3f4f6}.sheet{margin:0 auto 12px;background:#fff;box-shadow:0 10px 30px rgba(15,23,42,.12)}}@media print{body{background:#fff}.sheet{box-shadow:none}.label{break-inside:avoid;page-break-inside:avoid}}' +
      '
