.status.active { background: var(--success-soft); color: var(--success); }
.status.pending { background: var(--warning-soft); color: var(--warning); }
.status.locked { background: var(--danger-soft); color: var(--danger); }
.integration-mark { display: grid; width: 40px; height: 40px; place-items: center; border-radius: 10px; background: var(--primary-soft); color: var(--primary); }
.integration-mark svg { width: 19px; height: 19px; }
.sr-only { position: absolute; width: 1px; height: 1px; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; }
.progress { position: fixed; z-index: var(--z-progress); top: 0; right: 0; left: 0; height: 3px; overflow: hidden; background: color-mix(in srgb, var(--primary) 14%, transparent); }
.progress::after { display: block; width: 38%; height: 100%; border-radius: inherit; background: var(--primary); animation: progress-slide 1s ease-in-out infinite; content: ""; }
.skeleton-line { display: block; width: var(--skeleton-width, 100%); height: 11px; border-radius: 999px; background: var(--skeleton-base, #ececee); }
.skeleton-line.short { height: 8px; margin-top: 8px; }
.skeleton-line.value { height: 24px; margin: 12px 0 10px; }
.skeleton-panel, .skeleton-card { --skeleton-base: #ececee; }
.skeleton-table-head, .skeleton-table-row { display: grid; grid-template-columns: repeat(var(--skeleton-columns, 6), minmax(80px, 1fr)); gap: 18px; align-items: center; padding: 0 16px; }
.skeleton-table-head { min-height: 42px; border-bottom: 1px solid var(--line); background: #fafafa; }
.skeleton-table-row { min-height: 64px; border-bottom: 1px solid var(--line); }
.skeleton-table-row:last-child { border-bottom: 0; }
.skeleton-stats .stat { min-height: 112px; }
.skeleton-card { display: grid; align-content: start; gap: 22px; min-height: 300px; padding: 20px; }
.skeleton-chart { display: flex; height: 190px; align-items: flex-end; justify-content: space-around; gap: 18px; padding-top: 24px; }
.skeleton-chart i { width: min(34px, 10%); border-radius: 6px 6px 2px 2px; background: var(--skeleton-base); }
.skeleton-list { gap: 0; padding: 0; }
.skeleton-list > div { display: grid; gap: 8px; min-height: 64px; align-content: center; padding: 12px 16px; border-bottom: 1px solid var(--line); }
.skeleton-feed .post { min-height: 190px; }
.skeleton-line, .skeleton-chart i { background-image: linear-gradient(90deg, transparent, rgba(255,255,255,.78), transparent); background-size: 240% 100%; animation: skeleton-shimmer 1.35s ease-in-out infinite; }
@keyframes skeleton-shimmer { from { background-position: 100% 0; } to { background-position: -120% 0; } }
@keyframes progress-slide { from { transform: translateX(-110%); } to { transform: translateX(330%); } }
.modal-form { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.modal-form > label { display: grid; align-content: start; gap: 6px; color: #4e5156; font-size: 12px; font-weight: 700; }
.field-label { display: flex; min-width: 0; align-items: baseline; justify-content: space-between; gap: 8px; }
.field-label > span:first-child { min-width: 0; }
.field-label small { color: var(--muted); font-size: 11px; font-weight: 500; white-space: nowrap; }
.required-mark { margin-left: 3px; color: var(--danger); }
.modal-form input, .modal-form select, .modal-form textarea { width: 100%; min-height: 40px; padding: 8px 11px; border: 1px solid var(--line-strong); border-radius: 8px; outline: 0; background: var(--surface); }
.modal-form textarea { min-height: 96px; resize: vertical; }
.modal-form input:focus, .modal-form select:focus, .modal-form textarea:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
.modal-form label > .selection-control, .settings-form-grid label > .selection-control { width: 100%; }
.selection-trigger.placeholder { color: var(--muted); font-weight: 500; }
.settings-form-grid .selection-trigger { min-height: 44px; }
.selection-trigger:focus-visible { border-color: var(--primary); outline: 0; box-shadow: 0 0 0 3px var(--primary-soft); }
.login-form [aria-invalid="true"], .modal-form [aria-invalid="true"], .settings-form [aria-invalid="true"] { border-color: var(--danger); box-shadow: 0 0 0 3px var(--danger-soft); }
.modal-form .full-field { grid-column: 1 / -1; }
.modal-form .check { display: flex; min-height: 40px; grid-template-columns: auto 1fr; align-items: center; gap: 8px; padding: 8px 10px; border-radius: 8px; background: var(--surface-soft); }
.modal-form .check input { width: auto; min-height: auto; }
.form-alert { display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: start; gap: 9px; margin: 0 20px 16px; padding: 11px 12px; border: 1px solid color-mix(in srgb, var(--danger) 30%, var(--surface)); border-radius: 8px; background: var(--danger-soft); color: var(--danger); font-size: 12px; font-weight: 600; line-height: 1.45; }
.form-alert[hidden] { display: none; }
.form-alert > svg { width: 17px; height: 17px; margin-top: 1px; }
.modal-form > .form-alert { grid-column: 1 / -1; margin: 0; }
.modal-form footer { position: sticky; z-index: 1; bottom: -20px; display: flex; grid-column: 1 / -1; justify-content: flex-end; gap: 8px; margin: 6px -20px -20px; padding: 14px 20px 20px; border-top: 1px solid var(--line); background: #fff; }
.attention-list .empty-state { min-height: 220px; }
.feed > .empty-state { border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.settings-detail-layout { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(260px, .65fr); align-items: start; gap: 16px; }
.settings-main-panel { overflow: visible; }
.settings-detail-head { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 14px; padding: 20px; border-bottom: 1px solid var(--line); }
.settings-detail-head h3, .settings-detail-head p { margin: 0; }
.settings-detail-head h3 { font-size: 17px; }
.settings-detail-head p { margin-top: 4px; color: var(--muted); font-size: 12px; }
.settings-detail-icon { display: grid; width: 44px; height: 44px; place-items: center; border-radius: 12px; background: var(--primary-soft); color: var(--primary); }
.settings-detail-icon svg { width: 20px; height: 20px; }
.settings-form-section { padding: 22px 20px; }
.settings-form-section > h4, .settings-form-section > p { margin: 0; }
.settings-form-section > h4 { font-size: 14px; }
.settings-form-section > p { margin-top: 4px; color: var(--muted); font-size: 12px; }
.settings-form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; margin-top: 20px; }
.settings-form-grid label { display: grid; align-content: start; gap: 7px; color: #4e5156; font-size: 12px; font-weight: 700; }
.settings-form-grid label > small { color: var(--muted); font-weight: 500; }
.settings-form-grid input, .settings-form-grid select { width: 100%; min-height: 44px; padding: 9px 12px; border: 1px solid var(--line-strong); border-radius: 9px; outline: 0; background: var(--surface); }
.settings-form-grid input:focus, .settings-form-grid select:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
.settings-form-grid .full-field { grid-column: 1 / -1; }
.settings-form > footer { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 15px 20px; border-top: 1px solid var(--line); background: var(--surface-soft); }
.settings-form > footer > span { color: var(--muted); font-size: 11px; }
.settings-aside { display: grid; gap: 16px; }
.settings-help-list { display: grid; }
.settings-help-list > div { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 10px; padding: 14px 16px; border-bottom: 1px solid var(--line); }
.settings-help-list > div:last-child { border-bottom: 0; }
.settings-help-list > div > span { display: grid; width: 24px; height: 24px; place-items: center; border-radius: 50%; background: var(--success-soft); color: var(--success); }
.settings-help-list svg { width: 13px; height: 13px; }
.settings-help-list p, .settings-help-list strong, .settings-help-list small { display: block; margin: 0; }
.settings-help-list small { margin-top: 3px; color: var(--muted); line-height: 1.45; }
.settings-account-bar, .settings-account-preview { display: flex; align-items: center; gap: 12px; }
.settings-account-bar { padding: 18px 20px; border-bottom: 1px solid var(--line); }
.settings-account-bar strong, .settings-account-bar small, .settings-account-preview strong, .settings-account-preview small { display: block; }
.settings-account-bar small, .settings-account-preview small { margin-top: 3px; color: var(--muted); }
.settings-connect-body { display: grid; justify-items: start; gap: 18px; padding: 22px 20px; }
.settings-connect-body > p { max-width: 64ch; margin: 0; color: var(--muted); line-height: 1.55; }
.settings-connect-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.settings-zalo-qr { display: grid; grid-template-columns: 156px minmax(0, 1fr); align-items: center; gap: 18px; padding: 14px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface-soft); }
.settings-zalo-qr img { display: block; width: 156px; height: 156px; border-radius: 8px; background: #fff; object-fit: contain; }
.settings-zalo-qr strong, .settings-zalo-qr small { display: block; }
.settings-zalo-qr small { max-width: 34ch; margin-top: 5px; color: var(--muted); line-height: 1.45; }

@media (max-width: 640px) {
  .modal-form { grid-template-columns: 1fr; }
  .modal-form > * { grid-column: 1 !important; }
  .modal-form input, .modal-form select, .modal-form textarea, .modal-form .selection-trigger, .modal-form .check { min-height: 44px; }
  .modal-header .icon-button { width: 44px; height: 44px; }
  .settings-detail-layout, .settings-form-grid { grid-template-columns: 1fr; }
  .settings-form-grid > * { grid-column: 1 !important; }
  .settings-detail-head { grid-template-columns: auto minmax(0, 1fr); }
  .settings-detail-head .status { grid-column: 2; justify-self: start; }
  .settings-form > footer { align-items: stretch; flex-direction: column; }
  .settings-zalo-qr { grid-template-columns: 1fr; justify-items: center; text-align: center; }
  .skeleton-table-head { display: none; }
  .skeleton-table-row { grid-template-columns: 1fr 1fr; min-height: 140px; padding: 16px; }
}

@media (min-width: 641px) and (max-width: 1040px) {
  .settings-detail-layout { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  .skeleton-line, .skeleton-chart i, .progress::after { animation: none; }
}

.customer-detail-link { display: block; width: 100%; padding: 0; border: 0; background: transparent; color: inherit; text-align: left; }
.customer-detail-link:hover .cell-title, .customer-detail-link:focus-visible .cell-title { color: var(--primary); }
.customer-detail-link:focus-visible { border-radius: 5px; outline-offset: 4px; }
.detail-breadcrumb { margin-bottom: 14px; }
.detail-breadcrumb button { display: inline-flex; min-height: 36px; align-items: center; gap: 7px; padding: 0; border: 0; background: transparent; color: var(--muted); font-weight: 650; }
.detail-breadcrumb button:hover { color: var(--ink); }
.detail-breadcrumb svg { width: 16px; height: 16px; transform: rotate(180deg); }
.customer-detail-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 24px; margin-bottom: 20px; }
.customer-detail-head h2, .customer-detail-head p, .customer-detail-head small { margin: 0; }
.customer-detail-head h2 { font-size: 1.55rem; line-height: 1.2; letter-spacing: -.025em; }
.customer-detail-head p { margin-top: 7px; color: var(--muted); }
.customer-detail-head > div > small { display: block; margin-top: 4px; color: var(--faint); }
.customer-title-line { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.customer-summary { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); margin-bottom: 16px; overflow: hidden; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.customer-summary > div { min-width: 0; padding: 16px 18px; border-right: 1px solid var(--line); }
.customer-summary > div:last-child { border-right: 0; }
.customer-summary span, .customer-summary strong { display: block; }
.customer-summary span { color: var(--muted); font-size: .75rem; }
.customer-summary strong { margin-top: 7px; font-size: 1.25rem; font-variant-numeric: tabular-nums; letter-spacing: -.02em; }
.customer-summary .online-value { color: var(--success); }
.range-switch { display: inline-flex; padding: 3px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface-soft); }
.range-switch button { min-height: 32px; padding: 0 11px; border: 0; border-radius: 6px; background: transparent; color: var(--muted); font-size: .75rem; font-weight: 650; }
.range-switch button.active { background: var(--surface); color: var(--ink); box-shadow: 0 1px 2px rgba(23,32,42,.08); }
.customer-device-list { display: grid; }
.customer-device-row { border-bottom: 1px solid var(--line); }
.customer-device-row:last-child { border-bottom: 0; }
.customer-device-row > summary { display: grid; min-height: 72px; grid-template-columns: minmax(220px, 1.2fr) auto 120px 190px 104px 20px; align-items: center; gap: 14px; padding: 12px 16px; cursor: pointer; list-style: none; }
.customer-device-row > summary::-webkit-details-marker { display: none; }
.customer-device-row > summary:hover { background: var(--surface-soft); }
.customer-device-row > summary > span { min-width: 0; }
.customer-device-row > summary > span > small, .device-name small { display: block; color: var(--muted); font-size: .72rem; font-weight: 500; }
.customer-device-row > summary > span > strong { display: block; margin-top: 3px; overflow: hidden; font-size: .78rem; text-overflow: ellipsis; white-space: nowrap; }
.device-name { display: flex; align-items: center; gap: 10px; }
.device-name > svg { width: 34px; height: 34px; flex: 0 0 auto; padding: 8px; border-radius: 8px; background: var(--surface-soft); color: var(--muted); }
.device-name > span { min-width: 0; }
.device-name strong { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.device-expand svg { width: 16px; height: 16px; color: var(--muted); transition: transform .15s ease; }
.customer-device-row[open] .device-expand svg { transform: rotate(90deg); }
.device-daily-detail { padding: 0 16px 16px 60px; background: var(--surface-soft); }
.device-daily-detail .table-wrap { max-height: 340px; overflow: auto; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); }
.device-license-line { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; padding: 14px 0; }
.device-license-line small, .device-license-line strong { display: block; }
.device-license-line small { color: var(--muted); font-size: .72rem; }
.device-license-line strong { margin-top: 3px; overflow-wrap: anywhere; }

.form-dialog[data-size="order"] { width: min(960px, calc(100vw - 32px)); }
.form-dialog[data-size="order"] .modal-body { padding: 0; }
.order-detail { display: grid; }
.order-detail-lead { display: flex; align-items: center; justify-content: space-between; gap: 18px; padding: 18px 20px; }
.order-detail-lead > div { display: flex; min-width: 0; flex-wrap: wrap; align-items: center; gap: 9px; }
.order-detail-lead p { margin: 0; color: var(--muted); }
.order-detail-lead > strong { flex: 0 0 auto; font-size: 1.3rem; font-variant-numeric: tabular-nums; }
.order-section { min-width: 0; padding: 18px 20px; border-top: 1px solid var(--line); }
.order-section h3 { margin: 0 0 14px; font-size: .9rem; }
.order-section-title { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.order-section-title h3 { margin-bottom: 14px; }
.order-facts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 22px; margin: 0; }
.order-facts.compact { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.order-facts div { min-width: 0; }
.order-facts dt { color: var(--muted); font-size: .72rem; }
.order-facts dd { margin: 4px 0 0; overflow-wrap: anywhere; font-weight: 650; }
.order-facts code, .issued-licenses code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .76rem; }
.order-line { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; align-items: center; gap: 22px; }
.order-line span:first-child strong, .order-line span:first-child small { display: block; }
.order-line span:first-child small { margin-top: 3px; color: var(--muted); }
.order-line > span:nth-child(2), .order-line > strong { font-variant-numeric: tabular-nums; white-space: nowrap; }
.issued-licenses { display: grid; grid-template-columns: 130px minmax(0, 1fr); gap: 12px; margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--line); }
.issued-licenses > span { color: var(--muted); font-size: .75rem; }
.issued-licenses p { display: flex; flex-wrap: wrap; gap: 7px; margin: 0; }
.issued-licenses code { padding: 4px 7px; border-radius: 5px; background: var(--surface-soft); }
.order-bottom-grid { display: grid; grid-template-columns: minmax(0, 1fr) 320px; border-top: 1px solid var(--line); }
.order-bottom-grid .order-section { border-top: 0; }
.order-bottom-grid .order-section + .order-section { border-left: 1px solid var(--line); }
.order-totals > div { display: flex; justify-content: space-between; gap: 20px; padding: 5px 0; }
.order-totals span { color: var(--muted); }
.order-totals strong { font-variant-numeric: tabular-nums; }
.order-totals .total { margin-top: 7px; padding-top: 12px; border-top: 1px solid var(--line); color: var(--ink); font-size: 1rem; }
.order-totals .total span { color: var(--ink); font-weight: 700; }
.order-totals .total strong { color: var(--primary); }
.order-detail-actions { position: sticky; bottom: 0; display: flex; justify-content: flex-end; gap: 8px; padding: 14px 20px; border-top: 1px solid var(--line); background: var(--surface); box-shadow: 0 -5px 14px rgba(23,32,42,.04); }
.order-detail-loading { display: grid; gap: 18px; min-height: 360px; align-content: start; padding: 28px 20px; }
.order-detail-error { display: grid; min-height: 320px; place-content: center; justify-items: center; padding: 32px; text-align: center; }
.order-detail-error > svg { width: 32px; height: 32px; color: var(--danger); }
.order-detail-error h3 { margin: 12px 0 0; }
.order-detail-error p { max-width: 48ch; margin: 6px 0 18px; color: var(--muted); }
.dialog-inline-alert { margin: 16px 20px 0; padding: 10px 12px; border: 1px solid #f2c0c0; border-radius: 8px; background: var(--danger-soft); color: var(--danger); font-weight: 650; }

@media (max-width: 1080px) {
  .customer-device-row > summary { grid-template-columns: minmax(220px, 1fr) auto 110px 170px 20px; }
  .customer-device-row > summary > span:nth-child(5) { display: none; }
  .order-facts.compact { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 760px) {
  .customer-detail-head { flex-direction: column; gap: 14px; }
  .customer-detail-head .button { width: 100%; }
  .customer-summary { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .customer-summary > div:nth-child(2) { border-right: 0; }
  .customer-summary > div:nth-child(-n+2) { border-bottom: 1px solid var(--line); }
  .customer-device-panel .panel-header { align-items: stretch; flex-direction: column; }
  .range-switch { align-self: flex-start; }
  .customer-device-row > summary { grid-template-columns: minmax(0, 1fr) auto 20px; gap: 10px; }
  .customer-device-row > summary > span:nth-child(3), .customer-device-row > summary > span:nth-child(4), .customer-device-row > summary > span:nth-child(5) { display: none; }
  .device-daily-detail { padding-left: 16px; }
  .device-license-line { grid-template-columns: 1fr; gap: 10px; }
  .order-detail-lead { align-items: flex-start; flex-direction: column; }
  .order-facts, .order-facts.compact { grid-template-columns: 1fr 1fr; }
  .order-line { grid-template-columns: 1fr auto; }
  .order-line > strong { grid-column: 2; }
  .order-line > span:nth-child(2) { display: none; }
  .issued-licenses { grid-template-columns: 1fr; }
  .order-bottom-grid { grid-template-columns: 1fr; border-top: 0; }
  .order-bottom-grid .order-section { border-top: 1px solid var(--line); }
  .order-bottom-grid .order-section + .order-section { border-left: 0; }
}

@media (max-width: 480px) {
  .customer-summary > div { padding: 14px; }
  .customer-summary strong { font-size: 1.05rem; }
  .order-facts, .order-facts.compact { grid-template-columns: 1fr; }
  .order-detail-actions { align-items: stretch; flex-direction: column-reverse; padding-bottom: max(14px, env(safe-area-inset-bottom)); }
  .order-detail-actions .button { width: 100%; }
}
