/* Breadcrumb spacing on "bare" pages (crumb sits directly in .content, no flex-gap
   wrapper). Gap-host pages nest the crumb inside .set-page/.sd-page/.bua and get
   spacing from that container's `gap`, so they are intentionally not matched here. */
.content > .pg-crumbs {
    margin-bottom: 16px;
}

/* ==========================================================================
   Site Detail (and shared detail-tab) styles.
   Global (NOT scoped) on purpose: SiteDetail + SiteAssetsTab + SiteEmployeesTab
   all consume the same table / pill / card classes, and Blazor scoped CSS does
   not cross component boundaries. Prefix: .sd-
   ========================================================================== */

/* White container card that wraps the whole detail page (gray canvas shows as margin). */
.sd-shell {
    background: #ffffff;
    border: 1px solid #E2E8F0;
    border-radius: 16px;
    box-shadow: 0 1px 3px rgba(15, 23, 42, 0.05);
    padding: 24px 28px;
}

.sd-page { display: flex; flex-direction: column; gap: 20px; }

/* ---- Breadcrumb ---- */
.sd-crumbs {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.8rem;
    color: #94A3B8;
}

.sd-crumbs a { color: #64748B; text-decoration: none; }
.sd-crumbs a:hover { color: #2563EB; text-decoration: underline; }
.sd-crumbs .sd-crumb-sep { color: #CBD5E1; }
.sd-crumbs .sd-crumb-current { color: #475569; font-weight: 600; }

/* ---- Title row ---- */
.sd-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
}

.sd-title { margin: 0; font-size: 28px; font-weight: 700; color: #0F172A; }

.sd-head__meta { display: inline-flex; align-items: center; gap: 12px; }

.sd-last-activity {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    border-radius: 999px;
    background: #ffffff;
    border: 1px solid #E2E8F0;
    font-size: 0.82rem;
    color: #475569;
    font-weight: 600;
}
.sd-last-activity .sd-dot { width: 6px; height: 6px; border-radius: 50%; background: #94A3B8; }

/* ---- Info strip (code / province / people) ---- */
.sd-info-strip {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 36px;
}

.sd-field__label {
    font-size: 0.72rem;
    color: #94A3B8;
    font-weight: 600;
    margin-bottom: 4px;
}
.sd-field__value { font-size: 0.95rem; color: #0F172A; font-weight: 600; }

.sd-people-pill {
    margin-left: auto;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    border-radius: 10px;
    background: #EEF5FF;
    border: 1px solid #BFD4FF;
    color: #2563EB;
    font-weight: 600;
    font-size: 0.9rem;
}

/* ---- Overview: map + stat cards + responsible card ---- */
.sd-overview {
    display: grid;
    grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr);
    gap: 16px;
}
@media (max-width: 900px) { .sd-overview { grid-template-columns: 1fr; } }

.sd-map {
    position: relative;
    min-height: 240px;
    border-radius: 12px;
    overflow: hidden;
    background:
        repeating-linear-gradient(45deg, #1f2937 0, #1f2937 18px, #232f3f 18px, #232f3f 36px);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #94A3B8;
    font-size: 0.85rem;
    border: 1px solid #E2E8F0;
}

.sd-overview__right { display: flex; flex-direction: column; gap: 16px; }

.sd-stats {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 12px;
}
@media (max-width: 560px) { .sd-stats { grid-template-columns: repeat(2, 1fr); } }

.sd-stat-card {
    background: #ffffff;
    border: 1px solid #E2E8F0;
    border-radius: 12px;
    box-shadow: 0 1px 3px rgba(15, 23, 42, 0.04);
    padding: 14px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    position: relative;
}
.sd-stat-card__num { font-size: 1.6rem; font-weight: 800; color: #0F172A; line-height: 1; }
.sd-stat-card__label { font-size: 0.72rem; color: #94A3B8; font-weight: 600; }
.sd-stat-card__icon {
    position: absolute;
    top: 12px;
    right: 12px;
    color: #94A3B8;
}

.sd-contact-card {
    background: #ffffff;
    border: 1px solid #E2E8F0;
    border-radius: 12px;
    box-shadow: 0 1px 3px rgba(15, 23, 42, 0.04);
    padding: 14px 16px;
}
.sd-contact-card__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 10px;
}
.sd-contact-card__title { font-size: 0.78rem; font-weight: 700; color: #0F172A; }
.sd-contact-card__line { font-size: 0.8rem; color: #64748B; margin-top: 2px; }

.sd-person {
    border: 1px solid #E2E8F0;
    border-radius: 10px;
    padding: 10px 12px;
}
.sd-person + .sd-person { margin-top: 8px; }
.sd-person--primary { background: #EFF4FF; border-color: #DBE6FF; }
.sd-person__name { font-size: 0.9rem; font-weight: 700; color: #0F172A; }
.sd-person__line { font-size: 0.8rem; color: #64748B; margin-top: 2px; }

/* ---- Card (white panel) ---- */
.sd-card {
    background: #ffffff;
    border: 1px solid #E2E8F0;
    border-radius: 12px;
    box-shadow: 0 1px 3px rgba(15, 23, 42, 0.04);
}
.sd-card__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 16px 20px;
}
.sd-card__title { margin: 0; font-size: 1.05rem; font-weight: 700; color: #0F172A; }
.sd-card__body { padding: 0 20px 20px; }

/* ---- Project info grid ---- */
.sd-infogrid {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 18px 24px;
}
@media (max-width: 900px) { .sd-infogrid { grid-template-columns: repeat(2, 1fr); } }

.sd-remark {
    margin-top: 18px;
    padding: 14px 16px;
    background: #F8FAFF;
    border: 1px solid #E6EEFB;
    border-radius: 10px;
}
.sd-remark__label { font-size: 0.72rem; color: #94A3B8; font-weight: 600; margin-bottom: 4px; }
.sd-remark__text { font-size: 0.88rem; color: #334155; line-height: 1.5; }

/* ---- Buttons ---- */
.sd-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    height: 40px;
    padding: 0 18px;
    font-size: 0.88rem;
    font-weight: 600;
    border-radius: 8px;
    border: 1px solid transparent;
    cursor: pointer;
    white-space: nowrap;
    text-decoration: none;
}
.sd-btn--ghost { background: #EEF5FF; color: #2563EB; border-color: #DBE7FF; }
.sd-btn--ghost:hover:not(:disabled) { background: #E0ECFF; }
.sd-btn--navy { background: #1E293B; color: #ffffff; }
.sd-btn--navy:hover:not(:disabled) { background: #0F172A; }
.sd-btn--link {
    height: auto;
    padding: 6px 12px;
    background: #FFF7ED;
    color: #C2410C;
    border-color: #FED7AA;
}
.sd-btn:disabled { opacity: 0.6; cursor: not-allowed; }

/* ---- Tabs ---- */
.sd-tabs {
    display: flex;
    align-items: center;
    gap: 28px;
    border-bottom: 1px solid #E2E8F0;
    padding: 0 4px;
}
.sd-tab {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 14px 4px;
    font-size: 0.95rem;
    font-weight: 600;
    color: #94A3B8;
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    cursor: pointer;
    margin-bottom: -1px;
}
.sd-tab:hover { color: #475569; }
.sd-tab--active { color: #DC2626; border-bottom-color: #DC2626; }

/* ---- Toolbar above tab content ---- */
.sd-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
}
.sd-toolbar__title { margin: 0; font-size: 1.5rem; font-weight: 700; color: #0F172A; }

.sd-filters {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 12px;
}
.sd-filter { display: flex; flex-direction: column; gap: 4px; }
.sd-filter--grow { flex: 1 1 320px; min-width: 220px; }
.sd-filter--status { flex: 0 0 220px; }
.sd-filter__label { font-size: 0.72rem; color: #94A3B8; font-weight: 600; }
.sd-input {
    height: 42px;
    padding: 0 14px;
    font-size: 0.9rem;
    color: #0F172A;
    background: #ffffff;
    border: 1px solid #CBD5E1;
    border-radius: 8px;
    outline: none;
    box-sizing: border-box;
    width: 100%;
}
.sd-input::placeholder { color: #94A3B8; }
/* readonly inputs read as non-editable (subtle grey), mirroring the vendor .vd-input[readonly] pattern */
.sd-input[readonly], .sd-input:disabled { background: #F1F5F9; color: #64748B; cursor: default; }
.sd-input--preview { color: #94A3B8; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; letter-spacing: .02em; }
.sd-input:focus { border-color: #2563EB; box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12); }
.sd-select {
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%2364748B' d='M2 4l4 4 4-4'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 32px;
}

/* ---- Detail table (navy header, red left accent) ---- */
.sd-table-card {
    background: #ffffff;
    border: 1px solid #E2E8F0;
    border-radius: 12px;
    box-shadow: 0 1px 3px rgba(15, 23, 42, 0.04);
    overflow: hidden;
}
.sd-table-card__head { padding: 18px 20px 12px; }
.sd-table-card__title { margin: 0; font-size: 1.1rem; font-weight: 700; color: #0F172A; }
.sd-table-card__count { margin-top: 2px; font-size: 0.8rem; color: #94A3B8; }

.sd-table__scroll { overflow-x: auto; }

.sd-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    font-size: 0.88rem;
}
.sd-table__empty { text-align: center; padding: 28px 16px; color: #94A3B8; }
.sd-doc-empty { display: flex; flex-direction: column; align-items: center; gap: 12px;
    padding: 40px 16px; margin: 16px 20px; border: 1px dashed #e2e8f0; border-radius: 12px;
    background: #f8fafc; }
.sd-doc-empty__icon { width: 56px; height: 56px; border-radius: 50%; background: #eef2f7;
    display: flex; align-items: center; justify-content: center; }
.sd-doc-empty__text { font-size: .875rem; color: #64748b; }
.sd-table thead th {
    background: #1E293B;
    color: #ffffff;
    font-weight: 600;
    text-align: left;
    padding: 13px 16px;
    white-space: nowrap;
}
.sd-table thead th:first-child {
    border-left: 3px solid #DC2626;
}
.sd-table tbody td {
    padding: 14px 16px;
    border-bottom: 1px solid #EEF2F7;
    color: #334155;
    vertical-align: middle;
}
.sd-table tbody tr:last-child td { border-bottom: none; }
.sd-table tbody tr:nth-child(even) { background: #F8FAFC; }   /* zebra striping */
.sd-table tbody tr:hover { background: #EEF3FB; }             /* hover wins (declared after zebra) */

.sd-col-check { width: 44px; text-align: center; }
.sd-col-check input { width: 16px; height: 16px; accent-color: #2563EB; cursor: default; }

.sd-asset-name { font-weight: 600; color: #0F172A; }
.sd-asset-sub {
    margin-top: 2px;
    font-size: 0.74rem;
    font-weight: 600;
    color: #DC2626;
    font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, monospace;
}
.sd-cell-muted { color: #64748B; }
.sd-cell-empty { color: #CBD5E1; }
.sd-cell-mono { font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, monospace; color: #475569; }

.sd-icon-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    border-radius: 7px;
    border: 1px solid #E2E8F0;
    background: #ffffff;
    cursor: pointer;
}
.sd-icon-btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* ---- Status pill ---- */
.sd-status {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 5px 12px;
    border-radius: 999px;
    font-size: 0.78rem;
    font-weight: 600;
    line-height: 1;
    white-space: nowrap;
}
.sd-status .sd-status-dot { width: 7px; height: 7px; border-radius: 50%; }

.sd-status--green  { background: #ECFDF3; color: #16A34A; }
.sd-status--green  .sd-status-dot { background: #16A34A; }
.sd-status--amber  { background: #FEF3C7; color: #B45309; }
.sd-status--amber  .sd-status-dot { background: #F59E0B; }
.sd-status--red    { background: #FEF2F2; color: #DC2626; }
.sd-status--red    .sd-status-dot { background: #DC2626; }
.sd-status--purple { background: #F5F3FF; color: #7C3AED; }
.sd-status--purple .sd-status-dot { background: #7C3AED; }
.sd-status--blue   { background: #EFF6FF; color: #2563EB; }
.sd-status--blue   .sd-status-dot { background: #2563EB; }
.sd-status--grey   { background: #F1F5F9; color: #64748B; }
.sd-status--grey   .sd-status-dot { background: #94A3B8; }

/* ---- Pager ---- */
.sd-pager {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    flex-wrap: wrap;
    padding: 16px 20px;
}
.sd-page-btn {
    min-width: 34px;
    height: 34px;
    padding: 0 8px;
    font-size: 0.85rem;
    font-weight: 600;
    color: #475569;
    background: #ffffff;
    border: 1px solid #E2E8F0;
    border-radius: 8px;
    cursor: pointer;
}
.sd-page-btn--active { background: #2563EB; border-color: #2563EB; color: #ffffff; cursor: default; }
.sd-page-btn:disabled { opacity: 0.4; cursor: not-allowed; }
.sd-page-ellipsis { padding: 0 4px; color: #94A3B8; }
.sd-pager__size {
    position: absolute;
    right: 20px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 0.85rem;
    color: #64748B;
}
@media (max-width: 720px) { .sd-pager__size { position: static; transform: none; width: 100%; text-align: center; } }

/* ---- Empty / loading state ---- */
.sd-state {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 48px 0;
    color: #94A3B8;
    font-size: 0.95rem;
}

/* ===== Employee list + status badge ===== */
.page-title { font-size: 1.25rem; font-weight: 600; margin: 0 0 1rem; color: #0f172a; }

.filter-input { flex: 1 1 180px; min-width: 160px; height: 38px; padding: 0 .75rem;
    border: 1px solid #e2e8f0; border-radius: 8px; font-size: .875rem; background: #fff; }
.filter-select { flex: 0 0 160px; }
.btn { display: inline-flex; align-items: center; gap: .4rem; height: 38px; padding: 0 1rem;
    border: none; border-radius: 8px; font-size: .875rem; font-weight: 500; cursor: pointer; text-decoration: none; }
.btn-primary { background: #1e293b; color: #fff; }
.btn-create { background: #2563eb; color: #fff; }
.btn-create:disabled { opacity: .55; cursor: default; }
.btn--danger { background: #dc2626; color: #fff; }
.btn--danger:hover { background: #b91c1c; }
.btn--danger:disabled { opacity: .55; cursor: default; }

.emp-allbus { display: inline-flex; align-items: center; gap: .4rem; font-size: .8125rem; color: #475569; cursor: pointer; }

.col-check { width: 36px; }
.col-actions { width: 96px; }
.cell-mono { font-family: ui-monospace, monospace; color: #475569; }
.cell-muted { color: #64748b; }

.action-group { display: inline-flex; gap: .25rem; }
.icon-btn { display: inline-flex; align-items: center; justify-content: center; width: 30px; height: 30px;
    border: 1px solid #e2e8f0; border-radius: 6px; background: #fff; cursor: pointer; }
.icon-btn:disabled { opacity: .5; cursor: default; }

.emp-status { display: inline-flex; align-items: center; gap: .4rem; padding: .2rem .6rem;
    border-radius: 999px; font-size: .75rem; font-weight: 500; }
.emp-status--active { background: #dcfce7; color: #15803d; }
.emp-status--inactive { background: #f1f5f9; color: #64748b; }
.emp-status-dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }

.page-btn { min-width: 32px; height: 32px; border: 1px solid #e2e8f0; border-radius: 6px;
    background: #fff; cursor: pointer; font-size: .8125rem; color: #475569; }
.page-btn--active { background: #2563eb; color: #fff; border-color: #2563eb; }
.page-btn:disabled { opacity: .5; cursor: default; }
.page-ellipsis { padding: 0 .25rem; color: #94a3b8; }

.th-sortable { display: inline-flex; align-items: center; gap: .4rem; }
.th-caret { opacity: .7; font-size: .85em; }
.col-num { text-align: left; width: 110px; }
.cell-empty { color: #cbd5e1; }
.site-code { margin-top: 2px; font-size: .72rem; color: #64748b; font-family: ui-monospace, monospace; }

.status-pill { display: inline-flex; align-items: center; gap: .4rem; padding: .2rem .6rem;
    border-radius: 999px; font-size: .75rem; font-weight: 500; white-space: nowrap; }
.status-pill--active { background: #dcfce7; color: #15803d; }
.status-pill--closed { background: #f1f5f9; color: #64748b; }
.status-pill--inactive { background: #f1f5f9; color: #64748b; }
/* customer workflow-status variants (deal lifecycle pills) */
.status-pill--green { background: #dcfce7; color: #15803d; }
.status-pill--orange { background: #fef0e9; color: #c2410c; }
.status-pill--yellow { background: #fef9c3; color: #a16207; }
.status-pill--red { background: #fee2e2; color: #b91c1c; }
.status-dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }

/* shared list chrome (PagedListTable + ListFilterBar) */
.list-filters { display: flex; gap: .5rem; flex-wrap: wrap; margin-bottom: 1rem; align-items: flex-end; }

/* labelled filter fields (label stacked above input) */
.filter-field { display: flex; flex-direction: column; gap: .35rem; flex: 1 1 180px; min-width: 160px; }
.filter-field .filter-input { flex: 1 1 auto; width: 100%; min-width: 0; }
.filter-label { font-size: .75rem; font-weight: 500; color: #64748b; }

/* non-sticky page footer actions (กลับ / บันทึก) */
.list-footer { display: flex; justify-content: center; gap: 1rem; padding: 2rem 0 1rem; }
.list-footer .btn { min-width: 160px; justify-content: center; text-decoration: none; align-items: center; }
.list-footer__back { background: #e2e8f0; color: #334155; }
.list-footer__save { background: #13284f; color: #fff; border: none; cursor: pointer; }
.list-footer__save:disabled { opacity: .6; cursor: not-allowed; }

/* customer detail — information card */
.cust-info { display: flex; gap: 24px; align-items: flex-start; }
.cust-info__photo { flex: 0 0 136px; display: flex; flex-direction: column; gap: 8px; align-items: stretch; }
.cust-photo-box { width: 136px; height: 153px; border: 1px solid #e2e8f0; border-radius: 8px;
    background: #f8fafc; display: flex; align-items: center; justify-content: center; overflow: hidden; }
.cust-photo-img { width: 100%; height: 100%; object-fit: cover; }
.cust-info__photo .sd-btn { justify-content: center; cursor: pointer; }
.cust-info__photo .sd-btn--busy { pointer-events: none; opacity: .6; }
.cust-info__fields { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 16px; }
.cust-grid { display: grid; grid-template-columns: repeat(3, 1fr) auto; gap: 16px; align-items: end; }
/* create mode: the id field carries an absolute hint below it — reserve clearance for that one row */
.cust-grid:has(.cust-field__hint) { margin-bottom: 16px; }
.cust-grid--3 { grid-template-columns: repeat(3, 1fr); }
.cust-field { display: flex; flex-direction: column; gap: 6px; min-width: 0; position: relative; }
.cust-field__label { font-size: .72rem; color: #94a3b8; font-weight: 600; }
.cust-field__hint { position: absolute; top: 100%; left: 0; margin-top: 3px; font-size: .7rem; color: #94a3b8; white-space: nowrap; }
.cust-field--status { justify-content: flex-end; padding-bottom: 9px; }
.cust-card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
@media (max-width: 900px) {
    .cust-info { flex-direction: column; }
    .cust-grid, .cust-grid--3 { grid-template-columns: 1fr; }
}

/* ---- Modal (sd namespace) ---- */
.sd-overlay { position: fixed; inset: 0; background: rgba(15, 23, 42, 0.45);
    display: flex; align-items: center; justify-content: center; z-index: 1000; padding: 24px; }
.sd-modal { background: #fff; border-radius: 14px; width: 640px; max-width: 100%;
    max-height: 90vh; display: flex; flex-direction: column; box-shadow: 0 20px 50px rgba(15, 23, 42, 0.25); }
.sd-modal__head { display: flex; align-items: center; justify-content: space-between;
    padding: 18px 22px; border-bottom: 1px solid #e2e8f0; }
.sd-modal__title { margin: 0; font-size: 1.15rem; font-weight: 700; color: #0f172a; }
.sd-modal__close { background: none; border: none; cursor: pointer; padding: 4px; line-height: 0; }
.sd-modal__body { padding: 22px; overflow-y: auto; display: flex; flex-direction: column; gap: 16px; }
.sd-modal__foot { display: flex; justify-content: center; gap: 16px;
    padding: 20px 22px 24px; }
.sd-modal__error { margin: 0; color: #b91c1c; font-size: 0.85rem; }
.sd-modal__btn { min-width: 200px; height: 52px; justify-content: center;
    border-radius: 12px; font-size: 0.95rem; font-weight: 700; }
.sd-modal__btn--grey { background: #E2E8F0; color: #334155; }
.sd-modal__btn--grey:hover:not(:disabled) { background: #CBD5E1; }
.list-card { background: #fff; border: 1px solid #e2e8f0; border-radius: 12px; overflow: hidden; }
.list-card__head { display: flex; align-items: center; justify-content: space-between; padding: 1rem 1.25rem; border-bottom: 1px solid #f1f5f9; }
.list-card__heading { font-size: 1rem; font-weight: 600; margin: 0; color: #0f172a; }
.list-card__count { color: #94a3b8; font-weight: 400; margin-left: .25rem; }
.list-card__head-actions { display: flex; align-items: center; gap: 1rem; }
.list-card__state { padding: 2.5rem; text-align: center; color: #94a3b8; }
.list-table__scroll { overflow-x: auto; }
.list-table { width: 100%; border-collapse: collapse; font-size: .8125rem; }
.list-table thead th { text-align: left; padding: .75rem 1rem; background: #1e293b; color: #e2e8f0; font-weight: 500; white-space: nowrap; }
.list-table thead th:first-child { border-left: 3px solid #dc2626; }
.list-table tbody td { padding: .75rem 1rem; border-bottom: 1px solid #f1f5f9; color: #334155; vertical-align: middle; }
/* Zebra striping: alternate row background for readability (matches the design). Declared BEFORE
   .row--busy so the delete-in-flight gray still wins on even rows. */
.list-table td.list-table__empty { text-align: center; color: #94a3b8; padding: 2rem; }
.list-table tbody tr:nth-child(even) { background: #f8fafc; }
/* Empty-state row is not a data row: no zebra, no hover highlight. */
.list-table tbody tr.list-table__emptyrow,
.list-table tbody tr.list-table__emptyrow:hover { background: transparent; }
.list-table tbody tr:hover { background: #f1f5f9; }
/* Row with an operation (delete) in flight: dim it and block all clicks (links, buttons, checkbox). */
.list-table tbody tr.row--busy { opacity: .45; pointer-events: none; background: #f8fafc; }
.list-name { color: #2563eb; text-decoration: none; font-weight: 500; }
.list-name:hover { text-decoration: underline; }
.list-pager { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; padding: .75rem 1.25rem; }
.list-pager__size { justify-self: end; }
.list-pager__size .filter-input { width: auto; min-width: 130px; }
.list-pager__pages { grid-column: 2; display: flex; gap: .25rem; }
.list-pager__size { grid-column: 3; justify-self: end; }
.list-pager__size .filter-input { min-width: 130px; }

/* ===== Employee detail + certificates tab ===== */
.ed-page { display: flex; flex-direction: column; gap: 1rem; }
.ed-state { padding: 3rem; text-align: center; color: #94a3b8; }

.ed-crumbs { display: flex; align-items: center; gap: .5rem; font-size: .8125rem; color: #94a3b8; }
.ed-crumbs a { color: #2563eb; text-decoration: none; }
.ed-crumb-sep { color: #cbd5e1; }
.ed-crumb-current { color: #475569; }

.ed-title { font-size: 1.25rem; font-weight: 600; margin: 0; color: #0f172a; }
.ed-emptype { align-self: center; font-size: .6875rem; font-weight: 700; letter-spacing: .04em;
    color: #fff; background: #2563eb; padding: .35rem .75rem; border-radius: 999px; white-space: nowrap; }

.ed-btn { display: inline-flex; align-items: center; gap: .4rem; height: 36px; padding: 0 1rem;
    border: none; border-radius: 8px; font-size: .8125rem; font-weight: 500; cursor: pointer; }
.ed-btn--edit { background: #2563eb; color: #fff; }
.ed-btn--add { height: 30px; padding: 0 .85rem; background: #fff; color: #2563eb;
    border: 1px dashed #93c5fd; font-weight: 600; }
.ed-btn:disabled { opacity: .55; cursor: default; }

.ed-card { background: #fff; border: 1px solid #e2e8f0; border-radius: 12px; overflow: hidden; }
.ed-card + .ed-card { margin-top: 1.25rem; }
.ed-card__head { display: flex; align-items: center; justify-content: space-between; gap: 1rem;
    padding: 1rem 1.25rem; border-bottom: 1px solid #f1f5f9; }
/* Flush variant: no head separator (drops the top/bottom rules inside the card). */
.ed-card--flush .ed-card__head { border-bottom: none; }
.ed-card__title { display: flex; align-items: center; gap: .5rem;
    font-size: 1rem; font-weight: 600; margin: 0; color: #0f172a; }

/* Personal information card — profile strip atop the field grid */
.ed-profile__strip { display: flex; align-items: center; gap: 1rem;
    padding: 1.25rem; border-bottom: 1px solid #f1f5f9; }
.ed-profile__avatar { width: 64px; height: 64px; border-radius: 50%; background: #f1f5f9;
    display: flex; align-items: center; justify-content: center; flex: 0 0 auto; }
.ed-profile__id { flex: 1 1 auto; display: flex; flex-direction: column; gap: .35rem; min-width: 0; }
.ed-profile__name-row { display: flex; align-items: baseline; gap: .6rem; flex-wrap: wrap; }
.ed-profile__empid { font-family: ui-monospace, monospace; font-size: .75rem;
    letter-spacing: .04em; color: #94a3b8; }
.ed-profile__meta { display: flex; align-items: center; gap: .4rem; flex-wrap: wrap;
    font-size: .8125rem; color: #475569; }
.ed-profile__sep { color: #cbd5e1; }
.ed-profile__contact { display: flex; gap: 1.25rem; flex-wrap: wrap;
    font-size: .8125rem; color: #64748b; }
.ed-profile__contact-item { display: inline-flex; align-items: center; gap: .35rem; }

.ed-tags { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; }
.ed-tag { font-size: .75rem; color: #1e40af; background: #eff6ff; border: 1px solid #bfdbfe;
    border-radius: 999px; padding: .25rem .75rem; }

.ed-infogrid { display: grid; grid-template-columns: repeat(3, 1fr);
    gap: 1rem 1.25rem; padding: 1.25rem; }
@media (max-width: 900px) { .ed-infogrid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 560px) { .ed-infogrid { grid-template-columns: 1fr; } }
.ed-profile__sites { display: flex; flex-direction: column; gap: .5rem;
    padding: 0 1.25rem 1.25rem; }
.ed-field__label { font-size: .75rem; color: #64748b; font-weight: 600;
    letter-spacing: .01em; margin-bottom: .35rem; }
.ed-field__value { font-size: .875rem; color: #1e293b; }
.ed-field__input { background: #fff; border: 1px solid #e2e8f0; border-radius: 8px;
    padding: .5rem .75rem; min-height: 40px; font-size: .875rem; color: #1e293b;
    display: flex; align-items: center; }
.ed-field__input--readonly { background: #f1f5f9; color: #64748b; }

/* Styled file picker (native input hidden; label acts as the button) */
.cust-file { display: flex; align-items: center; gap: .75rem; }
.cust-file .sd-btn { cursor: pointer; flex: 0 0 auto; }
.cust-file__name { font-size: .8125rem; color: #64748b; overflow: hidden;
    text-overflow: ellipsis; white-space: nowrap; }

/* Vendor detail — stacked form matching Figma (ID, Name, [Contact|Phone|Email], Address) */
.vd-form { display: flex; flex-direction: column; gap: 1rem; padding: 1.25rem; }
.vd-row3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1.25rem; }
@media (max-width: 768px) { .vd-row3 { grid-template-columns: 1fr; } }
.vd-field { display: flex; flex-direction: column; }
.vd-input { width: 100%; background: #fff; border: 1px solid #e2e8f0; border-radius: 8px;
    padding: .5rem .75rem; min-height: 40px; font-size: .875rem; color: #1e293b; box-sizing: border-box; }
.vd-input:focus { outline: none; border-color: #2563eb; box-shadow: 0 0 0 3px rgba(37, 99, 235, .12); }
.vd-input[readonly] { background: #f8fafc; color: #475569; }
.vd-input--preview { color: #94a3b8; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; letter-spacing: .02em; }
/* Auto-growing remark box: height tracks content (field-sizing where supported), no manual resize. */
.vd-textarea { resize: none; field-sizing: content; min-height: 64px; line-height: 1.4; font-family: inherit; }
.vd-charcount { margin-top: 4px; text-align: right; font-size: .75rem; color: #94a3b8; }
.vd-error { background: #fef2f2; border: 1px solid #fecaca; color: #b91c1c;
    border-radius: 8px; padding: .625rem .875rem; font-size: .875rem; }

.ed-table-card { background: #fff; border: 1px solid #e2e8f0; border-radius: 12px; overflow: hidden; }
.ed-table-card__head { display: flex; align-items: center; justify-content: space-between;
    padding: 1rem 1.25rem; border-bottom: 1px solid #f1f5f9; }
.ed-table-card__title { display: flex; align-items: center; gap: .5rem;
    font-size: 1rem; font-weight: 600; margin: 0; color: #0f172a; }
.ed-table-card__actions { display: flex; align-items: center; gap: .85rem; }
.ed-table-card__count { font-size: .8125rem; color: #94a3b8; }
.ed-btn--cert-add { height: 34px; background: #dbeafe; color: #1d4ed8; font-weight: 600; }
.ed-table__scroll { overflow-x: auto; }
.ed-table { width: 100%; border-collapse: collapse; font-size: .8125rem; }
.ed-table thead th { text-align: left; padding: .75rem 1rem; background: #1e293b; color: #e2e8f0; font-weight: 500; white-space: nowrap; }
.ed-table tbody td { padding: .75rem 1rem; border-bottom: 1px solid #f1f5f9; color: #334155; }
.ed-cell-mono { font-family: ui-monospace, monospace; color: #475569; }
.ed-cell-muted { color: #94a3b8; }
.ed-cell-danger { color: #dc2626; font-weight: 500; }
.ed-link { color: #2563eb; text-decoration: none; }
/* Sticky action bar: pins to the bottom of the scroll container (.content) when the form
   overflows. Negative margins cancel .content's 24px/32px padding so the white fill is full-bleed;
   padding restores inner spacing. The white fill/border/shadow are applied ONLY while the bar
   floats over overflowing content — sticky-actions.js toggles .is-stuck (see that file). When the
   form fits or is scrolled to the bottom, the bar is transparent and sits inline. */
/* .content is a flex column (MainLayout) so .ed-actions can bottom-align; keep page blocks at their
   natural height (no shrink) so tall pages overflow + scroll instead of squashing. */
.content > * { flex-shrink: 0; }
.ed-actions { position: sticky; bottom: -24px; z-index: 5;
    display: flex; justify-content: center; align-items: center; gap: 1rem;
    margin: 1.5rem -32px -24px; padding: 1rem 32px;
    background: transparent; border-top: 1px solid transparent;
    transition: background .15s ease, border-color .15s ease, box-shadow .15s ease; }
.ed-actions.is-stuck { background: #ffffff; border-top-color: #e2e8f0;
    box-shadow: 0 -2px 10px rgba(15, 23, 42, .06); }
.ed-actions .btn { min-width: 200px; height: 48px; justify-content: center; font-size: 1rem; }
.ed-actions .btn--back { background: #d1d5db; color: #1e293b; text-decoration: none; outline: none; }
.ed-actions .btn--back:hover { background: #c0c5cc; }
.ed-icon-btn { display: inline-flex; align-items: center; justify-content: center; width: 32px; height: 32px;
    border: none; border-radius: 50%; background: #f1f5f9; cursor: pointer; }
.ed-icon-btn--edit { background: #fef3c7; }
.ed-icon-btn--delete { background: #fee2e2; }
.ed-icon-btn:disabled { opacity: .65; cursor: default; }

.ed-badge { font-size: .6875rem; font-weight: 600; letter-spacing: .03em; padding: .2rem .55rem; border-radius: 6px; }
.ed-badge--valid { background: #dcfce7; color: #15803d; }
.ed-badge--expiring { background: #fef9c3; color: #a16207; }
.ed-badge--expired { background: #fee2e2; color: #b91c1c; }

/* ===== Order type selector ===== */
.selector-card { background: #f8fafc; border: 1px solid #e2e8f0; border-radius: 12px; padding: 2rem 2.5rem; }
.selector-card__header { display: flex; align-items: center; gap: .75rem; margin-bottom: 1.5rem; }
.selector-card__header h1 { font-size: 1.25rem; font-weight: 700; margin: 0; color: #0f172a; }
.selector-card__subtitle { margin: .15rem 0 0; font-size: .875rem; color: #64748b; }

.selector-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; margin-bottom: 2rem; }
.selector-grid .selector-option:nth-child(n+3) { /* bottom row: switch to 3-col */ }
.selector-grid--bottom { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; margin-bottom: 2rem; }

.selector-option { display: flex; flex-direction: column; gap: .5rem; padding: 1.25rem 1.5rem;
    border: 1px solid #cbd5e1; border-radius: 12px; background: #e8f0fe; cursor: pointer;
    text-align: left; transition: border-color .15s, box-shadow .15s; min-height: 100px; }
.selector-option:hover:not(:disabled) { border-color: #93c5fd; box-shadow: 0 2px 8px rgba(37,99,235,.1); }
.selector-option strong { font-size: 1rem; color: #0f172a; }
.selector-option span { font-size: .8125rem; color: #64748b; }

.selector-option--active { background: #1e293b; border-color: #1e293b; cursor: pointer; }
.selector-option--active strong { color: #fff; }
.selector-option--active span { color: #94a3b8; }
.selector-option--active:hover { border-color: #334155; }

.selector-option--selected { outline: 3px solid #2563eb; outline-offset: -3px; }

.selector-option--disabled { background: #f1f5f9; border-color: #e2e8f0; opacity: .65; cursor: not-allowed; }
.selector-option--disabled strong { color: #475569; }
.selector-option--disabled span { color: #94a3b8; }

.selector-actions { display: flex; justify-content: center; gap: .75rem; padding-top: .5rem; }

/* ===== Order status badges ===== */
.status-badge { display: inline-flex; align-items: center; gap: .4rem; font-size: .75rem;
    font-weight: 500; white-space: nowrap; }
.status-badge::before { content: ''; width: 7px; height: 7px; border-radius: 50%; flex-shrink: 0; }

.badge--draft { color: #64748b; }
.badge--draft::before { background: #94a3b8; }
.badge--pending { color: #a16207; }
.badge--pending::before { background: #f59e0b; }
.badge--warning { color: #c2410c; }
.badge--warning::before { background: #f97316; }
.badge--danger { color: #dc2626; }
.badge--danger::before { background: #ef4444; }
.badge--info { color: #2563eb; }
.badge--info::before { background: #3b82f6; }
.badge--primary { color: #7c3aed; }
.badge--primary::before { background: #8b5cf6; }
.badge--success { color: #15803d; }
.badge--success::before { background: #22c55e; }
.badge--muted { color: #94a3b8; }
.badge--muted::before { background: #cbd5e1; }

/* ===== Order customer header (oh-*) ===== */
.oh-card { background: #fff; border: 1px solid #e2e8f0; border-radius: 12px; overflow: hidden; margin-bottom: 1rem; }
.oh-card__head { display: flex; align-items: center; justify-content: space-between;
    padding: 1rem 1.5rem; background: #f8fafc; cursor: pointer; }
.oh-card__head-left { display: flex; align-items: center; gap: .6rem; }
.oh-card__title { font-size: 1.1rem; font-weight: 700; margin: 0; color: #0f172a; }
.oh-card__accent { height: 3px; background: #dc2626; }
.oh-card__body { padding: 1.25rem 1.5rem; display: flex; flex-direction: column; gap: 1rem; }

.oh-sub-head { display: flex; align-items: center; gap: .5rem; margin-top: .5rem; }
.oh-sub-head h3 { font-size: .95rem; font-weight: 700; margin: 0; color: #0f172a; }

.oh-grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: .75rem 1rem; }
@media (max-width: 900px) { .oh-grid-3 { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 560px) { .oh-grid-3 { grid-template-columns: 1fr; } }

.oh-field { display: flex; flex-direction: column; gap: .25rem; }
.oh-field--full { grid-column: 1 / -1; }
.oh-field__label { font-size: .72rem; color: #64748b; font-weight: 600; letter-spacing: .01em; }
.oh-field__input { background: #fff; border: 1px solid #e2e8f0; border-radius: 8px;
    padding: .55rem .75rem; font-size: .875rem; color: #1e293b; min-height: 40px;
    display: flex; align-items: center; }
.oh-field__input--ro { background: #f8fafc; color: #334155; }
.oh-field__input::placeholder { color: #94a3b8; }
.oh-field__select { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath d='M3 5l3 3 3-3' fill='none' stroke='%2364748b' stroke-width='1.5' stroke-linecap='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat; background-position: right .75rem center; padding-right: 2rem; }

.oh-divider { border: none; border-top: 1px solid #e2e8f0; margin: .25rem 0; height: 0; }

.oh-checkbox { display: flex; align-items: center; gap: .5rem; font-size: .875rem; color: #334155; cursor: pointer; }
.oh-checkbox input[type="checkbox"] { width: 18px; height: 18px; accent-color: #2563eb; }

/* ===== Order form sections ===== */
.order-section { background: #fff; border: 1px solid #e2e8f0; border-radius: 12px;
    overflow: hidden; margin-bottom: 1rem; }
.order-section__head { display: flex; align-items: center; justify-content: space-between;
    padding: 1rem 1.25rem; border-bottom: 1px solid #f1f5f9; cursor: pointer; }
.order-section__title { display: flex; align-items: center; gap: .5rem;
    font-size: 1rem; font-weight: 600; margin: 0; color: #0f172a; }
.order-section__body { padding: 1rem 1.25rem; }

.order-bu-group { margin-bottom: 1rem; }
.order-bu-group__head { display: flex; align-items: center; justify-content: space-between;
    margin-bottom: .5rem; }
.order-bu-group__name { font-weight: 600; color: #0f172a; }
.order-bu-group__count { color: #94a3b8; font-size: .8125rem; margin-left: .5rem; }

/* ===== BU Allowance / Permissions pages (Figma node 956:43752) ===== */
.bua { display: flex; flex-direction: column; gap: 16px;
    font-family: 'Sarabun', 'Segoe UI', sans-serif; color: #212121; }

.bua-head { display: flex; flex-direction: column; gap: 8px; }
.bua-title { margin: 0; font-size: 28px; font-weight: 700; line-height: 38px; color: #060d1d; }
.bua-crumbs { display: flex; align-items: center; gap: 8px; font-size: 16px; color: #64748b; }
.bua-crumbs a { color: #64748b; text-decoration: none; }
.bua-crumb-home { display: inline-flex; align-items: center; gap: 6px; }
.bua-crumbs .sep { color: #cbd5e1; }
.bua-crumbs .crumb { color: #051430; }
.bua-crumbs .crumb.current { color: #60a5fa; font-weight: 600; }

.bua-tabs { display: inline-flex; gap: 4px; padding: 4px; background: #f1f5f9;
    border-radius: 12px; }
.bua-tab { display: inline-flex; align-items: center; gap: 8px; padding: 8px 16px;
    font-size: 15px; font-weight: 500; color: #64748b; text-decoration: none;
    border-radius: 8px; }
.bua-tab:hover { color: #212121; background: #e2e8f0; }
.bua-tab.active { color: #ffffff; font-weight: 600; background: #13284f; }
.bua-tab.active:hover { background: #13284f; }

.bua-card { background: #ffffff; border: 1px solid #e2e8f0; border-radius: 16px;
    box-shadow: 0 1px 5px rgba(33, 33, 33, 0.1); overflow: hidden; }

.bua-subtabs { display: flex; flex-wrap: wrap; gap: 4px; padding: 8px 24px 0;
    border-bottom: 1px solid #e2e8f0; }
.bua-subtab { display: inline-flex; align-items: center; gap: 8px; padding: 12px 8px;
    background: none; border: none; border-bottom: 2px solid transparent; font-family: inherit;
    font-size: 16px; font-weight: 500; color: #64748b; cursor: pointer; white-space: nowrap; }
.bua-subtab:hover { color: #212121; }
.bua-subtab.active { color: #dc2626; font-weight: 600; border-bottom-color: #dc2626; }

/* Toolbar between the BU sub-tabs and the stacked feature sections (Groups per BU design). */
.bua-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 16px;
    padding: 16px 4px; }
.bua-toolbar__info { font-size: 14px; color: #64748b; }
/* Stacked feature sections need breathing room between them. */
.bua-card + .bua-toolbar, .bua-toolbar + .bua-card, .bua-card + .bua-card { margin-top: 16px; }
.bua-empty { text-align: center; color: #94a3b8; padding: 1.5rem; }
/* BU picker on the right of the section head (replaces the top BU tabs). */
.bua-butabs-row { display: flex; align-items: center; justify-content: space-between; gap: 16px;
    flex-wrap: wrap; }
.bua-headactions { display: inline-flex; align-items: center; gap: 12px; }
.bua-buselect { display: inline-flex; align-items: center; gap: 8px; }
.bua-buselect--block { display: flex; flex-direction: column; align-items: stretch; gap: 4px; }
.bua-buselect--block .filter-input { flex: none; width: 100%; min-width: 0; height: 38px; }
.bua-buselect__label { font-size: 13px; font-weight: 600; color: #64748b; }
.bua-buselect .filter-input { width: auto; min-width: 160px; }
/* Split card: feature areas as left vertical tabs, the selected area's table on the right. */
.bua-split { display: flex; align-items: stretch; }
.bua-modnav { flex: 0 0 240px; display: flex; flex-direction: column;
    border-right: 1px solid #e2e8f0; background: #f8fafc; }
.bua-modnav__info { padding: 12px 16px 4px; font-size: 13px; color: #64748b; text-align: left; }
/* Group-count badge on each BU tab. */
.bua-subtab__badge { font-size: 12px; font-weight: 600; line-height: 1; padding: 2px 8px;
    border-radius: 999px; background: #e2e8f0; color: #475569; }
.bua-subtab.active .bua-subtab__badge { background: #fee2e2; color: #dc2626; }
.bua-modnav__list { flex: 1 1 auto; overflow-y: auto; display: flex; flex-direction: column;
    gap: 2px; padding: 4px 12px 12px; }
.bua-modnav__head { display: flex; flex-direction: column; gap: 8px; padding: 12px;
    border-bottom: 1px solid #e2e8f0; }
.bua-save--block { width: 100%; justify-content: center; }
.bua-modnav__item { display: flex; align-items: center; justify-content: space-between; gap: 8px;
    padding: 10px 12px; border: none; border-radius: 8px; background: none; font-family: inherit;
    font-size: 14px; color: #475569; text-align: left; cursor: pointer; }
.bua-modnav__item:hover { background: #eef2f7; color: #212121; }
.bua-modnav__item.active { background: #13284f; color: #fff; font-weight: 600; }
.bua-modnav__count { font-size: 12px; opacity: .7; background: rgba(148, 163, 184, .25);
    border-radius: 999px; padding: 1px 8px; }
.bua-modnav__item.active .bua-modnav__count { background: rgba(255, 255, 255, .2); }
.bua-modpanel { flex: 1 1 auto; min-width: 0; }
.bua-card-head { padding: 16px 24px; }
.bua-card-head--row { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.bua-card-title { margin: 0; font-size: 24px; font-weight: 600; line-height: 32px; color: #212121; }
.bua-card-count { margin: 4px 0 0; font-size: 16px; font-weight: 700; color: #4b5760; }

.bua-table-wrap { overflow-x: auto; padding: 0 24px 24px; }
.bua-table { width: 100%; border-collapse: separate; border-spacing: 0;
    border-radius: 12px; overflow: hidden; border: 1px solid #e2e8f0; }
.bua-table thead th { background: #13284f; color: #ffffff; font-size: 16px; font-weight: 700;
    text-align: left; padding: 22px 16px; white-space: nowrap; }
.bua-table thead th.col-bu { text-align: center; width: 96px; }
.bua-table tbody td { padding: 14px 16px; font-size: 15px; border-bottom: 1px solid #eeeeee;
    vertical-align: middle; }
.bua-table tbody tr:last-child td { border-bottom: none; }
.bua-table tbody tr:hover td { background: #f8faff; }
.bua-table .cell-module { color: #64748b; }
.bua-table .cell-label { font-weight: 600; color: #212121; }
.bua-table .cell-code { color: #64748b; font-family: ui-monospace, 'Cascadia Code', monospace; font-size: 14px; }
.bua-table .cell-action { font-weight: 600; color: #212121; white-space: nowrap; }
.bua-table .cell-check { text-align: center; width: 96px; }
.bua-table .cell-check input[type="checkbox"] { width: 20px; height: 20px; accent-color: #13284f; cursor: pointer; }

.bua-actions { display: flex; align-items: center; gap: 12px; }
.bua-save { display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    height: 44px; padding: 0 28px; border: none; border-radius: 8px;
    background: #13284f; color: #ffffff; font-family: inherit; font-size: 16px; font-weight: 600; cursor: pointer; }
.bua-save:disabled { opacity: 0.6; cursor: default; }
.bua-saved { font-size: 15px; color: #16a34a; font-weight: 500; }

/* Groups per BU: master (group list) + detail (grants) inside the card */
.bua-split { display: flex; gap: 0; align-items: stretch; }
.bua-master { flex: 0 0 280px; border-right: 1px solid #e2e8f0; padding: 16px; overflow-y: auto; max-height: 640px; }
.bua-master h3 { margin: 0 0 12px; font-size: 16px; font-weight: 700; color: #212121; }
.bua-grouplist { list-style: none; margin: 0 0 16px; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.bua-groupitem { display: block; padding: 10px 12px; border-radius: 8px; text-decoration: none;
    color: #334155; font-size: 14px; cursor: pointer; border: 1px solid transparent; }
.bua-groupitem:hover { background: #f1f5f9; }
.bua-groupitem.active { background: #eef5ff; border-color: #bfdbfe; color: #1d4ed8; }
.bua-groupitem .bu { font-weight: 700; color: #051430; }
.bua-groupitem.active .bu { color: #1d4ed8; }
.bua-newgroup { display: flex; flex-direction: column; gap: 8px; border-top: 1px solid #e2e8f0; padding-top: 16px; }
.bua-newgroup h4 { margin: 0; font-size: 14px; font-weight: 600; color: #475569; }
.bua-input { height: 38px; padding: 0 12px; border: 1px solid #e2e8f0; border-radius: 8px; font-size: 14px; }
.bua-detail { flex: 1; padding: 16px 24px; overflow-y: auto; max-height: 640px; }
.bua-detail h3 { margin: 0 0 4px; font-size: 20px; font-weight: 600; color: #212121; }
.bua-modblock { margin-top: 16px; }
.bua-modblock h4 { margin: 0 0 8px; font-size: 15px; font-weight: 700; color: #13284f;
    text-transform: uppercase; letter-spacing: .5px; }
.bua-grant { display: flex; align-items: center; gap: 8px; padding: 6px 0; font-size: 14px; color: #334155; }
.bua-grant input[type="checkbox"] { width: 18px; height: 18px; accent-color: #13284f; }
.bua-error { color: #dc2626; font-size: 14px; margin: 8px 0; }
.bua-tag { font-family: ui-monospace, monospace; font-size: 12px; color: #64748b;
    background: #f1f5f9; padding: 1px 6px; border-radius: 4px; }

/* Users → Groups edit affordances inside the table */
.bua-linkbtn { background: none; border: 1px solid #cbd5e1; border-radius: 6px; padding: 4px 12px;
    font-size: 13px; color: #334155; cursor: pointer; }
.bua-linkbtn:hover { background: #f1f5f9; }
.bua-checklist { display: flex; flex-direction: column; gap: 4px; }
.bua-checklist label { display: flex; align-items: center; gap: 6px; font-size: 13px; }
.bua-preview { margin-top: 16px; padding: 16px 24px; border-top: 1px solid #e2e8f0; font-size: 14px; color: #475569; }
.bua-preview h3 { margin: 0 0 8px; font-size: 16px; color: #212121; }

/* Create-group modal */
.bua-modal-overlay { position: fixed; inset: 0; background: rgba(15, 23, 42, 0.45);
    display: flex; align-items: center; justify-content: center; z-index: 1000; }
.bua-modal { width: 100%; max-width: 440px; background: #fff; border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.25); overflow: hidden; }
.bua-modal-head { display: flex; align-items: center; justify-content: space-between;
    padding: 20px 24px; border-bottom: 1px solid #e2e8f0; }
.bua-modal-head h3 { margin: 0; font-size: 18px; font-weight: 700; color: #212121; }
.bua-modal-close { background: none; border: none; font-size: 24px; line-height: 1; color: #64748b; cursor: pointer; }
.bua-modal-close:hover { color: #212121; }
.bua-modal-body { padding: 24px; display: flex; flex-direction: column; gap: 16px; }
.bua-field { display: flex; flex-direction: column; gap: 6px; font-size: 14px; font-weight: 500; color: #334155; }
.bua-field .bua-input { height: 40px; }
.bua-modal-foot { display: flex; align-items: center; justify-content: flex-end; gap: 12px;
    padding: 16px 24px; border-top: 1px solid #e2e8f0; }
.bua-modal--wide { max-width: 720px; }
.bua-modal-split { flex-direction: row; gap: 24px; }
.bua-modal-col { flex: 1; min-width: 0; }
.bua-modal-col--preview { border-left: 1px solid #e2e8f0; padding-left: 24px; }
.bua-col-label { margin: 0 0 12px; font-size: 14px; font-weight: 700; color: #13284f;
    text-transform: uppercase; letter-spacing: .5px; }
.bua-checklist { max-height: 340px; overflow-y: auto; }
.bua-preview-stat { display: flex; gap: 24px; margin-bottom: 12px; }
.bua-preview-stat div { display: flex; flex-direction: column; }
.bua-preview-stat b { font-size: 28px; font-weight: 700; color: #13284f; line-height: 1; }
.bua-preview-stat span { font-size: 13px; color: #64748b; margin-top: 4px; }
.bua-preview-menus { font-size: 13px; color: #475569; line-height: 1.6; margin: 0; word-break: break-word; }

/* Search box in card head */
.bua-search { display: inline-flex; align-items: center; gap: 8px; height: 40px; padding: 0 12px;
    border: 1px solid #e2e8f0; border-radius: 8px; background: #fff; min-width: 260px; }
.bua-search-input { border: none; outline: none; font-family: inherit; font-size: 14px;
    color: #212121; background: none; flex: 1; min-width: 0; }

/* Pager */
.bua-pager { display: flex; align-items: center; justify-content: center; gap: 16px;
    padding: 16px 24px; border-top: 1px solid #e2e8f0; }
.bua-pager-info { font-size: 14px; color: #475569; }
.bua-linkbtn:disabled { opacity: .5; cursor: default; }

/* ===== Settings hub ===== */
.set-page { display: flex; flex-direction: column; gap: 24px;
    font-family: 'Sarabun', 'Segoe UI', sans-serif; color: #212121; }
.set-head { display: flex; flex-direction: column; gap: 4px; }
.set-title { margin: 0; font-size: 28px; font-weight: 700; line-height: 38px; color: #060d1d; }
.set-subtitle { margin: 0; font-size: 16px; color: #64748b; }

.set-section { display: flex; flex-direction: column; gap: 12px; }
.set-section-title { margin: 0; font-size: 18px; font-weight: 700; color: #13284f; }

.set-grid { display: flex; flex-direction: column; gap: 12px; }
.set-card { display: flex; align-items: center; gap: 16px; padding: 20px;
    background: #fff; border: 1px solid #e2e8f0; border-radius: 16px; text-decoration: none;
    transition: box-shadow .15s ease, border-color .15s ease, transform .15s ease; }
.set-card:hover { border-color: #bfdbfe; }
.set-ico { flex-shrink: 0; width: 48px; height: 48px; display: flex; align-items: center; justify-content: center;
    background: #eef5ff; border-radius: 12px; }
.set-card-body { display: flex; flex-direction: column; gap: 4px; flex: 1; min-width: 0; }
.set-card-title { font-size: 16px; font-weight: 600; color: #212121; }
.set-card-desc { font-size: 14px; color: #64748b; line-height: 1.4; }
.set-card-arrow { flex-shrink: 0; display: flex; align-items: center; }

/* ═══════════════════════════════════════════════════════════
   Asset History (ah-*) + Timeline (tl-*)
   Page: /assets/{id}/history
   ═══════════════════════════════════════════════════════════ */

/* ── Asset header card ── */
.ah-card { background: #fff; border: 1px solid #e2e8f0; border-radius: 10px;
    box-shadow: 0 1px 3px rgba(15,23,42,.06); margin-bottom: 16px; }
.ah-card__head { display: flex; align-items: flex-start; justify-content: space-between;
    padding: 20px 24px 0; gap: 16px; }
.ah-card__title-group { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.ah-card__title { font-size: 18px; font-weight: 700; color: #1e293b; line-height: 1.3; }
.ah-card__subtitle { font-size: 13px; color: #64748b; }

.ah-status { display: inline-flex; align-items: center; gap: 6px; padding: 4px 12px;
    border-radius: 20px; font-size: 12px; font-weight: 600; letter-spacing: .02em;
    white-space: nowrap; flex-shrink: 0; }
.ah-status__dot { width: 7px; height: 7px; border-radius: 50%; }
.ah-status--available { background: #dcfce7; color: #16a34a; }
.ah-status--available .ah-status__dot { background: #16a34a; }
.ah-status--inuse { background: #fef3c7; color: #f59e0b; }
.ah-status--inuse .ah-status__dot { background: #f59e0b; }
.ah-status--repair { background: #fef2f2; color: #dc2626; }
.ah-status--repair .ah-status__dot { background: #dc2626; }
.ah-status--transit { background: #ede9fe; color: #7c3aed; }
.ah-status--transit .ah-status__dot { background: #7c3aed; }
.ah-status--pending { background: #dbeafe; color: #2563eb; }
.ah-status--pending .ah-status__dot { background: #2563eb; }

.ah-infogrid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0;
    padding: 16px 24px 20px; }
@media (max-width: 900px) { .ah-infogrid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 560px) { .ah-infogrid { grid-template-columns: 1fr; } }

.ah-field { padding: 8px 0; }
.ah-field__label { font-size: 11px; font-weight: 600; color: #94a3b8;
    text-transform: uppercase; letter-spacing: .05em; margin-bottom: 2px; }
.ah-field__value { font-size: 14px; color: #1e293b; }
.ah-field__value--mono { font-family: "SF Mono","Cascadia Code","Fira Code",monospace;
    font-size: 12px; color: #64748b; }

.ah-scancode { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px;
    background: #f1f5f9; border: 1px solid #e2e8f0; border-radius: 6px;
    font-family: "SF Mono","Cascadia Code","Fira Code",monospace;
    font-size: 11px; color: #64748b; }
.ah-scancode__icon { font-size: 13px; opacity: .6; }

/* ── Timeline card ── */
.tl-card { background: #fff; border: 1px solid #e2e8f0; border-radius: 10px;
    box-shadow: 0 1px 3px rgba(15,23,42,.06); }
.tl-card__head { display: flex; align-items: center; justify-content: space-between;
    padding: 16px 24px; border-bottom: 1px solid #e2e8f0; }
.tl-card__title { font-size: 15px; font-weight: 700; color: #1e293b; }
.tl-card__count { font-size: 12px; color: #94a3b8; background: #f1f5f9;
    padding: 2px 10px; border-radius: 12px; font-variant-numeric: tabular-nums; }

.tl-body { padding: 4px 24px 24px; }
.tl-list { position: relative; list-style: none; }
.tl-list::before { content: ""; position: absolute; left: 15px; top: 24px; bottom: 24px;
    width: 2px; background: #e2e8f0; border-radius: 1px; }

.tl-event { position: relative; display: grid; grid-template-columns: 30px 1fr;
    gap: 16px; padding: 16px 0; }
.tl-event + .tl-event { border-top: 1px solid #f1f5f9; }

.tl-dot { width: 10px; height: 10px; border-radius: 50%; border: 2px solid #fff;
    margin-top: 5px; justify-self: center; position: relative; z-index: 1;
    box-shadow: 0 0 0 3px #fff; }
.tl-dot--qr { background: #8b5cf6; }
.tl-dot--transfer { background: #0ea5e9; }
.tl-dot--delivery { background: #22c55e; }
.tl-dot--maintenance { background: #f59e0b; }
.tl-dot--generic { background: #64748b; }

.tl-content { min-width: 0; }
.tl-header { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 4px; }
.tl-type { display: inline-flex; align-items: center; padding: 2px 8px; border-radius: 6px;
    font-size: 11px; font-weight: 600; letter-spacing: .03em; }
.tl-type--qr { background: #ede9fe; color: #8b5cf6; }
.tl-type--transfer { background: #e0f2fe; color: #0ea5e9; }
.tl-type--delivery { background: #dcfce7; color: #22c55e; }
.tl-type--maintenance { background: #fef3c7; color: #f59e0b; }
.tl-type--generic { background: #f1f5f9; color: #64748b; }

.tl-date { font-size: 12px; color: #94a3b8; font-variant-numeric: tabular-nums; }
.tl-desc { font-size: 13px; color: #64748b; line-height: 1.5; }

.tl-details { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.tl-chip { display: inline-flex; align-items: center; gap: 4px; padding: 3px 10px;
    border-radius: 6px; background: #f1f5f9; border: 1px solid #e2e8f0;
    font-size: 11px; color: #64748b; }
.tl-chip__label { font-weight: 600; color: #94a3b8; text-transform: uppercase;
    letter-spacing: .04em; margin-right: 2px; }

.tl-remark { margin-top: 6px; font-size: 12px; color: #94a3b8; font-style: italic;
    padding-left: 10px; border-left: 2px solid #e2e8f0; }

.tl-empty { text-align: center; padding: 48px 24px; color: #94a3b8; font-size: 14px; }
.tl-empty__icon { margin-bottom: 8px; opacity: .5; }
